Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for inline generated snapshots #1318

Open
leighmcculloch opened this issue Aug 16, 2024 · 0 comments
Open

Add support for inline generated snapshots #1318

leighmcculloch opened this issue Aug 16, 2024 · 0 comments

Comments

@leighmcculloch
Copy link
Member

What problem does your feature solve?

Using stellar snapshot create allows a developer to pre-create a snapshot rather efficiently, assuming that the developer knows exactly what data they need in the snapshot. We've made it somewhat easy by prefilling related data for developers, so when they ask for a contract, we prefill all its data and its code. But it could be much easier if in a developer could write one line, with a network name and a ledger sequence, and for the SDK to build the snapshot as required by the test itself.

What would you like to see?

A new function added to Env, Env::from_history_archive("testnet", 12798787) that creates an Env that first downloads the buckets for that ledger from history archives.

It is also setup with a storage snapshot implementation that searches the bucket files for the ledger entries as they are requested, and does two levels of caching.

First it caches keys to entries by storing the entry in a file with name defined by a hash of the network, ledger seq, and key so that entries can be looked up fast by other tests that access the same entry. Second at the end of the test it writes out a ledger snapshot file containing all the entries that were read during the test with the values at the first read (just like the file that stellar snapshot create makes).

What alternatives are there?

Stick with stellar snapshot create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@leighmcculloch and others