simulate-upgrade command replays a transaction with new contract code to verify if a planned upgrade will break existing functionality.
Usage
Description
This command:- Fetches an existing transaction from the network
- Replaces the contract code with your new WASM file
- Re-simulates the transaction execution
- Reports any behavioral changes or failures
Examples
Flags
Path to the new WASM file to test
Run dead-code elimination on the WASM before simulation
Network to fetch transaction from:
testnet, mainnet, or futurenetCustom Soroban RPC URL (overrides default for network)
Workflow
Understanding the output
The simulation output shows:Common use cases
Testing bug fixes
Testing bug fixes
Verify that your bug fix resolves the issue without changing behavior for other transactions:
Performance improvements
Performance improvements
Measure the performance impact of optimizations:
Breaking change detection
Breaking change detection
Ensure API changes don’t break existing callers:
Best practices
Test multiple transactions: Don’t rely on a single transaction. Test your upgrade against a variety of real transactions to catch edge cases.
Use optimization: Always test with
--optimize to ensure the deployed WASM will behave the same as your simulation.