-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
Summary
Add the ability to replay transactions from mainnet (or any network) given a list of transaction signatures/hashes. This would allow developers to:
- Reproduce and debug production transactions locally
- Test protocol behavior against real historical transactions
- Analyze transaction execution in a controlled environment
Use Cases
- Debugging failed transactions - Replay a failed mainnet tx to understand what went wrong
- Protocol testing - Replay a sequence of swaps/liquidations to test protocol behavior
- MEV research - Analyze transaction execution and state changes
- Audit workflows - Reproduce specific transaction scenarios from production
Proposed Interface
# Replay a single transaction
surfpool replay <TX_HASH> -u https://api.mainnet-beta.solana.com
# Replay multiple transactions from a file
surfpool replay --from-file tx_hashes.txt -u mainnet
# Replay with profiling output
surfpool replay <TX_HASH> -u mainnet --profile --output results.json
Or as a cheatcode RPC method:
{
"method": "surfnet_replayTransaction",
"params": {
"signature": "5K2...",
"profile": true
}
}
Workflow:
- Fetch transaction via getTransaction (with maxSupportedTransactionVersion)
- Extract slot number and all account keys (including ALT lookups)
- Fetch account states at that slot using getMultipleAccounts
- Clone any missing programs
- Set time to transaction's block time via surfnet_timeTravel
- Execute via surfnet_profileTransaction or sendTransaction
- Return execution results (logs, CUs, state changes)
Related
-> Existing surfnet_profileTransaction cheatcode provides the execution infrastructure
-> surfnet_setAccount can be used to set up pre-execution state
-> Consider integration with scenarios for replaying transaction sequences
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels