diff --git a/Cargo.lock b/Cargo.lock index 49de10a9..646b3129 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "ac-compose-macros" version = "0.5.0" -source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-sdk-1.13#673dfb2f152ab06a532e668af95eca93666fc910" +source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13#84f2f7f0aa966d383184eee02b0873fc92aef305" dependencies = [ "ac-primitives", "log", @@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "ac-node-api" version = "0.6.0" -source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-sdk-1.13#673dfb2f152ab06a532e668af95eca93666fc910" +source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13#84f2f7f0aa966d383184eee02b0873fc92aef305" dependencies = [ "ac-primitives", "bitvec", @@ -35,8 +35,8 @@ dependencies = [ "hex", "log", "parity-scale-codec", - "scale-bits", - "scale-decode", + "scale-bits 0.4.0", + "scale-decode 0.10.0", "scale-encode", "scale-info", "scale-value", @@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "ac-primitives" version = "0.9.1" -source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-sdk-1.13#673dfb2f152ab06a532e668af95eca93666fc910" +source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13#84f2f7f0aa966d383184eee02b0873fc92aef305" dependencies = [ "frame-system", "impl-serde", @@ -2148,6 +2148,7 @@ dependencies = [ "encointer-node-notee-runtime", "frame-benchmarking", "frame-benchmarking-cli", + "frame-metadata-hash-extension", "frame-system", "frame-try-runtime", "futures", @@ -2204,6 +2205,7 @@ dependencies = [ "encointer-primitives", "frame-benchmarking", "frame-executive", + "frame-metadata-hash-extension", "frame-support", "frame-system", "frame-system-benchmarking", @@ -2720,6 +2722,22 @@ dependencies = [ "serde", ] +[[package]] +name = "frame-metadata-hash-extension" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1fa15dc90efe948898c06a3be111628230db100ffa2907e662062e9c9d1abd" +dependencies = [ + "array-bytes", + "docify", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + [[package]] name = "frame-support" version = "35.0.0" @@ -4718,6 +4736,20 @@ dependencies = [ "hash-db", ] +[[package]] +name = "merkleized-metadata" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f313fcff1d2a4bcaa2deeaa00bf7530d77d5f7bd0467a117dde2e29a75a7a17a" +dependencies = [ + "array-bytes", + "blake3", + "frame-metadata 16.0.0", + "parity-scale-codec", + "scale-decode 0.13.1", + "scale-info", +] + [[package]] name = "merlin" version = "3.0.0" @@ -8354,6 +8386,16 @@ dependencies = [ "serde", ] +[[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.10.0" @@ -8363,12 +8405,25 @@ dependencies = [ "derive_more", "parity-scale-codec", "primitive-types", - "scale-bits", + "scale-bits 0.4.0", "scale-decode-derive", "scale-info", "smallvec", ] +[[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 0.6.0", + "scale-type-resolver", + "smallvec", +] + [[package]] name = "scale-decode-derive" version = "0.10.0" @@ -8391,7 +8446,7 @@ dependencies = [ "derive_more", "parity-scale-codec", "primitive-types", - "scale-bits", + "scale-bits 0.4.0", "scale-encode-derive", "scale-info", "smallvec", @@ -8436,6 +8491,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 = "scale-value" version = "0.13.0" @@ -8446,8 +8507,8 @@ dependencies = [ "either", "frame-metadata 15.1.0", "parity-scale-codec", - "scale-bits", - "scale-decode", + "scale-bits 0.4.0", + "scale-decode 0.10.0", "scale-encode", "scale-info", ] @@ -9791,7 +9852,7 @@ dependencies = [ [[package]] name = "substrate-api-client" version = "0.17.0" -source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-sdk-1.13#673dfb2f152ab06a532e668af95eca93666fc910" +source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13#84f2f7f0aa966d383184eee02b0873fc92aef305" dependencies = [ "ac-compose-macros", "ac-node-api", @@ -9840,7 +9901,7 @@ checksum = "b285e7d183a32732fdc119f3d81b7915790191fad602b7c709ef247073c77a2e" [[package]] name = "substrate-client-keystore" version = "0.10.0" -source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-sdk-1.13#673dfb2f152ab06a532e668af95eca93666fc910" +source = "git+https://github.com/encointer/substrate-api-client.git?branch=crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13#84f2f7f0aa966d383184eee02b0873fc92aef305" dependencies = [ "array-bytes", "async-trait", @@ -9925,13 +9986,22 @@ version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dc993ad871b63fbba60362f3ea86583f5e7e1256e8fdcb3b5b249c9ead354bf" dependencies = [ + "array-bytes", "build-helper", "cargo_metadata", "console", "filetime", + "frame-metadata 16.0.0", + "merkleized-metadata", + "parity-scale-codec", "parity-wasm", "polkavm-linker", + "sc-executor", + "sp-core", + "sp-io", "sp-maybe-compressed-blob", + "sp-tracing", + "sp-version", "strum 0.26.3", "tempfile", "toml 0.8.8", diff --git a/Cargo.toml b/Cargo.toml index 8127809e..968ae969 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ pallet-encointer-scheduler = { default-features = false, version = "~12.1.0" } frame-benchmarking = { version = "35.0.0", default-features = false } frame-benchmarking-cli = { version = "39.0.0" } frame-executive = { version = "35.0.0", default-features = false } +frame-metadata-hash-extension = { version = "0.3.0", default-features = false } frame-support = { version = "35.0.0", default-features = false } frame-system = { version = "35.0.0", default-features = false } frame-system-benchmarking = { version = "35.0.0", default-features = false } @@ -125,11 +126,11 @@ substrate-client-keystore = { version = "0.10.0" } [patch.crates-io] ## api client # todo: temporary patch until ^0.17.1 is released -ac-compose-macros = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-sdk-1.13" } -ac-node-api = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-sdk-1.13" } -ac-primitives = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-sdk-1.13" } -substrate-api-client = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-sdk-1.13" } -substrate-client-keystore = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-sdk-1.13" } +ac-compose-macros = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13" } +ac-node-api = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13" } +ac-primitives = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13" } +substrate-api-client = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13" } +substrate-client-keystore = { git = "https://github.com/encointer/substrate-api-client.git", branch = "crates-io-v0.17.0-patch-for-stable-check-metadata-hash-sdk-1.13" } #ac-node-api = { path = "../../substrate-api-client/node-api" } #ac-primitives = { path = "../../substrate-api-client/primitives" } #substrate-api-client = { path = "../../substrate-api-client" } diff --git a/node/Cargo.toml b/node/Cargo.toml index f735a808..680f4726 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -28,6 +28,7 @@ futures = { workspace = true } log = { workspace = true } serde_json = { workspace = true } +frame-metadata-hash-extension = { workspace = true, features = ["std"] } frame-system = { workspace = true, features = ["std"] } pallet-asset-tx-payment = { workspace = true, features = ["std"] } sc-cli = { workspace = true } diff --git a/node/src/benchmarking.rs b/node/src/benchmarking.rs index b0a75303..ab4066db 100644 --- a/node/src/benchmarking.rs +++ b/node/src/benchmarking.rs @@ -120,6 +120,7 @@ pub fn create_benchmark_extrinsic( frame_system::CheckNonce::::from(nonce), frame_system::CheckWeight::::new(), pallet_asset_tx_payment::ChargeAssetTxPayment::::from(0, None), + frame_metadata_hash_extension::CheckMetadataHash::::new(false), ); let raw_payload = runtime::SignedPayload::from_raw( @@ -134,6 +135,7 @@ pub fn create_benchmark_extrinsic( (), (), (), + None, ), ); let signature = raw_payload.using_encoded(|e| sender.sign(e)); diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 32ff07a0..78ee0568 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -32,6 +32,7 @@ pallet-encointer-scheduler = { workspace = true } # substrate deps frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } pallet-asset-tx-payment = { workspace = true } @@ -73,7 +74,7 @@ frame-system-benchmarking = { workspace = true, optional = true } hex-literal = { workspace = true, optional = true } [build-dependencies] -substrate-wasm-builder = { workspace = true } +substrate-wasm-builder = { workspace = true, optional = true, features = ["metadata-hash"] } [features] default = ["std"] @@ -83,6 +84,7 @@ std = [ "encointer-primitives/serde_derive", "encointer-primitives/std", "frame-executive/std", + "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", @@ -124,6 +126,7 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/runtime/build.rs b/runtime/build.rs index 9b53d245..c77071ca 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -1,9 +1,9 @@ -use substrate_wasm_builder::WasmBuilder; - +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("ERT", 12) .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 2edd0ebe..76baafdc 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -480,7 +480,7 @@ pub struct NoConversion; impl ConversionFromAssetBalance for NoConversion { type Error = (); fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result { - return Ok(balance) + return Ok(balance); } #[cfg(feature = "runtime-benchmarks")] fn ensure_successful(_: ()) {} @@ -590,6 +590,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_asset_tx_payment::ChargeAssetTxPayment, + frame_metadata_hash_extension::CheckMetadataHash, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic =