Companion for substrate#9732 (#678)

* state-update4 branch

* new ref

* Update to latest.

* update deps

* switch to host state version

* update

* fmt

* up

* remove trie patch

* remove patch

* fmt

* update

* set state_versions in runtimes

* state version from storage

* state version from storage

* seedling compat

* restore lock

* update lockfile for substrate

* update lockfile for polkadot

Co-authored-by: parity-processbot <>
This commit is contained in:
cheme
2021-12-24 12:28:43 +01:00
committed by GitHub
parent 7b42df10f3
commit b9ba74892a
18 changed files with 297 additions and 269 deletions
+2 -1
View File
@@ -118,6 +118,7 @@ impl RelayStateSproofBuilder {
self,
) -> (polkadot_primitives::v1::Hash, sp_state_machine::StorageProof) {
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::v1::Block>>::default_with_root();
let state_version = Default::default(); // for test using default.
let mut backend = sp_state_machine::TrieBackend::new(db, root);
let mut relevant_keys = Vec::new();
@@ -126,7 +127,7 @@ impl RelayStateSproofBuilder {
let mut insert = |key: Vec<u8>, value: Vec<u8>| {
relevant_keys.push(key.clone());
backend.insert(vec![(None, vec![(key, Some(value))])]);
backend.insert(vec![(None, vec![(key, Some(value))])], state_version);
};
insert(relay_chain::well_known_keys::ACTIVE_CONFIG.to_vec(), self.host_config.encode());
+2
View File
@@ -94,6 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
};
#[cfg(feature = "increment-spec-version")]
@@ -107,6 +108,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
};
pub const MILLISECS_PER_BLOCK: u64 = 12000;
+2 -1
View File
@@ -24,7 +24,8 @@ use sp_runtime::traits::Block as BlockT;
/// Returns the initial head data for a parachain ID.
pub fn initial_head_data(para_id: ParaId) -> HeadData {
let spec = Box::new(crate::chain_spec::get_chain_spec(para_id));
let block: Block = generate_genesis_block(&(spec as Box<_>)).unwrap();
let block: Block =
generate_genesis_block(&(spec as Box<_>), sp_runtime::StateVersion::V1).unwrap();
let genesis_state = block.header().encode();
genesis_state.into()
}