Skip to content

Commit

Permalink
align metadata hash feature enablement with parachain
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Sep 7, 2024
1 parent 2a39581 commit ba77e79
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ parity-scale-codec = { version = "3.6.5", default-features = false, features = [
scale-info = { version = "2.11.0", default-features = false, features = ["derive", "serde"] }
serde = { version = "1.0.197", default-features = false, features = ["alloc", "derive"] }
serde_derive = { version = "1.0.117" }
serde_json = { version = "1.0.114", default-features = false, features = ["alloc"] }
serde_json = { version = "1.0.121", default-features = false, features = ["alloc"] }
tokio = { version = "1.37", features = ["rt-multi-thread", "macros", "time"] }

# encointer deps
Expand Down
10 changes: 9 additions & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ frame-system-benchmarking = { workspace = true, optional = true }
hex-literal = { workspace = true, optional = true }

[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true, default-features = true, features = ["metadata-hash"] }
substrate-wasm-builder = { workspace = true, optional = true }

[features]
default = ["std"]
Expand Down Expand Up @@ -197,3 +197,11 @@ try-runtime = [
"pallet-utility/try-runtime",
"sp-runtime/try-runtime",
]

# Enable metadata hash generation at compile time for the `CheckMetadataHash` extension.
metadata-hash = ["substrate-wasm-builder?/metadata-hash"]

# A feature that should be enabled when the runtime should be built 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 = ["metadata-hash", "sp-api/disable-logging"]
7 changes: 6 additions & 1 deletion runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults()
}

#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("ERT", 12)
Expand Down

0 comments on commit ba77e79

Please sign in to comment.