Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Dump state into new genesis file #2116

Closed
atenjin opened this issue Mar 26, 2019 · 8 comments
Closed

Dump state into new genesis file #2116

atenjin opened this issue Mar 26, 2019 · 8 comments
Labels
J0-enhancement An additional feature request.
Milestone

Comments

@atenjin
Copy link
Contributor

atenjin commented Mar 26, 2019

I think substrate may need a checkpoint feature.
it could be used in follow situation

  • sync block from some checkpoint, not from genesis
  • could export all key/value from some checkpoint(or could export all node's key in trie tree for checkpoint state root), and then, could use this exported key/value or other data be a new genesis. Using this exported data, we could restart a new chain to recover from some crisis problem(though, it's very ugly, but it maybe a final plan, just like what cosmos recently do, cosmos export data from 425000, change code, start a new chain. link )
  • maybe others...
@xlc
Copy link
Contributor

xlc commented Mar 26, 2019

Another similar feature I want is able to generate genesis file from current state. This means I can configure the testing environment once (deposit funds, deploy smart contract, doing configuration that is not possible with GenesisConfig, etc) and make a genesis file from it, and reuse it.

@rphmeier rphmeier added the J0-enhancement An additional feature request. label Mar 27, 2019
@rphmeier rphmeier added this to the 1.x series milestone Mar 27, 2019
@tomaka
Copy link
Contributor

tomaka commented Jul 24, 2019

Note that it is already possible to export and import blocks out of/into the database, if that's what this issue is about.

@gavofyork gavofyork changed the title need checkpoint feature for sync block or recover from crisis situation Dump state into new genesis file Nov 28, 2019
@gavofyork gavofyork modified the milestones: 2.x series, As-and-when Nov 28, 2019
@apopiak
Copy link
Contributor

apopiak commented Oct 26, 2020

The substrate export-state subcommand introduced in #5842 should solve this, right?

@bkchr
Copy link
Member

bkchr commented Oct 26, 2020

Not entirely. We still don't have checkpoints.

@atenjin
Copy link
Contributor Author

atenjin commented May 9, 2022

The substrate export-state subcommand introduced in #5842 should solve this, right?

not the full feature. for now, the export-state just can start the new chain from 0 height. but in fact, the best way is to start the new chain with the same height.

I think it needs a lot of modification for substrate backend part, and related to some consensus part.

@takahser
Copy link
Contributor

According to Kusama Network's YouTube video Part 1: How to Register a Parachain on Polkadot and Kusama it should be possible to generate the genesis file and the runtime wasm file by running the following command:

image

I tried that using the node-template however, I got an error:

$ ./node-template export-genesis-state --parachain-id 21; ./node-template export-genesis-wasm > wasmfile
error: The subcommand 'export-genesis-state' wasn't recognized

	Did you mean 'export-blocks' or 'export-state'?

Also, when I try to run the suggested command, the parachain-id arg is not recognized:

 % ./node-template export-state --parachain-id 2225;
error: Found argument '--parachain-id' which wasn't expected, or isn't valid in this context

So my questions are:

  1. What's the correct command for exporting the genesis state?

  2. Also, what's the correct command for exporting the runtime wasm, since the export-genesis-wasm command is not recognized at all?

    % ./node-template export-genesis-wasm > wasmfile
    error: The subcommand 'export-genesis-wasm' wasn't recognized

@bkchr
Copy link
Member

bkchr commented Oct 4, 2022

@takahser you need to use the parachain node template.

@kianenigma
Copy link
Contributor

This seems existent with the export-state subcommand, it is just a matter of using it right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

9 participants