There's a PR open on the stellar-cli that contains a new ledger snapshot subcommand:
The command generates a snapshot given a ledger sequence number, and that snapshot can be loaded into contract tests as a beginning state for the test to start with.
The goal is to make it possible to write tests that interact with complex production state, either for debugging or for writing tests that cover complex scenarios.
Feedback appreciated on the feature before it is release.
You can try it out by installing from source:
cargo install --locked --git https://github.com/stellar/stellar-cli --branch snap stellar-cli
Then run a command like this to create a snapshot:
stellar snapshot --contract-id CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75 --out snapshot.json
Demo: https://www.youtube.com/watch?v=mnY7AMm8MRk
PR https://github.com/stellar/stellar-cli/pull/1368
Install from source from the pull request with:
cargo install --locked --git https://github.com/stellar/stellar-cli --branch snap stellar-cli
Thinking about what we can do to make this less confusing.