From 879e28ae38643c028fa09c157e7b2714bcbf02a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 16 Jan 2020 13:58:37 +0100 Subject: [PATCH] Implement runtime version checks in `set_code` (#4548) * Implement runtime version checks in `set_code` Check that the new runtime code given to `set_code` fullfills some requirements: - `spec_name` matches - `spec_version` does not decreases - `impl_version` does not decreases - Either `spec_version` and `impl_version` increase * Make tests almost work * Some fixes after master merge * Fix tests * Add missed file * Make depedency check happy? * Remove leftover `sc-executor` * AHHHHH * Reset debug stuff * Remove some 'static * More 'static * Some docs * Update `Cargo.lock` --- Cargo.lock | 235 +++++++++---------- client/executor/common/src/error.rs | 4 + client/executor/common/src/wasm_runtime.rs | 4 +- client/executor/src/integration_tests/mod.rs | 2 +- client/executor/src/lib.rs | 43 +++- client/executor/src/native_executor.rs | 76 ++++-- client/executor/src/wasm_runtime.rs | 5 +- client/executor/wasmi/Cargo.toml | 1 - client/executor/wasmi/src/lib.rs | 16 +- client/executor/wasmtime/Cargo.toml | 1 - client/executor/wasmtime/src/runtime.rs | 13 +- client/finality-grandpa/src/environment.rs | 2 +- client/finality-grandpa/src/lib.rs | 4 +- client/finality-grandpa/src/observer.rs | 2 +- client/rpc/src/state/tests.rs | 2 +- client/service/src/builder.rs | 6 +- client/src/call_executor.rs | 4 +- client/src/client.rs | 12 +- client/src/genesis.rs | 2 +- client/src/light/call_executor.rs | 4 +- client/src/light/fetcher.rs | 2 +- client/src/light/mod.rs | 2 +- frame/system/Cargo.toml | 2 + frame/system/src/lib.rs | 125 +++++++++- primitives/core/src/traits.rs | 29 ++- primitives/externalities/Cargo.toml | 2 +- primitives/io/src/lib.rs | 23 +- primitives/runtime-interface/Cargo.toml | 2 - primitives/runtime-interface/test/src/lib.rs | 1 - primitives/runtime/src/lib.rs | 24 +- primitives/runtime/src/runtime_string.rs | 117 +++++++++ primitives/state-machine/src/lib.rs | 29 ++- primitives/version/Cargo.toml | 2 +- primitives/version/src/lib.rs | 28 +-- test-utils/client/src/client_ext.rs | 2 +- test-utils/client/src/lib.rs | 6 +- test-utils/runtime/client/src/lib.rs | 26 +- test-utils/runtime/src/lib.rs | 3 + 38 files changed, 584 insertions(+), 279 deletions(-) create mode 100644 primitives/runtime/src/runtime_string.rs diff --git a/Cargo.lock b/Cargo.lock index 1588be33b1a03..2888776ab6144 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1088,7 +1088,7 @@ dependencies = [ [[package]] name = "environmental" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1238,7 +1238,7 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1293,7 +1293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "fork-tree" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1306,7 +1306,7 @@ dependencies = [ "pallet-balances 2.0.0", "pallet-indices 2.0.0", "pallet-transaction-payment 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -1318,7 +1318,7 @@ dependencies = [ name = "frame-metadata" version = "10.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-std 2.0.0", @@ -1335,7 +1335,7 @@ dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1384,7 +1384,7 @@ name = "frame-support-test" version = "2.0.0" dependencies = [ "frame-support 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -1402,21 +1402,23 @@ dependencies = [ "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "frame-support 2.0.0", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", + "sp-externalities 0.8.0", "sp-io 2.0.0", "sp-runtime 2.0.0", "sp-std 2.0.0", "sp-version 2.0.0", + "substrate-test-runtime-client 2.0.0", ] [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", ] @@ -2042,7 +2044,7 @@ name = "impl-codec" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3041,7 +3043,7 @@ dependencies = [ "pallet-indices 2.0.0", "pallet-timestamp 2.0.0", "pallet-transaction-payment 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-authority-discovery 0.8.0", "sc-basic-authorship 0.8.0", @@ -3101,7 +3103,7 @@ dependencies = [ "pallet-timestamp 2.0.0", "pallet-transaction-payment 2.0.0", "pallet-treasury 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor 0.8.0", "sp-application-crypto 2.0.0", "sp-core 2.0.0", @@ -3191,7 +3193,7 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api 2.0.0", "pallet-treasury 2.0.0", "pallet-utility 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3221,7 +3223,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "node-template-runtime 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-basic-authorship 0.8.0", "sc-cli 0.8.0", @@ -3261,7 +3263,7 @@ dependencies = [ "pallet-sudo 2.0.0", "pallet-timestamp 2.0.0", "pallet-transaction-payment 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", @@ -3297,7 +3299,7 @@ dependencies = [ "pallet-timestamp 2.0.0", "pallet-transaction-payment 2.0.0", "pallet-treasury 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", "sc-executor 0.8.0", "sp-core 2.0.0", @@ -3313,7 +3315,7 @@ name = "node-transaction-factory" version = "0.8.0" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-cli 0.8.0", "sc-client 0.8.0", "sc-client-api 2.0.0", @@ -3476,7 +3478,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3493,7 +3495,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-session 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-application-crypto 2.0.0", @@ -3513,7 +3515,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-session 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-application-crypto 2.0.0", "sp-authority-discovery 2.0.0", @@ -3531,7 +3533,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-authorship 2.0.0", "sp-core 2.0.0", "sp-inherents 2.0.0", @@ -3550,7 +3552,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-session 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-consensus-babe 0.8.0", @@ -3572,7 +3574,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-transaction-payment 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3589,7 +3591,7 @@ dependencies = [ "frame-system 2.0.0", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3609,7 +3611,7 @@ dependencies = [ "pallet-balances 2.0.0", "pallet-randomness-collective-flip 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3630,7 +3632,7 @@ dependencies = [ "jsonrpc-core-client 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-contracts-rpc-runtime-api 0.8.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", @@ -3644,7 +3646,7 @@ dependencies = [ name = "pallet-contracts-rpc-runtime-api" version = "0.8.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-runtime 2.0.0", "sp-std 2.0.0", @@ -3657,7 +3659,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3674,7 +3676,7 @@ dependencies = [ "frame-system 2.0.0", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3691,7 +3693,7 @@ dependencies = [ "frame-system 2.0.0", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3710,7 +3712,7 @@ dependencies = [ "frame-system 2.0.0", "pallet-balances 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3728,7 +3730,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3743,7 +3745,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-finality-tracker 2.0.0", @@ -3759,7 +3761,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3775,7 +3777,7 @@ dependencies = [ "frame-system 2.0.0", "pallet-finality-tracker 2.0.0", "pallet-session 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-finality-grandpa 2.0.0", @@ -3793,7 +3795,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3809,7 +3811,7 @@ dependencies = [ "frame-system 2.0.0", "pallet-authorship 2.0.0", "pallet-session 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-application-crypto 2.0.0", "sp-core 2.0.0", @@ -3825,7 +3827,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3841,7 +3843,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3856,7 +3858,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3871,7 +3873,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3886,7 +3888,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3902,7 +3904,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3917,7 +3919,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -3934,7 +3936,7 @@ dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-application-crypto 2.0.0", @@ -3953,7 +3955,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -3973,7 +3975,7 @@ dependencies = [ "pallet-session 2.0.0", "pallet-staking-reward-curve 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -4003,7 +4005,7 @@ version = "2.0.0" dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -4018,7 +4020,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-inherents 2.0.0", @@ -4036,7 +4038,7 @@ dependencies = [ "frame-system 2.0.0", "pallet-balances 2.0.0", "pallet-transaction-payment-rpc-runtime-api 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", "sp-runtime 2.0.0", @@ -4051,7 +4053,7 @@ dependencies = [ "jsonrpc-core-client 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-transaction-payment-rpc-runtime-api 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-blockchain 2.0.0", @@ -4065,7 +4067,7 @@ name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0" dependencies = [ "frame-support 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", @@ -4080,7 +4082,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -4095,7 +4097,7 @@ dependencies = [ "frame-support 2.0.0", "frame-system 2.0.0", "pallet-balances 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -4172,7 +4174,7 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5018,7 +5020,7 @@ dependencies = [ "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5042,7 +5044,7 @@ version = "0.8.0" dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-block-builder 0.8.0", "sc-client 0.8.0", @@ -5064,7 +5066,7 @@ dependencies = [ name = "sc-block-builder" version = "0.8.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client-api 2.0.0", "sp-api 2.0.0", "sp-block-builder 2.0.0", @@ -5147,7 +5149,7 @@ dependencies = [ "kvdb 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-memorydb 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-block-builder 0.8.0", "sc-client-api 2.0.0", @@ -5182,7 +5184,7 @@ dependencies = [ "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor 0.8.0", "sc-telemetry 2.0.0", @@ -5213,7 +5215,7 @@ dependencies = [ "kvdb-rocksdb 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-util-mem 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5241,7 +5243,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", "sc-client-api 2.0.0", @@ -5285,7 +5287,7 @@ dependencies = [ "num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "pdqselect 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5326,7 +5328,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client-api 2.0.0", "sp-api 2.0.0", "sp-block-builder 2.0.0", @@ -5346,7 +5348,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client-api 2.0.0", "sc-telemetry 2.0.0", @@ -5383,7 +5385,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor-common 0.8.0", @@ -5412,7 +5414,7 @@ version = "0.8.0" dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-runtime-interface 2.0.0", "sp-serializer 2.0.0", @@ -5425,11 +5427,10 @@ name = "sc-executor-wasmi" version = "0.8.0" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor-common 0.8.0", "sp-core 2.0.0", - "sp-externalities 0.8.0", "sp-runtime-interface 2.0.0", "sp-wasm-interface 2.0.0", "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5446,11 +5447,10 @@ dependencies = [ "cranelift-native 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-wasm 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor-common 0.8.0", "sp-core 2.0.0", - "sp-externalities 0.8.0", "sp-runtime-interface 2.0.0", "sp-wasm-interface 2.0.0", "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5470,7 +5470,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", @@ -5532,7 +5532,7 @@ dependencies = [ "linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lru 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5618,7 +5618,7 @@ dependencies = [ "hyper-rustls 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client-api 2.0.0", @@ -5658,7 +5658,7 @@ dependencies = [ "jsonrpc-core 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", @@ -5694,7 +5694,7 @@ dependencies = [ "jsonrpc-derive 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5743,7 +5743,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-chain-spec 2.0.0", "sc-client 0.8.0", @@ -5807,7 +5807,7 @@ version = "0.8.0" dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", ] @@ -5857,7 +5857,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -5873,7 +5873,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client-api 2.0.0", "sc-transaction-graph 2.0.0", @@ -6179,7 +6179,7 @@ name = "sp-api" version = "2.0.0" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api-proc-macro 2.0.0", "sp-core 2.0.0", "sp-runtime 2.0.0", @@ -6205,7 +6205,7 @@ name = "sp-api-test" version = "2.0.0" dependencies = [ "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-blockchain 2.0.0", @@ -6221,7 +6221,7 @@ dependencies = [ name = "sp-application-crypto" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", @@ -6246,7 +6246,7 @@ dependencies = [ "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6258,7 +6258,7 @@ dependencies = [ name = "sp-authority-discovery" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-application-crypto 2.0.0", "sp-runtime 2.0.0", @@ -6269,7 +6269,7 @@ dependencies = [ name = "sp-authorship" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-inherents 2.0.0", "sp-runtime 2.0.0", "sp-std 2.0.0", @@ -6279,7 +6279,7 @@ dependencies = [ name = "sp-block-builder" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-inherents 2.0.0", "sp-runtime 2.0.0", @@ -6293,7 +6293,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lru 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-block-builder 2.0.0", "sp-consensus 0.8.0", @@ -6310,7 +6310,7 @@ dependencies = [ "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-inherents 2.0.0", @@ -6325,7 +6325,7 @@ dependencies = [ name = "sp-consensus-aura" version = "0.8.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-application-crypto 2.0.0", "sp-inherents 2.0.0", @@ -6338,7 +6338,7 @@ dependencies = [ name = "sp-consensus-babe" version = "0.8.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "schnorrkel 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-application-crypto 2.0.0", @@ -6353,7 +6353,7 @@ dependencies = [ name = "sp-consensus-pow" version = "0.8.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-core 2.0.0", "sp-runtime 2.0.0", @@ -6378,7 +6378,7 @@ dependencies = [ "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6416,7 +6416,7 @@ dependencies = [ name = "sp-externalities" version = "0.8.0" dependencies = [ - "environmental 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sp-std 2.0.0", "sp-storage 2.0.0", ] @@ -6425,7 +6425,7 @@ dependencies = [ name = "sp-finality-grandpa" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-application-crypto 2.0.0", @@ -6437,7 +6437,7 @@ dependencies = [ name = "sp-finality-tracker" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-inherents 2.0.0", "sp-std 2.0.0", ] @@ -6447,7 +6447,7 @@ name = "sp-inherents" version = "2.0.0" dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-std 2.0.0", @@ -6460,7 +6460,7 @@ dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-externalities 0.8.0", "sp-runtime-interface 2.0.0", @@ -6522,7 +6522,7 @@ version = "2.0.0" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6539,8 +6539,7 @@ dependencies = [ name = "sp-runtime-interface" version = "2.0.0" dependencies = [ - "environmental 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -6594,7 +6593,7 @@ name = "sp-sandbox" version = "0.8.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-io 2.0.0", "sp-std 2.0.0", @@ -6623,7 +6622,7 @@ dependencies = [ name = "sp-staking" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-runtime 2.0.0", "sp-std 2.0.0", ] @@ -6636,7 +6635,7 @@ dependencies = [ "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", @@ -6665,7 +6664,7 @@ dependencies = [ name = "sp-test-primitives" version = "2.0.0" dependencies = [ - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-application-crypto 2.0.0", "sp-core 2.0.0", @@ -6677,7 +6676,7 @@ name = "sp-timestamp" version = "2.0.0" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-inherents 2.0.0", "sp-runtime 2.0.0", @@ -6691,7 +6690,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-api 2.0.0", "sp-runtime 2.0.0", @@ -6705,7 +6704,7 @@ dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0", "sp-std 2.0.0", "trie-bench 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6719,7 +6718,7 @@ name = "sp-version" version = "2.0.0" dependencies = [ "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-runtime 2.0.0", "sp-std 2.0.0", @@ -6834,7 +6833,7 @@ dependencies = [ "node-runtime 2.0.0", "pallet-balances 2.0.0", "pallet-transaction-payment 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6869,7 +6868,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-client-transports 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-rpc-api 0.8.0", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "sp-storage 2.0.0", @@ -6887,7 +6886,7 @@ dependencies = [ "jsonrpc-core-client 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 14.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", "sc-transaction-pool 2.0.0", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6905,7 +6904,7 @@ version = "2.0.0" dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", "sc-client-api 2.0.0", "sc-client-db 0.8.0", @@ -6931,7 +6930,7 @@ dependencies = [ "memory-db 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-babe 2.0.0", "pallet-timestamp 2.0.0", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-client 0.8.0", "sc-executor 0.8.0", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6963,7 +6962,7 @@ name = "substrate-test-runtime-client" version = "2.0.0" dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sc-block-builder 0.8.0", "sc-client 0.8.0", "sc-client-api 2.0.0", @@ -7502,7 +7501,7 @@ dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-standardmap 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -8355,7 +8354,7 @@ dependencies = [ "checksum enumflags2_derive 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecf634c5213044b8d54a46dd282cf5dd1f86bb5cb53e92c409cb4680a7fb9894" "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum environmental 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34f8467a0284de039e6bd0e25c14519538462ba5beb548bb1f03e645097837a8" +"checksum environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" @@ -8549,7 +8548,7 @@ dependencies = [ "checksum parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6de20a133b50f5120c6b8284ee88c5017fb167149208b3ee2e95f8719a434dc4" "checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3" "checksum parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70a4d7b05e51bff5ae2c29c7b8c3d889985bbd8f4e15b3542fcc1f6f9666d292" -"checksum parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f9d99dae413590a5f37e43cd99b94d4e62a244160562899126913ea7108673" +"checksum parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f747c06d9f3b2ad387ac881b9667298c81b1243aa9833f086e05996937c35507" "checksum parity-scale-codec-derive 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34e513ff3e406f3ede6796dcdc83d0b32ffb86668cea1ccf7363118abeb00476" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" "checksum parity-util-mem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8174d85e62c4d615fddd1ef67966bdc5757528891d0742f15b131ad04667b3f9" diff --git a/client/executor/common/src/error.rs b/client/executor/common/src/error.rs index fca17bd88c8ea..f7de0af9685d7 100644 --- a/client/executor/common/src/error.rs +++ b/client/executor/common/src/error.rs @@ -57,6 +57,10 @@ pub enum Error { /// Runtime failed. #[display(fmt="Runtime error")] Runtime, + /// Runtime panicked. + #[display(fmt="Runtime panicked: {}", _0)] + #[from(ignore)] + RuntimePanicked(String), /// Invalid memory reference. #[display(fmt="Invalid memory reference")] InvalidMemoryReference, diff --git a/client/executor/common/src/wasm_runtime.rs b/client/executor/common/src/wasm_runtime.rs index 78c05c4c29b68..0733350f4cd6a 100644 --- a/client/executor/common/src/wasm_runtime.rs +++ b/client/executor/common/src/wasm_runtime.rs @@ -17,7 +17,6 @@ //! Definitions for a wasm runtime. use crate::error::Error; -use sp_core::traits::Externalities; use sp_wasm_interface::Function; /// A trait that defines an abstract wasm runtime. @@ -34,6 +33,5 @@ pub trait WasmRuntime { fn host_functions(&self) -> &[&'static dyn Function]; /// Call a method in the Substrate runtime by name. Returns the encoded result on success. - fn call(&mut self, ext: &mut dyn Externalities, method: &str, data: &[u8]) - -> Result, Error>; + fn call(&mut self, method: &str, data: &[u8]) -> Result, Error>; } diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 2d39cac414545..00f4eb33b02bf 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -83,7 +83,7 @@ fn call_in_wasm( code: &[u8], heap_pages: u64, ) -> crate::error::Result> { - crate::call_in_wasm::( + crate::call_in_wasm::( function, call_data, execution_method, diff --git a/client/executor/src/lib.rs b/client/executor/src/lib.rs index 1908eb3688ea3..4f97efa9b661e 100644 --- a/client/executor/src/lib.rs +++ b/client/executor/src/lib.rs @@ -39,7 +39,7 @@ mod wasm_runtime; mod integration_tests; pub use wasmi; -pub use native_executor::{with_native_environment, NativeExecutor, NativeExecutionDispatch}; +pub use native_executor::{with_externalities_safe, NativeExecutor, NativeExecutionDispatch}; pub use sp_version::{RuntimeVersion, NativeVersion}; pub use codec::Codec; #[doc(hidden)] @@ -57,26 +57,55 @@ pub use sc_executor_common::{error, allocator, sandbox}; /// - `call_data`: Will be given as input parameters to `function` /// - `execution_method`: The execution method to use. /// - `ext`: The externalities that should be set while executing the wasm function. +/// If `None` is given, no externalities will be set. /// - `heap_pages`: The number of heap pages to allocate. /// /// Returns the `Vec` that contains the return value of the function. -pub fn call_in_wasm( +pub fn call_in_wasm( function: &str, call_data: &[u8], execution_method: WasmExecutionMethod, - ext: &mut E, + ext: &mut dyn Externalities, code: &[u8], heap_pages: u64, allow_missing_imports: bool, ) -> error::Result> { - let mut instance = wasm_runtime::create_wasm_runtime_with_code( + call_in_wasm_with_host_functions( + function, + call_data, execution_method, - heap_pages, + ext, code, + heap_pages, HF::host_functions(), allow_missing_imports, + ) +} + +/// Non-generic version of [`call_in_wasm`] that takes the `host_functions` as parameter. +/// For more information please see [`call_in_wasm`]. +pub fn call_in_wasm_with_host_functions( + function: &str, + call_data: &[u8], + execution_method: WasmExecutionMethod, + ext: &mut dyn Externalities, + code: &[u8], + heap_pages: u64, + host_functions: Vec<&'static dyn sp_wasm_interface::Function>, + allow_missing_imports: bool, +) -> error::Result> { + let instance = wasm_runtime::create_wasm_runtime_with_code( + execution_method, + heap_pages, + code, + host_functions, + allow_missing_imports, )?; - instance.call(ext, function, call_data) + + // It is safe, as we delete the instance afterwards. + let mut instance = std::panic::AssertUnwindSafe(instance); + + with_externalities_safe(ext, move || instance.call(function, call_data)).and_then(|r| r) } /// Provides runtime information. @@ -98,7 +127,7 @@ mod tests { fn call_in_interpreted_wasm_works() { let mut ext = TestExternalities::default(); let mut ext = ext.ext(); - let res = call_in_wasm::<_, sp_io::SubstrateHostFunctions>( + let res = call_in_wasm::( "test_empty_return", &[], WasmExecutionMethod::Interpreted, diff --git a/client/executor/src/native_executor.rs b/client/executor/src/native_executor.rs index 86b274eea0bb9..4fe7a205f53f9 100644 --- a/client/executor/src/native_executor.rs +++ b/client/executor/src/native_executor.rs @@ -22,7 +22,7 @@ use sp_version::{NativeVersion, RuntimeVersion}; use codec::{Decode, Encode}; use sp_core::{NativeOrEncoded, traits::{CodeExecutor, Externalities}}; use log::trace; -use std::{result, cell::RefCell, panic::{UnwindSafe, AssertUnwindSafe}}; +use std::{result, cell::RefCell, panic::{UnwindSafe, AssertUnwindSafe}, sync::Arc}; use sp_wasm_interface::{HostFunctions, Function}; use sc_executor_common::wasm_runtime::WasmRuntime; @@ -33,22 +33,29 @@ thread_local! { /// Default num of pages for the heap const DEFAULT_HEAP_PAGES: u64 = 1024; -pub(crate) fn safe_call(f: F) -> Result - where F: UnwindSafe + FnOnce() -> U -{ - // Substrate uses custom panic hook that terminates process on panic. Disable - // termination for the native call. - let _guard = sp_panic_handler::AbortGuard::force_unwind(); - std::panic::catch_unwind(f).map_err(|_| Error::Runtime) -} - -/// Set up the externalities and safe calling environment to execute calls to a native runtime. +/// Set up the externalities and safe calling environment to execute runtime calls. /// /// If the inner closure panics, it will be caught and return an error. -pub fn with_native_environment(ext: &mut dyn Externalities, f: F) -> Result +pub fn with_externalities_safe(ext: &mut dyn Externalities, f: F) -> Result where F: UnwindSafe + FnOnce() -> U { - sp_externalities::set_and_run_with_externalities(ext, move || safe_call(f)) + sp_externalities::set_and_run_with_externalities( + ext, + move || { + // Substrate uses custom panic hook that terminates process on panic. Disable + // termination for the native call. + let _guard = sp_panic_handler::AbortGuard::force_unwind(); + std::panic::catch_unwind(f).map_err(|e| { + if let Some(err) = e.downcast_ref::() { + Error::RuntimePanicked(err.clone()) + } else if let Some(err) = e.downcast_ref::<&'static str>() { + Error::RuntimePanicked(err.to_string()) + } else { + Error::RuntimePanicked("Unknown panic".into()) + } + }) + }, + ) } /// Delegate for dispatching a CodeExecutor call. @@ -80,7 +87,7 @@ pub struct NativeExecutor { /// The number of 64KB pages to allocate for Wasm execution. default_heap_pages: u64, /// The host functions registered with this instance. - host_functions: Vec<&'static dyn Function>, + host_functions: Arc>, } impl NativeExecutor { @@ -107,7 +114,7 @@ impl NativeExecutor { fallback_method, native_version: D::native_version(), default_heap_pages: default_heap_pages.unwrap_or(DEFAULT_HEAP_PAGES), - host_functions, + host_functions: Arc::new(host_functions), } } @@ -139,7 +146,7 @@ impl NativeExecutor { ext, self.fallback_method, self.default_heap_pages, - &self.host_functions, + &*self.host_functions, )?; let runtime = AssertUnwindSafe(runtime); @@ -181,7 +188,7 @@ impl RuntimeInfo for NativeExecutor { } } -impl CodeExecutor for NativeExecutor { +impl CodeExecutor for NativeExecutor { type Error = Error; fn call @@ -212,13 +219,15 @@ impl CodeExecutor for NativeExecutor { onchain_version, ); - safe_call( - move || runtime.call(&mut **ext, method, data).map(NativeOrEncoded::Encoded) + with_externalities_safe( + &mut **ext, + move || runtime.call(method, data).map(NativeOrEncoded::Encoded) ) } (false, _, _) => { - safe_call( - move || runtime.call(&mut **ext, method, data).map(NativeOrEncoded::Encoded) + with_externalities_safe( + &mut **ext, + move || runtime.call(method, data).map(NativeOrEncoded::Encoded) ) }, (true, true, Some(call)) => { @@ -230,7 +239,7 @@ impl CodeExecutor for NativeExecutor { ); used_native = true; - let res = with_native_environment(&mut **ext, move || (call)()) + let res = with_externalities_safe(&mut **ext, move || (call)()) .and_then(|r| r .map(NativeOrEncoded::Native) .map_err(|s| Error::ApiError(s.to_string())) @@ -255,6 +264,27 @@ impl CodeExecutor for NativeExecutor { } } +impl sp_core::traits::CallInWasm for NativeExecutor { + fn call_in_wasm( + &self, + wasm_blob: &[u8], + method: &str, + call_data: &[u8], + ext: &mut dyn Externalities, + ) -> std::result::Result, String> { + crate::call_in_wasm_with_host_functions( + method, + call_data, + self.fallback_method, + ext, + wasm_blob, + self.default_heap_pages, + (*self.host_functions).clone(), + false, + ).map_err(|e| e.to_string()) + } +} + /// Implements a `NativeExecutionDispatch` for provided parameters. /// /// # Example @@ -318,7 +348,7 @@ macro_rules! native_executor_instance { method: &str, data: &[u8] ) -> $crate::error::Result> { - $crate::with_native_environment(ext, move || $dispatcher(method, data))? + $crate::with_externalities_safe(ext, move || $dispatcher(method, data))? .ok_or_else(|| $crate::error::Error::MethodNotFound(method.to_owned())) } diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs index eef73097f6e7b..036b28f764003 100644 --- a/client/executor/src/wasm_runtime.rs +++ b/client/executor/src/wasm_runtime.rs @@ -223,8 +223,9 @@ fn create_versioned_wasm_runtime( // The following unwind safety assertion is OK because if the method call panics, the // runtime will be dropped. let mut runtime = AssertUnwindSafe(runtime.as_mut()); - crate::native_executor::safe_call( - move || runtime.call(&mut **ext, "Core_version", &[]) + crate::native_executor::with_externalities_safe( + &mut **ext, + move || runtime.call("Core_version", &[]) ).map_err(|_| WasmError::Instantiation("panic in call to get runtime version".into()))? }; let encoded_version = version_result diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index 799b9f3c544f3..dbfdc505c647a 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -13,4 +13,3 @@ sc-executor-common = { version = "0.8", path = "../common" } sp-wasm-interface = { version = "2.0.0", path = "../../../primitives/wasm-interface" } sp-runtime-interface = { version = "2.0.0", path = "../../../primitives/runtime-interface" } sp-core = { version = "2.0.0", path = "../../../primitives/core" } -sp-externalities = { version = "0.8.0", path = "../../../primitives/externalities" } diff --git a/client/executor/wasmi/src/lib.rs b/client/executor/wasmi/src/lib.rs index 7c6141d6c835f..c10698fea46ad 100644 --- a/client/executor/wasmi/src/lib.rs +++ b/client/executor/wasmi/src/lib.rs @@ -27,7 +27,7 @@ use wasmi::{ memory_units::Pages, RuntimeValue::{I32, I64, self}, }; use codec::{Encode, Decode}; -use sp_core::{sandbox as sandbox_primitives, traits::Externalities}; +use sp_core::sandbox as sandbox_primitives; use log::{error, trace}; use parity_wasm::elements::{deserialize_buffer, DataSegment, Instruction, Module as RawModule}; use sp_wasm_interface::{ @@ -381,7 +381,6 @@ fn get_heap_base(module: &ModuleRef) -> Result { /// Call a given method in the given wasm-module runtime. fn call_in_wasm_module( - ext: &mut dyn Externalities, module_instance: &ModuleRef, method: &str, data: &[u8], @@ -410,13 +409,10 @@ fn call_in_wasm_module( let offset = fec.allocate_memory(data.len() as u32)?; fec.write_memory(offset, data)?; - let result = sp_externalities::set_and_run_with_externalities( - ext, - || module_instance.invoke_export( - method, - &[I32(u32::from(offset) as i32), I32(data.len() as i32)], - &mut fec, - ), + let result = module_instance.invoke_export( + method, + &[I32(u32::from(offset) as i32), I32(data.len() as i32)], + &mut fec, ); match result { @@ -599,7 +595,6 @@ impl WasmRuntime for WasmiRuntime { fn call( &mut self, - ext: &mut dyn Externalities, method: &str, data: &[u8], ) -> Result, Error> { @@ -612,7 +607,6 @@ impl WasmRuntime for WasmiRuntime { e })?; call_in_wasm_module( - ext, &self.instance, method, data, diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 64b08222d1a13..44912086eaaed 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -13,7 +13,6 @@ sc-executor-common = { version = "0.8", path = "../common" } sp-wasm-interface = { version = "2.0.0", path = "../../../primitives/wasm-interface" } sp-runtime-interface = { version = "2.0.0", path = "../../../primitives/runtime-interface" } sp-core = { version = "2.0.0", path = "../../../primitives/core" } -sp-externalities = { version = "0.8.0", path = "../../../primitives/externalities" } cranelift-codegen = "0.50" cranelift-entity = "0.50" diff --git a/client/executor/wasmtime/src/runtime.rs b/client/executor/wasmtime/src/runtime.rs index ae4739d1f1d3f..f9b1b6209c3b7 100644 --- a/client/executor/wasmtime/src/runtime.rs +++ b/client/executor/wasmtime/src/runtime.rs @@ -24,7 +24,6 @@ use sc_executor_common::{ error::{Error, Result, WasmError}, wasm_runtime::WasmRuntime, }; -use sp_core::traits::Externalities; use sp_wasm_interface::{Pointer, WordSize, Function}; use sp_runtime_interface::unpack_ptr_and_len; @@ -70,11 +69,10 @@ impl WasmRuntime for WasmtimeRuntime { &self.host_functions } - fn call(&mut self, ext: &mut dyn Externalities, method: &str, data: &[u8]) -> Result> { + fn call(&mut self, method: &str, data: &[u8]) -> Result> { call_method( &mut self.context, &mut self.module, - ext, method, data, self.heap_pages, @@ -146,7 +144,6 @@ fn create_compiled_unit( fn call_method( context: &mut Context, module: &mut CompiledModule, - ext: &mut dyn Externalities, method: &str, data: &[u8], heap_pages: u32, @@ -176,11 +173,9 @@ fn call_method( let args = [RuntimeValue::I32(u32::from(data_ptr) as i32), RuntimeValue::I32(data_len as i32)]; // Invoke the function in the runtime. - let outcome = sp_externalities::set_and_run_with_externalities(ext, || { - context - .invoke(&mut instance, method, &args[..]) - .map_err(|e| Error::Other(format!("error calling runtime: {}", e))) - })?; + let outcome = context + .invoke(&mut instance, method, &args[..]) + .map_err(|e| Error::Other(format!("error calling runtime: {}", e)))?; let trap_error = reset_env_state_and_take_trap(context, None)?; let (output_ptr, output_len) = match outcome { ActionOutcome::Returned { values } => match values.as_slice() { diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs index d708e00bfd444..372229001dd19 100644 --- a/client/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -412,7 +412,7 @@ for Environment where Block: 'static, B: Backend + 'static, - E: CallExecutor + Send + Sync + 'static, + E: CallExecutor + Send + Sync, N: NetworkT + 'static + Send, SC: SelectChain + 'static, VR: VotingRule>, diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index dbecd9c9a4b7f..78e803269d8ce 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -372,7 +372,7 @@ pub trait GenesisAuthoritySetProvider { impl GenesisAuthoritySetProvider for Client where B: Backend + Send + Sync + 'static, - E: CallExecutor + 'static + Clone + Send + Sync, + E: CallExecutor + Send + Sync, RA: Send + Sync, { fn get(&self) -> Result { @@ -408,7 +408,7 @@ pub fn block_import( ), ClientError> where B: Backend + 'static, - E: CallExecutor + 'static + Clone + Send + Sync, + E: CallExecutor + Send + Sync, RA: Send + Sync, SC: SelectChain, Client: AuxStore, diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index 3dbb2aff6a9cf..b97d80a33c3d9 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -67,7 +67,7 @@ fn grandpa_observer( ) -> impl Future>> where NumberFor: BlockNumberOps, B: Backend, - E: CallExecutor + Send + Sync, + E: CallExecutor + Send + Sync + 'static, RA: Send + Sync, S: Stream< Item = CommunicationIn, diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index 5951ee86a93ce..848e80d4fbd53 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -399,7 +399,7 @@ fn should_return_runtime_version() { let api = new_full(client.clone(), Subscriptions::new(Arc::new(core.executor()))); let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\ - \"specVersion\":1,\"implVersion\":1,\"apis\":[[\"0xdf6acb689907609b\",2],\ + \"specVersion\":1,\"implVersion\":2,\"apis\":[[\"0xdf6acb689907609b\",2],\ [\"0x37e397fc7c91f5e4\",1],[\"0xd2bc9897eed08f15\",1],[\"0x40fe3ad401f8959a\",4],\ [\"0xc6e9a76309f39b09\",1],[\"0xdd718d5cc53262d4\",1],[\"0xcbca25e39f142387\",1],\ [\"0xf78b278be53f454c\",2],[\"0xab3c0572291feb8b\",1],[\"0xbc9d89904f5b923f\",1]]}"; diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 85642b3e41102..5449b00b061a3 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -147,7 +147,7 @@ pub fn new_full_client( config: &Configuration, ) -> Result, Error> where TBl: BlockT, - TExecDisp: NativeExecutionDispatch, + TExecDisp: NativeExecutionDispatch + 'static, TGen: sp_runtime::BuildStorage + serde::Serialize + for<'de> serde::Deserialize<'de>, TCSExt: Extension, { @@ -158,7 +158,7 @@ fn new_full_parts( config: &Configuration, ) -> Result, Error> where TBl: BlockT, - TExecDisp: NativeExecutionDispatch, + TExecDisp: NativeExecutionDispatch + 'static, TGen: sp_runtime::BuildStorage + serde::Serialize + for<'de> serde::Deserialize<'de>, TCSExt: Extension, { @@ -226,7 +226,7 @@ fn new_full_parts( impl ServiceBuilder<(), (), TCfg, TGen, TCSExt, (), (), (), (), (), (), (), (), (), ()> where TGen: RuntimeGenesis, TCSExt: Extension { /// Start the service builder with a configuration. - pub fn new_full( + pub fn new_full( config: Configuration ) -> Result Clone for LocalCallExecutor where E: Clone { impl CallExecutor for LocalCallExecutor where B: backend::Backend, - E: CodeExecutor + RuntimeInfo, + E: CodeExecutor + RuntimeInfo + Clone + 'static, Block: BlockT, { type Error = E::Error; @@ -225,7 +225,7 @@ where impl sp_version::GetRuntimeVersion for LocalCallExecutor where B: backend::Backend, - E: CodeExecutor + RuntimeInfo, + E: CodeExecutor + RuntimeInfo + Clone + 'static, Block: BlockT, { fn native_version(&self) -> &sp_version::NativeVersion { diff --git a/client/src/client.rs b/client/src/client.rs index aeca4331844c0..efcbadb2b32e7 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -156,7 +156,7 @@ pub fn new_with_backend( E: CodeExecutor + RuntimeInfo, S: BuildStorage, Block: BlockT, - B: backend::LocalBackend + B: backend::LocalBackend + 'static, { let call_executor = LocalCallExecutor::new(backend.clone(), executor); let extensions = ExecutionExtensions::new(Default::default(), keystore); @@ -750,7 +750,6 @@ impl Client where import_block: BlockImportParams>, new_cache: HashMap>, ) -> sp_blockchain::Result where - E: CallExecutor + Send + Sync + Clone, Self: ProvideRuntimeApi, >::Api: CoreApi + ApiExt, @@ -829,7 +828,6 @@ impl Client where fork_choice: ForkChoiceStrategy, import_existing: bool, ) -> sp_blockchain::Result where - E: CallExecutor + Send + Sync + Clone, Self: ProvideRuntimeApi, >::Api: CoreApi + ApiExt, @@ -1387,7 +1385,7 @@ impl ProvideCache for Client where impl ProvideRuntimeApi for Client where B: backend::Backend, - E: CallExecutor + Clone + Send + Sync, + E: CallExecutor + Send + Sync, Block: BlockT, RA: ConstructRuntimeApi, { @@ -1400,7 +1398,7 @@ impl ProvideRuntimeApi for Client where impl CallApiAt for Client where B: backend::Backend, - E: CallExecutor + Clone + Send + Sync, + E: CallExecutor + Send + Sync, Block: BlockT, { type Error = Error; @@ -1448,7 +1446,7 @@ impl CallApiAt for Client where /// important verification work. impl sp_consensus::BlockImport for &Client where B: backend::Backend, - E: CallExecutor + Clone + Send + Sync, + E: CallExecutor + Send + Sync, Block: BlockT, Client: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: CoreApi + @@ -1552,7 +1550,7 @@ impl sp_consensus::BlockImport for &Client sp_consensus::BlockImport for Client where B: backend::Backend, - E: CallExecutor + Clone + Send + Sync, + E: CallExecutor + Send + Sync, Block: BlockT, Self: ProvideRuntimeApi, >::Api: CoreApi + diff --git a/client/src/genesis.rs b/client/src/genesis.rs index ab89bdd4d5e13..6dd6e2ec43bb5 100644 --- a/client/src/genesis.rs +++ b/client/src/genesis.rs @@ -59,7 +59,7 @@ mod tests { native_executor_instance!( Executor, substrate_test_runtime_client::runtime::api::dispatch, - substrate_test_runtime_client::runtime::native_version + substrate_test_runtime_client::runtime::native_version, ); fn executor() -> sc_executor::NativeExecutor { diff --git a/client/src/light/call_executor.rs b/client/src/light/call_executor.rs index 45d9bf303c0cb..9ac88103e8e04 100644 --- a/client/src/light/call_executor.rs +++ b/client/src/light/call_executor.rs @@ -222,7 +222,7 @@ pub fn check_execution_proof( ) -> ClientResult> where Header: HeaderT, - E: CodeExecutor, + E: CodeExecutor + Clone + 'static, H: Hasher, H::Out: Ord + codec::Codec + 'static, { @@ -248,7 +248,7 @@ fn check_execution_proof_with_make_header ClientResult> where Header: HeaderT, - E: CodeExecutor, + E: CodeExecutor + Clone + 'static, H: Hasher, H::Out: Ord + codec::Codec + 'static, { diff --git a/client/src/light/fetcher.rs b/client/src/light/fetcher.rs index d746b3abe5549..a35bfdc25cce9 100644 --- a/client/src/light/fetcher.rs +++ b/client/src/light/fetcher.rs @@ -197,7 +197,7 @@ impl> LightDataChecker { impl FetchChecker for LightDataChecker where Block: BlockT, - E: CodeExecutor, + E: CodeExecutor + Clone + 'static, H: Hasher, H::Out: Ord + codec::Codec + 'static, S: BlockchainStorage, diff --git a/client/src/light/mod.rs b/client/src/light/mod.rs index c067fc9caaa53..d65fdef71193d 100644 --- a/client/src/light/mod.rs +++ b/client/src/light/mod.rs @@ -73,7 +73,7 @@ pub fn new_light( B: BlockT, S: BlockchainStorage + 'static, GS: BuildStorage, - E: CodeExecutor + RuntimeInfo, + E: CodeExecutor + RuntimeInfo + Clone + 'static, { let local_executor = LocalCallExecutor::new(backend.clone(), code_executor); let executor = GenesisCallExecutor::new(backend.clone(), local_executor); diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 227aecee2ee43..fd9992aebed8f 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -18,6 +18,8 @@ impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" +sp-externalities = { version = "0.8.0", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 9e7678a7ede34..174eb733afb30 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -259,11 +259,38 @@ decl_module! { storage::unhashed::put_raw(well_known_keys::HEAP_PAGES, &pages.encode()); } - /// Set the new code. + /// Set the new runtime code. #[weight = SimpleDispatchInfo::FixedOperational(200_000)] - pub fn set_code(origin, new: Vec) { + pub fn set_code(origin, code: Vec) { ensure_root(origin)?; - storage::unhashed::put_raw(well_known_keys::CODE, &new); + + let current_version = T::Version::get(); + let new_version = sp_io::misc::runtime_version(&code) + .and_then(|v| RuntimeVersion::decode(&mut &v[..]).ok()) + .ok_or_else(|| Error::::FailedToExtractRuntimeVersion)?; + + if new_version.spec_name != current_version.spec_name { + Err(Error::::InvalidSpecName)? + } + + if new_version.spec_version < current_version.spec_version { + Err(Error::::SpecVersionNotAllowedToDecrease)? + } else if new_version.spec_version == current_version.spec_version { + if new_version.impl_version < current_version.impl_version { + Err(Error::::ImplVersionNotAllowedToDecrease)? + } else if new_version.impl_version == current_version.impl_version { + Err(Error::::SpecOrImplVersionNeedToIncrease)? + } + } + + storage::unhashed::put_raw(well_known_keys::CODE, &code); + } + + /// Set the new runtime code without doing any checks of the given `code`. + #[weight = SimpleDispatchInfo::FixedOperational(200_000)] + pub fn set_code_without_checks(origin, code: Vec) { + ensure_root(origin)?; + storage::unhashed::put_raw(well_known_keys::CODE, &code); } /// Set some items of storage. @@ -327,7 +354,24 @@ decl_event!( decl_error! { /// Error for the System module - pub enum Error for Module {} + pub enum Error for Module { + /// The name of specification does not match between the current runtime + /// and the new runtime. + InvalidSpecName, + /// The specification version is not allowed to decrease between the current runtime + /// and the new runtime. + SpecVersionNotAllowedToDecrease, + /// The implementation version is not allowed to decrease between the current runtime + /// and the new runtime. + ImplVersionNotAllowedToDecrease, + /// The specification or the implementation version need to increase between the + /// current runtime and the new runtime. + SpecOrImplVersionNeedToIncrease, + /// Failed to extract the runtime version from the new runtime. + /// + /// Either calling `Core_version` or decoding `RuntimeVersion` failed. + FailedToExtractRuntimeVersion, + } } /// Origin for the System module. @@ -1189,6 +1233,14 @@ mod tests { pub const MaximumBlockWeight: Weight = 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const MaximumBlockLength: u32 = 1024; + pub const Version: RuntimeVersion = RuntimeVersion { + spec_name: sp_version::create_runtime_str!("test"), + impl_name: sp_version::create_runtime_str!("system-test"), + authoring_version: 1, + spec_version: 1, + impl_version: 1, + apis: sp_version::create_apis_vec!([]), + }; } impl Trait for Test { @@ -1206,7 +1258,7 @@ mod tests { type MaximumBlockWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; - type Version = (); + type Version = Version; type ModuleToIndex = (); } @@ -1503,7 +1555,7 @@ mod tests { .validate(&1, CALL, op, len) .unwrap() .priority; - assert_eq!(priority, Bounded::max_value()); + assert_eq!(priority, u64::max_value()); }) } @@ -1562,4 +1614,65 @@ mod tests { assert_eq!(ext.validate(&1, CALL, normal, len).unwrap().longevity, 15); }) } + + + #[test] + fn set_code_checks_works() { + struct CallInWasm(Vec); + + impl sp_core::traits::CallInWasm for CallInWasm { + fn call_in_wasm( + &self, + _: &[u8], + _: &str, + _: &[u8], + _: &mut dyn sp_externalities::Externalities, + ) -> Result, String> { + Ok(self.0.clone()) + } + } + + let test_data = vec![ + ("test", 1, 2, Ok(())), + ("test", 1, 1, Err(Error::::SpecOrImplVersionNeedToIncrease)), + ("test2", 1, 1, Err(Error::::InvalidSpecName)), + ("test", 2, 1, Ok(())), + ("test", 0, 1, Err(Error::::SpecVersionNotAllowedToDecrease)), + ("test", 1, 0, Err(Error::::ImplVersionNotAllowedToDecrease)), + ]; + + for (spec_name, spec_version, impl_version, expected) in test_data.into_iter() { + let version = RuntimeVersion { + spec_name: spec_name.into(), + spec_version, + impl_version, + ..Default::default() + }; + let call_in_wasm = CallInWasm(version.encode()); + + let mut ext = new_test_ext(); + ext.register_extension(sp_core::traits::CallInWasmExt::new(call_in_wasm)); + ext.execute_with(|| { + let res = System::set_code( + RawOrigin::Root.into(), + vec![1, 2, 3, 4], + ); + + assert_eq!(expected.map_err(DispatchError::from), res); + }); + } + } + + #[test] + fn set_code_with_real_wasm_blob() { + let executor = substrate_test_runtime_client::new_native_executor(); + let mut ext = new_test_ext(); + ext.register_extension(sp_core::traits::CallInWasmExt::new(executor)); + ext.execute_with(|| { + System::set_code( + RawOrigin::Root.into(), + substrate_test_runtime_client::runtime::WASM_BINARY.to_vec(), + ).unwrap(); + }); + } } diff --git a/primitives/core/src/traits.rs b/primitives/core/src/traits.rs index cd188e3367707..020b5e2dc5461 100644 --- a/primitives/core/src/traits.rs +++ b/primitives/core/src/traits.rs @@ -80,7 +80,7 @@ sp_externalities::decl_extension! { } /// Code execution engine. -pub trait CodeExecutor: Sized + Send + Sync { +pub trait CodeExecutor: Sized + Send + Sync + CallInWasm + Clone + 'static { /// Externalities error type. type Error: Display + Debug + Send + 'static; @@ -99,3 +99,30 @@ pub trait CodeExecutor: Sized + Send + Sync { native_call: Option, ) -> (Result, Self::Error>, bool); } + +/// Something that can call a method in a WASM blob. +pub trait CallInWasm: Send + Sync { + /// Call the given `method` in the given `wasm_blob` using `call_data` (SCALE encoded arguments) + /// to decode the arguments for the method. + /// + /// Returns the SCALE encoded return value of the method. + fn call_in_wasm( + &self, + wasm_blob: &[u8], + method: &str, + call_data: &[u8], + ext: &mut dyn Externalities, + ) -> Result, String>; +} + +sp_externalities::decl_extension! { + /// The call-in-wasm extension to register/retrieve from the externalities. + pub struct CallInWasmExt(Box); +} + +impl CallInWasmExt { + /// Creates a new instance of `Self`. + pub fn new(inner: T) -> Self { + Self(Box::new(inner)) + } +} diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 361a9ac034394..23889da4ea289 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" [dependencies] sp-storage = { version = "2.0.0", path = "../storage" } sp-std = { version = "2.0.0", path = "../std" } -environmental = { version = "1.0.2" } +environmental = { version = "1.1.1" } diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index 7ac2ae1012272..704477b1fb2bc 100644 --- a/primitives/io/src/lib.rs +++ b/primitives/io/src/lib.rs @@ -35,7 +35,7 @@ use sp_std::ops::Deref; #[cfg(feature = "std")] use sp_core::{ crypto::Pair, - traits::KeystoreExt, + traits::{KeystoreExt, CallInWasmExt}, offchain::{OffchainExt, TransactionPoolExt}, hexdisplay::HexDisplay, storage::{ChildStorageKey, ChildInfo}, @@ -49,7 +49,7 @@ use sp_core::{ }; #[cfg(feature = "std")] -use ::sp_trie::{TrieConfiguration, trie_types::Layout}; +use sp_trie::{TrieConfiguration, trie_types::Layout}; use sp_runtime_interface::{runtime_interface, Pointer}; @@ -351,6 +351,25 @@ pub trait Misc { fn print_hex(data: &[u8]) { log::debug!(target: "runtime", "{}", HexDisplay::from(&data)); } + + /// Extract the runtime version of the given wasm blob by calling `Core_version`. + /// + /// Returns the SCALE encoded runtime version and `None` if the call failed. + /// + /// # Performance + /// + /// Calling this function is very expensive and should only be done very occasionally. + /// For getting the runtime version, it requires instantiating the wasm blob and calling a + /// function in this blob. + fn runtime_version(&mut self, wasm: &[u8]) -> Option> { + // Create some dummy externalities, `Core_version` should not write data anyway. + let mut ext = sp_state_machine::BasicExternalities::default(); + + self.extension::() + .expect("No `CallInWasmExt` associated for the current context!") + .call_in_wasm(wasm, "Core_version", &[], &mut ext) + .ok() + } } /// Interfaces for working with crypto related types from within the runtime. diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index bac9a893deb4c..7ed2257556b47 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -10,7 +10,6 @@ sp-std = { version = "2.0.0", default-features = false, path = "../std" } sp-runtime-interface-proc-macro = { version = "2.0.0", path = "proc-macro" } sp-externalities = { version = "0.8.0", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false } -environmental = { version = "1.0.2", optional = true } static_assertions = "1.0.0" primitive-types = { version = "0.6.1", default-features = false } @@ -29,7 +28,6 @@ std = [ "sp-std/std", "codec/std", "sp-externalities", - "environmental", "primitive-types/std", ] diff --git a/primitives/runtime-interface/test/src/lib.rs b/primitives/runtime-interface/test/src/lib.rs index 3cfb589b05519..b209e1f71ce55 100644 --- a/primitives/runtime-interface/test/src/lib.rs +++ b/primitives/runtime-interface/test/src/lib.rs @@ -30,7 +30,6 @@ fn call_wasm_method(method: &str) -> TestExternalities { let mut ext_ext = ext.ext(); sc_executor::call_in_wasm::< - _, ( HF, sp_io::SubstrateHostFunctions, diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index c010ea0456d9e..6033f221a1f5f 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -53,6 +53,9 @@ pub mod testing; pub mod traits; pub mod transaction_validity; pub mod random_number_generator; +mod runtime_string; + +pub use crate::runtime_string::*; /// Re-export these since they're only "kind of" generic. pub use generic::{DigestItem, Digest}; @@ -92,27 +95,6 @@ impl TypeId for ModuleId { const TYPE_ID: [u8; 4] = *b"modl"; } -/// A String that is a `&'static str` on `no_std` and a `Cow<'static, str>` on `std`. -#[cfg(feature = "std")] -pub type RuntimeString = std::borrow::Cow<'static, str>; -/// A String that is a `&'static str` on `no_std` and a `Cow<'static, str>` on `std`. -#[cfg(not(feature = "std"))] -pub type RuntimeString = &'static str; - -/// Create a const [`RuntimeString`]. -#[cfg(feature = "std")] -#[macro_export] -macro_rules! create_runtime_str { - ( $y:expr ) => {{ std::borrow::Cow::Borrowed($y) }} -} - -/// Create a const [`RuntimeString`]. -#[cfg(not(feature = "std"))] -#[macro_export] -macro_rules! create_runtime_str { - ( $y:expr ) => {{ $y }} -} - #[cfg(feature = "std")] pub use serde::{Serialize, Deserialize, de::DeserializeOwned}; use crate::traits::IdentifyAccount; diff --git a/primitives/runtime/src/runtime_string.rs b/primitives/runtime/src/runtime_string.rs new file mode 100644 index 0000000000000..e7ee927e087be --- /dev/null +++ b/primitives/runtime/src/runtime_string.rs @@ -0,0 +1,117 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +use codec::{Encode, Decode}; +use sp_core::RuntimeDebug; +use sp_std::vec::Vec; + +/// A string that wraps a `&'static str` in the runtime and `String`/`Vec` on decode. +#[derive(Eq, RuntimeDebug, Clone)] +pub enum RuntimeString { + /// The borrowed mode that wraps a `&'static str`. + Borrowed(&'static str), + /// The owned mode that wraps a `String`. + #[cfg(feature = "std")] + Owned(String), + /// The owned mode that wraps a `Vec`. + #[cfg(not(feature = "std"))] + Owned(Vec), +} + +impl From<&'static str> for RuntimeString { + fn from(data: &'static str) -> Self { + Self::Borrowed(data) + } +} + +#[cfg(feature = "std")] +impl From for String { + fn from(string: RuntimeString) -> Self { + match string { + RuntimeString::Borrowed(data) => data.to_owned(), + RuntimeString::Owned(data) => data, + } + } +} + +impl Default for RuntimeString { + fn default() -> Self { + Self::Borrowed(Default::default()) + } +} + +impl PartialEq for RuntimeString { + fn eq(&self, other: &Self) -> bool { + self.as_ref() == other.as_ref() + } +} + +impl AsRef<[u8]> for RuntimeString { + fn as_ref(&self) -> &[u8] { + match self { + Self::Borrowed(val) => val.as_ref(), + Self::Owned(val) => val.as_ref(), + } + } +} + +impl Encode for RuntimeString { + fn encode(&self) -> Vec { + match self { + Self::Borrowed(val) => val.encode(), + Self::Owned(val) => val.encode(), + } + } +} + +impl Decode for RuntimeString { + fn decode(value: &mut I) -> Result { + Decode::decode(value).map(Self::Owned) + } +} + +#[cfg(feature = "std")] +impl std::fmt::Display for RuntimeString { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Borrowed(val) => write!(f, "{}", val), + Self::Owned(val) => write!(f, "{}", val), + } + } +} + +#[cfg(feature = "std")] +impl serde::Serialize for RuntimeString { + fn serialize(&self, serializer: S) -> Result { + match self { + Self::Borrowed(val) => val.serialize(serializer), + Self::Owned(val) => val.serialize(serializer), + } + } +} + +#[cfg(feature = "std")] +impl<'de> serde::Deserialize<'de> for RuntimeString { + fn deserialize>(de: D) -> Result { + String::deserialize(de).map(Self::Owned) + } +} + +/// Create a const [`RuntimeString`]. +#[macro_export] +macro_rules! create_runtime_str { + ( $y:expr ) => {{ $crate::RuntimeString::Borrowed($y) }} +} diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index c8329178c6c4d..55f2eb4941f90 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -24,7 +24,7 @@ use hash_db::Hasher; use codec::{Decode, Encode, Codec}; use sp_core::{ storage::{well_known_keys, ChildInfo}, NativeOrEncoded, NeverNativeValue, - traits::CodeExecutor, hexdisplay::HexDisplay + traits::{CodeExecutor, CallInWasmExt}, hexdisplay::HexDisplay }; use overlayed_changes::OverlayedChangeSet; use sp_externalities::Extensions; @@ -191,7 +191,7 @@ pub struct StateMachine<'a, B, H, N, T, Exec> impl<'a, B, H, N, T, Exec> StateMachine<'a, B, H, N, T, Exec> where H: Hasher, H::Out: Ord + 'static + codec::Codec, - Exec: CodeExecutor, + Exec: CodeExecutor + Clone + 'static, B: Backend, T: ChangesTrieStorage, N: crate::changes_trie::BlockNumber, @@ -204,8 +204,10 @@ impl<'a, B, H, N, T, Exec> StateMachine<'a, B, H, N, T, Exec> where exec: &'a Exec, method: &'a str, call_data: &'a [u8], - extensions: Extensions, + mut extensions: Extensions, ) -> Self { + extensions.register(CallInWasmExt::new(exec.clone())); + Self { backend, exec, @@ -451,7 +453,7 @@ where B: Backend, H: Hasher, H::Out: Ord + 'static + codec::Codec, - Exec: CodeExecutor, + Exec: CodeExecutor + Clone + 'static, { let trie_backend = backend.as_trie_backend() .ok_or_else(|| Box::new(ExecutionError::UnableToGenerateProof) as Box)?; @@ -478,7 +480,7 @@ where S: trie_backend_essence::TrieBackendStorage, H: Hasher, H::Out: Ord + 'static + codec::Codec, - Exec: CodeExecutor, + Exec: CodeExecutor + 'static + Clone, { let proving_backend = proving_backend::ProvingBackend::new(trie_backend); let mut sm = StateMachine::<_, H, _, InMemoryChangesTrieStorage, Exec>::new( @@ -504,7 +506,7 @@ pub fn execution_proof_check( ) -> Result, Box> where H: Hasher, - Exec: CodeExecutor, + Exec: CodeExecutor + Clone + 'static, H::Out: Ord + 'static + codec::Codec, { let trie_backend = create_proof_check_backend::(root.into(), proof)?; @@ -522,7 +524,7 @@ pub fn execution_proof_check_on_trie_backend( where H: Hasher, H::Out: Ord + 'static + codec::Codec, - Exec: CodeExecutor, + Exec: CodeExecutor + Clone + 'static, { let mut sm = StateMachine::<_, H, _, InMemoryChangesTrieStorage, Exec>::new( trie_backend, None, overlay, exec, method, call_data, Extensions::default(), @@ -741,6 +743,7 @@ mod tests { }; use sp_core::{Blake2Hasher, map, traits::Externalities, storage::ChildStorageKey}; + #[derive(Clone)] struct DummyCodeExecutor { change_changes_trie_config: bool, native_available: bool, @@ -797,6 +800,18 @@ mod tests { } } + impl sp_core::traits::CallInWasm for DummyCodeExecutor { + fn call_in_wasm( + &self, + _: &[u8], + _: &str, + _: &[u8], + _: &mut dyn Externalities, + ) -> std::result::Result, String> { + unimplemented!("Not required in tests.") + } + } + #[test] fn execute_works() { let backend = trie_backend::tests::test_trie(); diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index fbbf0cfa94607..784051b56e5e1 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.1.2", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0", default-features = false, path = "../std" } sp-runtime = { version = "2.0.0", default-features = false, path = "../runtime" } diff --git a/primitives/version/src/lib.rs b/primitives/version/src/lib.rs index 3211c46253631..0534f87490868 100644 --- a/primitives/version/src/lib.rs +++ b/primitives/version/src/lib.rs @@ -25,11 +25,11 @@ use std::fmt; #[cfg(feature = "std")] use std::collections::HashSet; -use codec::Encode; -#[cfg(feature = "std")] -use codec::Decode; +use codec::{Encode, Decode}; use sp_runtime::RuntimeString; pub use sp_runtime::create_runtime_str; +#[doc(hidden)] +pub use sp_std; #[cfg(feature = "std")] use sp_runtime::{traits::Block as BlockT, generic::BlockId}; @@ -37,25 +37,13 @@ use sp_runtime::{traits::Block as BlockT, generic::BlockId}; /// The identity of a particular API interface that the runtime might provide. pub type ApiId = [u8; 8]; -/// A vector of pairs of `ApiId` and a `u32` for version. For `"std"` builds, this -/// is a `Cow`. -#[cfg(feature = "std")] -pub type ApisVec = std::borrow::Cow<'static, [(ApiId, u32)]>; -/// A vector of pairs of `ApiId` and a `u32` for version. For `"no-std"` builds, this -/// is just a reference. -#[cfg(not(feature = "std"))] -pub type ApisVec = &'static [(ApiId, u32)]; +/// A vector of pairs of `ApiId` and a `u32` for version. +pub type ApisVec = sp_std::borrow::Cow<'static, [(ApiId, u32)]>; /// Create a vector of Api declarations. #[macro_export] -#[cfg(feature = "std")] -macro_rules! create_apis_vec { - ( $y:expr ) => { std::borrow::Cow::Borrowed(& $y) } -} -#[macro_export] -#[cfg(not(feature = "std"))] macro_rules! create_apis_vec { - ( $y:expr ) => { & $y } + ( $y:expr ) => { $crate::sp_std::borrow::Cow::Borrowed(& $y) } } /// Runtime version. @@ -63,8 +51,8 @@ macro_rules! create_apis_vec { /// This triplet have different semantics and mis-interpretation could cause problems. /// In particular: bug fixes should result in an increment of `spec_version` and possibly `authoring_version`, /// absolutely not `impl_version` since they change the semantics of the runtime. -#[derive(Clone, PartialEq, Eq, Encode, Default, sp_runtime::RuntimeDebug)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Decode))] +#[derive(Clone, PartialEq, Eq, Encode, Decode, Default, sp_runtime::RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] pub struct RuntimeVersion { /// Identifies the different Substrate runtimes. There'll be at least polkadot and node. diff --git a/test-utils/client/src/client_ext.rs b/test-utils/client/src/client_ext.rs index 67d08c5fa600f..aa7383e3ab367 100644 --- a/test-utils/client/src/client_ext.rs +++ b/test-utils/client/src/client_ext.rs @@ -64,7 +64,7 @@ pub trait ClientBlockImportExt: Sized { impl ClientExt for Client where B: sc_client_api::backend::Backend, - E: sc_client::CallExecutor, + E: sc_client::CallExecutor + 'static, Self: BlockImport, Block: BlockT, { diff --git a/test-utils/client/src/lib.rs b/test-utils/client/src/lib.rs index c8d3a809a7d0d..8603b26d50a58 100644 --- a/test-utils/client/src/lib.rs +++ b/test-utils/client/src/lib.rs @@ -165,7 +165,7 @@ impl TestClientBuilder >, sc_client::LongestChain, ) where - Executor: sc_client::CallExecutor, + Executor: sc_client::CallExecutor + 'static, Backend: sc_client_api::backend::Backend, Block: BlockT, { @@ -224,8 +224,8 @@ impl TestClientBuilder< sc_client::LongestChain, ) where I: Into>>, - E: sc_executor::NativeExecutionDispatch, - Backend: sc_client_api::backend::Backend, + E: sc_executor::NativeExecutionDispatch + 'static, + Backend: sc_client_api::backend::Backend + 'static, Block: BlockT, { let executor = executor.into().unwrap_or_else(|| diff --git a/test-utils/runtime/client/src/lib.rs b/test-utils/runtime/client/src/lib.rs index 4faf7f8ab4851..0476be2f60201 100644 --- a/test-utils/runtime/client/src/lib.rs +++ b/test-utils/runtime/client/src/lib.rs @@ -59,21 +59,12 @@ pub mod prelude { pub use super::{AccountKeyring, Sr25519Keyring}; } -mod local_executor { - #![allow(missing_docs)] - use substrate_test_runtime; - use crate::sc_executor::native_executor_instance; - // FIXME #1576 change the macro and pass in the `BlakeHasher` that dispatch needs from here instead - native_executor_instance!( - pub LocalExecutor, - substrate_test_runtime::api::dispatch, - substrate_test_runtime::native_version - ); +sc_executor::native_executor_instance! { + pub LocalExecutor, + substrate_test_runtime::api::dispatch, + substrate_test_runtime::native_version, } -/// Native executor used for tests. -pub use self::local_executor::LocalExecutor; - /// Test client database backend. pub type Backend = substrate_test_client::Backend; @@ -245,7 +236,7 @@ impl TestClientBuilderExt for TestClientBuilder< sc_client::LocalCallExecutor>, B > where - B: sc_client_api::backend::Backend, + B: sc_client_api::backend::Backend + 'static, // Rust bug: https://github.com/rust-lang/rust/issues/24159 >::State: sp_api::StateBackend>, @@ -353,7 +344,7 @@ pub fn new_light() -> ( let storage = sc_client_db::light::LightStorage::new_test(); let blockchain = Arc::new(sc_client::light::blockchain::Blockchain::new(storage)); let backend = Arc::new(LightBackend::new(blockchain.clone())); - let executor = NativeExecutor::new(WasmExecutionMethod::Interpreted, None); + let executor = new_native_executor(); let local_call_executor = sc_client::LocalCallExecutor::new(backend.clone(), executor); let call_executor = LightExecutor::new( backend.clone(), @@ -372,3 +363,8 @@ pub fn new_light() -> ( pub fn new_light_fetcher() -> LightFetcher { LightFetcher::default() } + +/// Create a new native executor. +pub fn new_native_executor() -> sc_executor::NativeExecutor { + sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None) +} diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 4dfddfda21aec..b4c2e849a6113 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -65,7 +65,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("parity-test"), authoring_version: 1, spec_version: 1, + #[cfg(feature = "std")] impl_version: 1, + #[cfg(not(feature = "std"))] + impl_version: 2, apis: RUNTIME_API_VERSIONS, };