-
Notifications
You must be signed in to change notification settings - Fork 699
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
Cumulus's ExportGenesisState
command does not respect custom GenesisBuilder
implementations
#2326
Comments
Also, why is it called "export genesis state"? Shouldn't it be "export genesis header" or head data or something? |
I think it was called genesis state at some point at time in the |
I'm really stuck on this issue about the custom genesis builder. My problem is when the parachain collator tries to author block number 1 (so the first "normal" block after genesis). It cannot find the parent (the genesis) in the database. And the reason is that it is looking for the wrong genesis block hash. First let's export the genesis head data manually including my fix from #2331. My debug line shows the hash of the genesis block.
Now let's use zombienet to start a network. Here are some excerpt's from the collator's logs.
My debugging logs show that the parent that we are looking for, to collate on, is not the genesis block we expected. You can't see it from these logs, but I've also confirmed that the state root and extrinsics root are both unexpected as well. This is exactly what I would expect if the collator process or relay chain was somewhere "assuming" that I used the standard genesis block builder. But I can't figure out where. The only place I could find was in the And this custom genesis builder is working fine in a stand-alone node. @bkchr, if you could help me track this down, I would be very grateful. |
Looks like you may register the wrong header on the relay chain. Best is that you check the head data in the relay chain state. |
I've been playing with this issue as well. Once the parachain is started, the output is the following: polkadot-sdk/cumulus/client/collator/src/service.rs Lines 150 to 154 in 72c4535
[Parachain] Could not find the header of the genesis block in the database! block_hash=0xafd7f546d317aa37b61562a9721505a5f5ae9ce57a2368e89e25f40b446eedab
I added the following lines to retrieve the expected hash: tracing::error!(
target: LOG_TARGET,
expected_hash = ?self.block_status.block_hash(Zero::zero()),
"We were expecting another hash.",
);
|
…make it respect custom genesis block builders (#2331) Closes #2326. This PR both fixes a logic bug and replaces an incorrect name. ## Bug Fix: Respecting custom genesis builder Prior to this PR the standard logic for creating a genesis block was repeated inside of cumulus. This PR removes that duplicated logic, and calls into the proper `BuildGenesisBlock` implementation. One consequence is that if the genesis block has already been initialized, it will not be re-created, but rather read from the database like it is for other node invocations. So you need to watch out for old unpurged data during the development process. Offchain tools may need to be updated accordingly. I've already filed paritytech/zombienet#1519 ## Rename: It doesn't export state. It exports head data. The name export-genesis-state was always wrong, nad it's never too late to right a wrong. I've changed the name of the struct to `ExportGenesisHeadCommand`. There is still the question of what to do with individual nodes' public CLIs. I have updated the parachain template to a reasonable default that preserves compatibility with tools that will expect `export-genesis-state` to still work. And I've chosen not to modify the public CLIs of any other nodes in the repo. I'll leave it up to their individual owners/maintains to decide whether that is appropriate. --------- Co-authored-by: Joshy Orndorff <git-user-email.h0ly5@simplelogin.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de>
Substrate is flexible enough that chain developers can provide their own methods for creating a genesis block. For details see the
GenesisBlockBuilder
trait docs and my Stack Exchange Question.Although Substrate has this feature, it is not widely used in the Ecosystem. As far as I know, the Tuxedo template is the first to use a Custom Genesis Block Builder. It is working great as a standalone chain. The problem comes when I try to create a parachain.
Specifically, cumulus's
ExportGenesisState
command assumes that the genesis block will not contain any extrinsics. Indeed, thegenerate_genesis_block
helper function assumes no genesis extrinsics.The text was updated successfully, but these errors were encountered: