This feature allows you to save and restore contract storage state between debug sessions.
Save the storage state after contract execution:
soroban-debug run \
--contract contract.wasm \
--function transfer \
--args '["alice", "bob", 100]' \
--export-storage storage.jsonThis creates a JSON file with the current storage state.
Load a previously saved storage state before execution:
soroban-debug run \
--contract contract.wasm \
--function get_balance \
--args '["alice"]' \
--import-storage storage.jsonYou can import initial state and export the final state in one command:
soroban-debug run \
--contract contract.wasm \
--function transfer \
--args '["alice", "bob", 100]' \
--import-storage initial_state.json \
--export-storage final_state.jsonThe storage state file uses a simple, human-readable JSON format:
{
"entries": {
"balance:alice": "1000",
"balance:bob": "500",
"total_supply": "1500",
"admin": "alice"
}
}You can manually edit this file to set up specific test scenarios.
- Reproducing Bugs: Export storage when a bug occurs, then import it to reproduce the exact state
- Testing Edge Cases: Manually create storage states that are difficult to reach through normal execution
- Regression Testing: Save storage snapshots as test fixtures
- State Transitions: Track how storage changes across multiple contract calls
See examples/storage_state.json for a sample storage state file.