Conversation
… rupansh/simul-txn
Make simulateTransaction safe for any user-submitted transaction. * Missing accounts: the SIMD-186 loader panicked on absent pubkeys. Now returns an empty System-owned default (matches Agave), so transactions that create new accounts can simulate. * Malformed transactions: added Agave-style sanitize that rejects zero/insufficient signatures, signatures > keys, out-of-range program/account indices, too many instructions (feature-gated), and the no-writable-signer case. All return SanitizeFailure. * Address lookup tables resolved on the simulate path so versioned transactions work end-to-end. * JSON wire format: TransactionError marshals to Agave's exact shape — bare string for unit variants, single-key object for tuple variants like InstructionError. * Rent sysvar load failure and fees.go no-fee-payer panics are now clean error returns. * Stake program: fix variable shadowing that silently dropped a rent sysvar read error.
* Pass-1 accountsdb fallback in loadAndValidateTxAcctsSimd186: per-block MemAccounts only holds accounts the block's txs reference, so System Program and other native programs are often missing on the simulate path. Fall back to slotCtx.AccountsDb before fabricating a default; matches the existing Pass-2 program fallback pattern. * IsTransactionAgeValid accountsdb fallback for durable-nonce txs: when a user simulates a nonce-based tx without replaceRecentBlockhash, the nonce account isn't in MemAccounts. Same fallback pattern as Pass-1 so the on-chain nonce state is consulted instead of returning BlockhashNotFound. * CalculateAndDeductTxFees: thread isSimulation through. Simulate returns the error cleanly to the RPC client; block-replay keeps the panic on a sanitize-bypass invariant break, preserving the loud operator-visible signal. * Sanitize-block comment trim in transaction_processing_pure.go.
* fees: assert simulate returns err while block-replay panics with diagnostic context on a missing fee payer. * sealevel: assert IsTransactionAgeValid returns true when the nonce account is in MemAccounts and false safely when both MemAccounts and AccountsDb are unavailable. * replay: Go fuzz test that drives random tx shapes through LoadAndExecuteTransaction and asserts no panics. Covers sanitize, loader, and fees branches.
Koro/simul txn fixes
- Strict response shape: all 14 RpcSimulateTransactionResult fields with correct nil/empty/null distinctions - Custom JSON-RPC errors: -32602 InvalidParams, -32016 MinContextSlotNotReached with structured contextSlot data - Inner instruction recording with stackHeight (Option<u32>), preserved across InstructionError paths via AssembleInnerInstructions - SPL Token + Token-2022 balance decoding with precise uiAmountString for high-decimals tokens (no float saturation) - Pre/post account snapshots for token balance pre-state - accounts.encoding base58/binary rejection - too-many-accounts cap uses post-ALT-resolved key count - ALT resolve before sigVerify so sigVerify-fail responses carry resolved loadedAddresses - PACKET_DATA_SIZE encoded-length cap matching Agave constants - Log + return-data clamping to spec limits (10KB / 1KB) Live-verified A-to-Z (48/48) against real mainnet CPI swaps, Token-2022 txs, ALT-using txs, vote txs, sigVerify-fail paths, and 50-parallel concurrent simulates. Block-replay running cleanly across 400+ slots with these changes.
feat(rpcserver): Agave-parity simulateTransaction wire format
smcio
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
simulateTransaction rpc should have feature parity with agave (https://solana.com/docs/rpc/http/simulatetransaction)
quick js script to test: https://github.com/rupansh/solana-sim-txn/tree/master