Skip to content
Snippets Groups Projects
Unverified Commit 0126c8ce authored by bgallois's avatar bgallois
Browse files

add metadata hash check extension

parent 3dc35abf
No related branches found
No related tags found
1 merge request!312Upgrade polkadot v1.17.0
Pipeline #39689 failed
......@@ -3334,6 +3334,7 @@ dependencies = [
"distance-oracle",
"frame-benchmarking",
"frame-benchmarking-cli",
"frame-metadata-hash-extension",
"frame-system",
"futures 0.3.31",
"g1-runtime",
......@@ -7433,6 +7434,20 @@ dependencies = [
"hash-db",
]
[[package]]
name = "merkleized-metadata"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38c592efaf1b3250df14c8f3c2d952233f0302bb81d3586db2f303666c1cd607"
dependencies = [
"array-bytes",
"blake3",
"frame-metadata 18.0.0",
"parity-scale-codec",
"scale-decode 0.13.1",
"scale-info",
]
[[package]]
name = "merlin"
version = "3.0.0"
......@@ -16563,15 +16578,24 @@ name = "substrate-wasm-builder"
version = "17.0.0"
source = "git+https://github.com/duniter/duniter-polkadot-sdk?branch=duniter-substrate-v1.17.0#3f9bddbe619cf4068769b4d3fc58c8d50e358df8"
dependencies = [
"array-bytes",
"build-helper",
"cargo_metadata",
"console",
"filetime",
"frame-metadata 18.0.0",
"jobserver",
"merkleized-metadata",
"parity-scale-codec",
"parity-wasm",
"polkavm-linker 0.9.2",
"sc-executor",
"shlex",
"sp-core",
"sp-io",
"sp-maybe-compressed-blob",
"sp-tracing 16.0.0 (git+https://github.com/duniter/duniter-polkadot-sdk?branch=duniter-substrate-v1.17.0)",
"sp-version",
"strum 0.26.3",
"tempfile",
"toml 0.8.19",
......
......@@ -141,6 +141,7 @@ sp-membership = { path = 'primitives/membership', default-features = false }
# substrate dependencies
pallet-transaction-payment-rpc = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
frame-benchmarking = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
frame-metadata-hash-extension = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
frame-executive = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
frame-support = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
frame-system = { git = 'https://github.com/duniter/duniter-polkadot-sdk', branch = 'duniter-substrate-v1.17.0', default-features = false }
......
......@@ -120,6 +120,7 @@ clap_complete = { workspace = true }
frame-benchmarking = { workspace = true }
frame-benchmarking-cli = { workspace = true }
frame-system = { workspace = true }
frame-metadata-hash-extension = { workspace = true, default-features = true }
futures = { workspace = true, features = ["compat"] }
hex = { workspace = true }
jsonrpsee = { workspace = true, features = ["server"] }
......
......@@ -337,7 +337,10 @@ impl BenchmarkCallSigner<super::runtime_executor::runtime::RuntimeCall, sp_core:
pallet_transaction_payment::ChargeTransactionPayment::<
super::runtime_executor::runtime::Runtime,
>::from(0),
//frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false), TODO
frame_system::WeightReclaim::<super::runtime_executor::runtime::Runtime>,
frame_metadata_hash_extension::CheckMetadataHash::<
super::runtime_executor::runtime::Runtime,
>::new(false),
);
let payload = sp_runtime::generic::SignedPayload::from_raw(
......@@ -352,6 +355,8 @@ impl BenchmarkCallSigner<super::runtime_executor::runtime::RuntimeCall, sp_core:
(),
(),
(),
(),
None,
),
);
......
......@@ -11,9 +11,18 @@ version.workspace = true
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[features]
default = ["std"]
constant-fees = ["common-runtime/constant-fees"]
# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
runtime-benchmarks = [
"common-runtime/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
......
......@@ -17,10 +17,12 @@
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
#[cfg(not(feature = "metadata-hash"))]
substrate_wasm_builder::WasmBuilder::init_with_defaults().build();
#[cfg(feature = "metadata-hash")]
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("Ğ", 2)
.build();
}
}
......@@ -12,6 +12,14 @@ targets = ["x86_64-unknown-linux-gnu"]
[features]
default = ["std"]
# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
constant-fees = ["common-runtime/constant-fees"]
runtime-benchmarks = [
"common-runtime/runtime-benchmarks",
......
......@@ -17,10 +17,12 @@
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
#[cfg(not(feature = "metadata-hash"))]
substrate_wasm_builder::WasmBuilder::init_with_defaults().build();
#[cfg(feature = "metadata-hash")]
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("ĞD", 2)
.build();
}
}
......@@ -505,7 +505,8 @@ pub fn get_unchecked_extrinsic(
),
frame_system::CheckWeight::<gdev_runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<gdev_runtime::Runtime>::from(tip),
//frame_metadata_hash_extension::CheckMetadataHash::<gdev_runtime::Runtime>::new(false), TODO
frame_system::WeightReclaim::<gdev_runtime::Runtime>,
frame_metadata_hash_extension::CheckMetadataHash::<gdev_runtime::Runtime>::new(false),
);
let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap();
let origin = signer;
......
......@@ -12,6 +12,14 @@ targets = ["x86_64-unknown-linux-gnu"]
[features]
default = ["std"]
# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
constant-fees = ["common-runtime/constant-fees"]
runtime-benchmarks = [
"common-runtime/runtime-benchmarks",
......
......@@ -17,10 +17,12 @@
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
#[cfg(not(feature = "metadata-hash"))]
substrate_wasm_builder::WasmBuilder::init_with_defaults().build();
#[cfg(feature = "metadata-hash")]
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("ĞD", 2)
.build();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment