Skip to content

Commit

Permalink
feat: adding metadata hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Honza committed Dec 28, 2024
1 parent e626fae commit ccbd1e4
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 4 deletions.
68 changes: 68 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polk
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2409", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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-aura.workspace = true
pallet-balances.workspace = true
pallet-grandpa.workspace = true
Expand Down Expand Up @@ -187,3 +188,4 @@ try-runtime = [
"pallet-evm-chain-id/try-runtime",
"fp-self-contained/try-runtime",
]
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
11 changes: 10 additions & 1 deletion runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
fn main() {
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build();
}
#[cfg(all(feature = "std", feature = "metadata-hash"))]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("COMAI", 9)
.build();
}
}
7 changes: 4 additions & 3 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node-subspace"),
impl_name: create_runtime_str!("node-subspace"),
authoring_version: 1,
spec_version: 514,
spec_version: 515,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand All @@ -217,7 +217,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node-subspace"),
impl_name: create_runtime_str!("node-subspace"),
authoring_version: 1,
spec_version: 127,
spec_version: 128,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -756,6 +756,7 @@ pub type SignedExtra = (
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -1531,7 +1532,7 @@ where
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
// frame_metadata_hash_extension::CheckMetadataHash::new(true), TODO
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
);

let raw_payload = SignedPayload::new(call, extra)
Expand Down

0 comments on commit ccbd1e4

Please sign in to comment.