Skip to content

Commit

Permalink
Use runtime state version in child trie root calculation (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 authored Feb 10, 2025
1 parent 5cca21f commit d06c6e2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ismp-grandpa = { version = "16.0.0", path = "./modules/ismp/clients/grandpa", de
ismp-parachain = { version = "16.0.0", path = "./modules/ismp/clients/parachain/client", default-features = false }
ismp-parachain-inherent = { version = "16.0.0", path = "./modules/ismp/clients/parachain/inherent" }
ismp-parachain-runtime-api = { version = "16.0.0", path = "./modules/ismp/clients/parachain/runtime-api", default-features = false }
pallet-ismp = { version = "16.0.0", path = "modules/pallets/ismp", default-features = false }
pallet-ismp = { version = "16.1.0", path = "modules/pallets/ismp", default-features = false }
pallet-ismp-rpc = { version = "16.0.0", path = "modules/pallets/ismp/rpc" }
pallet-ismp-runtime-api = { version = "16.0.0", path = "modules/pallets/ismp/runtime-api", default-features = false }
pallet-hyperbridge = { version = "16.0.0", path = "modules/pallets/hyperbridge", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion modules/pallets/ismp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-ismp"
version = "16.0.0"
version = "16.1.0"
edition = "2021"
authors = ["Polytope Labs <[email protected]>"]
license = "Apache-2.0"
Expand Down
11 changes: 7 additions & 4 deletions modules/pallets/ismp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,13 @@ pub mod pallet {
<T as frame_system::Config>::Hash: From<H256>,
{
fn on_finalize(_n: BlockNumberFor<T>) {
let child_trie_root = storage::child::root(
&ChildInfo::new_default(CHILD_TRIE_PREFIX),
sp_core::storage::StateVersion::V0,
);
let state_version = <T as polkadot_sdk::frame_system::Config>::Version::get()
.state_version
.try_into()
.unwrap_or_default();

let child_trie_root =
storage::child::root(&ChildInfo::new_default(CHILD_TRIE_PREFIX), state_version);

let child_trie_root = H256::from_slice(&child_trie_root);
ChildTrieRoot::<T>::put::<T::Hash>(child_trie_root.into());
Expand Down
2 changes: 1 addition & 1 deletion parachain/runtimes/gargantua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("gargantua"),
impl_name: create_runtime_str!("gargantua"),
authoring_version: 1,
spec_version: 1_900,
spec_version: 2_200,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
2 changes: 1 addition & 1 deletion parachain/runtimes/nexus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("nexus"),
impl_name: create_runtime_str!("nexus"),
authoring_version: 1,
spec_version: 2_400,
spec_version: 2_500,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit d06c6e2

Please sign in to comment.