Closed hackfisher closed 9 months ago
What will happen if the new parachain will start it's genesis blocknumber from 0?
The side effect of this to smart contracts, a lots of state and value are recording the block number for business level usage.
Can genesis number been non zero?
If the genesis block number is not start from zero, we might need to mork web3 rpc api for those blocknumbers before genesis:
https://web3js.readthedocs.io/en/v1.3.4/web3-eth.html#getblock
理想的方式应该是直接基于原来的trie db,但是一个新链怎么基于一个旧的trie db启动?
区别是如果基于genesis state,那么之前的历史区块state会被丢失。
https://github.com/darwinia-network/darwinia/wiki/Substrate-Chain-State-Generate-Tools
If we use fork-off-substrate
to export the chain state and skip the System
pallet storages, then the genesis block number might be reset and start from zero.
Further question, we might be able to keep block_number related storages in System
, and start from some non-zero block height as genesis height?
Transfer to research repo and wait for further solution from Polkadot.
We can start draft a summary document about the solution:
Using fork-off-substrate, scraping the on-chain data, and customize according to the parachain requirement.
The hot-swap requirements are also from the bridge network connecting to relay chains, if we want to use Crab/Darwinia directly as parachain:
One approach will be using bridge messages to migrate the state of solo chain to the parachain, instead of current approach of hot-swap, how generate the genesis state from solo-chain(Have to stop the solo-chain which is unacceptable).
If parachain deployment does not support hot-swap in fly, then for an existing substrate chain being able to connect to relay chain, it will need to prepare genesis state data for collators and prepare genesis header for parachain auction.
We need to have solutions to generate this genesis state and genesis header for parachain.
And btw, how to stop an existing chain by upgrade runtime/client. (A tricky but simple way to stop produce/finalize new blocks). Since not all the clients will upgrade(they might do not agree with the parachain plan), an onchain governance through runtime upgrade is necessary.