From 281d58cb0dae352379b96a85c9f1f344119348a6 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 3 Nov 2021 10:12:50 +0100 Subject: [PATCH] Add a `trie_root_hash` variant for chain specs genesis (#10140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a `hash` variant for chain specs * Add doc * Rename to TrieRootHash * Apply suggestions from code review Co-authored-by: Bastian Köcher * Rustfmt * More cargo fmt I guess * Ok I have to use nightly cargo fmt Co-authored-by: Bastian Köcher --- substrate/client/chain-spec/src/chain_spec.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/substrate/client/chain-spec/src/chain_spec.rs b/substrate/client/chain-spec/src/chain_spec.rs index 2ddb56a0df..4aa0aa7463 100644 --- a/substrate/client/chain-spec/src/chain_spec.rs +++ b/substrate/client/chain-spec/src/chain_spec.rs @@ -119,6 +119,10 @@ impl BuildStorage for ChainSpec { }) .collect(), }), + // The `StateRootHash` variant exists as a way to keep note that other clients support + // it, but Substrate itself isn't capable of loading chain specs with just a hash at the + // moment. + Genesis::StateRootHash(_) => Err("Genesis storage in hash format not supported".into()), } } @@ -144,6 +148,8 @@ pub struct RawGenesis { enum Genesis { Runtime(G), Raw(RawGenesis), + /// State root hash of the genesis storage. + StateRootHash(StorageData), } /// A configuration of a client. Does not include runtime storage initialization.