From f82de7b993fe3621781a31efcf285674a349393a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 31 Oct 2020 18:01:46 +0100 Subject: [PATCH] Adds test parachain adder collator (#1864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * start working on building the real overseer Unfortunately, this fails to compile right now due to an upstream failure to compile which is probably brought on by a recent upgrade to rustc v1.47. * fill in AllSubsystems internal constructors * replace fn make_metrics with Metrics::attempt_to_register * update to account for #1740 * remove Metrics::register, rename Metrics::attempt_to_register * add 'static bounds to real_overseer type params * pass authority_discovery and network_service to real_overseer It's not straightforwardly obvious that this is the best way to handle the case when there is no authority discovery service, but it seems to be the best option available at the moment. * select a proper database configuration for the availability store db * use subdirectory for av-store database path * apply Basti's patch which avoids needing to parameterize everything on Block * simplify path extraction * get all tests to compile * Fix Prometheus double-registry error for debugging purposes, added this to node/subsystem-util/src/lib.rs:472-476: ```rust Some(registry) => Self::try_register(registry).map_err(|err| { eprintln!("PrometheusError calling {}::register: {:?}", std::any::type_name::(), err); err }), ``` That pointed out where the registration was failing, which led to this fix. The test still doesn't pass, but it now fails in a new and different way! * authorities must have authority discovery, but not necessarily overseer handlers * fix broken SpawnedSubsystem impls detailed logging determined that using the `Box::new` style of future generation, the `self.run` method was never being called, leading to dropped receivers / closed senders for those subsystems, causing the overseer to shut down immediately. This is not the final fix needed to get things working properly, but it's a good start. * use prometheus properly Prometheus lets us register simple counters, which aren't very interesting. It also allows us to register CounterVecs, which are. With a CounterVec, you can provide a set of labels, which can later be used to filter the counts. We were using them wrong, though. This pattern was repeated in a variety of places in the code: ```rust // panics with an cardinality mismatch let my_counter = register(CounterVec::new(opts, &["succeeded", "failed"])?, registry)?; my_counter.with_label_values(&["succeeded"]).inc() ``` The problem is that the labels provided in the constructor are not the set of legal values which can be annotated, but a set of individual label names which can have individual, arbitrary values. This commit fixes that. * get av-store subsystem to actually run properly and not die on first signal * typo fix: incomming -> incoming * don't disable authority discovery in test nodes * Fix rococo-v1 missing session keys * Update node/core/av-store/Cargo.toml * try dummying out av-store on non-full-nodes * overseer and subsystems are required only for full nodes * Reduce the amount of warnings on browser target * Fix two more warnings * InclusionInherent should actually have an Inherent module on rococo * Ancestry: don't return genesis' parent hash * Update Cargo.lock * fix broken test * update test script: specify chainspec as script argument * Apply suggestions from code review Co-authored-by: Bastian Köcher * Update node/service/src/lib.rs Co-authored-by: Bastian Köcher * node/service/src/lib: Return error via ? operator * post-merge blues * add is_collator flag * prevent occasional av-store test panic * simplify fix; expand application * run authority_discovery in Role::Discover when collating * distinguish between proposer closed channel errors * add IsCollator enum, remove is_collator CLI flag * improve formatting * remove nop loop * Fix some stuff * Adds test parachain adder collator * Add sudo to Rococo, change session length to 30 seconds and some renaming * Update to the latest changes on master * Some fixes * Fix compilation * Update parachain/test-parachains/adder/collator/src/lib.rs Co-authored-by: Sergei Shulepov * Review comments * Downgrade transaction version * Fixes * MOARE * Register notification protocols * utils: remove unused error * av-store: more resilient to some errors * address review nits * address more review nits Co-authored-by: Peter Goodspeed-Niklaus Co-authored-by: Andronik Ordian Co-authored-by: Fedor Sakharov Co-authored-by: Robert Habermeier Co-authored-by: Peter Goodspeed-Niklaus Co-authored-by: Max Inden Co-authored-by: Sergey Shulepov Co-authored-by: Sergei Shulepov --- polkadot/Cargo.lock | 300 +++++----- polkadot/Cargo.toml | 3 +- polkadot/node/core/av-store/src/lib.rs | 52 +- .../node/network/collator-protocol/src/lib.rs | 4 +- polkadot/node/service/Cargo.toml | 2 +- polkadot/node/service/src/chain_spec.rs | 6 +- polkadot/node/service/src/lib.rs | 2 + polkadot/node/subsystem-util/src/lib.rs | 5 +- polkadot/parachain/Cargo.toml | 3 +- polkadot/parachain/src/primitives.rs | 18 +- .../test-parachains/adder/collator/Cargo.toml | 29 + .../test-parachains/adder/collator/src/lib.rs | 157 ++++++ .../adder/collator/src/main.rs | 81 +++ .../test-parachains/adder/src/lib.rs | 10 +- .../test-parachains/adder/wasm/Cargo.toml | 0 .../test-parachains/tests/adder/mod.rs | 36 +- .../runtime/{rococo-v1 => rococo}/Cargo.toml | 4 +- .../runtime/{rococo-v1 => rococo}/README.md | 0 .../runtime/{rococo-v1 => rococo}/build.rs | 0 .../{rococo-v1 => rococo}/src/constants.rs | 3 +- .../runtime/{rococo-v1 => rococo}/src/lib.rs | 526 +++++++++--------- 21 files changed, 763 insertions(+), 478 deletions(-) create mode 100644 polkadot/parachain/test-parachains/adder/collator/Cargo.toml create mode 100644 polkadot/parachain/test-parachains/adder/collator/src/lib.rs create mode 100644 polkadot/parachain/test-parachains/adder/collator/src/main.rs delete mode 100644 polkadot/parachain/test-parachains/adder/wasm/Cargo.toml rename polkadot/runtime/{rococo-v1 => rococo}/Cargo.toml (97%) rename polkadot/runtime/{rococo-v1 => rococo}/README.md (100%) rename polkadot/runtime/{rococo-v1 => rococo}/build.rs (100%) rename polkadot/runtime/{rococo-v1 => rococo}/src/constants.rs (97%) rename polkadot/runtime/{rococo-v1 => rococo}/src/lib.rs (98%) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index c192a26692..6bdc6bfc16 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -1319,9 +1319,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c5cb4dc433c59f09df4b4450f649cbfed61e8a3505abe32e4154066439157e" +checksum = "534ce924bff9118be8b28b24ede6bf7e96a00b53e4ded25050aa7b526e051e1a" dependencies = [ "indenter", "once_cell 1.4.1", @@ -1460,7 +1460,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", ] @@ -1468,7 +1468,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "chrono", "frame-benchmarking", @@ -1508,7 +1508,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -1524,7 +1524,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "12.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "serde", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "bitflags", "frame-metadata", @@ -1560,7 +1560,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1571,7 +1571,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1593,7 +1593,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1609,7 +1609,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -1623,7 +1623,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-api", @@ -3812,7 +3812,7 @@ checksum = "7a1250cdd103eef6bd542b5ae82989f931fc00a41a27f60377338241594410f3" [[package]] name = "pallet-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -3828,7 +3828,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3868,7 +3868,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3882,7 +3882,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3898,7 +3898,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3913,7 +3913,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3928,7 +3928,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3949,7 +3949,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3965,7 +3965,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -3985,7 +3985,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4002,7 +4002,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4016,7 +4016,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4032,7 +4032,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4046,7 +4046,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4061,7 +4061,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4082,7 +4082,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4098,7 +4098,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4111,7 +4111,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "enumflags2", "frame-support", @@ -4126,7 +4126,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4141,7 +4141,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4161,7 +4161,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4177,7 +4177,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4191,7 +4191,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4213,7 +4213,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -4224,7 +4224,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4238,7 +4238,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4256,7 +4256,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "frame-system", @@ -4273,7 +4273,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4291,7 +4291,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-support", "parity-scale-codec", @@ -4304,7 +4304,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4319,7 +4319,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-benchmarking", "frame-support", @@ -4335,7 +4335,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5477,7 +5477,7 @@ dependencies = [ "polkadot-runtime", "polkadot-statement-distribution", "polkadot-test-client", - "rococo-v1-runtime", + "rococo-runtime", "sc-authority-discovery", "sc-block-builder", "sc-chain-spec", @@ -6363,7 +6363,7 @@ dependencies = [ ] [[package]] -name = "rococo-v1-runtime" +name = "rococo-runtime" version = "0.8.26" dependencies = [ "frame-executive", @@ -6381,6 +6381,7 @@ dependencies = [ "pallet-session", "pallet-staking", "pallet-staking-reward-curve", + "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -6538,7 +6539,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "async-trait", "bytes 0.5.6", @@ -6568,7 +6569,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6592,7 +6593,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6609,7 +6610,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -6630,7 +6631,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -6641,7 +6642,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6685,7 +6686,7 @@ dependencies = [ [[package]] name = "sc-cli-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -6696,7 +6697,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "fnv", @@ -6733,7 +6734,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "blake2-rfc", "hash-db", @@ -6763,7 +6764,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6774,7 +6775,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "fork-tree", @@ -6819,7 +6820,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "futures 0.3.5", @@ -6843,7 +6844,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6856,7 +6857,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6880,7 +6881,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "sc-client-api", @@ -6894,7 +6895,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "lazy_static", @@ -6923,7 +6924,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "log 0.4.11", @@ -6940,7 +6941,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -6955,7 +6956,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -6973,7 +6974,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "finality-grandpa", @@ -7010,7 +7011,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "finality-grandpa", @@ -7034,7 +7035,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -7052,7 +7053,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "async-trait", "derive_more", @@ -7072,7 +7073,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "hash-db", "lazy_static", @@ -7091,7 +7092,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "async-std", "async-trait", @@ -7145,7 +7146,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7160,7 +7161,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "bytes 0.5.6", "fnv", @@ -7187,7 +7188,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "libp2p", @@ -7200,7 +7201,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "substrate-prometheus-endpoint", @@ -7209,7 +7210,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "hash-db", @@ -7242,7 +7243,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "futures 0.3.5", @@ -7266,7 +7267,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.1.29", "jsonrpc-core", @@ -7284,7 +7285,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "directories", @@ -7348,7 +7349,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -7362,7 +7363,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -7381,7 +7382,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7402,7 +7403,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "erased-serde", "log 0.4.11", @@ -7421,7 +7422,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "futures 0.3.5", @@ -7442,7 +7443,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "futures 0.3.5", @@ -7868,7 +7869,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "log 0.4.11", @@ -7880,7 +7881,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "hash-db", "parity-scale-codec", @@ -7895,7 +7896,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7907,7 +7908,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "serde", @@ -7919,7 +7920,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7932,7 +7933,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-api", @@ -7944,7 +7945,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7955,7 +7956,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-api", @@ -7967,7 +7968,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "lru 0.4.3", @@ -7984,7 +7985,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "serde", "serde_json", @@ -7993,7 +7994,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -8019,7 +8020,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "merlin", "parity-scale-codec", @@ -8039,7 +8040,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8048,7 +8049,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -8060,7 +8061,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "base58", "blake2-rfc", @@ -8104,7 +8105,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -8113,7 +8114,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -8123,7 +8124,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "environmental", "parity-scale-codec", @@ -8134,7 +8135,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "finality-grandpa", "log 0.4.11", @@ -8151,7 +8152,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "parking_lot 0.10.2", @@ -8163,7 +8164,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "hash-db", @@ -8187,7 +8188,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "lazy_static", "sp-core", @@ -8198,7 +8199,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "async-trait", "derive_more", @@ -8214,7 +8215,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "serde", @@ -8226,7 +8227,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -8237,7 +8238,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "sp-api", "sp-core", @@ -8247,7 +8248,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "backtrace", "log 0.4.11", @@ -8256,7 +8257,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "serde", "sp-core", @@ -8265,7 +8266,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "either", "hash256-std-hasher", @@ -8287,7 +8288,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "primitive-types", @@ -8303,7 +8304,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "Inflector", "proc-macro-crate", @@ -8315,7 +8316,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "serde", "serde_json", @@ -8324,7 +8325,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-api", @@ -8337,7 +8338,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8347,7 +8348,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "hash-db", "log 0.4.11", @@ -8369,12 +8370,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" [[package]] name = "sp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8387,7 +8388,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "sp-core", @@ -8400,7 +8401,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8414,7 +8415,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -8427,7 +8428,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "derive_more", "futures 0.3.5", @@ -8442,7 +8443,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "hash-db", "memory-db", @@ -8456,7 +8457,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "futures-core", @@ -8468,7 +8469,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8480,7 +8481,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8621,7 +8622,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "chrono", "console_error_panic_hook", @@ -8647,7 +8648,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "platforms", ] @@ -8655,7 +8656,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -8678,7 +8679,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "async-std", "derive_more", @@ -8692,7 +8693,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -8719,7 +8720,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "futures 0.3.5", "substrate-test-utils-derive", @@ -8729,7 +8730,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#5d307871e98319874a8898e4138d6d42fe214719" +source = "git+https://github.com/paritytech/substrate#3664cdbc92b13d7197fbf2a7fa2b0cd6201eba09" dependencies = [ "proc-macro-crate", "quote 1.0.7", @@ -8847,6 +8848,25 @@ dependencies = [ "tiny-keccak 1.5.0", ] +[[package]] +name = "test-parachain-adder-collator" +version = "0.7.26" +dependencies = [ + "futures 0.3.5", + "log 0.4.11", + "parity-scale-codec", + "polkadot-cli", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-service", + "sc-cli", + "sp-core", + "structopt", + "test-parachain-adder", +] + [[package]] name = "test-parachain-halt" version = "0.8.26" diff --git a/polkadot/Cargo.toml b/polkadot/Cargo.toml index 8c3f43e3d2..991d96a17e 100644 --- a/polkadot/Cargo.toml +++ b/polkadot/Cargo.toml @@ -34,7 +34,7 @@ members = [ "runtime/parachains", "runtime/polkadot", "runtime/kusama", - "runtime/rococo-v1", + "runtime/rococo", "runtime/westend", "runtime/test-runtime", "statement-table", @@ -69,6 +69,7 @@ members = [ "node/test/service", "parachain/test-parachains", "parachain/test-parachains/adder", + "parachain/test-parachains/adder/collator", ] [badges] diff --git a/polkadot/node/core/av-store/src/lib.rs b/polkadot/node/core/av-store/src/lib.rs index 2fe87de358..22b8c29107 100644 --- a/polkadot/node/core/av-store/src/lib.rs +++ b/polkadot/node/core/av-store/src/lib.rs @@ -56,8 +56,6 @@ mod columns { #[derive(Debug, Error)] enum Error { - #[error(transparent)] - RuntimeAPI(#[from] RuntimeApiError), #[error(transparent)] ChainAPI(#[from] ChainApiError), #[error(transparent)] @@ -65,13 +63,30 @@ enum Error { #[error(transparent)] Io(#[from] io::Error), #[error(transparent)] - Oneshot(#[from] oneshot::Canceled), + ChainApiChannelIsClosed(#[from] oneshot::Canceled), #[error(transparent)] Subsystem(#[from] SubsystemError), #[error(transparent)] Time(#[from] SystemTimeError), } +/// Class of errors which we should handle more gracefully. +/// An occurrence of this error should not bring down the subsystem. +#[derive(Debug, Error)] +enum NonFatalError { + /// A Runtime API error occurred. + #[error(transparent)] + RuntimeApi(#[from] RuntimeApiError), + + /// The receiver's end of the channel is closed. + #[error(transparent)] + Oneshot(#[from] oneshot::Canceled), + + /// Overseer channel's buffer is full. + #[error(transparent)] + OverseerOutOfCapacity(#[from] SubsystemError), +} + /// A wrapper type for delays. #[derive(Debug, Decode, Encode, Eq)] enum PruningDelay { @@ -582,7 +597,13 @@ async fn process_block_activated( where Context: SubsystemContext { - let events = request_candidate_events(ctx, hash).await?; + let events = match request_candidate_events(ctx, hash).await { + Ok(events) => events, + Err(err) => { + log::debug!(target: LOG_TARGET, "requesting candidate events failed due to {}", err); + return Ok(()); + } + }; log::trace!(target: LOG_TARGET, "block activated {}", hash); let mut included = HashSet::new(); @@ -626,7 +647,7 @@ where async fn request_candidate_events( ctx: &mut Context, hash: Hash, -) -> Result, Error> +) -> Result, NonFatalError> where Context: SubsystemContext { @@ -651,44 +672,49 @@ where Context: SubsystemContext { use AvailabilityStoreMessage::*; + + fn log_send_error(request: &'static str) { + log::debug!(target: LOG_TARGET, "error sending a response to {}", request); + } + match msg { QueryAvailableData(hash, tx) => { tx.send(available_data(&subsystem.inner, &hash).map(|d| d.data)) - .map_err(|_| oneshot::Canceled)?; + .unwrap_or_else(|_| log_send_error("QueryAvailableData")); } QueryDataAvailability(hash, tx) => { tx.send(available_data(&subsystem.inner, &hash).is_some()) - .map_err(|_| oneshot::Canceled)?; + .unwrap_or_else(|_| log_send_error("QueryDataAvailability")); } QueryChunk(hash, id, tx) => { tx.send(get_chunk(subsystem, &hash, id)?) - .map_err(|_| oneshot::Canceled)?; + .unwrap_or_else(|_| log_send_error("QueryChunk")); } QueryChunkAvailability(hash, id, tx) => { tx.send(get_chunk(subsystem, &hash, id)?.is_some()) - .map_err(|_| oneshot::Canceled)?; + .unwrap_or_else(|_| log_send_error("QueryChunkAvailability")); } StoreChunk { candidate_hash, relay_parent, validator_index, chunk, tx } => { // Current block number is relay_parent block number + 1. let block_number = get_block_number(ctx, relay_parent).await? + 1; match store_chunk(subsystem, &candidate_hash, validator_index, chunk, block_number) { Err(e) => { - tx.send(Err(())).map_err(|_| oneshot::Canceled)?; + tx.send(Err(())).unwrap_or_else(|_| log_send_error("StoreChunk (Err)")); return Err(e); } Ok(()) => { - tx.send(Ok(())).map_err(|_| oneshot::Canceled)?; + tx.send(Ok(())).unwrap_or_else(|_| log_send_error("StoreChunk (Ok)")); } } } StoreAvailableData(hash, id, n_validators, av_data, tx) => { match store_available_data(subsystem, &hash, id, n_validators, av_data) { Err(e) => { - tx.send(Err(())).map_err(|_| oneshot::Canceled)?; + tx.send(Err(())).unwrap_or_else(|_| log_send_error("StoreAvailableData (Err)")); return Err(e); } Ok(()) => { - tx.send(Ok(())).map_err(|_| oneshot::Canceled)?; + tx.send(Ok(())).unwrap_or_else(|_| log_send_error("StoreAvailableData (Ok)")); } } } diff --git a/polkadot/node/network/collator-protocol/src/lib.rs b/polkadot/node/network/collator-protocol/src/lib.rs index 642aac587c..f10c85b5e8 100644 --- a/polkadot/node/network/collator-protocol/src/lib.rs +++ b/polkadot/node/network/collator-protocol/src/lib.rs @@ -101,12 +101,12 @@ impl CollatorProtocolSubsystem { Context: SubsystemContext, { match self.protocol_side { - ProtocolSide::Validator(metrics) => validator_side::run( + ProtocolSide::Validator(metrics) => validator_side::run( ctx, REQUEST_TIMEOUT, metrics, ).await, - ProtocolSide::Collator(id, metrics) => collator_side::run( + ProtocolSide::Collator(id, metrics) => collator_side::run( ctx, id, metrics, diff --git a/polkadot/node/service/Cargo.toml b/polkadot/node/service/Cargo.toml index 813d5f595a..bfafd798d3 100644 --- a/polkadot/node/service/Cargo.toml +++ b/polkadot/node/service/Cargo.toml @@ -73,7 +73,7 @@ polkadot-node-subsystem-util = { path = "../subsystem-util" } polkadot-runtime = { path = "../../runtime/polkadot" } kusama-runtime = { path = "../../runtime/kusama" } westend-runtime = { path = "../../runtime/westend" } -rococo-runtime = { package = "rococo-v1-runtime", path = "../../runtime/rococo-v1" } +rococo-runtime = { path = "../../runtime/rococo" } # Polkadot Subsystems polkadot-availability-bitfield-distribution = { path = "../network/bitfield-distribution", optional = true } diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index cabed4105d..a49f455bd4 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -768,6 +768,9 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: keys: vec![], }), pallet_staking: Some(Default::default()), + pallet_sudo: Some(rococo_runtime::SudoConfig { + key: endowed_accounts[0].clone(), + }), } } @@ -1176,7 +1179,7 @@ pub fn westend_testnet_genesis( pub fn rococo_testnet_genesis( wasm_binary: &[u8], initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>, - _root_key: AccountId, + root_key: AccountId, endowed_accounts: Option>, ) -> rococo_runtime::GenesisConfig { let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); @@ -1208,6 +1211,7 @@ pub fn rococo_testnet_genesis( keys: vec![], }), pallet_staking: Some(Default::default()), + pallet_sudo: Some(rococo_runtime::SudoConfig { key: root_key }), } } diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 046c1b1383..8073939e11 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -503,6 +503,8 @@ pub fn new_full( let (shared_voter_state, finality_proof_provider) = rpc_setup; + config.network.notifications_protocols.extend(polkadot_network_bridge::notifications_protocol_info()); + let (network, network_status_sinks, system_rpc_tx, network_starter) = service::build_network(service::BuildNetworkParams { config: &config, diff --git a/polkadot/node/subsystem-util/src/lib.rs b/polkadot/node/subsystem-util/src/lib.rs index 3e9fc6366f..ec8832065a 100644 --- a/polkadot/node/subsystem-util/src/lib.rs +++ b/polkadot/node/subsystem-util/src/lib.rs @@ -28,7 +28,7 @@ #![warn(missing_docs)] use polkadot_node_subsystem::{ - errors::{ChainApiError, RuntimeApiError}, + errors::RuntimeApiError, messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest, RuntimeApiSender}, FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemError, SubsystemResult, }; @@ -99,9 +99,6 @@ pub enum Error { /// A subsystem error #[error(transparent)] Subsystem(#[from] SubsystemError), - /// An error in the Chain API. - #[error(transparent)] - ChainApi(#[from] ChainApiError), /// An error in the Runtime API. #[error(transparent)] RuntimeApi(#[from] RuntimeApiError), diff --git a/polkadot/parachain/Cargo.toml b/polkadot/parachain/Cargo.toml index 15bbdf3229..e3a01c31cd 100644 --- a/polkadot/parachain/Cargo.toml +++ b/polkadot/parachain/Cargo.toml @@ -15,10 +15,10 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-wasm-interface = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } polkadot-core-primitives = { path = "../core-primitives", default-features = false } +derive_more = { version = "0.99.11" } # all optional crates. thiserror = { version = "1.0.21", optional = true } -derive_more = { version = "0.99.11", optional = true } serde = { version = "1.0.102", default-features = false, features = [ "derive" ], optional = true } sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } @@ -36,7 +36,6 @@ wasm-api = [] std = [ "codec/std", "thiserror", - "derive_more", "serde/std", "sp-std/std", "sp-runtime/std", diff --git a/polkadot/parachain/src/primitives.rs b/polkadot/parachain/src/primitives.rs index 83edc4e0f2..50173adbc5 100644 --- a/polkadot/parachain/src/primitives.rs +++ b/polkadot/parachain/src/primitives.rs @@ -34,31 +34,19 @@ use polkadot_core_primitives::Hash; pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber; /// Parachain head data included in the chain. -#[derive(PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug, derive_more::From)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Default, Hash))] pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); -impl From> for HeadData { - fn from(head: Vec) -> Self { - HeadData(head) - } -} - /// Parachain validation code. -#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, derive_more::From)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))] pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); -impl From> for ValidationCode { - fn from(code: Vec) -> Self { - ValidationCode(code) - } -} - /// Parachain block data. /// /// Contains everything required to validate para-block, may contain block and witness data. -#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, derive_more::From)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] pub struct BlockData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); diff --git a/polkadot/parachain/test-parachains/adder/collator/Cargo.toml b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml new file mode 100644 index 0000000000..459017b06d --- /dev/null +++ b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "test-parachain-adder-collator" +version = "0.7.26" +authors = ["Parity Technologies "] +description = "Collator for the adder test parachain" +edition = "2018" + +[[bin]] +name = "adder-collator" +path = "src/main.rs" + +[dependencies] +codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] } +futures = "0.3.4" +log = "0.4.8" +structopt = "0.3.8" + +test-parachain-adder = { path = ".." } +polkadot-primitives = { path = "../../../../primitives" } +polkadot-cli = { path = "../../../../cli" } +polkadot-service = { path = "../../../../node/service" } +polkadot-node-primitives = { path = "../../../../node/primitives" } +polkadot-node-subsystem = { path = "../../../../node/subsystem" } + +sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } + +[dev-dependencies] +polkadot-parachain = { path = "../../.." } diff --git a/polkadot/parachain/test-parachains/adder/collator/src/lib.rs b/polkadot/parachain/test-parachains/adder/collator/src/lib.rs new file mode 100644 index 0000000000..c68434ce37 --- /dev/null +++ b/polkadot/parachain/test-parachains/adder/collator/src/lib.rs @@ -0,0 +1,157 @@ +// 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 . + +//! Collator for the adder test parachain. + +use std::{pin::Pin, sync::{Arc, Mutex}}; +use test_parachain_adder::{hash_state, BlockData, HeadData, execute}; +use futures::{Future, FutureExt}; +use polkadot_primitives::v1::{ValidationData, PoV, Hash}; +use polkadot_node_primitives::Collation; +use codec::Encode; + +/// The amount we add when producing a new block. +/// +/// This is a constant to make tests easily reproducible. +const ADD: u64 = 2; + +/// The state of the adder parachain. +struct State { + genesis_state: HeadData, + last_head: HeadData, + state: u64, +} + +impl State { + /// Init the genesis state. + fn genesis() -> Self { + let genesis_state = HeadData { + number: 0, + parent_hash: Default::default(), + post_state: hash_state(0), + }; + let last_head = genesis_state.clone(); + + Self { + genesis_state, + last_head, + state: 0, + } + } + + /// Advance the state and produce a new block. + /// + /// Returns the new [`BlockData`] and the new [`HeadData`]. + fn advance(&mut self) -> (BlockData, HeadData) { + let block = BlockData { + state: self.state, + add: ADD, + }; + let new_head = execute(self.last_head.hash(), self.last_head.clone(), &block) + .expect("Produces valid block"); + + self.last_head = new_head.clone(); + self.state = self.state.wrapping_add(ADD); + + (block, new_head) + } +} + +/// The collator of the adder parachain. +pub struct Collator { + state: Arc>, +} + +impl Collator { + /// Create a new collator instance with the state initialized as genesis. + pub fn new() -> Self { + Self { + state: Arc::new(Mutex::new(State::genesis())), + } + } + + /// Get the SCALE encoded genesis head of the adder parachain. + pub fn genesis_head(&self) -> Vec { + self.state.lock().unwrap().genesis_state.encode() + } + + /// Get the validation code of the adder parachain. + pub fn validation_code(&self) -> &[u8] { + test_parachain_adder::wasm_binary_unwrap() + } + + /// Create the collation function. + /// + /// This collation function can be plugged into the overseer to generate collations for the adder parachain. + pub fn create_collation_function( + &self, + ) -> Box Pin> + Send>> + Send + Sync> { + let state = self.state.clone(); + + Box::new(move |_, _| { + let (block_data, head_data) = state.lock().unwrap().advance(); + + let collation = Collation { + upward_messages: Vec::new(), + new_validation_code: None, + head_data: head_data.encode().into(), + proof_of_validity: PoV { block_data: block_data.encode().into() }, + processed_downward_messages: 0, + }; + + async move { Some(collation) }.boxed() + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use futures::executor::block_on; + use polkadot_parachain::{primitives::ValidationParams, wasm_executor::ExecutionMode}; + use codec::Decode; + + #[test] + fn collator_works() { + let collator = Collator::new(); + let collation_function = collator.create_collation_function(); + + for _ in 0..5 { + let parent_head = collator.state.lock().unwrap().last_head.clone(); + let collation = block_on(collation_function(Default::default(), &Default::default())).unwrap(); + validate_collation(&collator, parent_head, collation); + } + } + + fn validate_collation(collator: &Collator, parent_head: HeadData, collation: Collation) { + let ret = polkadot_parachain::wasm_executor::validate_candidate( + collator.validation_code(), + ValidationParams { + parent_head: parent_head.encode().into(), + block_data: collation.proof_of_validity.block_data, + relay_chain_height: 1, + hrmp_mqc_heads: Vec::new(), + dmq_mqc_head: Default::default(), + }, + &ExecutionMode::InProcess, + sp_core::testing::TaskExecutor::new(), + ).unwrap(); + + let new_head = HeadData::decode(&mut &ret.head_data.0[..]).unwrap(); + assert_eq!(collator.state.lock().unwrap().last_head, new_head); + } +} diff --git a/polkadot/parachain/test-parachains/adder/collator/src/main.rs b/polkadot/parachain/test-parachains/adder/collator/src/main.rs new file mode 100644 index 0000000000..a55f556757 --- /dev/null +++ b/polkadot/parachain/test-parachains/adder/collator/src/main.rs @@ -0,0 +1,81 @@ +// 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 . + +//! Collator for the adder test parachain. + +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 test_parachain_adder_collator::Collator; +use sp_core::{Pair, hexdisplay::HexDisplay}; + +const PARA_ID: ParaId = ParaId::new(100); + +fn main() -> Result<()> { + let cli = Cli::from_args(); + + if cli.subcommand.is_some() { + return Err("Subcommands are not supported".into()) + } + + let runner = cli.create_runner(&cli.run.base)?; + + runner.run_node_until_exit(|config| async move { + let role = config.role.clone(); + + match role { + Role::Light => Err("Light client not supported".into()), + _ => { + let collator_key = CollatorPair::generate().0; + + let full_node = polkadot_service::build_full( + config, + polkadot_service::IsCollator::Yes(collator_key.public()), + None, + )?; + 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())); + + log::info!("Running adder collator for parachain id: {}", PARA_ID); + log::info!("Genesis state: {}", genesis_head_hex); + log::info!("Validation code: {}", validation_code_hex); + + let config = CollationGenerationConfig { + key: collator_key, + collator: collator.create_collation_function(), + para_id: PARA_ID, + }; + overseer_handler + .send_msg(CollationGenerationMessage::Initialize(config)) + .await + .expect("Registers collator"); + + overseer_handler + .send_msg(CollatorProtocolMessage::CollateOn(PARA_ID)) + .await + .expect("Collates on"); + + Ok(full_node.task_manager) + }, + } + }) +} diff --git a/polkadot/parachain/test-parachains/adder/src/lib.rs b/polkadot/parachain/test-parachains/adder/src/lib.rs index 7ccba8400e..2e3ab895e2 100644 --- a/polkadot/parachain/test-parachains/adder/src/lib.rs +++ b/polkadot/parachain/test-parachains/adder/src/lib.rs @@ -33,15 +33,15 @@ static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc; #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -#[cfg(feature = "std")] /// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics. +#[cfg(feature = "std")] pub fn wasm_binary_unwrap() -> &'static [u8] { WASM_BINARY.expect("Development wasm binary is not available. Testing is only \ supported with the flag disabled.") } /// Head data for this parachain. -#[derive(Default, Clone, Hash, Eq, PartialEq, Encode, Decode)] +#[derive(Default, Clone, Hash, Eq, PartialEq, Encode, Decode, Debug)] pub struct HeadData { /// Block number pub number: u64, @@ -62,7 +62,7 @@ impl HeadData { pub struct BlockData { /// State to begin from. pub state: u64, - /// Amount to add (overflowing) + /// Amount to add (wrapping) pub add: u64, } @@ -81,13 +81,13 @@ pub fn execute( parent_head: HeadData, block_data: &BlockData, ) -> Result { - debug_assert_eq!(parent_hash, parent_head.hash()); + assert_eq!(parent_hash, parent_head.hash()); if hash_state(block_data.state) != parent_head.post_state { return Err(StateMismatch); } - let new_state = block_data.state.overflowing_add(block_data.add).0; + let new_state = block_data.state.wrapping_add(block_data.add); Ok(HeadData { number: parent_head.number + 1, diff --git a/polkadot/parachain/test-parachains/adder/wasm/Cargo.toml b/polkadot/parachain/test-parachains/adder/wasm/Cargo.toml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/polkadot/parachain/test-parachains/tests/adder/mod.rs b/polkadot/parachain/test-parachains/tests/adder/mod.rs index b0d905988c..8e581d187a 100644 --- a/polkadot/parachain/test-parachains/tests/adder/mod.rs +++ b/polkadot/parachain/test-parachains/tests/adder/mod.rs @@ -28,34 +28,7 @@ use parachain::{ wasm_executor::{ValidationPool, ExecutionMode} }; use codec::{Decode, Encode}; - -/// Head data for this parachain. -#[derive(Default, Clone, Encode, Decode)] -struct HeadData { - /// Block number - number: u64, - /// parent block keccak256 - parent_hash: [u8; 32], - /// hash of post-execution state. - post_state: [u8; 32], -} - -/// Block data for this parachain. -#[derive(Default, Clone, Encode, Decode)] -struct BlockData { - /// State to begin from. - state: u64, - /// Amount to add (overflowing) - add: u64, -} - -fn hash_state(state: u64) -> [u8; 32] { - tiny_keccak::keccak256(state.encode().as_slice()) -} - -fn hash_head(head: &HeadData) -> [u8; 32] { - tiny_keccak::keccak256(head.encode().as_slice()) -} +use adder::{HeadData, BlockData, hash_state}; fn execution_mode() -> ExecutionMode { ExecutionMode::ExternalProcessCustomHost { @@ -89,7 +62,6 @@ fn execute_good_on_parent(execution_mode: ExecutionMode) { add: 512, }; - let ret = parachain::wasm_executor::validate_candidate( adder::wasm_binary_unwrap(), ValidationParams { @@ -106,7 +78,7 @@ fn execute_good_on_parent(execution_mode: ExecutionMode) { let new_head = HeadData::decode(&mut &ret.head_data.0[..]).unwrap(); assert_eq!(new_head.number, 1); - assert_eq!(new_head.parent_hash, hash_head(&parent_head)); + assert_eq!(new_head.parent_hash, parent_head.hash()); assert_eq!(new_head.post_state, hash_state(512)); } @@ -145,11 +117,11 @@ fn execute_good_chain_on_parent() { let new_head = HeadData::decode(&mut &ret.head_data.0[..]).unwrap(); assert_eq!(new_head.number, number + 1); - assert_eq!(new_head.parent_hash, hash_head(&parent_head)); + assert_eq!(new_head.parent_hash, parent_head.hash()); assert_eq!(new_head.post_state, hash_state(last_state + add)); number += 1; - parent_hash = hash_head(&new_head); + parent_hash = new_head.hash(); last_state += add; } } diff --git a/polkadot/runtime/rococo-v1/Cargo.toml b/polkadot/runtime/rococo/Cargo.toml similarity index 97% rename from polkadot/runtime/rococo-v1/Cargo.toml rename to polkadot/runtime/rococo/Cargo.toml index 99162b7574..6877a3c12b 100644 --- a/polkadot/runtime/rococo-v1/Cargo.toml +++ b/polkadot/runtime/rococo/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rococo-v1-runtime" +name = "rococo-runtime" version = "0.8.26" authors = ["Parity Technologies "] edition = "2018" @@ -29,6 +29,7 @@ offchain-primitives = { package = "sp-offchain", git = "https://github.com/parit pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -68,6 +69,7 @@ std = [ "codec/std", "frame-executive/std", "pallet-grandpa/std", + "pallet-sudo/std", "pallet-indices/std", "pallet-im-online/std", "inherents/std", diff --git a/polkadot/runtime/rococo-v1/README.md b/polkadot/runtime/rococo/README.md similarity index 100% rename from polkadot/runtime/rococo-v1/README.md rename to polkadot/runtime/rococo/README.md diff --git a/polkadot/runtime/rococo-v1/build.rs b/polkadot/runtime/rococo/build.rs similarity index 100% rename from polkadot/runtime/rococo-v1/build.rs rename to polkadot/runtime/rococo/build.rs diff --git a/polkadot/runtime/rococo-v1/src/constants.rs b/polkadot/runtime/rococo/src/constants.rs similarity index 97% rename from polkadot/runtime/rococo-v1/src/constants.rs rename to polkadot/runtime/rococo/src/constants.rs index a565ca4dbc..31f8a97ce4 100644 --- a/polkadot/runtime/rococo-v1/src/constants.rs +++ b/polkadot/runtime/rococo/src/constants.rs @@ -33,7 +33,8 @@ pub mod time { use primitives::v0::{Moment, BlockNumber}; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * HOURS; + // 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/rococo-v1/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs similarity index 98% rename from polkadot/runtime/rococo-v1/src/lib.rs rename to polkadot/runtime/rococo/src/lib.rs index 8520426a51..7d7777cb93 100644 --- a/polkadot/runtime/rococo-v1/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -86,6 +86,29 @@ use constants::{time::*, currency::*, fee::*}; #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +/// Runtime version (Rococo). +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("rococo"), + impl_name: create_runtime_str!("parity-rococo-v1"), + authoring_version: 0, + spec_version: 10, + impl_version: 0, + #[cfg(not(feature = "disable-runtime-api"))] + apis: RUNTIME_API_VERSIONS, + #[cfg(feature = "disable-runtime-api")] + apis: sp_version::create_apis_vec![[]], + transaction_version: 0, +}; + +/// Native version. +#[cfg(any(feature = "std", test))] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + /// The address format for describing accounts. pub type Address = AccountId; /// Block header type as expected by this runtime. @@ -107,242 +130,6 @@ pub type SignedExtra = ( pallet_transaction_payment::ChargeTransactionPayment, ); -#[cfg(not(feature = "disable-runtime-api"))] -sp_api::impl_runtime_apis! { - impl sp_api::Core for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialize_block(header: &::Header) { - Executive::initialize_block(header) - } - } - - impl sp_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } - - impl block_builder_api::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { - Executive::apply_extrinsic(extrinsic) - } - - fn finalize_block() -> ::Header { - Executive::finalize_block() - } - - fn inherent_extrinsics(data: inherents::InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } - - fn check_inherents( - block: Block, - data: inherents::InherentData, - ) -> inherents::CheckInherentsResult { - data.check_extrinsics(&block) - } - - fn random_seed() -> ::Hash { - Babe::randomness().into() - } - } - - impl tx_pool_api::runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction( - source: TransactionSource, - tx: ::Extrinsic, - ) -> TransactionValidity { - Executive::validate_transaction(source, tx) - } - } - - impl offchain_primitives::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &::Header) { - Executive::offchain_worker(header) - } - } - - impl primitives::v1::ParachainHost for Runtime { - fn validators() -> Vec { - runtime_api_impl::validators::() - } - - fn validator_groups() -> (Vec>, GroupRotationInfo) { - runtime_api_impl::validator_groups::() - } - - fn availability_cores() -> Vec> { - runtime_api_impl::availability_cores::() - } - - fn full_validation_data(para_id: Id, assumption: OccupiedCoreAssumption) - -> Option> { - runtime_api_impl::full_validation_data::(para_id, assumption) - } - - fn persisted_validation_data(para_id: Id, assumption: OccupiedCoreAssumption) - -> Option> { - runtime_api_impl::persisted_validation_data::(para_id, assumption) - } - - fn check_validation_outputs( - para_id: Id, - outputs: primitives::v1::ValidationOutputs, - ) -> bool { - runtime_api_impl::check_validation_outputs::(para_id, outputs) - } - - fn session_index_for_child() -> SessionIndex { - runtime_api_impl::session_index_for_child::() - } - - fn validation_code(para_id: Id, assumption: OccupiedCoreAssumption) - -> Option { - runtime_api_impl::validation_code::(para_id, assumption) - } - - fn candidate_pending_availability(para_id: Id) -> Option> { - runtime_api_impl::candidate_pending_availability::(para_id) - } - - fn candidate_events() -> Vec> { - runtime_api_impl::candidate_events::(|ev| { - match ev { - Event::parachains_inclusion(ev) => { - Some(ev) - } - _ => None, - } - }) - } - fn validator_discovery(validators: Vec) -> Vec> { - runtime_api_impl::validator_discovery::(validators) - } - - fn dmq_contents( - recipient: Id, - ) -> Vec> { - runtime_api_impl::dmq_contents::(recipient) - } - } - - impl fg_primitives::GrandpaApi for Runtime { - fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { - Grandpa::grandpa_authorities() - } - - fn submit_report_equivocation_unsigned_extrinsic( - equivocation_proof: fg_primitives::EquivocationProof< - ::Hash, - sp_runtime::traits::NumberFor, - >, - key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, - ) -> Option<()> { - let key_owner_proof = key_owner_proof.decode()?; - - Grandpa::submit_unsigned_equivocation_report( - equivocation_proof, - key_owner_proof, - ) - } - - fn generate_key_ownership_proof( - _set_id: fg_primitives::SetId, - authority_id: fg_primitives::AuthorityId, - ) -> Option { - use codec::Encode; - - Historical::prove((fg_primitives::KEY_TYPE, authority_id)) - .map(|p| p.encode()) - .map(fg_primitives::OpaqueKeyOwnershipProof::new) - } - } - - impl babe_primitives::BabeApi for Runtime { - fn configuration() -> babe_primitives::BabeGenesisConfiguration { - // The choice of `c` parameter (where `1 - c` represents the - // probability of a slot being empty), is done in accordance to the - // slot duration and expected target block time, for safely - // resisting network delays of maximum two seconds. - // - babe_primitives::BabeGenesisConfiguration { - slot_duration: Babe::slot_duration(), - epoch_length: EpochDuration::get(), - c: PRIMARY_PROBABILITY, - genesis_authorities: Babe::authorities(), - randomness: Babe::randomness(), - allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryPlainSlots, - } - } - - fn current_epoch_start() -> babe_primitives::SlotNumber { - Babe::current_epoch_start() - } - - fn generate_key_ownership_proof( - _slot_number: babe_primitives::SlotNumber, - authority_id: babe_primitives::AuthorityId, - ) -> Option { - use codec::Encode; - - Historical::prove((babe_primitives::KEY_TYPE, authority_id)) - .map(|p| p.encode()) - .map(babe_primitives::OpaqueKeyOwnershipProof::new) - } - - fn submit_report_equivocation_unsigned_extrinsic( - equivocation_proof: babe_primitives::EquivocationProof<::Header>, - key_owner_proof: babe_primitives::OpaqueKeyOwnershipProof, - ) -> Option<()> { - let key_owner_proof = key_owner_proof.decode()?; - - Babe::submit_unsigned_equivocation_report( - equivocation_proof, - key_owner_proof, - ) - } - } - - impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { - fn authorities() -> Vec { - AuthorityDiscovery::authorities() - } - } - - impl sp_session::SessionKeys for Runtime { - fn generate_session_keys(seed: Option>) -> Vec { - SessionKeys::generate(seed) - } - - fn decode_session_keys( - encoded: Vec, - ) -> Option, sp_core::crypto::KeyTypeId)>> { - SessionKeys::decode_into_raw_public_keys(&encoded) - } - } - - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Nonce { - System::account_nonce(account) - } - } - - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi< - Block, - Balance, - > for Runtime { - fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo { - TransactionPayment::query_info(uxt, len) - } - } -} /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. @@ -400,6 +187,9 @@ construct_runtime! { Registrar: paras_registrar::{Module, Call, Storage}, ParasSudoWrapper: paras_sudo_wrapper::{Module, Call}, + + // Sudo + Sudo: pallet_sudo::{Module, Call, Storage, Event, Config}, } } @@ -410,30 +200,6 @@ impl Filter for BaseFilter { } } -/// Runtime version (Rococo). -pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("rococo-v1"), - impl_name: create_runtime_str!("parity-rococo-v1"), - authoring_version: 0, - spec_version: 1, - impl_version: 0, - #[cfg(not(feature = "disable-runtime-api"))] - apis: RUNTIME_API_VERSIONS, - #[cfg(feature = "disable-runtime-api")] - apis: sp_version::create_apis_vec![[]], - transaction_version: 2, -}; - -/// Native version. -#[cfg(any(feature = "std", test))] -pub fn native_version() -> NativeVersion { - NativeVersion { - runtime_version: VERSION, - can_author_with: Default::default(), - } -} - - parameter_types! { pub const Version: RuntimeVersion = VERSION; } @@ -782,3 +548,243 @@ impl paras_registrar::Trait for Runtime { type ParathreadDeposit = ParathreadDeposit; type Origin = Origin; } + +impl pallet_sudo::Trait for Runtime { + type Event = Event; + type Call = Call; +} + +#[cfg(not(feature = "disable-runtime-api"))] +sp_api::impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } + + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: inherents::InherentData, + ) -> inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + + fn random_seed() -> ::Hash { + Babe::randomness().into() + } + } + + impl tx_pool_api::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx) + } + } + + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl primitives::v1::ParachainHost for Runtime { + fn validators() -> Vec { + runtime_api_impl::validators::() + } + + fn validator_groups() -> (Vec>, GroupRotationInfo) { + runtime_api_impl::validator_groups::() + } + + fn availability_cores() -> Vec> { + runtime_api_impl::availability_cores::() + } + + fn full_validation_data(para_id: Id, assumption: OccupiedCoreAssumption) + -> Option> { + runtime_api_impl::full_validation_data::(para_id, assumption) + } + + fn persisted_validation_data(para_id: Id, assumption: OccupiedCoreAssumption) + -> Option> { + runtime_api_impl::persisted_validation_data::(para_id, assumption) + } + + fn check_validation_outputs( + para_id: Id, + outputs: primitives::v1::ValidationOutputs, + ) -> bool { + runtime_api_impl::check_validation_outputs::(para_id, outputs) + } + + fn session_index_for_child() -> SessionIndex { + runtime_api_impl::session_index_for_child::() + } + + fn validation_code(para_id: Id, assumption: OccupiedCoreAssumption) + -> Option { + runtime_api_impl::validation_code::(para_id, assumption) + } + + fn candidate_pending_availability(para_id: Id) -> Option> { + runtime_api_impl::candidate_pending_availability::(para_id) + } + + fn candidate_events() -> Vec> { + runtime_api_impl::candidate_events::(|ev| { + match ev { + Event::parachains_inclusion(ev) => { + Some(ev) + } + _ => None, + } + }) + } + fn validator_discovery(validators: Vec) -> Vec> { + runtime_api_impl::validator_discovery::(validators) + } + + fn dmq_contents(recipient: Id) -> Vec> { + runtime_api_impl::dmq_contents::(recipient) + } + } + + impl fg_primitives::GrandpaApi for Runtime { + fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { + Grandpa::grandpa_authorities() + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + sp_runtime::traits::NumberFor, + >, + key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Grandpa::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + authority_id: fg_primitives::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((fg_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(fg_primitives::OpaqueKeyOwnershipProof::new) + } + } + + impl babe_primitives::BabeApi for Runtime { + fn configuration() -> babe_primitives::BabeGenesisConfiguration { + // The choice of `c` parameter (where `1 - c` represents the + // probability of a slot being empty), is done in accordance to the + // slot duration and expected target block time, for safely + // resisting network delays of maximum two seconds. + // + babe_primitives::BabeGenesisConfiguration { + slot_duration: Babe::slot_duration(), + epoch_length: EpochDuration::get(), + c: PRIMARY_PROBABILITY, + genesis_authorities: Babe::authorities(), + randomness: Babe::randomness(), + allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryPlainSlots, + } + } + + fn current_epoch_start() -> babe_primitives::SlotNumber { + Babe::current_epoch_start() + } + + fn generate_key_ownership_proof( + _slot_number: babe_primitives::SlotNumber, + authority_id: babe_primitives::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((babe_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(babe_primitives::OpaqueKeyOwnershipProof::new) + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: babe_primitives::EquivocationProof<::Header>, + key_owner_proof: babe_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Babe::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + } + + impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { + fn authorities() -> Vec { + AuthorityDiscovery::authorities() + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, sp_core::crypto::KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi< + Block, + Balance, + > for Runtime { + fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + } +}