diff --git a/Cargo.toml b/Cargo.toml index 7889acc97..3046125bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk. frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false } frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false } polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false } +frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false } sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52" } sc-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52" } diff --git a/runtimes/bulletin-polkadot/Cargo.toml b/runtimes/bulletin-polkadot/Cargo.toml index 43e7065cc..afa33bb4c 100644 --- a/runtimes/bulletin-polkadot/Cargo.toml +++ b/runtimes/bulletin-polkadot/Cargo.toml @@ -20,6 +20,7 @@ frame-executive = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } frame-try-runtime = { workspace = true, optional = true } +frame-metadata-hash-extension = { workspace = true } pallet-authorship = { workspace = true } pallet-babe = { workspace = true } pallet-grandpa = { workspace = true } @@ -235,3 +236,7 @@ try-runtime = [ "parachains-common?/try-runtime", "sp-runtime/try-runtime", ] + + +# Enable the metadata hash generation in the wasm builder. +metadata-hash = ["substrate-wasm-builder/metadata-hash"] diff --git a/runtimes/bulletin-polkadot/build.rs b/runtimes/bulletin-polkadot/build.rs index bb05afe02..03b01d79d 100644 --- a/runtimes/bulletin-polkadot/build.rs +++ b/runtimes/bulletin-polkadot/build.rs @@ -1,4 +1,11 @@ -#[cfg(feature = "std")] +#[cfg(all(feature = "std", feature = "metadata-hash"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("", 0) + .build(); +} + +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] fn main() { substrate_wasm_builder::WasmBuilder::build_using_defaults(); } diff --git a/runtimes/bulletin-polkadot/src/lib.rs b/runtimes/bulletin-polkadot/src/lib.rs index f686e0af6..11ade7b7b 100644 --- a/runtimes/bulletin-polkadot/src/lib.rs +++ b/runtimes/bulletin-polkadot/src/lib.rs @@ -600,6 +600,21 @@ generate_bridge_reject_obsolete_headers_and_messages! { } /// The SignedExtension to the basic transaction logic. +#[cfg(all(feature = "std", feature = "metadata-hash"))] +pub type TxExtension = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + ValidateSigned, + BridgeRejectObsoleteHeadersAndMessages, + frame_metadata_hash_extension::CheckMetadataHash, +); + +#[cfg(not(all(feature = "std", feature = "metadata-hash")))] pub type TxExtension = ( frame_system::CheckNonZeroSender, frame_system::CheckSpecVersion, diff --git a/runtimes/bulletin-polkadot/tests/tests.rs b/runtimes/bulletin-polkadot/tests/tests.rs index 1736cd657..69f8e17df 100644 --- a/runtimes/bulletin-polkadot/tests/tests.rs +++ b/runtimes/bulletin-polkadot/tests/tests.rs @@ -49,13 +49,13 @@ fn construct_extrinsic( frame_system::CheckEra::::from(Era::immortal()), frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, - ) - .into(), + ), frame_system::CheckWeight::::new(), runtime::ValidateSigned, runtime::BridgeRejectObsoleteHeadersAndMessages, - ) - .into(); +#[cfg(all(feature = "std", feature = "metadata-hash"))] + frame_metadata_hash_extension::CheckMetadataHash::::new(true), + ); let payload = SignedPayload::new(call.clone(), tx_ext.clone())?; let signature = payload.using_encoded(|e| sender.sign(e)); Ok(UncheckedExtrinsic::new_signed(