1

What contents of a non-raw chain spec can be added or altered without mutating the derived genesis hash? More specifically, does changing a pallet's genesis configuration in the spec lead to a different genesis hash?

Context: Say a test-network halts and requires codeSubstitutes addition in the chain spec. However, upon restarting with the altered spec, the client throws with

Error: Input("\"Error parsing embedded file: unknown field `interestAccrual`, expected one of `system`, `parachainSystem`, `parachainInfo`, `balances`, `collatorSelection`, `session`, `aura`, `auraExt`, `council`, `elections`, `democracy`, `vesting`, `treasury`, `fees`, `collatorAllowlist`, `blockRewardsBase`, `blockRewards`, `liquidityRewardsBase`, `polkadotXcm`, `ormlTokens`, `ormlAssetRegistry`, `evm`, `evmChainId`, `baseFee`, `ethereum` at line 193 column 24\"")

because some pallets' genesis configurations have changed in between the testnet's genesis and now such that the GenesisBuild storage behaves differently. This problem can be solved by updating/removing the erroneous pallets' configurations/storages in the spec. However, that does not appear to be the correct approach as I fear it will lead to a different genesis hash.

Shouldn't the genesis.runtime.system.code be used automatically to not run into the stated compiler error?

1 Answer 1

1

The genesis hash is the hash of the genesis storage. So changing a pallet's genesis configuration (genesis storage) will indeed result in a different genesis hash.

When launching a node to your network with codeSubstitutes it needs the same genesis state as how the network was initially launched. In other words, don't modify the chainspec aside from including a new validation function in codeSubstitutes.

4
  • Thanks! But how to resolve the above client error message above then? It appears to me that the client version from the original genesis spec needs to be run with the codeSubstitutes addition? I would have thought even newer clients would still execute the wasm from genesis.runtime.system.code. However that is not the case. Commented Sep 12, 2023 at 9:20
  • You simply take the original chainspec that you used to at launch and add the codesubstitutes. Don't try to build it again from scratch. Commented Sep 12, 2023 at 10:54
  • That part is clear to me. But when you want to use this chain spec with a newer client version, the client can throw the above error message if any pallet's GenesisBuild has changed. Say the chain launched 2021 and two years later you need to add codeSubstitutes. The current client version won't run with the spec. So what can you do apart from building (i.e. docker image) a client based on 2021 with the altered chain spec? Commented Sep 12, 2023 at 13:01
  • May be related, see comments here: substrate.stackexchange.com/questions/9949/…
    – Bruno
    Commented Sep 16, 2023 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.