paritytech / paritytech/try-runtime-cli
Disk-backed externalities
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Original issue https://github.com/paritytech/substrate/issues/14076
Prelude
Discussion in https://github.com/paritytech/substrate/issues/13562 expanded to include various topics other than lazy-download, including improving general performance and using a disk-backed database.
I am creating this issue to separate the discussion and progress around allowing the try-runtime-cli to accept a DB path for reading state, rather than loading all state into memory.
Motivation
Creating snapshots and loading state into memory is not a significant issue for chains like Polkadot and Kusama, but it can be for heavier-weight chains like Moonbeam with extensive state.
On these heavy chains:
- It takes a long time to create a snapshot, and the snapshot size is considerable.
- The state might not fit into memory, depending on the chain and machine specifications.
- It would provide a much better developer experience for using try-runtime-cli with these chains if developers could skip worrying about that and just specify the path to their existing database instead.
Implementation ideas
TestExternalitiescurrently has a hardcodedInMemoryBackendas a generic parameter. However, that could be updated to a more genericsp_state_machine::Backend.- Once that change is made, we should be able to use either an
InMemoryBackendorDiskDbBackend(which is already implemented in fudge) inTestExternalities. - We can add a new
Modetoremote-externalitiescalled something likeDisk, so we would haveOnline,Offline(perhaps rename this toSnap), andDisk. - Finally, we can update the CLI to accept
live,snap, and a new optiondbwhen specifying where to get state. If the user choosesdb, they pass the path, and theTestExternalitieswill be initialized with aDiskDbBackendinstead of theInMemoryBackend.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with TestExternalities, its hardcoded InMemoryBackend parameter, and the remote-externalities Mode handling described in the issue. Review the sp_state_machine::Backend interface and the existing DiskDbBackend implementation in fudge, then trace how the CLI currently selects live and snap state sources. Done means a database path can select disk-backed state without loading the full snapshot into memory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, databases, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100