diff --git a/Cargo.lock b/Cargo.lock
index 9e7440541..52b17fed8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1063,6 +1063,7 @@ dependencies = [
"cumulus-primitives-utility",
"frame-benchmarking",
"frame-executive",
+ "frame-metadata-hash-extension",
"frame-support",
"frame-system",
"frame-system-benchmarking",
@@ -1217,6 +1218,7 @@ dependencies = [
"cumulus-primitives-utility",
"frame-benchmarking",
"frame-executive",
+ "frame-metadata-hash-extension",
"frame-support",
"frame-system",
"frame-system-benchmarking",
@@ -4544,6 +4546,22 @@ dependencies = [
"serde",
]
+[[package]]
+name = "frame-metadata-hash-extension"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bb1eec9eb46d3e016c95b2fa875118c04609f2150013c56a894cae00581e265"
+dependencies = [
+ "array-bytes 6.2.2",
+ "docify",
+ "frame-support",
+ "frame-system",
+ "log",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-runtime",
+]
+
[[package]]
name = "frame-remote-externalities"
version = "0.36.0"
@@ -5299,7 +5317,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
- "windows-core 0.52.0",
+ "windows-core",
]
[[package]]
@@ -6696,6 +6714,20 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "merkleized-metadata"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f313fcff1d2a4bcaa2deeaa00bf7530d77d5f7bd0467a117dde2e29a75a7a17a"
+dependencies = [
+ "array-bytes 6.2.2",
+ "blake3",
+ "frame-metadata",
+ "parity-scale-codec",
+ "scale-decode",
+ "scale-info",
+]
+
[[package]]
name = "merlin"
version = "3.0.0"
@@ -12464,6 +12496,29 @@ dependencies = [
"sp-arithmetic",
]
+[[package]]
+name = "scale-bits"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e57b1e7f6b65ed1f04e79a85a57d755ad56d76fdf1e9bddcc9ae14f71fcdcf54"
+dependencies = [
+ "parity-scale-codec",
+ "scale-type-resolver",
+]
+
+[[package]]
+name = "scale-decode"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27"
+dependencies = [
+ "derive_more",
+ "parity-scale-codec",
+ "scale-bits",
+ "scale-type-resolver",
+ "smallvec",
+]
+
[[package]]
name = "scale-info"
version = "2.11.2"
@@ -12490,6 +12545,12 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "scale-type-resolver"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0cded6518aa0bd6c1be2b88ac81bf7044992f0f154bfbabd5ad34f43512abcb"
+
[[package]]
name = "schannel"
version = "0.1.23"
@@ -14231,16 +14292,25 @@ dependencies = [
[[package]]
name = "substrate-wasm-builder"
-version = "18.0.0"
+version = "18.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "511bbc2df035f5fe2556d855369a1bbb45df620360391a1f6e3fa1a1d64af79a"
+checksum = "4a39a20e17c24ede36b5bd5e7543a4cef8d8a0daf6e1a046dc31832b837a54a0"
dependencies = [
+ "array-bytes 6.2.2",
"build-helper",
"cargo_metadata",
"console",
"filetime",
+ "frame-metadata",
+ "merkleized-metadata",
+ "parity-scale-codec",
"parity-wasm",
+ "sc-executor",
+ "sp-core",
+ "sp-io",
"sp-maybe-compressed-blob",
+ "sp-tracing",
+ "sp-version",
"strum 0.24.1",
"tempfile",
"toml 0.8.12",
@@ -15775,7 +15845,7 @@ version = "0.51.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
dependencies = [
- "windows-core 0.51.1",
+ "windows-core",
"windows-targets 0.48.5",
]
@@ -15788,15 +15858,6 @@ dependencies = [
"windows-targets 0.48.5",
]
-[[package]]
-name = "windows-core"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
-dependencies = [
- "windows-targets 0.52.5",
-]
-
[[package]]
name = "windows-sys"
version = "0.45.0"
diff --git a/Cargo.toml b/Cargo.toml
index 36d17fcee..91352c831 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -132,6 +132,7 @@ cumulus-primitives-utility = { version = "0.8.0", default-featur
cumulus-test-relay-sproof-builder = { version = "0.8.0", default-features = false }
frame-benchmarking = { version = "29.0.0", default-features = false }
frame-executive = { version = "29.0.0", default-features = false }
+frame-metadata-hash-extension = { version = "0.1.0", default-features = false }
frame-support = { version = "29.0.0", default-features = false }
frame-system = { version = "29.0.0", default-features = false }
frame-system-benchmarking = { version = "29.0.0", default-features = false }
@@ -264,7 +265,7 @@ sp-rpc = { version = "27.0.0" }
substrate-build-script-utils = { version = "11.0.0" }
substrate-frame-rpc-system = { version = "29.0.0" }
substrate-prometheus-endpoint = { version = "0.17.0" }
-substrate-wasm-builder = { version = "18.0.0" }
+substrate-wasm-builder = { version = "18.0.1" }
try-runtime-cli = { version = "0.39.0" }
xcm-emulator = { version = "0.6.0" }
xcm-simulator = { version = "8.0.0" }
diff --git a/runtime/bifrost-kusama/Cargo.toml b/runtime/bifrost-kusama/Cargo.toml
index fee68ce52..95cf2c1be 100644
--- a/runtime/bifrost-kusama/Cargo.toml
+++ b/runtime/bifrost-kusama/Cargo.toml
@@ -21,6 +21,7 @@ serde_json = { workspace = true }
# frame dependencies
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
+frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true, features = ["tuples-96"] }
frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
@@ -159,6 +160,7 @@ std = [
"frame-benchmarking?/std",
"frame-executive/std",
+ "frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
@@ -397,6 +399,8 @@ try-runtime = [
"bifrost-channel-commission/try-runtime",
]
+# Enable the metadata hash generation in the wasm builder.
+metadata-hash = ["substrate-wasm-builder/metadata-hash"]
# When enabled, the runtime API will not be build.
#
# This is required by Cumulus to access certain types of the
@@ -407,7 +411,7 @@ disable-runtime-api = []
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
-on-chain-release-build = ["sp-api/disable-logging"]
+on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = []
diff --git a/runtime/bifrost-kusama/build.rs b/runtime/bifrost-kusama/build.rs
index a6d8f457d..24206c333 100644
--- a/runtime/bifrost-kusama/build.rs
+++ b/runtime/bifrost-kusama/build.rs
@@ -16,7 +16,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#[cfg(feature = "std")]
+#[cfg(all(feature = "metadata-hash", feature = "std"))]
+fn main() {
+ substrate_wasm_builder::WasmBuilder::new()
+ .with_current_project()
+ .export_heap_base()
+ .import_memory()
+ .enable_metadata_hash("BNC", 12)
+ .build()
+}
+
+#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs
index dbd25ac53..3b06312c0 100644
--- a/runtime/bifrost-kusama/src/lib.rs
+++ b/runtime/bifrost-kusama/src/lib.rs
@@ -923,6 +923,7 @@ where
frame_system::CheckNonce::::from(nonce),
frame_system::CheckWeight::::new(),
pallet_transaction_payment::ChargeTransactionPayment::::from(tip),
+ frame_metadata_hash_extension::CheckMetadataHash::::new(true),
);
let raw_payload = SignedPayload::new(call, extra)
.map_err(|e| {
@@ -2030,6 +2031,7 @@ pub type SignedExtra = (
frame_system::CheckNonce,
frame_system::CheckWeight,
pallet_transaction_payment::ChargeTransactionPayment,
+ frame_metadata_hash_extension::CheckMetadataHash,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml
index c30f52443..fba01fcc1 100644
--- a/runtime/bifrost-polkadot/Cargo.toml
+++ b/runtime/bifrost-polkadot/Cargo.toml
@@ -21,6 +21,7 @@ serde_json = { workspace = true }
# frame dependencies
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
+frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true, features = ["tuples-96"] }
frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
@@ -156,6 +157,7 @@ std = [
"strum/std",
"frame-executive/std",
+ "frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
@@ -372,6 +374,8 @@ try-runtime = [
"zenlink-protocol/try-runtime",
]
+# Enable the metadata hash generation in the wasm builder.
+metadata-hash = ["substrate-wasm-builder/metadata-hash"]
# When enabled, the runtime API will not be build.
#
# This is required by Cumulus to access certain types of the
@@ -382,7 +386,7 @@ disable-runtime-api = []
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
-on-chain-release-build = ["sp-api/disable-logging"]
+on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = []
diff --git a/runtime/bifrost-polkadot/build.rs b/runtime/bifrost-polkadot/build.rs
index 8b3550ecf..a0321ffe4 100644
--- a/runtime/bifrost-polkadot/build.rs
+++ b/runtime/bifrost-polkadot/build.rs
@@ -15,7 +15,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#[cfg(feature = "std")]
+#[cfg(all(feature = "metadata-hash", feature = "std"))]
+fn main() {
+ substrate_wasm_builder::WasmBuilder::new()
+ .with_current_project()
+ .export_heap_base()
+ .import_memory()
+ .enable_metadata_hash("BNC", 12)
+ .build()
+}
+
+#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs
index 7cab2a8ac..0d041515d 100644
--- a/runtime/bifrost-polkadot/src/lib.rs
+++ b/runtime/bifrost-polkadot/src/lib.rs
@@ -1864,6 +1864,7 @@ pub type SignedExtra = (
frame_system::CheckNonce,
frame_system::CheckWeight,
pallet_transaction_payment::ChargeTransactionPayment,
+ frame_metadata_hash_extension::CheckMetadataHash,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =