diff --git a/Cargo.lock b/Cargo.lock
index df96a2140abee3b802f06c665f3990ebd6284e7c..ab38930b1b07ef7753bb760cbcea8ce849dce329 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -18528,9 +18528,9 @@ dependencies = [
 
 [[package]]
 name = "scale-decode"
-version = "0.13.0"
+version = "0.13.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b12ebca36cec2a3f983c46295b282b35e5f8496346fb859a8776dad5389e5389"
+checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27"
 dependencies = [
  "derive_more",
  "parity-scale-codec",
diff --git a/polkadot/Cargo.toml b/polkadot/Cargo.toml
index 512783de94806354f3d33cf32d73cca7b71faf16..3a939464868fed72d4bf89f3501dae84769d97b0 100644
--- a/polkadot/Cargo.toml
+++ b/polkadot/Cargo.toml
@@ -68,6 +68,11 @@ jemalloc-allocator = [
 	"polkadot-overseer/jemalloc-allocator",
 ]
 
+# Generate the metadata hash needed for CheckMetadataHash
+# in the builtin test runtimes (westend and rococo).
+metadata-hash = [
+	"polkadot-cli/metadata-hash",
+]
 
 # Enables timeout-based tests supposed to be run only in CI environment as they may be flaky
 # when run locally depending on system load
diff --git a/polkadot/cli/Cargo.toml b/polkadot/cli/Cargo.toml
index 9dcdb44ab64f54fd0c08e329679c721117facd14..da37f6062c5725e9162718c7d49ee50d94617140 100644
--- a/polkadot/cli/Cargo.toml
+++ b/polkadot/cli/Cargo.toml
@@ -49,6 +49,7 @@ substrate-build-script-utils = { workspace = true, default-features = true }
 [features]
 default = ["cli", "db", "full-node"]
 db = ["polkadot-service/db"]
+metadata-hash = ["polkadot-service/metadata-hash"]
 service = ["dep:polkadot-service"]
 cli = [
 	"clap",
diff --git a/polkadot/node/service/Cargo.toml b/polkadot/node/service/Cargo.toml
index 23cd51d8a04c3b0cae8837219ea6bb352f2f9587..c0ddbf7dcfc36d89591567a88075c2344b025b04 100644
--- a/polkadot/node/service/Cargo.toml
+++ b/polkadot/node/service/Cargo.toml
@@ -201,6 +201,13 @@ rococo-native = [
 	"rococo-runtime-constants",
 ]
 
+# Generate the metadata hash needed for CheckMetadataHash
+# in the test runtimes.
+metadata-hash = [
+	"rococo-runtime?/metadata-hash",
+	"westend-runtime?/metadata-hash",
+]
+
 runtime-benchmarks = [
 	"frame-benchmarking-cli/runtime-benchmarks",
 	"frame-benchmarking/runtime-benchmarks",