diff --git a/evm-template/Cargo.toml b/evm-template/Cargo.toml index 5529907..4b24f95 100644 --- a/evm-template/Cargo.toml +++ b/evm-template/Cargo.toml @@ -31,6 +31,7 @@ smallvec = "1.11.0" frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } +frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } diff --git a/evm-template/runtime/Cargo.toml b/evm-template/runtime/Cargo.toml index da024aa..cf020d7 100644 --- a/evm-template/runtime/Cargo.toml +++ b/evm-template/runtime/Cargo.toml @@ -20,6 +20,7 @@ smallvec = { workspace = true } # Substrate frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } @@ -128,6 +129,7 @@ std = [ "fp-self-contained/std", "frame-benchmarking?/std", "frame-executive/std", + "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-benchmarking?/std", "frame-system-rpc-runtime-api/std", @@ -185,7 +187,7 @@ std = [ "xcm/std", ] async-backing = [] - +metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] runtime-benchmarks = [ "assets-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", diff --git a/evm-template/runtime/build.rs b/evm-template/runtime/build.rs index b0ab6fa..b7a03bf 100644 --- a/evm-template/runtime/build.rs +++ b/evm-template/runtime/build.rs @@ -1,10 +1,13 @@ -#[cfg(feature = "std")] +#[cfg(all(not(feature = "metadata-hash"), feature = "std"))] fn main() { - substrate_wasm_builder::WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + substrate_wasm_builder::WasmBuilder::build_using_defaults(); +} + +#[cfg(all(feature = "metadata-hash", feature = "std"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("UNIT", 12) + .build(); } /// The wasm builder is deactivated when compiling diff --git a/evm-template/runtime/src/types.rs b/evm-template/runtime/src/types.rs index ce5ae83..1317239 100644 --- a/evm-template/runtime/src/types.rs +++ b/evm-template/runtime/src/types.rs @@ -75,6 +75,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, ); diff --git a/generic-template/Cargo.toml b/generic-template/Cargo.toml index cd89ca0..dfe8d5e 100644 --- a/generic-template/Cargo.toml +++ b/generic-template/Cargo.toml @@ -29,6 +29,7 @@ smallvec = "1.11.0" frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } +frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" } diff --git a/generic-template/runtime/Cargo.toml b/generic-template/runtime/Cargo.toml index 6747f56..e4bccb4 100644 --- a/generic-template/runtime/Cargo.toml +++ b/generic-template/runtime/Cargo.toml @@ -20,6 +20,7 @@ smallvec = { workspace = true } # Substrate frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } @@ -105,6 +106,7 @@ std = [ "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", + "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-benchmarking?/std", "frame-system-rpc-runtime-api/std", @@ -157,7 +159,7 @@ std = [ "xcm/std", ] async-backing = [] - +metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] runtime-benchmarks = [ "assets-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", diff --git a/generic-template/runtime/build.rs b/generic-template/runtime/build.rs index b0ab6fa..b7a03bf 100644 --- a/generic-template/runtime/build.rs +++ b/generic-template/runtime/build.rs @@ -1,10 +1,13 @@ -#[cfg(feature = "std")] +#[cfg(all(not(feature = "metadata-hash"), feature = "std"))] fn main() { - substrate_wasm_builder::WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + substrate_wasm_builder::WasmBuilder::build_using_defaults(); +} + +#[cfg(all(feature = "metadata-hash", feature = "std"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("UNIT", 12) + .build(); } /// The wasm builder is deactivated when compiling diff --git a/generic-template/runtime/src/types.rs b/generic-template/runtime/src/types.rs index 1c7a1e6..048233e 100644 --- a/generic-template/runtime/src/types.rs +++ b/generic-template/runtime/src/types.rs @@ -70,6 +70,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, );