From 83661eb8dc9371f517f3132751a6cfbc0b295113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 9 Nov 2020 11:26:29 +0100 Subject: [PATCH] Adds integration test based on adder collator (#1928) * Adds integration test based on adder collator This adds an integration test for parachains that uses the adder collator. The test will start two relay chain nodes and one collator and waits until 4 blocks are build and enacted by the parachain. * Make sure the integration test is run in CI * Fix wasm compilation * Update parachain/test-parachains/adder/collator/src/lib.rs Co-authored-by: Sergei Shulepov * Update cli/src/command.rs Co-authored-by: Sergei Shulepov --- polkadot/Cargo.lock | 321 +++++++++--------- polkadot/cli/Cargo.toml | 14 +- polkadot/cli/src/command.rs | 6 +- .../node/core/candidate-validation/src/lib.rs | 113 +++--- polkadot/node/service/src/chain_spec.rs | 4 +- polkadot/node/service/src/lib.rs | 11 +- polkadot/node/subsystem-util/src/lib.rs | 1 + polkadot/node/test/client/Cargo.toml | 1 + .../node/test/client/src/block_builder.rs | 9 +- polkadot/node/test/service/Cargo.toml | 5 +- polkadot/node/test/service/src/chain_spec.rs | 49 ++- polkadot/node/test/service/src/lib.rs | 130 +++++-- .../node/test/service/tests/build-blocks.rs | 4 +- .../node/test/service/tests/call-function.rs | 4 +- polkadot/parachain/src/wasm_executor/mod.rs | 46 +-- .../test-parachains/adder/collator/Cargo.toml | 8 + .../test-parachains/adder/collator/src/lib.rs | 37 +- .../adder/collator/src/main.rs | 11 +- .../adder/collator/tests/integration.rs | 73 ++++ polkadot/rpc/Cargo.toml | 2 +- polkadot/runtime/rococo/src/lib.rs | 4 +- .../runtime/test-runtime/src/constants.rs | 6 +- polkadot/runtime/test-runtime/src/lib.rs | 18 +- polkadot/scripts/gitlab/test_linux_stable.sh | 2 +- 24 files changed, 546 insertions(+), 333 deletions(-) create mode 100644 polkadot/parachain/test-parachains/adder/collator/tests/integration.rs diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index ca21ba2cea..d571ac2fd0 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -1494,7 +1494,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", ] @@ -1502,7 +1502,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -1520,7 +1520,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "chrono", "frame-benchmarking", @@ -1542,7 +1542,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -1558,7 +1558,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "12.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "serde", @@ -1569,7 +1569,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "bitflags", "frame-metadata", @@ -1594,7 +1594,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.24", @@ -1605,7 +1605,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1617,7 +1617,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1643,7 +1643,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -1657,7 +1657,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-api", @@ -2502,9 +2502,9 @@ dependencies = [ [[package]] name = "jsonrpc-client-transports" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f7b1cdf66312002e15682a24430728bd13036c641163c016bc53fb686a7c2d" +checksum = "489b9c612e60c766f751ab40fcb43cbb55a1e10bb44a9b4307ed510ca598cbd7" dependencies = [ "failure", "futures 0.1.29", @@ -2518,9 +2518,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b12567a31d48588a65b6cf870081e6ba1d7b2ae353977cb9820d512e69c70" +checksum = "0745a6379e3edc893c84ec203589790774e4247420033e71a76d3ab4687991fa" dependencies = [ "futures 0.1.29", "log 0.4.11", @@ -2531,18 +2531,18 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d175ca0cf77439b5495612bf216c650807d252d665b4b70ab2eebd895a88fac1" +checksum = "6f764902d7b891344a0acb65625f32f6f7c6db006952143bd650209fbe7d94db" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2cc6ea7f785232d9ca8786a44e9fa698f92149dcdc1acc4aa1fc69c4993d79e" +checksum = "99a847f9ec7bb52149b2786a17c9cb260d6effc6b8eeb8c16b343a487a7563a3" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", @@ -2552,9 +2552,9 @@ dependencies = [ [[package]] name = "jsonrpc-http-server" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9996b26c0c7a59626d0ed6c5ec8bf06218e62ce1474bd2849f9b9fd38a0158c0" +checksum = "4fb5c4513b7b542f42da107942b7b759f27120b5cc894729f88254b28dff44b7" dependencies = [ "hyper 0.12.35", "jsonrpc-core", @@ -2567,9 +2567,9 @@ dependencies = [ [[package]] name = "jsonrpc-ipc-server" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e8f2278fb2b277175b6e21b23e7ecf30e78daff5ee301d0a2a411d9a821a0a" +checksum = "cf50e53e4eea8f421a7316c5f63e395f7bc7c4e786a6dc54d76fab6ff7aa7ce7" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -2581,9 +2581,9 @@ dependencies = [ [[package]] name = "jsonrpc-pubsub" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f389c5cd1f3db258a99296892c21047e21ae73ff4c0e2d39650ea86fe994b4c7" +checksum = "639558e0604013be9787ae52f798506ae42bf4220fe587bdc5625871cc8b9c77" dependencies = [ "jsonrpc-core", "log 0.4.11", @@ -2594,9 +2594,9 @@ dependencies = [ [[package]] name = "jsonrpc-server-utils" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c623e1895d0d9110cb0ea7736cfff13191ff52335ad33b21bd5c775ea98b27af" +checksum = "72f1f3990650c033bd8f6bd46deac76d990f9bbfb5f8dc8c4767bf0a00392176" dependencies = [ "bytes 0.4.12", "globset", @@ -2610,9 +2610,9 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436a92034d0137ab3e3c64a7a6350b428f31cb4d7d1a89f284bcdbcd98a7bc56" +checksum = "6596fe75209b73a2a75ebe1dce4e60e03b88a2b25e8807b667597f6315150d22" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -3847,7 +3847,7 @@ checksum = "7a1250cdd103eef6bd542b5ae82989f931fc00a41a27f60377338241594410f3" [[package]] name = "pallet-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -3863,7 +3863,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3903,7 +3903,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3917,7 +3917,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3933,7 +3933,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3948,7 +3948,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3963,7 +3963,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -3984,7 +3984,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4000,7 +4000,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4020,7 +4020,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4037,7 +4037,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4051,7 +4051,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4067,7 +4067,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4081,7 +4081,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4096,7 +4096,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4117,7 +4117,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4133,7 +4133,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4146,7 +4146,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "enumflags2", "frame-support", @@ -4161,7 +4161,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4176,7 +4176,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4196,7 +4196,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4226,7 +4226,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4248,7 +4248,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", @@ -4259,7 +4259,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4273,7 +4273,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4291,7 +4291,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "frame-system", @@ -4308,7 +4308,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-support", "parity-scale-codec", @@ -4339,7 +4339,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4354,7 +4354,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4370,7 +4370,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4861,6 +4861,7 @@ version = "0.8.26" dependencies = [ "frame-benchmarking-cli", "log 0.4.11", + "polkadot-parachain", "polkadot-service", "sc-cli", "sc-service", @@ -5604,6 +5605,7 @@ name = "polkadot-test-client" version = "0.8.26" dependencies = [ "parity-scale-codec", + "polkadot-node-subsystem", "polkadot-primitives", "polkadot-test-runtime", "polkadot-test-service", @@ -5694,7 +5696,10 @@ dependencies = [ "pallet-balances", "pallet-staking", "pallet-transaction-payment", + "polkadot-node-primitives", + "polkadot-node-subsystem", "polkadot-overseer", + "polkadot-parachain", "polkadot-primitives", "polkadot-rpc", "polkadot-runtime-common", @@ -5710,12 +5715,12 @@ dependencies = [ "sc-consensus-babe", "sc-executor", "sc-finality-grandpa", - "sc-informant", "sc-network", "sc-service", "sc-transaction-pool", "serde_json", "sp-arithmetic", + "sp-authority-discovery", "sp-blockchain", "sp-consensus", "sp-consensus-babe", @@ -6581,7 +6586,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "async-trait", "bytes 0.5.6", @@ -6611,7 +6616,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6635,7 +6640,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6652,7 +6657,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -6673,7 +6678,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", @@ -6684,7 +6689,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6728,7 +6733,7 @@ dependencies = [ [[package]] name = "sc-cli-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", @@ -6739,7 +6744,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "fnv", @@ -6776,7 +6781,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "blake2-rfc", "hash-db", @@ -6806,7 +6811,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6817,7 +6822,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "fork-tree", @@ -6862,7 +6867,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "futures 0.3.5", @@ -6886,7 +6891,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6899,7 +6904,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6923,7 +6928,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "sc-client-api", @@ -6937,7 +6942,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "lazy_static", @@ -6966,7 +6971,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "log 0.4.11", @@ -6983,7 +6988,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -6998,7 +7003,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -7016,7 +7021,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "finality-grandpa", @@ -7053,7 +7058,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "finality-grandpa", @@ -7077,7 +7082,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -7095,7 +7100,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "async-trait", "derive_more", @@ -7115,7 +7120,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "hash-db", "lazy_static", @@ -7134,7 +7139,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "async-std", "async-trait", @@ -7188,7 +7193,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7203,7 +7208,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "bytes 0.5.6", "fnv", @@ -7230,7 +7235,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "libp2p", @@ -7243,7 +7248,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "substrate-prometheus-endpoint", @@ -7252,7 +7257,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "hash-db", @@ -7285,7 +7290,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "futures 0.3.5", @@ -7309,7 +7314,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.1.29", "jsonrpc-core", @@ -7327,7 +7332,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "directories", @@ -7391,7 +7396,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -7405,7 +7410,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -7424,7 +7429,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7445,7 +7450,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "erased-serde", "log 0.4.11", @@ -7464,7 +7469,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "futures 0.3.5", @@ -7485,7 +7490,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "futures 0.3.5", @@ -7923,7 +7928,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "log 0.4.11", @@ -7935,7 +7940,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "hash-db", "parity-scale-codec", @@ -7950,7 +7955,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7962,7 +7967,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "serde", @@ -7974,7 +7979,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7987,7 +7992,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-api", @@ -7999,7 +8004,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -8010,7 +8015,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-api", @@ -8022,7 +8027,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "lru 0.4.3", @@ -8039,7 +8044,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "serde", "serde_json", @@ -8048,7 +8053,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -8074,7 +8079,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "merlin", "parity-scale-codec", @@ -8094,7 +8099,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8103,7 +8108,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -8115,7 +8120,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "base58", "blake2-rfc", @@ -8159,7 +8164,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -8168,7 +8173,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", @@ -8178,7 +8183,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "environmental", "parity-scale-codec", @@ -8189,7 +8194,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "finality-grandpa", "log 0.4.11", @@ -8206,7 +8211,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "parking_lot 0.10.2", @@ -8218,7 +8223,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "hash-db", @@ -8242,7 +8247,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "lazy_static", "sp-core", @@ -8253,7 +8258,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "async-trait", "derive_more", @@ -8269,7 +8274,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "serde", @@ -8281,7 +8286,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", @@ -8292,7 +8297,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "sp-api", "sp-core", @@ -8302,7 +8307,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "backtrace", "log 0.4.11", @@ -8311,7 +8316,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "serde", "sp-core", @@ -8320,7 +8325,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "either", "hash256-std-hasher", @@ -8342,7 +8347,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "primitive-types", @@ -8358,7 +8363,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "Inflector", "proc-macro-crate", @@ -8370,7 +8375,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "serde", "serde_json", @@ -8379,7 +8384,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-api", @@ -8392,7 +8397,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8402,7 +8407,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "hash-db", "log 0.4.11", @@ -8424,12 +8429,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" [[package]] name = "sp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8442,7 +8447,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "sp-core", @@ -8455,7 +8460,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8469,7 +8474,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -8482,7 +8487,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "derive_more", "futures 0.3.5", @@ -8497,7 +8502,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "hash-db", "memory-db", @@ -8511,7 +8516,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "futures-core", @@ -8523,7 +8528,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8535,7 +8540,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8677,7 +8682,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "chrono", "console_error_panic_hook", @@ -8703,7 +8708,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "platforms", ] @@ -8711,7 +8716,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -8734,7 +8739,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "async-std", "derive_more", @@ -8748,7 +8753,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -8775,7 +8780,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "futures 0.3.5", "substrate-test-utils-derive", @@ -8785,7 +8790,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#b7712fed2c58a898f7706e16861d7109c8f585a5" +source = "git+https://github.com/paritytech/substrate#2e7292cd84121db8bcd2317c1ad70e348ee52f7a" dependencies = [ "proc-macro-crate", "quote 1.0.7", @@ -8908,6 +8913,7 @@ name = "test-parachain-adder-collator" version = "0.7.26" dependencies = [ "futures 0.3.5", + "futures-timer 3.0.2", "log 0.4.11", "parity-scale-codec", "polkadot-cli", @@ -8916,11 +8922,16 @@ dependencies = [ "polkadot-parachain", "polkadot-primitives", "polkadot-service", + "polkadot-test-service", "sc-authority-discovery", "sc-cli", + "sc-service", "sp-core", + "sp-keyring", "structopt", + "substrate-test-utils", "test-parachain-adder", + "tokio 0.2.21", ] [[package]] diff --git a/polkadot/cli/Cargo.toml b/polkadot/cli/Cargo.toml index b1c366a3ab..df5375af33 100644 --- a/polkadot/cli/Cargo.toml +++ b/polkadot/cli/Cargo.toml @@ -17,17 +17,19 @@ crate-type = ["cdylib", "rlib"] log = "0.4.11" thiserror = "1.0.21" structopt = { version = "0.3.8", optional = true } +wasm-bindgen = { version = "0.2.57", optional = true } +wasm-bindgen-futures = { version = "0.4.7", optional = true } + +service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true } +polkadot-parachain = { path = "../parachain", optional = true } + sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } -service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true } - frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } - -wasm-bindgen = { version = "0.2.57", optional = true } -wasm-bindgen-futures = { version = "0.4.7", optional = true } browser-utils = { package = "substrate-browser-utils", git = "https://github.com/paritytech/substrate", branch = "master", optional = true } + # this crate is used only to enable `trie-memory-tracker` feature # see https://github.com/paritytech/substrate/pull/6745 sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -36,7 +38,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } [features] -default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker" ] +default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker", "polkadot-parachain" ] wasmtime = [ "sc-cli/wasmtime" ] db = [ "service/db" ] cli = [ diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index 2177afdd7b..6d2aa1acd6 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -219,11 +219,11 @@ pub fn run() -> Result<()> { Some(Subcommand::ValidationWorker(cmd)) => { let _ = sc_cli::init_logger("", sc_tracing::TracingReceiver::Log, None); - if cfg!(feature = "browser") { + if cfg!(feature = "browser") || cfg!(target_os = "android") { Err(sc_cli::Error::Input("Cannot run validation worker in browser".into())) } else { - #[cfg(all(not(feature = "browser"), not(feature = "service-rewr")))] - service::run_validation_worker(&cmd.mem_id)?; + #[cfg(not(any(target_os = "android", feature = "browser")))] + polkadot_parachain::wasm_executor::run_worker(&cmd.mem_id)?; Ok(()) } }, diff --git a/polkadot/node/core/candidate-validation/src/lib.rs b/polkadot/node/core/candidate-validation/src/lib.rs index 29ceb0d33a..dbcd1eab4b 100644 --- a/polkadot/node/core/candidate-validation/src/lib.rs +++ b/polkadot/node/core/candidate-validation/src/lib.rs @@ -31,19 +31,14 @@ use polkadot_subsystem::{ ValidationFailed, RuntimeApiRequest, }, }; -use polkadot_node_subsystem_util::{ - metrics::{self, prometheus}, -}; +use polkadot_node_subsystem_util::metrics::{self, prometheus}; use polkadot_subsystem::errors::RuntimeApiError; use polkadot_node_primitives::{ValidationResult, InvalidCandidate}; use polkadot_primitives::v1::{ ValidationCode, PoV, CandidateDescriptor, PersistedValidationData, OccupiedCoreAssumption, Hash, ValidationOutputs, }; -use polkadot_parachain::wasm_executor::{ - self, ValidationPool, ExecutionMode, ValidationError, - InvalidCandidate as WasmInvalidCandidate, -}; +use polkadot_parachain::wasm_executor::{self, ExecutionMode, ValidationError, InvalidCandidate as WasmInvalidCandidate}; use polkadot_parachain::primitives::{ValidationResult as WasmValidationResult, ValidationParams}; use parity_scale_codec::Encode; @@ -60,57 +55,13 @@ const LOG_TARGET: &'static str = "candidate_validation"; pub struct CandidateValidationSubsystem { spawn: S, metrics: Metrics, -} - -#[derive(Clone)] -struct MetricsInner { - validation_requests: prometheus::CounterVec, -} - -/// Candidate validation metrics. -#[derive(Default, Clone)] -pub struct Metrics(Option); - -impl Metrics { - fn on_validation_event(&self, event: &Result) { - if let Some(metrics) = &self.0 { - match event { - Ok(ValidationResult::Valid(_, _)) => { - metrics.validation_requests.with_label_values(&["valid"]).inc(); - }, - Ok(ValidationResult::Invalid(_)) => { - metrics.validation_requests.with_label_values(&["invalid"]).inc(); - }, - Err(_) => { - metrics.validation_requests.with_label_values(&["validation failure"]).inc(); - }, - } - } - } -} - -impl metrics::Metrics for Metrics { - fn try_register(registry: &prometheus::Registry) -> Result { - let metrics = MetricsInner { - validation_requests: prometheus::register( - prometheus::CounterVec::new( - prometheus::Opts::new( - "parachain_validation_requests_total", - "Number of validation requests served.", - ), - &["validity"], - )?, - registry, - )?, - }; - Ok(Metrics(Some(metrics))) - } + execution_mode: ExecutionMode, } impl CandidateValidationSubsystem { /// Create a new `CandidateValidationSubsystem` with the given task spawner. - pub fn new(spawn: S, metrics: Metrics) -> Self { - CandidateValidationSubsystem { spawn, metrics } + pub fn new(spawn: S, metrics: Metrics, execution_mode: ExecutionMode) -> Self { + CandidateValidationSubsystem { spawn, metrics, execution_mode } } } @@ -119,7 +70,7 @@ impl Subsystem for CandidateValidationSubsystem where S: SpawnNamed + Clone + 'static, { fn start(self, ctx: C) -> SpawnedSubsystem { - let future = run(ctx, self.spawn, self.metrics) + let future = run(ctx, self.spawn, self.metrics, self.execution_mode) .map_err(|e| SubsystemError::with_origin("candidate-validation", e)) .boxed(); SpawnedSubsystem { @@ -133,11 +84,8 @@ async fn run( mut ctx: impl SubsystemContext, spawn: impl SpawnNamed + Clone + 'static, metrics: Metrics, -) - -> SubsystemResult<()> -{ - let execution_mode = ExecutionMode::ExternalProcessSelfHost(ValidationPool::new()); - + execution_mode: ExecutionMode, +) -> SubsystemResult<()> { loop { match ctx.recv().await? { FromOverseer::Signal(OverseerSignal::ActiveLeaves(_)) => {} @@ -499,6 +447,51 @@ fn validate_candidate_exhaustive( } } +#[derive(Clone)] +struct MetricsInner { + validation_requests: prometheus::CounterVec, +} + +/// Candidate validation metrics. +#[derive(Default, Clone)] +pub struct Metrics(Option); + +impl Metrics { + fn on_validation_event(&self, event: &Result) { + if let Some(metrics) = &self.0 { + match event { + Ok(ValidationResult::Valid(_, _)) => { + metrics.validation_requests.with_label_values(&["valid"]).inc(); + }, + Ok(ValidationResult::Invalid(_)) => { + metrics.validation_requests.with_label_values(&["invalid"]).inc(); + }, + Err(_) => { + metrics.validation_requests.with_label_values(&["validation failure"]).inc(); + }, + } + } + } +} + +impl metrics::Metrics for Metrics { + fn try_register(registry: &prometheus::Registry) -> Result { + let metrics = MetricsInner { + validation_requests: prometheus::register( + prometheus::CounterVec::new( + prometheus::Opts::new( + "parachain_validation_requests_total", + "Number of validation requests served.", + ), + &["validity"], + )?, + registry, + )?, + }; + Ok(Metrics(Some(metrics))) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index e51b011c3d..dc417ec16a 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -771,7 +771,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: pallet_sudo: Some(rococo_runtime::SudoConfig { key: endowed_accounts[0].clone(), }), - parachains_configuration: Some(rococo_runtime::ParachainConfigConfig { + parachains_configuration: Some(rococo_runtime::ParachainsConfigurationConfig { config: polkadot_runtime_parachains::configuration::HostConfiguration { validation_upgrade_frequency: 600u32, validation_upgrade_delay: 300, @@ -1223,7 +1223,7 @@ pub fn rococo_testnet_genesis( }), pallet_staking: Some(Default::default()), pallet_sudo: Some(rococo_runtime::SudoConfig { key: root_key }), - parachains_configuration: Some(rococo_runtime::ParachainConfigConfig { + parachains_configuration: Some(rococo_runtime::ParachainsConfigurationConfig { config: polkadot_runtime_parachains::configuration::HostConfiguration { validation_upgrade_frequency: 600u32, validation_upgrade_delay: 300, diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 6fd2b8a432..450dcb2acf 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -50,7 +50,7 @@ use service::RpcHandlers; pub use self::client::{AbstractClient, Client, ClientHandle, ExecuteWithClient, RuntimeApiCollection}; pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec}; pub use consensus_common::{Proposal, SelectChain, BlockImport, RecordProof, block_validation::Chain}; -pub use polkadot_parachain::wasm_executor::run_worker as run_validation_worker; +pub use polkadot_parachain::wasm_executor::ExecutionMode; pub use polkadot_primitives::v1::{Block, BlockId, CollatorId, Hash, Id as ParaId}; pub use sc_client_api::{Backend, ExecutionStrategy, CallExecutor}; pub use sc_consensus::LongestChain; @@ -296,6 +296,7 @@ fn real_overseer( registry: Option<&Registry>, spawner: Spawner, _: IsCollator, + _: ExecutionMode, ) -> Result<(Overseer, OverseerHandler), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend, @@ -321,6 +322,7 @@ fn real_overseer( registry: Option<&Registry>, spawner: Spawner, is_collator: IsCollator, + execution_mode: ExecutionMode, ) -> Result<(Overseer, OverseerHandler), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend, @@ -375,6 +377,7 @@ where candidate_validation: CandidateValidationSubsystem::new( spawner.clone(), Metrics::register(registry)?, + execution_mode, ), chain_api: ChainApiSubsystem::new( runtime_client.clone(), @@ -476,6 +479,7 @@ pub fn new_full( is_collator: IsCollator, grandpa_pause: Option<(u32, u32)>, authority_discovery_config: Option, + execution_mode: ExecutionMode, ) -> Result>>, Error> where RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, @@ -611,6 +615,7 @@ pub fn new_full( prometheus_registry.as_ref(), spawner, is_collator, + execution_mode, )?; let overseer_handler_clone = overseer_handler.clone(); @@ -910,6 +915,7 @@ pub fn build_full( is_collator, grandpa_pause, authority_discovery_config, + Default::default(), ).map(|full| full.with_client(Client::Rococo)) } else if config.chain_spec.is_kusama() { new_full::( @@ -917,6 +923,7 @@ pub fn build_full( is_collator, grandpa_pause, authority_discovery_config, + Default::default(), ).map(|full| full.with_client(Client::Kusama)) } else if config.chain_spec.is_westend() { new_full::( @@ -924,6 +931,7 @@ pub fn build_full( is_collator, grandpa_pause, authority_discovery_config, + Default::default(), ).map(|full| full.with_client(Client::Westend)) } else { new_full::( @@ -931,6 +939,7 @@ pub fn build_full( is_collator, grandpa_pause, authority_discovery_config, + Default::default(), ).map(|full| full.with_client(Client::Polkadot)) } } diff --git a/polkadot/node/subsystem-util/src/lib.rs b/polkadot/node/subsystem-util/src/lib.rs index 08fde2ff3e..bb84ef1171 100644 --- a/polkadot/node/subsystem-util/src/lib.rs +++ b/polkadot/node/subsystem-util/src/lib.rs @@ -292,6 +292,7 @@ pub async fn signing_key(validators: &[ValidatorId], keystore: SyncCryptoStorePt /// /// It can be created if the local node is a validator in the context of a particular /// relay chain block. +#[derive(Debug)] pub struct Validator { signing_context: SigningContext, key: ValidatorId, diff --git a/polkadot/node/test/client/Cargo.toml b/polkadot/node/test/client/Cargo.toml index 794dc2ea08..2b0d6dd91f 100644 --- a/polkadot/node/test/client/Cargo.toml +++ b/polkadot/node/test/client/Cargo.toml @@ -11,6 +11,7 @@ codec = { package = "parity-scale-codec", version = "1.3.4", default-features = polkadot-test-runtime = { path = "../../../runtime/test-runtime" } polkadot-test-service = { path = "../service" } polkadot-primitives = { path = "../../../primitives" } +polkadot-node-subsystem = { path = "../../subsystem" } # Substrate dependencies substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/polkadot/node/test/client/src/block_builder.rs b/polkadot/node/test/client/src/block_builder.rs index f377bf6c16..5d17b8a766 100644 --- a/polkadot/node/test/client/src/block_builder.rs +++ b/polkadot/node/test/client/src/block_builder.rs @@ -69,7 +69,14 @@ impl InitPolkadotBlockBuilder for Client { inherent_data .put_data(sp_timestamp::INHERENT_IDENTIFIER, ×tamp) - .expect("Put timestamp failed"); + .expect("Put timestamp inherent data"); + + inherent_data + .put_data( + polkadot_primitives::v1::INCLUSION_INHERENT_IDENTIFIER, + &polkadot_node_subsystem::messages::ProvisionerInherentData::default(), + ) + .expect("Put inclusion inherent data"); let inherents = block_builder.create_inherents(inherent_data).expect("Creates inherents"); diff --git a/polkadot/node/test/service/Cargo.toml b/polkadot/node/test/service/Cargo.toml index 6e8ba29648..0dbffe78e1 100644 --- a/polkadot/node/test/service/Cargo.toml +++ b/polkadot/node/test/service/Cargo.toml @@ -15,13 +15,17 @@ tempfile = "3.1.0" # Polkadot dependencies polkadot-overseer = { path = "../../overseer" } polkadot-primitives = { path = "../../../primitives" } +polkadot-parachain = { path = "../../../parachain" } polkadot-rpc = { path = "../../../rpc" } polkadot-runtime-common = { path = "../../../runtime/common" } polkadot-service = { path = "../../service" } +polkadot-node-subsystem = { path = "../../subsystem" } +polkadot-node-primitives = { path = "../../primitives" } polkadot-test-runtime = { path = "../../../runtime/test-runtime" } polkadot-runtime-parachains = { path = "../../../runtime/parachains" } # Substrate dependencies +sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } @@ -39,7 +43,6 @@ sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-informant = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/polkadot/node/test/service/src/chain_spec.rs b/polkadot/node/test/service/src/chain_spec.rs index e677d0b9ac..35d610a972 100644 --- a/polkadot/node/test/service/src/chain_spec.rs +++ b/polkadot/node/test/service/src/chain_spec.rs @@ -16,10 +16,11 @@ //! Chain specifications for the test runtime. +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use babe_primitives::AuthorityId as BabeId; use grandpa::AuthorityId as GrandpaId; use pallet_staking::Forcing; -use polkadot_primitives::v0::{ValidatorId, AccountId}; +use polkadot_primitives::v1::{ValidatorId, AccountId}; use polkadot_service::chain_spec::{get_account_id_from_seed, get_from_seed, Extensions}; use polkadot_test_runtime::constants::currency::DOTS; use sc_chain_spec::{ChainSpec, ChainType}; @@ -53,7 +54,6 @@ pub fn polkadot_local_testnet_genesis() -> polkadot_test_runtime::GenesisConfig vec![ get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob"), - get_authority_keys_from_seed("Charlie"), ], get_account_id_from_seed::("Alice"), None, @@ -63,13 +63,14 @@ pub fn polkadot_local_testnet_genesis() -> polkadot_test_runtime::GenesisConfig /// Helper function to generate stash, controller and session key from seed fn get_authority_keys_from_seed( seed: &str, -) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId) { +) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId, AuthorityDiscoveryId) { ( get_account_id_from_seed::(&format!("{}//stash", seed)), get_account_id_from_seed::(seed), get_from_seed::(seed), get_from_seed::(seed), get_from_seed::(seed), + get_from_seed::(seed), ) } @@ -92,46 +93,47 @@ fn testnet_accounts() -> Vec { /// Helper function to create polkadot GenesisConfig for testing fn polkadot_testnet_genesis( - initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ValidatorId)>, + initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ValidatorId, AuthorityDiscoveryId)>, root_key: AccountId, endowed_accounts: Option>, ) -> polkadot_test_runtime::GenesisConfig { - use polkadot_test_runtime as polkadot; + use polkadot_test_runtime as runtime; let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); const ENDOWMENT: u128 = 1_000_000 * DOTS; const STASH: u128 = 100 * DOTS; - polkadot::GenesisConfig { - frame_system: Some(polkadot::SystemConfig { - code: polkadot::WASM_BINARY.expect("Wasm binary must be built for testing").to_vec(), + runtime::GenesisConfig { + frame_system: Some(runtime::SystemConfig { + code: runtime::WASM_BINARY.expect("Wasm binary must be built for testing").to_vec(), ..Default::default() }), - pallet_indices: Some(polkadot::IndicesConfig { indices: vec![] }), - pallet_balances: Some(polkadot::BalancesConfig { + pallet_indices: Some(runtime::IndicesConfig { indices: vec![] }), + pallet_balances: Some(runtime::BalancesConfig { balances: endowed_accounts .iter() .map(|k| (k.clone(), ENDOWMENT)) .collect(), }), - pallet_session: Some(polkadot::SessionConfig { + pallet_session: Some(runtime::SessionConfig { keys: initial_authorities .iter() .map(|x| { ( x.0.clone(), x.0.clone(), - polkadot_test_runtime::SessionKeys { + runtime::SessionKeys { babe: x.2.clone(), grandpa: x.3.clone(), parachain_validator: x.4.clone(), + authority_discovery: x.5.clone(), }, ) }) .collect::>(), }), - pallet_staking: Some(polkadot::StakingConfig { + pallet_staking: Some(runtime::StakingConfig { minimum_validator_count: 1, validator_count: 2, stakers: initial_authorities @@ -141,7 +143,7 @@ fn polkadot_testnet_genesis( x.0.clone(), x.1.clone(), STASH, - polkadot::StakerStatus::Validator, + runtime::StakerStatus::Validator, ) }) .collect(), @@ -152,13 +154,24 @@ fn polkadot_testnet_genesis( }), pallet_babe: Some(Default::default()), pallet_grandpa: Some(Default::default()), - pallet_authority_discovery: Some(polkadot::AuthorityDiscoveryConfig { keys: vec![] }), - claims: Some(polkadot::ClaimsConfig { + pallet_authority_discovery: Some(runtime::AuthorityDiscoveryConfig { keys: vec![] }), + claims: Some(runtime::ClaimsConfig { claims: vec![], vesting: vec![], }), - pallet_vesting: Some(polkadot::VestingConfig { vesting: vec![] }), - pallet_sudo: Some(polkadot::SudoConfig { key: root_key }), + pallet_vesting: Some(runtime::VestingConfig { vesting: vec![] }), + pallet_sudo: Some(runtime::SudoConfig { key: root_key }), + parachains_configuration: Some(runtime::ParachainsConfigurationConfig { + config: polkadot_runtime_parachains::configuration::HostConfiguration { + validation_upgrade_frequency: 10u32, + validation_upgrade_delay: 5, + acceptance_period: 1200, + max_code_size: 5 * 1024 * 1024, + max_head_data_size: 32 * 1024, + group_rotation_frequency: 10, + ..Default::default() + }, + }), } } diff --git a/polkadot/node/test/service/src/lib.rs b/polkadot/node/test/service/src/lib.rs index 5fed8153b8..37877e257a 100644 --- a/polkadot/node/test/service/src/lib.rs +++ b/polkadot/node/test/service/src/lib.rs @@ -23,17 +23,22 @@ pub mod chain_spec; pub use chain_spec::*; use futures::future::Future; use polkadot_overseer::OverseerHandler; -use polkadot_primitives::v1::{Id as ParaId, HeadData, ValidationCode, Balance}; +use polkadot_primitives::v1::{ + Id as ParaId, HeadData, ValidationCode, Balance, CollatorPair, CollatorId, ValidationData, Hash, +}; use polkadot_runtime_common::BlockHashCount; use polkadot_service::{ - new_full, NewFull, FullClient, ClientHandle, ExecuteWithClient, IsCollator, + NewFull, FullClient, ClientHandle, ExecuteWithClient, IsCollator, }; -use polkadot_test_runtime::{Runtime, SignedExtra, SignedPayload, VERSION, ParasSudoWrapperCall, UncheckedExtrinsic}; +use polkadot_node_subsystem::messages::{CollatorProtocolMessage, CollationGenerationMessage}; +use polkadot_test_runtime::{ + Runtime, SignedExtra, SignedPayload, VERSION, ParasSudoWrapperCall, SudoCall, UncheckedExtrinsic, +}; +use polkadot_node_primitives::{Collation, CollationGenerationConfig}; use polkadot_runtime_parachains::paras::ParaGenesisArgs; use sc_chain_spec::ChainSpec; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_executor::native_executor_instance; -use sc_informant::OutputFormat; use sc_network::{ config::{NetworkConfiguration, TransportConfig}, multiaddr, @@ -49,7 +54,7 @@ use sp_blockchain::HeaderBackend; use sp_keyring::Sr25519Keyring; use sp_runtime::{codec::Encode, generic, traits::IdentifyAccount, MultiSigner}; use sp_state_machine::BasicExternalities; -use std::{sync::Arc, time::Duration}; +use std::{sync::Arc, time::Duration, pin::Pin}; use substrate_test_client::{BlockchainEventsExt, RpcHandlersExt, RpcTransactionOutput, RpcTransactionError}; native_executor_instance!( @@ -64,23 +69,25 @@ pub type Client = FullClient Result< NewFull>, ServiceError, > { - new_full::( + polkadot_service::new_full::( config, - IsCollator::No, + is_collator, None, Some(sc_authority_discovery::WorkerConfig { query_interval: Duration::from_secs(1), query_start_delay: Duration::from_secs(0), ..Default::default() }), + polkadot_parachain::wasm_executor::ExecutionMode::InProcess, ).map_err(Into::into) } @@ -105,11 +112,14 @@ pub fn node_config( task_executor: TaskExecutor, key: Sr25519Keyring, boot_nodes: Vec, + is_validator: bool, ) -> Configuration { let base_path = BasePath::new_temp_dir().expect("could not create temporary directory"); let root = base_path.path(); - let role = Role::Authority { - sentry_nodes: Vec::new(), + let role = if is_validator { + Role::Authority { sentry_nodes: Vec::new() } + } else { + Role::Full }; let key_seed = key.to_seed(); let mut spec = polkadot_local_testnet_config(); @@ -127,17 +137,19 @@ pub fn node_config( Default::default(), None, ); - let informant_output_format = OutputFormat { - enable_color: false, - }; network_config.boot_nodes = boot_nodes; network_config.allow_non_globals_in_dht = true; + let addr: multiaddr::Multiaddr = multiaddr::Protocol::Memory(rand::random()).into(); network_config .listen_addresses - .push(multiaddr::Protocol::Memory(rand::random()).into()); + .push(addr.clone()); + + network_config + .public_addresses + .push(addr); network_config.transport = TransportConfig::MemoryOnly; @@ -148,10 +160,7 @@ pub fn node_config( task_executor, transaction_pool: Default::default(), network: network_config, - keystore: KeystoreConfig::Path { - path: root.join("key"), - password: None, - }, + keystore: KeystoreConfig::InMemory, database: DatabaseConfig::RocksDb { path: root.join("db"), cache_size: 128, @@ -189,28 +198,64 @@ pub fn node_config( max_runtime_instances: 8, announce_block: true, base_path: Some(base_path), - informant_output_format, + informant_output_format: Default::default(), } } -/// Run a Polkadot test node using the Polkadot test runtime. +/// Run a test validator node that uses the test runtime. /// /// The node will be using an in-memory socket, therefore you need to provide boot nodes if you /// want it to be connected to other nodes. /// /// The `storage_update_func` function will be executed in an externalities provided environment /// and can be used to make adjustements to the runtime genesis storage. -pub fn run_test_node( +pub fn run_validator_node( task_executor: TaskExecutor, key: Sr25519Keyring, storage_update_func: impl Fn(), boot_nodes: Vec, ) -> PolkadotTestNode { - let config = node_config(storage_update_func, task_executor, key, boot_nodes); + let config = node_config(storage_update_func, task_executor, key, boot_nodes, true); let multiaddr = config.network.listen_addresses[0].clone(); - let NewFull {task_manager, client, network, rpc_handlers, overseer_handler, ..} = - polkadot_test_new_full(config) - .expect("could not create Polkadot test service"); + let NewFull { task_manager, client, network, rpc_handlers, overseer_handler, .. } = + new_full(config, IsCollator::No).expect("could not create Polkadot test service"); + + let overseer_handler = overseer_handler.expect("test node must have an overseer handler"); + let peer_id = network.local_peer_id().clone(); + let addr = MultiaddrWithPeerId { multiaddr, peer_id }; + + PolkadotTestNode { + task_manager, + client, + overseer_handler, + addr, + rpc_handlers, + } +} + +/// Run a test collator node that uses the test runtime. +/// +/// The node will be using an in-memory socket, therefore you need to provide boot nodes if you +/// want it to be connected to other nodes. +/// +/// The `storage_update_func` function will be executed in an externalities provided environment +/// and can be used to make adjustements to the runtime genesis storage. +/// +/// # Note +/// +/// The collator functionionality still needs to be registered at the node! This can be done using +/// [`PolkadotTestNode::register_collator`]. +pub fn run_collator_node( + task_executor: TaskExecutor, + key: Sr25519Keyring, + storage_update_func: impl Fn(), + boot_nodes: Vec, + collator_id: CollatorId, +) -> PolkadotTestNode { + let config = node_config(storage_update_func, task_executor, key, boot_nodes, false); + let multiaddr = config.network.listen_addresses[0].clone(); + let NewFull { task_manager, client, network, rpc_handlers, overseer_handler, .. } = + new_full(config, IsCollator::Yes(collator_id)).expect("could not create Polkadot test service"); let overseer_handler = overseer_handler.expect("test node must have an overseer handler"); let peer_id = network.local_peer_id().clone(); @@ -255,19 +300,19 @@ impl PolkadotTestNode { pub async fn register_parachain( &self, id: ParaId, - validation_code: ValidationCode, - genesis_head: HeadData, + validation_code: impl Into, + genesis_head: impl Into, ) -> Result<(), RpcTransactionError> { let call = ParasSudoWrapperCall::sudo_schedule_para_initialize( id, ParaGenesisArgs { - genesis_head, - validation_code, + genesis_head: genesis_head.into(), + validation_code: validation_code.into(), parachain: true, }, ); - self.send_extrinsic(call, Sr25519Keyring::Alice).await.map(drop) + self.send_extrinsic(SudoCall::sudo(Box::new(call.into())), Sr25519Keyring::Alice).await.map(drop) } /// Wait for `count` blocks to be imported in the node and then exit. This function will not return if no blocks @@ -275,6 +320,29 @@ impl PolkadotTestNode { pub fn wait_for_blocks(&self, count: usize) -> impl Future { self.client.wait_for_blocks(count) } + + /// Register the collator functionality in the overseer of this node. + pub async fn register_collator( + &mut self, + collator_key: CollatorPair, + para_id: ParaId, + collator: Box Pin> + Send>> + Send + Sync>, + ) { + let config = CollationGenerationConfig { + key: collator_key, + collator, + para_id + }; + + self.overseer_handler.send_msg( + CollationGenerationMessage::Initialize(config), + ).await.expect("Registers the collator"); + + self.overseer_handler + .send_msg(CollatorProtocolMessage::CollateOn(para_id)) + .await + .expect("Sends CollateOn"); + } } /// Construct an extrinsic that can be applied to the test runtime. diff --git a/polkadot/node/test/service/tests/build-blocks.rs b/polkadot/node/test/service/tests/build-blocks.rs index b809f188aa..fa03e04228 100644 --- a/polkadot/node/test/service/tests/build-blocks.rs +++ b/polkadot/node/test/service/tests/build-blocks.rs @@ -21,13 +21,13 @@ use sp_keyring::Sr25519Keyring; #[substrate_test_utils::test] async fn ensure_test_service_build_blocks(task_executor: TaskExecutor) { - let mut alice = run_test_node( + let mut alice = run_validator_node( task_executor.clone(), Sr25519Keyring::Alice, || {}, Vec::new(), ); - let mut bob = run_test_node( + let mut bob = run_validator_node( task_executor.clone(), Sr25519Keyring::Bob, || {}, diff --git a/polkadot/node/test/service/tests/call-function.rs b/polkadot/node/test/service/tests/call-function.rs index 184755627f..c6802234c9 100644 --- a/polkadot/node/test/service/tests/call-function.rs +++ b/polkadot/node/test/service/tests/call-function.rs @@ -20,7 +20,7 @@ use sp_keyring::Sr25519Keyring::{Alice, Bob}; #[substrate_test_utils::test] async fn call_function_actually_work(task_executor: TaskExecutor) { - let alice = run_test_node(task_executor, Alice, || {}, Vec::new()); + let alice = run_validator_node(task_executor, Alice, || {}, Vec::new()); let function = polkadot_test_runtime::Call::Balances(pallet_balances::Call::transfer( Default::default(), @@ -37,7 +37,7 @@ async fn call_function_actually_work(task_executor: TaskExecutor) { assert_eq!( result.as_str().map(|x| x.starts_with("0x")), Some(true), - "result starts with 0x" + "result starts with 0x", ); alice.task_manager.clean_shutdown().await; diff --git a/polkadot/parachain/src/wasm_executor/mod.rs b/polkadot/parachain/src/wasm_executor/mod.rs index 4608de4310..735ec7f072 100644 --- a/polkadot/parachain/src/wasm_executor/mod.rs +++ b/polkadot/parachain/src/wasm_executor/mod.rs @@ -37,38 +37,18 @@ const MAX_RUNTIME_MEM: usize = 1024 * 1024 * 1024; // 1 GiB const MAX_CODE_MEM: usize = 16 * 1024 * 1024; // 16 MiB const MAX_VALIDATION_RESULT_HEADER_MEM: usize = MAX_CODE_MEM + 1024; // 16.001 MiB -/// A stub validation-pool defined when compiling for Android or WASM. -#[cfg(any(target_os = "android", target_os = "unknown"))] -#[derive(Clone)] -pub struct ValidationPool { - _inner: (), // private field means not publicly-instantiable -} - -#[cfg(any(target_os = "android", target_os = "unknown"))] -impl ValidationPool { - /// Create a new `ValidationPool`. - pub fn new() -> Self { - ValidationPool { _inner: () } - } -} - -/// A stub function defined when compiling for Android or WASM. -#[cfg(any(target_os = "android", target_os = "unknown"))] -pub fn run_worker(_: &str) -> Result<(), String> { - Err("Cannot run validation worker on this platform".to_string()) -} - /// The execution mode for the `ValidationPool`. -#[derive(Clone)] -#[cfg_attr(not(any(target_os = "android", target_os = "unknown")), derive(Debug))] +#[derive(Clone, Debug)] pub enum ExecutionMode { /// The validation worker is ran in a thread inside the same process. InProcess, /// The validation worker is ran using the process' executable and the subcommand `validation-worker` is passed /// following by the address of the shared memory. + #[cfg(not(any(target_os = "android", target_os = "unknown")))] ExternalProcessSelfHost(ValidationPool), /// The validation worker is ran using the command provided and the argument provided. The address of the shared /// memory is added at the end of the arguments. + #[cfg(not(any(target_os = "android", target_os = "unknown")))] ExternalProcessCustomHost { /// Validation pool. pool: ValidationPool, @@ -80,6 +60,19 @@ pub enum ExecutionMode { }, } +impl Default for ExecutionMode { + fn default() -> Self { + #[cfg(not(any(target_os = "android", target_os = "unknown")))] + { + Self::ExternalProcessSelfHost(ValidationPool::new()) + } + + #[cfg(any(target_os = "android", target_os = "unknown"))] + { + Self::InProcess + } + } +} #[derive(Debug, thiserror::Error)] /// Candidate validation error. @@ -159,13 +152,6 @@ pub fn validate_candidate( let args: Vec<&str> = args.iter().map(|x| x.as_str()).collect(); pool.validate_candidate_custom(validation_code, params, binary, &args) }, - #[cfg(any(target_os = "android", target_os = "unknown"))] - ExecutionMode::ExternalProcessSelfHost(_) | ExecutionMode::ExternalProcessCustomHost { .. } => - Err(ValidationError::Internal(InternalError::System( - Box::::from( - "Remote validator not available".to_string() - ) as Box<_> - ))), } } diff --git a/polkadot/parachain/test-parachains/adder/collator/Cargo.toml b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml index 882c3d72f8..9a066279e8 100644 --- a/polkadot/parachain/test-parachains/adder/collator/Cargo.toml +++ b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml @@ -12,6 +12,7 @@ path = "src/main.rs" [dependencies] codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] } futures = "0.3.4" +futures-timer = "3.0.2" log = "0.4.8" structopt = "0.3.8" @@ -28,6 +29,13 @@ sc-authority-discovery = { git = "https://github.com/paritytech/substrate", bran [dev-dependencies] polkadot-parachain = { path = "../../.." } +polkadot-test-service = { path = "../../../../node/test/service" } + +substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } + +tokio = { version = "0.2", features = ["macros"] } [features] real-overseer = [ "polkadot-service/real-overseer" ] diff --git a/polkadot/parachain/test-parachains/adder/collator/src/lib.rs b/polkadot/parachain/test-parachains/adder/collator/src/lib.rs index ba2923a752..3e24db1fc8 100644 --- a/polkadot/parachain/test-parachains/adder/collator/src/lib.rs +++ b/polkadot/parachain/test-parachains/adder/collator/src/lib.rs @@ -16,12 +16,14 @@ //! Collator for the adder test parachain. -use std::{pin::Pin, sync::{Arc, Mutex}, collections::HashMap}; +use std::{pin::Pin, sync::{Arc, Mutex}, collections::HashMap, time::Duration}; use test_parachain_adder::{hash_state, BlockData, HeadData, execute}; use futures::{Future, FutureExt}; -use polkadot_primitives::v1::{ValidationData, PoV, Hash}; +use futures_timer::Delay; +use polkadot_primitives::v1::{ValidationData, PoV, Hash, CollatorId, CollatorPair}; use polkadot_node_primitives::Collation; use codec::{Encode, Decode}; +use sp_core::Pair; /// The amount we add when producing a new block. /// @@ -32,6 +34,8 @@ const ADD: u64 = 2; struct State { head_to_state: HashMap, u64>, number_to_head: HashMap>, + /// Block number of the best block. + best_block: u64, } impl State { @@ -46,6 +50,7 @@ impl State { Self { head_to_state: vec![(genesis_state.clone(), 0)].into_iter().collect(), number_to_head: vec![(0, genesis_state)].into_iter().collect(), + best_block: 0, } } @@ -53,6 +58,8 @@ impl State { /// /// Returns the new [`BlockData`] and the new [`HeadData`]. fn advance(&mut self, parent_head: HeadData) -> (BlockData, HeadData) { + self.best_block = parent_head.number; + let block = BlockData { state: *self.head_to_state.get(&parent_head).expect("Getting state using parent head"), add: ADD, @@ -72,6 +79,7 @@ impl State { /// The collator of the adder parachain. pub struct Collator { state: Arc>, + key: CollatorPair, } impl Collator { @@ -79,6 +87,7 @@ impl Collator { pub fn new() -> Self { Self { state: Arc::new(Mutex::new(State::genesis())), + key: CollatorPair::generate().0, } } @@ -92,6 +101,16 @@ impl Collator { test_parachain_adder::wasm_binary_unwrap() } + /// Get the collator key. + pub fn collator_key(&self) -> CollatorPair { + self.key.clone() + } + + /// Get the collator id. + pub fn collator_id(&self) -> CollatorId { + self.key.public() + } + /// Create the collation function. /// /// This collation function can be plugged into the overseer to generate collations for the adder parachain. @@ -125,6 +144,20 @@ impl Collator { async move { Some(collation) }.boxed() }) } + + /// Wait until `blocks` are built and enacted. + pub async fn wait_for_blocks(&self, blocks: u64) { + let start_block = self.state.lock().unwrap().best_block; + loop { + Delay::new(Duration::from_secs(1)).await; + + let current_block = self.state.lock().unwrap().best_block; + + if start_block + blocks <= current_block { + return + } + } + } } #[cfg(test)] diff --git a/polkadot/parachain/test-parachains/adder/collator/src/main.rs b/polkadot/parachain/test-parachains/adder/collator/src/main.rs index 1a699df7fb..0bc93821a2 100644 --- a/polkadot/parachain/test-parachains/adder/collator/src/main.rs +++ b/polkadot/parachain/test-parachains/adder/collator/src/main.rs @@ -20,9 +20,9 @@ use sc_cli::{Result, Role, SubstrateCli}; use polkadot_cli::Cli; use polkadot_node_subsystem::messages::{CollatorProtocolMessage, CollationGenerationMessage}; use polkadot_node_primitives::CollationGenerationConfig; -use polkadot_primitives::v1::{CollatorPair, Id as ParaId}; +use polkadot_primitives::v1::Id as ParaId; use test_parachain_adder_collator::Collator; -use sp_core::{Pair, hexdisplay::HexDisplay}; +use sp_core::hexdisplay::HexDisplay; use std::time::Duration; const PARA_ID: ParaId = ParaId::new(100); @@ -42,11 +42,11 @@ fn main() -> Result<()> { match role { Role::Light => Err("Light client not supported".into()), _ => { - let collator_key = CollatorPair::generate().0; + let collator = Collator::new(); let full_node = polkadot_service::build_full( config, - polkadot_service::IsCollator::Yes(collator_key.public()), + polkadot_service::IsCollator::Yes(collator.collator_id()), None, Some(sc_authority_discovery::WorkerConfig { query_interval: Duration::from_secs(1), @@ -57,7 +57,6 @@ fn main() -> Result<()> { let mut overseer_handler = full_node.overseer_handler .expect("Overseer handler should be initialized for collators"); - let collator = Collator::new(); let genesis_head_hex = format!("0x{:?}", HexDisplay::from(&collator.genesis_head())); let validation_code_hex = format!("0x{:?}", HexDisplay::from(&collator.validation_code())); @@ -66,7 +65,7 @@ fn main() -> Result<()> { log::info!("Validation code: {}", validation_code_hex); let config = CollationGenerationConfig { - key: collator_key, + key: collator.collator_key(), collator: collator.create_collation_function(), para_id: PARA_ID, }; diff --git a/polkadot/parachain/test-parachains/adder/collator/tests/integration.rs b/polkadot/parachain/test-parachains/adder/collator/tests/integration.rs new file mode 100644 index 0000000000..a7d9a92559 --- /dev/null +++ b/polkadot/parachain/test-parachains/adder/collator/tests/integration.rs @@ -0,0 +1,73 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Integration test that ensures that we can build and include parachain +//! blocks of the adder parachain. + +// If this test is failing, make sure to run all tests with the `real-overseer` feature being enabled. +#[substrate_test_utils::test] +async fn collating_using_adder_collator(task_executor: sc_service::TaskExecutor) { + use sp_keyring::AccountKeyring::*; + use futures::join; + use polkadot_primitives::v1::Id as ParaId; + + sc_cli::init_logger("", Default::default(), None).expect("Sets up logger"); + + let para_id = ParaId::from(100); + + // start alice + let alice = polkadot_test_service::run_validator_node(task_executor.clone(), Alice, || {}, vec![]); + + // start bob + let bob = polkadot_test_service::run_validator_node( + task_executor.clone(), + Bob, + || {}, + vec![alice.addr.clone()], + ); + + let collator = test_parachain_adder_collator::Collator::new(); + + // register parachain + alice + .register_parachain( + para_id, + collator.validation_code().to_vec(), + collator.genesis_head(), + ) + .await + .unwrap(); + + // run the collator node + let mut charlie = polkadot_test_service::run_collator_node( + task_executor.clone(), + Charlie, + || {}, + vec![alice.addr.clone(), bob.addr.clone()], + collator.collator_id(), + ); + + charlie.register_collator(collator.collator_key(), para_id, collator.create_collation_function()).await; + + // Wait until the parachain has 4 blocks produced. + collator.wait_for_blocks(4).await; + + join!( + alice.task_manager.clean_shutdown(), + bob.task_manager.clean_shutdown(), + charlie.task_manager.clean_shutdown(), + ); +} diff --git a/polkadot/rpc/Cargo.toml b/polkadot/rpc/Cargo.toml index 08445cd7ba..0c50b52fce 100644 --- a/polkadot/rpc/Cargo.toml +++ b/polkadot/rpc/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -jsonrpc-core = "15.0.0" +jsonrpc-core = "15.1.0" polkadot-primitives = { path = "../primitives" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index d9c2a839c4..7b5fcfabff 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -177,8 +177,8 @@ construct_runtime! { AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config}, // Parachains modules. - ParachainOrigin: parachains_origin::{Module, Origin}, - ParachainConfig: parachains_configuration::{Module, Call, Storage, Config}, + ParachainsOrigin: parachains_origin::{Module, Origin}, + ParachainsConfiguration: parachains_configuration::{Module, Call, Storage, Config}, Inclusion: parachains_inclusion::{Module, Call, Storage, Event}, InclusionInherent: parachains_inclusion_inherent::{Module, Call, Storage, Inherent}, Scheduler: parachains_scheduler::{Module, Call, Storage}, diff --git a/polkadot/runtime/test-runtime/src/constants.rs b/polkadot/runtime/test-runtime/src/constants.rs index b18501b714..4c00475f4b 100644 --- a/polkadot/runtime/test-runtime/src/constants.rs +++ b/polkadot/runtime/test-runtime/src/constants.rs @@ -28,10 +28,10 @@ pub mod currency { pub mod time { use primitives::v0::{Moment, BlockNumber}; // Testnet - pub const MILLISECS_PER_BLOCK: Moment = 1000; + pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - // Testnet - pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES; + // 30 seconds for now + pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = MINUTES / 2; // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index c597710a73..183ceb6e6e 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -25,8 +25,9 @@ use sp_std::prelude::*; use sp_std::collections::btree_map::BTreeMap; use codec::Encode; use polkadot_runtime_parachains::{ - configuration, + configuration as parachains_configuration, inclusion, + inclusion_inherent, initializer, paras, router, @@ -42,7 +43,7 @@ use primitives::v1::{ use runtime_common::{ claims, SlowAdjustingFeeUpdate, paras_sudo_wrapper, BlockHashCount, MaximumBlockWeight, AvailableBlockRatio, - MaximumBlockLength, BlockExecutionWeight, ExtrinsicBaseWeight, ParachainSessionKeyPlaceholder, + MaximumBlockLength, BlockExecutionWeight, ExtrinsicBaseWeight, }; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, @@ -78,6 +79,7 @@ pub use sp_runtime::BuildStorage; pub use pallet_timestamp::Call as TimestampCall; pub use pallet_balances::Call as BalancesCall; pub use paras_sudo_wrapper::Call as ParasSudoWrapperCall; +pub use pallet_sudo::Call as SudoCall; /// Constant values used within the runtime. pub mod constants; @@ -252,7 +254,8 @@ impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, pub babe: Babe, - pub parachain_validator: ParachainSessionKeyPlaceholder, + pub parachain_validator: Initializer, + pub authority_discovery: AuthorityDiscovery, } } @@ -440,12 +443,14 @@ impl pallet_sudo::Trait for Runtime { type Call = Call; } -impl configuration::Trait for Runtime {} +impl parachains_configuration::Trait for Runtime {} impl inclusion::Trait for Runtime { type Event = Event; } +impl inclusion_inherent::Trait for Runtime {} + impl initializer::Trait for Runtime { type Randomness = RandomnessCollectiveFlip; } @@ -497,8 +502,9 @@ construct_runtime! { Vesting: pallet_vesting::{Module, Call, Storage, Event, Config}, // Parachains runtime modules - Configuration: configuration::{Module, Call, Storage}, + ParachainsConfiguration: parachains_configuration::{Module, Call, Storage, Config}, Inclusion: inclusion::{Module, Call, Storage, Event}, + InclusionInherent: inclusion_inherent::{Module, Call, Storage, Inherent}, Initializer: initializer::{Module, Call, Storage}, Paras: paras::{Module, Call, Storage, Origin}, Scheduler: scheduler::{Module, Call, Storage}, @@ -603,7 +609,7 @@ sp_api::impl_runtime_apis! { impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { - Vec::new() + AuthorityDiscovery::authorities() } } diff --git a/polkadot/scripts/gitlab/test_linux_stable.sh b/polkadot/scripts/gitlab/test_linux_stable.sh index a18ff43874..98ace6b542 100755 --- a/polkadot/scripts/gitlab/test_linux_stable.sh +++ b/polkadot/scripts/gitlab/test_linux_stable.sh @@ -3,4 +3,4 @@ #shellcheck source=lib.sh source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh" -time cargo test --all --release --verbose --locked --features runtime-benchmarks +time cargo test --all --release --verbose --locked --features=runtime-benchmarks --features=real-overseer