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

Make the genesis block building more flexible #10360

@liuchengxu

Description

@liuchengxu

The background is that we want to inject a DigestItem into the header of the genesis block, I thought calling frame_system::deposit_log() in genesis build should work, but it's not because right now only the genesis storage/state is taken care of and the genesis Digest is hardcoded as the default value.

Since we already have built the genesis storage, we could extract the Digest value from the state and extend construct_genesis_block(state_root, digest) using it, so that people can use frame_system::deposit_log() during the genesis build as normal.

let genesis_storage =
build_genesis_storage.build_storage().map_err(sp_blockchain::Error::Storage)?;
let mut op = backend.begin_operation()?;
let state_root = op.set_genesis_state(genesis_storage, !config.no_genesis)?;
let genesis_block = genesis::construct_genesis_block::<Block>(state_root.into());

By adding this feature, people can have full control of building the genesis block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions