From 1291fbf5c711f6b3f26599aa771d8ad8c45efe8d Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Sat, 16 May 2020 12:59:34 +0200 Subject: [PATCH 001/280] Remove on_block_imported (#6039) * remove on_block_imported * Update client/network/src/service.rs Co-authored-by: Pierre Krieger Co-authored-by: Pierre Krieger --- client/network/src/protocol.rs | 32 +++++++++++++++++------------ client/network/src/protocol/sync.rs | 6 +++--- client/network/src/service.rs | 14 +++++++------ client/network/test/src/lib.rs | 6 +----- client/service/src/lib.rs | 2 -- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 7662a476e9..4153129a0a 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -111,7 +111,7 @@ mod rep { /// reputation change should be refunded with `ANY_EXTRINSIC_REFUND` pub const ANY_EXTRINSIC: Rep = Rep::new(-(1 << 4), "Any extrinsic"); /// Reputation change when a peer sends us any extrinsic that is not invalid. - pub const ANY_EXTRINSIC_REFUND: Rep = Rep::new(1 << 4, "Any extrinsic (refund)"); + pub const ANY_EXTRINSIC_REFUND: Rep = Rep::new(1 << 4, "Any extrinsic (refund)"); /// Reputation change when a peer sends us an extrinsic that we didn't know about. pub const GOOD_EXTRINSIC: Rep = Rep::new(1 << 7, "Good extrinsic"); /// Reputation change when a peer sends us a bad extrinsic. @@ -535,6 +535,12 @@ impl Protocol { self.sync.num_sync_requests() } + /// Sync local state with the blockchain state. + pub fn update_chain(&mut self) { + let info = self.context_data.chain.info(); + self.sync.update_chain_info(&info.best_hash, info.best_number); + } + /// Accepts a response from the legacy substream and determines what the corresponding /// request was. fn handle_response( @@ -1419,17 +1425,6 @@ impl Protocol { } } - /// Call this when a block has been imported in the import queue - pub fn on_block_imported(&mut self, header: &B::Header, is_best: bool) { - if is_best { - self.sync.update_chain_info(header); - self.behaviour.set_notif_protocol_handshake( - &self.block_announces_protocol, - BlockAnnouncesHandshake::build(&self.config, &self.context_data.chain).encode() - ); - } - } - /// Call this when a block has been finalized. The sync layer may have some additional /// requesting to perform. pub fn on_block_finalized(&mut self, hash: B::Hash, header: &B::Header) { @@ -1494,12 +1489,23 @@ impl Protocol { /// A batch of blocks have been processed, with or without errors. /// Call this when a batch of blocks have been processed by the importqueue, with or without /// errors. - pub fn blocks_processed( + pub fn on_blocks_processed( &mut self, imported: usize, count: usize, results: Vec<(Result>, BlockImportError>, B::Hash)> ) { + let new_best = results.iter().rev().find_map(|r| match r { + (Ok(BlockImportResult::ImportedUnknown(n, aux, _)), hash) if aux.is_new_best => Some((*n, hash.clone())), + _ => None, + }); + if let Some((best_num, best_hash)) = new_best { + self.sync.update_chain_info(&best_hash, best_num); + self.behaviour.set_notif_protocol_handshake( + &self.block_announces_protocol, + BlockAnnouncesHandshake::build(&self.config, &self.context_data.chain).encode() + ); + } let results = self.sync.on_blocks_processed( imported, count, diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index f4c935de5d..e08fcf4e9b 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -513,10 +513,10 @@ impl ChainSync { } } - /// Signal that `best_header` has been queued for import and update the + /// Signal that a new best block has been imported. /// `ChainSync` state with that information. - pub fn update_chain_info(&mut self, best_header: &B::Header) { - self.on_block_queued(&best_header.hash(), *best_header.number()) + pub fn update_chain_info(&mut self, best_hash: &B::Hash, best_number: NumberFor) { + self.on_block_queued(best_hash, best_number); } /// Schedule a justification request for the given block. diff --git a/client/network/src/service.rs b/client/network/src/service.rs index ba6c7a39b4..5448568930 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -400,16 +400,18 @@ impl NetworkWorker { &self.service } - /// You must call this when a new block is imported by the client. - pub fn on_block_imported(&mut self, header: B::Header, is_best: bool) { - self.network_service.user_protocol_mut().on_block_imported(&header, is_best); - } - /// You must call this when a new block is finalized by the client. pub fn on_block_finalized(&mut self, hash: B::Hash, header: B::Header) { self.network_service.user_protocol_mut().on_block_finalized(hash, &header); } + /// This should be called when blocks are added to the + /// chain by something other than the import queue. + /// Currently this is only useful for tests. + pub fn update_chain(&mut self) { + self.network_service.user_protocol_mut().update_chain(); + } + /// Returns the local `PeerId`. pub fn local_peer_id(&self) -> &PeerId { Swarm::::local_peer_id(&self.network_service) @@ -1349,7 +1351,7 @@ impl<'a, B: BlockT, H: ExHashT> Link for NetworkLink<'a, B, H> { count: usize, results: Vec<(Result>, BlockImportError>, B::Hash)> ) { - self.protocol.user_protocol_mut().blocks_processed(imported, count, results) + self.protocol.user_protocol_mut().on_blocks_processed(imported, count, results) } fn justification_imported(&mut self, who: PeerId, hash: &B::Hash, number: NumberFor, success: bool) { self.protocol.user_protocol_mut().justification_import_result(hash.clone(), number, success); diff --git a/client/network/test/src/lib.rs b/client/network/test/src/lib.rs index 76bc2afa69..25a7f3a606 100644 --- a/client/network/test/src/lib.rs +++ b/client/network/test/src/lib.rs @@ -295,11 +295,11 @@ impl Peer { Default::default() }; self.block_import.import_block(import_block, cache).expect("block_import failed"); - self.network.on_block_imported(header, true); self.network.service().announce_block(hash, Vec::new()); at = hash; } + self.network.update_chain(); self.network.service().announce_block(at.clone(), Vec::new()); at } @@ -813,10 +813,6 @@ pub trait TestNetFactory: Sized { // We poll `imported_blocks_stream`. while let Poll::Ready(Some(notification)) = peer.imported_blocks_stream.as_mut().poll_next(cx) { - peer.network.on_block_imported( - notification.header, - true, - ); peer.network.service().announce_block(notification.hash, Vec::new()); } diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index ebd2b99ef1..5604b98e82 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -369,8 +369,6 @@ fn build_network_future< // We poll `imported_blocks_stream`. while let Poll::Ready(Some(notification)) = Pin::new(&mut imported_blocks_stream).poll_next(cx) { - network.on_block_imported(notification.header, notification.is_new_best); - if announce_imported_blocks { network.service().announce_block(notification.hash, Vec::new()); } -- GitLab From 6d91909fabb0810b11a0c82aadb5dee41ac08ec8 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Sat, 16 May 2020 19:00:58 +0200 Subject: [PATCH 002/280] Aura fix: make sure the key exists locally (#6054) * Fix AURA * Add test to make sure claim slot works as expected --- client/consensus/aura/src/lib.rs | 62 +++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index 7fc788e85b..ae88c1707b 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -246,7 +246,13 @@ impl sc_consensus_slots::SimpleSlotWorker for AuraW slot_number: u64, epoch_data: &Self::EpochData, ) -> Option { - slot_author::

(slot_number, epoch_data).cloned() + let expected_author = slot_author::

(slot_number, epoch_data); + expected_author.and_then(|p| { + self.keystore.read() + .key_pair_by_type::

(&p, sp_application_crypto::key_types::AURA).ok() + }).and_then(|p| { + Some(p.public()) + }) } fn pre_digest_data( @@ -859,8 +865,11 @@ mod tests { use sp_keyring::sr25519::Keyring; use sc_client_api::BlockchainEvents; use sp_consensus_aura::sr25519::AuthorityPair; + use sc_consensus_slots::SimpleSlotWorker; use std::task::Poll; use sc_block_builder::BlockBuilderProvider; + use sp_runtime::traits::Header as _; + use substrate_test_runtime_client::runtime::{Header, H256}; type Error = sp_blockchain::Error; @@ -1044,4 +1053,55 @@ mod tests { Keyring::Charlie.public().into() ]); } + + #[test] + fn current_node_authority_should_claim_slot() { + let net = AuraTestNet::new(4); + + let mut authorities = vec![ + Keyring::Alice.public().into(), + Keyring::Bob.public().into(), + Keyring::Charlie.public().into() + ]; + + let keystore_path = tempfile::tempdir().expect("Creates keystore path"); + let keystore = sc_keystore::Store::open(keystore_path.path(), None).expect("Creates keystore."); + let my_key = keystore.write() + .generate_by_type::(AuthorityPair::ID) + .expect("Key should be created"); + authorities.push(my_key.public()); + + let net = Arc::new(Mutex::new(net)); + + let mut net = net.lock(); + let peer = net.peer(3); + let client = peer.client().as_full().expect("full clients are created").clone(); + let environ = DummyFactory(client.clone()); + + let worker = AuraWorker { + client: client.clone(), + block_import: Arc::new(Mutex::new(client)), + env: environ, + keystore, + sync_oracle: DummyOracle.clone(), + force_authoring: false, + _key_type: PhantomData::, + }; + + let head = Header::new( + 1, + H256::from_low_u64_be(0), + H256::from_low_u64_be(0), + Default::default(), + Default::default() + ); + assert!(worker.claim_slot(&head, 0, &authorities).is_none()); + assert!(worker.claim_slot(&head, 1, &authorities).is_none()); + assert!(worker.claim_slot(&head, 2, &authorities).is_none()); + assert!(worker.claim_slot(&head, 3, &authorities).is_some()); + assert!(worker.claim_slot(&head, 4, &authorities).is_none()); + assert!(worker.claim_slot(&head, 5, &authorities).is_none()); + assert!(worker.claim_slot(&head, 6, &authorities).is_none()); + assert!(worker.claim_slot(&head, 7, &authorities).is_some()); + } } -- GitLab From 8345611570c69134edbad05eab3001e17d9b908c Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Sat, 16 May 2020 19:03:04 +0200 Subject: [PATCH 003/280] resetting to -dev (#6050) --- Cargo.lock | 354 +++++++++--------- bin/node-template/node/Cargo.toml | 40 +- bin/node-template/pallets/template/Cargo.toml | 12 +- bin/node-template/runtime/Cargo.toml | 48 +-- bin/node/bench/Cargo.toml | 18 +- bin/node/browser-testing/Cargo.toml | 6 +- bin/node/cli/Cargo.toml | 120 +++--- bin/node/executor/Cargo.toml | 50 +-- bin/node/inspect/Cargo.toml | 14 +- bin/node/primitives/Cargo.toml | 12 +- bin/node/rpc-client/Cargo.toml | 6 +- bin/node/rpc/Cargo.toml | 38 +- bin/node/runtime/Cargo.toml | 112 +++--- bin/node/testing/Cargo.toml | 68 ++-- bin/utils/chain-spec-builder/Cargo.toml | 10 +- bin/utils/subkey/Cargo.toml | 20 +- client/api/Cargo.toml | 44 +-- client/authority-discovery/Cargo.toml | 24 +- client/basic-authorship/Cargo.toml | 26 +- client/block-builder/Cargo.toml | 20 +- client/chain-spec/Cargo.toml | 14 +- client/chain-spec/derive/Cargo.toml | 2 +- client/cli/Cargo.toml | 32 +- client/consensus/aura/Cargo.toml | 50 +-- client/consensus/babe/Cargo.toml | 58 +-- client/consensus/babe/rpc/Cargo.toml | 26 +- client/consensus/common/Cargo.toml | 10 +- client/consensus/epochs/Cargo.toml | 10 +- client/consensus/manual-seal/Cargo.toml | 26 +- client/consensus/pow/Cargo.toml | 24 +- client/consensus/slots/Cargo.toml | 24 +- client/consensus/uncles/Cargo.toml | 14 +- client/db/Cargo.toml | 28 +- client/executor/Cargo.toml | 36 +- client/executor/common/Cargo.toml | 12 +- client/executor/runtime-test/Cargo.toml | 14 +- client/executor/wasmi/Cargo.toml | 12 +- client/executor/wasmtime/Cargo.toml | 12 +- client/finality-grandpa/Cargo.toml | 54 +-- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/informant/Cargo.toml | 12 +- client/keystore/Cargo.toml | 6 +- client/network-gossip/Cargo.toml | 8 +- client/network/Cargo.toml | 32 +- client/network/test/Cargo.toml | 26 +- client/offchain/Cargo.toml | 26 +- client/peerset/Cargo.toml | 4 +- client/rpc-api/Cargo.toml | 14 +- client/rpc-servers/Cargo.toml | 4 +- client/rpc/Cargo.toml | 44 +-- client/service/Cargo.toml | 68 ++-- client/service/test/Cargo.toml | 40 +- client/state-db/Cargo.toml | 6 +- client/telemetry/Cargo.toml | 2 +- client/tracing/Cargo.toml | 4 +- client/transaction-pool/Cargo.toml | 28 +- client/transaction-pool/graph/Cargo.toml | 14 +- frame/assets/Cargo.toml | 14 +- frame/aura/Cargo.toml | 26 +- frame/authority-discovery/Cargo.toml | 22 +- frame/authorship/Cargo.toml | 18 +- frame/babe/Cargo.toml | 30 +- frame/balances/Cargo.toml | 18 +- frame/benchmark/Cargo.toml | 14 +- frame/benchmarking/Cargo.toml | 16 +- frame/collective/Cargo.toml | 18 +- frame/contracts/Cargo.toml | 26 +- frame/contracts/common/Cargo.toml | 6 +- frame/contracts/rpc/Cargo.toml | 16 +- frame/contracts/rpc/runtime-api/Cargo.toml | 10 +- frame/democracy/Cargo.toml | 24 +- frame/elections-phragmen/Cargo.toml | 22 +- frame/elections/Cargo.toml | 16 +- frame/evm/Cargo.toml | 18 +- frame/example-offchain-worker/Cargo.toml | 14 +- frame/example/Cargo.toml | 18 +- frame/executive/Cargo.toml | 26 +- frame/finality-tracker/Cargo.toml | 18 +- frame/generic-asset/Cargo.toml | 14 +- frame/grandpa/Cargo.toml | 38 +- frame/identity/Cargo.toml | 18 +- frame/im-online/Cargo.toml | 24 +- frame/indices/Cargo.toml | 18 +- frame/membership/Cargo.toml | 14 +- frame/metadata/Cargo.toml | 6 +- frame/nicks/Cargo.toml | 16 +- frame/offences/Cargo.toml | 18 +- frame/offences/benchmarking/Cargo.toml | 38 +- frame/randomness-collective-flip/Cargo.toml | 14 +- frame/recovery/Cargo.toml | 16 +- frame/scheduler/Cargo.toml | 16 +- frame/scored-pool/Cargo.toml | 16 +- frame/session/Cargo.toml | 24 +- frame/session/benchmarking/Cargo.toml | 26 +- frame/society/Cargo.toml | 16 +- frame/staking/Cargo.toml | 42 +-- frame/staking/fuzzer/Cargo.toml | 26 +- frame/staking/reward-curve/Cargo.toml | 4 +- frame/sudo/Cargo.toml | 14 +- frame/support/Cargo.toml | 24 +- frame/support/procedural/Cargo.toml | 4 +- frame/support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 14 +- frame/system/Cargo.toml | 18 +- frame/system/benchmarking/Cargo.toml | 16 +- frame/system/rpc/runtime-api/Cargo.toml | 4 +- frame/timestamp/Cargo.toml | 22 +- frame/transaction-payment/Cargo.toml | 20 +- frame/transaction-payment/rpc/Cargo.toml | 14 +- .../rpc/runtime-api/Cargo.toml | 10 +- frame/treasury/Cargo.toml | 18 +- frame/utility/Cargo.toml | 20 +- frame/vesting/Cargo.toml | 20 +- primitives/allocator/Cargo.toml | 8 +- primitives/api/Cargo.toml | 16 +- primitives/api/proc-macro/Cargo.toml | 2 +- primitives/api/test/Cargo.toml | 22 +- primitives/application-crypto/Cargo.toml | 8 +- primitives/application-crypto/test/Cargo.toml | 12 +- primitives/arithmetic/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- primitives/authority-discovery/Cargo.toml | 10 +- primitives/authorship/Cargo.toml | 8 +- primitives/block-builder/Cargo.toml | 10 +- primitives/blockchain/Cargo.toml | 10 +- primitives/chain-spec/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 14 +- primitives/consensus/babe/Cargo.toml | 18 +- primitives/consensus/common/Cargo.toml | 20 +- primitives/consensus/pow/Cargo.toml | 10 +- primitives/consensus/vrf/Cargo.toml | 8 +- primitives/core/Cargo.toml | 14 +- primitives/database/Cargo.toml | 2 +- primitives/debug-derive/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 6 +- primitives/finality-grandpa/Cargo.toml | 12 +- primitives/finality-tracker/Cargo.toml | 6 +- primitives/inherents/Cargo.toml | 6 +- primitives/io/Cargo.toml | 16 +- primitives/keyring/Cargo.toml | 6 +- primitives/offchain/Cargo.toml | 10 +- primitives/panic-handler/Cargo.toml | 2 +- primitives/phragmen/Cargo.toml | 14 +- primitives/phragmen/compact/Cargo.toml | 2 +- primitives/phragmen/fuzzer/Cargo.toml | 6 +- primitives/rpc/Cargo.toml | 4 +- primitives/runtime-interface/Cargo.toml | 20 +- .../runtime-interface/proc-macro/Cargo.toml | 2 +- .../test-wasm-deprecated/Cargo.toml | 10 +- .../runtime-interface/test-wasm/Cargo.toml | 10 +- primitives/runtime-interface/test/Cargo.toml | 18 +- primitives/runtime/Cargo.toml | 16 +- primitives/sandbox/Cargo.toml | 10 +- primitives/serializer/Cargo.toml | 2 +- primitives/session/Cargo.toml | 12 +- primitives/staking/Cargo.toml | 6 +- primitives/state-machine/Cargo.toml | 12 +- primitives/std/Cargo.toml | 2 +- primitives/storage/Cargo.toml | 6 +- primitives/test-primitives/Cargo.toml | 8 +- primitives/timestamp/Cargo.toml | 10 +- primitives/tracing/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 8 +- primitives/trie/Cargo.toml | 8 +- primitives/utils/Cargo.toml | 2 +- primitives/version/Cargo.toml | 6 +- primitives/wasm-interface/Cargo.toml | 4 +- test-utils/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 24 +- test-utils/runtime/Cargo.toml | 60 +-- test-utils/runtime/client/Cargo.toml | 24 +- .../runtime/transaction-pool/Cargo.toml | 12 +- utils/browser/Cargo.toml | 12 +- utils/build-script-utils/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 20 +- utils/frame/rpc/support/Cargo.toml | 10 +- utils/frame/rpc/system/Cargo.toml | 20 +- utils/prometheus/Cargo.toml | 2 +- 180 files changed, 1761 insertions(+), 1761 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eac3ec0562..5c50933839 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -586,7 +586,7 @@ dependencies = [ [[package]] name = "chain-spec-builder" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "ansi_term 0.12.1", "node-cli", @@ -1405,14 +1405,14 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -1428,7 +1428,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1445,7 +1445,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -1465,7 +1465,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-alpha.8" +version = "11.0.0-dev" dependencies = [ "parity-scale-codec", "serde", @@ -1475,7 +1475,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "bitmask", "frame-metadata", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1521,7 +1521,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "proc-macro2", "quote 1.0.3", @@ -1530,7 +1530,7 @@ dependencies = [ [[package]] name = "frame-support-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "parity-scale-codec", @@ -1547,7 +1547,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.2.11", "frame-support", @@ -1565,7 +1565,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -1580,7 +1580,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -3368,7 +3368,7 @@ dependencies = [ [[package]] name = "node-bench" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "fs_extra", @@ -3397,7 +3397,7 @@ dependencies = [ [[package]] name = "node-browser-testing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -3414,7 +3414,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "assert_cmd", "frame-benchmarking-cli", @@ -3488,7 +3488,7 @@ dependencies = [ [[package]] name = "node-executor" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.3.1", "frame-benchmarking", @@ -3522,7 +3522,7 @@ dependencies = [ [[package]] name = "node-inspect" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "log", @@ -3538,7 +3538,7 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-system", "parity-scale-codec", @@ -3551,7 +3551,7 @@ dependencies = [ [[package]] name = "node-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "jsonrpc-core", "node-primitives", @@ -3576,7 +3576,7 @@ dependencies = [ [[package]] name = "node-rpc-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "env_logger 0.7.1", "futures 0.1.29", @@ -3589,7 +3589,7 @@ dependencies = [ [[package]] name = "node-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-executive", @@ -3655,7 +3655,7 @@ dependencies = [ [[package]] name = "node-template" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "log", @@ -3684,7 +3684,7 @@ dependencies = [ [[package]] name = "node-template-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-executive", "frame-support", @@ -3716,7 +3716,7 @@ dependencies = [ [[package]] name = "node-testing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.3.1", "frame-support", @@ -3929,7 +3929,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -3943,7 +3943,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -3965,7 +3965,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -3983,7 +3983,7 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -3999,7 +3999,7 @@ dependencies = [ [[package]] name = "pallet-babe" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4021,7 +4021,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4037,7 +4037,7 @@ dependencies = [ [[package]] name = "pallet-benchmark" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4051,7 +4051,7 @@ dependencies = [ [[package]] name = "pallet-collective" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4068,7 +4068,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "assert_matches", "frame-support", @@ -4094,7 +4094,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -4103,7 +4103,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4122,7 +4122,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4133,7 +4133,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4153,7 +4153,7 @@ dependencies = [ [[package]] name = "pallet-elections" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4169,7 +4169,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4188,7 +4188,7 @@ dependencies = [ [[package]] name = "pallet-evm" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "evm", "frame-support", @@ -4208,7 +4208,7 @@ dependencies = [ [[package]] name = "pallet-example" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4224,7 +4224,7 @@ dependencies = [ [[package]] name = "pallet-example-offchain-worker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4256,7 +4256,7 @@ dependencies = [ [[package]] name = "pallet-generic-asset" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4270,7 +4270,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "finality-grandpa", "frame-support", @@ -4297,7 +4297,7 @@ dependencies = [ [[package]] name = "pallet-identity" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4314,7 +4314,7 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4333,7 +4333,7 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4349,7 +4349,7 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4363,7 +4363,7 @@ dependencies = [ [[package]] name = "pallet-nicks" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4378,7 +4378,7 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4394,7 +4394,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4419,7 +4419,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4433,7 +4433,7 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "enumflags2", "frame-support", @@ -4449,7 +4449,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4464,7 +4464,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4479,7 +4479,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4500,7 +4500,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4520,7 +4520,7 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4536,7 +4536,7 @@ dependencies = [ [[package]] name = "pallet-staking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4600,7 +4600,7 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4614,7 +4614,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4626,7 +4626,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -4660,7 +4660,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4677,7 +4677,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "parity-scale-codec", @@ -4690,7 +4690,7 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4706,7 +4706,7 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-benchmarking", "frame-support", @@ -4722,7 +4722,7 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5846,7 +5846,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "bytes 0.5.4", "derive_more", @@ -5876,7 +5876,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -5900,7 +5900,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5917,7 +5917,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5932,7 +5932,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5942,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "ansi_term 0.12.1", "app_dirs", @@ -5984,7 +5984,7 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "fnv", @@ -6022,7 +6022,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "blake2-rfc", "env_logger 0.7.1", @@ -6055,7 +6055,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6065,7 +6065,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6103,7 +6103,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6153,7 +6153,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -6178,7 +6178,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6190,7 +6190,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "derive_more", @@ -6220,7 +6220,7 @@ dependencies = [ [[package]] name = "sc-consensus-pow" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -6241,7 +6241,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -6263,7 +6263,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "log", "sc-client-api", @@ -6276,7 +6276,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "derive_more", @@ -6311,7 +6311,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "log", @@ -6327,7 +6327,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "log", "parity-scale-codec", @@ -6341,7 +6341,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "cranelift-codegen", @@ -6362,7 +6362,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "derive_more", @@ -6406,7 +6406,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "finality-grandpa", @@ -6423,7 +6423,7 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "ansi_term 0.12.1", "futures 0.3.4", @@ -6439,7 +6439,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "hex", @@ -6454,7 +6454,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "async-std", @@ -6513,7 +6513,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "async-std", "futures 0.3.4", @@ -6531,7 +6531,7 @@ dependencies = [ [[package]] name = "sc-network-test" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "env_logger 0.7.1", "futures 0.3.4", @@ -6557,7 +6557,7 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", @@ -6590,7 +6590,7 @@ dependencies = [ [[package]] name = "sc-peerset" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "libp2p", @@ -6603,7 +6603,7 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "assert_matches", "futures 0.1.29", @@ -6642,7 +6642,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -6665,7 +6665,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6679,7 +6679,7 @@ dependencies = [ [[package]] name = "sc-runtime-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sp-allocator", "sp-core", @@ -6692,7 +6692,7 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "exit-future", @@ -6753,7 +6753,7 @@ dependencies = [ [[package]] name = "sc-service-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "env_logger 0.7.1", "fdlimit", @@ -6788,7 +6788,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "env_logger 0.7.1", "log", @@ -6802,7 +6802,7 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -6823,7 +6823,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "erased-serde", "log", @@ -6838,7 +6838,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "assert_matches", "criterion 0.3.1", @@ -6861,7 +6861,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "assert_matches", "derive_more", @@ -7230,7 +7230,7 @@ dependencies = [ [[package]] name = "sp-allocator" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "log", @@ -7241,7 +7241,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "hash-db", "parity-scale-codec", @@ -7256,7 +7256,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7267,7 +7267,7 @@ dependencies = [ [[package]] name = "sp-api-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.3.1", "parity-scale-codec", @@ -7286,7 +7286,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "serde", @@ -7297,7 +7297,7 @@ dependencies = [ [[package]] name = "sp-application-crypto-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sp-api", "sp-application-crypto", @@ -7308,7 +7308,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.3.1", "integer-sqrt", @@ -7324,7 +7324,7 @@ dependencies = [ [[package]] name = "sp-arithmetic-fuzzer" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "honggfuzz", "num-bigint", @@ -7335,7 +7335,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -7346,7 +7346,7 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7356,7 +7356,7 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -7367,7 +7367,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "log", @@ -7382,7 +7382,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "serde", "serde_json", @@ -7390,7 +7390,7 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -7413,7 +7413,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -7426,7 +7426,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "merlin", "parity-scale-codec", @@ -7442,7 +7442,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -7453,7 +7453,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7464,7 +7464,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "base58", "blake2-rfc", @@ -7510,7 +7510,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7518,7 +7518,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "proc-macro2", "quote 1.0.3", @@ -7527,7 +7527,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "environmental", "parity-scale-codec", @@ -7537,7 +7537,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "finality-grandpa", "log", @@ -7552,7 +7552,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7561,7 +7561,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "parity-scale-codec", @@ -7572,7 +7572,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "hash-db", @@ -7591,7 +7591,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "lazy_static", "sp-core", @@ -7601,7 +7601,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sp-api", "sp-core", @@ -7611,7 +7611,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "backtrace", "log", @@ -7619,7 +7619,7 @@ dependencies = [ [[package]] name = "sp-phragmen" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "rand 0.7.3", @@ -7634,7 +7634,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7655,7 +7655,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "serde", "serde_json", @@ -7664,7 +7664,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -7686,7 +7686,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7706,7 +7706,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "Inflector", "proc-macro-crate", @@ -7717,7 +7717,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sc-executor", "sp-core", @@ -7732,7 +7732,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sp-core", "sp-io", @@ -7743,7 +7743,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "sp-core", "sp-io", @@ -7754,7 +7754,7 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "assert_matches", "parity-scale-codec", @@ -7768,7 +7768,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "serde", "serde_json", @@ -7776,7 +7776,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-api", @@ -7788,7 +7788,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7797,7 +7797,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "hash-db", "hex-literal", @@ -7817,11 +7817,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" [[package]] name = "sp-storage" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7832,7 +7832,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7844,7 +7844,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7857,14 +7857,14 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "tracing", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -7878,7 +7878,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "criterion 0.2.11", "hash-db", @@ -7896,7 +7896,7 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "futures-core", @@ -7906,7 +7906,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7917,7 +7917,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8032,7 +8032,7 @@ dependencies = [ [[package]] name = "subkey" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "clap", "derive_more", @@ -8074,7 +8074,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "chrono", "clear_on_drop", @@ -8100,14 +8100,14 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-support" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", @@ -8123,7 +8123,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", @@ -8146,7 +8146,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" dependencies = [ "async-std", "derive_more", @@ -8159,7 +8159,7 @@ dependencies = [ [[package]] name = "substrate-test-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "hash-db", @@ -8179,7 +8179,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "cfg-if", "frame-executive", @@ -8222,7 +8222,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "futures 0.3.4", "parity-scale-codec", @@ -8241,7 +8241,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" dependencies = [ "derive_more", "futures 0.3.4", @@ -8256,7 +8256,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" [[package]] name = "substrate-wasm-builder" diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index c4df4f18a2..030672ee6f 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -21,25 +21,25 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-alpha.8", path = "../../../client/cli" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../../client/executor" } -sc-service = { version = "0.8.0-alpha.8", path = "../../../client/service" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } -sc-network = { version = "0.8.0-alpha.8", path = "../../../client/network" } -sc-consensus-aura = { version = "0.8.0-alpha.8", path = "../../../client/consensus/aura" } -sp-consensus-aura = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/aura" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../../client/consensus/common" } -sc-finality-grandpa = { version = "0.8.0-alpha.8", path = "../../../client/finality-grandpa" } -sp-finality-grandpa = { version = "2.0.0-alpha.8", path = "../../../primitives/finality-grandpa" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-alpha.8"} +sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } +sc-service = { version = "0.8.0-dev", path = "../../../client/service" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +sc-network = { version = "0.8.0-dev", path = "../../../client/network" } +sc-consensus-aura = { version = "0.8.0-dev", path = "../../../client/consensus/aura" } +sp-consensus-aura = { version = "0.8.0-dev", path = "../../../primitives/consensus/aura" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } +sc-finality-grandpa = { version = "0.8.0-dev", path = "../../../client/finality-grandpa" } +sp-finality-grandpa = { version = "2.0.0-dev", path = "../../../primitives/finality-grandpa" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-dev"} -node-template-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } +node-template-runtime = { version = "2.0.0-dev", path = "../runtime" } [build-dependencies] -substrate-build-script-utils = { version = "2.0.0-alpha.8", path = "../../../utils/build-script-utils" } +substrate-build-script-utils = { version = "2.0.0-dev", path = "../../../utils/build-script-utils" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 24f40f4126..01484c608c 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Anonymous'] edition = '2018' name = 'pallet-template' -version = "2.0.0-alpha.8" +version = "2.0.0-dev" license = "Unlicense" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" @@ -16,26 +16,26 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = [dependencies.frame-support] default-features = false -version = "2.0.0-alpha.8" +version = "2.0.0-dev" path = "../../../../frame/support" [dependencies.frame-system] default-features = false -version = "2.0.0-alpha.8" +version = "2.0.0-dev" path = "../../../../frame/system" [dev-dependencies.sp-core] default-features = false -version = "2.0.0-alpha.8" +version = "2.0.0-dev" path = "../../../../primitives/core" [dev-dependencies.sp-io] default-features = false -version = "2.0.0-alpha.8" +version = "2.0.0-dev" path = "../../../../primitives/io" [dev-dependencies.sp-runtime] default-features = false -version = "2.0.0-alpha.8" +version = "2.0.0-dev" path = "../../../../primitives/runtime" diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index b1151c64d9..dfd517130b 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,31 +13,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } -balances = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/support" } -grandpa = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } -randomness-collective-flip = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } -sudo = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } -system = { version = "2.0.0-alpha.8", default-features = false, package = "frame-system", path = "../../../frame/system" } -timestamp = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } -transaction-payment = { version = "2.0.0-alpha.8", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } -frame-executive = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/executive" } +aura = { version = "2.0.0-dev", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } +balances = { version = "2.0.0-dev", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } +grandpa = { version = "2.0.0-dev", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } +randomness-collective-flip = { version = "2.0.0-dev", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } +sudo = { version = "2.0.0-dev", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } +system = { version = "2.0.0-dev", default-features = false, package = "frame-system", path = "../../../frame/system" } +timestamp = { version = "2.0.0-dev", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } +transaction-payment = { version = "2.0.0-dev", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } +frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../../frame/executive" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/api" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-alpha.8"} -sp-consensus-aura = { version = "0.8.0-alpha.8", default-features = false, path = "../../../primitives/consensus/aura" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } -sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-alpha.8"} -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/io" } -sp-offchain = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/offchain" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -sp-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/session" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-transaction-pool = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/version" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/api" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-dev"} +sp-consensus-aura = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/consensus/aura" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/io" } +sp-offchain = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/offchain" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-session = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/session" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/version" } -template = { version = "2.0.0-alpha.8", default-features = false, path = "../pallets/template", package = "pallet-template" } +template = { version = "2.0.0-dev", default-features = false, path = "../pallets/template", package = "pallet-template" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 443bfaeede..ec72a125bb 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-bench" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." edition = "2018" @@ -10,20 +10,20 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] log = "0.4.8" -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -node-testing = { version = "2.0.0-alpha.8", path = "../testing" } -sc-cli = { version = "0.8.0-alpha.8", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api/" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +node-testing = { version = "2.0.0-dev", path = "../testing" } +sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } serde = "1.0.101" serde_json = "1.0.41" structopt = "0.3" derive_more = "0.99.2" kvdb = "0.6" kvdb-rocksdb = "0.8" -sp-trie = { version = "2.0.0-alpha.8", path = "../../../primitives/trie" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } +sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 2178fc631f..3885aa3b09 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-browser-testing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Tests for the in-browser light client." edition = "2018" @@ -17,5 +17,5 @@ wasm-bindgen-futures = "0.4.10" wasm-bindgen-test = "0.3.10" futures = "0.3.4" -node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-alpha.8"} -sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-alpha.8"} +node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-dev"} +sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-dev"} diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 1e4c9b6be3..281bee8dbb 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Generic Substrate node implementation in Rust." build = "build.rs" @@ -20,7 +20,7 @@ targets = ["x86_64-unknown-linux-gnu"] [badges] travis-ci = { repository = "paritytech/substrate" } -maintenance = { status = "actively-alpha.8eloped" } +maintenance = { status = "actively-developed" } is-it-maintained-issue-resolution = { repository = "paritytech/substrate" } is-it-maintained-open-issues = { repository = "paritytech/substrate" } @@ -46,76 +46,76 @@ tracing = "0.1.10" parking_lot = "0.10.0" # primitives -sp-authority-discovery = { version = "2.0.0-alpha.8", path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/babe" } -grandpa-primitives = { version = "2.0.0-alpha.8", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/timestamp" } -sp-finality-tracker = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/finality-tracker" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../../primitives/keyring" } -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } +sp-authority-discovery = { version = "2.0.0-dev", path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } +grandpa-primitives = { version = "2.0.0-dev", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/timestamp" } +sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/finality-tracker" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } # client dependencies -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api" } -sc-chain-spec = { version = "2.0.0-alpha.8", path = "../../../client/chain-spec" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../../client/consensus/common" } -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../client/transaction-pool" } -sc-network = { version = "0.8.0-alpha.8", path = "../../../client/network" } -sc-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../client/consensus/babe" } -grandpa = { version = "0.8.0-alpha.8", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } -sc-client-db = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/db" } -sc-offchain = { version = "2.0.0-alpha.8", path = "../../../client/offchain" } -sc-rpc = { version = "2.0.0-alpha.8", path = "../../../client/rpc" } -sc-basic-authorship = { version = "0.8.0-alpha.8", path = "../../../client/basic-authorship" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/service" } -sc-tracing = { version = "2.0.0-alpha.8", path = "../../../client/tracing" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../../../client/telemetry" } -sc-authority-discovery = { version = "0.8.0-alpha.8", path = "../../../client/authority-discovery" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } +sc-chain-spec = { version = "2.0.0-dev", path = "../../../client/chain-spec" } +sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../../../client/transaction-pool" } +sc-network = { version = "0.8.0-dev", path = "../../../client/network" } +sc-consensus-babe = { version = "0.8.0-dev", path = "../../../client/consensus/babe" } +grandpa = { version = "0.8.0-dev", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } +sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../../../client/db" } +sc-offchain = { version = "2.0.0-dev", path = "../../../client/offchain" } +sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } +sc-basic-authorship = { version = "0.8.0-dev", path = "../../../client/basic-authorship" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } +sc-tracing = { version = "2.0.0-dev", path = "../../../client/tracing" } +sc-telemetry = { version = "2.0.0-dev", path = "../../../client/telemetry" } +sc-authority-discovery = { version = "0.8.0-dev", path = "../../../client/authority-discovery" } # frame dependencies -pallet-indices = { version = "2.0.0-alpha.8", path = "../../../frame/indices" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/timestamp" } -pallet-contracts = { version = "2.0.0-alpha.8", path = "../../../frame/contracts" } -frame-system = { version = "2.0.0-alpha.8", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../../../frame/transaction-payment" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/support" } -pallet-im-online = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/im-online" } -pallet-authority-discovery = { version = "2.0.0-alpha.8", path = "../../../frame/authority-discovery" } -pallet-staking = { version = "2.0.0-alpha.8", path = "../../../frame/staking" } -pallet-grandpa = { version = "2.0.0-alpha.8", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../frame/timestamp" } +pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } +frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } +pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../../frame/im-online" } +pallet-authority-discovery = { version = "2.0.0-dev", path = "../../../frame/authority-discovery" } +pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } +pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } # node-specific dependencies -node-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } -node-rpc = { version = "2.0.0-alpha.8", path = "../rpc" } -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -node-executor = { version = "2.0.0-alpha.8", path = "../executor" } +node-runtime = { version = "2.0.0-dev", path = "../runtime" } +node-rpc = { version = "2.0.0-dev", path = "../rpc" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +node-executor = { version = "2.0.0-dev", path = "../executor" } # CLI-specific dependencies -sc-cli = { version = "0.8.0-alpha.8", optional = true, path = "../../../client/cli" } -frame-benchmarking-cli = { version = "2.0.0-alpha.8", optional = true, path = "../../../utils/frame/benchmarking-cli" } -node-inspect = { version = "0.8.0-alpha.8", optional = true, path = "../inspect" } +sc-cli = { version = "0.8.0-dev", optional = true, path = "../../../client/cli" } +frame-benchmarking-cli = { version = "2.0.0-dev", optional = true, path = "../../../utils/frame/benchmarking-cli" } +node-inspect = { version = "0.8.0-dev", optional = true, path = "../inspect" } # WASM-specific dependencies wasm-bindgen = { version = "0.2.57", optional = true } wasm-bindgen-futures = { version = "0.4.7", optional = true } -browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-alpha.8"} +browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-dev"} [target.'cfg(target_arch="x86_64")'.dependencies] -node-executor = { version = "2.0.0-alpha.8", path = "../executor", features = [ "wasmtime" ] } -sc-cli = { version = "0.8.0-alpha.8", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } +node-executor = { version = "2.0.0-dev", path = "../executor", features = [ "wasmtime" ] } +sc-cli = { version = "0.8.0-dev", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } [dev-dependencies] -sc-keystore = { version = "2.0.0-alpha.8", path = "../../../client/keystore" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../../client/consensus/common" } -sc-consensus-babe = { version = "0.8.0-alpha.8", features = ["test-helpers"], path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.8.0-alpha.8", path = "../../../client/consensus/epochs" } -sc-service-test = { version = "2.0.0-alpha.8", path = "../../../client/service/test" } +sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } +sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } +sc-consensus-babe = { version = "0.8.0-dev", features = ["test-helpers"], path = "../../../client/consensus/babe" } +sc-consensus-epochs = { version = "0.8.0-dev", path = "../../../client/consensus/epochs" } +sc-service-test = { version = "2.0.0-dev", path = "../../../client/service/test" } futures = "0.3.4" tempfile = "3.1.0" assert_cmd = "1.0" @@ -126,12 +126,12 @@ platforms = "0.2.1" [build-dependencies] structopt = { version = "0.3.8", optional = true } -node-inspect = { version = "0.8.0-alpha.8", optional = true, path = "../inspect" } -frame-benchmarking-cli = { version = "2.0.0-alpha.8", optional = true, path = "../../../utils/frame/benchmarking-cli" } -substrate-build-script-utils = { version = "2.0.0-alpha.8", optional = true, path = "../../../utils/build-script-utils" } +node-inspect = { version = "0.8.0-dev", optional = true, path = "../inspect" } +frame-benchmarking-cli = { version = "2.0.0-dev", optional = true, path = "../../../utils/frame/benchmarking-cli" } +substrate-build-script-utils = { version = "2.0.0-dev", optional = true, path = "../../../utils/build-script-utils" } [build-dependencies.sc-cli] -version = "0.8.0-alpha.8" +version = "0.8.0-dev" package = "sc-cli" path = "../../../client/cli" optional = true diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 78cfb3e5b4..014ac9a4c8 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-executor" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." edition = "2018" @@ -13,34 +13,34 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -node-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../../client/executor" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../../primitives/trie" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +node-runtime = { version = "2.0.0-dev", path = "../runtime" } +sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } trie-root = "0.16.0" -frame-benchmarking = { version = "2.0.0-alpha.8", path = "../../../frame/benchmarking" } +frame-benchmarking = { version = "2.0.0-dev", path = "../../../frame/benchmarking" } [dev-dependencies] criterion = "0.3.0" -frame-support = { version = "2.0.0-alpha.8", path = "../../../frame/support" } -frame-system = { version = "2.0.0-alpha.8", path = "../../../frame/system" } -node-testing = { version = "2.0.0-alpha.8", path = "../testing" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../../../frame/balances" } -pallet-contracts = { version = "2.0.0-alpha.8", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-alpha.8", path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-alpha.8", path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-alpha.8", path = "../../../frame/indices" } -pallet-session = { version = "2.0.0-alpha.8", path = "../../../frame/session" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-alpha.8", path = "../../../frame/treasury" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../../primitives/application-crypto" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../../primitives/externalities" } -substrate-test-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/client" } +frame-support = { version = "2.0.0-dev", path = "../../../frame/support" } +frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } +node-testing = { version = "2.0.0-dev", path = "../testing" } +pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } +pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-dev", path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } +pallet-session = { version = "2.0.0-dev", path = "../../../frame/session" } +pallet-timestamp = { version = "2.0.0-dev", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-dev", path = "../../../frame/treasury" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } +substrate-test-client = { version = "2.0.0-dev", path = "../../../test-utils/client" } wabt = "0.9.2" [features] diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index c16bb0493a..5beb1f948e 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-inspect" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99" log = "0.4.8" -sc-cli = { version = "0.8.0-alpha.8", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/service" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } +sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } structopt = "0.3.8" diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index 96f8428a1c..5850db83d4 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/system" } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/application-crypto" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/application-crypto" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } [dev-dependencies] -sp-serializer = { version = "2.0.0-alpha.8", path = "../../../primitives/serializer" } +sp-serializer = { version = "2.0.0-dev", path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index 80ca0063b2..8ba5aed4aa 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,5 +16,5 @@ futures = "0.1.29" hyper = "0.12.35" jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } log = "0.4.8" -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -sc-rpc = { version = "2.0.0-alpha.8", path = "../../../client/rpc" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index bd8a8bd312..ef948cd009 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -11,22 +11,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } jsonrpc-core = "14.0.3" -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -node-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -pallet-contracts-rpc = { version = "0.8.0-alpha.8", path = "../../../frame/contracts/rpc/" } -pallet-transaction-payment-rpc = { version = "2.0.0-alpha.8", path = "../../../frame/transaction-payment/rpc/" } -substrate-frame-rpc-system = { version = "2.0.0-alpha.8", path = "../../../utils/frame/rpc/system" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } -sc-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../client/consensus/babe" } -sc-consensus-babe-rpc = { version = "0.8.0-alpha.8", path = "../../../client/consensus/babe/rpc" } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/babe" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../../../client/keystore" } -sc-consensus-epochs = { version = "0.8.0-alpha.8", path = "../../../client/consensus/epochs" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sc-finality-grandpa = { version = "0.8.0-alpha.8", path = "../../../client/finality-grandpa" } -sc-finality-grandpa-rpc = { version = "0.8.0-alpha.8", path = "../../../client/finality-grandpa/rpc" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +node-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +pallet-contracts-rpc = { version = "0.8.0-dev", path = "../../../frame/contracts/rpc/" } +pallet-transaction-payment-rpc = { version = "2.0.0-dev", path = "../../../frame/transaction-payment/rpc/" } +substrate-frame-rpc-system = { version = "2.0.0-dev", path = "../../../utils/frame/rpc/system" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +sc-consensus-babe = { version = "0.8.0-dev", path = "../../../client/consensus/babe" } +sc-consensus-babe-rpc = { version = "0.8.0-dev", path = "../../../client/consensus/babe/rpc" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } +sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } +sc-consensus-epochs = { version = "0.8.0-dev", path = "../../../client/consensus/epochs" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sc-finality-grandpa = { version = "0.8.0-dev", path = "../../../client/finality-grandpa" } +sc-finality-grandpa-rpc = { version = "0.8.0-dev", path = "../../../client/finality-grandpa/rpc" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index afcc63d5d7..8ca89367fe 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -20,68 +20,68 @@ serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" # primitives -sp-authority-discovery = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-alpha.8", default-features = false, path = "../../../primitives/consensus/babe" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-alpha.8"} -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/inherents" } -node-primitives = { version = "2.0.0-alpha.8", default-features = false, path = "../primitives" } -sp-offchain = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/offchain" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/staking" } -sp-keyring = { version = "2.0.0-alpha.8", optional = true, path = "../../../primitives/keyring" } -sp-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/session" } -sp-transaction-pool = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/version" } +sp-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/consensus/babe" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-dev"} +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/inherents" } +node-primitives = { version = "2.0.0-dev", default-features = false, path = "../primitives" } +sp-offchain = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/offchain" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/staking" } +sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../../primitives/keyring" } +sp-session = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/session" } +sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/version" } # frame dependencies -frame-executive = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/executive" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/system" } -frame-system-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/system/benchmarking", optional = true } -frame-system-rpc-runtime-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } -pallet-authority-discovery = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/authority-discovery" } -pallet-authorship = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/authorship" } -pallet-babe = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/babe" } -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/balances" } -pallet-collective = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/collective" } -pallet-contracts = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/contracts" } -pallet-contracts-primitives = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/contracts/common/" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-alpha.8", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } -pallet-democracy = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/democracy" } -pallet-elections-phragmen = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/elections-phragmen" } -pallet-finality-tracker = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/finality-tracker" } -pallet-grandpa = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/indices" } -pallet-identity = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/identity" } -pallet-membership = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/membership" } -pallet-offences = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/offences" } -pallet-offences-benchmarking = { version = "2.0.0-alpha.8", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } -pallet-randomness-collective-flip = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/randomness-collective-flip" } -pallet-recovery = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/recovery" } -pallet-session = { version = "2.0.0-alpha.8", features = ["historical"], path = "../../../frame/session", default-features = false } -pallet-session-benchmarking = { version = "2.0.0-alpha.8", path = "../../../frame/session/benchmarking", default-features = false, optional = true } -pallet-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/staking" } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/staking/reward-curve" } -pallet-scheduler = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/scheduler" } -pallet-society = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/society" } -pallet-sudo = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/sudo" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/timestamp" } -pallet-treasury = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/treasury" } -pallet-utility = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/utility" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/transaction-payment" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } -pallet-vesting = { version = "2.0.0-alpha.8", default-features = false, path = "../../../frame/vesting" } +frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../../frame/executive" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system" } +frame-system-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system/benchmarking", optional = true } +frame-system-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } +pallet-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../../frame/authority-discovery" } +pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../../../frame/authorship" } +pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../../frame/babe" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../../../frame/balances" } +pallet-collective = { version = "2.0.0-dev", default-features = false, path = "../../../frame/collective" } +pallet-contracts = { version = "2.0.0-dev", default-features = false, path = "../../../frame/contracts" } +pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "../../../frame/contracts/common/" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-dev", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } +pallet-democracy = { version = "2.0.0-dev", default-features = false, path = "../../../frame/democracy" } +pallet-elections-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../../frame/elections-phragmen" } +pallet-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../frame/finality-tracker" } +pallet-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-dev", default-features = false, path = "../../../frame/indices" } +pallet-identity = { version = "2.0.0-dev", default-features = false, path = "../../../frame/identity" } +pallet-membership = { version = "2.0.0-dev", default-features = false, path = "../../../frame/membership" } +pallet-offences = { version = "2.0.0-dev", default-features = false, path = "../../../frame/offences" } +pallet-offences-benchmarking = { version = "2.0.0-dev", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-randomness-collective-flip = { version = "2.0.0-dev", default-features = false, path = "../../../frame/randomness-collective-flip" } +pallet-recovery = { version = "2.0.0-dev", default-features = false, path = "../../../frame/recovery" } +pallet-session = { version = "2.0.0-dev", features = ["historical"], path = "../../../frame/session", default-features = false } +pallet-session-benchmarking = { version = "2.0.0-dev", path = "../../../frame/session/benchmarking", default-features = false, optional = true } +pallet-staking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/staking" } +pallet-staking-reward-curve = { version = "2.0.0-dev", default-features = false, path = "../../../frame/staking/reward-curve" } +pallet-scheduler = { version = "2.0.0-dev", default-features = false, path = "../../../frame/scheduler" } +pallet-society = { version = "2.0.0-dev", default-features = false, path = "../../../frame/society" } +pallet-sudo = { version = "2.0.0-dev", default-features = false, path = "../../../frame/sudo" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../frame/timestamp" } +pallet-treasury = { version = "2.0.0-dev", default-features = false, path = "../../../frame/treasury" } +pallet-utility = { version = "2.0.0-dev", default-features = false, path = "../../../frame/utility" } +pallet-transaction-payment = { version = "2.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } +pallet-vesting = { version = "2.0.0-dev", default-features = false, path = "../../../frame/vesting" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } [dev-dependencies] -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index 37518ebe80..dded81ac8e 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-testing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." edition = "2018" @@ -13,40 +13,40 @@ publish = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-alpha.8", path = "../../../frame/balances" } -sc-service = { version = "0.8.0-alpha.8", features = ["test-helpers", "db"], path = "../../../client/service" } -sc-client-db = { version = "0.8.0-alpha.8", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api/" } +pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } +sc-service = { version = "0.8.0-dev", features = ["test-helpers", "db"], path = "../../../client/service" } +sc-client-db = { version = "0.8.0-dev", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" } codec = { package = "parity-scale-codec", version = "1.3.0" } -pallet-contracts = { version = "2.0.0-alpha.8", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-alpha.8", path = "../../../frame/grandpa" } -pallet-indices = { version = "2.0.0-alpha.8", path = "../../../frame/indices" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../../primitives/keyring" } -node-executor = { version = "2.0.0-alpha.8", path = "../executor" } -node-primitives = { version = "2.0.0-alpha.8", path = "../primitives" } -node-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } -frame-support = { version = "2.0.0-alpha.8", path = "../../../frame/support" } -pallet-session = { version = "2.0.0-alpha.8", path = "../../../frame/session" } -pallet-society = { version = "2.0.0-alpha.8", path = "../../../frame/society" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -pallet-staking = { version = "2.0.0-alpha.8", path = "../../../frame/staking" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../../client/executor", features = ["wasmtime"] } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -frame-system = { version = "2.0.0-alpha.8", path = "../../../frame/system" } -substrate-test-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/client" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-alpha.8", path = "../../../frame/treasury" } +pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } +sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } +node-executor = { version = "2.0.0-dev", path = "../executor" } +node-primitives = { version = "2.0.0-dev", path = "../primitives" } +node-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +frame-support = { version = "2.0.0-dev", path = "../../../frame/support" } +pallet-session = { version = "2.0.0-dev", path = "../../../frame/session" } +pallet-society = { version = "2.0.0-dev", path = "../../../frame/society" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } +sc-executor = { version = "0.8.0-dev", path = "../../../client/executor", features = ["wasmtime"] } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } +substrate-test-client = { version = "2.0.0-dev", path = "../../../test-utils/client" } +pallet-timestamp = { version = "2.0.0-dev", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-dev", path = "../../../frame/treasury" } wabt = "0.9.2" -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-finality-tracker = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/finality-tracker" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/timestamp" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../../client/block-builder" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/timestamp" } +sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -54,4 +54,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.8.0-alpha.8", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } diff --git a/bin/utils/chain-spec-builder/Cargo.toml b/bin/utils/chain-spec-builder/Cargo.toml index d4faa4f1e3..211460400c 100644 --- a/bin/utils/chain-spec-builder/Cargo.toml +++ b/bin/utils/chain-spec-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-spec-builder" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" -sc-keystore = { version = "2.0.0-alpha.8", path = "../../../client/keystore" } -sc-chain-spec = { version = "2.0.0-alpha.8", path = "../../../client/chain-spec" } -node-cli = { version = "2.0.0-alpha.8", path = "../../node/cli" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } +sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } +sc-chain-spec = { version = "2.0.0-dev", path = "../../../client/chain-spec" } +node-cli = { version = "2.0.0-dev", path = "../../node/cli" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.8" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 91643b4551..488b0f7fbc 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subkey" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,10 +12,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.1.29" -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -node-runtime = { version = "2.0.0-alpha.8", path = "../../node/runtime" } -node-primitives = { version = "2.0.0-alpha.8", path = "../../node/primitives" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +node-runtime = { version = "2.0.0-dev", path = "../../node/runtime" } +node-primitives = { version = "2.0.0-dev", path = "../../node/primitives" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } rand = "0.7.2" clap = "2.33.0" tiny-bip39 = "0.7" @@ -23,14 +23,14 @@ substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.3.0" } -frame-system = { version = "2.0.0-alpha.8", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../../../frame/transaction-payment" } -pallet-grandpa = { version = "2.0.0-alpha.8", path = "../../../frame/grandpa" } +frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } +pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } -sc-rpc = { version = "2.0.0-alpha.8", path = "../../../client/rpc" } +sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" libp2p = "0.18.1" diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index 9d79e2ca5a..9e983eb966 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,36 +14,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } -sc-executor = { version = "0.8.0-alpha.8", path = "../executor" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../primitives/externalities" } +sc-executor = { version = "0.8.0-dev", path = "../executor" } +sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } fnv = { version = "1.0.6" } futures = { version = "0.3.1" } hash-db = { version = "0.15.2", default-features = false } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } hex-literal = { version = "0.2.1" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } kvdb = "0.6.0" log = { version = "0.4.8" } parking_lot = "0.10.0" lazy_static = "1.4.0" -sp-database = { version = "2.0.0-alpha.8", path = "../../primitives/database" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/version" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../primitives/trie" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../primitives/storage" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-alpha.8", path = "../../utils/prometheus" } +sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } +sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } [dev-dependencies] kvdb-memorydb = "0.6.0" -sp-test-primitives = { version = "2.0.0-alpha.8", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime" } +sp-test-primitives = { version = "2.0.0-dev", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index ad567bf0e6..d2b74b51e1 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-authority-discovery" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -23,21 +23,21 @@ futures = "0.3.4" futures-timer = "3.0.1" libp2p = { version = "0.18.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-alpha.8"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} prost = "0.6.1" rand = "0.7.2" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../keystore" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sc-keystore = { version = "2.0.0-dev", path = "../keystore" } +sc-network = { version = "0.8.0-dev", path = "../network" } serde_json = "1.0.41" -sp-authority-discovery = { version = "2.0.0-alpha.8", path = "../../primitives/authority-discovery" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } +sp-authority-discovery = { version = "2.0.0-dev", path = "../../primitives/authority-discovery" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } [dev-dependencies] env_logger = "0.7.0" quickcheck = "0.9.0" -sc-peerset = { version = "2.0.0-alpha.8", path = "../peerset" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client"} +sc-peerset = { version = "2.0.0-dev", path = "../peerset" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client"} diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index 5a5aaacd5f..ad15cbedd3 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-basic-authorship" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,20 +15,20 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" futures = "0.3.4" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../primitives/inherents" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../block-builder" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-dev", path = "../../primitives/inherents" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] } futures-timer = "3.0.1" [dev-dependencies] -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../../client/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../../client/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } parking_lot = "0.10.0" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index 07eb6fc82a..df2aca9cf5 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-block-builder" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../primitives/block-builder" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-block-builder = { version = "2.0.0-dev", path = "../../primitives/block-builder" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../primitives/trie" } +sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml index 305de23b1d..fbbf05f55b 100644 --- a/client/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,12 +12,12 @@ description = "Substrate chain configurations." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-chain-spec-derive = { version = "2.0.0-alpha.8", path = "./derive" } +sc-chain-spec-derive = { version = "2.0.0-dev", path = "./derive" } impl-trait-for-tuples = "0.1.3" -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-chain-spec = { version = "2.0.0-alpha.8", path = "../../primitives/chain-spec" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-chain-spec = { version = "2.0.0-dev", path = "../../primitives/chain-spec" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index beacd7ffda..643b3bab82 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 8be0381ee8..1dc5f1a39f 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-cli" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Substrate CLI interface." edition = "2018" @@ -26,23 +26,23 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" serde_json = "1.0.41" -sc-informant = { version = "0.8.0-alpha.8", path = "../informant" } -sp-panic-handler = { version = "2.0.0-alpha.8", path = "../../primitives/panic-handler" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../service" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } -substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-alpha.8"} -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } +sc-informant = { version = "0.8.0-dev", path = "../informant" } +sp-panic-handler = { version = "2.0.0-dev", path = "../../primitives/panic-handler" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../service" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-dev"} +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.8" -sc-tracing = { version = "2.0.0-alpha.8", path = "../tracing" } +sc-tracing = { version = "2.0.0-dev", path = "../tracing" } chrono = "0.4.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index a4f5861260..c8a00f9185 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-aura" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Aura consensus algorithm for substrate" edition = "2018" @@ -12,37 +12,37 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/aura" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../../client/block-builder" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-dev", path = "../../../primitives/consensus/aura" } +sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../../keystore" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sc-keystore = { version = "2.0.0-dev", path = "../../keystore" } log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } -sp-version = { version = "2.0.0-alpha.8", path = "../../../primitives/version" } -sc-consensus-slots = { version = "0.8.0-alpha.8", path = "../slots" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-alpha.8", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../../telemetry" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-alpha.8"} +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-version = { version = "2.0.0-dev", path = "../../../primitives/version" } +sc-consensus-slots = { version = "0.8.0-dev", path = "../slots" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} [dev-dependencies] -sp-keyring = { version = "2.0.0-alpha.8", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../executor" } -sc-network = { version = "0.8.0-alpha.8", path = "../../network" } -sc-network-test = { version = "0.8.0-alpha.8", path = "../../network/test" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-dev", path = "../../executor" } +sc-network = { version = "0.8.0-dev", path = "../../network" } +sc-network-test = { version = "0.8.0-dev", path = "../../network/test" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 033f3da62b..1a0c7b2985 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "BABE consensus algorithm for substrate" edition = "2018" @@ -14,31 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/babe" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../../primitives/application-crypto" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" serde = { version = "1.0.104", features = ["derive"] } -sp-version = { version = "2.0.0-alpha.8", path = "../../../primitives/version" } -sp-io = { version = "2.0.0-alpha.8", path = "../../../primitives/io" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sp-timestamp = { version = "2.0.0-alpha.8", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../../telemetry" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../../keystore" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sc-consensus-epochs = { version = "0.8.0-alpha.8", path = "../epochs" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../../primitives/block-builder" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-consensus-vrf = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/vrf" } -sc-consensus-uncles = { version = "0.8.0-alpha.8", path = "../uncles" } -sc-consensus-slots = { version = "0.8.0-alpha.8", path = "../slots" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -fork-tree = { version = "2.0.0-alpha.8", path = "../../../utils/fork-tree" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-alpha.8"} +sp-version = { version = "2.0.0-dev", path = "../../../primitives/version" } +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } +sc-keystore = { version = "2.0.0-dev", path = "../../keystore" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sc-consensus-epochs = { version = "0.8.0-dev", path = "../epochs" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-consensus-vrf = { version = "0.8.0-dev", path = "../../../primitives/consensus/vrf" } +sc-consensus-uncles = { version = "0.8.0-dev", path = "../uncles" } +sc-consensus-slots = { version = "0.8.0-dev", path = "../slots" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +fork-tree = { version = "2.0.0-dev", path = "../../../utils/fork-tree" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" @@ -50,13 +50,13 @@ pdqselect = "0.1.0" derive_more = "0.99.2" [dev-dependencies] -sp-keyring = { version = "2.0.0-alpha.8", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../executor" } -sc-network = { version = "0.8.0-alpha.8", path = "../../network" } -sc-network-test = { version = "0.8.0-alpha.8", path = "../../network/test" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../block-builder" } +sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-dev", path = "../../executor" } +sc-network = { version = "0.8.0-dev", path = "../../network" } +sc-network-test = { version = "0.8.0-dev", path = "../../network/test" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 1f365a9e2a..2a0762e1a8 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "RPC extensions for the BABE consensus algorithm" edition = "2018" @@ -12,24 +12,24 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-consensus-babe = { version = "0.8.0-alpha.8", path = "../" } +sc-consensus-babe = { version = "0.8.0-dev", path = "../" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../../primitives/consensus/babe" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.8.0-alpha.8", path = "../../epochs" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../../primitives/runtime" } +sc-consensus-epochs = { version = "0.8.0-dev", path = "../../epochs" } futures = { version = "0.3.4", features = ["compat"] } derive_more = "0.99.2" -sp-api = { version = "2.0.0-alpha.8", path = "../../../../primitives/api" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../../primitives/consensus/common" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../../primitives/core" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../../../keystore" } +sp-api = { version = "2.0.0-dev", path = "../../../../primitives/api" } +sp-consensus = { version = "0.8.0-dev", path = "../../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-dev", path = "../../../../primitives/core" } +sc-keystore = { version = "2.0.0-dev", path = "../../../keystore" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../../test-utils/runtime/client" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../../../primitives/application-crypto" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../../../primitives/application-crypto" } +sp-keyring = { version = "2.0.0-dev", path = "../../../../primitives/keyring" } tempfile = "3.1.0" diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index 54fefb00fa..bf7fac9568 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,7 +12,7 @@ description = "Collection of common consensus specific imlementations for Substr targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index a55806ee38..7c2edffc53 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-epochs" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Generic epochs-based utilities for consensus" edition = "2018" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -fork-tree = { version = "2.0.0-alpha.8", path = "../../../utils/fork-tree" } -sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-alpha.8"} -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sc-client-api = { path = "../../api" , version = "2.0.0-alpha.8"} +fork-tree = { version = "2.0.0-dev", path = "../../../utils/fork-tree" } +sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-dev"} +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sc-client-api = { path = "../../api" , version = "2.0.0-dev"} diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 34b7d13cb7..3d42412f2f 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-manual-seal" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Manual sealing engine for Substrate" edition = "2018" @@ -22,20 +22,20 @@ parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } assert_matches = "1.3.0" -sc-client-api = { path = "../../../client/api", version = "2.0.0-alpha.8" } -sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-alpha.8" } -sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-alpha.8" } -sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-alpha.8" } -sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-alpha.8" } -sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-alpha.8" } -sp-core = { path = "../../../primitives/core", version = "2.0.0-alpha.8" } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-alpha.8" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-alpha.8" } +sc-client-api = { path = "../../../client/api", version = "2.0.0-dev" } +sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-dev" } +sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-dev" } +sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-dev" } +sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-dev" } +sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-dev" } +sp-core = { path = "../../../primitives/core", version = "2.0.0-dev" } +sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-dev" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev" } [dev-dependencies] -sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-alpha.8" } -substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-alpha.8" } -substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-alpha.8" } +sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-dev" } +substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-dev" } +substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-dev" } tokio = { version = "0.2", features = ["rt-core", "macros"] } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index a41c1bea79..3d47a983ea 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-pow" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "PoW consensus algorithm for substrate" edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../../primitives/block-builder" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } -sp-consensus-pow = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/pow" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sp-consensus-pow = { version = "0.8.0-dev", path = "../../../primitives/consensus/pow" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } log = "0.4.8" futures = { version = "0.3.1", features = ["compat"] } -sp-timestamp = { version = "2.0.0-alpha.8", path = "../../../primitives/timestamp" } +sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } derive_more = "0.99.2" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-alpha.8"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index fdaa4871a1..f778cbf2f0 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-slots" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Generic slots-based utilities for consensus" edition = "2018" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../../primitives/application-crypto" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../../telemetry" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" log = "0.4.8" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml index e052e8b023..b9039d8189 100644 --- a/client/consensus/uncles/Cargo.toml +++ b/client/consensus/uncles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-uncles" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Generic uncle inclusion utilities for consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-authorship = { version = "2.0.0-alpha.8", path = "../../../primitives/authorship" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-authorship = { version = "2.0.0-dev", path = "../../../primitives/authorship" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } log = "0.4.8" diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 9aaccf1da0..c9006ee2f6 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-db" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -23,22 +23,22 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["st codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } blake2-rfc = "0.2.18" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sc-executor = { version = "0.8.0-alpha.8", path = "../executor" } -sc-state-db = { version = "0.8.0-alpha.8", path = "../state-db" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../primitives/trie" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-database = { version = "2.0.0-alpha.8", path = "../../primitives/database" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-executor = { version = "0.8.0-dev", path = "../executor" } +sc-state-db = { version = "0.8.0-dev", path = "../state-db" } +sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } parity-db = { version = "0.1.2", optional = true } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-alpha.8", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } [dev-dependencies] -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.9" kvdb-rocksdb = "0.8" diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index cea11c9a0c..ac863fbd8c 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,22 +15,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../primitives/trie" } -sp-serializer = { version = "2.0.0-alpha.8", path = "../../primitives/serializer" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } -sp-panic-handler = { version = "2.0.0-alpha.8", path = "../../primitives/panic-handler" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } +sp-serializer = { version = "2.0.0-dev", path = "../../primitives/serializer" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-panic-handler = { version = "2.0.0-dev", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.41.0" lazy_static = "1.4.0" -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../../primitives/runtime-interface" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../primitives/externalities" } -sc-executor-common = { version = "0.8.0-alpha.8", path = "common" } -sc-executor-wasmi = { version = "0.8.0-alpha.8", path = "wasmi" } -sc-executor-wasmtime = { version = "0.8.0-alpha.8", path = "wasmtime", optional = true } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-dev", path = "../../primitives/runtime-interface" } +sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } +sc-executor-common = { version = "0.8.0-dev", path = "common" } +sc-executor-wasmi = { version = "0.8.0-dev", path = "wasmi" } +sc-executor-wasmtime = { version = "0.8.0-dev", path = "wasmtime", optional = true } parking_lot = "0.10.0" log = "0.4.8" libsecp256k1 = "0.3.4" @@ -39,11 +39,11 @@ libsecp256k1 = "0.3.4" assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" -sc-runtime-test = { version = "2.0.0-alpha.8", path = "runtime-test" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } +sc-runtime-test = { version = "2.0.0-dev", path = "runtime-test" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } test-case = "0.3.3" -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } [features] default = [ "std" ] diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index 890010caf1..ed91c353b9 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-common" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,11 +18,11 @@ derive_more = "0.99.2" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } wasmi = "0.6.2" -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-alpha.8", path = "../../../primitives/allocator" } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime-interface" } -sp-serializer = { version = "2.0.0-alpha.8", path = "../../../primitives/serializer" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } +sp-serializer = { version = "2.0.0-dev", path = "../../../primitives/serializer" } [features] default = [] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index 54ba45921f..c675e72e0f 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-runtime-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,12 +13,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/io" } -sp-sandbox = { version = "0.8.0-alpha.8", default-features = false, path = "../../../primitives/sandbox" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -sp-allocator = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/allocator" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/io" } +sp-sandbox = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/sandbox" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-allocator = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/allocator" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index 4638727742..7ccb167325 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmi" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,8 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" wasmi = "0.6.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-alpha.8", path = "../common" } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-alpha.8", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-dev", path = "../common" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 0a803d772a..8a424dfc2e 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmtime" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,11 +16,11 @@ log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-alpha.8", path = "../common" } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-alpha.8", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-dev", path = "../common" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.2" } wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.2" } wasmtime-environ = "0.16" diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index 179a938270..f0f89b6278 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -fork-tree = { version = "2.0.0-alpha.8", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-dev", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" @@ -23,37 +23,37 @@ parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" parity-scale-codec = { version = "1.3.0", features = ["derive"] } -sp-arithmetic = { version = "2.0.0-alpha.8", path = "../../primitives/arithmetic" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../client/consensus/common" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../keystore" } +sp-arithmetic = { version = "2.0.0-dev", path = "../../primitives/arithmetic" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-dev", path = "../../client/consensus/common" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sc-keystore = { version = "2.0.0-dev", path = "../keystore" } serde_json = "1.0.41" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-inherents = { version = "2.0.0-alpha.8", path = "../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sc-network-gossip = { version = "0.8.0-alpha.8", path = "../network-gossip" } -sp-finality-tracker = { version = "2.0.0-alpha.8", path = "../../primitives/finality-tracker" } -sp-finality-grandpa = { version = "2.0.0-alpha.8", path = "../../primitives/finality-grandpa" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-alpha.8"} -sc-block-builder = { version = "0.8.0-alpha.8", path = "../block-builder" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-inherents = { version = "2.0.0-dev", path = "../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sc-network-gossip = { version = "0.8.0-dev", path = "../network-gossip" } +sp-finality-tracker = { version = "2.0.0-dev", path = "../../primitives/finality-tracker" } +sp-finality-grandpa = { version = "2.0.0-dev", path = "../../primitives/finality-grandpa" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} +sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } pin-project = "0.4.6" [dev-dependencies] finality-grandpa = { version = "0.12.3", features = ["derive-codec", "test-helpers"] } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sc-network-test = { version = "0.8.0-alpha.8", path = "../network/test" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/babe" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sc-network-test = { version = "0.8.0-dev", path = "../network/test" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../primitives/consensus/babe" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = { version = "0.2", features = ["rt-core"] } tempfile = "3.1.0" -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index 75d7497235..0eecec19f7 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "RPC extensions for the GRANDPA finality gadget" repository = "https://github.com/paritytech/substrate/" @@ -8,7 +8,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -sc-finality-grandpa = { version = "0.8.0-alpha.8", path = "../" } +sc-finality-grandpa = { version = "0.8.0-dev", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.3" @@ -20,4 +20,4 @@ log = "0.4.8" derive_more = "0.99.2" [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index 695f480915..5957cfc297 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-informant" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Substrate informant." edition = "2018" @@ -17,8 +17,8 @@ futures = "0.3.4" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } wasm-timer = "0.2" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../service" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../service" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index f81251bf6b..6de93f28be 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-keystore" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } hex = "0.4.0" rand = "0.7.2" serde_json = "1.0.41" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index 78b80f1033..d46e3420ea 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Gossiping for the Substrate network protocol" name = "sc-network-gossip" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -19,12 +19,12 @@ futures-timer = "3.0.1" libp2p = { version = "0.18.1", default-features = false, features = ["websocket"] } log = "0.4.8" lru = "0.4.3" -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } wasm-timer = "0.2" [dev-dependencies] async-std = "1.5" quickcheck = "0.9.0" rand = "0.7.2" -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index e2bdea235d..537ab43672 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate network protocol" name = "sc-network" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -25,7 +25,7 @@ derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" fnv = "1.0.6" -fork-tree = { version = "2.0.0-alpha.8", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-dev", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" futures_codec = "0.3.3" @@ -38,23 +38,23 @@ lru = "0.4.0" nohash-hasher = "0.2.0" parking_lot = "0.10.0" pin-project = "0.4.6" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-alpha.8", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } prost = "0.6.1" rand = "0.7.2" -sc-block-builder = { version = "0.8.0-alpha.8", path = "../block-builder" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sc-peerset = { version = "2.0.0-alpha.8", path = "../peerset" } +sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sc-peerset = { version = "2.0.0-dev", path = "../peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -sp-arithmetic = { version = "2.0.0-alpha.8", path = "../../primitives/arithmetic" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } +sp-arithmetic = { version = "2.0.0-dev", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } thiserror = "1" unsigned-varint = { version = "0.3.1", features = ["futures", "futures-codec"] } void = "1.0.2" @@ -73,10 +73,10 @@ env_logger = "0.7.0" libp2p = { version = "0.18.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } -sp-test-primitives = { version = "2.0.0-alpha.8", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +sp-test-primitives = { version = "2.0.0-dev", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } tempfile = "3.1.0" [features] diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 38e1ceb8ea..5abc9a1ea7 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Integration tests for Substrate network protocol" name = "sc-network-test" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-network = { version = "0.8.0-alpha.8", path = "../" } +sc-network = { version = "0.8.0-dev", path = "../" } log = "0.4.8" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" libp2p = { version = "0.18.1", default-features = false, features = ["libp2p-websocket"] } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../../client/consensus/common" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../block-builder" } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/babe" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } env_logger = "0.7.0" -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } tempfile = "3.1.0" -sc-service = { version = "0.8.0-alpha.8", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../service" } diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 29c36331df..5a13b44a80 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers" name = "sc-offchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bytes = "0.5" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } fnv = "1.0.6" futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -sp-offchain = { version = "2.0.0-alpha.8", path = "../../primitives/offchain" } +sp-offchain = { version = "2.0.0-dev", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } rand = "0.7.2" -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../keystore" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sc-keystore = { version = "2.0.0-dev", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] hyper = "0.13.2" @@ -38,10 +38,10 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" fdlimit = "0.1.4" -sc-client-db = { version = "0.8.0-alpha.8", default-features = true, path = "../db/" } -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sc-client-db = { version = "0.8.0-dev", default-features = true, path = "../db/" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } tokio = "0.2" [features] diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index f23e89e0f5..b4c5005324 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -3,7 +3,7 @@ description = "Connectivity manager based on reputation" homepage = "http://parity.io" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" name = "sc-peerset" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" repository = "https://github.com/paritytech/substrate/" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" libp2p = { version = "0.18.1", default-features = false } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils"} +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" wasm-timer = "0.2" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index 3f984a09ed..f591a6d853 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-api" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -21,11 +21,11 @@ jsonrpc-derive = "14.0.3" jsonrpc-pubsub = "14.0.3" log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } -sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-alpha.8"} -sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-alpha.8"} +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-dev"} +sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-dev"} serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -sp-rpc = { version = "2.0.0-alpha.8", path = "../../primitives/rpc" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +sp-rpc = { version = "2.0.0-dev", path = "../../primitives/rpc" } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 1f9172b908..a57baf1db7 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-server" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,7 +17,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.0.3" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index a97a46fa29..94d4b38600 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,38 +12,38 @@ description = "Substrate Client RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-rpc-api = { version = "0.8.0-alpha.8", path = "../rpc-api" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } +sc-rpc-api = { version = "0.8.0-dev", path = "../rpc-api" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.0.3" log = "0.4.8" -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.0.3" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } serde_json = "1.0.41" -sp-session = { version = "2.0.0-alpha.8", path = "../../primitives/session" } -sp-offchain = { version = "2.0.0-alpha.8", path = "../../primitives/offchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sp-rpc = { version = "2.0.0-alpha.8", path = "../../primitives/rpc" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sp-chain-spec = { version = "2.0.0-alpha.8", path = "../../primitives/chain-spec" } -sc-executor = { version = "0.8.0-alpha.8", path = "../executor" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../client/block-builder" } -sc-keystore = { version = "2.0.0-alpha.8", path = "../keystore" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } +sp-session = { version = "2.0.0-dev", path = "../../primitives/session" } +sp-offchain = { version = "2.0.0-dev", path = "../../primitives/offchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-rpc = { version = "2.0.0-dev", path = "../../primitives/rpc" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-chain-spec = { version = "2.0.0-dev", path = "../../primitives/chain-spec" } +sc-executor = { version = "0.8.0-dev", path = "../executor" } +sc-block-builder = { version = "0.8.0-dev", path = "../../client/block-builder" } +sc-keystore = { version = "2.0.0-dev", path = "../keystore" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.10.0" [dev-dependencies] assert_matches = "1.3.0" futures01 = { package = "futures", version = "0.1.29" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } tokio = "0.1.22" -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../transaction-pool" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../transaction-pool" } lazy_static = "1.4.0" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 04a6f488b1..5a026e5890 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -39,38 +39,38 @@ hash-db = "0.15.2" serde = "1.0.101" serde_json = "1.0.41" sysinfo = "0.13.3" -sc-keystore = { version = "2.0.0-alpha.8", path = "../keystore" } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../primitives/externalities" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-session = { version = "2.0.0-alpha.8", path = "../../primitives/session" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../primitives/application-crypto" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sc-network = { version = "0.8.0-alpha.8", path = "../network" } -sc-chain-spec = { version = "2.0.0-alpha.8", path = "../chain-spec" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sc-client-db = { version = "0.8.0-alpha.8", default-features = false, path = "../db" } +sc-keystore = { version = "2.0.0-dev", path = "../keystore" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-session = { version = "2.0.0-dev", path = "../../primitives/session" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sc-network = { version = "0.8.0-dev", path = "../network" } +sc-chain-spec = { version = "2.0.0-dev", path = "../chain-spec" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../db" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor = { version = "0.8.0-alpha.8", path = "../executor" } -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../transaction-pool" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -sc-rpc-server = { version = "2.0.0-alpha.8", path = "../rpc-servers" } -sc-rpc = { version = "2.0.0-alpha.8", path = "../rpc" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../block-builder" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../../primitives/block-builder" } +sc-executor = { version = "0.8.0-dev", path = "../executor" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../transaction-pool" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +sc-rpc-server = { version = "2.0.0-dev", path = "../rpc-servers" } +sc-rpc = { version = "2.0.0-dev", path = "../rpc" } +sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } +sp-block-builder = { version = "2.0.0-dev", path = "../../primitives/block-builder" } -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } -sc-offchain = { version = "2.0.0-alpha.8", path = "../offchain" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sc-offchain = { version = "2.0.0-dev", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-alpha.8"} -sc-tracing = { version = "2.0.0-alpha.8", path = "../tracing" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-dev"} +sc-tracing = { version = "2.0.0-dev", path = "../tracing" } tracing = "0.1.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } @@ -83,7 +83,7 @@ procfs = '0.7.8' [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/babe" } -grandpa = { version = "0.8.0-alpha.8", package = "sc-finality-grandpa", path = "../finality-grandpa" } -grandpa-primitives = { version = "2.0.0-alpha.8", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-dev", path = "../../primitives/consensus/babe" } +grandpa = { version = "0.8.0-dev", package = "sc-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { version = "2.0.0-dev", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index 76420f9139..c44f436513 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,24 +20,24 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../../primitives/externalities" } -sp-trie = { version = "2.0.0-alpha.8", path = "../../../primitives/trie" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../../primitives/storage" } -sc-client-db = { version = "0.8.0-alpha.8", default-features = false, path = "../../db" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } +sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } +sp-storage = { version = "2.0.0-dev", path = "../../../primitives/storage" } +sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../../db" } futures = { version = "0.3.1", features = ["compat"] } -sc-service = { version = "0.8.0-alpha.8", default-features = false, features = ["test-helpers"], path = "../../service" } -sc-network = { version = "0.8.0-alpha.8", path = "../../network" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../api" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../block-builder" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../executor" } -sp-panic-handler = { version = "2.0.0-alpha.8", path = "../../../primitives/panic-handler" } +sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-network = { version = "0.8.0-dev", path = "../../network" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } +sc-executor = { version = "0.8.0-dev", path = "../../executor" } +sp-panic-handler = { version = "2.0.0-dev", path = "../../../primitives/panic-handler" } parity-scale-codec = "1.3.0" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index 17b9340afd..f4f084bc89 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-state-db" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = "0.10.0" log = "0.4.8" -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index 4a3f302fb6..e2c08babf3 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-telemetry" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Telemetry utils" edition = "2018" diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index 4e1924180b..52fa8d6600 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-tracing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -20,7 +20,7 @@ serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" -sc-telemetry = { version = "2.0.0-alpha.8", path = "../telemetry" } +sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } [dev-dependencies] tracing = "0.1.10" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index a7b50c847c..8b51bc7418 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,21 +20,21 @@ intervalier = "0.4.0" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parking_lot = "0.10.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-alpha.8"} -sc-client-api = { version = "2.0.0-alpha.8", path = "../api" } -sc-transaction-graph = { version = "2.0.0-alpha.8", path = "./graph" } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-alpha.8", path = "../../primitives/tracing" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../primitives/utils" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} +sc-client-api = { version = "2.0.0-dev", path = "../api" } +sc-transaction-graph = { version = "2.0.0-dev", path = "./graph" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-dev", path = "../../primitives/tracing" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } wasm-timer = "0.2" [dev-dependencies] assert_matches = "1.3.0" hex = "0.4" -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } -substrate-test-runtime-transaction-pool = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +substrate-test-runtime-transaction-pool = { version = "2.0.0-dev", path = "../../test-utils/runtime/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index eaa70743e2..4f9131aa96 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-graph" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,18 +18,18 @@ log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0.101", features = ["derive"] } wasm-timer = "0.2" -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../../primitives/utils" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-utils = { version = "2.0.0-dev", path = "../../../primitives/utils" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } criterion = "0.3" [[bench]] diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index 6dc6e3e513..dc2a838d1c 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index f052f8c7e4..cd7f17ba13 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aura" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME AURA consensus pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../session" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -sp-consensus-aura = { path = "../../primitives/consensus/aura", default-features = false, version = "0.8.0-alpha.8"} -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/timestamp" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../timestamp" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +sp-consensus-aura = { path = "../../primitives/consensus/aura", default-features = false, version = "0.8.0-dev"} +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } [dev-dependencies] diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index a9f352a8bc..134dff4017 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authority-discovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME pallet for authority discovery" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-authority-discovery = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/authority-discovery" } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } +sp-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authority-discovery" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -pallet-session = { version = "2.0.0-alpha.8", features = ["historical" ], path = "../session", default-features = false } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +pallet-session = { version = "2.0.0-dev", features = ["historical" ], path = "../session", default-features = false } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } [features] default = ["std"] diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 46ce41e148..d5769783a9 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authorship" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" description = "Block and Uncle Author tracking for the FRAME" authors = ["Parity Technologies "] edition = "2018" @@ -12,15 +12,15 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-authorship = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/authorship" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-authorship = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authorship" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} impl-trait-for-tuples = "0.1.3" [features] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 3340f7a71e..685e508a3d 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-babe" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,22 +14,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../timestamp" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/timestamp" } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../session" } -sp-consensus-babe = { version = "0.8.0-alpha.8", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.8.0-alpha.8", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } +sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/babe" } +sp-consensus-vrf = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/vrf" } +sp-io = { path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 29802a68d2..3916d5605f 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../transaction-payment" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } [features] default = ["std"] diff --git a/frame/benchmark/Cargo.toml b/frame/benchmark/Cargo.toml index 1c56424151..7fab3642f2 100644 --- a/frame/benchmark/Cargo.toml +++ b/frame/benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-benchmark" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std"] diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index b963b73483..fcc8e0bf92 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] linregress = "0.1" paste = "0.1" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api = { version = "2.0.0-alpha.8", path = "../../primitives/api", default-features = false } -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../../primitives/runtime-interface", default-features = false } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime", default-features = false } -sp-std = { version = "2.0.0-alpha.8", path = "../../primitives/std", default-features = false } -sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-alpha.8"} -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-api = { version = "2.0.0-dev", path = "../../primitives/api", default-features = false } +sp-runtime-interface = { version = "2.0.0-dev", path = "../../primitives/runtime-interface", default-features = false } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "2.0.0-dev", path = "../../primitives/std", default-features = false } +sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-dev"} +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [features] default = [ "std" ] diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index 8372880400..f2a7f46b06 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-collective" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 0cbd731147..3350e815b2 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ pwasm-utils = { version = "0.12.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-sandbox = { version = "0.8.0-alpha.8", default-features = false, path = "../../primitives/sandbox" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-contracts-primitives = { version = "2.0.0-alpha.8", default-features = false, path = "common" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", default-features = false, path = "../transaction-payment" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-sandbox = { version = "0.8.0-dev", default-features = false, path = "../../primitives/sandbox" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "common" } +pallet-transaction-payment = { version = "2.0.0-dev", default-features = false, path = "../transaction-payment" } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../timestamp" } -pallet-randomness-collective-flip = { version = "2.0.0-alpha.8", path = "../randomness-collective-flip" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } +pallet-randomness-collective-flip = { version = "2.0.0-dev", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index 15f0b8a0e7..d834be7437 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } [features] default = ["std"] diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index f8692de80a..f3d32e7696 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-alpha.8", path = "../../../primitives/rpc" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-dev", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -pallet-contracts-primitives = { version = "2.0.0-alpha.8", path = "../common" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-alpha.8", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +pallet-contracts-primitives = { version = "2.0.0-dev", path = "../common" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-dev", path = "./runtime-api" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index e9d9e6fdfa..fdcfb5149a 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Runtime API definition required by Contracts RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/runtime" } -pallet-contracts-primitives = { version = "2.0.0-alpha.8", default-features = false, path = "../../common" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/runtime" } +pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "../../common" } [features] default = ["std"] diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index e506561411..5c339d2bc5 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -pallet-scheduler = { version = "2.0.0-alpha.8", path = "../scheduler" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../primitives/storage" } -substrate-test-utils = { version = "2.0.0-alpha.8", path = "../../test-utils" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-scheduler = { version = "2.0.0-dev", path = "../scheduler" } +sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } +substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } hex-literal = "0.2.1" [features] diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index fc7c6c7993..f9a3ec0b21 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections-phragmen" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-phragmen = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/phragmen" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../primitives/phragmen" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -substrate-test-utils = { version = "2.0.0-alpha.8", path = "../../test-utils" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } [features] default = ["std"] diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index 0eb99ad94e..3109a13392 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 124ee92ca8..c7aea6eb9b 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-evm" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../timestamp" } -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../balances" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } primitive-types = { version = "0.7.0", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.16", default-features = false } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index 5953240a4b..30381adb49 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example-offchain-worker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -13,13 +13,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } lite-json = { version = "0.1", default-features = false } [features] diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index 16b05180bb..d12b1e7c83 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../balances" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index cb0efafac1..84918f7361 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-executive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/tracing" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../../primitives/tracing" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } [dev-dependencies] hex-literal = "0.2.1" -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-io ={ path = "../../primitives/io", version = "2.0.0-alpha.8"} -pallet-indices = { version = "2.0.0-alpha.8", path = "../indices" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -pallet-transaction-payment = { version = "2.0.0-alpha.8", path = "../transaction-payment" } -sp-version = { version = "2.0.0-alpha.8", path = "../../primitives/version" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ path = "../../primitives/io", version = "2.0.0-dev"} +pallet-indices = { version = "2.0.0-dev", path = "../indices" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } +sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } [features] default = ["std"] diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index b0bf31304c..9c2019bfb5 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-finality-tracker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-finality-tracker = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/finality-tracker" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-tracker" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index 97c37fae37..9b32d718ac 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-generic-asset" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Centrality Developers "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-io ={ version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 3ee12a4aab..7a9a00a282 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-grandpa" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,27 +14,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-finality-grandpa = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/finality-grandpa" } -sp-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/session" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../session" } -pallet-finality-tracker = { version = "2.0.0-alpha.8", default-features = false, path = "../finality-tracker" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-finality-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-grandpa" } +sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } +pallet-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../finality-tracker" } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.12.3", features = ["derive-codec"] } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -pallet-offences = { version = "2.0.0-alpha.8", path = "../offences" } -pallet-staking = { version = "2.0.0-alpha.8", path = "../staking" } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", path = "../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../timestamp" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-offences = { version = "2.0.0-dev", path = "../offences" } +pallet-staking = { version = "2.0.0-dev", path = "../staking" } +pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } [features] default = ["std"] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 9d36a235e0..bfe2a7d492 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 7c93b25e35..964bd2f69a 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-im-online" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME's I'm online pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } -pallet-authorship = { version = "2.0.0-alpha.8", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../authorship" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../session" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std", "pallet-session/historical"] diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index 7a747ed294..db0f4cbf55 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-indices" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-keyring = { version = "2.0.0-alpha.8", optional = true, path = "../../primitives/keyring" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../primitives/keyring" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index 538c63acbb..befca54ad1 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-membership" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index bbf2839341..1241c3b4ab 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-metadata" -version = "11.0.0-alpha.8" +version = "11.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 24fd06e454..140a48523b 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-nicks" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index 4b5fbb9dbe..ebb31d680d 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ description = "FRAME offences pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index f18865a45a..ff77497db0 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,28 +13,28 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../system" } -pallet-babe = { version = "2.0.0-alpha.8", default-features = false, path = "../../babe" } -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../../balances" } -pallet-grandpa = { version = "2.0.0-alpha.8", default-features = false, path = "../../grandpa" } -pallet-im-online = { version = "2.0.0-alpha.8", default-features = false, path = "../../im-online" } -pallet-offences = { version = "2.0.0-alpha.8", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../session" } -pallet-staking = { version = "2.0.0-alpha.8", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-io = { path = "../../../primitives/io", default-features = false, version = "2.0.0-alpha.8"} -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/staking" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } +pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../babe" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../../balances" } +pallet-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../grandpa" } +pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../im-online" } +pallet-offences = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../../session" } +pallet-staking = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +sp-io = { path = "../../../primitives/io", default-features = false, version = "2.0.0-dev"} +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/staking" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } [dev-dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", path = "../../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } serde = { version = "1.0.101" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-alpha.8"} +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} [features] default = ["std"] diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index efd41d96b0..2c6e733cae 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-randomness-collective-flip" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 5d4ea80fca..b0a5982714 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-recovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 6fdf61cf93..6cc9161eea 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scheduler" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -11,16 +11,16 @@ description = "FRAME example pallet" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index e24505355d..83d1402957 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scored-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 61fa57521e..b03eea494a 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/session" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../timestamp" } -sp-trie = { optional = true, path = "../../primitives/trie", default-features = false, version = "2.0.0-alpha.8"} -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } +sp-trie = { optional = true, path = "../../primitives/trie", default-features = false, version = "2.0.0-dev"} +sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" [features] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index e06377a0b4..d263e1af9a 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ description = "FRAME sessions pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../system" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../support" } -pallet-staking = { version = "2.0.0-alpha.8", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -pallet-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../session" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } +pallet-staking = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +pallet-session = { version = "2.0.0-dev", default-features = false, path = "../../session" } [dev-dependencies] serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", path = "../../staking/reward-curve" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-alpha.8"} -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../../timestamp" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../../balances" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/reward-curve" } +sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} +pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } +pallet-balances = { version = "2.0.0-dev", path = "../../balances" } [features] default = ["std"] diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index 00f5aa651b..24380aff55 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-society" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 38fb18b56a..022baa0f13 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,35 +14,35 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-phragmen = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/phragmen" } -sp-io ={ version = "2.0.0-alpha.8", path = "../../primitives/io", default-features = false } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-alpha.8", features = ["historical"], path = "../session", default-features = false } -pallet-authorship = { version = "2.0.0-alpha.8", default-features = false, path = "../authorship" } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../primitives/phragmen" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-dev", features = ["historical"], path = "../session", default-features = false } +pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } static_assertions = "1.1.0" # Optional imports for tesing-utils feature -pallet-indices = { version = "2.0.0-alpha.8", optional = true, path = "../indices", default-features = false } -sp-core = { version = "2.0.0-alpha.8", optional = true, path = "../../primitives/core", default-features = false } +pallet-indices = { version = "2.0.0-dev", optional = true, path = "../indices", default-features = false } +sp-core = { version = "2.0.0-dev", optional = true, path = "../../primitives/core", default-features = false } rand = { version = "0.7.3", optional = true, default-features = false } # Optional imports for benchmarking -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../primitives/storage" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../timestamp" } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", path = "../staking/reward-curve" } -substrate-test-utils = { version = "2.0.0-alpha.8", path = "../../test-utils" } -frame-benchmarking = { version = "2.0.0-alpha.8", path = "../benchmarking" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../staking/reward-curve" } +substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } +frame-benchmarking = { version = "2.0.0-dev", path = "../benchmarking" } rand_chacha = { version = "0.2" } parking_lot = "0.10.2" env_logger = "0.7.1" diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index 9fa74d695d..c717dd8598 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-alpha.8", path = "..", features = ["testing-utils"] } -pallet-staking-reward-curve = { version = "2.0.0-alpha.8", path = "../reward-curve" } -pallet-session = { version = "2.0.0-alpha.8", path = "../../session" } -pallet-indices = { version = "2.0.0-alpha.8", path = "../../indices" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../../balances" } -pallet-timestamp = { version = "2.0.0-alpha.8", path = "../../timestamp" } -frame-system = { version = "2.0.0-alpha.8", path = "../../system" } -frame-support = { version = "2.0.0-alpha.8", path = "../../support" } -sp-std = { version = "2.0.0-alpha.8", path = "../../../primitives/std" } -sp-io ={ version = "2.0.0-alpha.8", path = "../../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-phragmen = { version = "2.0.0-alpha.8", path = "../../../primitives/phragmen" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-dev", path = "..", features = ["testing-utils"] } +pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../reward-curve" } +pallet-session = { version = "2.0.0-dev", path = "../../session" } +pallet-indices = { version = "2.0.0-dev", path = "../../indices" } +pallet-balances = { version = "2.0.0-dev", path = "../../balances" } +pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } +frame-system = { version = "2.0.0-dev", path = "../../system" } +frame-support = { version = "2.0.0-dev", path = "../../support" } +sp-std = { version = "2.0.0-dev", path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-phragmen = { version = "2.0.0-dev", path = "../../../primitives/phragmen" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } [[bin]] name = "submit_solution" diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index 52ba05e409..b5ec29060a 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking-reward-curve" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -21,4 +21,4 @@ proc-macro2 = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index 1eb8de2cd0..bbceac1496 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-sudo" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index e2063bf69e..3213f0dfe4 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,24 +15,24 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-metadata = { version = "11.0.0-alpha.8", default-features = false, path = "../metadata" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/tracing" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-arithmetic = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/arithmetic" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -frame-support-procedural = { version = "2.0.0-alpha.8", path = "./procedural" } +frame-metadata = { version = "11.0.0-dev", default-features = false, path = "../metadata" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../../primitives/tracing" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../../primitives/arithmetic" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +frame-support-procedural = { version = "2.0.0-dev", path = "./procedural" } paste = "0.1.6" once_cell = { version = "1", default-features = false, optional = true } -sp-state-machine = { version = "0.8.0-alpha.8", optional = true, path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" [dev-dependencies] pretty_assertions = "0.6.1" -frame-system = { version = "2.0.0-alpha.8", path = "../system" } +frame-system = { version = "2.0.0-dev", path = "../system" } [features] default = ["std"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 6ef28cb75f..4d05685f9d 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -frame-support-procedural-tools = { version = "2.0.0-alpha.8", path = "./tools" } +frame-support-procedural-tools = { version = "2.0.0-dev", path = "./tools" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full"] } diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index d49a90895f..5e5e0eb4c4 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Proc macro helpers for procedural macros" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support-procedural-tools-derive = { version = "2.0.0-alpha.8", path = "./derive" } +frame-support-procedural-tools-derive = { version = "2.0.0-dev", path = "./derive" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full", "visit"] } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index f5f9c83b55..7cc657e685 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 67e00f3d8d..59014d893c 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ path = "../../../primitives/io", default-features = false , version = "2.0.0-alpha.8"} -sp-state-machine = { version = "0.8.0-alpha.8", optional = true, path = "../../../primitives/state-machine" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/inherents" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } +sp-io ={ path = "../../../primitives/io", default-features = false , version = "2.0.0-dev"} +sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../../primitives/state-machine" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/inherents" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 9b4424d56a..099290f2c7 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-alpha.8"} -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/version" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-dev"} +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" -sp-externalities = { version = "0.8.0-alpha.8", path = "../../primitives/externalities" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../test-utils/runtime/client" } +sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 25a9e8cf86..60ee030011 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-benchmarking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../../benchmarking" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../system" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../support" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-alpha.8"} +sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} [features] default = ["std"] diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index 5d2811abcd..d0644931ae 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-rpc-runtime-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Runtime API definition required by System RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [features] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index e5ac4f1aa7..49abf80254 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-timestamp" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,19 +16,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io", optional = true } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/timestamp" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io", optional = true } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-io ={ version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index 866d2ceda5..0f8b05c3dd 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-alpha.8", default-features = false, path = "./rpc/runtime-api" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "./rpc/runtime-api" } [dev-dependencies] -sp-io = { version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index f66e2a9f9d..3851c988e2 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,10 +16,10 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-alpha.8", path = "../../../primitives/rpc" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-dev", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-alpha.8", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", path = "./runtime-api" } diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index 909e526ed3..f8e948ea10 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../../support" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../support" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 9d4a6fb5d2..9b031c4a0c 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-treasury" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-alpha.8", default-features = false, path = "../balances" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io ={ version = "2.0.0-alpha.8", path = "../../primitives/io" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index 6fc23eb91e..fff5513682 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-utility" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 94924c07e2..96282db360 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-alpha.8", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-alpha.8", path = "../balances" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../primitives/storage" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } hex-literal = "0.2.1" [features] diff --git a/primitives/allocator/Cargo.toml b/primitives/allocator/Cargo.toml index e3f64cc6c9..d56b4e34b2 100644 --- a/primitives/allocator/Cargo.toml +++ b/primitives/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-allocator" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/sp-allocator" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-alpha.8", path = "../std", default-features = false } -sp-core = { version = "2.0.0-alpha.8", path = "../core", default-features = false } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-dev", path = "../std", default-features = false } +sp-core = { version = "2.0.0-dev", path = "../core", default-features = false } +sp-wasm-interface = { version = "2.0.0-dev", path = "../wasm-interface", default-features = false } log = { version = "0.4.8", optional = true } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index 8c490673b2..f82bcac77e 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api-proc-macro = { version = "2.0.0-alpha.8", path = "proc-macro" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../version" } -sp-state-machine = { version = "0.8.0-alpha.8", optional = true, path = "../../primitives/state-machine" } +sp-api-proc-macro = { version = "2.0.0-dev", path = "proc-macro" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../version" } +sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } hash-db = { version = "0.15.2", optional = true } [dev-dependencies] -sp-test-primitives = { version = "2.0.0-alpha.8", path = "../test-primitives" } +sp-test-primitives = { version = "2.0.0-dev", path = "../test-primitives" } [features] default = [ "std" ] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index 724a465008..46f804f32c 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-proc-macro" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 8aa77b01ea..9e2d894a01 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-alpha.8", path = "../" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -sp-version = { version = "2.0.0-alpha.8", path = "../../version" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../blockchain" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../../client/block-builder" } +sp-api = { version = "2.0.0-dev", path = "../" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sp-version = { version = "2.0.0-dev", path = "../../version" } +sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-blockchain = { version = "2.0.0-dev", path = "../../blockchain" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" [dev-dependencies] criterion = "0.3.0" -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -sp-core = { version = "2.0.0-alpha.8", path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sp-core = { version = "2.0.0-dev", path = "../../core" } [[bench]] name = "bench" diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index b48b61a99f..b350dee843 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" description = "Provides facilities for generating application specific crypto wrapper types." @@ -14,11 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } [features] default = [ "std" ] diff --git a/primitives/application-crypto/test/Cargo.toml b/primitives/application-crypto/test/Cargo.toml index b50d035546..6e2c81f3a6 100644 --- a/primitives/application-crypto/test/Cargo.toml +++ b/primitives/application-crypto/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" description = "Integration tests for application-crypto" @@ -13,8 +13,8 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../core" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../test-utils/runtime/client" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../api" } -sp-application-crypto = { version = "2.0.0-alpha.8", path = "../" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-api = { version = "2.0.0-dev", path = "../../api" } +sp-application-crypto = { version = "2.0.0-dev", path = "../" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index 0cab74a7b1..c22706e32e 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-debug-derive = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/debug-derive" } +sp-debug-derive = { version = "2.0.0-dev", default-features = false, path = "../../primitives/debug-derive" } primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index 9180414a3a..fdcf691762 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic-fuzzer" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-arithmetic = { version = "2.0.0-alpha.8", path = ".." } +sp-arithmetic = { version = "2.0.0-dev", path = ".." } honggfuzz = "0.5" primitive-types = "0.7.0" num-bigint = "0.2" diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index e39e795d1b..286a2e3141 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authority-discovery" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Authority discovery primitives" edition = "2018" @@ -12,11 +12,11 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index 98c3a549de..0888878ab8 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authorship" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Authorship primitives" edition = "2018" @@ -12,9 +12,9 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../inherents" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index 1875bc08a8..b9793621c9 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-block-builder" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "The block builder runtime api." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } [features] default = [ "std" ] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index 3c6cd68170..9eb619ccb9 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-blockchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,7 +19,7 @@ lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-alpha.8", path = "../consensus/common" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } -sp-block-builder = { version = "2.0.0-alpha.8", path = "../block-builder" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../state-machine" } +sp-consensus = { version = "0.8.0-dev", path = "../consensus/common" } +sp-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-block-builder = { version = "2.0.0-dev", path = "../block-builder" } +sp-state-machine = { version = "0.8.0-dev", path = "../state-machine" } diff --git a/primitives/chain-spec/Cargo.toml b/primitives/chain-spec/Cargo.toml index 2bb950042b..1d482c5970 100644 --- a/primitives/chain-spec/Cargo.toml +++ b/primitives/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-chain-spec" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index f1f61f0957..b907b5689b 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-aura" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,13 +12,13 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../runtime" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../inherents" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../inherents" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index f5b2bf0510..6a5da2788f 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-babe" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Primitives for BABE consensus" edition = "2018" @@ -12,16 +12,16 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } merlin = { version = "2.0", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../api" } -sp-consensus = { version = "0.8.0-alpha.8", optional = true, path = "../common" } -sp-consensus-vrf = { version = "0.8.0-alpha.8", path = "../vrf", default-features = false } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../inherents" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../runtime" } -sp-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } +sp-consensus = { version = "0.8.0-dev", optional = true, path = "../common" } +sp-consensus-vrf = { version = "0.8.0-dev", path = "../vrf", default-features = false } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../inherents" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index ac17421f60..ec05e9fba1 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,22 +17,22 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" libp2p = { version = "0.18.1", default-features = false } log = "0.4.8" -sp-core = { path= "../../core", version = "2.0.0-alpha.8"} -sp-inherents = { version = "2.0.0-alpha.8", path = "../../inherents" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } +sp-core = { path= "../../core", version = "2.0.0-dev"} +sp-inherents = { version = "2.0.0-dev", path = "../../inherents" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "3.0.1" -sp-std = { version = "2.0.0-alpha.8", path = "../../std" } -sp-version = { version = "2.0.0-alpha.8", path = "../../version" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } -sp-utils = { version = "2.0.0-alpha.8", path = "../../utils" } +sp-std = { version = "2.0.0-dev", path = "../../std" } +sp-version = { version = "2.0.0-dev", path = "../../version" } +sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-utils = { version = "2.0.0-dev", path = "../../utils" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-alpha.8"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} [dev-dependencies] -sp-test-primitives = { version = "2.0.0-alpha.8", path = "../../test-primitives" } +sp-test-primitives = { version = "2.0.0-dev", path = "../../test-primitives" } [features] default = [] diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index 6e3115258b..aedc50ab51 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-pow" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../api" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../runtime" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../core" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index 76de25ffd6..fce027e7a0 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-vrf" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Primitives for VRF based consensus" edition = "2018" @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { version = "1.0.0", package = "parity-scale-codec", default-features = false } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } -sp-std = { version = "2.0.0-alpha.8", path = "../../std", default-features = false } -sp-core = { version = "2.0.0-alpha.8", path = "../../core", default-features = false } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../runtime" } +sp-std = { version = "2.0.0-dev", path = "../../std", default-features = false } +sp-core = { version = "2.0.0-dev", path = "../../core", default-features = false } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 23e4d55ca9..d028141d3d 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-core" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -33,9 +33,9 @@ num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } -sp-debug-derive = { version = "2.0.0-alpha.8", path = "../debug-derive" } -sp-externalities = { version = "0.8.0-alpha.8", optional = true, path = "../externalities" } -sp-storage = { version = "2.0.0-alpha.8", default-features = false, path = "../storage" } +sp-debug-derive = { version = "2.0.0-dev", path = "../debug-derive" } +sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } +sp-storage = { version = "2.0.0-dev", default-features = false, path = "../storage" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } futures = { version = "0.3.1", optional = true } @@ -50,10 +50,10 @@ twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } merlin = { version = "2.0", default-features = false, optional = true } -sp-runtime-interface = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime-interface" } +sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../runtime-interface" } [dev-dependencies] -sp-serializer = { version = "2.0.0-alpha.8", path = "../serializer" } +sp-serializer = { version = "2.0.0-dev", path = "../serializer" } pretty_assertions = "0.6.1" hex-literal = "0.2.1" rand = "0.7.2" diff --git a/primitives/database/Cargo.toml b/primitives/database/Cargo.toml index b8ce17c8c6..ef65a8b940 100644 --- a/primitives/database/Cargo.toml +++ b/primitives/database/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-database" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index d099f4917c..d620d2bc71 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-debug-derive" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 443885f94f..31dde81d7e 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-externalities" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-externalities" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-storage = { version = "2.0.0-alpha.8", path = "../storage" } -sp-std = { version = "2.0.0-alpha.8", path = "../std" } +sp-storage = { version = "2.0.0-dev", path = "../storage" } +sp-std = { version = "2.0.0-dev", path = "../std" } environmental = { version = "1.1.1" } codec = { package = "parity-scale-codec", version = "1.3.0" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index 54bbd3deb1..36af9319e7 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-grandpa" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index cf8045d0d3..9e40cb8551 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-tracker" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } [features] default = ["std"] diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 49180b6192..287f4d7b9d 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-inherents" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = { version = "0.10.0", optional = true } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index df7f6ea1da..2bba4e94cb 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-io" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } hash-db = { version = "0.15.2", default-features = false } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } libsecp256k1 = { version = "0.3.4", optional = true } -sp-state-machine = { version = "0.8.0-alpha.8", optional = true, path = "../../primitives/state-machine" } -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../../primitives/wasm-interface", default-features = false } -sp-runtime-interface = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime-interface" } -sp-trie = { version = "2.0.0-alpha.8", optional = true, path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-alpha.8", optional = true, path = "../externalities" } +sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../../primitives/wasm-interface", default-features = false } +sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../runtime-interface" } +sp-trie = { version = "2.0.0-dev", optional = true, path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/keyring/Cargo.toml b/primitives/keyring/Cargo.toml index 18e814f311..b9fe7cb7a0 100644 --- a/primitives/keyring/Cargo.toml +++ b/primitives/keyring/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-keyring" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-alpha.8", path = "../core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } +sp-core = { version = "2.0.0-dev", path = "../core" } +sp-runtime = { version = "2.0.0-dev", path = "../runtime" } lazy_static = "1.4.0" strum = { version = "0.16.0", features = ["derive"] } diff --git a/primitives/offchain/Cargo.toml b/primitives/offchain/Cargo.toml index ad2f1ee453..1ed6c3342a 100644 --- a/primitives/offchain/Cargo.toml +++ b/primitives/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers primitives" name = "sp-offchain" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } [dev-dependencies] -sp-state-machine = { version = "0.8.0-alpha.8", default-features = false, path = "../state-machine" } +sp-state-machine = { version = "0.8.0-dev", default-features = false, path = "../state-machine" } [features] default = ["std"] diff --git a/primitives/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml index 161214d801..bc3ef2bdc6 100644 --- a/primitives/panic-handler/Cargo.toml +++ b/primitives/panic-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-panic-handler" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/Cargo.toml b/primitives/phragmen/Cargo.toml index 071b81a06b..3317b2fac0 100644 --- a/primitives/phragmen/Cargo.toml +++ b/primitives/phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-phragmen-compact = { version = "2.0.0-alpha.8", path = "./compact" } -sp-arithmetic = { version = "2.0.0-alpha.8", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-phragmen-compact = { version = "2.0.0-dev", path = "./compact" } +sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../arithmetic" } [dev-dependencies] -substrate-test-utils = { version = "2.0.0-alpha.8", path = "../../test-utils" } +substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } rand = "0.7.3" -sp-phragmen = { version = "2.0.0-alpha.8", path = "." } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-dev", path = "." } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } [features] default = ["std"] diff --git a/primitives/phragmen/compact/Cargo.toml b/primitives/phragmen/compact/Cargo.toml index d73af49679..1e5afd6c49 100644 --- a/primitives/phragmen/compact/Cargo.toml +++ b/primitives/phragmen/compact/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen-compact" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/fuzzer/Cargo.toml b/primitives/phragmen/fuzzer/Cargo.toml index 5a6b90925f..d81d23c476 100644 --- a/primitives/phragmen/fuzzer/Cargo.toml +++ b/primitives/phragmen/fuzzer/Cargo.toml @@ -14,9 +14,9 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-phragmen = { version = "2.0.0-alpha.8", path = ".." } -sp-std = { version = "2.0.0-alpha.8", path = "../../std" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } +sp-phragmen = { version = "2.0.0-dev", path = ".." } +sp-std = { version = "2.0.0-dev", path = "../../std" } +sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } honggfuzz = "0.5" rand = { version = "0.7.3", features = ["std", "small_rng"] } diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index ee64741b60..4c9dfb5d7b 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-rpc" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", path = "../core" } +sp-core = { version = "2.0.0-dev", path = "../core" } [dev-dependencies] serde_json = "1.0.41" diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index 75bed6ad7b..df1b32d73f 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,20 +13,20 @@ documentation = "https://docs.rs/sp-runtime-interface/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-wasm-interface = { version = "2.0.0-alpha.8", path = "../wasm-interface", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-tracing = { version = "2.0.0-alpha.8", default-features = false, path = "../tracing" } -sp-runtime-interface-proc-macro = { version = "2.0.0-alpha.8", path = "proc-macro" } -sp-externalities = { version = "0.8.0-alpha.8", optional = true, path = "../externalities" } +sp-wasm-interface = { version = "2.0.0-dev", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../tracing" } +sp-runtime-interface-proc-macro = { version = "2.0.0-dev", path = "proc-macro" } +sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] -sp-runtime-interface-test-wasm = { version = "2.0.0-alpha.8", path = "test-wasm" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } -sp-core = { version = "2.0.0-alpha.8", path = "../core" } -sp-io = { version = "2.0.0-alpha.8", path = "../io" } +sp-runtime-interface-test-wasm = { version = "2.0.0-dev", path = "test-wasm" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-dev", path = "../core" } +sp-io = { version = "2.0.0-dev", path = "../io" } rustversion = "1.0.0" trybuild = "1.0.23" diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index d8f39ba645..429168fe7b 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 461010f11c..5bf47afd78 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-alpha.8", default-features = false, path = "../" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index 4d9dd1b0b4..5029d4fa3e 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-alpha.8", default-features = false, path = "../" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test/Cargo.toml b/primitives/runtime-interface/test/Cargo.toml index 6a964dce47..3aab396e2e 100644 --- a/primitives/runtime-interface/test/Cargo.toml +++ b/primitives/runtime-interface/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-alpha.8", path = "../" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../../client/executor" } -sp-runtime-interface-test-wasm = { version = "2.0.0-alpha.8", path = "../test-wasm" } -sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-alpha.8", path = "../test-wasm-deprecated" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } -sp-core = { version = "2.0.0-alpha.8", path = "../../core" } -sp-io = { version = "2.0.0-alpha.8", path = "../../io" } +sp-runtime-interface = { version = "2.0.0-dev", path = "../" } +sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } +sp-runtime-interface-test-wasm = { version = "2.0.0-dev", path = "../test-wasm" } +sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-dev", path = "../test-wasm-deprecated" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-core = { version = "2.0.0-dev", path = "../../core" } +sp-io = { version = "2.0.0-dev", path = "../../io" } tracing = "0.1.13" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index dad1691fcf..cc87a21f97 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,23 +16,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../application-crypto" } -sp-arithmetic = { version = "2.0.0-alpha.8", default-features = false, path = "../arithmetic" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../io" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } +sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../io" } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } impl-trait-for-tuples = "0.1.3" -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } [dev-dependencies] serde_json = "1.0.41" rand = "0.7.2" -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } [features] bench = [] diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index 3922897c01..73755d17c3 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-sandbox" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,10 +13,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../io" } -sp-wasm-interface = { version = "2.0.0-alpha.8", default-features = false, path = "../wasm-interface" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-dev", default-features = false, path = "../io" } +sp-wasm-interface = { version = "2.0.0-dev", default-features = false, path = "../wasm-interface" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [dev-dependencies] diff --git a/primitives/serializer/Cargo.toml b/primitives/serializer/Cargo.toml index 4ad0e350c7..ded058caa1 100644 --- a/primitives/serializer/Cargo.toml +++ b/primitives/serializer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-serializer" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index 50d930f00b..f910d85440 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-session" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-staking = { version = "2.0.0-alpha.8", default-features = false, path = "../staking" } -sp-runtime = { version = "2.0.0-alpha.8", optional = true, path = "../runtime" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-staking = { version = "2.0.0-dev", default-features = false, path = "../staking" } +sp-runtime = { version = "2.0.0-dev", optional = true, path = "../runtime" } [features] default = [ "std" ] diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index acf752bcde..f22e88855d 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-staking" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index b5f20b58de..470ad33fc3 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-state-machine" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Substrate State Machine" edition = "2018" @@ -18,17 +18,17 @@ parking_lot = "0.10.0" hash-db = "0.15.2" trie-db = "0.20.1" trie-root = "0.16.0" -sp-trie = { version = "2.0.0-alpha.8", path = "../trie" } -sp-core = { version = "2.0.0-alpha.8", path = "../core" } -sp-panic-handler = { version = "2.0.0-alpha.8", path = "../panic-handler" } +sp-trie = { version = "2.0.0-dev", path = "../trie" } +sp-core = { version = "2.0.0-dev", path = "../core" } +sp-panic-handler = { version = "2.0.0-dev", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.3.0" } num-traits = "0.2.8" rand = "0.7.2" -sp-externalities = { version = "0.8.0-alpha.8", path = "../externalities" } +sp-externalities = { version = "0.8.0-dev", path = "../externalities" } [dev-dependencies] hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../runtime" } [features] default = [] diff --git a/primitives/std/Cargo.toml b/primitives/std/Cargo.toml index 21588803a5..8f9d626e25 100644 --- a/primitives/std/Cargo.toml +++ b/primitives/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-std" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/storage/Cargo.toml b/primitives/storage/Cargo.toml index 0023278cc8..a2ac2b1308 100644 --- a/primitives/storage/Cargo.toml +++ b/primitives/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-storage" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" description = "Storage related primitives" @@ -13,11 +13,11 @@ documentation = "https://docs.rs/sp-storage/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } ref-cast = "1.0.0" -sp-debug-derive = { version = "2.0.0-alpha.8", path = "../debug-derive" } +sp-debug-derive = { version = "2.0.0-dev", path = "../debug-derive" } [features] default = [ "std" ] diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index 79b4dea000..b6d4972dd9 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-test-primitives" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } [features] diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 41ad1fa0b1..4279538c24 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-timestamp" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Substrate core types and inherents for timestamps." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index 64e8225f02..2bdf76bc06 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-tracing" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index e384325299..5acb86ade4 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,9 +19,9 @@ derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } -sp-utils = { version = "2.0.0-alpha.8", default-features = false, path = "../utils" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-utils = { version = "2.0.0-dev", default-features = false, path = "../utils" } [features] default = [ "std" ] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index ca459f3057..b3cf58ec59 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-trie" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] description = "Patricia trie stuff using a parity-scale-codec node format" repository = "https://github.com/paritytech/substrate/" @@ -18,19 +18,19 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.20.1", default-features = false } trie-root = { version = "0.16.0", default-features = false } memory-db = { version = "0.20.0", default-features = false } -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } [dev-dependencies] trie-bench = "0.21.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-alpha.8", path = "../runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../runtime" } [features] default = ["std"] diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index d7efdf4942..7ed50c9f32 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index cf23c8f595..dc9f562ccd 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-version" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index b3f468a83a..d9d17b9edb 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-wasm-interface" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" -sp-std = { version = "2.0.0-alpha.8", path = "../std", default-features = false } +sp-std = { version = "2.0.0-dev", path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 48261b4eeb..e19592a82b 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index 5b71bc0051..082d9941d8 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,17 +12,17 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-alpha.8", path = "../../client/api" } -sc-client-db = { version = "0.8.0-alpha.8", features = ["test-helpers"], path = "../../client/db" } -sp-consensus = { version = "0.8.0-alpha.8", path = "../../primitives/consensus/common" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../client/executor" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../client/consensus/common" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, features = ["test-helpers"], path = "../../client/service" } +sc-client-api = { version = "2.0.0-dev", path = "../../client/api" } +sc-client-db = { version = "0.8.0-dev", features = ["test-helpers"], path = "../../client/db" } +sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sc-executor = { version = "0.8.0-dev", path = "../../client/executor" } +sc-consensus = { version = "0.8.0-dev", path = "../../client/consensus/common" } +sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../client/service" } futures = "0.3.4" hash-db = "0.15.2" -sp-keyring = { version = "2.0.0-alpha.8", path = "../../primitives/keyring" } +sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-core = { version = "2.0.0-alpha.8", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../primitives/runtime" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../primitives/blockchain" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 2a7cb9a234..6cd82ce029 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,35 +13,35 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-alpha.8", default-features = false, path = "../../primitives/consensus/aura" } -sp-consensus-babe = { version = "0.8.0-alpha.8", default-features = false, path = "../../primitives/consensus/babe" } -sp-block-builder = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/block-builder" } +sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/aura" } +sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/babe" } +sp-block-builder = { version = "2.0.0-dev", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-executive = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/executive" } -sp-inherents = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-alpha.8", optional = true, path = "../../primitives/keyring" } +frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../frame/executive" } +sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.20.0", default-features = false } -sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-alpha.8"} -sp-core = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/std" } -sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-alpha.8"} -sp-io = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/support" } -sp-version = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/version" } -sp-session = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/session" } -sp-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/runtime" } -pallet-babe = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/babe" } -frame-system = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/system" } -frame-system-rpc-runtime-api = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/system/rpc/runtime-api" } -pallet-timestamp = { version = "2.0.0-alpha.8", default-features = false, path = "../../frame/timestamp" } -sp-finality-grandpa = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/finality-grandpa" } -sp-trie = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/trie" } -sp-transaction-pool = { version = "2.0.0-alpha.8", default-features = false, path = "../../primitives/transaction-pool" } +sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-dev"} +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-dev", default-features = false, path = "../../frame/support" } +sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } +sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } +sp-api = { version = "2.0.0-dev", default-features = false, path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../frame/babe" } +frame-system = { version = "2.0.0-dev", default-features = false, path = "../../frame/system" } +frame-system-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../frame/system/rpc/runtime-api" } +pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../frame/timestamp" } +sp-finality-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-grandpa" } +sp-trie = { version = "2.0.0-dev", default-features = false, path = "../../primitives/trie" } +sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../primitives/transaction-pool" } trie-db = { version = "0.20.1", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.8.0-alpha.8", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } +sc-service = { version = "0.8.0-dev", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } # 3rd party cfg-if = "0.1.10" @@ -49,10 +49,10 @@ log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../client/block-builder" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../client/executor" } -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "./client" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../primitives/state-machine" } +sc-block-builder = { version = "0.8.0-dev", path = "../../client/block-builder" } +sc-executor = { version = "0.8.0-dev", path = "../../client/executor" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "./client" } +sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../utils/wasm-builder-runner" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 87e0884649..32091a8e00 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-client" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,16 +12,16 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-consensus = { version = "0.8.0-alpha.8", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-alpha.8", path = "../../../client/block-builder" } -substrate-test-client = { version = "2.0.0-alpha.8", path = "../../client" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -substrate-test-runtime = { version = "2.0.0-alpha.8", path = "../../runtime" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } +substrate-test-client = { version = "2.0.0-dev", path = "../../client" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +substrate-test-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../client/api" } -sc-consensus = { version = "0.8.0-alpha.8", path = "../../../client/consensus/common" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/service" } +sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } +sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } futures = "0.3.4" diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index 4f1c816d09..3184527308 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../client" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../client" } parking_lot = "0.10.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../primitives/transaction-pool" } -sc-transaction-graph = { version = "2.0.0-alpha.8", path = "../../../client/transaction-pool/graph" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +sc-transaction-graph = { version = "2.0.0-dev", path = "../../../client/transaction-pool/graph" } futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.99.2" diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index 35e798a392..ec37c8b139 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-browser-utils" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" authors = ["Parity Technologies "] description = "Utilities for creating a browser light-client." edition = "2018" @@ -22,11 +22,11 @@ js-sys = "0.3.34" wasm-bindgen = "0.2.57" wasm-bindgen-futures = "0.4.7" kvdb-web = "0.6" -sp-database = { version = "2.0.0-alpha.8", path = "../../primitives/database" } -sc-informant = { version = "0.8.0-alpha.8", path = "../../client/informant" } -sc-service = { version = "0.8.0-alpha.8", path = "../../client/service", default-features = false } -sc-network = { path = "../../client/network", version = "0.8.0-alpha.8"} -sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-alpha.8"} +sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } +sc-informant = { version = "0.8.0-dev", path = "../../client/informant" } +sc-service = { version = "0.8.0-dev", path = "../../client/service", default-features = false } +sc-network = { path = "../../client/network", version = "0.8.0-dev"} +sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-dev"} # Imported just for the `no_cc` feature clear_on_drop = { version = "0.2.3", features = ["no_cc"] } diff --git a/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml index 6c3f17be2b..72374a531c 100644 --- a/utils/build-script-utils/Cargo.toml +++ b/utils/build-script-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-build-script-utils" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index d663774bd7..7062a61ae5 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-tree" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index 71bd64a0a6..fc681bd044 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking-cli" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,15 +12,15 @@ description = "CLI for benchmarking FRAME" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-benchmarking = { version = "2.0.0-alpha.8", path = "../../../frame/benchmarking" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../primitives/core" } -sc-service = { version = "0.8.0-alpha.8", default-features = false, path = "../../../client/service" } -sc-cli = { version = "0.8.0-alpha.8", path = "../../../client/cli" } -sc-client-db = { version = "0.8.0-alpha.8", path = "../../../client/db" } -sc-executor = { version = "0.8.0-alpha.8", path = "../../../client/executor" } -sp-externalities = { version = "0.8.0-alpha.8", path = "../../../primitives/externalities" } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-alpha.8", path = "../../../primitives/state-machine" } +frame-benchmarking = { version = "2.0.0-dev", path = "../../../frame/benchmarking" } +sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } +sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } +sc-client-db = { version = "0.8.0-dev", path = "../../../client/db" } +sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } +sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } +sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } structopt = "0.3.8" codec = { version = "1.3.0", package = "parity-scale-codec" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 1dbb8b09a8..b086f6aa5f 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-support" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies ", "Andrew Dirksen "] edition = "2018" license = "Apache-2.0" @@ -17,10 +17,10 @@ jsonrpc-client-transports = { version = "14.0.5", default-features = false, feat jsonrpc-core = "14" codec = { package = "parity-scale-codec", version = "1" } serde = "1" -frame-support = { version = "2.0.0-alpha.8", path = "../../../../frame/support" } -sp-storage = { version = "2.0.0-alpha.8", path = "../../../../primitives/storage" } -sc-rpc-api = { version = "0.8.0-alpha.8", path = "../../../../client/rpc-api" } +frame-support = { version = "2.0.0-dev", path = "../../../../frame/support" } +sp-storage = { version = "2.0.0-dev", path = "../../../../primitives/storage" } +sc-rpc-api = { version = "0.8.0-dev", path = "../../../../client/rpc-api" } [dev-dependencies] -frame-system = { version = "2.0.0-alpha.8", path = "../../../../frame/system" } +frame-system = { version = "2.0.0-dev", path = "../../../../frame/system" } tokio = "0.2" diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 991878cef0..33fd3b399a 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-system" -version = "2.0.0-alpha.8" +version = "2.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "FRAME's system exposed over Substrate RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-alpha.8", path = "../../../../client/api" } +sc-client-api = { version = "2.0.0-dev", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.0.3" @@ -20,14 +20,14 @@ jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-alpha.8", path = "../../../../primitives/runtime" } -sp-api = { version = "2.0.0-alpha.8", path = "../../../../primitives/api" } -frame-system-rpc-runtime-api = { version = "2.0.0-alpha.8", path = "../../../../frame/system/rpc/runtime-api" } -sp-core = { version = "2.0.0-alpha.8", path = "../../../../primitives/core" } -sp-blockchain = { version = "2.0.0-alpha.8", path = "../../../../primitives/blockchain" } -sp-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../../primitives/transaction-pool" } +sp-runtime = { version = "2.0.0-dev", path = "../../../../primitives/runtime" } +sp-api = { version = "2.0.0-dev", path = "../../../../primitives/api" } +frame-system-rpc-runtime-api = { version = "2.0.0-dev", path = "../../../../frame/system/rpc/runtime-api" } +sp-core = { version = "2.0.0-dev", path = "../../../../primitives/core" } +sp-blockchain = { version = "2.0.0-dev", path = "../../../../primitives/blockchain" } +sp-transaction-pool = { version = "2.0.0-dev", path = "../../../../primitives/transaction-pool" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-alpha.8", path = "../../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } env_logger = "0.7.0" -sc-transaction-pool = { version = "2.0.0-alpha.8", path = "../../../../client/transaction-pool" } +sc-transaction-pool = { version = "2.0.0-dev", path = "../../../../client/transaction-pool" } diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index c425a7c879..9ecf5325cd 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Endpoint to expose Prometheus metrics" name = "substrate-prometheus-endpoint" -version = "0.8.0-alpha.8" +version = "0.8.0-dev" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" -- GitLab From 5a7600912b7fd50091990899e8ad93ad618f40c4 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Sat, 16 May 2020 21:59:11 +0200 Subject: [PATCH 004/280] Remove file accounts.scale (#6053) --- frame/system/src/accounts.scale | Bin 181794 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 frame/system/src/accounts.scale diff --git a/frame/system/src/accounts.scale b/frame/system/src/accounts.scale deleted file mode 100644 index bfd7e6277f20c53ceb1d664235bb6af18ec538ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 181794 zcmWjJV^}6i6ae7tzP@bRc6YOF+qP}nZgZP9*XG)6+qSLS{(hf1&zU)A=EuwoXn;Tk zy);`=f#^-(Y`MK5VG(~V^^K2MElEX={f%0tHv~bk_B(vreD6YZ@>z-^sQ$%^ZE_l6 znp)rzG_-E8hy#N9`ZH8~e|W2@S$#OytSw%OU)dyMKU~HZz?c zYSE)9!~>etW6TwK_6LOR&p41RnqNTLx=Itu6Q1cWdx$N$8iC11<>L%Iy03 zQi|e={xo)h+Pv>;CdHCbo1F2rablf{)+GpEE^NM!6hK+EIOf;hb|a~shaB@~YUeOH zWN6X(G!}^5;*j!z5sqsivNOLteW@U$4BX5KrVNvFzhCbv{27Ri( zTC}E`)K44_E268!wGUMFJh5*lRix8BK|p0xMwQ&1577y*4FvLq9uta+zS&XO{`0Dr z$=mBUvhpu_G5P(U$&p43WS|sCl4MSm-eMqX4lqbjb`ldQ1V+pwJg=D*Pj=n&y28}g zf3Kmtz)3;0g!$so@d9g7LPhS!pp9s;%7q~UHth#@ilYD8=TL%ZRi+L*1LIWT?mDY- ze^>)T|M;FU+#MnI`@eA?6!3%S*Qm+EY-%?p#C|DqvC^jN<2)O@}+;!t-A;kqj_A_L(`>= zHUGDM7zbGX^soW(%86U!3nJlCJp$(j!SX-#Racrq2fU}XjvkKF^m2m)S%m-b%Pc~# z1Q-<|8i#QZH9I=TrrG%?{)vhg;vQAi}s&brtp zKu|%Vp9`YXJJgk1aP}C~rjb0vK)PPtYW7XkR30>uUVeZi^V?NB-*a2_pJHreMr>GT zM<>JX4u4f6|2TSVyC()oe@E3rmcVn1cD`Z48?2j@$Qs=JoRZeBbC(Kc>eUCy&n*VT z%23ZFc`1>_R`gIZKjjZia2?WzzKepQNCbkkdmfiBky&>m(XZfryew}n!6p_Nj2?dCc8bZnZ0Ke2d}o zh3x=Jy`>S6S&DC#Y&(SQ+O{tEyUF3g_#+hUzW^7_kYZd=Ig<7DIx@E*Dy_m_JyLIp z1{A{QmV|^6$&dqOl~%Q&dWRLKlz4mK(VbG;KQ>>8ss9#ogwM;VnD!y(t(EVC8o%P7 zr>9G+G}4^225ly?5DOdsE`^~W<-L{k+FTTvU?uh zNsEPmY(Wo$h9R5Y1)@qu%jwr&kE8Sy+2iMb;t)_Gl8RPvD#rJLMiWd@3AgjEDoVK; zOsXs8uz+qs$y90*3K)y5oJYif<|&&^DY}&uyi0nI0*St^g6!Te&$V;FY2Zkc|(iL@UwoSlzwEQ}TsVT{UGvd*B>)@m%9JtR`Vn_p1!%k1N_cQV`yq(~*XAS8JOQaoeCx~H2cA z`)crDV8TC+1Ft&BnvU>@!VCzJTqQ6Qp|B839;->1I~tV1z-pTO*!tSf$-}8=cFFO~ z{5U`^EE86R$vyj6`zleupek@s0C9#*TUN?Yb#Ms{t73+ZoYK1Nt_>6u7o-Sau+jRC z5uw+M*EhkMWi!?yBP1E>$#S1&tM@C{XI{c!7@}Oo*5fR7CcnwZU>g8A>R+z+3F3;h zT02IZ&6HbUIIX)aI0G7S*e2H}cvE(`af#L-&u1xtF`(YN*TGI;+%2b7{ig!yVb`oy zk#5jxq*YhU`2+4gZs7kdgtiKR@uNfT9mr9WFM6Uc5zWxo7154E5JxScF6nEl@O3DG z2|V@j9tQT+W?U|zU9vr)x^zp&)1k&@&bTf*D9mtyDH-g_K=PB;Q}<#6_*c;DH%T0d zf4ZLgQ?=``GRgXZsZ(>W_-lLnB{IL8I36%KniszsJc9q$bxf?k|5Yghrq72u#!W~r z;xyHjcC#bbjiz-W^1WSrG2qJAFt4z|ToT!<4X~ulau;o?v8!H&0OH1Q$_=J?46FPddj)NZe$huoql-^~B}zXY_$vE&Y%Y=W7ZUrRE=_%U8EeZo zbw>9z{D9yEONqvsPyjuQVwFr5?u=V;c@NHL|LEVU?eGx~6?yap%dyg?*$}QLvm<1L zIjIQ#GE><96AMd3nmAY(%eTb=*2bi6*!d$2uE(Uw3~x@01+4l!@5eT~0BO96C~1Nm zSSQ9wYbrHzYCsR{`ES~OG8%g6wt;cGrK_t@o}n0Iu>P5*cI{Iuy7ayc_Z5;0um)D| z7Ml4%J}Xv8OPV@lumQ&9PQrSzC>IWJ%bekb^q9`Dl=IQ`sZ4B?cb0w&u#GTqALtQa z#-XL)0Aj-p^uSsMgt3@;<`881<%+5l*v`Q6v6EbQO9jSZBJ>IMj84!v(pt(^5~y+w znfm%MHP~nSkM!ClEhPf~ z@n80aS#~t};MD&~l_peYVUe;i(^*7@vK$2Wt4D1*$8cZwvYMLXfGal6g(t!IDT4i~ zSU?;d2`nLT5R%zuc|@Zdu9)RR1=r@#fp*W;KK;mFeT4=%)H}(~?UutM8mdG2z(NXO zgWH`;#QbsoyqY3-Z)WczJZ3&ckt3DXU^ea_7TaYO26s%X+B$=R>eT2ZLt1}&S5yu` ze6v^SX?kR_I#sG30B>irQwB7zgz8r|U*gU=7-N1!EU zw`^%6f%!n^U_!p_j7|f9lmV1OYWVvV;P)3l+{p;XNncJ?f+$T&Av?6#{o^ zE7?3MxNt)jdjsm_uV5&8auD!+)&n4oa4sbSgdk5BM8J-=`AJCH6P_CVuGc1uEV$^L z^yDn@$)S|$0l^%0)`>T6@hXoqn#)70tNZZfKHZb6dr6Xx)A8zJ0Kxr|UCLYo7SU0w zf?Q9J)y3Lcso;;?3)jM(=XPNx2f;V^3N#LLLZNY+>lzBJ3QeLQMQ2n4Q@UmHi396| zfKc`Hb#oCbhE^W*FYskirD3J~rAVXBK(Hx(;51|{1!1~z^#Tfq$Nk!LEgn8?9BL0{ z6lx5#9@ffm>6atMhp?l9%VQ-Mrg!%?-g(}Gq}ntyNiWD~#hAQC1I^#}fbb6|ey_Wk zdfn@-P5D8PL`__}35AP8beo9i#T08L3K7Xfk8nncqj*GTXRoToJ+o05g|QMU0}@3g z!JBhT4H0*|+W%5_()4iYw;x;{2@iHbn<1{PV=K$uGWhV~36TorD|q|F_Q_#MD7PXr zylWgk^7X(^m{oD^5{G=v36ZIl6rb%*=Wf>^>-RI6k&^J%Cf?T7{u0~zZt-`iD@2Y3 zYx!P|t1L%cNhyELAJ>?w4!_(Kjxzz-4nCB>W)Q_4$Mvf(6lXoCu7Q9KA%#*XHe5cD#UJ#1JLbrEt3f%IPNg zN->Kia{8*9xzJQ2IIb4NEhfbOi9nP|gxhq(<<=SljhTUe8-6_oD*-vlpQ#Q_Z4Ivd1DN%+;Fs-O_ zqi*(AiAQxNJ$>mM+tVHWJ|)DOfl8ZGXkib0WwqZ1*IRA=u?@K1TG0Kb%2ew4jS9qu zITr4z-kwiah=?G?S^r9d>DNa=JGP-U^zDi6?6*Is!G{fR$OO5j#Qk=&YpXbNifO

hS-T;7C>1!B6Q1mGz`#cVGz2nvo-opqNA>p5zoUF8{&9s_HBhN=gCYr zXxC0i|9S%LkENv!7T@QZ$X0z)^aKh(4@pk;=PL3i%{ZBp*PY&s5dbC1lGGZJCM1rp1~+iE z)!QGAvmnlW%UQSEHhQd4jJq+D>_{j<5|VSU__$6@AKk2U6D#jm7CJ<-)G4uBVY^ALXr$P1N6Cy!~zuCy)pv7qWt{%D7^6*9N&jR1VmS zn_z~488$;+s=e9fNYQu(1-Tmyni#?7+x`$6TvbC5=#S!Q);+rU3wX0l+*w{iTm+4aGQty?ZS>dXy~$mAMAP?x^S_Omd=* zIYRulv5Pxu55363@5dGjeX(PcNQ`mG)nJ9Cd*RlYlI_ z#@HnIdP3#*uItE~kS{7wPZ(v(3E9AR(jCc3)rKm{s|TfyDil)U&f#qwQt+y}OGi8)JI;yd9aAAhL53>U zz{c@}W#;LxTESx^5JNTU>w8Ax0(-H+5yftx9)zmU*?mXhf8QAQJD?fjB6`E4{Nbt@fIM)lsr~GO(cf!b^yg9mdVu2|}$#1a=$6j^lZ>21>H5XV})y zNAFUmmJB7$$K=fZwt#v@rJ#T@-%_0{;pBbZO72(CZ*M7%iN~$(=_9{RQHJ^$uM{1r z)%vSjh_7&QtNSn-Q7WQ7T9J!m>2+XZMhQ(_h(pu=cM^)zu8qG;AhV@oR}_5ctpWMf zADX$rfDxMc@{$DZOcUyq#yj=Fv8pXHLQRE~hi{*C&uYI8=>a;A?I$db78rXe(aau+ zXg|k;qSWZTBudbmasO$zQ37;}Q-SH2QSjM%LqSslA+3%D8mKIm0;k9_td3>?pZ&KN zQMFu!qI!H3H7mg*+)a(mDw5>l;;?6aO~oID{_{;53xcJf@ZINhKAqb(^et`P2hbG= zj;Y`U%#Lp_$bOi4Y3+Z1qbdwqGm`u4x{vY>NK3(DMUpRjt{ zw4oWv6Wn-Yrl0#3Iz}eYEzZd@Nv^xA%eVExsUtTqxXoKnfd|uE`*atIhxfzKEgn6M zN~l^qc$qPr%y)S37E+qirwk4O&(??7#D9K&d#?cs##sU%Xdo_U7V}^R%GFbG=bfzA zFM0Z}_V4%}{iuuWzi9!LWqKjYO(6A&MpRTf_=c3cmfX-%&8gt4}Fb$C(Z@ z*^%I1KCW)lUk(4=A87RBef!{V!kjIe(XmBPd_ri3K!}CLtqUr%f&5e?pA+zZejBx4 zdlg62nAo36x6c7fh6YP3cCG+MW&1F^`t2tNL;x)BY0u_S6k|fW7X=NZ910!I;vZ}g zAN9S^txK{yzV$9K&}#2ALIgRamFR50D1BVYI=9yKExlB~T@STdTv?!s!urB`ymYx{ zwW9Lg*)U@g=cT|KUhCTpH|v6xv{L0Kt_EsMgpH^75Se-2LpUox*ag9nzuk#o4Pqtc z<`W1QT)@f$y=8=EmC2sYbRY#4wIzgZ-OzThO-x>hZuz-T!cV#W8NK?hKT~1~zJ1E| z>W%;HI;ZajUe()D=zX*c6{%2~Z$&OU;XX3ycow)T|J>SfOEm>3jp{izUg1hfig zD06p~4xIjr^c6&?r||=!lpsn4`cLyp9&+~mn3*?{rC55apbz|#8TqJv0IID+P8B9G z^xwtm2^5Kb|8(1GLoJVGP%BjTqxap!fmsH50cx2Y=u6!43K;sOzj(wLzMir)!RwF` z6?`eVtMeHJ*`l*h3W#+tUNoOd@)VIpsRpo4j-l`EDU@$lI|vK3KlS^u5a2>OB*ELEqJ= z5~5>3Nj^-^L-V^H48m8{g9tm_>W9Kli=p|Q4AXg5|A>Hz@Pt3R?*Y*DFo=+qgrCYN z-j(3~Gvjy-zPM8fQ)FAEnMa>@5>7}y|C}2dEUPxn`A0imsk`%_veK^Y`lC8^*>7ko zt-yb75ppAZG9(fpbtW^>M+5v}hTRl7=XpeZ zMFTQXal3y`?u^*wgGLg-I3-4SZC=u1{7hy0&)e1E3cl=%ki>!^%?SMn z`ypcVij_$N0oaV%|Kc~%Cw9)ZW*&IszPab%f}51+8+p<>NReg~KNm54doyCJ99yaB zg~WBz`QCp`oE|2&F>QP#MI~IMJ=EXcg4LEYrK7R8;kg+YTt*F^m^@yOzM>+N2bQu& z_3dq)TOtCO20bSl_|HEKu|Vn+;t3`>b}?9wLM|!3{ZDc8v%d|vMVIf$LAQL?@QG`y z7ueEC$y@T-oc*`AvrDlaZX110wYxjJM6tw#<^p%|#;PLYXNhpt{`uN(E^~}j#~}KU zjXy09V;cETOq)A&O`rMq-v8F8V+)-z<=J7%4Ah_weOYmBrbjNiG+J@h?zzHx_}jY_ zaMCj;s110#p`tk8rw{Eh=J(%xR)J)~9a#VB-viWKmIx_%zWkiqao_Yy3*?3dnXeqX zPV#BDw)*FOLcql3X%tX9R?6jfHL8jk*ENuydUO_}OnlF8?{_Z%Zf>m|^)B@DT|eTF zc(WC!51rkqd&Lod$p7=pDX_kSVMx>m@@@@m-T;A*=>qdLKL71N&*ZFcA3%DmQ}DEf zzA1C{SiDZQ9!|o)l{L2DSi}XD;s5r*hF^N^D!(^%*THC_^WWpa+vsf82;~+rS0klz?1M!aj-ph?zTNdI{b?uTS+k znQG%Y-`cE+iRewvQ1hTI_o~Jj?Ti$p`}PqXQZmaN-&zTY>6`t_hKajI+f13?R-Pru zai$30K8g@*F7Ky3{E$H`pYH^EEB9v>iiVK_y#%c4g!|jaG#pPr;Lk=1WQ-fks9?Qt z#hN9tSQ9|Py7`Fz_1A<7!~g`wG~X$5eCv2AP)_@364v#svo$8yG6(vfe|d9o<;r4G z6Cc0+<&TkX{;R=^3FCI02F}a=ufHa>p88mq@AmH3d+mhs&uGjMl z!F#n$cIvfh5mE6?=9sh5B%l(e3xP3kIOtQqI6^g|=ip3V zP3f5b)o(i|`|8Z_RYb(#WI-%fW~gNiK1QKQ)u%8;mEZZ>chu5Pu~;*a&ZRo%gr-F4 z+f|iCaI_DsD9T+c9RGO=)8mkVjsBSaPuQ^)ZjXKdOMwCFN%mR&U?S*0zgE>JJ?b6P zP7zNvj9=MQ#pb6mDnKw5_-MT}|Mp$aRR8<-{e-@Os7+~9g_`XZUR@3TIhI83 zrC!MM#xQ(6rEfp1Sae`J$~j@u4Q7v68&9uLDUuv==xtyE8(|~)_G7DXK88$<+&>=k zqHwY39|Cy3>^{5{>k?pf;I7|(%4J?UBE8y+COfZ8(5#5IlDe&<2P&?eCHn^TZ+%a7 zQY|SRGc@ChSHZTuNECTE@=VSZDy}3$y@bI3`S$d@XId%7>2a*+MKJ-&?}tUwMau@m z`~XyQv~NGNAr>XyDUEV*dEyQ(%G+lbSfW&SCxkT>7xPB{=e3aslhRqXPuQGJ>gfQh zl=%aaxy0q)>~z?1EHG#&D`vNYAr_!+_&!fE`Qv{Ec>VMM%I?gq*N~=n{4nTYtRP@+ znR#<&it*@2!;qoN{4IL@ZFv7l-9c0p5Wryey}_wRp8dzeLe~d2^m*%xp*ZU=m+B)& zbMTV+Is$_wb%kmS_KOJ+Ru-k06CfvUp4u<8y`*R~&bUTzWB`M^`vBT-#9AMaUG_sC zYx9@-j~c4k;UVmZ;aSS51!x#@cdoeK4~ZJe(#jbO@z8aXZSOHCI-WlxgJ%FK`mhoC%GymUCc({iR;Blt@;lbIq`si?%ocs zTS=M`Im=)W+p6soGdMx^XZcXD|H@ckEDZul<)}!>07`bF&BDNyZK1kX_^rVo`73oX#jQTVcu4J}XLv7ENFkQ-E^5*Av zQ4YgQVtFhvIi!6_A3^F2mJOvWRuF;;a|B^w%AIHms;g!%=k<=pt$HX8V}ZQl5pQfTowS6Dlnrz&1}S7y9bhO!{4teL(xh$hMG9%hJtZh6u6+I*hY=8+Ksp^riA0(5cTX z1%JOa;gyEkp31<$jNV!oO}5ggAML3-=|&KOT)@%Mx(s0fGRoA_DazDgHV%oAq+w81 z`8aMgqe0b7y1iU5k>&Ho+HJ|n0qH0(J1O2I#yt(|!I&LF{880RC9;LbzDQ-CDRgEE zqsF!{7YJ`085%7=>ThN~B?J{N;dxE1jn^+RD8wlFr$Wo5?6ixhZY*7vmybV9|ULGK>nJY~?ZhLNHndHze#4 z_T+2^Ln%GlPq>DtqD)!>R}f-~lL4oA79-->c*;`~4u8fE5(U;^9fm39Fh9k^jR1$O z#f;WG&5w$x3loS0M~qh0;+x0t{0DVy@8>+*%$=#YH5^-3bBh7Sm=*&j99fY|spxz4 z0Uil4y76x1_3_{N4v{XTn|}3r=r{uxI8ObJxY;OZNUgLvVzIKGz;PP{H+Y+Ak84nA zKMf*pIG#N4-H!-BBtPHm2Y8c@FBLwmm}MI;kR}C^cF)uZjz4y(X<8%n#C4y=|Gbhf zdx;W)>?4Z5{|JOIt6qdk47>1lW@FccC-Jmq%)x=Mllq+7M2mQz4`KuQJ!?lF++XvesALw8j9Z zHxaUFXo5e`2oz3}Winh_szzDik_*x$Tcnt~OD%+=G+`FBMV!Jszz0rSW!PCiX*eS? z^{4jKf5<%y$E)VXY~_Us?=Jktl2mZ|uu}o)tmAw71U{)+=bSU+NvJBd)9Hp=2YhYL zo8fTQr6dJ2O~fiYOcbeB^!c zaj_qa5@bq99=CT!ZAWE&kyAd`W629%JC953b?Na>ns>BST_r_NMIoL~aiO1a9M{pNE=B-CWU zzT@0hKmiuV+q-;jrs zy{%pBo_kx{Xh!!HRLLHq1{{1=2m_JIDcy)W(kt&iI!*Gg!(<;EA;;X{%< zI+55+g_McjPIlW~8ADYuuO7cmtX3zu^)bg=Y*ubd0rC%o%$__}gb0zm(^4fS<1rFL zrtepe-9P|>#IW2 zzfQMRX!sQg_hn&fthEC~E$3qI!Je1ve>O$a6uu9y2`WG8nk%)2M|3!r#ht#-Y72>R zn*V~wM@Z058TVYxee$^&u5qG-$E!-YHHQt^_rSEOp|@dWDj&|IfA~vSLlbnwtpYy< z&j9L5hIMrCQeZbqZI2wGV^!J>GWWY-m_@+<4dhlA-b;hWL%VTy4Bd1FUh@&tfkW@E z|4OFm(2kawpfI})e%I*ibaOnDV)Bm&wF`5WhHm+!nxTWtlEc$zZ?=(RsYVh|`j@?O>m@ z2>R6%0g`&qN@ORDKo1?PvD^Xnmd}$MtE>4mE!ys5i3YbHVK#Zj! zH`Roy+@w#HyK%gU)$pIEbimlhs=;w_!8AGs0%fl}4R!kxp*_abVoa?+iC_ur?jOQ) zqu<(5M*SMF2<+=q_kU1oT3Ui^%I8c%Y|)2CBv6KCcbps4oiIu5oDqoSAB!zL^8=Dn634&VazqA z5Ru*E8ZE`aefLFV5Of&d^i-)+p)U6ei+ugj>9OF5WKB~TIB3-wvktS-5cGJ{e8r!W zen>x`kRQyNZshJKLruPY#ABZBuMPEKAy`3e8pl372Bm515A2Ag&|uT;B+ta>Vw4R3 zz@rD4BiKPE0b6oTAL+3glP!O0x*^SX2#!Y?kbz|-n-sfkAlQp*!5)ZK*@SdkVRs3@ zo^l9}_~mg;7adxW+Ie|?A-KwnG1ajc3m&Rh0xB%rdwvo}6y;z%y2BQlv5@KEA-F#r zp2}@Cmrh^~D}S6VRP#fZNF&d#-9AE%6b(R*BY46O&he79fCq6TcpoC-e{_T1a8Y~r z@(DGkJ>J}-A*65cQ+bYbaO>miq#-h-YA9T1yANO4EHHN+Jb2_WAQZ|o_UGkf{~cBC zNFpJ~k&+Q4ZgIS%iaNXsS{G0fMJSO@;-93>)rb~Vo!nXc&p}WYkxbQ#63q6FZ&cHj z2B9o7Z*rUQNt%qAoTS>6xon!)8p-FI~xY^&LgU;TC&9HCum4YbyC zz`)oNC=8)dB{HSowkr}unV5K39aY3EfzV~q-$ZkTbQ4T;y95MSFLm^v{w&}SG;HYb z(vQx;MCev5>xlHE0hAWG3m02P!6>>_ZQmJ27USbV(vzskA&jhKqU{XG#qT>XH)aJl z*e^0`-kK$pFCpX+S}Cv*BaC($@v2(wOi*b+`YzD|%c7-=;SwZPU&TKAJn1Xk;YBEQE92}q1-MZPicA-roG;x*Hezw?Wh z7(hNXPxdh$%UxIv4QJBr5oP@*`@SB&*$+7{CL%!!JDaARmH$~1Yh{h2{=R>x<8n|t zjyO9B@l+r|o^&uE_+n79r9C}@^%#ff1%M@S z@pmYc1OSf6iTr?$xVsx>0E{8azTURhVQ_NiGO4trhbVN441hHBs1DkY%?BOj{%6j! zs&opZEw&F1sDiA)Z2D-l<$R2A$ak2pwjBp|Yg~ZsdB6PS?5yk+TzfHZ(ClXMnh);XRXNi0;!SfR$5|BaI z5(*FJ&^rLyJ>SkItB*zcz`+a2@wld{9_Os0o>SZ1W4=Y3FfssLplbYoq4M5hCzg4# zKb{8p$U39DA+$Bpyf|x1VjTdiA8#1|k<5dBbvqXtHC`+Ep2vrbx5)FrVQR z0eK^YZZPN!o1FmM0f!}(|MRT9cL9h>c1CFJe2w&kkxnn*Qp+stz4^g8w&>HIQ_Wu3 zm;l6##yu=?oe1SAe(&f-e?ZcBfoaD90upB5r8XZ3T)QON=_Xex2Glx#ZG-EBc?1uT21r1=%M4_us+f&UL!w6#J!RjXaTaNVDvB2OELfZ zI2mB=tCpM#mTIr{>)Vif=@dTfiUAbjYr80Y)H~wHai`?+my4GOFHKK-5%Ch!&l>wd zgaQgVttR(ORM-gNjBGZOi9kvcSF?2*LYqEnYoWc#$N|+}{Lz7HBdQK|sh1$IkahVc zA3n}7ok$r4G3^D534qRRk7^s@09{yTYXBr2tEmld0MdFePd|uCr$L^dpNMlbc1vc1z4HB+*5ZvnRz;)m73Cf z^%{dXSey(YEnGOQF_u3X0IW*82c3$spr#NoJ+p=NBIa=*hR~Xn?k2+p@i^+A1GXpa zgaEN~P#pm~Y#Kn%?xn7IuB(kP^l1!v_Ye;hz@7+6EuR5(1%)m|`Iy)cVV0W%kdp}g zD*Eqelh7p+U@yaukLD?h;X&ETFGB5fOkYJB)67_A*mD)u!~IkWaG=&DikdZqSZ_b6 zt4IfUr7o;=)ZJ88zrWFZS#{w;LSbiu$r+(S8n-w4{pfWcL1slq`5t>MC8&_&xNV_^ zBtdvb@It22z`KuA>?37XklSpY^PEvdE-HPWEry_l4Xg%DP`<1%wM}U zLIY>m7Zm#E$tH>^J}aiNFiPKW(e^YsQfl@Mtk~`EU^WwxuLW0ud!2h~2*!^U)OEva z9I z|66yey0NPmlw#?5YI%aZvvQ8~`nC ziW#bv{avt;?`;Fq%xmtW_I`sOB9V5`KpnL@7uJEL3mS&av#WeXTZ`>U&mXCTp1F7V z3_Nn&Knw8k7JH?v%RLdyDT9he8F7v!I#nBnwkCM}*S3IPLEW#U*L!&6b2er(fVbdHFa)`Gh;~ITiWrz)VfBKd2FH&!P6!g?2q8qP_B&I@||@ z?5z1K8_#Mfz`XDRlzLZLcv1zzomY3=2A3p%*gmRjPl;!oW$8yu;4ix*;^Ki-?Y$qN zAMo~yY=mWk*7R+CU=>E?&gh`lz}h|G4=E`f;v1dc35?a2I|0fgiE$El-3(T-_LMJ6 zz%C~uq%$AO;)3fLwHB-rragJ`DEA;Y>j(0+cWu@!;MkR+{QL%T7v&bDeiRQ_%(?hy z@0>K<$D!=cib+~`;LMPJ@P&A#gp0QWB+eIvj>4aN8I_nAG6&2KYTLmj;C7P<5eF2! z+v6DPDTHhgRkGwg({DRaI64k$=R{?F;7-aDUE$FW&p|hT9BD&Hx2$1Dq3%k!d(>;$ zNnx&1;LePV>|03BIDJDdw8_+A_&(b9k40Bs;8*`RuEr4*aCgBUUZWSdw(JOpruvv= z|H@5YE2^DU>}vqcNr?;&JPn6ExqQIT#CgMIUcdpE?@2;QPvjLz%jV(t;$Ptb--RFl zdq3+3?}Kl?V=ROjP`z$pQ>}XZIUqPJzgA~~jAL>oMrv+vJYOk|zyCfW2uC-M?>@zxdVr{Dbsg%?a}@*CKkM2ngH!e;g? zXo76_|HyV5-!DkpkiW#R{141uABDb1QBNmcY(vc+S3RJXK2AxGq=TOKY1m{yF!u6*-?6RP~U&4AfOmq%ov|0IE;NwQ)(LISEs%i zoSBQ}jFsilC>?}OVxicWX^}EnA`IJ`(Nm-0T=J35yP*1H4UToKeDO-IVz= zKRJEOPa#=N5j=J7(H_jPkY2n@PAUB~c~N48aE8j~cgd}t927GYmQ7z31zIBLe}Nz3 z1v!(r!Js75*!B>O8TfEizBUJ%wD6W&3F*j(O*kmiaPX3RIinOxQ>_dSHAREj(#ubh zgqR19#(r)3T015W=K-qc^-$UvwWG)^-FPF^(B+siGrq=dZV)R~yb$=z7x`b^=up~z z+mKkf<3*khGJ6=xb9Y#7AlSSM72a}(4wHqiqM>vxrbsR6{0!b^a*g1pYu2;61Zt+B z|Ef;9a7JYJVMQ4XGHC>A`tz`2pFLHD%~oD69E{Fi?Ia9|T%Wa7Q=km>&<2;?F@2Vp zxxN@7tMpci?DHn(h-7&E{UVp*5keWd`Wtcl$;V8$;?Bl~Gu=zl=^YtY=yFHog=JO9(gC|v3gO_5_o4b z*X)ret$2cHaxE;bs)({W)%sB=0JBjVfmL#;&PaaL+bE0G1Kp+!{1et)0YG_3!EG1; z9xkLiP)s|O9~@SQc)u%1EeT>1%BR+V$e?_^NUxSn#8}ax6rMB|rFDzMk{idsqld0B zwCO%mnWBpLx0-vu(s4=8oKs2;<2mm9d|Lon`@1@@&D&p&D1j=rv1&&EY|1pe@>fF|8QMGi4=3l&O*FMxhwP34r<=J`MQ#aTcph~jjYsOe@1jyziZGyHS)8R2)SWRT zMw7o}@El3|(gF>}P7#FBlGiLO-vNTH9D#xs)b1iGL zEj$`#b_?%t^$fke_lwaUq7UO&-VcbzbU239=#Y1Je@QfA*$5bC%X8QJ&5TN^MfXaI z=?ix#WEaO8gA}Ck)Lk^W1x!Z3hRPyc`;F-r!== ze4g!JM3O2XbLCFhDFf|KF0zs%#dlXfP6{+qR!!Iy*EGl+C7*+@2fKsO{gc>*V}uE( z5tm)kB5X8r3R&rmK5{2pqLSu8SKTI1cDcB7@o_V_TBV{dBmy*YnL-@!01R+K_ruIB zbi)2unwbUbplXzb^&J+QL0GW$L^nlp_&+$kO8(A<{Ay=%pAZRqcu(Mv$DF~|8nUqoNd%hcGPg16H z{FPp1^2+#_O?x!4dks>i3y}?N6eINrK8HZv5W0HJxm&nH%CuR!Xfrf%p8%8$3cGxV zXv%Dq$2}cwAoWew*KVt#RkdpQ85)`+o~tc=z7vkl0YfN@VJ!xoeFsJ(mHJ#A{4M(? zi94Fp1?kFiGcD|^i)9!^Se|J>XmCe=&@ySZZ#f8A$bV?Q&;8nz$TWNzs_3Q0&i8zb zrH0+I;JH0ZO1)H7c5-MbP&UtO=$qWiLJqA7?~KACGV}Fo|J~Qy?p}`IeM+IFY8ykn z&`H+`_g;5UE!Oo&KfL95ai!%_X6GNpJn*1pEFdC3%%2jg^l^U`mk4$w#mEA>qO>@! z-?%(kROQjiJZ*~^ItmI$cWWs^isqluaOp}#?`(_{#GGq7>0Qyvf1_9&s_B`P*#z3r zVNg0o^E`H6su}$F)vBD>_nw0Gd-k}!VRBOUOyaHBPhjr+RrBus_1=+9|B=IXyIugT z#Zt%e)zm%wU9sv<9i5M2-bH-k)iYOm1+`LyERP>rTNPvcBg4TaGPuW|6QT`g(= z(r4UzD;qW?uK&c*I-FsyKTO>S&mYc#(v4h~V!oMh&k~&DTwa!&lI8knlX9?anFGR# zL)tFWe?De>!&aiLDiz(@pyF_Me!$wJ&9J5xu#D+R{c*$)$pshxA6r1AzbofT3X7?x zsdpplYwhN8dlb=BHf7`;@A2Z#X8V8xD7-izr33QdUmEVDxe{-UR20+b2Wf91Lq7!} zmrLKoG23f^w3Pe(Qt>x;(yy7D#T3B}uicwE8PCsYHnOdRf8r z97+Kg)A0~KEXDK_1Qg|6>&qIK4Y9Q!Q&s^84HAv@-||^M?jAE~6P;1OaunsV9WL$& zWv%;%gRGDRK-PZ>iR);A=Y86d)d@L>2^8%8Uz3M2Q_%3}l5#UD7wweN$qY8It*~fg z!oBE`Efnr4lT+4W{wfueXnxsxr=H5^bEg^U$f@ER^S#FQY83Ig1l_&jf8uVC{)Ng_ zthG}9T;6>=Ybl+Y+Wuv$aTN2EtyBm??AN@rb&?euNV>`4PJJL0;uTkZ{TC{PZ502N zhhxR7Y5^~bfKGK)Dc>)0;Rka;BVH_H7>%&wL={Ny+o3n6JN`qX?OX1`meRpFU^rci zSEEHwNSfM?u}=8vaTJJVLV$QexfO&pg=$X&An&J#Vuj3soP^PCXKcokmit*CDS4=Y zw-x7hiEw5&oEqP?mytxT)ZOI(acZ|Ab&`tgTVuEK4i*3pueAZl>DyYFX*5B~-fYPh zg4&w~#{^I(@=H{H)D{V4D>N~je1r{5|dPx)vWya%&m+A&w(Fi2KZA zhO+OLCZXeXx>zA|ct!RFRu&~pkDXtxI3A*x5!{4WOiWxcdFvTTHFgUlnI!YtqZTJ* ziLI>>z(kBFG`i+3@jE1Pqsy5q%Edr_cvP~qZU6JVfS(qV7c9_Zl*_tOg%qtC4s96SuT=bR(NNy zxE4opz)9Ql67)N>@PYp~@8UmC&mKw0ehe8-@z1$cJr-l{thbca1M8Hq1IM8Rl9gPz zqoLG0ZTKTaG1zenDHdkLhLS^l&-omSpjHt=z+}G2aX5)2O5q%OcP_s~vKD6f?r5zy zhrCXYGZ;F_%!&bvxuQPTrKk?zu1^PxJr-(?h5IV#-1z93E?kQLn* zAAxLr_8B_M07>>D(w-!;BNlSMI)--t-O5|xd=SG^dDtyM?CYH(2hMsUK8rEIZ5DHT z1(+jl8h9ZLx&eFT;!75KB5&(R4#h&QZAJ_MRu*;n3N`mVazBMFwN>aVuIlcnFF}63484Fz2fI+8JUFRY?jxvleju`76oyU&-pyUuJvFz7Ti)sKo*e_pYF-85^~8bM)T8|=?Fz+ z7M;~dA;w9cU}1{bBo?U1W&E|4kWyK!8!UP`(XNEWo5GkEHf zOyNnFGCzWnO-KP0(*FB4Fs3JP;_-9~c^0*02O3FrXM2oqd>BsN}j<_Gu2?L>D%>*S*$AANlEkr^q<^-EEd9 z=J%vQ$WCi5u8@`6`xn1cC|r`v#LhSb!$mdiTwAP!1{^+vI-LE!`g*{_`xp86s(0?Q zdGDp^aw2wKhx>~(pFV2*n;%8wy~dB{A{Y7is(@*XOXYoBa2mu6)|jFW1wi%x40K*v zm-PyaLl^=$99E%FXd<73%o7@bez!xZus;~!VIfaClz=1BgcuriV8UctU1uS05+Y-_ z52a*md1%VUW)+9}eQM#20vI4*ll+-h<&XTToL_H$n37JN21#gc6d4Jbxa%s=co-&c zhg`AoNDAsFwF4Tx@#3f_iozDwOeT3pQp)Z-dl)o5&mL^CVedv&(4saL0=l~a<=xeV ztYD~kk|g;kTcn zYNR5)z-?>5Aa63%k~Y~`t-N?9kwQ%ZuB zXc$M!ste|xn99{JPL(^rR>@@A%ViL&70^Dk+M@MwJ{U~2y-OF0Zv8qJ=mFmHuIvvp z9nVBnJy^&(Y!5@VW*ALy5|zGtvx_VYSfg9`?ZuL398=Lr(gxr++*Q%nPHonK42gyHY$o10_FBn%EQ;2b4x~L;wTM&vr z%Q8ov6x8x*jQO36Pnmg4RA)5(S@iZz>1)L+ zd?lKt+E|hgY8ZHJxm353A;qNAuHxzkO!@@~>vl8T{^903MesaKXBc}e1#n!qBYM~t zb&StwWF^0ujL)Mdu1p{V^4Fi!0vLZtb|T-WEALL*Q9qbN2Npt2%wRLI=q`L5v^?71 zTo{Ja3EmsXA*;{SD;V;$XK@#VOb{?R z@SiZ+kS&5JuZcfJ{CmF2Nf^%-hC!S`++99)({tk&Y%<2uJau2;{55}^bzl4d85q}t z{5OK~X*oTs26-!+`yqw1y+ZF4RD+PB3}TF>r5N4L-m0>o5Z$!LaqJWsz&FjNsF?1g z>7R>R572K=2?sAP8@MI~e(4eUPu=nwgh%Upd(wf8mrWeAt-zcYmA~6vF1! zR2ei~9M#5(m29!B;ueNAV)Di}Pvk^Hx_o5v0U@*J02xvW!=Zhe1b>;y!psIlQ0CLThRHi>1*vqg}>i!ATC;^d8BFDws_ZeNfY>F#E z6^ihJKvfOo?XoI>HRn>0|FM zhP{Ed*iTn~RqsXqde-$0N*Sqp3U0R|Iat_9)_N9yC*BajYx^Nvw`~q|>nmj%T^Y96 zIRryI+Zq=6~YN*X9Z4?edsz9{}Mf6H#!hYI*uS$Jh?{yMh-vrHB~=^81>X~uuV2u6qdB;*n& zrRnbSpIU`nzOgeKAha^1=^8_|BHCmOP~1_?;`7hkES2ybSgK&D79a_SAkf=)V;V!X zBTkf>`ZB3Qxmb;)#42lvVVdWU z*2#(QNR}f5ZW>pCKVAQni0sFzV6VqG2nZc9FolW;3VV{b1u937X&PZX1j=rq-EwmN zxX-7zs&wIbF5owuyFd#%a{vDedm3(M2?&vem)BvoRD{<%WQJ9o+qN3`Yth>{Q@!Pk zFB)(!f1nEVtUVvHGCTGYZock3q*4DOoBF?-1L1x*dm3~#gq*V%SUG7weg};otN9M| z{W#x@P~GSIT!KgZn-Q#J@WgO$e6QyQ^R?tUcOAPpp2Y;q6+XcE3mU``;6bF}hAZs3 zP+Y9^Q&eFD05RgZo%Mx-%A-keT^h=e-2xyLzb%ZtGvTRSl6s5fjUCocE1`f+8mZ)H zb{gkQZ)g`dP(rPz4C3j*#WR8%Jf#fXn3Ae=Lr?L#WE%YX2dQNV9eODZlGx+49vfCg z$Y0(z<>K-XXQXA`H5(70v8d+L$_64z+LT+=7lq|mBBNmfBa~l}IbHLiq zf4K9qKV85NR7z2*w{KKFq-iwJje&762^&6Q!DothMD34`?%ICo-K<>3CE(^igm41o z&iwOol^alZHJm)5PQ5v^>}mz6!b|zrR9-W7z6Nd?B#Ggo;O^oNcQXBCb%G}bBR?J{3yoI#tZj~ZXjyCGz zvV*?F1zxa0ZyXV)Nkd^~`u82OnF$t}RAn+Te8gyXHIah)hO1EkZX6~wrVFUEo(0B{ zJD+{S5;EOQBzXi+uSq?|L6sMkKpZMxWQzWxsX~Uqe{5jUY@Ya0AEd5`rA*>TZRlt8quU>-_zj7&x2049)3-X{^JRC@SGh(uJ zTZlt2PJ%8V8%f=nCWH{HeK_u6KNEiA#~fGPvp{Mj^~KE7I3iaj*D0G(hh}}}Wk{i*UclgmZXAW!K**J{CpKTDOMUVU7f|#wZ9kG{*YRU~>?o%0Y#fG9h@f~}8R{C7 z5nEhgtzMnF4X?qtlNk%top@^+cN~UyZrU_JRfOjdr#3cFuhH_ej`t`wF?$j369b^G zavY0lcAdnsxWT7F@U5?n$&?bgK?>B59xU*+U{lyDMI4QBoA<|X(}7p}hbWR-Tfn5w zuPG6NIK!-85Cx@Or5uxVlQPyXHKa@HIEK5R$Nq?I+Nie>yQRBYg|3oq862XUmD^an zq;Daoflg+eN9#|AAuJNL;5P@Tw4$3d1{|aE8#(;-#dO{?hMJM|2WvYU6M8QIz}>gt z(aTU`4IHW5sMMr2LoKw)VUuZOWx-glX5(#jalITfOY!xaI~=Ujjn#67O?X_e!FdVu;X}oR3w`^17ZKt{#)3Fy>8flPW zxdNku1s_eT6&&KN7mKgVPLRVu{y0Yv4oaJe?Z_bkJ=bA$Fz+;cQXK1UYEqDRj|(iz zbn_!XYlz%n`}xUG(`}WH1pt8p8XWAu0P!zO;QhaTY*M7bwF7_bz9*?sHewpzHbz~c zT^#Ly8{*=$E*fnJfKd==K>;c6bXK0|(}lgW*)lI5Lmc*mWbitcfb({>Xl`qqMn3KI z-$`IH`$76;xFcebIvn=Iud`m;oz64f{j7h=2K8}@_TjjR(V>bz16Q2_R~-2h)e^OR z-BEudegIBX#ABRMITR=SoG*VNpw5s?865i#f#q!kjHwD2GaDEd1#yd2Wod3h<5K0} zdk;a>avb~p<7vkAi%s`%%sZrgWrM)!U@!+Whk47bbS8FncpW6J!@JRpmi&6u%)SH16NUxXvC2WgLqid75co`kr?_DIH}{d;T0UiA<+b2~_NFUy?N*rY$Ch z&-i>TYN++vOdV`5Jg%?Fi7>}doR1iQU5>=iND)xyZ$y@uIqQq%WF5(Dlw%`Yc`VJo zYaN47&esmxP$aA?kJ78$7w2_5mby_IGynSn}J?;cglvser4(HlG25J#k$%>ML{ zM;-Fo#wzQ977)M_xK69AVLDFS9Q8D}_N`tPy25Qmryc+3=8|Dn9ivpVpAz!H3V@34 z6t$vLIRd)lj2ycx(H;aJHt5z)JHEiW#39BR>)+>tWPO|<{0{hoR^`DfR~`jBSMA#w zQhBavb%>T+j)U+?vAPpvwHzaV2POp>R2~Xx7ylm9)cAQx`%k{J(RH&1UK(i5E})Pg zuoQU~DjpAStr0O>%8G$!D4bNNJAlkW-})FTtL@TKt7PmG5*`pS$(n?_+sa&0IB92* zWC?-V_EA7K4Xa6{S7DnM7alEdyd3Y>Y?O8^nxc%hzPs@ddfG#FOruAY)bokhW*#%} zyscp<$J8!|ZpS@Z*3F*EZ=5#}nwA#+JwkOP6&^Jt>2;(xW0?fUz`oCuP98rL+@LijZAH430me-pV_U7zmKqLR52}=t4Jh=NP##8Mq&a}5pRf!1 zc=6nwu2C`^AB?v}s4=Q$`&;XAARbF2Y?;%Au(6j|+Oh(>i5GS@05@Q_Cyby)LV;*R{FqB_V>~3WMF<)nyfE(ptr)l7#%}rm7Qnf}rBpzx`{_8Pm zTAy}*nUc8h=bUqvnG9DnJbC#R7qzZJL>_{0mYYWFCd5HoTV5Gjr_jV^}R?mGB28H?~FXV-V3*BfyxDVIGEPW;0|LaCFiGd;qIC zTpoAV+Wdl9=u||X1STSpSRRu$0beM>roIM#!Lv9*g|KTz*RWIa=t7qQ_$5;IcOIZI zDZ0pJULaR*;yBW9%CbZqgP0iAGu7&lKZ#&+ULK}#pqh`iU~Lf@7tz771jdag(OKV> zro8&5Qbrr~JszpyY}_-S&K5QFWc5I{zVog2yRcKq)YMxZ1}hvH3m(d=k=m8bSjf4t zTfixyCM~tPh3oa%uDmXN==faZOhyKw_7i_5>5h ze;&@ARW3Dv2T)@)1g*q2ateA+=fI6@ld;~Crj0obYaZ7w6XKx+%MK2IeiezOjCYGM zhDCVHPnP2_UuUJkNgmh`HjoQ|OrUvufS#|-_bo*7T}D`#$-o5D0`zG$Y##aEXc{`p zGt!;{lNWYo`vC(cq?L9^e%X zMgfS6sICkprFiUK_1CNs2_LL?za*hCDrtPeN<-@sJ*dixB2jAtBk?$O7JxKlm>&Tk$Ko2w0IH+bR2-ChNFKC+*84Zf*=8b%2X`!(L7gWp@HUkZfQ2OF|XS5 zYF=vg)USqEVjvC$$M|aAT3vk_ChaP|Tjwr}SsG=;lZKe&@(GmgD>?Ky}{nceL1eL;)>K^T_Q6VzOV#NtMll~%lUqs zN+2MywfHGx2%%p*3_`*$8qrk&ag@7rY(VP*!vzry5+EnKt4>ip?t*=_LUF;Rk1#u{ z58gACh68w8)DK|U2OurM)n?D6*rg)Grw*^9A#*7pMqf z$*$KO3m`O%RLZUynAsjf5`Gj(=JXUAojbH+UmiFyKO*n`XCPgxxm5k%UP}X+BS^B; zgOE;L866=9RmepL$I;AIOCVj;()!C}5F-36$nA+OI)BW^|}I03e@0(=L1v zUa_+%Ls2I9Y-Bt}dGZj3K56IrkuPZAq;DG9coM>_%S~nk57g=vVWKLY3K(gcW0? zx8bKjlK>+(aUkN6@f}TdjgL27OF03S6$SCxqn7$d0$(EoYThH7D>u`)adG_};-DV>DFqN62QZK=Ny*Tp;3-DXHrsxlXL-20eE=K_>gw zKh|zHG`c)rk5pl32q5B;F6)7RhBP1;({r2Q7bOzgzTc(K1=18*wwKYQ3LxX~WqR;` zYG0X%p?H*lmhJT>#2rXEZ>gYzULB^0bRgsKXzwx>?U#32lPele0=3LVkSdfq;vnPp zyZ&li&vB#4d}&2tRW6cf>QrxNJ&Ttq@jlO^=^*3w#tz3$3r%w7>KB9sp?_UG9Z$Cm zj%`@?)k^qp?;z=XI2lKtTPIvobuAO9E54eE#Lwl)A6sKHKVBfnOd#s&rMcRygFJ6! z@y=WmkL5u!zO*otaHWNPUIxq}86fV%i_`NRkqj68Gg{{&RphV=#@_|?Lw??Pq8AE|0=BnruozRQXZNIJep6Xg&{V&ee8YL7N{WZ(=1(5 z`*YK0MJRwzss||V*!?sqR3SJRw$YE!{3RX|fz1q{NHoeRvei9zc~PP*)NHi*8zDFt z?J9hf#lkh7RUCuExURwHao7M*5Qu5lq$YLXXCXKr6NNW9$q@>P*9 z=QBL2;1oW~Pa$pAyL5%P@ZLX@wO?h+{}*pf@8kTPnsEz;i4etTCn0cBA!4K?{-dGt zOVMB>h0Eei=}w>#p}=&0Jv)miBq5G+cuyg&VmRj;Yfu|xltvpBf^_7Ip=aep3UKo; zCn1me=SC(`>uifqDeOk4M_3NOyEQna_E!La#)h2i7a^x|I!i1W11@kod0C+Ue+O=} zjiJ7V=xj|SOQm;uMj@^N_d>8e?E6v#EX*U@c{-YfMwS#&8wF)4@qY1+yCJfPsOd7^urj=3BMgN-EuGYUw*8jkdy5oabcjUm=c!6@Qk9qDpg0M`#vJYyhBueaWn4_^xU z`lZ-1A|eH6->a7p-n9YM!J|Wtfkygi4!@t zU+huFP)-k=^?pW(<~`{Q86pg!cUz&G_z%LtHh`bA&KU*zxt3$G*olhWgT(5Db|MZX zo9kN+Xo82^8$M9GgQR?Lm&uIT%|YTmI0dsOJR%#4(*N88E(e<)vuGm8;#j zbmT?CVnmaP3C0_+LLxwxhP4*5xpq0wF_4~$maT^AVuF;N0uN|p9Y4YPc_Kqb?PK~W zjDTeA-p&USGXp}U4=)ueU$3-O@Cl`8RU$;b9E!|G%%+dIMLB>EB*j$72dH_r(#^@- zS)h_^IwD4~2Yp9M~4U#u}sSqN#3#B`klIK79wmm920KS7P`A53Hapt zM3|G52!@O`l=dZfRe+CXZz6x0;(t}^u#KLXZjX|PQ&xtM)wINVBKS=C|AFw9?jn?E zM2VYoDdIxsHfw0IID(h9!VA?~!C)8@kGUA(HX^c>MhF)-?U`t0$iG-9AA)VnNn&?` z6|sAKsDVMSEF!i~t0GHf<5D%aJgcST0CR8i2KJw~guR7EMtnN{Ln6BmDEs^aPpX3A zx;Ri?GSJ^ZnHVC5>!2j82M!`WZX)*TCMyf!%?Y5Za)p?Tq&ybHMv1~}l@2PQK$(Wx z93uA{5zO;RCAA8(9ekO10w(TYqX%H)@=U+lH0(8tGdIp z1aEK5GK#+q-4@CSHzO8!jcFikl}BbZpko58BSvG?;t;coVtyh|zu5~;wIdzN2cN>( z!I92{o||P!)lRNTwBgVNwkvZ0?xrEiA|ox}pcZE7JZrB**~Ho_y3a?tfkh?=q1aK? z)X|=r5hFKz^QoaUTW{4yE;tvxyWF1xIN7>KS0= z=tn{%J%UXzD zP>~F1Na+EYeQ$^CUu%*cRZsrAgCaq>`6hjqoNkz~3(<9hJ&}Ow|^lqz1 z|0QtQ-z#pAU0(YcG2L`0rRBl*}CRyji{9GB8k-uE6CtMq4~ zVr$AZhbXBEg0tQ+7$g_~W>1ge$C1zl+2<|WqpvOKG2XQ-Q{bFO_4e%QStJ^>k$`?c z;SC!}tL20tpwgL8p!jA*sEgT3kwai4FC-s&J8hO^kjiQgmP1Qo7vCk%X>3x9Kl{9? zfl0X6awH&8WBmxBEL>^oBk**+C1z1gnoZs-*qEhH`F z*Xw}$pln%$FP zLmQo}$e_Y06r z)uxqC$+DO!-8~JL>Lh#c+1twh1c4LL>BpTIarz{7+k{>>63?zdU3%*pjA6)RB8~m>z${0A9kA5s+D!&p; zh#hn$+9ZwKFgry#;9IR2M|SD%{+>k|O=!Iu1HO^r0Rb5Q7bK9Ac!A>gjg#~YBQ=vL zE@pV#{e2?-GAauyrJ6_p*CdyukWXUbtGm_{htos44gxE>md(Br{QkioYv5gidnBQ4 zn!~{jFc<0P*ENfO+*N}~`Fv%6^Y~l5Nd?S(z$B>Q0iceA6Ke}IM|fvaJEB=0-rQ^w zN1*q5va|nmY9zA@x6c#v@YrYmnhcs%i(!CV4cxNvXa?4c+M$-+zocMapDM#DE5`c4Sp!?8amvUIUK2) zP9(qbg*F`mZmY$QETR@@J^)asOjsD_in;rmmNF*FJtWrN`>GU)1C>7uxN%esFMP6O z_DSJA1#h&ky$#14JS6T#B5Qy^{yaFpdh-w&qLvxIqW|>B*6~V8?^=efXC(0?s)Z@$ zBoy*E;#g3o5|?ClOiL<+w?9X(Jrawl2u7VKi-LLdZpL-DbI)Dd?gDB=kpIhwCIN;g@gEo z*^}a3jCICVc@hMDZFQT`Y9$W7EdonTcq^OwR<2^;>9tmXEGdZEVG1jLdy@y>N+lIU zdU#56aC$P~SfYT+vqNn6#~%myJ}^eIZ{pw6mL*9+DvDM{LQ*qQ=tRtk^jF4$Nk?xd zs3Fwj0o?igfF)xxYHY)QFefQLFg zI{ZuU;j6`y;HBOK2ezRqde9)gvzKvhY9kwX~rO*d>y0ApjEbx7f$100V0IKMJ6D&3CC5 z3W_!^;YK1oE+%2tE4knr3S>04nEQ@45rFrWcuZ@we+gMa4*3p?M<#8yw>l!au9^;q zVMqCjzFix#|_876l-^09t0Le z8DmehzchQjs6h0=OjKvkeko6hrdFk8>Q9uye(M!9}YKv4L zYizPa6axk9a3Ech|zUncZY1Q#h6e$1DWfyB>c$1FA( zPZZ7%*ZHZBtxed#d?zB1|C=O3@QXBhb(+$idGZ0OG(3d|K;b_`>zW`M?Sl6Xw-U@-*%sS0xc^)v{rYA63{o*=KwS{>VVOLYxlAq_>jANFj63o;O z4+9WVNGC!GR;l!C6_Cavw_!*(dv9yTPJ!C zN$O)|iXZ)Y(iq?n$yj^Bgv)QSJ{y>9TJ*Z-z9*cJWU`Mz5kje}>-Vgm^@0ai>kJcc z7CnLPG|H(DvM2_H61r4^b=lUSKyq(6CGW}`PIhPufas*B*spdJIw%c+0gajrhus)Z z`&TKQ#s=#8(&;mFaN)>C-(s^+dMFT}Qu5k5s<*+eLa*FfO-!r&C7e)aB#W)}JbBZ@ zNhluqL*V*hrI@V|Aqat8ill2$4qXd$E`NdW=?`i(11KZ(NBW+7F1cC{dS%md2WXm6 zH%`KcYSQnrQNY8gZ|XR@;l{1RA!P5g}bi3@9}Mk&S3B z2}@sFb+Ag^F{CWl!PWA!^~TfX+)bS9KPWr(JI&ueFj^^8&B1s|BJzXPT# zArJEEASg)=qjfRFWlyXtnau7zp_*4Gs=*lSil#NV4G*(+^C(a1;GuJ$H%|d$uxlZ$ zivsPmF)2+&t^j{MM}*KF8Yoa$nyIr1OXZkP10%WtZ%X;?eNj=3vvdo@9IC2PNhni^ zsZ&JTq6HylpG#nB6}E!TyoXuaf!p)Y|b2azME?~<7o}YXWoGS=(DU3 zxcO?XRo=%7s3>1=U&b{(%Cm(%t|iQpyBMfR{&bVJR5OY-C)wHBXee?7ApJk=%NgR2 zCmX;9Q#btP)5b?L4loo*SQxJl9Vm$2nAetvt!jUaILSbWDY#~U>bT<#V(d1#iTDVN zekhP#uaJ8qx!}Du9#srM2&$i%F-GSiBc42TX=goEv?!6cJE|gl@xMYM)xldOC8d2H z84sMl`Z8S-I))-x7$}s4o90)mXfmJ#>i-x@6ukzwdc)xD$E0{PI_j#@o_X;^8&5lNB`BUX5pjP7H=yIlhr*-bv2h|{`bZb>zZ_jx z-8ke>H7Kh^?!&lI8HQD%;Ler3QOPz0D7Cy|0yN0xpp6%UB`C0S71)YBFVi5WPFoCUkBn!iQG57JGnFpnUR43K^9u%sW4aI0MW|5=}os8>^ zM=0%x#O51RV()WAllL*p)_I5{fMIzGOgDa1K{D@EcPR2<;HUe+Ru@j|=FtWYIvfNr z<3`P`6Z(z1&}>i~dMOCXZnf3lWNB<~y*>7YzgX_U(l>$>6LyH+J!=L4!6~-2tXc(y zW-VP?fPg#fQ}P0Sf1QS)Vo$7%TLq{@XDQfUfp1?e!7WL5KRZ@d1^xKz)wk$chy>;w zvFEP`%qjesje6V~gG#2SI4U(Q zmMWKMKT?q`__j1tWGP!^Jl3+5LYMC<7)W zmkI?}{5{b}GAcZ?wh`*GfI1Dw&V@YHO%ATb#~)Ew^ahQrd+_1wLMlI`3qXa~t@qvE zJ}`6CT|>;CRo-%fDUkXtgt3pWASyy4=7()zs%;kTuOA-@j17!MJt|91;DPImG_Th! zV=6{y`PKoe(WrodV{Mepec^#&D3VQDR+KWq>Fp*Jk19vpZUl^p)n_*ytK0JHVBH^C z4H_^B2t%d?`g$fScq&eo4gjW^2hz=I5gfvc((I%dzln#=gTPkLuEokPdg*lKq%&QXS zGHhbeIu4P)!~APlGsts!S1N2h&+6o_Ny{W7KC}@6a8YP`oDov012%=1b|0IXD=K$1 zA_LF~;C{#n~S6 z*K!K{uRyK3LRw^sfPz8|eFuz3Ix3~s6`m338E~`S$nPOR1Y8f5x_wOIZZb`WfzplC z5h|@(4BPaHgUh|M=_ii~8Sx0nVShJi1i0T`(u-`s4=S}XKY7zMW(&g>bs{n-imdir zpQg%$u`j?1AcfLk1}e)PUr}+e7`@Ymvre8cBxqE};d&T!%n(~(0@#O3KPuM-C}D=Y z9np#J0nBD^$r3u@3z6vCeevLuoawIzKq}bzwcM$*c!eoemjFq9VvPxDSwt;Dd#qw? zj}e4`5h~oTC-g>1v|jb(S2KsxEap?hHtP*YjX`5|N|eCIEGp+%ZU*ymnDz?fSCxx$ zuaC44^F9q~Y0w+M&S`6RU@Giq9AlFw!oO)TRw*7U4PKr~#mmOaj2YO8U{5>eSSs-j z9h{j*GFk58gqgr7TJjo3;>|zN)w973u|lXFmn!_*WjgE_J`4r3`1SSv1Lm1srvqZ|G| zhJHxZ9LiZPASY76-~vG_xH6QsRx36k2tfJa(J)U_6+CyG&;%!SaBy^wm zh(w_;e*|cfqb@u;mn(R_O}Qd#OscVN;3-nQ>751yDx3A53`}t+3?!Xt@hgCHrqN8! zuD%vx9U>=wdi~H)LUi3|R?D58KJK!zCo6@rP@lvDCDhv(^VqkuaA4&(nxhSSL9cZX z4S+IwaVwS$1akIbAa%_Q)4A=`+4)7hE%?46T`~d2(dCFa(krP7rsNfl7maJN?Uf}6 zy`i# zEaKT$NEl5xU@RH;LzMugyU1X-X2#DFg+zRnI4mirM*vy4%8o5tjVoBEKHTcX)@xONCusz`K)0e4W-KLP%K16t$6Gy zkw=qmumXRC)MSUm+N^$PSc;Hpt};FOV=Pp|HdGz6Q5BwbW(0c<8JwZkxXIachmduN zDKqe%K`d~P68HzNkHhfNtFXl!si=)k@=Y2EEBKwP_0D7J9V~MfKTKjji!#zEffNIf z;E!pWpCdJfQO6n-ybdXWNi1_7?{#F4;bPA7qcnb&vioS``NFmNl4Gc`R47-wPb_m* zqoU>#=xp`9?*k`#3b-MSWfBhAH<_lO#OC2kg)EMd%P~?Q^AFOEZLAVFo5LA9gW`&o zMoTyNC7}ZhMJ$n+=P)Ej_bSMT{klUH@rr$(=2Fl$Gs11g$_3QOc`TAKiu^?_eGF6z z>aia6q2~8&d)?D3eTp7LI*-U?D=d|5-$((slIcewPVbZAI0;4VS5gW6NYfIeoV<)P zAS{*)Rnx&aAczjdV)9%d@hD->MmjoMJ2%*%b zg$;SgL@c?6lc0l>6^Y64cQe`7lg{xFB$+5!!rH5(zc38SfSaJ$gzqn*xq>Oi79E$fyL!;47dMwJq)UN|z&%vFAB+J&O6(`_OK*4cb zkb{{Y^q9?ka4gThepEBIS?~{8=O3po`t6)*&p;j*iIrIg zV=Uk7Cstp zViJ)y@wfN08ZwoSm@MfUP}R`#LE2Yl1-sfFClBXYM_?K%dH>BBhvbacc=~RLET)11($9 z(~!6=alDMOop7I)CDknR7g5LWaH`+%0w+2w`|a&PMW~ zRX$Pc5!9r-)q6wGem?L| zIiETW0}gpMk1n`JpDn}gAJ*+VF?nZ9hw~d*9@dG!U!Wlm@a&$Qp*E35?Jdk!ILug~ zoRCn1dTW(8G;R3G>Yjaa<)T8ZrF4|U;VsgO9|T$e_WOIK6y0S|Tss&BU?@`D-Q8uO z%i_zjxVyW%yGw!MR@~j)OY!3Fg<^$5ad#+ixxb&;nVlq)oFwPG-;JZmx-&7&qRc@& zOb%lU^{aJKy*UTE&#)*X*GgzrzF@lB#RpZt$<#XvUwm}|){oRy`&){RFT)RVS39S286h00j0vCl##DrJrsWkmmwDKzJdIjB18Ks?m=$p#b zQ^&i>74JHH=v!3?PFdsN>JHM+H1Q}pLGnQBrCQc!5?By6ibbTI^`bA^ zELP+IE&*9xnVVT&L!&NQHPdrNqDcUnzMpR8uz&h_1ln+bblm38W1lN$=l07%>A_w3 zOQqup@GbW$@`fq%e%5IrT5p)A}2@7 z>UW9zYN;oO#HVD(CTD&Bc8O;~GGUI_swgY&nf(5=u_#b%BRLF*gxyDYPvI=TtXk$e zB@$f1%_u99UA?o$?-pH;Tl9Ytn6LF3$&;`#{=$6i+A| z3gf?}KMZp76QtoUd%)a|%%rUBUY`QK~Ug0j01_JQ#d{UBm>ylm=w#Cn%Qb> zr`yZTmOIVDbi_hAOkmwM$Mq%Y@SC1ET)I93ZaF8J`tlE#y@FxClwG-VSc<*y2!E?8 z;5}8EAu%N6rQy|EbKZp^@?&tN3mvEBu&GH}X9cU*&;OJH?Qg9bRZ+ObRU_I5b4LY_ zjD2+Eup413Z?~uDnVv>QE7ZzXA}fM%p{*M_Na0=ne0!+K;TSNrZ<6;<5rP600HHD? zvE^kK>h$;)BWA$6Ix6dM_=HotWZ?Kr+_!2?*Q3l^H>#FFh8zpw$Uoqa z=pCGo3o;q8K(9{?A^zlsL~JF0Goru@XOFGKk$+~LV#Yu|b{tC{DJ(rWQy{GS_wou` zY$GBpK&*v{qugm=PvAJ1$uzcv1b6?pM19NKy7Y7FKI{}#otKILM|sH9%C<0a=6n*V=|oJ(71fGFOPk=-hnyErf)=zv-?Tb zOLQ-%P5)NKU~1Z!7C7?jIG{dL!B}$2V)(-F#u_yXoJm{vNkiEQ6HB2>(zC#%3AM5g z^GZ&yrnxtA!Sq3#aZ#e@?^PiJ4c-(RQOX!1s7>*q$9J5$RK-|}LE?9AG^)3~RV`9na?}q><|gZev428@V<|vCguj$zB~Z+FjlX%-m!^f)d@}6d7CGW3TFG9zL#dfeiKF?})DhXN24tgp-9sc4gzr%R@hB#F-NM$$~EmS-R9BAa$XWC6&7 z*@)+tw2$Jn;?sVVvAcoYN&oiZ+&@l(6BYJ(Q2^@2l#dk)H%QH6RY<`*Q>HK5&1A9~ zna_b%-h+I%|IB+7GkV5$+suU1lKN3ex4sgu+Y|-kdOjvqILyxTyiwvGI z{l^40tPJ+y6amM70C@B0H1$rx4Oyr2mD{_9Yni`1j->Kz)OwS*EH;^V0|I6fMHpfE z0B&ZpS|%)~imdWjdYF%l;_ASWd}L!?K*(a2z1m`b6}^`{7Oa2ukaXy7zcnvpyI`GF zbMxT?pny99R6HGgXNU24S`qO!g^~IJ+33_=8ZwNCcRbdn zz6|dfORAnsBN>`j*G+x`wENb%a2WjYUBm2g*MicClHj$xb=1laPz8L42^9(gbepp_ z3osZmVL850IA9-u^+Dk9lx1oc?;lb2f7`sHJA`W*X$o9DhyB=q`uhla^*&xdq9rD@0YpW|mr0((3ympgB`%R&lKx(jBc1)-eeqHd1ed5IobBCMaMtzg~ePa?qV!7Tnu(HI@>35B=-( zj4v)@W~Ds1E)UrHWfFpq&iOJqb`RVmOs_EMeAEi6vADi^h^*T?H300*_*?jw2f`p^ zEY?ZpQpn*;%rBs%Uu#Y#v?iT%s{-~md|@(SG_ggPAGEYPi*bvqd;mH`ZzVZA=cGN%mJ)hMC;4qbgz?BTKm(f&Xt89b;CV+oSxwVUHTf8P=ZelxI*YPLo z-l2(cwLe)7k78&pUb*mz5y<0E3K7#k@D%hxuVW3=Ydf?j_zNJvcRB_SfnK4m1 zHn~;tmiPVqc#cgyPtnVcPC6 zQ6r3EX+0k8+%@w~#FN@Q_^!Sj`$(F(-qw#f@?49`is5v_k*_d+nncFJbt2d5uwLy0bEJ(?~KM3_Z=(Q(lo&O+h{WI%FR18)aobXC9ED+|V`}c_kS}81PqFf(lT>letpNEH!2zh3qwl54* zKv(DH(cAvlND=1dkEK~hIrE8-by&3pOAuxQnbO`rYzm&6KP1Ot{L;!hxak-7*1E+a z%7gRju{Le1Vg9Edt^Cg1;K)27JSxQ#VH520*vzc+o->ke+Ij4C`??&t3m-LZ9sX(C zv3N2VZU0-xD%@6;u%DdP9l?6PKzYhy=J1hgw<+M!Ho_pd;)@zMswI}aa0@xO= zInNPrCo(O$9U~_Kd+B5w7&DMRM8{&ALW_lGlN5$oG|z05PpNpgolddRSuDxH1?ltA z|7b$;T)KY`+ASRne7LUmCrEJRcDh=NV{j@9ZN74$iPhP&epUH5v25X#S*HiuZJku$ zcDwt#=d-B`(%n%E?Q6!S7WUqu_dR_b3&LoGwLDqpc2D;Z{6r^=_WR=ZV#)CKhc>3! zaZZ_K#F+;bD)1j$?pV^otD{6|-!QMts%yQQqK|HGWm8RlyMS`|b#5ag?i9u@Uk_ji zbV;j%nakIKWY+e}%hTgXZiUqa!EG`cce>^PZK?qN&aq&-la&%HRwkuGyuEA8Xc`JK zaZninchyNpYJSwn6}_y4qry1F;^3Zly>|tHu!itS4Wcs(cXdL5Y4m(@)i#}Vj({>l z(A=W4tB)wUj*8`Z%TmST|LzjXO62PIp`bZ3E4Vav(lYqg@)`30Dces=9`}FuXot=H zXu%ctQG(OfpexKpx)|ZR8f@NC&jh1AcXfZQmrN=4sUO`f&qZRm$rNXt21Za?)W!^x z-oH@^?z--gQ13QUAKAfWP;>XC9_+!7V^mKmTQ__jJN;U8?s|y2B^p^*@gk4g32=6H zbChGSj`CO>(N8*_{tqT6_lR+mF!!-SDi1GuH_zzY4)G`0{Rlh4%yri+4?#?F?uAl^ z2^M4Ygs6>)`+5++b~8$rkQHt#6=W`%LTr(Xd!q+&Ua?*y^&|}q$|0sUj%sR8VZUcn zzB;V=Q+>jXd%y2#ZRv)|mjd87KhiuiFKg+|Y!%hSBzfQpnFSDk!gjh$juPRhezw73 zBySnSt9TW^q!zg}AuUo~VEpj-N&oc?s{^y?<;T*r{|;ie!8Oe$?w4aNnuM5d83vSk zpRVhIo+y_#I@5f{yBsQm;lmiXG{8Ut+N;ogsq_h)ch3!o)CW|aeO#4$n!Nmkl*&64 zG9C{eMD1$nlKt}Ox+TImZG%xz@DxrdEA=bxs2`K9&IYxvd(iD_K`Y0*r;MvrB`-?T zVE5q_9=qw7j4L2?lvrcIu{~RaXuNyH3e^-HvIm*C>u_0-KXWnRCvM#y#H#c4aY5Lj zcOOKuTXmNkfh8w(&`Fm18@{37w_TY`5kbA#c=W!J!ln9kA8z(L6ki`JbupBxitCy{ zV;QGgy#?v|hKc^&S$l~-?6TLOlOHBqgmJEE;{3HVYc*ETf99FzM*4J1%zgsa!+s!< zyHXQ@jchx};v|?iyP~%6UjBB@K>hAqIU?QJe)#b<)8P`FQZNz8*^+BbzCV0FelYmU z2!yfceHk6aXlId29RynNae2Y%!jj+WY?-Uk-8BDfm{3p!dP zC=p7HE192eYR9>;EPfd!7CZeA&n?;npndNB>Zw$zirLmQSfdqs-6@T09 z80qy*2mRMo(5?qJ<#->@PJDUFgX&?-fGpn@dzt?&)Pgpy)45c^GiRLR>6Z^Plj^ z%YCJW8vQv@N3230ECMw@P-=M~xG=3fIEb~q5_{QgcFRDS0As-y%|rlWPM#VcD7AhR z-P|6*mqG9Nwd^74T73dP%I8(6^6~XpAS{mb-OoC^UYGN>`cX2|_RIp)y+6K2yoxMM z{X0Z1ymNo|bI11&s^-*e1WaoK+yLf3^=1`49>&4$a|)NAO5gp$hKPP0(_)wUrh?z? zidhISlo%n^Sy2m%IwHyml-eL*HlZW8^L5RH)^Q?fI_;wE2F+COFF!)EPv)h8(r3Z{ zRzj#gYsPIw%nU2S#Gd}T$~yXn9zM_Mi;@culo7NEfY!m@o@fN85tiU(vT)mUs1=)1 z$WIDnF?u_^dk{nsx0dh0Id{xUnN8GA`mdSp^Ss_w5YzA8rWwLxC4e0R;Wwj@gOoV+#L8D z9X3~p`R>kwfk+kvb1k1Z!rNEEgGkouzIlxPGW@pbbIi>5?k+Z$`CgJno#d3P5nj6C z6hl}@wIkb4wW-D_OP=rUy3|-B@ALYcar^qF0Ozc^A|Or6LJTi0eh2S2@$T;Ci5K_5 zECRE1x6_`R6nn>%pj@OYmPtg>1Af~7J$3i}#Q(VEFaGnY<{1z9_XmiPVu5CL_)U7x zd;5xdWB)RlD$@3Y#LD=R=qQ%PwIi+6-6=({Go9~Syt^+j?tr1Nbjy(RCzpJ7i$Eb?;?!odr#73os?C>#z^wdCLIw6y`r{=}w zmrWkBA+>i8fo|9a8l@BA?62agz`@!&;O}jqs(&J`koc2s^6p{2C*k-`oOYi|fYhi3 zM}pcSD-O79w~d|37#Uda9#P_XsKRz*kfDiU*~unj#}?+9_Tp{<1dR@DRlIwoyyE)e zE#JQu%NVom8j=R~kro>WUiJmQUSrY!<0I1ek>9xfiy4L^4Bahw?N(j#8r}=^jN1yJ zQ#E+^C=vb^tvpDilzrU&*^A6kKOsgRZQ{pRET?rm>35ILvuD-GeO%yDyyc1FHGUoH z&{@4~iFWr$N@Jn<-=BZ|p7*}tr#+tSc-T`H8l#o_sb^I0sQs#)VfF5D*Vlh;G242R z>piyZhjpGFPR;)Ekyv$6@3vZk-#tE5mkCnt@`R~Rei+ugtZ9@680zM$CH>+o%?JDL z3FKJwY9BWSEM;)&hty_N%a*>98F_dtBw4uI8@_uYI%&p(FVv%@&oo21Pl@z~)6r`} zlt%wGv>vGO?nxOsu%YJ1Rbkjc7d02jw_@rkhFpbUQ7&zVKmU)fq~8cd+yoXfE`V5% zvU>LmGl&2t8(;Z~x2((<)w`#lKbgvK@A+IIgBpWLF==e?vhXx|<6b8$%%uMB-xN}* zG{*Dq-=YDtNah_9sQ$k{7yMqG}UuTBiMoyMzWe)VV35-_riyKk5AwpLfd* z+g*R1mlL2*fpz{`N^lFenSmTT75;C(49Z7^@y^mrTlH~x!7%G8>Ns(VGJcZ@*^aSz zxBp#v(1zVjXtMybbfew9!RM)!0sLc^a8m*p`1SmM*LOUIG6L9o@0X7lGB6>KD&n{SZKD@IyNaaUg z%L*@rB31g>k;+0`oEQ+3{-1yHKwt|I#b^oZd$?#;87v!NDXs0zSWz3cR&A31$5&nm z=Po2d>kk7%Hu4bXwU&i$ECzszi%sVxfk*Iv@3Qos#pv6bILj%A|BTckSC8R0V6KPK zfA3Z8_3i}#+ipHvFNQTcZ6K@f=xcN%T3PaeZ9!3fl4IGs7a20mDtaA&@C6IQPka+U zbzh#BSN@djACteRk@??8r?pEr54p(h;ZTr3>;5Pjh3NSKOVt5{K!^Y5m*S}NUrsu1 zi*Di_S4dxV%!D0N?UtoOB5sFO6Eo+#mm7(yzm4x;;pZ`N zHpRt;8)b1FgEk@Nm)R!SjPG6{$aBqbmrajPWTlDmc|M8M6w4k`HJI}Cp!Ul8-7CKf z;9@RuftVkh^ff=tNjOA$7K#bWSzgGa@@T(%6?_}U#7wUrAu3@Zf7y>Zn~P3H4#j~G zG5zSG|L4yt%yKHj7~0>kzONe=zfJ<7%^n9}4P*grJEse$cds_d#YtnAr)6TEvJ+x4sP>X54%k5_boEv9mv znUf#f3i0gIf-1EqQ0Z*FP=MxrqnfYw2!oCOX6;wRcr0Jz-I$bGlD`ZD8e`+Nh>Fh? zPgQ!z%t-9IAqn{pcAlqjs8w0~c1n)`T91AYaR)a5?;oh@3M4fzgertA^b_lcCj2-` zR9O&#wh29yd}>*$$`EV;mk}4nXb4}Sn%$2~r6+gVzZc9v+qP59#LwYtlGFV5&8Tvi zy9S?{*`H>@C+T}!J0}-_b^;Rdm3*FH-NnnrSo{FV1ZIX%?8Fyl$9g*UpWtxKc0530 zJ$|s9!qry55LkA7F(iF zYi<3@e?oY)J^6u!H$Ps)L2SACr{uR}4GB|9?hD&rBZk<>6(A;>yt2TS*q&-A=$AQL z7Y~WFdTnbH!@lUZEnI^zJi5RxSGg&D66cv1#_7Ld5OE?)E9_g3bEV(lvx&OA9i8WKh+d5M|r?X1VR^%e5$2|I8uRyWJvDdiE4DRgwE;{GPy z9(27({^<0pWsRRvN(H$2<#XjK(W@h|TAb6j7s_R)+J>Hf`BI)BwE4&!_e0>8=pr(~ z@}I?QxyGZl1JzdeEH2yEyC=%K3Z?pdRWNY-_u(wDo;;d`$b6@!Y|_8AZ+~3|U_GG? z{E^cz79zku9@u-gNKjUk_?1CRuPhp7o_6}qC&~Me8NLt3trEc9d(Bbth0LAHcpOv3 zwN@c592L?cq%)l`TnV|;Ndn*zK|X4)ZHEc3A2{cSqUu}mrIk{opG%`0Hv~%E$OF6} z4_R&V#E(EvV5`fE3->F0YXTd&@mwD#lJP{rE8kr0X9(g!4c{=g&V<71{{3*_?j z<#V<1adhR@R(CRSkyfyg1bRBViSbB?Y1r~xE0~x%iAiX>sGF!u*l0P)a%)?g@$s44 zi1SG3YQ5iD+IVoAcqnLS+PEs}$UBNE^D8^cO8fGgnebG=qtPS&IaP*hPkk>hPpekd zJ4J|p&qxGK#2!e#V&>_H9)oXfp|^5%E(8s`7LZgB4EGj$87Rv;Nz{d6Y4aS4qP1vU zXxb7m{8<}Pe#F50JE|zi-pD$haIMNz^aF%}5H&RbzDLx1pch^lE%>a>%a|Gb>DpN* zfYMa41QW!PQJij06v^|Tb0{t|LGsM8EV9$mm8-q}yjvqKF9+h{(&bavV($=q;ux!| zC%JB#)eccrAavOYDdum@kOhIP#dnz+^h02$N8)BIYF3B_<%6xY0JuH3v=MO#SRj#k zwEXIw->7teU6Tkeif;okA}(o>*uxVW=|(Bdv>;Kem8B>&+URPe@>IOHbiI3j0)7TE z9zN9|^{ns6w`)1YtAHGGsBPc{{|Wj{=eJE&zS>l2Z)%4zPz$F-#obpbsDPXUaUn%B z`HEUbH_*i0;8O6^y`JWaS^c8cjn}=GH2iTJLp&59F)KXl*$%B->8kn3y+z z{tB1tX3LA^D4cD4N_s2Av0@X}#!QQ7i9Qq3)lP=5%~C>7ZBkq<2S*Q4U6x09_V7m_h|`QH0*#$~}ER zPdh54e`Av$Qh_*rr27X`!V9xZ{eH?I8#vi?!5_4i9EoZ{%ap;IIyp3)VddX;z$=2} z@Y`r#BpyNI8;Wd058DcnRCE=}8plsl%pKNsAzpbcqLm>mz5>HOA8FGc#YXG#tTB75 zan)xK_b6U-cwQw6`Y-T+Q30(%)1r(W!b6AMXFl=NN2*FYI#RQiQeLGz`VpP+c~%bD zMq?L=qP}BnQrZ=I>kLOxt3oH;1Kya9QgIBmx377+IGcUJhr&-{nE4>in!H5Q$by(P zXWlxBv;LJVt0oJI^7(~W?4@#$Dr+6friD8)BZ>mSEAI?-Yp7MctKb6JHwxkt7Y^4o zeaM!C48dj%)|Wl!CEmZP0^R*|{9I7e^%^q0k-ZAKDB9KE3VN8_zp(ND;qrZu5_MN$ z2mUEX85M73^+l7#`E?UW^mQ=mx*+J8jpKh0Vsu?N_fxY*GKi2AHEyFZ3uRiPS&0!F z2sPp4gZrB1sR6J1`sa|QoQ!HcG+X)aG#*hcGwd`>(KbsDA5#C5mY*j#S;P5$p<|u4 zdEYkG6G@9+73!JHa26&nALbK!W|>MJO3O+?EW7cWZmgH-NFHAF-?OMBXIL0v#bYO{f56Ev!uE) zWG%Odxm;i|`82@TrriG$OMk>;XzX&B{8*b58)||a`GdKe1FXhW_^c%l=5kuBpXiaf zrT%51Rd4llw}Pn-YkbSK-czFV`5Ye+65byl92Dm_pHqzeg1u=l0HsK_&Vxfgx-ax) z_*@JI5Nfbm%Z|y?z7M3Rp0m7MQ!SpuUe&Q^+(gv6@&)r1Nf<^5`l?h655VdRVZmw( zxAh|?z?mMq4L?4>^To|snModUYQU|8=qzhY0R-1!nmKE6i+)MnQ5|m?@TI}$$GFW! z8|y~pill>6b{H}nD&;DWsnbRe?3Dx(H{l;co329U`)IW->LkE7j1X;f&IASS(YC%B zNlb4x9P^7=WpDWq?ik5?f0yRRz##r~#cz?~kAmm9G8K}GG{&_nE?kftgQDr|BizUj zXr1>w#FxaV4rXMiqQwh-_-!-r!Byg0FriN9+!+nOOr7E0I>{(`WODz(csJY$xuLEm z85LF|(?Hc?o}ssQ2a5*%19I(YYGEcS@wo7r-3 zLMpQZe{Hito1%p53^x9Im6H!QYYh1o4V`oMWyJ3v_j6!U@HZ5NfS`8>OT}Mfx#5MB-LO1-vnJ_61< zj{5W2P}NQH{I;c#j%cN()iXTXA1vWgyU{f(1h9TD7#8H`_*92Ret4LR1Ar*|tz@9d z+0H{kBaIW50z^O???As%qR*O@NR*_yeV^yP-=a2mexVy^{eDIOD?la<7)8m#OJSU> z55)L^7)wDmEXgpJjy6Xutjsu!CcqwQn#T7pKwg)J?B=k0PhVfo&ZZ7Cl55<2o+w>Y zP5@9($(k0FJQ(MjOX}Vm{XG@?6oJRFy`^&vk6*i5}DIdDgk-8PO&MbnaiTP#e(%!zm@C34E5w~ED3_7 zZmgI#TLDvm?b}KJ0xPDhRpY3-P#)1t76}FBo9#@8zN=14SRUl-0$ZI@YGAW8fW|0L3BGih#MO=@4iR65OZ~wZhDiG@Y z#H2|GPJL9I$o8c-Y@U!tMP0!>Txd!64t0SB2z)MhJfvGA`#}&bQ$FEPd6)#7h__?w zKscjMpAE|g5r}pGqsm&Hos9AftOX2|+rKzMmw(PukS}O0pKXJA1u~5gXpSqUxXAGU zpz~k}_&9%N#jKtWqj}hr9%96H0zKF%VQ1pRgP5_z7cB(HL!!Ra5G0#IWCVm9ZM-{p zfnJF2=GLL(mkO)fxsIK^f6o#>7ul9Z{T_sxvL)gi1g4(te*!narg9cIzY}@s`o~aI z?BPa9vhFoyC@QuM1(wcSDUJ$@+bi127aNMrB6V9}qsFAs6ImBZ zba~L7SDWjco}hfX(_I4=p?aiu?UxYuW>;5Ti-Uu_WI}6;U6j1sctMBwp@e)brb8$h zAwBU!fLz-FBb#bK)iozeCKk2Ig051Wj<%LJ?iWMz=K zTd?+G8gZiWoAGj*@b7-wVt3eH3%QQ>V!Ec6Q&0RK$%Ihb8Qryo>Ijsah!hKqQXkP0 zilK1dnudz{+j_pC7zvTI1=)ljd!wYTqZM@GQ6WJ$d)KwDw^|zWfBo9QQx~G*-_6vl z%CI8O*eg~o%A3T3fyu*uV4jSYaC37_HWm6L5#aEC`zoY*d#f`G@cA&CuB>EH@J(x= z{wVoQgiJ`_hlPOLV>y$@=da(#x`)QOcCt<-3$=|F7Lz_`jZzDV&>WaF;CQPvp-HTr zxdf2xzO>hoM9(@wAj~)ZK4L;*e4{*~HZU$nJQ8|Z2SvHHGH_$t|+A1*=?jorEe$uQhXBh8KJPy2OE?f_+u z)*o?-Ee40fQWNN#97c2&m(^06tm0@XJ!(&<`%=|5Za!8k%HBjDLMK>aY` ztTZt#4&9jy{BP-MT-Lv#LN~;1zu|-&&GB<-<=rEOLppN-Y(giZ$}eNxP1f=0;+Qj+ zADM)lMtqCEn(s7+7Qsl!HXtluOLsro7~wsn>MSg3iUNiFg^EW>{0I=+{*H_nAtSF! z4u(I?wr+OKqmX;5YS(rTi}u3hvjuQ|B%OEWQpxb6<#g(*+WubE9<)5TOz;jO`uT znqedaeM`k@p{>?JD+y%TYuaX!joG#iq;ztA-w4x7o5ORsoZyMR#j%nJtr|H~BJE9q zKE?)`&Cx4iSf;ypoN7!OLhBJ`SL%6%b|W}Xabt5wd)*x}`3uy9Ey3Me!=q?3>E836 zk^|gA`>du*Ih`xgin%!rj=vgjEZ*ZBz}4a;hYFV?u%FC?&c1NB+P%5d`i@7AcPRfE zDhr8SvpkaAOT;M_O?2ZHy3}x{dYv7%@F9{)|6r@N{959M9e!>5qV&(K;NugkF!W2< z-nX=!N;cGig15*3H$wzxwcZvAnmxDaAm-L0VQ7zuMWIC4W zm6K$|uX%zEWvATXr8b^-SKWizDOz-)V3btZ(4BtM05r}myI*{Ysd^w?P>C^el)$(= zhTS&>Fd=28a+2H2OfV_@w;ZEvSK4&8^qOZA6rHRq9`Ly>m_%ErvPzHZ?_|(y0wHht ziDym(6%dVLibf9+obrtnVnpatjcrZa;y7e`}6|a8fpR2e@+~J(RG05V{$CO zY$9OEqsYLo-b6?B<6qiD9(PBTD~H;q#mZ6qOFERnY|f>Q#MZJpSe))81}tOcba7Zj zs}um&wgt?_AXzOipy|k({K@(=Bi8{IY>i6(aeMBFLe|qKqevJYp#>n3% z=pT>k!#HQpItp$Y7@70NP2bBrO2(su!E46VUKJ)Q`3FmFU;^T7omq~u>G1>1-e31M z0jSPkDLmHxY`i;&8AyF%(6~b&>mSeOvXk(IMsHark#ke9QpMs(>hntBhA` z{!qQRGNkGBV_7NI?X4GBA`E!6qW{AyB{PVr>eK*#rQE4^N05l@Zj=h)OG9qDmcaiN zK}0>gC&`<0xTFcrVgU{`1gJx82JSp^Plpg{OSdsDsxN58V1G=8%h|+ijXk#!awLC=0hA{Sr8f4n~A|w-;m7( zxPH<8+3XWNkD@Z;=yw{zcTGo9{N;h)xn&KWW;9G)b<>iBZM= z+n8-Z{tE_T3`pQVAGvLV^Sg@pM3))WimOT&&Y5?0l|nEIVaW&+0PNsLF!NuOiMvc< z&7YOE(uEVNRpvw?l;Tk#ylVz`et@okigSeblTHo9eT(x zXhcMOO|f53@guWHa)&VvYPLI#!#<3j3@e(VF(pwN;7vrC(jw^UASHQV^k&ialdU0# zAM&c+38Fx6eE=Pc(EG*VcmLB!6U0#5?_EMZ3~oE@ES+wicLq_3hdH?rtWJ@xn4hR+ zO3>n>Z(~;R0(uh4pQZl@-M(OpNumL~PC7+S3`JsIUbiF-O|%xgTw4m3&M5Wkdt4s2 z5kT*u{b>*kkbZEairbSqhaK`r)-Q?=LDruG-YlYuvV0fMA=D5YKbzvuXp|q}sp*FK zH#VHCGGA`t_Y1#1o-jMenTtXQAL)NZZa41knjA=b4W^rqpJG25a}i-M@hb~Q?W;hD z;5DELl0zM#ULJ{!A_>y4A1W z`K0T9-V&*@psPaYqo@Ll4?Cd;uvPNTv7&OpvTDfG_EWH}Z7!aY01^mCW*ufthY`(< z2cy8UQ@HK}^6*5iGZhuxdaw46GGz$Yt%mDLg)+0|!$t~;7jpxb^tCL-SVw6b8n=un zk`M&+b*LRklFIg=H!APmuIrLMi#_w=mE2^hPIB3if_@?kKc+} zmf19zG2#yR)EbCpDgaS%Aayz~om_TJWYcwPJ`B?)?e$T$wN{e5{2IIestQqrJo$~l z>S%6a_Q?%FJ8R*gzr`VZzLHAe_W|@px)Ajr8DQD{hzZ{4JPw**j5`_a$rCX8w}5B_ z&{4pZEyS4ZF)f3dH3@%D;-zs>W+8AEwzy+(GQX`Ou`_v44`Lz`Vkc|R+3kn@KBIFz zNx_lez-1+W;h?BXvQ%puhFCl)ZJdzJc^pNx?#SndzVCIQ(^m3Gk`LrSEd3w+5bNZ? zUX~aChv);!Hw%PnKfBs;Y7C^`%|*o@U4PkeKs>`P1ym2`dnn7Gs~te1^!>Hnnqf5NZQ`$Z)ZEVf8YD$`$B)Y{4}x6 zHc+wI%{449Zf9_$1J3P$)V_+KKF(cIKPs_Jy=uAtfk}(qa;E zEZkc!75%t)Lh=lP*7;4G$4rEaavJVZkUG+l{C|M5_VC<_0sJh5>JWhI6LS~B#16Lt z%+!(>q-jkO|7+Rd{ZTdv@B$O_vr(jX&sIp(tvH7Fvs8&Zq`fh5A7$4}E%TD}J>z!~ zIsleZ-=WOS})O8Ox+^NA;b9 zjT?l*&)t3NIwCJ6^xPuGGC!;!k1px_KgoCQvz|58dJML>b~ozp>a$f%H3(WNZiiSQ zZy{gVG<#essQjZdx#NsWiyE93F=h=1o0e^l$KR|)iMpw4tW|l1E>;H7CJiLJ|KtZ= zObK|dH=7JIMB>QwaJVD)E)V4 z@@fCFUX0Gbs>I%^))f&`^SUKKA)%2Lb;Jr7J>ytRD*vIjs8r^Uu zBCpVl`oF$uHwLN7uC^lz(OJR*hl|1WyykC@nz>?W_L{|fQ6~}l4-u4p{rw)xqDv3{ zRBbBOR<)RbrO~P zw6AN$TWn6^zv1YhN|tkNNc7S8V-l6d5p~y2@<;+PsVMr?Iw~Dl)6*_cUA+DUjF@?x zK=lkn-XlqG^=k%Fqm9SFBHcVxs5a!?*OASB^CYKC1d{yIkD`?AXP4VCu8if8ASf7z z--a4jRTP6D*VH5XG=bbEI1J*dMk7ZZj^JQt;Xm)|{iBHOYtIV4j<+E#r@1cBmfy3k;}$-mp@ zU8>yG&tGClCW1>^>&bG;Q8y;JQY){2BSF7>Ssjh~n|pY&@mmlyJ*VRHi#zU$5(+?;)ywj+WQHb<5O54%_Q%yc>z#I> z29(T~7}Fy&a>g_0^)f@gl0cKjQf}heLa}toX~PYOU9>DI9=38+=_giZpAWhAK+x1R z3oZS1M}L~{`!oG06mpcWov8P$Uui+=gELIK9MGE32;2{&2j1!&8(bG|M9X#)we2ZZ z7_On}6Dtje9n^`fGkUq|kbuNE@L@@0El& ztr7$(7L-F1rG`5SSfSoP;x^_TPiT8x<0{U8TxsWa@$>Y6Wz5VA1$n`@)7#3#Rw*UDq zxJrDtUW{C4iC;&fpI9+}>fuL8)5|? ze8{6iL0wLjAS@Zo~BsBAA>Bf%wlVkOdQv+V``KozmuzB znCYpA!q)y@Fu(QZQneyaGyVpExA=QBt!j7TGoOWA_8(nu-L-w$CFdYJv8vFygpode zc5#wFgFh~|LjTNC$E4c??w8TZ<4~g*26iSu05s|Y7xAQ1^bSJ7~ssee!Q01|B;l$N>dF_08 zJVjMxp}q<_pIrIe)ifn6RK2}K`DLv>=Wqd)U zNOFdo*N<|EVYFdL+gwD{S!+;#ntB&Ph|=29X>xPRj!1x&<~Gw+87f#f5- z)?ZxVj$p`R+F{LI4qaG*A%pBW}0S2+EYr%g+qz- z`$s2U?OglVSO#IcloK*}jGob(tgeRvEb*$qS{704DiDY_KWUfq&h7&a7 z$j`duGBo0gvJZX~?xF0=waV>L*V94Sdr>vQh(G^=&6U>o)at~4A_vHo=xW9d)=eL; zKa=Egp-Ccq0#sl*o;9SDq#2RC8uc5Cu#Zp7ia-$m zi-J|9GW3(xLteUoW7qmov(ZANtAYMOPI#zLj9OFtBu}<)Q-{{KdVOp!p<3xtqn1b| zz;$QnI$PfZB%&++26^9aRS?HV8}jr8ptOPh4sG+Su_9-YN8wDG8A(f!lz4R4VkWcS z?C-W-75E3JPh}|FpPqa*Zy^@PVi%WSc*}F3G1`oHt!CF2wgY*>GN8%hKKN%v!&+Y& zE!{|fwVFexu2~9qAL=e${xLU+*4!CB+0V&F-z6AZO0G%B+Bup@oBs!4K%T#Cc2-(p zYfepWX<|oNM{rR?LqS(?IC)lOMQ0EUWm#n4A4&N9ab4-DY>Tx9h7+ z?KL6yv|?l+9gyM`MZBxh-3=KWD(lgO1i}?V=ppam?m!+GX1-dN!!+sUMj3HC^WCx5 zM#q9TL76~o_Pdci1pVS=o$=v=b0bt(MjmSIaBfdNL638NR0BDfzLvK^?AjA7+cQF9 zWu=>LMkh1K3>fqsJyKY*y|ZxmAx@*tOKKzb+*X-A87rttMk+L879Jc|s|+idpxGF_ zP_XB3_~G1VV3bpuM6OtBMnbhFD!(CiX$q+VPH#KC*c^Sg^Nq7L7W9RF19}|?Mnhi) z)`s#6J|gKS?e;qeyD8=W2{b1d`a?`zI~5-TMn~Hd?e-`@@C;vJ#}fsy*!pi*eEcLC#ReWEMp^ZqeSYA5{8=wBO`HTtG&dqb z=Q$y{Pow2GDNkiRMq0H-dOqopMt|_;bdv2iIlDa{@C?1y@L4`Hf{HXq&|*71Tah+Su-?=~uDi*9`T3L< zaYCm}NNb=}MwM+&jr)BIOw&3(c-t6JmN~NUigfiNN_3Koq5rwx_<>cq%+0YFj5nsPa=!;&gjuWc zMzNIRxDp0d1eRAj%QXf!Z<}=*rFL|~-r=|!$0;`oM!~f!Un*Fe_MlO-yJFW!)&Jxm zPjAGIUD(|gX?E>U$hY<$D+nkEwBQUM z|L|@-M(8$ud=DejNeR1%3%ZzBc(8Wr01!+bRclz*hlcieM(+V8VDlJO`KWbte&BI~ z+?%QQmEENG`NwEi4h5s+Bn*# z==v$Oeu1p%_kgt=X^VT}R!al)j&B%Fh56tg|t zN8b}vg>3QEePo>h^#QE-4`q^$P03DgG5675FJne5NCRbhh0WWG;It;8j2?g7XYx1U zrjq=dwuV?Cg)Bh>NDctM1_JpjCV(n=OO1nech`DKy#B1#)w%h6PbS}9NFz3WUSppj z)pm)fo$EhHlybWe1bSz6XIP??+NYltNHud}v>S>6=X(Dalj_$1)i&_Vwtbv7u ze=MBINH_m{X`-Sm$Bk4m(P_v2e2Cf^rziWwW1VNKKjH zG3f~WU+hK(5a-owmKCZ1HJeKHsnch0SALU6NKXYC?>kUj5y3XuL|@CG|K0Y@G1?!kn5)NM&;~P<>_A13ZTem;T|4F|@Ab zBnX*9NP%qM!d=LlxNUg?dDCRozl;{3wdJ;ci4XXx4-TVvmm3G7)or`@NNUozdY9$&xX_05o zGG7(G*+_1~-?wB;bP2`@>VdWyNU#G5OJvSw#_ywvxo)@Po}rISh$cPS%{Oaw_75Q$ zNZ7|-=(OHv!d|R)WtNcm!5csFKCd*3iK5{?g_x}rNZl5|D$=8$N+X<4#Ef$U%XX!5 zh!?q5Y9(3a(L8i9NaganZ}xXEu&hS+1QGjPgKUX`y&5B*=I=!g$130mNbq0W>vmnA zp+UM+eV8rW?|+d*WY(%lya~(!4aCD2A)%w6XO(p?2S0YaQ0D}}T%7B>5Z)WONy!&1&H~3mj-k62iG=Jv^^NUK zi1DxeHfdfF6BfgjN&1NXDp};!7--SVXtfc(9!6y6%}=o-0M}}LjLnbmN&q_Q;)OKY z-OPp^eLj)3c4#$3A#g;_{Pci4?H{~pN)R0S@-pwoSWkt4l?YHz>hv?bJDl-2s^4(U z(>{g_N+av-HpEJkS+~U`WTuQCUG!DtfVFMl$sbpKXAk`VN+@Wv`Ob}Dk^}PMD{u90 z=ROQg@x-1$JTu6A(iYNuN;$IQb3|=z^_i7C3kCtkZ6;?jGC+5dONywT4pcV~N=ie? zZE%Wn^Bjd7{N>v6y#@$F*C^pL$}mmZb~TD^N=ninbV%bEJQ%n!PyWvfI3So~Uj5Kk z;IDjBB8#LZN=#D2VcGpY%2nc#( zMzVKaMyPB-hqtlQqHDydAw_FyN>D2WIl}g)uU*5g?W3S?yX2@pxlnld62UM|5jz0j3B81wd;qN_~OfXd{7r?L~5PcO%2$ zk6D0z!mK}K>lHGuXrRA8N`+bUeTXtJx`8?|FBFFAy;7H22Kx*WZ{tfiLV>AgN`|J~ zGRG`9wEqR}J}TBl;@G^BJ(Fq&sk zy`4&J;>CRV>|Eh&icp&hy*BkIO3m_q2n1?hBQr8_f-oQv_Jv7_w^P*PO zVZH?R+b z0is6xY-^V2Z|7h*LBdFmo=I5naiDh*tCK+8OD0t9_{jwwN$E6UYjXU)Irh@(oj?}w z>{qfSKVP;?OFlz+>&(w`Va(}X+R-{`fF{%)4*~KXzQ3zJG50=3OIfZyqvotl#Bhb* zaJ57pd~5Mn zOV+55!A5v$u|p1=mE|qYV#fepSb6c{ZO>KwU*jwDOW|ATWm_Q?*GA;K--<+4daP;y zem$o}P==XF_Mp$hOZsa0R(0Y6IpsT%3oTEMC5-7zHe`Nw9Dgh-+AqjeOa7r9TN9;$ za^>2x80|pxvqA|^JOFH_2fZS>kk>;oObEwEFwETLIAUiz4%7eDdu7JMG(?%^Q7{bN z=eprmObP>?-NpoXPucvfsfe_C5uPDmtfs!)l2D)sJO@>1ObanVs640xvLZ$_ObbVHpEpT5EquSbj*>4@#TA?r2?D%u>~SKSaND65OgU)> zs+t|=_~8ySoJt31qHewY1NWQ(8MXP*isu$LOi6#Ziks04-@ zxekgQYihYgOiZ?f(#MJgF{|{6kz`zh;aVc|Ff9S%>YLaS>{OpZOik>fO$W86A4RMP zEa^H$`*M(IE*L>C`xK_p9tMeXOip%cE_G5C6Q{zf|EkgL5q#|YP_qx9z@bQRALG(Y zOju=0aR}jj432*#QogFeXnyUe?-09Hac7mcR1_atOj`l2W|nA$?_d(xW0Oqu6>^C+ge-;%+k3G3ExI4OtY>!GIzH@Kb!K|z>=zL;n3vU;COCTOwS73XYGFi zOuY3;NfR=|{hJI4IR4Dy*`iP}R0AS(*3R~Nv;(ToOw6vk0V5+#FC@!GrF(z6_dO`5 zpSBm2L>*wQ>V!q|OwEh)4(C7K^eA~)GwCm06~zHeH(Dr;SN`s+pQWS=OwzkF=L0;t zzW6iJy7Wf0uya20WP1E=hif|UVEApxOynUq4Dcm=hL#xYCBr1`Ol*H;D3X_>!89{0 zAucrwOz4y&JLNg-Z5UE>7h$QT=oe%lV3^cbuj|;DmWsYXOzs+w)4Zv7z=k%6L*+v- z04?}oR5X{YRpWt7Sl<%GKbv}uT z*CM@}Z)RZdO%f8yt!FxmB4}Q0z=#^xo8x%)|^xd~w)*c`IO&-Uqw+a2IPWqj1T&+$mgYG`Y{wy~C$xJr~Hk~^9 zO&-U%)r|6>%EPB=Mra-lyo778U*{e6aaL=tqti4JO&-m>gxB4O7L{9_zQVFhbB#4t zfl0O19+*JI;Hmu>O&-m_EeRGG5jy;E=Xv1v&Uc>I0O&}~Qn2`5fB(K3dM==q`jTX6vQ?5n=ZA|q*vb9`+O&}~Wh1?Q8mnVLYO&}~aPx6saSRC5swzC{Q^umv6PanAIFTi=cgKRO&}~)dcyT%V+hwdVG(;oS>DuH47q0u z^cO9uGodwgO&}~>!obyn)YN>*|0S@$MJ+L+n#BA!47X?L_vfl+O&~H&m)>Q!N^f0j z#v>tSUKFK!im}cm58otX@R6gWO&~H?3YZ<|ct~)!R}pPUITmV$hD-@tq83;sTzK*j zO&~IU#@<5+rD=|b1_xT<=J&;?<8gnU00o`T?d)B7O)M*(a~G8+d*z*4K9$76haI;72BD%nC|4F4yo<<`#Q$4 ze;K91O>*z}>Y4YAEnU*)><{dx5LezF4Yzj;(bCpSmA{J&O>*!90h)2d&K{BLwyH;Z z66z!6+9b?m$<^&=nDKCyO>*!9zxl`UFpODwa#Pi|CVBMdd`qNY)MGyjh|Td>O>*`x z(rr#vwFbegvn5{fO7XL`wkl$xvt>!Pi)}FxO>+-Qmg;g322-++NNvsSij=JoxncVS zfu&fHej~rBO>|UtO@@1sQMO$pxXm35=RS|o`YZ4hA~R3es*-QMO>|VWaOT4tE^;k8 zbHC<6K86YtevFxe<<-(@7Br7{O>|niQxcqQ>84TF6s^0gT~21LFHz$z`?Z+2<8@1l zO?z>vQlTWHc`~w%iHf1U-v(36aJn@zj~1;P9;xG(O@(!riKq48umj*A_Z?>>W`O4D zzIrm}y6i3bPf!u!O|hqAiZA33xI!py*Oy1P0GnZX!x|bV0i>Hb8`>PWE#H_U@vB{C-e(> zDOyTkP0T#dbVZOH*-+U>izQi00P_yLyhB+9jqLXuJrf(BP1EG5@6MbxhbL_~ zSvBrUzUrH(u>XWGN<}{5P1P*QJz_~=i5tk-|8M>+4?QAQm7=H)H!S-M!j z^gy%<<1)go?pwIYpsB}QqHxKK^sK34L+dKxP56%zX{csUv$Ab>p@^C-B4iv;*($2S zTVYIYJ%Fx}P5&2gh^CijK0HfFePLSSKR7MOFsR5gR3&rdE-E?fP6G+x+o_|wtmf@2 z8EaXmC_88iAfqBk=og(?7;|EFP8Cp+0A~b%hN<%pd72kVP>v!h(W%*)^@is2=Yq*H zP8I$gTg78kJJi97p1jGKPPj`v_JUC2^`+j<+~%K6P8j9r-sv@b+EBta4wm?Y-XL{5 z%bSP`K8;oiY>$N>P9S9>zr9f5^z{)r!Y3YkUSfo6%*PE@pTG`fQY7tNP9nmV)hO3| zyF=P$l+4F3`?QN87@q``UD5PAJ#b><;dqAtA8LV;BhL+^?G)57GD|Hv_{V z;bDr%1oB*AyKV??6|Pc`2_GUJT;;L zjC4w5clJUB9bGM%7zfr^PCwbbF-Vv8o)Qi?DMwx6%)acE-(grkM#Y*q(&%nlPDQSv zgO4Kk`A2|*lu-7pFe5l8n{*ILKoD6&0($`iPDZZ+{3x1fn$I7y25fP`(2F`%r=5L$ zQ}SSMQsOR5PDtl*v#lEiob>u!h&$cm?OsWw?+@wB8tvpb`i&(!PEt0sC7-?1ujpa0 zNo0F$ViE*bYhPGXNEQ!+36sEp(DTP09lR>Z;R7rJYx&^RVCJ{yKu zPJS-)?>ZmFfLlPY9uNs@i05g@VvNO&Q~T%k`^76hPLC_<4kG$CE5M;|YI3Ou&2B)& zA1TjMO_J2%R>eHDV1AsY>Y9;|GpadOMzx0uum|PNR76&60&h z9#P;7E@*`sSEFWPnG33tCaYX`G~ib^PN=PEIOav<5OWs+eT%Xc)F(eyyz{>y%&Elo z!oOKLPQM@n0D&HHb^6lqs7iOK9wDD29K9z(M#{6)>}LWDPQd$>-@=N0Y8BJ4FnRz$ zNU*HV3nQ~Y*vRHaDGq=GDYV%>n*aDdrd#aMM0MPVGasfa`1-^r*^#l{!4xO{8PX!c=+l(;6KzoGJz%S5<@aSg}>2b~a&dPd-8m3)`-x z_0Vj?4WXn)=jc=UQElC$M%p8*e^3v-Pga)gbq2i?s(W{SA9V&^ASBD`EMa+Rq#!w( zR;a?gPijz9jJK8vhZYQan{u|8_z3XHoe&3abojPl1F-BF2jw!i`jq0!x;l^M^)p+qCJ)q=IzlUcFvS_)nnZMBM5Po-~F z0xNm>GnA^!E)4@1fi}(H9e`SIBIK2wbclCOPxJxY@TK)RM2-=ZacvF%yHRAC!=0Sv z2eJ$$i8?WQPyj!=H~7YuvP!!stgF#3Se9BT$X#;lFyzt#)SKg(te(KjL zg0OKb)hb>CJL9l1P%qopNP*G-0IInv=K7oFCs_pPnpX9VLaiKjR7sY8P%w%jNDIv_ zrKb(VH*q1$y~i&K5kSRu>eObfsxlENP&J@N1oo3Xx`L6SIwU^bt~T)sEi-IB#_skgP)Zc8HfqiV?Z8^8h6Ws& zh-rDlhlPJgOIl~a_8{2NP)sbdSyMc&!0FsdX!n!+^(@F;>NX2H&1{9=BQcp`P*qqU z8uICdi%ceBeRcvSW^=Ycb?4iE+;2yoU^W3+P+Rj;CdI~&?eH-oh6CLpYt%&Rq63ca zL^#S|;5k1@P+ezDoEq&xmo;XuhmUkAx#(9K;aM83b{cRzE(VfgP+%0GFQ+Ssv9!*K zoj~Jhva3x7{2r}FW5`yz{NgbfLYyDPbnEZk^c5b-rXsB>4~GlsbnS3+P--EYQTmTC9p$iRXh z@=`$3E8H|AK#lzG6(p~jrZWDMw$G1MP;;V%d+w31ShS=l^;JATAVtJD>#GCTYYaX< zT^8*TP=HE-#1Z=}Gc6HH`v$e=_YtaauGnBs@$g~!YWuMBP?!i}?Oo>8lMkr5^zS-H zg<4nH8YqqoQmZyMTag@pP@@h;d!pfC7g_`$@SbNn3SM(Kl|%txT{Sn7G=ByTP_7@= zMw^Ck0uQ!0PDj|@NH&1=*#GTIY=A_4l}lYiP_XdrG)?wnEkRecW<0-F!UD3LQVQK0 zS-ZUwLmO!~P`pi#MpCCzZl1Q7L?E&*Xu%`2U*p%bKa5HF#4YH2P`-yVllkNIa9xX6 zH!00Euz=G0Mwzw*ph+Z&3P~3&c$#?98bvgJu`VmMikLWr969S>cuRrzM`e8F^QGYe8B`(|w zi={eCXSN+*gFttVUeP+An7h`LJ(6`#QHYvthXzx-5Hr(SU>Yl+63JGULFT`$sMhqM zGoN7hQILbZ9PGWCl zy`;(IRu?c&3}*SRbR>h=QI;N5$=GeJ7<9y6NdL{1QJVvL zf>hs#@erp+ompbM-Z)gwq7eHA%2ULKow3HbQJiqeRO7spXzA@j4#(FEQsS^ar#q}f zgCU#uLeh+^QRXSEUXDCeAzTM_@5VT$kUQwqgI`DQ6Z@TqKeh^KQfRsmD2lrQng)0{Uo!(Ou|}G-S%e$)YhnO% zy8!!7QgM@glQyv|C;_G^IMR4{a+-OE#|3u{Um3vUFZ{+#QhqJ`T51j}dj?laZzmUP zQ%bf?L0jAUIez&9yModvQhzm;IP#EQd6*=nP&DY?EhgbuMxsCI@iKmjeMR!zQh!)m zGHm=Wf~>nf{10OFa|qtQQ2$L3R< z9*pEuUJjy1Qj9Co&NA*iQ;5LYD{2uT5@&RJnhSef>tC4(WHQJ?QjpD~eEteCG1%%v zsD=dJu!^K`eIf4338uFLm8}mLQk)eWuCOHgpk<|2WIGuGi7n$2eL)KUZ#2gg*~B>x zQlp6Y-Ibwb!M?@qK$a?|`2t{^s7ew0oiA!#bstcAQnF}XL!|$j=KnNy^1Zl2R{uhJ zwsE`6q26vtXo2BWQnTI^VWUR^GYcx1GdlgjGWQXkOPVd;yfW+1rv9D+Qn+QjXGHBa z6g`0ObiqW}O8m6GeXE|fej*|^W?%XLQpGPz=Pt4|e*(mu^a_L2<)x+e4-80%b`e*I z9OpqnQpZhSQS(g+$v8jvug_#DiiH~|mjZpt0f+xZH-{N;Qpyv#Q-i7`;5h|(F{$8T z`=dcCEh5+BIVf-K)TALiQq#C@J%0|@L#1FLf)SSLb7T!l9-$Cvd~hSj32<)#Qray8 zvFuc?h>0MeqS+T%1ux@z1C_R1CXBZN1r{$t;C&C)WO{b6vXzd=|!Z zcm3a{-w*vXQs*D&&AA`*&w}Y2Wrs#|z*y6=v@h7V}yPYb8?R8b3hc=*AOx-@DAg>`w{gV-hYwX|*c&(2qd++l!#k4p!fGAhhi&a{ zw~gVnQ!PR_14VlfxzKOf5j9q_q%U#88U^dxB-<2^iTN}tQ*FvJE$FI!+-MWg@@XjL z9ONgT#fokfWOd>TT+3KXQ+;v}fM zE2jY7SP1rN6zrTPVqgPFdN}coYjn##JG9Q~}MlE)gEpc(^F9 z4g%*dS}~pxgEx~IY%R4jzT-I`R0B#Uib|TTPHbh1r<>d{Yl3f6SF$fYt3w%dc)Oq6c+AK4mIr8y2rsR2iiqbkEOQ zOQtu6FoY8!CjtG@6mf(F(5r8CWEQCpR3H(=b?#vR4pTp0#s6$HdzPLj^F%Sx4>27T z!Ah0oR3Z3f?+`)bM)0??LMi*A4gua{%#u*yI}kjLWSVn-R3e_rOI?xUS?6cECAQEr zQBk{>nxV#ch@Wq~lCnQ>R3?G(-pJz`z2TNwNROl>*x-6()Y_=BZdpYaAA7A-R4T8# zR5YV8e%#djH!~ntN{U@Qg5E2*HJ59c$O#PqR4f{@yMk&U^H2-T;rADrgNmM0hp&8V zd?KfxrNGfvR5ky7M=jYRVgJ;dM`t`cU{o%gvULHOQiWJFJRSx(sMdinQOkt%ia{k7aE}k1R9=8&_=$=s)PWuevIoyI0_D#B@n#kHSP#vQraEFyRCN7ELdA84 z<<>UK#Ovk|kOW#vb;-;xvM?hJ0@ytVRE=8DcO^`MOT>kk1SGIp*p7IGazUf5nW?<>X*RH*iL z&yO5ysvq9)a!sixd~ATO@@Kq|8jX7p0~y&wRHqfXURI=6mGD$H*z{ zac=9@Ao;@uv57(?RNxRivsJV9^H&f|OzKo;Sqb)sst{^UN7q5$-ZkTPROi)y+FqK2 z@Er&gPX`fNQWR4+WlA^d#smxJjfzWfRQJ~Hm<>mH(=BqqO=xjregO3I2)PMOMru1u z7&ri3RZ26oV!Tn zRu8>(v)h*MapOB-U=BYwsU|=OhuW&HI1M&7l$-}=RvZ0s?nBB-({wW{U-nToE~`oG zIwkyjsrh(IR|Km!Rv<35y?@dqf2rEP_XpWSCq_@pb1(Z_5J&%C0eas{RwHlpJBdva z7r0sIX>hkZn0M%+{Ne3%R8Yv+_dSHIRwmU9Qq1F<&gn=V-0RDE@duT2wyykX(bMhZ zHoaQ~RwsQX7KS=?bThDHE6X38pBoz|`x%1sW{oF;lqJ;yRxfG`nVxOWxFE9R-BQoL z)2cDZX&GQmj+yhbTieneRy`ZfLQw+CBDMcq(P4SW5@amT0x!beO;(+{i?MA4Rzgwl zBD1}(qjUE=+0CApvZ4P3^~;JlAekm1K!GeGR!aaZ=@2lGF`@KohuY=6A6VEf2{4d} zst`#-U1bF(R#RWiK9t-z#QGukeDdBB7qEV?)u*cp58ZbD16O2yR#`F1NKUC$X_E&o zgjQRQp~yb+7EUz}5ElErKN)LZR%k!TL9}r2pN|K_=yjf!PU_JMjuY!o9j$b=P?h9L zR&9`YgCNUL)N)Ge^yk`;)vo~;L z^2=P@xmuyG@;EExR&PtC@=82sOlE-_a7+^#*n$;zp={V77iq$MwRVdUR&=Ag%~Q$d{bm-cHc`8+ezGuwqIROfPJW-0BLJM}P0>^=Ar!m;w=NR>D$`GtT@S zm)%(;sS{X}5*2asf1ga6#Ahn1ubKNaR?%8D&j()Ak1-~mWHHi-9jL)DT(uy-zqSOE z>F)w=R@skd0YgwrrSHZyBrL9xLr-#%=M4q$-773Bh?j$2R_|46bI7%|zh6=)a6#~w zTcgBeo01$f2ldvT7af5^R`AehBK4Nj%8*e^qdgPYHuNC?RTRUfbx2=LJeQ_ZR`*VF zNJS8g2&POhi%gT5zNQ?`Oi-Z;G?4~HF1+zMR{TPG-vnTerORrZENkB%S`+Z#5#88* zcW_QH^7rLCR{ZT&&`XBL^X0+`6#JUa)kx+w2!}-UT=8;bI^VPuR{gf`g}XuEE<6Q> zz@z`J?H&Akf8EE^92>Wv>=g4SR}}?Em2IO16oq|}U5KF^u_nG{wHn^Av*TC00_V>1 zS0cS`#$Z!ele43E-%2@wLJ`?sJ(Q8JrPy=J2^t7pS10MGWziF0GLVrpO?>Hk(ib$u zL2)c*%aVP8#>zQ$SA84p?5%FXxKCm|53$2#rH^f=_uv|FmaA9c8B%X#SB@P%d2Ai> z1kSMC2tl%q^_-|19!cQH9theI>j;5ZSEHXz1vKoblo2YX^SmeBC#Y*d?mBZja!R{n zIzR`PSFa7~zeNRC=v;k!Sw1(I>0Tzs2Kb;EznU#+Fv-P!SFh?RXFFOJrcA3xSZRtR zJFV}^UAOeEyg__uTw>v$SG0HY2(yj{kvotXM|3Zvuv4Dg3EBnIkH6A%+PdMTSGP1W zt#AKg?StnE=1go(5*sA%FP;nSP4k77d;pfELCfX z%lrzKTclo?02xh5ddsc5RzOK1SPGTb^v)GHMt&!-FjOAV{hOb%gPGu1zl>3LrB`1# zSPGTcBFU%&LLE(lFZ@4vC{qX|p|z87520e=9Q_7mSP^_NMf!A3_4qA~xKrh{i5A3s zw|BFZU!61mC!V=SSRk`w;6;T~jI&AV^4t!}#d*TuN*qb#X@%Wx6H$flKkSVbUhQl2hY+73u+$xmp9 zRb7p6()}?meWJ;tfRiaDSX$T64bwOIp&xJmyO;uw7CKi7WsDors`8r7`$54(SYT|G z4hdqh&;V8#5>kMpBDZ+@e;@(SZuOrJb@E!shv=hwmjP#CgFv}!X zSaYYkiW3swqp}p%n`*qd8Lk%>)Xg=_@?!M2PbD@n2Eg|RSc`QZWVqw8)YCk~(fc$}w&6E4ErwvH2ux_a zYz0{pSe&96%y1(j0E*9Kmd!JE9ti-LW}HhRdF$`OoZG4bSe705~DJ+JRw0C3k8nSe=l`&#@6Tr~BR+y2-bT4?Na>?R2MFER6q;RO3QTSf%oE zGu^hTu4PKRcPW5zZ5?rRhD|!+*m^ZG6%og3oM>J8q&nmB3mZ8+OpB&j9b7uSg==h@C4&Mk`hIG z9}XmK)@Ao$LcR47Use%-tnj-sShLp0rdKBT$r+9~`W->AFb)=)Ze*+h>jB;b{UsGs zSiDrDDqZ;3FZpcL+SEfzwQT8U86o-sCqeVwCU%E+Si)_k>P*DDZh+*jdyfbiDAmbY zA=o^_e~F=FOSnvaSjN|*$|$cK{SAy9ww4*_T7p1K++|fFb#EF;kMc3TSj)gM*-ku4 z!itTfSLQAR2-{qNP~<^~-jd5H=_~9OSk1@phzx+}M^SL{1~?rou{wvs2}Li)*rDM; zhSnP>Sl%y9Nxbp(IZ)mc*5a?-rl7hksYLyG99!#d^3*R!VfjoT;NXCL zAQGZ&0&U7*+)XgwCT{szSn3tUO>IFHfRFFoHls$6<<3wNgg=h-OoenKC4U!0SnT~; zX#I?#+6CZA!f*3SnzYs=T0Vb{5$;;+!l%+Y+nNnc zBul%&w%9pzSoh~WO&r9t|E?r3HQN?43GG>yXUbi`iu~XYl_7K&SorfZ5iJl|fltL1 zT9BgCFsdHtB0CkBeck5uXYTW4Sp0&HgYT zSvz-|j27Q|r|(M0k!Faq?o>tDG7iv-KJ|eJ+xkslS$m+9Xyf6TRPCIS%7Vw)RR4Pe*)7x=3H~~Iu6Go+BS*Z{|HamCTP;l& z5;d?YS-((O2pe0da-4ZYFp-qm&qv?D-I7%nV{`ne!OZzRS=rYQoR~~XhVxG@XDc3p zxc3qZbT0D%Ji?cU+LcRLS@k*-Vf9>}GU>w979r<0?@YV5e1@_ROtg##8B3WBS^y)x zho#kGh=CeRef-TUW#E|&^z9>PK=E4NF1kH?S^z2jr8>zm(1D9E1^{I+Y+jvnxw}@P zW1Vq_qUY#oS`gsnRzNJpT*Cz_Ub07K&7uHd>az1&I+kngk5=(xS|g*=A=hPf@c5u* zequTW=jaF~{ajhme8=-=o)Z>SS}TW1k2=Ve2<(q4(i4WP$G@)BJZ_igBf`8Nx%|jF zS}?S-4Z+dDIUb?4X)9duQJUGMIFN~vC|13j%UV!wS~;Ziz|sfYMN*T|Ny`&CeHH=v(aA_Kx^i~s#w1Syw(GTfqT1q$74~dAz z;fS8VxR@m;9{0jJN5P4<$BF~N`bywIT2J&G0o2!?5GR5$@mB+nWN9kc|NA)f@N|76 zB%&}aT2xX{6Q z4~L2PAVy)Hc*q1HDi`7`qh`2xV`wJ4Qe|l+T5C3sA6sFa6bu7}G{}!GMs2K~{-eQl z?SKNW0##yoT5@u7!4y65#qo1P`LXCnh5CjY%>07DC{Mk)ty!m~T5^Ov(N=_9btJho8t3zo2l^G1k*crcl zT7yaEAh?DD#cm3t6YGEVaGRb2y7B;9jDEB)*c34lKm)vgT9vc8MoINA-As2RQ2t{)#nkab4omd->|F=jLmcZNTAIUtMdAj; z9UmiD-`TubXW2z?9OzO!rSttI6zJe8TCo1Hj6KR=%e>PVx5jJjYI)>0@LWTCv)GL( zg(zDNTC^x@GevE$@}-db;mXrSFX=Ho`N=a;)g&7GB23s;TDJey-#&l>Ai&R!iSC6P zzE?{AG)&?gb2~Qti&elRTD$Tbm{p7KP5KyJDK%tM3aDLvpzSeEKzDA|KTr@(TD^Am z%I?|p@>FkGEJ5{QiKXG^r`f^*KoZWhPBZ%zTEX>Pl>@FLfXiQKM;Mqt&ieLiyYx}Z zc4s}T9DL0qTEk+hseXdtbj?bcPzL4!^CzdxZ6pd5pqAC{07VmiTEtAchJ!5Sl5!^! z!sgwBv$1@?8AFxY0K`hyct=-pKTk7MZvTH&j0AOGf_2fE{0sB^x#@uW2& zG-8!C-OCD_#W6W_TI3>Mi-6uF2B~HKd?qa_*L~NMuZm3Eg7K8_zp`32TIJa#u9+U9 zpBB^THOEc-Np>DI>)BFfgq1kCChhPvTIK_?j`;?(bXTsrRS4Axbj~XzD3#w_S}*{p z+OKaHTIRp9%4pPlHm^JA%CFXPWJ$WS*xvnu#S}uYmrzzqTI}onAE4g#S7SCYKA@fv z4pOQo8s59>g5O$nso%Td=LeO6B2u9?tO36w4A-L|uxjThr%;3BEjptgnxJ zTg|ueGFd@tV_tj`-=*gmCO~Sy3W!rSyNPm61xhw=Tp9b>??M*fN%I@K_5L((A(FVW zn^P(78EjcWHk#-}TpAK-H(@As7Oo9vuY{<0g}v(2kz96ogk0d@B&5qvTpMjD)x6A+ z0G=N9(YaAezh;rsIXVd<_8!l@Af8T6Trm1syG~fA_)$N4yW&U7qLvU5_>SBbrZu47 zai_{VTrud*X3PV#KgBpSti!?4yz=(zN*Vl^M`jfz&j8IiTr?gpFV!xkadUTuIlZ7O z{*Rou_gyCMwHp@oY|0R+Tr}tA7tm4gu3QDuPB;F5;dhA|rv}7z0u$?SM+|ZwTs2$Z zZsEQlFS``=jYI0HMq0Z6gjKCRFf{8ymSMeaTs}b`h`GR(v zTvOYOJSA#=7!lv-Ss9r0>nDl-LqdUiWG;QjmV>9oTyLo~ku5y=;l9f^HY$;?H}Tz2(=n#-Yg zJHkTvIcbNmLAo9Q{6+0iB8ql*DNGXqTz744kud?*nID0hXTz!`$dKoQ>z1tQLkZ*Ka%m`ATtPdAG4x3C+iv}!WT#a%CLXKvDY~58@+|Jtu zU|fs4mEu;MBE>20ZbcSfmStJorMNrA-QBHtffkqI?(XjJ=l30dIlZqOBs0lOuF1TQ z_s>3sHBSs5_3(D3@38eozjO%CTjbX53}PDC{5oXDwRdjm42X0|^5qU~63%eFT?7K_ zU+h&l4c@2Ue^bwybqR=egdAg*nLBc4J(aeOEU5F+4co(Y41SKe+(BW1Qhbbr>jKS+ z#8KhOut*F)NY7OgEqDAU;5tW>?_DqWm;GdJ#~Z(yD=9O zYPscL8_P)@4Z8S|ZCKN@s~#S#k^foFoV^t7OGOr4GrACmEvuAC^9=tCxy11N$vJ|U9vH*+AeHT5&jCjj)W293Ag5Z2g!q*9 z1JsNuiQ{wjP&^}4zNr>zi2()Jvz@G0lk&KEtzWi4gk~x9bs~F;fPEt@AxTdYT|NIu zieI-i?9W%0@no_r_ZOd#h^O~A5!{W)>VqO^rfR>E+n+sXIBbf-Ff#_B`UKBiV)If~ z@v<0w@`H&ALVm{DI8FPIT!?xTy}Ub>o4Aii-WVS8Pu0_iHWKpVLMYop%eTEvVgBb& z~-wT(!B#AA*Gxoh`M(U@35yePG%+4|X zk;q@a7V2IB@!!Jn?7sdM%bR~(cSH*q@l`A|;sX|;OT~}FVkE%HG#IuDah*;4`}HAF zm*PjH*l~W6kwDJVN?%C3E2rG7`(Wj#9{I`lS|3q;1J(9Ajl?fSdZV-st`-Sk zm%GQ^WsIK3IbRSM6ka|LP1KA5jMNc=r=wSl>^KP`QUN(uU*KsBu<`VDdSv)h2*jyO zjkNjRs+AZ|>9xAW{a$n@U)VJTh|6Au$IgBC)mFfsM#h5!9p3!s(h|gR&wp?yR&k{R znS3jUf+TIF8jF)5M&_@zNTLAq0<=$wxM+Igtk}jsb`WZL31r|_C8F%DjjX>dwGNEW zaJv>cA~Rt=_EcY&(Od?z%$uWKIor8^HnIlr#kpV}=U=X9@i;ZF9NZkM2L9~4MV?Ot zXAV(;j6BO#epVSP)be81ejP;P#wgb_xIL+>4Z%VaNTJo4H0r9Hp&Z(;Ciz~; zs900VwDM?9ww*?()3qMqz*bgjZ}eBrE$GaR$>h5BNdX^lZ8SO~LTR$k?@XVT#aIXC!KHGCHYuijjlO;jpU+Ewl9{4-k%zSvr0^ z{&uHdL22ymVa!dgh(vzVueeo~!Ft#nZ}aYwS#&Z{>Xu=ElT21(c35t1Y zd4Fd;0^oFb!t-=aDy3diyE{b($%?Gwt~$S*#gBI-Vo|1k0>D|wE}NAHDFS1#EVLvj z<@GwTs{}qaE5oB_qY$tt0X~!p-+v9v+D2{ozW0%+;6ePlZggei_;XVZS%jaWB7jT- zm&f$agi34(|DDRvUn98K^=O9&pjqXUgw4nv06@Rc<8KU`{3rW)_y@c|i3W@Wigc`i z@hjL}d}1&a3}8Q`_2A+!-VDh>7_Nw7@Jwr4AblkWkPRg8%{?Jc2e6+jU!#7i3r2rX zH~zNovB=+|cw4T2)A?YQ6kIkW{q80{Ks6tkOV5vDdtW>T&~=7O`E!kcP^WqQQ?Isn zx1r)~p!B$Ru|w&G3?$xUN|#4uv(H`7Gn9^e?0$DQh_u-vrsnpS-kL0HizrlQb*hm9 zOt8YQI1 zhDO)J?2Kp58T#Mwl(y&aBmo%JREp09%sw zL`9O#|MOIdRn@6f1?q$mlX09SKy@oO|F3F>?`hlRB|2`eVqBL479KS9fMqgv%t~Af zph+jx!U&~z5P`4B%VwjKK=O8 z*7!A#^DCTDnBkS9IbywsOJ+~eDytJZAQ0E7fMvAth+#A0W=8mvlmns6s%pQdVeX7_ zj-7ztyT^CWYf+_l9SR$b<;5pst&qNK<=yDki2B5|Ov1iev(jG-i-17l`kl&WSIhDn-aRx@@e%+*R6HskytEvb5`A+)!@IY(#>2Pw z>7w`jLZl|+;;df)9aQ^|C5N-DmA0Y2`*gfIt8i8tNBdX7q}?UjZ6Z5uje(r3sK5|| zRqA)2VNal}Mx$E!N8bjV`k{R0eo)1D%q217|2Xus``s6KB}o0FUCu32tl8Nmz68=B zFrV$XmY;s6V%ly41i9j6QmDUeaCfj6Tu;1(Jn+@%_r`kgR0F6O3lTrQJ1e|NVp0Jy z`r+GK3;9ODV#x@1FnJBn2j!||Yvp(6>7xg?V2*cbvx;-5RK^2t4|h|}zRw;RgaS^; z-<^+>yy>GBB#4Azm8MB|N9l((LPdJX9|1>yuC$eYVDSxba7iO={i{K3M-ErU(j zj518Xi!3eB{xJSOU#pwdc^sl!R56)J;)Z-lwasT%L`4VOB#>6AzdQG?;7;~>jvfWf zhXW03&~hYg)jfk1^63WsW{9LaE>h@|XCL?=GObz3-RKE5=7J9b>}{ zNn-U{-OdGb;aZU__Tl{J1M3=F?OB#b<&>gq1Wd9g&?B9_pq9hy!*Vg!cmHa0lik?r zacppz+n9frDL#UT16xq{%u0J}bWZo~g6*wd`xzf4Fe*Lbj~*FtS8u$kR!=T!G)zmJ zioI|EJJzKq;(psfa!{lt6{q>ndzNZVKO{&pRp}?ne3wzOX*ZpDU4PU4;>I9@@}K`@ zwD3WfkVw!v+KF4 zzFL-^694&-hRsi6+a`)HwnJ}zMOX#zMN?^N`S?B^>SId2yL5Wf3{?&>c@jSS(;B}v zF7=j_A${Xt#?9qlYQFz@3x3f{9}?p??i}qUj8zTb*@Gr>%OC{A_usMwoK5QlUY`6#CnTK{>j^q)S0o#UN(8g!F*wOVN zl+TpUrX(r5$v`4hAiu)9E5C5`;iHOl{YnUNFG^XNDcRqCn@^P`pr@^p&3<>)TLWO- zNTXMLEY2`}zn|y}flXFnba$B{Bwu~_KYt@G;>2UgC-BUhL03>FumD^(s9xsr>VJHF z6nu9zZoA)KGl92a2!GDz^C)yOD64@w{=&SVDn^jZe;yVO$JN7JwA(B>RiUz1mJ=O? z2us>hM32eJg81(01`62I0I*GF|9sB)%|=X8(l?zY-QOf@C!R>o|2Z`0xBs}D*^`BB zP=riPi?%i0B&ye*9sOk8BJ;az!0QQoF@0F%KyKLkLK(3h*;~Fp*u;`HY}c}9{h!=DV zvUSH|^!{@*8U7P0N(Iqk0c~TJ3k*cdEDpPisZ7p>ObFJyYk{2;J=+VEp4ULK_`NhR zTa(WVQ&UToXC{B?|GPeYL+n>6fo5aO0gS~9)qZTWzCOn56&JGG47-4M6wu1}tta#lln0CmJ{%3M$S zDtt|pPY-j3_`m*T!~l17v50FPy0krt_G*LVc08Xtf6yZpaV2go@}G}8%6*&6_h}^m zX&&m9{2c0e2rr4brntE9Aokz$Z|on^4+lu37UZ|J=4jLn3<9>agvTGtogk!VR81v-NjQ<-rbsX*U^4F{_5>~f-LoM zw2h{=@xsDzrm+m?JfHjBL0Qw0G0=1)2{(&|*jH&*e?Ec)r$xrQtp&l)|BWA@WzIl2 z$567^&{Tm^t#XD)Rm2|o;)jXz3ZI+*+Rql-YEwbo+OUDB{xeZl#l8OEY}yy8o6n4@ z+zJ1UzYx(+yz+6d=bw&Ky+wNI&cvA4cC*`T?GkS?b~WGKo=!^=y)3C3mL?_0fj5z^ zKR#8SBc8mW>}a9X_T3#3k~t&n1Ew%U425;}i%KSiV83pk|E4hOp{ut5gcJV}ZK)2Q z+1yOK$09m8RqJI5!|Ss;EulZLvZP}K#J}nYBHbM%SWL1X<=Q0UXFfbEoskE8QJml4 zMw+1kr1cb@eb@|sgO6*GgU0&&AlR}KaUGJ@>7^<%!pHgsNL%~D*)K13&;bnybr}K#vkaj|rGrA=5i2)-io9qykhU+^uCFi`B`zr+hnysml$O+5?Kmf(HBE%_G|EW@g$a#$ z)uaxBAZvQo{JwtwAyN5Zq09r&txA0#99baz_y?CHe`|;AA5YyLNLlnVl{*idq>n0~ zuOgg${H}oi_nw#pVX8U}PDSf%VFTTb^yK62a}kUPkv9W!u5o>oqh4udtG?IEu~1t zLvhr`&<^ZY_-7+c#{xIR$3K-{xZDlGV#aU*&y4;EoRGhCBD2e}P~IsEp<&&f7VVi* ziucH%?Z{EUbI~|3X~jX>D2+X`7N*M({MHlCBKlGB(2p)~jdu_5T0kYNH2~}yi1hGP z6|2@0oq5wu^CdNOkXBoxLo_x) BWLch^Byz8quu88lkI}kJ;m1n0hl& zyLvbi*7j?}x3?LYV}YIbjnIu~0h64@5X+3u5>=VRWsZcymLY!<=7!>zTNd?KaOiGA z+kdS2`qh9G-(SWrRMB3ekKW6BUFJWKD0$ z#jrLR)~q(zqV(i1?RxtF!KEwH_}FUFDJcj|Cgxd=e5y9(uxFg){JG3T+W!$qB%}-b zYE!WVpGW=AB3^4@wTr>@E45dM29k@OYUWbuly&Ca1=r1^fHQegb)mxhudCvw!dCI# z!5-%qaWFq!C4=E_xNVp?fJy=_GyT3JKR^toV)Y|bRDS3Tq&W>Iyqxot4v{#jQAEz1 zM*rd{kF~8$6;#H30$7|hhDW~4jR^X|OXiJ6DF5@z9}Kew$NbhcRRu8NH~t!l=Sl_M zG`cOgf#T2DGCctA>CsVF5rT`D;RchsNa z|IYAx^`Wv{5zSOGbPY0^$ zX-El~X8%U?kg{>%>Ra!H1Ipd_BN}sMIGz6PVnSo|-AOhx&4s31j>!l=SzcE>Hns;G zcTiwBU-hNC-Olo&=dID1wtsv5F4us!Y1}7CoT`SOy=;w5J)=)1wfLEQhP#$M{N13GVzUa ze3?gn=~x|LI`k))&y~8ctQ64cRFe~yn(_;_-9g~#S}ClD~_YPcjHIJ9} zYOvm$`NoHrC?r9uA%lX1URW0>n{T*IUxu!yssBmUUbym`4Ws3uw(_Q zrc+_~R@@>%g|87+a&}DK=B`z3rw(r2g-aMR$NI10rmN(iCi2lTheAzyFFUG~1uJ7o z&AV#VIOtvc>nXLZBU6u(&a8(!%?R{vzjGd~=FYA{Df8 zz5txkp~h}imO7sASa2II7pd~~-!lgMz~=OB@kQ))!D!(clM}2AtVQt$RE}Aj=w5~? z3w-X~_~uN?i=Sys4An`?wI5b4hVlE#m+c453#@XNVJ7`bkIvz9`5Yd~hAu?0> zi<`%SyWFshW?^TIK3nmFyyl$q&#gbn1Zg`X6+~sm(>j zHK$u&9wAh?^bxRDF*v|^kVKQ~`)~Bsvgs;aaOMV}cDG+_ijyPEjoAB8@Rq6QMWhkM zbD>j)(etL9mATc6GL*lS?zaSu4nIa@cmIVq1N(c>`SS}Uj`k{4%-mL|+2|kdNknmj zgU;7(`0037&h8I(7#r2C2i-mnU~}6_5ryH2j3C^v><2Q$%Q5{2yCJ0WHh*ImusAuI z&CKl>+T94c$v`-+O8%^yrAIk7;fjE~T^b&zpJ}d+6z0zRqRe&W!V2<LzM6ZagZtgf zUIfue5voEjmvv}c(qj5lC9JYSERBd9V9bM{e!&bF$4<^0z)kq*R?w>bZfJ#P795z1 zD+4_j)jXnclAI93?sn`49!qq+!Q@Fg}A);#s}&tEhVT%6ogTv>a& z)Qn0NJ)9Q{HXWEoepU(*7W3@xXI8Y1PuZFsp?GGnJdB;aatJ!VQS?bGHtRn#cbgZa z;VSCIevLJh+OFS^z`B_rq}QOw3vy=fyh|(b;WMw|{6~jAeiA|@mOQhUFem|r?@5^I zbLLhx{c%$-X=2{i?5M_d3W>b?w{rE{-A^w<+HhbiayT34cy(JsFJe9p>Jb&RB(7F5 z(BoV3poRcb<#0qDBAnQ%r>{3=TcUBs?ocEgUlqEMCEf>)R@3unnHNR!s6zS)Iy?DcpaF|CtZ`F_5(C0-or$nF@5*LriT|HN4f93;IY z98U<=>#9WYgYiF7Q3|&x=@6zT$VvV*Ff^Xqxu{l*Co|%Y@Ay65ayJSN2@lJnnM9b3 zB<=i>GSk4fMg*?zYdpWpGrmWhwDZq3W6Ly)-VkieWJ!G+Cg!<~@VFG@2GW<(`Jo;g z1GsSOZ*)NxBLmG`V=l7(xa}zp9PpGvpbrA$7sANbS$q!8v1@mh2xYWLXe73&f-lgI zi8uby?L4`ezqo5~gRNVWb~0rwk@Uz86VDd<%PVGO0#qc5w7gcttQO`zXBxJNCD|NW z;xb9_-$U@1)Y)Nwtb8dCU8PRp1&39)kK8KrPF1N|;{DxE*)LF{%xBi?J0~=s?I(GR zLvIwozEDDBa?`Z5WDxopYu?t#e;nsxf19P4E{s9)$5QTJGEyJtm+qaFC4+%msE%_N z@o$JH|IK4KkG86U_<77KpjEd|#!gDvW4kFBj$lS(*no zEs`|Rb%byGm%DLfR;LDk4x?vFvvwr0X-K2dv$P4=aERyT%0Q0rPN+i9jVQK4>*<8C z5c^_i;R)>Fu>{K~vj?TuClls#S4zfFukj*|vobKZxDZjGnGCNWTRLSgXpsr0ef^rp z-#}ovit)hIayCTXW%Cj3hgHoX)Y92NEfb%lcKbI)_@@_vZ|=Pa%;ZOGS+oJ|RUIwO znU?M_YA_{EIFVrfoqA%C+hKbW9>2*|q|}Eto7Xi;TFW2si)ZR=)`UpP`vyggAtEmxCuLYWrI9+qLdfmW~4 zATev2J)X+#nBnaW%eX59xk*B+Uhb2u7--vcJk@~zaTzx@*;r285mVC}40D&8GJfP`SiM!L%7wbjSV<24TJ!#hTC#cND&`4Ip%s=%yo9cP~G}j)l8nD zPDm*0pC~de*xPbLbz+=dm6EPY6ZZA=RUQ?0G>(ckOog_>@iJ8<)WULScPgvNcSX%V z{Akks5noq0^RE#O9A+G#vrACLYm=}(_F{LzaQBeg}<<+zH)czs0O@_z>t2e|0`~#;Ktl| zL=RaJ=X7Je*ZPc#D`T6NlyR`YR3PW{(LT@0ZX(y+AX0S1aru z{~9G8p1{`1>sWl$zD3=n5=n@RP={R39U}4F9`|is+3ADrhcrg3xET+FlAr&4ko;8(pDhhd8 zog`U0_&BG<iHb@o)lD3Df21YO#sNi#|vp@)HwT-M@T3v}pU0-g|Z6)LtL&Y@z9@ zr%d;x=Po(6UskOJgmI@8E%3H22%I}wL@INTvSC?jk0CyhPY1ZqEfoF)B37$W)$(!y9>*!usPje&{G(dP*y?Yr~ z+3aC~A4(a=QveZE3{7e|JsKEdxhKORL%;mpwTx~zvlxkhWavc!JU2b$q?*f$Hs5CF zpNVz~NX0(XgZ2MDV+4EwvVC%r9H_5(KFvez*i)bXYK)s6c1@ROQccOKqa;ZJG*k;- z@iyMP{>iKsyse41Em9SPw1cdh-R^Oo{{03F1llo4Q;wvTf8prtX_GvdHV0o zSpAC7B2)B&@9^hKt8JRcC2z_@W;wjq)S)Kesly(a)=5y~Bf^_PX-C(wiF(R*7(9L( z*Ous}8Nri8%nB*AdP`X9Tv8-X5d0+_Z00LQ?G*N91=R&uM^AvFM)RB= zd zBl~rgHDvO}Lxbl3lt2mW?^w_M$7zkZ_`L~5`OuNm?$3ktVAY4O;?O6CZ8jy~pSrEg zKrJpf9`BubB#y2+tXb?&lGS5x6WPN`rAdas0fjyLm-2o3+fO*qHT4ms(j`(T1P$$S$_lb-(HN>(wH%ooPu?)bNX+3`)jH7CqpO4Kj$rh z3%dI~SKwjd4Idn}w#RQI!zzt#wJPXNEp?G~Gv}1RB{*V{phFj2i9%mn6Rgb-dWSLx zu8GSpe^(2jR%lwlB@2rF;dLDuirffzp)EE=-nY5zIlTuo6!ta z3_=6$R7km+Al6Z(A+ZF(2Kh4kLnG7leoM!#CeWA`owERsNi|dv@)hG}wCs|w+=^D> zk#;M*9wl`plM38|P4I!oo5)^dIg!!l@%YM##8$3SPtz0AxB)?>naz{v{xo z@iw~L4-wBt{bpoif72#wF_vxy!&?;jZg9R=3)6vM2@RJ=%K}E3K_{UWd=_ zFRP7&eiHuCfsM@%cr-s<4GHdi1+_$wQ9R5AL#8;~v@ zd(yckBS^phQvyYLK1Dh6Lw}gR=|u$HYuEl-H%Qk#J>t_7@4^ zwL7CAJ@hhd`^%0dGoVwR$?9O4ALO1lO#DgL-?-FuZHR}@?T6m)N5cWB641nHd@c;o z9^}nK!+?(qjAAyU(Bn%6%GS9E~gmG8*K;1Pe$A~|>7n0SwsNDdv#WK(b4NOkq zEX=eUmE&Idz%y#Sq&5QbeKmHsUIg*SP)^)I(=KnCa!D0Qqba9|kISEaPtOR11`)Zz zdx(o({-HzyEhrR;uoyFpUe+Zb+rrPjynV(mFyRGGT{-_Oj!cmOEzM|*NZDXFtSIS@ z|Jym4n;(6%IW?`Q@UySkQjX>VZGONoPR6R#oQ}qB^cA0{`Fq}HRCVB`TY9rWnmj`Q z+Ibwwfz3+sVum$e9`YS%XAb$OY#QyCDn;*OUo@co|FSK^u7LsSzDbh9B$+tFZ{!1Y=w-ftk1LefmcLjc-^d^C?} zAIe7rJ%k_%1Mmi^DPfSR@$}qS`XJm+j!WAx^@zxl6x`@GFovpO;l`bSo;`40veANs zVYI(yPBIRr)XYAbO~QbUHW$P4C~dL6b%JrZ-&^sB2a|(e@N@R+>4lTd0^6&NAs1X4 z9e<3csN|yhkM0Ch$&n$J=*+%6_99<})2$vGyGU$xcWj@}>kU2BU^uRc?>qF1f!|i( zRI0TbM;mu+97p0lA07#+kY(K*BZ)lId%L6$y`SUyaa%swI4qqdPMvHW8imMcD<=huy3jd_n`7Nl|WYZDg8K)+4N?|=R_TLHG z9MYqjW(2@n6|UYivu!&4%RkWO>S)?TC3s7h_%lujMi6ZkpD@dvP>;{xozgk`*ZDat z*D!+2pS{1P1louPMhHFWP--OCds*x;w9cO4RMLgPF%Os&zfr1tC*>q4wPQSyuvSDr zN8o_Kd{-tPNoQn^tHSXyH@uBH3Ji%=db$#sg~d;gZZN&T{4RngT0ftX2kFV4vJ-pJ zonQExwLCEv8}a|N=i&&1`9r#%sP{Z_xW_^41*sOXP6{2saK-vEBMNy_F1i?atU zpuNfz(?hVkw{L(XN)6dkC0;D-tw%|<^eu~E@qbx)Tl=R4LtaM_JKFwx9Zj*TBgK?X^0_(kdW)H z+6_vX4cc&kmlG=kN}`<}L-l8{I$(7cX!#iq4x7NJ#l!eRTBq^nNyMqmEj<;g&S!qG z&M#UEnpxL>!^{p_E=K7{xlRiA2)~C3J(E8~D4OenA?4YX>=SpJ37k#%Q>F!QUApOA zGe_yevkV^iK?Ox%$Di><$XzyTXd&rF1~7I{#P~$fJm09~{c}L+w88+eGvKt{%usoD z`M!xHkv8BJ~)+RlJ#Jb6~TweMni0eM1GMeKG%DnElv|`)RJ+W>??@CDQka|MtPV}E!Xl3Ze#QQ!mpKax-)8qswWkZzsy3x zt_5i!N+*o|AZRJYvEWZl}4Rg~s z@<_BZba_idIF%thN&mz9x26?%KW+*YpL)Abr)3#JIfTRLUR$(46(#fn8GX6l@omYK(02-P1zO%9@t z);|?r_ASBWK%FnP7EZe*l!Yo*OvG7fyVu47C|hE%UVm~vlt{>m2AmIuE zYq8jR%f+zThu{I>_YJ;y=gQr-bLG~#?W3%1ZnPoyu&U`-RSVv&axAIm(|eUDVGwfL zRZ6Ep3Pz9yU)uM3Lllat;;oJAxErf|sSlXXsIOwSyHDs`l($6VB(RL=+o!U>m$k_! zIR-N{NyC_TC?7{&OXQ`|Xj{-E@pd6;XjqzPioi!g9@Mdrc3W+(Y37 z(2FL7hJJ9W4G2~V8oH@RiJZrj%O_HTAg4W7Sc;y{BE1A;Zwc@G&S6Kzi%5N()HiA) zUdLdBV4Rr5ff-W8+L4$mV>-l#i&Z(IY)bL=^DKPj;&mh;G>zar$+_b<5d@Nd;zXCi zBE#&H;@PJQqyLWXyO1y;v}Yl+pI7t=i`yGjfAA>jAUu>cbFnbHccr1i(O=9#80)jp zF3x^rN>^dbv+}h0dzt1-X3S5lMy4~wE^5n!9`QM&vS`2L_p<9gg7#cty$vdX!22! z32r(oMkYbtBH|UhzugKvM4COeqr#ODS%*WM$bY*;>^AD`?Jn`9Yf)VN`W)3BA}gGV z5&4&PCo~LlbJ?-H*`Xi*v=n;V1=duFDZ4~~$SuNkSAf>4EhGD8_#E%;Ils=bU0RWF zx)8$et{G}V)KD3>17G1G;I7%oLUg#|p8_3?jGs@8+Yd5dN;1AfbhIh98+Jv}?z^}F zD0Iw8$vdONF4TWnx8DRD$u;31mfujGOEnd~xA=)F+=Kp5=M_KuGE9`%PH361+NsCDiTaJI3L{a^2n!-d&hB76s+E&N5k zZAz;nueIQE6QK>no)|OSswI#O+o}#*&VecoaCMNbcZ}xl_xx#uoa+YSu;SkIPtN>6 z+-aL}p}RWa)y1Lq*o`<@De9I%+YAZf*o?UtAsuDQ2A&Q}jWSxT8_uBCb4CsdUr{#6 zOmc(xo9<_tJG;O+e>*(QqWL@#DbCG9?CWK>IIbHkOZX8IW1uqHtapf5e``+06_}5- zY>gTxCrZynB@u4W`_UYd?68qYnOPPV#zQ4aVtBX8?4Wa8I0cSRJ zL}aGkISEj%?%J)tfKc^X1^%MUKZruT9=IU6A7X7vZO=*Se{k6xI@E*@@6v=J2CHbF zMNmfN+8aU2$T6@x`uD-@5Ns6_CAPtZM8~DyOve~%DRKoAdsdM8bFuFyd&I?wSX_}9 zY6%U?{vCb!Tyv_yp(|@MKc*q=XTCRq$CAfWaO6I^h%gKlY5Zf;N2P8yWpLpdyo8Y6 zZ_G7xx$=3CNRvEXh8GwZrP^?Wb>^RLmNLqmDQ1w~0UH&D#SQBr(SK?JVgwSM9LYAHEtq|%<9qpUasaF5VSPFWx$!V*@e1f__( z==46XP~8%EVevrp;8L^~yMLOB5)zOp#jDQA6MR8rtolz5njx?q`gEyc>}-Mb4@Qf9 zH2<_|q)gja~K26`XD7_=dCdm~>nBOSvZvVW~s!GN4^ zqx8q=>@55EcrpZj#wkM9?yuwsKdfut*!RI(|3ayp!|zB}Sh?-Y0L$TlC=wv+CKS@! zEV_`@kHl{K%oo0nr%22r%qEC(5-kU>4Z@I(ZsaT64B9NGEv_$Eo(coL! z%)v_pTa3_ZN?IwkquE5zhyb~#ittzTExWE$_!?WltPm;2U7|^{^fZ?miC8J_$ZJOc zjNJ?$O$ne5@*-sOx;|(6UYeI&E*j)+;n%*lw{0g%Jos!Wo`pWS!^!Wbu2EmBJXOKh zDMjr^xC!dwqO%Lyx0!bLFfx=Z>Fy{^Lek+!n;dS@z-(i&2)Om`v$hNU*pOAtnypJ+ zkrS1Kdm_tnWlSqw`hss6%;w>2#Ap|rGWX_YNDae1=wiwpg^@GY=!kT1yr_Fay3^N$ zhiR8a((L13@DnSPDVe{rr?mZEgGgLnYamehV>9f}hF!bHoQrEE1p#CiP8T7wiJ&-V z02d0w#%FgzrMvz;ReQVBlTj_9*A2C8di5iFVXIo#A0vY3I$R!6L+Lx;+1>5V12P%6 z2zm-tOd@6WlyS#s(=DHgy)z~4m-a?4!=IpVi7~@JS`MRnYjAfUFC!t;X!CKOUN)$V ztHZ*AL`a}Wu0m;Kqr=T`p(16a8;7ueVR1#k`0Ze~3!efej02`^x0Y|!C}c2 zTKJ14!84H+>6+Dxyz0cq?-LXyfr3tk2hQEa;pU@3YX{{}?Z6kV!r??u=9h?ZCM+oC zP1Nq_LR zinfs(%;Sv5jvkcV0V9=GZnPp30e_;%fJ3^v!GcQ;wJjWT9B{it zk%cl6p?jl_yM$b$_N8XoT`=vGDIFK)HX?}g|7u@y{{Us|RSNCJG7p9OhJk;c@7*hU z+d#eFjloU^tL_BixUT_EcuMe$uIoqzfL7%`EuAZ)!Z(?F!7`z=APd@Qa(6G|JK z8p~CdkTH={E)h@h-Tme12m+O1e!Ar?+58cNsgDdZ2CW;j`d$Yg9be1y;%f-kg$^}P zdljpv3Tjl9gBq9(tYJ-dX6x9Ml+~Sm)lltWSAc@57)r?sJe#3vM4?=zh=Wwo%Ea56BF7h+ zt)ZzIHpsdKGgQ7uc=O6orEFF=^*_q=hyO3{T~2kK$*WMaKhA5SYN|3 zh|ciC2!YT_?_eU@@)(x$gOmQTWE%F*aKr>&4;c9`?H6eMkNd^;BU}*Wm+r465xx}u zBCI1zaK_zU!DojiC5T97L6bOe%f3A`6kvffa=)*suY);KaL2xM4mQvCCHjT9CSbaL>ml{7L%Uq5Di(nhx8p`NS~g z@_O88o_k5w5$kM)aSS8rYJm7Qz1ujaWb?R~)wMb){D%ZEZf0V_47cdcaTS?+l?zR( zlA%MS&(qa~E13*u|K3RC(ydRLAwbcvaWHV)NKpOr-bQRzu}f5LooZPMg>8kpYUzCi z7CI$Tag(2`lJ6{PvzCipS-P~6r?ZMN|EnKV%7qu`utFH~aha>Fn18Yex`0XqdUF>g z!v`&OCGMiU-`Rht!Ay#GaqAFNYOXD+1^(253mZJp&On48_c!xGp&H2!N73*WBc+J@; z-fm>yzcPPQ&at=X#gBbqBT5LpW z3mqz^O?tyDzR?M-q9J6R;2VMgav=JDLqIn5Sz8}DUIsAST`q|6=EnQJ+aU+XD9Zsu zaxL%?Ny4P4hLA)W)%5;%y_YtsG?31gdm^cP2=|voaxk_90JDIOMug|~JxM-Y&-3w4 zJkU{s*Ss;4*gIi8azuxL40WE4L))^Fd>WgPP{X2}8Z%SQrRer$=pzkSa#Ve5`9{4s zyK*qvZ3E8&raUCJ&yO*lq76fW_S6;9a$8CbSu-11KoRJAQW)i$5B`uv3DdQ%i$-y6 z!owIUa$ZZ;?v3{x*4v`tE;FsZV6`dm01K#|bBB;1xo($^a$ziCo*G+=AOZVGPta(B z-&#SgZZ@y8g_5ZvLYgQPa%!WQd<#08BiqpRS9|Gn4%$w;p5<86Je>_;jmtgHH7b7eYQu$QChFXlD)C8uT-H}dVQw`Ma;e|Vg?-WGn6c$R2E=$~T=8yy z=ACuSINW+PYQ|?!aG0lb z_CstBM=_EmeP=n|d!E)`hlNT%DpLA7a=JSK&YBaVOfW(pO~$_e1OZ{x8%nx&6f&yc zJ}Z?@a=a|6G64zw7{lbKOi1iy!)_}2G7R!3yxY3Z9XRzca=a|6gwk2A=r%0kWP>4w zqZaO2^A$3l6m|F4sBE)#a=e5l_q?6;<_hx*Q5MfvM2Wn?0&0{=`)(WywE0jJa=-^p z^kcCp_y=D6vnuuw_u6zdrCu%H|>VA zTOf=tSo&Pya>n-h`o_r0H&0dxYgQL>;8i#A5}?`WG;JLGWC7kJa?deydFs3>61#$# zHbe>(M^(k5DjcR3#2{&W|Kk*1a?|1YkB>|xUoAU61yb~?mmH(E7;~>Had^P0S<`1Qa__%0c$g$? zd~OUuIz6~17P}sAxO+APhd*FV%abKba`L_ZXFNv!mlQrkiA%Pu9Sheoh<^d_&^wYm z`IGwSb1Ns-=@1F>!CCvaiX}Ylu~p-r2)t&&&4N?_>Ea?Sb1OXr#v?>dT#j#;#lH{X zjhu0fpVcR)d!cn-SAL84b1S>CiWL>4qdf0fqVy~9iOVg?%w@7zl#zVX59K66b4`R2 ziB%!c6+hu}Avr+jH~9Dw7FP+q=RV`-)y4q4b6k^HF!M7|AQq}#!02ctN0!>Q#N(g1 zXjVJ7bkBg(b8w;DmR6fD(1rahsp6{A3Hb9c}3iar$hNEMqiEL5R#oabv(a;2mptjiSlmA*|9 zbF|@Z<3YBT?}R*Uh6v!%00ifnK(Xf}CZ{k_QywcObO(b_B9VtUH*U#Or>y@>>F>kV z+JWO-W@f6c&9O^lbO?iERpfWp+5VN!0U{1TKOO2974HE#p+#2r@4ie%bQTt^SyMgx zM&fOYQW2b8{c^$7zM_cgohnfgVsOh1bR7mh^Bdi9+!44dm7>w*HqR_IPnAHHjEm57 zrkjVmbTTe#<=xgniPYdHV%U#J{emOWqol)AHs~3ZbTodKFejJvac@Qn!3WVz zV5CK$l;f{Qeq$uGm28M`bT|D!pO0^f820@j#zfF9HmWD;K6niA>GV=pWO?~hbV8ZJ zT`L7+^b8QheWID<9&uS2hEK+3+X4Hc8T++TbV906<1Dr;9d6`;&mk#GUeK7R+Ob-B z#t((mBxcY{bW%T`%Dt>>tH&dW{*Gv3YmHwEXCfW%b>8Tvv8m-)bX?Eq6t0)DLoY(+ zVM6BL_pEX|g7}R?&D81M7C;yCbYKagl_4LPx;>rtL3HB@w5C|64(?WG^q6^QDSRh4 zba{EP{I82=U|13tKXtw%F&xaMO+tFwCseg^w(`mbbbXf~v|R$+eJ3@<1)fV*QT}-Z zeCM}vlX>3q3lOXxbb@stJsr8o+bu)t1zz}yF1p`ql)f7o6q2sI@AcX&bck|CGkR*C zZa3%ctz;4R>WKfC4vT`KE4woW8ZVMAbdw!T8jyVVq9_Aa`k-s0tEj$ZyCn92J%&W3FO{acax+WuF6Qsc`hF5j>=;ZCbi0Py7DZDIX$&f^Nqx4q57p zZJvgGOv26YP;6t)aPl zbkB;vVv99a`PwoV!q23qMwo$^u8MFm1bmECxHM@-b_g5B~7!HQ=(2eDc zxp<~Xz>Bzd?f!fSbmWG6Mzq+0YA-0IA`H>bp&;;I!15A`KKzp$6euM4nn>G+eUpM`#nWD z=6yL+bp`1MKGhYMSUgz~qc-Oi3`WhWL< zHlrQpZZv&9nNbUpPDGn%-wE3hb_Ji*`Eb$;(~M`B+?zgt1b^H#AbyjW;mBn(UR&i6 zb`H?~NoJeTAI$ja0;-QtmMtJmHH)1e1FeU4vzu)6eu9AUab|@gEGv%97ddlsv!2G_{sT31&~Z7zHAiFNBBan|b~R?}eDq*a9|;_Dg~ z>f3RS<5ILA7)cJmKEZHTc0PS78|*o(L~RI=d=}h-Q66+QLat;JUV9ehCIBuSc1AI} z6UlRa>11rA)7Qnsv1@ zc4rqHI}OxFYq3BBNh->NFp5nB-(DOcCI!erfO>9Dc5J?yJ2G5Y^!3Eg$K&$auzIgI zvpBfD}QHC)Gc5Pafacj-^9J{UUFepDx<=OO&7olml>POkH4>%A-c5&syC&Nd?VkwfG{=X+Sz;u&3@shDUDc6(?9)1%j>)_V8m@)caSIl{s%&*J*h@7phn zw#jP)c6>9?HTe#C_i+a5I4X6>8jB2pHHp9L0`2KGVS?E&c8q4o7$^?$v}?Ondg^~8 zOYSpQFlB;W8^e>|m~F`*c9E8_quU!Kn22QeoJ=yiWcoO)+v{=Sv>1P$(OQTKcAVAw z4=ZL-Z;deQ(Tg=mxdR?D1Wq$>pzeQ$e0 zv&A(`KxgwlcBk6-_kv1GIRWE|AOZGGM+TvuvOLY8x~VkqO=0vxcCC#$-xKAxuSJ zC%FJVdOCAAcnqD7^Aa2PWU^zTJ$Vzff-Ug^zwwaw4yHc;vS%%Dcp31K^t7t0D%?)d zIz^^^9E0;AWB}l$SSLB2p=oee<#K6H0-Z@xENy0Mr(&&7=yD|d<@4&HbcqY+3|g1MrD0l;v}tGq4&FD$eTl7b$6zo4vt`Lw?Ejp^`ncvHrow@fX)fS~IceQB=l+fu&m&56xR z54^PIc`c`Ccy^>+2Q(%h;HI!ex`!oY$1+(;cdhZHS^C&if&k)Wcy`kzx9L&a8tqfW zE;~f+Scw?fNS-XNF3({ahiJw?czJ{y{q4Sf#^OKwzFn2xqsj@3cT5XC@92^{5PsKW zc!oO&O@0UZUI@%=*?mIUI#V0Os|9 zaZCSRU{x}P4cp;Wc$L6`YYHOUAMesKC$oh{OOCMy^FcroQ%|V$@KIB6c$Y&oTD(mF z5Sf2k^AYD0ipqwJ?s3RnrR%qk+2?>nc%2YoyIqM5s&xe4>!iy$5vsH`EFj|1WQE*x z5j_mvc(3YRCkU~cds2gH5~;pBDbq9eY9c^cQo=19X%qJ=c(8pBk7?i+!AC=LN1nN% zxZFX&hiH944-6!clQiGZc(Ri>{{|T*1{aRmS{IF=4a4o@3CRwpF zY{^(2D?;-Cc*R5i3Uqn)G0DUmExH%kZS6|M(oUE`yVEBIbMG4`c*p=fi|nyMPB%Xi zy|1p~Ja!D)YNYZ)8`LC6DV5g;c+W3l`~cLYWH&(?b3QmP_L*Uc| z&+Rs_7`p$4S^9Gc4Bd0Ppl{zMobviu>s{3n%*xnsP%No%P9T(AZ#@_O)*d0c1j24tFO@#qLe zaO@5PO`9QNGsoQyfvzN3(T-`1d0c1pzhCqXZD{pGuBcMVnwU?Jc4dWA?V0|7jytu} zd0c1#Clb--N5eUEc)A!}Zf8C*zeV&foeDfGQMCTg|d3Q^NmC<&y%s=nEdDpJV7VoQaA)^|`^BR87 z#*Vq)d5Ie}-Tgg$A(dqUc5zKy-@L7gT*2_(=G(<2 zcQ3L{AH?8o@A(EZU3Hojd9N#}WOt|bc%D&&dk~}JicGij=Hqr13f-CbyIZz2d9N$4 zrz@}~@7h=dktiGe;!~W+<&TdV^ap$mx#xy#d9N|(d>HG|5~U~P7s%+L^zQ#IZe4fm(hm;JhoKsW<&|c`xMjPd9aXnH=ddzv{!Ji-=3ym3N7}de8(>7uu~G35;Lzi zd9apgQaT{lQ-uq*fv-k5ds>|=GD$XCbfQYY6P{~@d9>BdDy*GIa0Yb6sR&I);H4>E ziVmbXIHn%j2{wr4dI`oUXYa6QTya#T$A;zsdkgU3_xg0T7{7RG1weo1Xn0P?@s0QooU-bf`jFa zdv@ZYD#iQ}dQVHz>;2-jC1w2b6qwQe*ds^V;yf12NuQ(PlmTT}dR(C9Rvz=zvV}qY z=+5v|YS}I!s1thCX3@A(>-gVXdR(C9j-b;;tiI7E1M32cfWiiVx#bCIc=|fda9PGl zdR(C9nA3*3`5zd31p4`V)%QCe_}K9RiHPN~f@9nvdR(C9o>btSWv2w`g@K{6GW@}_ zDQ_ZVPjf_zk($bAdR(C9$CS$k99kBD$%w5HUzk;D?qn{gyo+T_QhR6~dS|ukn;79q zm>XOH?fg9xfq&rM+OsEmWPi0iA10yzdVG_M&P|3e71a<3Ge(>Ad_`rbHbvBaMd6Hj z+}h0^dVOF3EKD9*MMzxn;)wxOB{k>qOI>gJHNYurg+-GRdVSo{Cj*q^U5An;AB86w zJEH<{_vf)9J`IOLZR<8PdW1(1#8tV{Qgj_vR|5b~MFkYk;(p$6`RMETyq;w=dXPdA zWGd@qp5&@BN6BTEmR?Mn(nB>&@{3gz?L_LUdXmHqZB6brZ$>Dy8)wh%DZz#&otes~ zMu}R@Kd*rzdZnO}e@;&U4BU9n9MNHkAfdu_loC8dZotPcnd9KH(*hf z!}@IZ)FNUU7IkHicJWC+)RIi#Fd$84OZ}P*HV*|0Ibsic7m z7@m(LdfjL)@w*;EU=OAFMgExTL@S0mmX$N$z3_ErPoRnwdfj>i#nF^k#)#>UA2aD% z0}hBTz=hbutXNmNNgiTBdgNqNXMlkKi*52zhTLkU(_bQV_WVv<9!#b$!Les8dg-00 z5L$8WjKc39Ng~YqH6P5{kA$g~R*8iChFVw;dhgndzUk_E#^MOQv(%91dAj4Jk&ikj zMoHg_Id%X$difM+DlI7x>x?~P!}6h=DAkjZf5%qd&5H(s*%iA$djIsPnEuQVz%>O<^Lz$Uas_XByiP}_YzcUL$~ zdlv^o&>A>I)oswn zkl151dybPHQ}P!1-v&)YZ3IA^v_WcpTx8%nwHH3?ab`Bfdz*E6IQ~-B-`r}|*aoQ` zIYF@RV50h{ND!-9F2`@2d%$*{+7d9DPmIK)&#NAx@q*I;+TxDd-IIqg5>en8(Sd9 zpZZ7*+N#bZc-jDGY_eHBNZe_9S69xmjJ*l*5aVUowLp zI}}n6d@(po1}l9IcWJm5yOlA1X|kJ(xc**_1ranbxNjLpd`Vhs&YS=R7z>d68FqNA;`d54pszjd|JM1R+&}c^W{c7>lo;IcI$SF2uZpl zXbrW6E6*J)d|thubSMK;@vADd*&Tr%`OJ1^X3bRz)q<8?!n7Mdd}NFku{_dbsLA1a zLcDBRj0Q2V2U|-$ykq)5M4kK$d}ObE&@AX?$rgGf?)%nk`B$gzD9O*bw$@bg-w@s- zd}v-D@uT4eH3da}_yB}Q9u5fbr305hJ*TvyuF|4$e4}NT#ei+uwb1Zh#_ngIY8>2% zqC)gO^Z9_XW?bP3e5yb}uE(CPs-e@4UWitY%0Wldw?~N{PF>J|mfaNue7*CB`qOgJ zGJ1InK8)I)FN>15h#vUM3^1}}s?=^ze8UZV{>HwQD&aZde=R z|ClZh72AH4EppMhSEBq1eAj4Hb=x*(3hPIjvswhjbsGZZXZi(yG^IeR@h&XFeBQ_) zLa8ppT{+Go_kBb4$6&oM+{+E$;D)vy3bEa8eBmqi2m7Xr{JtmVd98s(ejz+!Lo0Ax z^w`a!L)Tt%eBu)@_7v&y5M|FkewHAA>_CRM%Y#@=tj}w#Z8gzseCGvV^B=VK?{ef(e9)^Zdt_U^nq3|`NO?3eCIKt>G-r*48`Of*NOUqJ?HqKf|Q9w9*UAYkXN55 zeC*Ex1OpJ|K2DC~sQ!!bEXnG&uyr?jcBj~?#DULoeEoKaetSm}>jYxtxfJF*3SKmv z?M7LF{byMGM+%u=eG&q5<#qyTCX!%>Qsu>581E8gcI6+J6j2q+px2eDeI7kJb7S`w;pIbeh%wBZ573k85I;bgL@mHup?kmk81U) z_1I&7E@7HGeiK_wBb8<2$`DF)VAgKZ{F=z56`1iRD3I`R)9oZcejS5~KWsY8y+5=) zWn`rmTQW^l=4+cYT*0bSM`Y4bekmxbGHb~Rt<&ir$T*#L=EeFQmIdvwO=WtkBITl3 zek);WoB7|pAni`AHC?2h8y}|3t=l3_x=-+`&Ir?xek|JrRRl9#Jchb&PD!Qc*>!D5 z+R4TE&9f_Rdsq%Eek|JrrV3`trQ>vcl4h4nJI30)SeRPg}1}E z6C~_~en@2V;X*TLZ&moVy3|zs7D4u>?~ zJ-Rs^Qqm3gPnhX2>6j#n2o%g`{;Uf^ua9zjeur{>M5aRuDug>5<+ZkFM$^CeRRr5E zu#Cl5RyMU`eu-5kwKCd}xE_Ms;`z9BqRG4z|5}d{Z*1?Lm^)iVeu=L;Nud{mQI))i zBH$gqIQRlHrc!;A*fiO%iPTdRev3hzVCalhyysG0X@8KhbZ17tc%_#I!`tpNoz{G4 zevF&g@_&BwBnfKHHeEhuE;_a!=cccMD{k94JJm@9ev#+b6q{>2|F!IxDbIXB$Tn}z zfwqU&m8ny&QtF9gexq57NW6R4Q3)H7H;A4kEG@mXZqBLXDYzXUaGTW-ezsS<-l5>N z5!v>P)(8VFI?C@WgjfqexE!^;q5Yj!+XKe$EYIlx~ns;b$B^gH&o6=ye$kHN zq*o1XU7|@DTY+hHd;tXcIgPQtm@Z{#MBC#%e%$NIgKVJzypTVXGrUn%Chq#SS9$wt zyXmE0SeQ38e(%LiRc)xB+CgM+0M@^}J!l7+K>h0_6Gk*n*8NL%e()LBD*3haGEW!! zEQ;n7fgVk|0+9(=ZTBRDboT`otbQbfe__0OFRucD+!XF0Z_UzcL~S^#Da{S1t_V&l z>sKzFf2h)he~0I(FVF_eg(JcGh_pDoER?|vQ^F=HHDG4sf6*b#Yr@Q+)gKZwM^U}k z#D(#~dBTE@C3W;dWCJ!*fB^BqRDTDVHeWPw`+fCr*z z8n^RG9Q!&h&a-~=h^sk;N6pdi@`AXT>p*=(fDjzI{~_dYh-Hw#USZfa?y9d#vjK+N zY#;rz?KQD&fFX)gmOa`$`S!rNQhIAp5cmCrR|;7}T^GY;HxW8@fG6-zbnZG3-0(}6 zT8+#HkQTK6+U;;*yk4TtZySJNfHyz%g^0NtkIAy{#;@64a#{4ot#(YgK1m1|!8?Tr zfIBqFPZKA5uV%$wcbAWVKc^(KwOF%{C7|Bg07MfvfIZA!KV=>ErK|0nU`CGrPc>tO z0gm{}H2PH8?+bfKfIZ)>vx+zYhjpNqDai3K9~q}bEs#TR82f#`#P;+(><|2yZMA(dB`i%dnZ;oA%FaSuea|2$NYVd z^zSSSfN_FXrfO6WDqmOHIOz%_&$f#=S1-KfOeOC zgTZs1?>E%X3lL3rc8jylXkJ9Ml*|q>jgrnqfOeOCg_dYdB!t*lZvP<;kRCS+xo9UX zzMXZdSYA&BfQgiZ)r5&mNu~fV9|h{se*Z`{NgIbW<3PR|PPb7qwmAmm6HfVS8VRJq40q4XZPh@%)o zriOXe9o)vloXH`vHzV>xfV@K~%e|R65FJ&?cYKNy>-Dlqhb?(xVdA4=-rmMXfXKdj z^|)ZD$EO%BxA|0uUXA&FsL3t#4I<%qHEQC2fXbyhGz9;ju&#OPq=xseso_%_m%M?> z>NS{KpL{$rfXtz_l&{1xXi)Z}7wQuQEfvN!r0BvmsWEnNfsXtTfZxo%9Dk?lKIThq zJ}t{a%1%I$LdjR`k;ETs;#Z)(fa33}DSp)>)0Xt3)r9dAF9z2RL!`@6w>1h4(5?l; zfa45Dqx>gq0wxj{4kf;Mfm6N4`}`uDIgeNdMkFbCfaEku8_Jd=_XW{FOSeVA53OjC zg{!l6fc4pyaHfp6^>x?S0x8_vZ-9V7A$(#Xo*88p*Mfr;Vqe|lLzu5 z8UojYp|hAff)I@UK*lLVuZq#PDX&TjlQ(uFW*}z-_14WiR;spaf+U;j2N`1ic+opJ znN^MO14N5!DbQ_5 zf<5TlX*~aw2J|*m`Tl}dxGz2z#8x7?KQqtESk-bCfadyVe!H%4>MSAm?83AJuQd#jCWzh5Tht3Y!B2o0`9qerqO{AW z{KeN3f>ZWeR~}SDs=9ikB40?Wy&XAZ=|IXuqyf*`|3;b-f>g{Y?YvfJe)?!EmjSkI z5gPvCjEOqmJCyB#T*Agtf>!3W&1vnt%q*)^#xebQel~1;1mi^Z-!mu2x0UTXf>$>{ zWSD!XBe5=YtCQ;l(FQhA;;hXb?gkWL2>o7Lf>=8aCH=_zGMmr)+Xe|8fy>8j*W}|T z4Tx-5qpxmOf?M1^XRu*VSExt2Brde+jsCamUrO}n0lgWf!+0=vf^$N#TmvWe;sqm2TGn+nNhYf`xK}{DitlKVM99^d=*pxg!n-%aZ>$77=g8@1KoFf`?DqjI6fR~MS$7^Wbr%&4CH*S%3Ff{Gp|Jfb}ZHu+gSdf}$UUjKZ~9tQB{9Y!~S zrhW)Bf{kczi=Jw9yIyY|CBwA3+j;KsZ0Ba$te;i0+%_e(f{rk;>7f>(qH0BrHuRXR zE-F<5QdCd^1b`ZwYuq0gf{*W+3|*^i8C?UgRwyW1N<%?6jNDqU@OgPo-;|(6f|%-D znY{H9^b;Ma%$di;4Y`f03CztON@o|c2CMc`f}Dr*h3X>-0GOJ)ga*fz(xnizMR(~1 z(h4_|+_aEqf~LnY^h=&bt8X_Y@sNez0R2HI>25@^3b<`x+M{+bf~O1C1ObkHzKt}< zR3r=I^KQ$T5lNroW>~;`6ym_df~UEQBlziZP^g1aD?Ci}Qi zTxivX%g1%>)2&iYdw&@{>|F3W9A>|G@#UM)LWKeKl zp!1k`g3@B=h&Mqe6Pj1MUZjm#(slH=+%y~fKDQ&cTv|v@g5GR1-Dc-b)2)x>m&7Ef zEm8-?d4Y7}*|}?SF$%mYg6AT%I-6udMFD~($s-Cous(6BL@BcDsn_VxY%EdTg6<6! zK+M*jasW#w`yWb~#ASk6dpvo7$lOO+vnLMAg7U$GWMDt~^G zpAS|s_ZcM#EN$!3xy+zHQybPHgC^7CH!g1B!UBL5awkgTe0ocxEd)cmbuG&J1iyP) zgMqlsS2j_Ob})Q|!QEAQ(aH+rTyq#bEjljyd0w0UgPBQCO=uaen(ns%RaIW9AR zbcQ{5dfqC>`s9jH_lI0EJhR=|WygXo)n1iG3WeK`}=! zSxr7%gcZ=Muzjgr>nzcX%fggSua?MBWaNB{WyP9y6e&G7gdL+dMH6E{&_<0B;#K;m zSN|RXmqq#Ea%^n+G#!3%gdTNPwsPoqK>ac%x+-+XZ*TcyJj=aK+VuNJtdu%Fgdv2! zW@S6AegXXy7==(GGrjCJ9IPc)u@|hw9#e^ZgeWVruO-@ILp+?WmyZHD(Xe$qanpA(=ubPlY z?b555eKm)872bT(>%wu{9oYa}ghtVucxwK|;JeoQXXS`xCF;}%1vO(r9z<$}tzfEZ zghuOw>AI*&av!XUmZ%4HuvRc1-+pmlIgNeGCHby$gh$MQ2L&@1h;?}Y%3Rn(-&ARd z02Q`_u=Z(Hx&YE6gh-~Sf!bR!9XRin)B}R2AJ*IE^8ymef%_N&KQ5C;giPa%DpnSR z#@-^8E`hnF!ZhNAJ@6H>T@6yYqqk6bgj6Yi;R^J#6q2?f`G|1-QkrvBqXIx>AVy4k z>;tY;gjhYDmaTJ4l)|XvUX?{dN(!%s?>iKus{ZS5hCIvEgkFTY!r>uQ>&>)tl|Q>s z^Ky60p=#Fze{K@QC4oj)gkX5sv0Mz-0kRPg*(PXZ2A?J-NA7=iT0Ua%VYY`_gk)L9 z5-bKhY!fm<`Z`4;Q8#KtB>nMM#%x-voSn-Hglh>ZRvuWlkuLuS@kmlgm;uVGup28YJnAQ64C}u@ANFNS7q4s2h}hO_E)9}gn0EI?)9T~-r68A zK4HjJ;JIW`_LAz=J%fQTyy?vdgn)!3Da|E}Yq-EHYRJW~l>wPEjQpxo>~_mN)BnJK zgp{{4HZ&R|Fl;IL ze@4$8O~Uio5$6J@oG6ADgy*SrpVG2C=l8dD-48ej*3GLzx&}|OLa*NfgXRh#gzX%L z3#C~VkIPP&dLh-)n{`k4jkMQGebzuvyyuXt&8P%Y#%Ca0*T+OyujHUr zW<0big-IM;?$Nl)PY$_9r}E|sxTtAI687w2S=nfh5#f>U)0=3+h4w!1 zkoXtbdCK_FFI5ZoIz}s;yt95_?cMpU@-A4Rh5{?RFIrjtvarX!b08gz^beL_H0ZcE zutK?~_i<83h6!l1u`wAg{FS>UEq>Z88qWg?XK;)7PK)ecwvMvY7Ffvnl&BMs@8L7z-T8-w!NQhERH9kBBr4%f=6vkg?d(pC;|d zP>t*@*5&`ugU>j)hEt8gu5tq8N>}tc+Jt$OSlf+EIg$hXfA)?S>f^;-hG9x!w`aHZ zQE=9D#AGqZDLWIdU=;S@28z7n2NcykhG<*TI*|<4jyV+j>^WJ*;_~CCcV=D=EhNShI*K0 zcyVU{Qim`4=&L`p9m2-j7~|?o*{#ikWj{!EhJ5v>*^uiM4$3= zf%!0vrtw_m+0ztaVJBVe7|m91hKOyYIl@%r(Y$BV%^jLQe#a0*@6b%w&>{K-RE#&K zhKPW-!i#~`HKmPYuTgqZrv%;pyn;t*Sn@P`{*}=ahK$uuuA!jhSTFjOmVHJ?bKE>JRY`WkaaHUP__(LhOo1LhjdN;i}*q#e4sKDLGnNYw^e)U zmvjiq^RygvhPObP5pW9o0(m6MK>9<7otSW*qf;5wkLrcpH2_XzhPgC$SFdZ@3tHWH zUWO4P@ji{Wv)Uw=R6YkWV~fr_hQQe3*jDPM@9mf$70`c)(OHg%3u4TCVf#i;lslFh zhQ^)+*1P5)hrlX^A!h+JcY+WG5`p?WxEqkJ-}i7=hQ`EVx@(W&mPIT`=84?4bSKeR z6YUpAVi#jl6|bl|hRRn(X$s{_F%jQ*8X7_#Zy3o$u=6$y>`u#eCf*iwhS2@J&Lj(m zdmLN_r4JoXQY%Gocl_;wS;eJa-FSGj^7mmrVrxdmJh`E~;*hjb0-GsnJzfLV%- z7SdFxJg>B8Ro%FFON)i!sZcJ^hm0~9Zy|f;quvJ-V(f)`D!G7Rih!&V3nb}ZCs%!bA3LQ|_cJf5z3#7oc-x@MF^V^CFh!+dFb(?n_ z7CYF(hs}6vlpE}~ilZ|eN2`#+7qYBWh!+dF#;yjz{=O@A!39?qIH3m%I&L_PmAE44 z>hk@3h!?B4*3EUnA5jbHsuMpiflGL>VsM!6fg9_7CjAz0h%LJ06=x{))qVo265%Fo zF~)2S#K#&l#V$uH9KY=^h%)5*U!U+dXxG#GW8Qn_H}O&R{+H#>810#nbZL=vh&ep{ zx_737;a@I=;7TQO?UalTq~k?sucvv{Zv6%{h(5^XNb(ov$hx3(i_MXSR4`2GIjzXj z7R;;)CH=rkh(dj0e*;1h-Ye-&DBtNO1>pYfU!EjbT9Gz-ro#76h(qPWUdGPl<#xG5 zv%$|zQZwe?e5es{u)n#ek8X)fh(t?5TN7|u`f4ql8*k$edfs0UD`B*njw){^mlj9# zh)BX45FIqlTbvLw(%p>J8V^}Mbb6_E74um(UhU-vh*z`Ax1V+HcVgJ2F@!mif6}!U zL!4Q0G{exJ;N$TFh+;sPb0mkmpOOS#JwRL0xA{XYy>MJRrHo#N(KS42h-k@Vk0~i4 z(OC!+R~j?RK0Zv+z5>-3W{1n8y<8z1h=r2hGl{&vsxov{V{w-v0BqHoLK!J0Ol`w$ z1FI52h=v>an*rl3HR6-t;agE|t0}Fzz%K#eZYevRqbgfdh>eO;#GZa=Clq}jlG9g7 zu*OWT1w7sLMI!MUe{1Lhh>vDyDCjbZGh}*4yq8x>YF2T9l5orc=4^2}p{9`9VbO3-*NrJ=!m|UybgJK)e@AY%P?0JC?L?eQlo)p!1tKLx%4zaemilon} z&N2G`JE!pfaQFY=Drqj_scuCnZtZU!;CB%V>9Zb2nY!OT0YG5+7 zx(3msej`lF){1Pg=FR42Ux%_1(VE=USc52x9`{YBrW(AiY9$rEOlV(syw zRUyyu^^3S7w;lK?u2{jQnxRYea3xB;4gWh}i|Vsy)$}m3l{eyERV-WP&l%&GZ%j~S zY^XPSuo*_Vvl3KvlH?nIhf2hQX~0@!Eu@5wiNI9=V3pOP$_5E95P+j?N4VjSpb+tR zBv_?#K<~%rVmk>dHh4H#aD#n(a-83Rw^E1-mK*T~x0L4llt!aaKxCg|8^IaUYA`b& zsrjo`MNllB3OAB4eg1uXJoC_SO9(R45~GnXA(*~`VH-?q{PfQssHjMe2X6aef9cHi zfIP;ep)vW{MqsJRK7KjQ7_|xpV^*X`ge;b{5tq_6HAm@a=4>RON~p$Vkle7?7o)4Y zojcN>U6eND!`K8*ZvV)>WIU7uh*WIFWh0rkt8r@kUJ#i@7*)-6>RV6FMx>*Crjp)B z!NkjL(8gISn=jg~^)E6j@+Z?V>!(r1uepXnQ3kKx_y-7J>Jh!pl>{+Oig;w@5le6I zgs<`KSi%I{Z5QLDLh~{aXT6oPu;MWQ8a;B4V8@S*VLRtXS(|%c4avFBYIcm zFf?~16?=HRnNH?MC)LUBM+X3m8@IVOoN(FBFOEppHuVNg_*fuD@*^l)ABVqk*b0Dz z=D;GWlMBmEcJG;HvVz%XwH;KM7wIJo#E!W69tuFp*;*%9o#S;{qga)n6v$*bnRYUp zTc|~|l$9Xf69J%z&BV=}Rdu1yg(%9VF{74CWZPUjYRp57;W7k!lLJsWGc`#4!{Wn= z^0QGxW6$Brac~RKe_0#C6Vf3Gl`e8%qXQq38x*er!+oLNi8m0 zU;{7(oA~6c&}dDqD%9CNoq^mpdu}xCf5L*cemDh@+W~Ndhub4@wMi?J(sV0l0 zT{NKJe%(Qjf!;sM82|*1{KMshc`b6+?7-)<9x3~l7?nAk8fdZrB5yio7y#i+ryga# zVM%|C$Xc^6W2lNR`zRudUwDn*q{>*5Er9Btnsv3>kuT)u;Z9KfHuFH)5S8Y8p{Fu* zhiTlb7Jwb$d7G_(*8#g?eNgWQSP&&lFtw7w(GEi!0tPs*LwG=dvqF>*Bah5Z zH!9oechY&Uq%VJDVH->(5PLF?z`*IGC{(= zcT+gzQ~`i_H=+$&`;#0VvWS`k47-WBi1?H){RzP-xO9sqCyi224@_7q*Or->Vm7e> zhQn;Y;T4{=7B=j-Vg_FoRrJMTAPF+U6~Q&m39gWKq?Wz9L7q=xOc& z;K}mYa0bstilM1hN;t*!=Qq3@nH^pRXy!wf>YsqRD~A0Oc0VymN4g1rU}-u5ai2^w z#Mm7pF8IX7kt<;6u=K?%5Avjto#aI^y3KY_c1c@ry#~eOl_CThUl}kv;}>+7W4G0G z)@w)F6JrFJ39R5%1nq12>wzFUVgYMz!QLPcax!k3RU^Ff(z)p_(IB?5U3BRM{=J!l z9blsi0?}#kbKK(a@`XFKzc6;0#vGjfqLTXxGxisx4&bmYbx9S?Z2%3nLHO%OxxZzO zbAhWZQ3`n~%0(WOB!FYS1h~y4nZUgcTy{>@t4UG?Rc?NWGnT2sgYKJdH^7<9uNr_! z;5YTyeZ-jgll2L!t%lY+70L|O(15a6T)-nUT=n~A#;8QxpSlo+=$8f}33T4@-M55oSkC$(1^{~nv z2q#Reh%>LqSC&^u_w2Nxo+#W=g+UuzMw3l2y-_8^+HEQZK_j_KkzyT(e7Apl_(e~n zYF*ThStH7DIkvizd6NH)M@|~E_Z=r+m5%clYO4f9HOW#5n7pnHeFho2oGE2Wg4tx; zHdw%5{52Jl7&PCH`g=;Vo{lql8Iw*P(Le+xuR=D)M$v{w=PK> z!RRiMGtIE=eW4e^)531W2IzZr9fu~7s4d}2@mF2ciV2&MjU>Dx$hGi)$p#x*Z%|(U z8ekjHqK>=MtVclY;d)`Zs)jmw-^$}q$@t~hqNEwIoxz^8qHYOWG1ungCil)*2}ub< zZ?EtdrfdF06|+K%$GPzP0inEi3EB88Cs6mIDbAiXgzlP?toUpkWoLRI`uGnlQhTY8*IEOeHW2~K+ekg?G}w`vZK+(&eO zo7KsrXxRK;j`G}hCt2S=f(&YQK(5(QgD6f|jVo8ei?dG|U)r+;rNgMmZr>`#I4+k! zAh(JLqsscpZW`YB@uq~o^o0&EZnT+C^4l*@>~bP9;EzKkY1#n?aOIOBO>OCtWJ38< z+K~zTF=|)AeWE91pc*TA1pcr}kj`(%EDGrv&{$GT}xMv77VM0f`wP%SA$o`Q!| z+3Dwjvnpo9fB`}jx%I;#p^BY}ln$X5&=`afxu}v)ru*=si6IK5ZV~Bz$i-6K+w%bl z+c=j1G(oK?l#?}DW4k7`x>b7@FY{15*C0hp{WKp`Tn#Yo-=+LFGM@e0<;nNNS|%R$|l4Ys{fj{*;h&f4SHT z6lPS{jz&clpP0BL1xBYby{xp924uy**|{R19Uz=nQ>upYnZ<^`=Ipg5!cc^w!wki%;fwd*3v7RIUI?3D7XR`h-*z!Dl9}Lm^-Ku zPDJMMs3D3z6O!WRkbiD+LB$FTBigKrGo7u1Zx6Nyj4{K6XdZ`*%?DPwmzGjj~f{CE=SwXBZec-7e z4!N?Y!45FJky&0<8d(AsEL8{cgWhs@sl-VFQ`mJr;wqUU2`_n`HWC*y?Vf>!sx~|>`rZFr7bWmdPpgnEE>)r7Y=vjjt7bo?{{*^y;$toau)dw%3rnO+JM*rwRlM3j zSaL-ooy|diJAKA&j>^Ou*mlGW#x4IEV*@#e>5b3VO-|v%HtZgJ8MgVbhJC~V?818F zJ*M|nnksJ4v8fxW?^JcmB9pFI9pt6)W$ASXb}KlJ(ZuPdles?5c2)eOg~y0AKqicZ zd&O%{1g4S!yVZXGx_*HcR)##zlH2?ZHti$Zi2ycd`27!;Pb*Xsu&3^F*~*D8WF>p5 z_A(W0A+f(w9};VLGY?#Q4Ov0<%db{ie#X^N35Pi2WR#~OwIj>)OreCy7#VFF{Z9Y# z$IMi1=<;72%g7lMsT;2A1n7(o%ppS(EV6T5qQIVdbf`X_^6|GWn#VrdiCt#oogO|6cN+?^5>O%z_$XKBMDOJTND;_3+@cLGDC-p z=PU-8cH}RAQ4X{v{zUx8!MPxRMz;G8DnZB@e{j#wr%O#y;y=%{Aiq3KcxYhsA0Mkf zunjncM^7RR0(VO(Ddqa|*Z4hj{|75^&a?y@wnq=&?+UtaxmKA9lUdE1X!(@n z$@t^1*Mj*rs?wK#wwnM5Gx=gJe0cP+PC4H#KDI*_4Cj^>?#1rE`mYsorKEYY|Jj15 zP*ypaJ=|VD-JGSl*_;q9E2+-#%b~kIM)56NO`hhBJ@d7ro2>7M`$g(4Iu<%90wn+Q zvC=<=yJGdb(gB5gKGbv)F~u9Cs>2GDdhiLm|M_H=Yg6hm`Owy*Ko3jGwPTb>k}r;2l^I2x0;3gUs23v0IlbG?(zG=Tb7U=#doF7oBM$QIU}~gZgqrT7)+ogqu`XbYsxs;M{Kp zZN=*rnzc^3>HHvyFGq3}jlDXi%`fG&w{SJL)mpKawi`Y+-T7_v)F}U-k5uKMdf`kC z5Twd5B>g=*m<|SsS5*5i)9mN`_xzDRC2Gdgj<9W2`+`Iyx>l{G>ZX!Elvk(-iz(^8 z93>iugPz2#1iq<|rZsa2e=g&ta&f|dyTW3b(Cy1n4;2`hGs|=(&-N=~ZNr2aktzq$ zT?&czQQEJ+=6@@i3-&Kvy|fP1gHWt+#KplCJ;1tjBB6`4z7fvX_-aK^xyTkSmqvD3dxQf>H;}W3SMZPIb}SSeAaKQNgMY#U;eEwl8wF6$Ju7R{A#8+ zq1!6h!~~UKx4{xg@tNVv@nsv2+d6`LCPPovddz+>rQoN_g1+r&S&^-R|JOdDmKF1T z=^+=}TH-IYH@dv9gvH16yLmK7U|9PHpCPc)?n{xK(sjn}OgsAP-k-NoF>3~xk zrt6mzsWn`GbgvoZ3ASSR&oNd)`u{dGd1cJnPQ*vI{&M0-i7-Y+uXr8VZm0w^w6{k> zF_z5~UqqCwjD3_ZCrj0KCpsNKvdm%|0Gk(z(ALrCC=Or-uPp<~68`7on{a}v>!W>V zfInhy=_yZcZ79W!&`$G3<7fL{PENoD=%N{G2$zu&ot3krw{S?!7H4R>Dnm*r`Q~kb|p>0mBdnku{!2|KE0&DUf9ug&;QT=DtT~bz4rq*2>G(9 zj-Pl->+NX$a3%?P>w+o&^Y)*t*qEF4KN*@Qy)VA?STJ2Jx+p|6ak=iIBmU>7qE~6j zGsfslNuTa4z<~*9RoqN-C*(C~$ZL-;r%rY`Y{7)VXX}gBZ`_9Y~-=2bVp zJFblnk(}TP)g|WZ5ZWA7Yb8kVKc9{0#`ELP?^GI}iX5cDxtk1m8;1w4Xo&Ggdi-*R z)IFaYr1fP5K@R&QmNa#kE19;nAyTanZ?CVlpPp7m9WDXvG*1gd@+CUAwu;~io$(2q zV5`udHRyi--9MA@EkHe^2D5Z<5V@)%?l2@sK9k_wnC77ytR3>pnH3)Pu1mm*Qj7(M zVx)bwSE@;GS~EJ({aD^U|BFv7Wkdt42FWB3;N8MQlNDE)xN;5;Zen5A1)g7PVPD>8 zm1Xt`jof*qRD2st+-0v88Y8WFj{;%HmW2N0tcYV*w?3wq9Y1El!y+2~ZjDxWQC=Im zOTIw|DgWomxz&%NGdYXT!tqX^_LfE(c2CsE7JtbgqTm0;U)EGEbuPB+)nN7*^*Hsn zGi^*Aslhes3;HbWp@}c&poYn$oz-!LbW{s5fF%%T0O9WohY#%HmyTDEd^r~z#?bwN zMz>!e!RbIt|I=Axibpz^z)Cp2!wSuRUP|aTRps*uP+|4oZ$TuUVd=?o8H?t22?wt= z`10>4-*iy~N|dp(!mS%`HyFrJ5xo)13I(+_?tRsO{eKG8_CAet3En=w{V=m`8mYR{ zoDZ1e)@Vt2x(#;+4wIa_Kd(`eN;L8uKB%15j>>jh@*IPNtO$E-_xt34V`3g+TJ=qc zDRKVbH~Ub$ne{fuA4(_cTcd{5OFO*4DYrekx&)#O=mPiOcc($I-MR@G8rk+gXQ8=? z%F{1^Gc~tbNHk7visguXmz3n44FR(E&=d%~rl+b~RNVx?*)6*VGC0_!`({4v0l>%^ zcP6uNzzzva=u`@^Q7JlbL1tJ*8&7+h!A=2Ze0OwO3EEl()b-H8!?OySX_5nOQQ}Uk zcwJJ@p(O=8XV6r}Hhh9m;aL)`(TC z2KPNa`By&+3421KfApIRd0ZHH&6_2a>&B4-q$elou_3aA#0Q5Ax^gItL%rAYX@dqn ztgHPa332R`TWmDnhWp6va3vcB3Og_2w;Q8BpmG2of4TVQ)<_WZHWzD%Zg9?2NVD;h z&n@)t(=~-GK9K`or?XcSzMG1==H;c#;JBrO;-G3kZ4V>mvgUyat5DJ4fA!Mub-gr^ zF%JjF9e+Pl@J}7BqoBfH%^N;*34le@dL2-w>;KYA_n`f-8kbYu4^qiUdxg5LEYfo{`a!W*bD^A?B&^I=T?rq zR7C_88d+0xk33gHHF5IUUt1hoGh&ri#DI1Iq=HGP2 zS?U+qKQDOD-o0YG`r0Iog_)?b!lc%QwRDAx6( zPlBJ@bo^6I8yf}HAx5HxfhaCRY~3g^LL7Gt+NEt2-$cW@!2o;`l~v|r4GaE3q5wQH z8lkor$-o2c(Mq{AMny;v7yXeq>{Uiq_+MhkDR2M48gQ)`RfUzwe&bofgBoeE5*y#% zky$1JcQNf0fRx<5lP)<3E?5??c{NEC zQ(8Rsv@oXprnsw1Hb1(WqgtS;Bxp)&{M|Ux(U+MtrgZ+;WCwNOr*ik=99mPKOSGz{XQGJ#AG2C}@oa|MGm}*NJ;QT)6 zGgm;HqFD)1t|T}v8@e}#XCn-@>i~ykOc$@PebOJ`bVDbVGgAJ5nezzDl$A@Rl4aMb zVpgO`O!xTUnn?uBkNtF-np&j0$kbK#b*!?3eVQ6`*79!Bn8oDPn!Axj_O3MDh*w?x zq?1Hi6_=kZ$o!tWnadBzG55475DzUwvkY9upR0cAiA4{hV$=x+&hY-P&vlxlv6$6H zSi8xE1EK~gZl?3_ZTnBBOy9{RKW`oJPUKkhl#|RnQWnZ52zlL((JXJ z7TZ@LA<$x{V!e&2n5o(y9?f!v2nyr-5X9z6-nIq?LC^r0>QSf4j4J|(wKz` zu~lJ@}k6#VqXLVGB}iRDz+u^lYi3v5g(3a|%(muGNrNT-q^ zwGULd4cZRxXzn#3v7;Iu51dXbS^}m!9AL=y3EU4?aca;JVd*4+OPn)1vAYn_zGMJn z5j3%O>yO0{2%>J?A0HP_D*>jltjOU#ad7a&OeA$EcGeQzi)Qg7HHa=JVm!8RDO($= zG(GBUaa1e~7=@+bq$Cxmdk!ZSA5;CO7;4uV%AZVeDTw+%;;2Eoz6ORy5b(3q(%XJ5 z=yx4Y3h@6_7IT*sCg{>nM&RvY?#fjJMTyxczqt|a8VWmfb9GE=Xm@6%uUsS-2lcPTf;*Dp?vz-+UG-(?S4(j1z0MgCWh(}Uu`Prm4N06azan^@YiDR4h!u>VXxp^KKr1=fz z<>Yy0-5st%RFfSNan4Gxvzw?QNm4HZcrca}Z#CC0sZU#J&A+kYNhQ!Q;@l(~1q}_4 zoc5rxA&vTyMvrv}K-5(?&a>l+Ju>%}ao(N77p2WTgb_e@akO;`IaUzMrM~D@# z`9>kEak16;k`cW^Om&4xe#Su@rXPF?W>N(y`f!-oHk%N76QoKLfO z&uiD;e0En9SsaVRYfo2Mikr*;@j2k4q=Vuur(7Y8WLy<=XoVq+$0^Hi3jJ=D;%2F8 z4bZZua^>`Nj^_fy)B>RkA`nc-2E1USj0lnV;kF0TQXtCcg z?piK5_=(lz7pV|C{17{+d-PNmf2$t*@Kk;9P~8tM?pD*HJYxcaNMxq8Nyg19)v7CR z+T9E~OFctt?DsZo+&#h&q-ov}tFsxDzu=bKQQZo|GxoLYmD~+NxTlYxXDKQ3Pm@{4h*tulSG)6q7(A$dw^H=G z@N$e=aW6Q(0y;}H*+$QyCn#MgZ{*l~_32>kcKCKzJwEO=_TQ_=CTDjLh|(T`#ZzFL zcr65P6pEn~)rnisvjl4-)!#G-bpD07AkLC%kEa7S6N0*Oo#kWUFC%PFtp3;a!KR}Y zvO`zE*eZyF5YGWy3i&;6(AfRyWxIY^G>`z{=qFxSfX~Z$VbR=YL%j7Hkc=s^X(mIH z&%BBQzbGd>k8;8adOx<)(G69&D?T1;%>2|78OK~5rk+@kCYVe4dA=nW&gw4;qBTcq zetfZmtV(nj%)&E!+y-DlAJ_zYp6Z96(~Q+TlKn2aMy*_YeHehA_- zyMg4oEM(w)f4OmXSc)#QN8z4tpuNE-KrydD4vThAPv;PIM=N2@C7ofvz$V61c5?X~ z+&j)C;1!gQT9^5*vffAwX&z7$z@Yx(Wnq%rNH716xhE))K&8d6@*bz(9QJQthN;*; zRq*4!#saKzX5>PY1?&tgfrdCFvs0vWDvx3(Lg0`Z7ewjPqb0kn1d}f@*z%1rC z8$+5Kq|vu}0t%K_6es?-jU@j8t2`zwy5A;~AOa?S{@s5@`;9hpZ0vn-yK$9SL-Qb0 z`eBo>ARC82LHZF4zq3i@ieY`EBIoaE^6-_oK7Ac2opYCi+R&WOBolCV3(@iEnT2I1c7ek3$0`~7GXb3 z)U&Dom05JnhNFlf!C{U36`q^6*V{;fyGY}gCL|0e9lDhv_3SMbC+QPaf@i|dJ~HX* zs^@m)7aAu80*56CTiA7{N1MrVg9LQ_gy_h+f;F$uGF#G?NI0h1QwCnH!t%Fz68JjW zApM`e6N-)HuDsvHlFVq4(I-rax1hjg9bGP{KoZo2gBu`~gyL0xpiHd8u;(fRU+3vN zxIKk{$}IQZ+k_-ZuLe*pp^Or=N;;?0r3U-f{$lKksYPQ1-(r6=-SyoyBnl**P#(9t z9FB8L)=A&I)m(*CV)rMxbRiQVoZghhA*M|>p~{wkZS^khV=|08TNxW}oU?R~%Yf}j zi|6D{;B7`Jp-qQ@9)DYiT|j6sZ@|D3>Ccj8co_pjvT2A69i1a%LT4XYs34-->xg@a zpAIXwApKTUz!s@4J_e_t5sf2n!W_c);SveaIMjhz%uMNh23 zQ5C0pmpv|`q{m6NUdTiWT6kApw8r5ZNQ}uXTQ_X(7i)AWmy|*WDTX4)3 z$k(WJB$mB(1Y41GbIz3w!*xw?>UXgDVf}&{%_h_Q`O(Aent0r6cbW2=!Dk7PmRd@G z|7X$;XAjNQ(0<$2Zy_R=@+3%4B2tv#lfpu4ZDeV%3d41c=PS%ZKde+@c|s{`_YtmDcBAZ}W z;d+C9dbMaYs!0@|#F>2UykJS>*XaQ}-`QFO^Jz%tT~Ee8^4k|I36rSw7gYpxKU?>N z2S1j^N0u1$x8T27=Vx8Eg$m&hgD3H!C*&9?k-Q-dCnQti949A$)&IarxK5l=-rBR5 zQc2?T!Aj3A4g>t{k!pWC0&=N5T+96&qLTIy>PUK@lT6}Ylk#aT7B^Zlo%m)qTtL4% z#ds(QeJ_1iD|Rdy0Z5Vn&)a~cGuR|za<0z(SbX_aTMis)Afx`zb)$6NI zi5VKO2jL{`9@txGBlDZvR8dR+>PA$T8$uX6da73J&w46o9poxMz|P_c%?W_^ey}MkU7)L<_XgY;jy>MI~zPAGOEz$l4^= zJdxAIOV*vgy(|pP4Oh0g(XcfzL0Lc>(R@XzdaIEUUgw!-YvPSX34ZjT^{O z)XCF&<*nxsc9-UxF=fP2)niRRd$E$TDnarm_Zb)lw5;RdIRaZI@$sQC7RgetpFyKeI>fLa58ZFy2X>W&S4Ji4TiwAFY9wW*nB} z;|87SvD=l87icrNUcO0#q-k$1t8`o#!gwo>N=5}e9e@NSUx!{~NcqVkA@iiEXTBM3 z7l!6%CQ2Hh5AyHVT*5$F8(j-7Ami|-C2i82l&>GwZc#6w9oS=Anf0NZtU<4>7`$B< zx1nK&sF$=@_xXn3v3E7!0w4SK%;a<#dh;VKuH`f-tTz|dO(khrAJ&6}d}CrkJ=90( zyx#O6&93`amIzk>ST&d?{xfOa{?_xl8V*gyES~)FcT{5Z@#GAOld&9o3_>j-G(j>_ zL}d`Y06CRIXE5TB6uZdk{G&S?V#8*>Nt)Csb!s! z=*=!mP(s@~66LljkaH!sAc>7{w|X{BABCRNN5ElC08T9r=lpm5XR8NdFbk6}SN1aw z!$#Hp7-UI0SU6@+eePmB)}q%Ua)xbSd6Gb|;z{FEgfqWi0M3(Dm&@i-PxIOS&| zI(!@kVz0OYRq=EsWs3MBZJZ#gm^ZaSyYM~DYIk2z?~qo(0+KB>*YlXQ-=@TPd9EO4 z0E<@0acrqp*7lpGLfz#ON?}-q5T= zIMayCtp!(`dc4FJlEJr%VfEO7SP!JyejUTAik9%+GeG|VGi7w|Q2V0q6z4f%g*BIa zjtbJ+F-7b44AZ^gc<>!6Y5+T{Zocps-4~#?$l7IQMFZ((lRn6@$G0p#1P73YmrP5R zrhlhJa@1L9v(Re=S%QAqdfQ+-QBN1}P8_1vUM$wz4`eQ|OQDI1%no(m^MdS;hDSD3 z_RWyen*EJc2|s!tjqpnvmwb1FVO|QT{Xy=7#0ocBQV3{lB@L#stnB%H&pA@t`P}TD zy2s#r0U#fh^@YFM)Yxq6PTBOoCJEP>fcMzp;HhMn=ld2Cz98Qg*z~9Sro=JY8w-fX zyZv3lG|%+!rWLJSyosdpe?j4{kPiP=0+CugDG7<$8_xk=#QtjKp2Zc?O|L#xZikIT{(VC;WG`B}AN30MrS7-?&$?vDzbe z7BusWv%3W|4xFk40=m;Sx$B%+K=Zr3-EjOa)*&IpJ3UxW-s47)U)42=D$g!aJ}#V% zKx@*lzc)9kx*i3}|cLIJs@iDL}BgLXcAnDZY<|6F)!v|9Wl{^{U|rfYI_G2^zVWkvpX{o z@lJZ`2=u{z|GaVsn=aV)O(G^10csl}#W4mqw2?DA1uZ|yc|7&LCo`+l>MH44q9I|IN1#(Dr(`G zZw*inUW4MJ^1lr~m&L31Qf_C?mnL3nNcM?~P4FYsuRD+{nZZKOu(w2PCYuD6Rz{PQ~BHF0IN-_l^|c z@O!_T1ddalRFP$Zr|NBM7XA=zpJZzNN{`Si#YEQAWS)&a5?Dyhb$V}flxh@;0WaeM zV>Z$179}a#sKy0Z1y|Sjm@WaCs10c5PBoub5`_LsTeZ#ULt+wCLY=KNK@Ha_n{n*u za*~k^o$Bd1*xK+%STU-E%R?JyJzCpgh4ck4w3C4Gy6ivopVo$bnACVX zm+zx@{PD)Ex96 z+P+lVP#I{z8B-xn&z;(9aa@^axZ|8_iY8`S@(syU(R|x}3X-9EYe^Z*2s!nu+z)^o zOvZefs5@7Ky{Uj@eCxPmtgAY zLwY7&o8QGXGT{JGW2bfr;(hN^f#n+aryXi_w9B1N@bAsQYsyY_vROrN&N9nw$#j&iHbZ z5-W{`SyU(M58_Wcp?B^32v`^Y77rlxZ)eMXbsH1Tq~tVZbU-fk&m^n!!Yx~-Nn8uO zonkLX>&Ol@vp2dkw3aj@HJ3$cst5`Zmfqq(WlHKhJIzg~L_f#O*=MR%de1aFEq2=3 zilC3>NhdNTSFo&27Va18b8AV2F?-=kDAY6$8^VIoSacZkCH{-^+{Y7vtUJC@=&zFV z(K8KbWc+Ed4u8V7u}+*e2;7TS*R*l8{`l6L59=h-TZ}Ef2WqD!fF&D+*Q&%}R?U%o zj&piuz5OjfMcUp}7LbwqXT6Y?t|kcI3*D^%)wGqierjk!SVWv8z4mb5D!m|6)~}Y9 z<-Ou2-m4r@SB5CRr-DJG)1ascl_${!A!@Gtiea2~0^~&)_yGb3)ffh1wO-lT!x3<% zrK^;nkdj&~;}fUD*!E=gsUVP+o870(+ry&eb3S?4vX;^UosZ!Vipe(@Wp-e0Jtgtz7b5rZdu#L!FSmD_^D# zSYVx{pS4iBxtL9#DGMB5_&cxoPN4~k`sphHSaEXsh|(dAQ>Yn?Y}0+oml57q=7d8 z#SjSECo6r7ZSr7*4Q&^^AIW=ti z;1z6*1FCj=mzx(4^1KRG-O%fdfnVh|6*x=1HSBY* z=^=58-Sv|iC2$nV!?MVq&YBe&Q-iVhCSjK&gM&T}5AFs+EE&BEj6mT`fl>hVUKLfw zslS|X%8P%JU?1M9{o1aHB=XR2x_!2|mB11f<2?OLxH7xS<_el3P#^^FNP)?4ZqnpJ zzj0`q)HSLyQ#L^+0_;;E#{9OE|H&*m)NLC?9$qRkQdxLGjf3A*zi56Y$s=^yfZ>O^ zynEZG))j4bnL#7)Z?>zw$aY|}QoT(kJL8L33+gLLZZ7DvZ9DevC&h`sIW-=Cp6n~> z2v9YX*O0bZxw6;7RnCQ3i{~;d_aA?IvJ>PS2F#WaeOsp~3m3L_|5kV6~Z(phiq*)I#aA_2>E5vGPCc+P z1IY6ORq$bJk$D`#%?$O4L}Hsenu+gnsA!+Oy7bel%tIv8V|pxMqCPle{ikq7u~1G=4(WvV_A- z6{@{|nc%SRirFZ#BFg$pH?wxpQJcP*S@um1u_*8R$*cxhMg7PUChI*Hl_nW2Jf5qG zv-Y-`CEBeTjL5^9`hp=k{q<$vBsEGaooj)vF(5ee)H#6nZabD{?7L z-emL>d1gsZ4}!(7vxLS9`!|vRy(W0ommG=6%OkH%N#85rWCbj)wp4Gavh1lrHNWk7 zPqrBLyrZkza$57KLL=R$t`6YiN32GovmBi;Hd3bj)z05z;hA#NF@nc&{bAY7lmvxaW*1T2@ET}bi;4J)pHRk*6{!%TS-C$;pj8=FfG8>Mz zD^m82Ov>;cZ7;Tu`J7H{U-XEMdvodZFNC#_U^arvGA(Wr{jRR}ElhceXzlsvW5YJX z?l{S5S6NdWUp8XW3H;5e{p!Ptq{_o7iD#4O1Eur6L-!#%MU0B}k8Bc-@tm)n&dTOi z<>lPxF~RE}=&mAsB+_Cr;kIcy*4eZKl8ePb4o z?0#df2e!^U)Qe#(q!|xrSM-&arrBO*lz3BbB?z-JddhjRPOz3ra%pl64I5$Yfu2Q2 z;@JVDm*#E^XhnC8ONTibTzMFX75u>GF6J0tD13Xu`|KbW94|7mL*^-p-DIi6I%VM? zd_LF7yK7133X^sQ?(CotZ11AN{IW|wC+gqR~(WZH~R3O>@pBvE67+vK1GdWk3u5z|AgG`{-_2jFIRU-%flf zl+)%!vRKI^bBjV&zuj{tfy{35>BKVgn?bNC3|}AVww|JUSLbLQHZ3#TVqQoF_+@ua zJI2fxuRr2xw5f)1jeK@Wn9!QQZVmiFNpIhhAkOZ*1Xn8H(1Z}Oi2A&jHe|N?(b%FN z_1+ljlEyMsZIV6f!UO;L^!5{3xTT+4XXsB6X}?Wje#f&Sn$Ni231ar1A73_rDlpSz zFVl$G?uqtsSuZE}@Gl4LI1>L*$>tNIM`ntslKECBLRxl?xjtn*t@!Gl&9i4;9Z$Ly+#FkzjH_(;Xgj%p z-4QE2uYJe7VoFO@JH^d@vb5WF9%L`|`_Y+hb?97TRhE1QAFYpt&=h@(pKqJ}dKb8& zHSyL6el*|$VONayI!t-@0QT8!x|H|nsqLQE6ZxxR7KA*q+Mq8v}AVQdCX@;(Q2^=D&TG;f{q764L zTZv_c?4QKj84^HD2Y~u_ELR?6s{3kvL6E2$Y%`JyZBA_R0iXOz`_#or@1(HnE}@YR zKB?KT9F#Po@n+5kJLm=bouCCIDI#Z)yYZN9)-LnGFVpax#kx1d@Ev`3?qkxFF`xzS zB={b_3iI=k#iRcawgFGR1uGO2x)YB0*j2ZSe4rgEXA7>7bOl5NMfVhH<9hF#Y~6$1 zKl&$SW1ZxaE1)8E5DB(ptsMlaF||E+2IgB~C>Xk(KE&3ZOLb(?G(F^C+Wr!^Fo!-@g#> zuL&v}Cz<qX;VaovBJ$;h;<#q)vcoi;j=@5^IW0ct*s2-!M1Atb-iy zgCqi39H3BGb};KXMRUN^n`pSk$V~l)i7V%xwSq9}#|A7NU!YmeXVw`p;3H4V{P(5L zk$a|AevLo?R*nr!Nge2tE1+J$Bko>sgtC#-Mh_ z3$5j~?1gPV`5=~-1!!>19=<*mxxoKb8#>hNr%UZwN1(t)7@`p$Tdb%e!c-r^ zan1H)6-^CMjE9RTi`o#Pb)dxTNRdZ;QRbhL3i=pumwvl5f%;yq0*!t87R+z}cc8{G zDv3Weu?Hp5@%eEyM-ISy6E>&c@D<4RdTK(QZJ^zTLlaF!+%$nD1Cv&x()rhgBU%M| zAV+QI1fYmHYoOpgZ&NUS<@%s&@Pb=aE7nqp8y?iY#%tcE-yc*CPN3=rI_2*ae$g$B zX<}U-m;7B)eAdU&6bo9E+td^vM4;?~-lavqRh77K63Lx2r_Ny4uL$9c6_Ef=I9sWd zRG{!VZN-e$)F=d{4auy|3M3#qEZkeflIP>UAk_NfF`)QVbTkT1t%muhBmXrTUqFkxT2w$=8j8lbOka!{IK6HPyQYz?)tcptDT8lem$RcErWa=l&Wh;CocGwb$YH5ALXWF5@` zl|1lNt-_7@>EXy!lE)tDhZPy++P{2F#GA>x|C~6K<@}O9Rac3!#xI z*e8uILKKbGv+2bQN+G2a-Ed>AN5>kjmnbN)XrcnZ?g-bA2RXY;#zmr+P)M9IuMda* zGLUJ?ukLNc!=eRaxZNpOP2@}vz>_~&$jI4|ksTAE={m886+!Rr7os7qCKl%lYjyi} za8$P^+?kqu<>tGELHW>Qg0(YBE21VS=zv9b*S#4ZR$i|DH-wv{w*C-qI;s%^#Qc^% zpQ1AA1e*;1vrze6`w2-|*CD6FG4TA1mt{HrQXj|!K%z4mnc%3De$21Oe0pU_Jk)fY zz$IV{@@h<;X`XYHbfPpG+BvxlzyIpIH3?#A@k?Fe2Nuo7)Kt5wf zY?0V#agc7~n9u%din^L6KI3vgryK-(9HKni%grZF)hnKGwxh?*zN)-qYmFb~quEjS zAgM9#YN96wpT6S21(5#Hcu=sAQ4+7!s zmT${#UcgO!0it0WWyEu)h8_*=(~fHtidRjg3WZIzJZbUjNkQ<|D57U? zWYkZNA1GQH>8LtRjqW(lPc%K*Mxu0c`0X{6Vfc;G#H-}zzLj1t>G&|$ylSy&;^R(kY0`i?DYz>lR!UL@L+I6{y!U4?o$7!%wXCZdJA=6t$}k%(S-H4|6W7rb1r5xnqcoI#&7Uz`Q3e4>u~dDtp<$n;~D6+iD)&=1K1FJqq-Kso%j z3p>wQm!glG$1%O@Mo#c)9U9rG+gA$EclnV0j5BuzT>qLwMxw8dEAxIe`I|e_ZI$L0 zWooEFb&Ja1SW60h3|ClPfuhGK@n{C3%BZW%U#gruU)}=1@9aEt?5rN$QiU0eD5A)s zj4+>45*Vt!&f?~(L?w&r4I%(6jM)+>rOpVt)#Mu++`WS%TWa9%5;^? zaH8$JNM?2oaAA$TJn>JlA;~kAn4sgHXZPRC2~cL|BBK3!^45olhjNihZ^ia)(Qj^e zj`rIkLX;<0WTZ!z7^5C#)sj{_e~GntwWA%X_EDWl4~+5)MJ`V3_#@`3y`v=xPpSBy zR(V8yyti2h9J$|?#7=mTSismVdhr={Vxu>?41xsBpN#i^jvj6=zU9_zcuqV=#N zXt-o@#iKX54IVMV2;hgK?%)PdZUVM&l1U#AYz_*tvjzD z5_h&8qFO|{wpuYQex5X-r=zib&e3#G6w8n58R`iFzI{P72FQ?k&vQLJ=We#;4WqZ- zM7);r@`!V4@b9Hb zN`ljF?=NK;HBaTHF##(#W4?~!5Tp~P89XSuCjwau+j_myKo4q0hgW%NgJ=uy*ky>_ z6r>l-0TQ~%eqi7Z;{L}(%z5iz_g!FAyB@~X{01AecXUpX`YRmvG@@7BZ7UodBq8~H)uw4X- zR1%u?PY7?UmJcZgxE<>2AvB05WNb8YOrZfkXwGb7LWu#9aG9XV|FDS)p{zt;o z1}jBk1QY3FwLV$XjhuIjb)-)qG9y4g@qsV|Vty`Lp&SUH$G^|!_1*g-JfkA-Zlq7( zAs$hUN`4Jwe70$M%KY;p(?WT2tN3-&oP2iG0i;$3!i36C_6K9^5*=6=v{w+4!ke_s zQnNOR!Fq?%PNZ1NA=YD(jpw%)uCW2Ft-wp)*^R@Kk;B0kdt^aa3#4bTswgL0mv}@@ z&qw6`HK|gHR-o%YSKjaiD}()=O{8iFv2}Y=262cxr#VG(tvl)!DIf81M7-uH$it}r z1EhJJedGCExwC<*{iVPX6g$x*r^CTxM~hOF9+_0*ZlsO4bwoVxooIPPgnVc~9ron* z2-L5h2dVT*vIBDcE2NX&WnF4l!8YP3DD-QEGUC%5#`5Q-$GR#Y=85-I45XF$ZWGN& zn9^>o$y`&Agp;qs-Rw11)B0ITrw$9bY^1G0*%T#N!w%s8eEd8FSU+FCiZ#jPT60%# z3yH%R45aIcT@n}oiU#_J?0JKmyXQ%`AcH?Jm}udGOx&6;gMV+KpT83s%!HXf0@cyNq-HsHGSd zT}YqU_F&9XwSUAhR%%ai@DZFfVgxpLCJZ*gOQlq;R0@nV=?1zS*XU8@TFt<`UZ#Qr z=yQm1g<4g{p`~t8$SXO>!b+pNT$)(HLzUpwFXGzdY(~4i^I{YSc71#ryhSxkE z+1d|Eb*0Xhx8U_VgaLtiK3OkmTs$U@z*c3-3P*zcCgm^>)}_vtyw9j|qEWI)9s~@IsCcZ&OsCqnm&ZX?k4yKgu_qXjGjyCa~M|(*tNa!@x zU>!phOs<}pV5RKL5mSg4sD;1;Z(3{}qx27Eopc??o+tS;OisMU0j2EBFzht2fb(e1 zRZjnt@5)Jj2v$J;Rk~FWJy4x8$EEDdI>IxW*~;g_kN+zuR6s8alpo59YBfN`(E!4tQ3x?SJeJ?na0>cN@L^OG0IHna zyrje=S*LynfkYxx|66QTtsJ<|z%tH3F{UAip9!QG4L{Z81ezX;18<*_4)%glGsi^t zN9?zvW2Pmh@kxx}p}5&o-Nd(fq>kyhyH9#O+6~MD=2A6qJEk#D|5g7Y+IHx{X-S?f>`rNjBBnL(OHGF0{_F?APd}Zv5O7NqaUoQjc#OpWjLOl9Yos@B$@S0E9ptzxqAZu5GPFU9f-oO zA`2W~6A5lkM5aapEQc&0TYI&{2;9HGph^MCwvF%mqa(t7h=>4YSEf^CSSH2>>0YOp zC@&6h4f>z@gQkYxLX77A^vQ^h!?}}8W~&+u8%JCs)$b45c%k{tOs0tmIqLyWdOG&Wb&wkl zCk!|$AuVp05vGq-@O|L^(-WU@f(yHXdxE!?rxC|5+K8&d!R1BB7^ab3 zZ?g>3184Fvl*WicrU8#uTz5X8#YF2WVp)3|G^Uh<^05xW@!p}6ltMjMZ;{5et0NV& ziS*$Jyzr_hK&GLOykiR~zjFL`LWkqLl-PVo;C4{b^d>@C-k=SEMy9C;07J0oy(S}l z40sxFeQJfd4h84fGJ~c66&yUo38u4O?;?1H)Gewt#PxKrzkb$=(XU>ux6T);{64_? zo2ImWn-=5K1g}`IyMWi3z@_f;s?7orytnIc8DPLWi>9}hBVzCxBdKHZ&^ipFl=Zoe z7-^N@u%;^y zsD>U&q8&ib2?#0t=L2tPzN@=%;EsJ5padg?Q}g9ase8CLp6Y zTc8MguS2{`ky`N}bEkZ{dO$9>&ZA?CSJ8Ls1RT*MD|T0dZWK`7S8;ZbR;P#bNe44B z)m+$t9^YcW_@~olSDW*2V9{*W)TM==Ri~It`QRvAY2a6{2&S4*%#%i?xc9}POeH}C z|M#~rlBdY%ofbJ%l57FMdbalk5N5U+4}`0X7hsFnFAq4C&8N#NywmsEznzu%D2|nC zVmQs`(-Z?DF>Sj+*YRg&m#51y{w3dmbXpnc9EI6&HyVz$oN>)s5MTD=ot@jKGN<+8 zmnRUrLc=i?;6eS;d5ug<90i&I6^wBBr8$9~_oxH-D6P<@20eV z%sGwvR|~^lDX0eqNcQAAeTt6|L5pc&Fwz8U5M*Bv2wmt7V3@dH38)Lgc1vxbWoW+$ zp}u9eyLp#J7P8S8`w_Vgruclrf(g%2q4(v(Tc>bm6<%q1> z38)%p)cFE*+p{YL(YO!zD#4A5c>!iGW)p1tmttd5K&T&DPqwwqms^4$n6sb~B01UF zbk`|nQmL#u>>|r9)~G2?%f>CdWIAWz19K4hnsAsvz@unn<8bZzF_2h^45%u56W)!} zl%S$xitTwPO4h>TFv2nxrvAExx_(gi5vV~y1`NP|;bnO?h^Xjiiz=RxMt)nkW&@nj zVvcY-W2jNbu9D9&B)T_Ga-?!2mFi1m61lS6pc|*glV|>I5~yk85$+X)h%M=m+|GR; z$J`LxAdm?XrIspg1=leiOsHz+&NVgF-PV3W+qQCo*1B;KP;Jx22wkR42 zF8dGAR)|cGKB$bbcVKO(dwH_yOba5VavMa<>&^v@jlMK#7i%V2o~VrdTsy!roAHNz zcN0ILgPT0N)W9Nj+pL?lzmT*!hDdlTv(g6DeB#u{L{}p4L3JK- zE~ue7hH!}T(0AqXjLH37o|DkaJOIjvMnLyxEp;wsi>R=kB1uid>%PY4u2HVaW81gf z1lV6d{)eH0p$rXdCea9bSi9w-r zIEqvIN%8o@9W4*?R(n&WD5&7-5ixr86}&%U&)wATZXQ&v84n-Bj=Jh`H6io0WT@hq zBJGWD@11?ka%PMPATsiK=iSxUrDGV@ojKxiHmLHbEaP8AT`z92>Yy4825wj%M3yJ_ zr8U62*LL?OPN?$AvwQvOLw@p0CsE|;o@}^st~SM4@NRHzJu}9;Qqqa9&l6#We4p%HG*b zoDc_OzIZs@Tgj6ypQ$S8NgStx-;E~!FgKj`Tb zn&UR(EsKxjNEBg}mnYT<&x~*@>-_IpKB+`nFaBo!-!^2*bBBudf}*%0jL!jY++2CkjHOowIyu$ALhKb@v;^PxN?$f-~@?Vko=nKrzkebAy4 zbcy|^8oD2{G;Y-5$x#LF<*8t*ps2uik`fJ-tcWploW4SkzMCLrnqB$==)!AbDXG3O zupgksNPqU3>bRHxH13N0^uSahoGoZQ2DD65r%pU{3la0c6LuQx^K z{*`3v>A+8(SE>sgz8%7L^aw(#HXVdaEW_nKkXtt#@27iefsL?MI;stG{0`mR3HGa4 zce%&`OpP_@!>un^V(Vy>e9F#(+Akk7R}?G~j0&Qod@I0jeRu@F&fp;J=#f=1ruKBMVIIiY^p0He|L~$ z|7RS>vkSs44z!{ZeU4@Afg(PN3)kd;_9TmD&-DH z(m04HLGq!>^G&3C0vLcqG^#kpvG`^mnj(uO7dy*Iz^RyWSG|UU>!pIV?Z;7oII2E$ zaH-2&oe$^&B>nyik|9sWjC%lXDmzyn_%#hLWU5bgkvjWrrnq1~p>Fq)YwU=iDUySL z!HRb~WY|f25~@?B5^~|5^}Ricd+Jrx;G-Ydk#}Mh#Z2e|hQY{yCaP%`$H+RVy&bM` zP0P8&Zbl9)*7k2XVhI92YO#-L_^NqaJ{|1kw(}8T%#CeIC$3EcBsjdlop=&xCdL#C z2dah|uG&m3wl*H0jKydws!39|uT5n$!Pno;Ms)a{@T!g&n8a!5U@p|34!G&L;586s zrX|L8AxA zS~a(cL8_owGnEJi7V8*gLd*cdaAmn z@L2U5`Z4nwW$ZlA9kV*tkMrIeWs}$iXe~5BOsc_eLg(8vi~X41&jZd0B9e^s?WQbk zca+kmf1w!ERI1Fa7|HNbCpi))tfxP(azR{|_Z5E&r3`<+LJv)<)2hu@DolQzs$1+5 zTpJGjDNDerIMtdCrTN`GlX7B9N2=Es*r$t?F;S{4&$&BD##K(NqUgcQBHy?#@NjS(I7h|C8*WZ$0UGotqfrocPFQ56S9Nvi!fg*@Rn z5tHD|&g6ar0{VIvBy$&#R0@^N2psTlE1NGTeLa zaL4f@Je==IZVr~+{)?;p>#Lh=96E#mDzMNrm{nNNs3a(N{o~-1jdOcqJgg5wg`)R;dNm!5xufvS7T#H)e9~g4)FhTh1}E}1 zI;<1?+;z}yvi7@2kg2bkq7Q@b-wa~WnPn3!@@8%?khni7Kyn}uYP^=v>7rzGo z=#eQ(3mp^MS5DM{K?wk%M#PxYcoo=TYpf?k^nyG-*k!y!d#;@_GgTRecC0nv5m}VV48Q*xPAFM?E#&CmgVcb$`nG77g9>eUXH2D~|cSV)@Sm>ODZmdd# zB3Z=qp&`l6b>-bDL?Gtkn|N`98aqE3nl8P$IIK*UDe)Ng{ruh2>nAJj0w{QYa2HoG z8g8G7gSt|+Fsx5v_h|d#a!Aq9ImX66z$Wtz4f?Np3Csrs6=hhdNUUUrM^5as#t3=9 zqyHer1xiUR%zr#jkk={zT+^C>Oss3Q7bGP3q(kTt*=5811cpPDXooAm2g!hxWoLl(@U|$b!>983`t*|} zx}@T3Dy!1mv*RMCB&?1C4wZwZ-L3P9O8nf23`?y2aDYoz18Q7&RAU7KL9CW>jB`iQ zI5|||vQp_Cn^c_cEIg91rm8kzs(i^&IINd?uA%lf{?n=btZw4T`$>e3=o!$^g+q`P z@j=J}My#i#?q&e@#uz;nk+caMr>=FYd{To zVZ||_=$S$?x`p6Owc{W&Tl?(kJhxSZOC?UR|QBdp2& zJ<|7Z@5h9;XwmN*J}5@vGomW;29wXWz|3|>@gCt4 zfNC{Qy8_I*3arv#3Dl?o!i+3xrgwX1IQ@dDgn~Rhz3PVJaNN+5V65Ck(ZlGVgB@0c zqJugSA1=)tfs1o01Z+>Kr7{d95UlDfcT9=6i&KkXb~&WdRGGBz`TSIaUUoV=n5^%m zHLU_jv`#FnoO*EJ0(S|5b*M(LD?E>^cO9m&&!)pBhpnWT3l!(vbrkf&B6epDjO7Zs zX^p#TT0R?}7lVhWv#qaWF=FZW7|@_ldy4(x&2oE|q3+EQ5;q})RyH1e_N~tekKo}@hZn7lKP==qFumZFaISZO79#8b^)iev zlqfC=*sd7NlX^26E^Oxo0mbc3{Em&|_BR;|2P(bbFt}9+0Inx~pRN~OX^|~XuAx39 z`W^O&gV)ckFfFU|eO=}xRIWAeSYgFGr99Spb?x+#;kB<7Z6@*dbT3x{1lxlSFs?lE zV49=*n7$6UVSpu-j74Wat#UO<;6gUF5^n>kHLgAO^@40Wos#MUQcr{XOntQ{2)4pL zVT3d@P;B6iBd$&_IY7Z}#boBF2b~{5J@6pLPIKpT@(KQE1Q%k#1|TonVK&_5;vuHBT74X%?GBh#fY@+fQuxgKwV zpq#f?_Rm|5Jr6z0)(;x8Yp$Cf_{T0hj2|5sXv=!0M|o!mImojtL>`jze1{d!>+TOHuS?uI}e{Y z3RfKOnwO=D75)Zqik(TdXZ7uO39hx6fayvMzbUlh_Q%t)J`~0IBQQ)zjXU~>f&$GPuf8U2ClrSrBzzzIyUPQCGqtYTXiZF zM;(Anz-K8eZ3P7ha<0{<)=g|2r%ON_jFJLrc{T(pmF`fFSsSa-$y&H^Qm*ytt@HvV+GO~AQ43Eo-_D0p)u+mY zcIyLR6u;?#EUx^Ixmz`ZTzIJ3sPq3G4y@4YR#fw_jKONkf8l7-Vy^s;xxS{;?_pq3 zsj+~c6n-y<$!9-%X!elO)+Im!Ew27bGGXINMGl){EG6>*y-$o#HwmBPYC1 zB(E+a7+Fk?K!!OJTQuQBQ|R{4 z8o3I9oq1;S?UhkwQm;KXeHPW?y}*~wW7NC&#fc;%7U^dT!{a7g#e_?PU?to2L#YP_JRbtVZmZKNBuENJs)AG=_=u<_|3Mne8Ew z5NC}4*{}O^zY)Mi13B41sf*f7Ow~EjGc}mIN4l__Wf3zp*suTv|M>apcs61S*A8<- zuC6xYoq(&^MHJEsDH>aITCfl!7TSyux4l_|d{)q~w;)oj^82TD{^12g9avRV2(S>} zU{?{Ep95UE%BY)XVrM;UDc3GeB3T9mWPj@pm#`N@yBsoh)sCLu$I&;b#`pCW{6KjYL(yX76eq!n*JFp#DqP#))*EOoy z2A>Q&e$krShZY3Sz4_J4@oP&)Sg;_ZZK(CCD$MsYB%(kW9R+kiP)=3S?7=1&d?n+f zC9on?IelrZ?H1A-7>1d zd{U04VA;tbUgA=0e>eBxj*~g>zD-Jr0ny1a+48Ed6!fdgZ-@W z@BD^=GWSQ82C!e_{RL?)*i;oOPcX|Quj>Po)p1RK*Y`S# z44&H|KCp^eJth|yYa{Z)(c>?Do2y}}0W2C@rhx>%+GPYXF0hL8=W#o?|BQmoeS~~5 zPmkbhy8?C?T!aY3O?q$bcd(8UX11Am9+KN0Fyru3$gap8y1-{zu_ue6X6PC8L#2|7rNu`e}qPLmELPI1x@z zFvibW*ofsqBe1loRhOS2hsip*D?$|@YW8BcVyvveX~HS%7FXbR^02yJX>ybk+Ywy7 z%AM&B5OWP>wZpjF^)2vsCTSh$TCmYHX_mqm`ysbJVgF5}|15I_*5rmgxF8YzEi&j- zT(H8_e*6q+-PNw0C+`=TCnh{MWpLt*8U%(PaSDUlxW)RK~F0*Q|xx& z{=RiIQn3;V>39nQr8hzfhF)zKg*4QcLr;(H*Cc#v-pUu3R2;%_m zFo-!MPui%|EYH^i#59(K)Uie1URGxDDAQPQYG&=4od;KTZ8A#2niY_xU6(U5)Unr} zhoop-xOwX}!y>XVgY$M!=OF;nNQbitKX!VD6|wcHU{ISxf$-HLj06&X)Oi^rQt(m} zxlS+?-{1H*ZL$SqcEI#}$a%w-QO0~3XJXUzU~oxx0@YY11`u=&T(SrePVCq`C*HY# zg{w9R&EPe|XZ8(K-Y5;et#?PV(Xt7P1mEKlKZdgv!BIW+@C9KdD4<#o?&z2x(2?NN zDzX(UuPBwIxq>?W>e~&s8mtx{1s{b@gwNouMJ0vBIkF!XLpDlU0Tl`cHYu@BV5K5j zCh3L3WI)#R(?oP_i?Si}(>mL$;b~iK?~k9evkEiG?&9aLBs39H)&0BTGqNLE>W}-; zVmUG2IgsTPyt`_cFIDL0V9WQ@#;N?HK(ZzUvuegYb+SuA zkx;RsEG3`VG8!;g>Vv2ejVbF3#BKmq=J|+}C$dYz=^l5%90>ijd{ok3un1PO^7}B$*q02oSD(o5D>A2d(7x zKrwRu=xOns5Vb#bF0z9G0ir%Ekb<+ZNx`Q&t}Y&wfn$wYogJl#!fdLG(Ub3c6@Y+*DQdf))j{U5W zUVJadzIKF?Cv#$0>9Qu9L$bDc=LRF&@g7eeqPBRU%K7q_5TL-C@U~J%g7$MqM6$NN z-C|Q|wX?fWaJdWgW8n#9uCc$j1MwW$qmiuM2C}y)%p-knkbeNGE^6oK3(8I)*njo@ z8ndeaARJzp)3UohCm=>@XwiZR%rpC81sQ$akx4IrSG_1*?Gqk?P_n(S*L0X>B}tA8 zU(SXMeOM4X+iQC?fK=5b{oFr3f3m<7%Y1FyZ(oWQgY%MW7pH^CLBEMIFc7DH%)F8L z1hUA7Ba=vfvt8(1EfW9oOiG{zkEG8%s4koNvr2{KVzSFnB1Hq6w14rylH1ymuQ!Rl za=ZLdp`8seO(&7uV6w~)J6;W9ZC6r@J|7L&N1NySr}M<@5m8<~E8mwV&a%wImDKav zD5!bnzzsii^SWH$H4GB%@I+$@DcnW-q_WJ(*5V9{ZF3S0V>B>Ks<@HUd*ZXy)hAU7 zpP3NvF0#zY*6NAc3IdhsSI3ggeFYcts4ft(_Wwm$(2`PeGqTLd*RH$B zT+aw%l%Ud15RuS~qqV}MhX))_wLoy@X3Ux3EwbD~SzOe7_lwl}Pno%#)bb9*>S!wm z71;*0X--YUMY7!?R9eZvrYBxU;3~Mz1h^J1XYG$I4M8$9|2*z)FOB^+_TI&3*AtV44@NO&AR4H zYzscG%VmUr9B{9P3GuS?`Log30(&5UvNEJ@IsaIX~Mb>)TOv~Fzdj6+%5T2 za~JljOzlYOoLMOaGu^r-mTl?X1GFv$*;MEX9S`DClCcYY5o1PN-OAehBPOcr zUYQ@SF|;!l=JSu7=M6nY5e{MBxrD<6n}-f={lnL-ZamfV3A8hvB`@&X!2JjnTC|=M zV-Agy`29(E+kV^Zrm(>;7qmM)VqXcR{wkp^f!m=!NIfTC`Er2?QbAw4fe5 zzVwJyk78CAX5hWdB^D79D4fky%Cu8Qe60@P8ut~ono0rQfar!+vzRIfcU}(J)0?AC zEVNY7wT8d3^EjQolKwGXuQ(7$897(6^$9z725F57LbO>x>)XrqKl~(Ax(o9;JH??Q zHpH5&?j(d>d$eAW)_YzGa%5u%C1efW0nUW)Al}-3ND8wo>-`}y|jYuy^N2l_kTTi!3fNG zckj}QAmKWRm}udLyx$L}OSFjmVy`M}7Ovtm%cT@A?wDi`uq5Ijk&xjDmu;(VE3}uo zFBnr3bhl0lye}dzd9=IGp?nlYfy}EYw`O-bjtv%JJRp7W zJq3vhw<5NFJhZ^%V|n}m60p`ukS$~A-%B5^Ro!(tWgwB*q~ndR1+>BUc2f&S711F; zZBQBNM~_@LN+$HxpCd7HI3VIiptQuCev%nE3~WOqH8*|+m#I?}!4&-E&iu?bN!#JG zH?+m_>J>$+iPN8!rtc=IBZI^#>HHc2q#1pEkY}D~PPE9ME6%X@vKg@*=@>B64~GNQ z2FbWp6q>e_PFbige6;1cH3fYi>OLgHpkf=GF8VzgTpm&~OD=o*NVM$vew^yngzC%tOA5yexUaiBb5+%xWquY# zKN?mj1+?+jaZrZr@xb)-V<1IeuEGqbY}eYv6%;4362$@;WVHA(?E`=f`8s|(iZ6@w zd43AKjF=!mIWOiKn7)h@MzsXqTkDn20Z`LzZs@zUpcqc3nl{GI4E!vYdO1ecu(by5 z^jbOh1kH4P7Zf`;jz9iColLkfx@S%;7?lV2OSNdDH|GW{?$YliUHOJka|-|mLJs^& zR*WW>(REk5jkSo%&HPE?kW++fMQ!xiNrrdi4lZeNBPPPuhe}Ixn zon~L2H^skqOGnMsgog3pdn3|BGOZ1SUA7bFI1c3et%&NB{X%})CleCeaM11kv0C)F zsag&R7Pb}M1j%NJImkwnve{J=k>F)JEC+H8+mKTZhXItgS+*Xehb5WDNmEbEXR4)c zTSkhEF~oDQYD@K+1GYf* zrtN?Uj+q--W#j=s0SBQ1foK9Wo=X9uei}%xRJKoQ{nQUjjyOkt(UvnI#woq$Z;iP! z#4|N&w>ev;4z_JZ6*po%Wm8wP6Nq!U@Z`#dEL6LLTGQ?r#14Au zBDQs$0M7-as}z;XZ<`MMes{=C>dw1(IXZtgioecJ7q)sWN^v@e)$YJ16uxttlB-NmfS_udU}bC*bxmnL|HQA^Zpv6Xc(#2p)n0(3 zf6TLQfE1k!;2{;@u6&lK@Pej=1Ze=BdA5~bYY&RXG%M(0HX0r9nRT304ARo-0&+OC z!zFwBDYlk}DGIEUX`c!wI{C|sZy^g1A@olmsGmnvOj$p+WVV~-!kzdGwK7^IJVwsH zL)hcbZYFl+*_mqp;w8T$GPa!q^$uj`V40Akj;-~&N^-?ZnI&AB!!@eEgr-KK9k!hV z^;5Lw7vg-Twa$fZ&LNi)u7$3giq+G$O~Eiwbhf3Q0ov15h6_0I4!`PUN1`*Q;Kko? z2!x4IK+mS0VYaL=4eOYq2~^g?EvivOXoI;h6fII&GC_BApBaP?Nw%yvA((+;TrTTP zisMx!i<*PYAP_1HaanijAfBgbf3~l}vWA2gg5YK2f{9L7K*(_@b~3&_24lK5!_^=z zZ??As3jss;f}hk)QG{vL(W~p}A0se%^VjH0hB9e71h&7O3)bfv-g#@q6}4k5N4uSm zn&nYnG%Yt5hW~C_9=67AN8KlNLV&uqy6awB+@K9VV-5%CId@@ZB*`VN8n(vhVEqjy zx8MAc>UUBH)T+DHiQEr2|9^Hu-}*_GKeo#2FAuozQar590aJIHqm}92isbl4zCb#) zwrl>@0k+Q_tJ0ovI6vr5s3nc@hOd6$n0I5Ob|z6F%mIu9C$`n)q)o_3*Ly;?m^b*C zQR&FC2wK14EQQ_H%09|DM7Hl>%Ww&l$qga(giF4}p#AM_hwKTS@T@>oxCk}OfVS}E zIBMKMI%no61r1E3{Ep)BaP5_pW&Zycy@>pq_5it!DWD}wdVtiv`D{syQHo8yO?yZF2nY_+TTxz))I$G2T?6TQ>hNGAzA z)DgIXMHhLe7mG==3_U>BjXydp`nO<0$M#t#2%(YKqlaEw_O?2(V^=HL4%F|_7q+-; z+P8k)B)oL0xqUw+_cCMpq#(fwG(6(?D8wr1-wi;b1h;?;ILx5} z4ty$OJBaTx6teAy$E)O>L248{AaY=jBDf9IH|d#ankR-@OqM{QG=;An34{p;dgQav zj~;(vUAPYrPE;?I^PNr`$)>fLpOpU*`_QWC0-E>GnBZ-+dAJy-8$u`3AL#z{?h8+I zSHbvLo3R-lJR~Dx*{AGCa<~}EM=ca^d2oI+C3##w;a6W2z^xb=V-(b$`Dv*(D!3aP zpS@;SR#@%~^ll0wkue#?Js~mnR50L|*9O z<~VF;oC@?s+kh5IjpfbPnyqk1C!^g?d@EzAiL=DjaY4;Zy(}-;lq`HPF95I^ahHMZWFW<{zea2vsKcK1-M7AQ|7S5!Vld3N$Q%v@~&Uv0O_|PH(h{d7k*Vam9`FP zbN)0Wpi!3rdQ$GHj*%A|vcZ zoBCJM$mv@=T1N0<9}3_%VGwfZQ)X0%sV!;-frYR-~G| z8I$TCY;^kwZ|1ubkq8W&n4nJ|VZrQ(j;e9tjN=;-d={kfaoSa)XPP$mdngeAcO)=sUMPa7zmJQ9zQ+Q zM&acK#xY#h&syznj@Pw1jes{J{5? zQIj*Vp+beofDMdzXg@PRWCo=3Y&`*J=HQae zj9cT;@7qB%x#kG}BRQuq9sZk|?HWo(?gkUk!j>4B-_=5!K9BU};fJOu7fOS+(BWrl1q|%TD=$*^5QH5t6=I{W0HiVA0!m?GHTiwzT z+Hh)Ofwp*wKg#Mh%S30U2G{{WhHht-w={rp&xozscjmCET;mLRtL6kh@|i`` zoL!6IFRtlN9%g{WRVjj#GhmKWh_6WKQmyblx`qYSzR;M zS|s?cg{iy9uO1q~7>Y_!x?L;q;0xdY^4tb>VtICa*q=29;&ME8q(^3YmW#0g94?jQ ziwrnadhzAvZo29#6~J4x(8|1B+(xoQ8g5XcsI^k6T?8EUJ1Nhs?Jow_hZy!0JeP^K zKRR~F6vxa(Uh#Kok^(N$O6*@54J&)Jxs6N~`N&kupnHpdQ|=`m-Cu~A$pUWmC@~Qh za67d9c2bpm`Qow+&NJf&*E{-A$(22}6#*}~&HP6{mLg{px}o*Q^7Z%;j&uw+n|Z-~ z!$$ZCdVtr@X+G!)|Mx(#LcCcYZULXS1k<#8{+yIv;9X3mFW@bPpA+uf$I5B|#x+wG zIa1w@o{JD`G1vVGjtTRH_dowmn!9(kykuhU!^5(h7b_=b#&2ni?v9+1fbj?LmPDD0 znw`t|O>)I`sW%YC`)w6Hw*UgT^4xXZLH+vaY`gWgPu2wP##nwS&(z9=<$CJaRIM?? z0_>Om+Mmu-hDBC~(eug$K^QR?HbSQNkL!N-n@?xzg$=sGr%MFJcu!A?88uw&VjM1Y zT3`6R{H@(*+&t3X|FZk(3Qv;9guRK$RU*A~E;NC;&o7I@YzPI85x&S6<)5wyA5FFU zw94W#!DNpo+b@GaxaAyx6PG8=clTrB(~XXu4oD8!ctrFLjud~n$jccqQ<70IB*|A4 zT&4luW9?m!pcxd@H=jiYMJ{4?au1xf+t&ATkKH=mU@ZXeR~hiS;)Plp(p^Z+k{V? zQv$r-ciOZ@BeD?B+rVlwkxcsa-m)+oHSGIw>C#(9dH&~HlH`&`?A79dMSGh~7mA`z zs<@d$I}Ulqh~1Q*-b*wMK^%)WhmVG>CqL_s85lGryG#%70Gaa(!ST}vJJyRf8|m0G z(Sp%cK@Fbq2oR;^s`vAS8wJIBpFV`f^)9l^yk^n14fnPiCJEsaICzp3>7p$@rglzzvf%xu12Raeh^rkVgn^fc033hoFrl4J*g`^s#3R zL`20y|q(|;a6LH*pgn)>;%*iHa9wF@Yv zpNGEuNTvE-0I_ke@t+sf-imK-4?;u@3c2wGb@&g9-$%o&<~4Sr8q$6G>_=7aEAqN6 z2UC|YE-lI-3Ypwq_gHVoP;9^!=cmt|f7?gPb-|@498mMIopQ{fDN4C`39_EW?pglv z=?m?5^~hd)w2V@Qoenm8ZsvKb97o>efi7&z82{DpB6TT|+ms1L*ymPYuf^Z|L}>Yk zyH&=fZS5$6=KndZ9)54OU^UaGXCy5Y&` z%vh}RpC`vhob^7@u)a4n^8V(V+u@HZ7(_Rq{ox?PA^hpf$`jC>l{OK~*XlFYA8~TA z$lpTIbO7T!G!Z{h|MT2pmCx}0!2MvH`ytngJGb9RV7jT#3?_Wvu}nUF6%N}MstP}4 z&UxSf#8A*K%A1~z6p!u6<%7!nU;V6gh6ZsX_$2;3z~CY%Y{dBnJ$a&V2`(v}n#afe z&kvLy^rQ#xs|>FFApdrT!%L@!t?dNip8kF+k@@uXyZ1UgnZ*TQ5g;sEV&Nlmfhwe1 zl$np@W!75Z)3-g(gInlVD|SP=va_O6**HV#t7dO1?P_S@o+bbDE@x|a9N7oY4I;a` z&^uGb0{MSccyg)eQ6BMopT3JdPrH{>B5P)j-4=Ar)x4@yGV$oEXQ3N$A^qR|-3zw> z%>`s=k(`LZRpWmvYU@w|Fq82SmHbHYvH$daEz59wdSSBL;*v|ds#*0p;dLV2KQp`C z&_e$5pMF5$Z~UY_?Q&IKkQyoT3PC_w@z0hUHp-b{5FYZ=54q_LcONKU#r>i8ZU~Yu z+MlwzW9#4hIg0+pc7!di*-@rS}yijub z-}7;vphe-DPHs)hQ2g`D42d)&7P+fKs*+;55>~U%r(c+(itFrp3z`UUYayuBg_r4u zbdj1vm0g|l<+y(OWi%H}mO(CTp%?0(TK}L#W(w7Q~_PVt73x++q9l z8+*0BO9Gxa1$Mrr09=I6C{VSIU16x@x}qNz|CR41=&H(5l%qs?j5y$5*}rSt#gAZb zKHln|RHjV-`7Mkd8@$~=jl}BfuELV95C+(cb`9{v!K`p%zz&vFCt>cjjI)d6V$ zK{GNA-a{8L*j>2|W$Jan4e&b9^p=ixFX z)B@PBt+J>1glQM?Hz7%b`+Or|1-MHQJpXx%IwJ%r- z1O5NX|Ll`?#Ye@P88XO#*_k1irNF69Ov*VF%{O40{a^cfK87mI=nzG@PxIf7wmh(} zbG>h^}7gZoRORN=6lt5C7AlIn?j_RrgLSeXM?@+4w=o z>zhM-JP1~*130a`>4XS&Hq%#gIj2rL29$46>l`f8MfxIOthIE?uwZNtH)4n9+fo-= zcEir^&ws4~tEs*mj%_Vsr_6K4ixe@lZ3NOW;OLA6<8gQXirx=cB@#R%XsB9uT(!O! zVB!3cb}M`pkp^IT#1-f)wfGjyg#WjR{zlbm+Z0*iM-=q&8z>^`1n5Rx!ZT>LF25^&XtTFzDOMO zJSg%&7jeJNI!O@NJUr$1XrPh1D4j&fRUH$jm+8 zk*;tDg~;~&G}~U*>@=miwGo5ttG`^cOIIIOSwELMXSX2G06Xi;*XBz1&o8f ze)F96;yNy8<*2|e+N)c6E}5+vN!Bc2PE((|TSqi{=aSrDFt3(f!pm#d&#oa>25i^W z7@6$!%R<8@HLJ~wxvd;j9j)Y1jbX2@b`p{rC%Lz1vW-_vE#}9%sN+?HOiii-mzP|W zHR!@FAR|PPx!Jy!1}o8^hXZFhm%b4u&fdOu@xSkkjJ7>p^ND8HvaI3?LBPq;Bt01; zXvgF|$y?tvmSnb-WVWTQKf9XQHSZIn7>1*`qdl9>K}8pPD*8Ms0?VmIOzgAS z*8*1+#G&R|u5^NKHpmtN&(+S44vrClaScM^V$2T$s^WZ1n3O6mFeOR1AQZJzP5-#1 z7tW;j4#wgxr97q=0WPPI9LYIj&Z&O45Dj)Z{#z!{KRqu%4@I;(zAub+hVJ2 zG+UutrMNb1Lk^g(L+5~22y_)|IGCsMkDK9<^jbyV=}_+0>3`RcdELkRYX;RtLy`*_ z^c^N)0I<9p)V={-X=~Q4ixEYs%kE&+PpYqUJ~Djl&pdp}E5Y&E6hD8r6XtTYOZAx&{JM+wi7IX<0I&5gcT!ZX zdXfao%O**8jP_f0@^6TS#{(wA;>rDgt<;RzqIbk}JSRaC@j@isxl>=h3>Ybti&n9a>P|f+!tsr|i*2S$CB4K|vOXrcmx~$kAj#$&BE~OMp1Qh`u8;z| zi|+vj0x#JgP%oWK4!3+OnxtqYRLxb^zxMODzINGnSGC*}%3{%gAL+)tf?=t(@V1VA zUOw28smf(}v?>#Jx1tn8985b|wy{jgav@Bc*p1E`gS*+mzX>ay7AT3j+g{@YZ)w+X z$b#GqdHSiyJ>^PUm;U`Ycb2zS*P_Dj?r-L4Q}lr?B})F$VkL{Fs0Bfixf2g})IMMZI;i_WNw8r9b+DeSdrRvt z`Py#r`2wXW8`nBC@SocdZ|wdXI<1DhJURw*_b$2(uU3XDPH`1}$M-rj{}ddU{`GfL zvmBF;VzEuW?%n;_{DrsG7419}PPh)CdK(WX`Ml=u%V!Ws+jLZn-KX(Arsc-}R99!t zS=i#5I7q~|FQ0v!)DaWA{1ha_yZ@|5;-e)(^E#DMcQ?ZPoh?=*JSRi;QR)R}D`yx5 z3;-?>_T-tby!Juv0~`7r-WVGBq$I?WwPR@ld`UAFxXDhVdM?Cf^OJ|`uLln&%34}S zUk~wKI>8&`Qtl3r$bXoedv37OS%OZEYsFir3%-(UOy3PG7s)%z&DL;T0Rz!bdOjL~ zoXEmf*cohySJ<2VM0A-&v`D;*&Y1z3{BxmghwZkUbG^RgsOS+?uTraQ-Gr=? zJoLMiHKuvMTqY(|!nG)VJ42;LCkbj$ukwSWT+7wbjN5xl5P8cPVcya9U4~|6r`*q~ zrIk8{UNvh|Xnf+(P*oA)OLbI-IEV9@jcxtdPMWXh9|i7qy&5R1)B)IAhg>lVASiu$ zg>p}jK=v5n(Tm6rAHUArUQIOX2bEbTaM7abL@$zz@J_0B=FvgZR5owyfCwdAuP#Z> z3h1VoNuz=I%t1qj%c12cAg)-kDo8N3m2(}0FU2mIo%E8PP zNBDAfB*ihpUI%p(=v*r~XJT?$2~M?$rng6uRO=x#(E;7f);!nYjee#)kl_2%h`$DK zz+pI6zPFF%uZa)tS2=xBQoVZw{A%-%>?K1M4GolrBw%;527UqbpJXxilFB+|y1hps zzc9B8s-+;H1G%#p(}r%qCF^T5&t>`NV*;*p6uozUs$83yI)8lQi|BwT+W)I6Zm}3g zG=*35?4@QpX{puS`KUB+Y)@5Pn3E}MnTZzmyx4IMrSmv5;|t``eC)qQuvka}O& z<~-P9bm5a=hn;zt9NOh3e1;-m_XU~Ms{5gfAB-cr9#mB~dNqGOceu&R9jnE@Ud75` z{;G*aFzv_V*f~nqXS_4fM9H6lnm)z$ipQBRqhn5C3%WUS7pd)lM ztYI?@mxRpdRE{V_evSL*&zF8;=I4oh_eCZem^B)VfRM~ktqAFOtKc78lq6-c1lIlZ zsv$D6NMUd)Qm0~BSO$Ud3QoWDMEQUDJer;DlbH6ixha4Cmjy9c6%#`4Tn z7@hS=WV2j2@T2wXWpCbwZ`r80*j)Q}PZgX09Yv-?9y_@_lnMCo&8O@)%QkB_{uduP z4wseb4jCLk4Cl;pW&pib8gk|bg+=>sKZLJ`Qcc?0-B}#!pl)j`XjG&nScBE z#GA1{?mV>!P4{sszLEkx97%s;z!jp2qj;`F3UcfVe!6*oywP##s_z-I|F*g#EO*a_ zX&XkGqGDtaVRxz{I8*t_w?d&mt4dnD z`wLbSZx`O@>X_j3Kd1`J?kn){SSU6}@|C3hS&iw?{kJ6UOT|MjR-vx(a`85+2s&0G z!0x&BZX)9TCb{H*VFC$=Jcq_a3&k`!x*3(NL%hMg4Vdh1hL5d zT{bJ{h-eikg1Y>O?`So)fDdn4MVw0}if|H$QBM5+Zq2+q5}=z+AFdD8*N68KjPf%$ z_Mpo0yVq4p7Y&~N{=1f*ZIk@@*IQz%<_VHyZwqw)F|Cou3+=ir_6U#uF~`D+J;Yg_ zK*fBTm%t0V(W!~I=(bCQ_F=txy#$A+?I1(48l<8Qq*eAgvA8DEj=ERM`NNk;N9sl~fd7Mio3MOG-FnpJW9; zphat*^P}#5uc6I#Ph+A&o(j-|spcLkm`z*N9lCWlp!V)x#L5||oZ^-lG`ZuEAHWT1>6WMjhf#d2mK12s` za#oy!qD_@NS03~n!CtsyZEh_@`LTSeK}e;Ky@L`>t8bJyOs{2T__-rF{omRtIS)B_FjPBQ)+WmgEt&DG+)oe;8od{paaD#yr9bJ1Md>f0}J1 zzbjD@d+}fwr?(b1333ghqtr0vmc+xUa!HmaexUzw64Jl@T?hFk9xfhr;n98&GnV>D zTza!S0a5(4qNo)4B2MEz1`|*B>HCeFJ-fvq&icdBxx%W~il*E^N_Fr;?|RhbX0grU zayv@GsjcK7(FDT2m%TD)--E89znO~yeyC^~q$RTeN6SdBDR#{uu_C4g2glD#D~N}S zui&rJ@NgL!b!+b$0mueH_gXH4B(;igXvXtwxR{)yZyw*pe5}9A##88K>L6!xbQG7dBO_29p>zhD_{_`~BU6+SKmK}7X zXqtt~An&MHDRb~rFAc@qCb)=r`K37es=)a~NudfoO<+YSMR1w=Rpo%(y&wbw-Rd7<%IV z*V3|Q^92>j08P${8xNoBlG#Lbte>>5_U4<{U@DAF8>3Uy<|>KRIXfqQ2$h`0U&I(^ z8HAXUZ#f32gQ@9Q#$vD-O6uub#l5Z5%hYe<+F84Hv2x-er2BH>gBimR&&B)=g@=^|{tgT)lfw{hwj*N%QWCeZ%Q5s>%&8N&NWH2Z6kw@PI@ zgSC6;enJ!!mo})8fGe{8t_Y?T1gtva?{P*aZ;8U*gLOs!`iQA70bPnOwM>!%C|Th< z6igzB97EJ#Xsc76!M5M&3(Txi*N+4P_0rcUbpG%Zjr%S7dU9B5MVaYRgM(WDVF(x< z1=CYi-X321=VZDjs<}xX&PE?!b^9WiK@cKS?Fb|lCDkJRk&+3oaq6j5^rLli;GbrP zmY4R0!4;v6q-MT`(34f#;b(g9*_wq)oxr#yNXjExB<-A(8m2aDchR{_yxs`VkOgr&>JwQ8-?y{s zfz)u3#HhXCCcT1kKt5Orhzlz+6dRwPXDe`w3Y(A*n=*q$swHPTxq!It{;HKS)Qj1n(+W{U}}Aj)tZ29^$=$;Sj$1{6`1bUb+v{mmG6fx`Pfi%?y}|&54v9d@%YdO-FODvOqj!>2-D6F;CMJg00KP z(Ew%Rt&JaVgB|udR5TO;S3nA0Ut&4Hea1^FyYND-+q82CphWAlc zuiTkq9k!NrC)DoSG^4>TbDLMHD;J@9nukfy3);$ntITitd}aNIgBWz z4m4e+&8pf`Jz{^t!8dW{9y^8|_>0Rza|(!e66E}c3basefv(920e^`1o~1gh zkWH9V?A<<&Ede|)Q?PhpO91CCbYwHozz{3Dqu78eqHn2UPV(w+%hmQ`z3N&1tsr+c z>op8{V5sQl=%d@XkjI(L#^yMX>1_Sqm~9-y%v+5h)+IR>Fz$EN22$k)r|?Mt9+c^y zjNS3Jyxy1{ZTE>l%yhymV6OQLL?N?dP{8DY@G=fMV+5x?b2q|)(4l&7g>9o1up)cl zU>A2|qi;LEsPt-PTw$}G9F`8xCaZh(EG&>7*fL^LKw-yQ^_VFcw(v*w&k9HB%;Lbw zJtmWJz`>w4u;b2xxuLMr|93fYJaY0nl+L{W@|SeMVw{@skW_vP-~dk{1wh=DH@ExG zgCYtUZZ-wEFw2HA;3oNpfAX0#aGWK^;%!UqoX&5z(C45*lB=(E_%*Oi{ zAee3FO8xQnskdtbusljmE=e=?BDVEj&xMPIo2yd}oTlUP2;q_de`Z00u!O1?pv7=U zjkvkBu3N@1L}0N1&hW8Tk0uEBCHm_ndc_el4^W2={vIkL={i{JqOS%6my$6d;^pJ+ zT|G!e@PfyqdOps+Sgf0SGPR_Wv6L|a*PtG{D9D#I?@H|Q?wB=5e*gAR3gZLcem`c~ z@YA3L?$^&wA$@Kf&>|J`#bSsKw5kn?&t0Zf)JG`kYhMxo9>Mrf_b;~MPqbF(IK0S0 z)k_q!Rc3st(SlcJe`^v0-sSuWN#|v8ve%u@S_|-YmEOR?w`HPkc=)rt^vLZ7d{)ha z^AzK48oBw_RJue@n>HA<@#Sa9jR#>rHjEY@@I|{SD3BRj4)Sv+Rc@)kiTKFFQV-6A z=zJ>#Y1*?k@J*||7N+dVnQgbaP6ukZ@J26vy1dU5VAlP>DuQn@49(~Z0L|D{w>)QL zX3DaVUpHt>)G+jCS7)|$XAA2LBOOF8h>MCdp_(QvV<_Cu1vSq2$gBEgTtB$>Qbafn z69~|uq419NXC*AaE;1%6UMib9I?>`9No64&`i=b^R;sF}v6M07Rw4>HGt_*IBt4LK zcAANkXd3t~!g_H(9NKKY;^*pH!Y9oN=-gKsb;2#)npDn(B_$)SCP>~IE`AO3a;3M_ zAoZDw@p{g)j?ko)`qBo7J#*RDh7GSCuGuA4@P7X2ax)Ro{8Bn?Fvat9H{s53z3r-J za~Uo%+^Fpre`?~crM-@I(7vy7p>8R-p@6Q+4%kLs%?lG9Za(x@1fQ&j^hE^COeUyh zt~2}bkXk1_MvTde`UBX9Cj=hb%NQJBfzI^HszY56>1W~_t1&(FSi3sP3k2T7k7R5z zC{^SyWO3z*7F5y6Fh%lC&tJ&h6r(J)piN?ipD<>8T}5{;N?5}XmW;Kj8Z!6f=rfiu z)uj=>!%^XYU;?#q|2c{_{VjQ_%!X9RI@{d;wf}do{sBx0sim3&f{7NDQ+*#PR1w3v z2*<{CXYT-Ypov(_P>)Sw1Cd}sa8FkX>JBpHu^L^~i8wp1CK?mY_|SQdZrT}AIAxL` zLMEtDC_3}_f@C!eCfhZeUChXqI6404gMaJ&>cr9@QU|@J@`#l=2kX{hR%Q>SD&+!k zlo&2aOS^S-WNIf6MIT|rvsU6v${oTNEBnGpc;8a4#>Xw9Rf?_n0X_^6wG%@#VFB_C zDcxO+h&#`JJ&wDJ0<#p(=`#Amenr1?il(3~0=j+jBu{5t>G}4ai z4KyN%$L9-1J+6#B$j&<@J&lKT85g!7m!xo!(!TXxbl?=kZ}XJpSr>q~F!!R(k<{HQ zcEm@C$NEn@&bG@_M_vOYn1pn_*xrBvnPWD;|UGNBIAEpB-} zky0YAd7@D+Pggev5k0+-I}?p>RG=Cm63~J4%o+I#1*lu}KOE8jEqV8YpC6L_Q86yWUWI=CN>}kl5f{+RnHni!w@cRB*lSqsz%AV4^)1~qo~+;oGKuv z)Y>Q`k4VgnuXVOw@YYrE{sXs>ARv!Zj?^lxIts`+4$xM;J5f1_)TS5^BAsx?#`tq4 ze5_dP-$WuDhXcs9V?N(|6!jA43HjIJHe$Qy#<;4#fFS+293jTZssPCAX@t%zftz3H zrN^O?-MF%p2KBc;umaYG&14YL4gnO-gy1K9%0|6b8p+i_lj5Y?9Tvd~;a3KDMIrH| z4gp2b2is*oEf}9beJ4H2YfUUs%jgdZXCLU)cq8)aAOyvax>Xk=_Lco@lLVi0@ycGc zs{F**gXRV4E2?_bVt`V&BHKkxBleaoLpcw`gRYXQ{w6$tV7h)>sOTI^Sb{Qiu`Cl7 z;IymAY&>_&+pgH`7QrbWqg|}V>Dxsl%%J@ChQHC7pp+Ag%?IAcdqtkg-OtX=nQ60W z1e62ZSb``VLt#`IRaXplXubtuk)4 zN_a4AkSlZs+h4At`H%jp)HD9NBi#dfP}k=SZ^`tI#JL8#YL#f{Fm=O0r$^gxC(W>Z zxV(`aXh21PDjq7x?!4Bj#ewQJyY8puoQ5@v+Q9r>4631g+kT~n&yPn!i zX>*4v^c8?cvpr5)RIr!|G@8R*|MR)w-#ek0o26&8Ah-YY`#V$WF|GkWP!N0?Y0+$wu$Syy}LZ&-IIC!Cf?%2PzNJ}WWmdaZ3 zmGrN;>Ypg~BnT6ct+hdaJv?U^iIve^l2W5yS)LY2rFNIl@$fkGFn8WcPfU1zZ@kYK zS*T2O3Mb+nDH2>L$=hRTp1NU6awVa(;%%)Y*NX#=LX1Sf{eoXmNH#owRmWBsXEF_v z@p!0j**jCUD`&YIg^GmX^{V6QCkY5Pt{3Z9Sg?kr>z=m9V^Cz~L@&}Dg>%kH*$HoQ zz-HyT%iA>9uApvTESJ(%w77yl*6x!YC0n34d@S}qspmCj>P3~iwBD`eb?tBMfqz=` zgr>6?r9PU&`w~s+RBoY*EoHs_&4g{-XKppulRkb!zVw#cC^H@s zUbH5p4IU9oH-(-=&^+D=zR^WK$=Yj3sL?9(Gh@G z)<(mdYMqZZN6dFsh4andODrCe6r7~ zKQl1g1$(y|7RZ})g^81R=>+9ksd#OlP2fihb2I4Ur*GF%eVA{p=6Va9?%pNTTW6z_ zj5~@DSB^)EGQ9)VRFDP%|0-R0({F(t8xms07d@FeN(5L?`i`T`2lk7?AHD0!($^fD zHNwWw>lJlM#-7GmmkmtR_qwAUn{k)6%$~H)5lY~s6$yKdu!tcMKt*hH6dm^bvf}9c zHtb|5o^o2{-*(x=%3g!l?-MV61I9Zbj5yI>QDUP@QB}jJ(4n#4T>kR0lbC2EW7yOG z5y6PYZ6`?LY2q2(0`U33@lQ(%lrQt$jchcdq}x2UyXvk}dTxJdYaOkHM4BdJZV#)a%<3oWz7oH&)-sQ=Y_&N{rUe%-^lU^0>X6qh z_j434YikBL?3E?@!C#F@JwB8F$&-Gjb}T^J`y1=?hg8!~B%E)NCg5xC@;=;{wEq@d z>K|GNa!VtoZ?u~?j$WWQ>d@0ITz8FIZLP#HW3RZLUu*Q-%zb^dVh!}L=v_pS9YT0D z*bN`zSO!Wq8hTc#@(%-nRuS&%(uYcj>K#WWXV z@hw88TA&A*3z#}VeQBB=Tnx(tbxm$PKvh6E#A?P^CjyLn`&*Fbx$?x4cov-4Uy4qS z`N@{pHv6CWt{LuQi|*p9f+Z7EjX0RAbp0~{A z>UDpQLyDJ)Sa}9()js@jx19z}?{AG5-O&AHgpFKDNS<>V$FPl3rMjf&R0vQ1hSPM@ zo0OSm_t?JWA%I6#NTcsDj&F`U8R_7)mQX)_&~>~#>rX3G5V%&sFx<@STl$A)*OG-x1keo-nOnf|1O^vDU=;GEmZ3}P6s`7F$S}8ZJzXZs%*qBe6=U_cp(3D zLRV<^RYj9>oM{ou`i114d%M|S<3+oI@^q3WXrQ%5TO2(zJ%t!$oOR-&8rEqpukA*0 zK)Uq9Y2TqATUDle3< zx2iVYgxB#jVW*|JQiI8jk|Ga^aVqMs>^9(qs!NRY z_})Uqknrc%G!#?)bB}Lda7fe!_J3YdiNV8yg`Mq2-ik19KJL_vL-d| zy0^^7x#uT_UZFn42!~7N*-s7CbX8-`pQFwz{B`u#KVygSvb2Qa<#pvp zVH?JG>sa%=Oq)m(M`%5e)*7^)MxPPPe(XL|AB4}ao&6RBDBz^$EgFOy2ND7s<#8p)K|~Fx z`4La1q$z`d)}t{f=7g@_IoVZ*z-z7qL3hOQiQ<>*d_^_hBo*WQoP}&B3T2~pE>HKe zWEN&0aWbv(#lRR%T4F<-$nA)x+nvj5AepzHsrRwz8IEOMup<8W+7Eqw7*&K3d|R++ zW4)ixuV&T764u^j$zxh_5jgzub-l8#qNd9*`Y2RTkJxW|8!USHB&t1dktU4&#HGOa zHoThJ&61u%5e3d7cWnHeY8C?5Z7u7B>1*&pN-F92!=}xfs;G^Gf6x9flbgoB{DlRg zZQlFaT7%S9g)!UlSATaVbVSRd*!*u}Pjnsv!wfaAL=<`q%@bHS;tUKE+DyVoyMM6B zZSv-s&^0bn`=^k4*sd?!*oP$V6#DEY++j2qeWWlLO)`JWuFaNJcrG92b}IyP_N8aZ zvb&m0_>D9@Qjak^*Crf$=oK6O9IxGL5HW$}Qp>p}X`e!v2+BI`9zlkVr!f^?82U)o zj7%<{xq)N-NSrhd6#TzC^2$kX_X;H_c~4J+DJF&Ig*Y>vA7~W68gC;#VQx zWioSn4=ZK|*?xD>wDFt}GVM^*>Ff_^68rDE6PGPe8hwF~un{VYf>~2;Ga=8fygv@9 zZ4(ARochY-Cmth&8wPVVZuE(q`LoCife9z^CHT01B-#90*W`5+iCbfU zp(Ezj)+v({0&Y#ifr-TL2v9GgGv#qMOXq9aI*vpGRR^y&LVh>yIT@SVgNgJwCj(ay z%Nu)JxB)E@I@Lfz=^ZsIkwH>FMjVZGFgZN&{nNFj;`oSlm(kHQVmAzP);HGicgM%< zYlP`BF#9aMzDn}CtFGf1XZb>!&*_qbU%6>4ed@%e@j%)WSdK^}I(CgtPs@Pmn2#Bi z4gCS!R|BEHV{xrYC%S_QRwW}XS@JVI*0{vSWxjE+OErlXt|Kg{A?rT#mIdO1)gXXR zzFay4JSq{CpKszLt*_!eH;_&54@$b@OlSNKJB-tJxlsjF@e z^AEYOU$YsJmRjarbOcc{F_Z!Ldu|*-`*-aQ7oU$4-!`1<>??^uJNUSguZj}V>)V82 z*OLCKavUIn-9gF7UlaMnuAfcr>uaLP9N*`0z56i1aZjoI<`XQ)GGXpL6S24LFbqmg z6Nf4&PSss!%k&Q5^m=bT#P)r`wmeLJYEONez=$U){O0uKq#~XX^$Qtr!CT;uB7(W; zK4xR8RTy+eMs;Yu)#wCJ*6G7T3VyYmKK$Rtx)DNj^|$B0WTL7{$DGm2xSB-f@&Q2 zp67x878F^$%v|vVaH(~`LqA5EHTvE74_`%nOaQ_v*ZRRsXu-+zmLNTnJuE2js7SRp z&xDDQ6#*h?u7LQE= zO{J)8uT2ZQFSp66qw8MG>~-rdKUx^D6A0$T5wJ-d^G&ZhrLMA`j!*eoW36M zg6I1&K1k;*fCNa?khj0UF9_h*B6LDh&=1UyZK&Dr3cu69@{8!Cy9^7p5Wwgy-xpM@~YlD$}nQ6 z1{HZlp&^iwL1dYV|LBIe*~EvfXjLZ9lv3k=I{$X@8?pG$W za_%U@Jl{1M1=sFHYzgBj@|M=%H9`K5y`i(tALl7;!^s=zr|i-S-NT(>B6?_3%$WAR zkB44HskK1A?FHbWpq4=vOL(*GGTO3k*^{Iwf`9sM5wgg|@0=19(# zedBj_=WNBZ@1cl6E-zG(LoBgl#3{Glh$|Kx9v9A**lJ28O0gQFT&X%deXgjfGkpIC zg}74Azu)5vuqDo;+P+ef2w3yJ~37mJ?l^nWDNyrI0>IBZtOql}@ zFAvW$*&FN55P0N z{MeZK$_&o<-XuPts#Ct|OP#}SO17CjBbq+>RRhLIB`qW&BQVbSU|*5C<+r_;c;NqZ zHGuC!Dq1T#7VUJ&qo>Y&If>5uQvXLa)cE(5?yu&dk3D;rL(^o+0uknOTx-Q7TSd*?Z4I)b8dU{ zN-#-0vnW92eKgNc>=&Db<`gydHU9?u-7^yl51dDr$+L|=pG9I==DN>vdmC#2nt#vQ z(*Fqi`6+^F9&)wv1g8b?7l7@h5`xcidmFAD?(RvO7aXGPR2t)Df0$965D_v;#f*vI z<~7f~ok{@;vSQsi)3cLCwmugEN2bG>M}L#>bI9yNkm=9Xmj%^IyJU2q2WYR0{@zd@ zw?-F+h@WME(hc-DN7~Qb(~rxMTf}Lwk_0@^TL2p2{#hkGsOzV(G87feKN8Rd&IQbd z+Uw!EnPYfLX3$jRgW{3`v zLI(z`uR+ikXtqMxqDaWDPbC_1YElJyT0FTzWD+4D*kS^NP?UsoiF~h((a>G;4f7&sh)|dcC51^f81}pG?bJ?-I}} z!wk_XBa@o6*6p$#`zCHL$!E;;c}iJx(~_NeN@&nC$`+$A&vGsaxd^32fsc+TfTAJM zZICG=t)*nNwnor3PM_tazB6TaxOJA5<-tAK;Cs@(q!jX`dx*l!sAteT>q||401u}c z8aVJfr$8b4R`GKVK)E|eb^1ma+%?cevzUT6D=IrU+Me{kQCvPYuQ7YZnWKOESSqM< z3OLYH{_A=b<#?@MQ5zX|cCF8juM-DU$E|+L(*_V(FICWJ(-O1ZIH!}7CD2C6TRw6# zwuUEQMQtY^zF*ohwL#Er44SN(9kGL0IeEPp$)`pDJaf6L}B6w1dQsgM4MvVP56eZAd7~2OM3yAfXomaIg(zkGER`avj3_^KWmg!iaI>JbNd_vnty2!TlKwXa%CI!e$5`Exu4-$q=etf zt9iZ!z+iW61Z~ikKOR8{I_RqiKR#>)S=y>Wg8KoVq{4+!8%MY&sA2S(2t zbd}JtH6zMf8w|E|2l7Tgj5_>$WK_0(!37N{T!{va40O=F0}qJUj+aK~=7gdU(BZhZ z+XU95+R@qsesTc99uUyV>m1-H(k7?^Rs{4VCpGr^KY--=EXY!tMmO%{TawVt(9JEh z^wa@Pt`S=Kz2Bw?!a=~x&+KIiXs}-qvrEw064z~;hpoXI<7sOEWvYi7$?zoqvH1`x z;eSI-WG~R^r}w|pw|%>7QKcFumo!Vqh9dFV=Zs(o>(*U?byLvo)!P^^+zMa1-Yp~)&syxqE7RdF(yAdI7Cnc%d>}mCW6r+m^gLuAa#bKJ#Ga|Ux+sbx-@HF z|BQUfRKhk`(LT{BrguM`W%dYmX_hbCMUyv!6xOPz8&ai09`0aWC%@5IqCE7V%T+Ki z>WeDmIK^&8$XgakKf_r&BS^s)=ET1fLlKme-sr&Q4)=O{|~>V6Pp&*vr{ zw2;xgt0Ht=nphuika&XrOcP*~-$P%FS zQwL+4Mq^{_<}Sa=_H5D1dzx$wMIhf8@;O#zccp^yB@hweL9Fl~m(FHzCc zfi}FOSRUF{B%*85Dj0%QXS`K8uPFbJul_=5F--S~zfy~IUqmp6s4BA<$N1jMi`5|2jFj!{& z1)tH><((~0wu-K7xdz5+{YU(3{SUS%cE|+y;~Y4K5@^xq@%B3J{z$d~>?APD;!>u_ z5}%|EY3V;VMHKa&kmb?_?Hv7Ai*Q78>Y%+6s4InmRpiw_uPOXUZ-FP`s|(T**_z>* z2Oc+jdQ^rVLgmBjunie6ZCF+lDJQNYqb*OV% zD)<5OE#T515qBecN@}09@j|R&TTLAvkW5V*%!IM{yV3Ph)??BnA)M?HJr)Y4lFM5k zR+SM^OM911Z*Kfi<-b7D&T`Txqe#dx(nal3UaZ31HBOXw0Qd?8>n9kA36hVgzsb@k zscrvoBA_5X7>ISwpLH`4n;fUhIJ62IgxOjM3B=MV2iUKPot^qd8TO_wf&jv4bUR1q-G%pOdOk``!o4BQk#<8#t2*Povq2Dmc3UjD!b!k@t72(2m>o&kss#K4_4 z11Hih1ok#id|EeI$>K@VF#s6ItacN`54KFp2D%WVVn5PEwo$~OP&hQNHA2`&!DiansDr9KR$grzCS*>%!ef-k5L znp!aV_LS`6x93k zFU6@bGE>rCX2A?l0`;&}FGSS}f9gO9XOkJM{EjjG3m|Ep?6>qUr%b z{8babW--i>rohsJoX2zI^iyD(*=Mg2OAbQd-@`=Vf0ZQ+gOMgvYFpBprfuk-q68C) zKE`ptG1(q90+{$L+85t%0RX`D5o6M=fUuOaz<{W$oboVm?_8Q?!9k!ikZ_J|Azt3GrJZ@TL?k+>t;@xw+gJ*v|QSoe+a0ZqfXN? zg>0tK>B>e>3-Zn4?N9rL1D%(ge;?Qj(HR>nq*c=~g?t)PV=UGhW4>q$w^zT>@PjyI zKyP&(5SGi}Dty!1wY~J9Ynh(5UreH%>|-e*AjV~z0dx>Uu$p8!z z@}|qH-_1@0-|KHWh4|DX-vIJ5i6QbeQf-Jf_n@W{Kx#7T(g3juYy8ULVsF$vH4ofB z`cPu)3W0G!u}L%WSsTcrf=I%SzC*F3Vp^27UEyK)|FTc3rq zMbRlPtL<`~_OBFY!pPtFe?4Y!W*T6?$yjug~Rg;(N8NHRBTxfsfS zwRAqUzWh?u@}s%6Pa%PiEqv5fwbqard%NBe04dtJ7$R{J+7K>P<`3;tk=tKcE3edB zmJ?<-_`^%_dP->WPN?zIu~W>tJq{r$&F0W;A{NwJmJ_nnG`&1cAY9a2mJ_+=(l{1McI6G2f+$4|KDsS1P=N87Ut zfH~P_XK39XtUHNzuX)sj;SAt`WUGC7i3tcOX1g5w%l2J%`k~hSSAuOe$86M;xG(EW zT60?aBL0obg(Mv7{^>q^3AKxR@c9Yde`(a84=HE<=^JB_KBbyS;eV`<)G3)pDb$pi zSDQ9%4PMlxfK*ZgVnRA#<2O#ytR(l2bfkn=<^VHV#+Z=JkRa5!AYQBJcI`L5d$b?|7MgM(0qtgciI2JGGKX}dJK70Lb$bRJPRar@TJn13DL12a*-n(|Vj3tC(EVlD?p^?b=!;dXsB{+@IW)Mf(oE2`AL?cjFqf zmo%3kNn`x*6>%pfjLxG$M8N<%_vaxq*AvwC!ggn#Kqh)tsWy%+C*=XLGcS{sAS6Yc zj>AG{IV05q47=s_blEI5li#>Y^+a=M)M${EioWjFKIO(eaGcc#mhm4^1mqNP0Uo*B zvwCy#M{HV#*k8exur^2@Pq)=AHyvwN%ARxmBwF!mC#>=E%S=!K`@(QhH#-f#Y=zY_ znHd-w3RqB@aadhf)mdBcJn+$!aLeuJGO-8rj9t~7Q9|npS;!RhMEO{0%wttY>Lom3 zGs?6pmf$20N)pw>ESdoNiL0WcYrh_3C<~e@fiIi6$}y=c(Lbs#&S2HYM4}v3f6v*z zs`*LCA>gARW??<#C&7QXe#gi;CjZsd6KL6ZVc{#*hkMvKnZe(DM&jK}|1qwFT0ui` zZCusj6P{>9JRO<-1}7iGzB76}uh?4#!dX5fH+NkUnG)6VozN(2H;-I74+XMC{x3Jr z4%H_l#zXo(1tntdVxrasr3SNEHgQ@xn~SzEv#DJ&2r!)hx;(5C93#NpJyX^OI@=Zp zuq@o~`Ym0s^-5Gx6}ndG7cmN_Ydak%);!h>i3clM6y{P^U6R~VIIjsO4q05zTxI>J zv9~??WgylJugS}PK^84q7u$tX$D0*JH>+sWr|hDi{Bza?3RKn=?-!^#l49QTvE_69 zG%;;aEjoU?;EF&{W$_E(j2YH9-e_IaF@f4$;k9DmID^sXGq(J>ltxguZ=WS8W>MBl ze>K)V&oqrWrIub(thDu{zxK+-&A^WFDlXEeaw*nUXtWVaUq?b+;-yzTn*b}Y5oe8O z?w*K)Z`=Bvd@a^jO}CDG0~J(YGO>4AFvJZ^%5`GtAq>6gGeoM_s#MlpUSaWK^$Ov* z=zi{ZSI=Ocky4KF$#oHD8XGlVN*2~%u*j246X}w$f zw`QN*7U_r_Y1btqw#0avy%*NF8ahX!eZt~mLn)SIByf3XoPvDxe@SfLJ5=!GG*Q;Q zGg+hwQ|V?QV)=lzZ36NdX-K-5WPHQ6y_2Bwr$*Mk{^=%55I^ej{Scg97i^kG!Nh*2 z!El4sW7g^;A1v0ted>@oH-(rJZ;d}-Om_3FkP8Gv-;Q@XTh7im4CB_o@U!T$lCJ(O zSM_e%IWek)y}T;@D%rTMsT!+_w@=o>ntVCV@sa1a+hG;7lY~{ZKNyI zlR*u@m#Z&}RnPHl;w9G56%~WFT3RTc1I8ls1j$!2l{%mamjmXLCXcbR!L`=dJt^{z zgA^_BEZf4sV>!Qr(;)jMd6zRK5!3UY$*x40haZxXZTL7+Ui9uVWQ{2D0J80``u zT140DA&3;tDscg2c^8;VK{6iCm`4b;uy={N=hu~VaFt$$dq{JG%bz|hExRKEw%SW23Ob#kbz$g zdrIcRxNt3B(@&A5I`tGwJD0S_I$gcA9zWO(33jal;(4jPNsKekD9yiqf@qY%_cIdy zrcL>=Lju?kX-e8#`W?$v)a@$K!JRiJUgUHeXf_BgcI2i2Q?6SKxD&V^mzgq33%cFlJ?Z< z&=`;a!oB@H`@o?VA~x7YI{qanO*;3a{UHpP0!Z<^Kj^+}KQWt8PBJxTSLxVNx;4nc zAH6b9fuS^bxLme5g5xN3br7GGMWy@eEne7M*`18q%s{3UZQhR_S5hr`Tp-(Q%35pnm;H3+hhR-vQY${@XH{4ekj>a z)0}q4tY7$2oFjB4ruO1K3lm7jWVxwb6{0(B%emQRdE9z~_y~wO+xD9e`Uj&96ucE6 z{EebGZv%k?Od{EDPvEPw#tuoF`~?RRSt)#a{ntPV>Ib;F^inHg9EsV}35&wct&3{2 zFqNdbRK&hN^Lw)pNO2`$0~lsLsCB)2VCL}*b^?$5h%uCt<2YcKCU)OoeA<1?JC+r91 zDxoq#3xehPy321xuvOXwfaDICT8CzHZ^g$n=Du2-ss{kfch@ThDw%c&?kd^|7sFXD z^Eml@t6nrFDQK!r_m%^oPmzHAltxgz%MIEI*B-K=0a0_tmmjMX3SCotU11Q4gqX*< z7SR2x7J1qU+S|hYCYO1F8p@W{kQ2{11lsVOL8R0I<8QFdxp~?ToBXTvNUjsCYEUC) zm=D%JGQe>jgqmE7iiXg3DPP(VgsBg|EK=T?Lz>;tKcW(!s+P7raVyNao5sb^Ha6G4w& zM|9SM$jZ}az}^e8PvM0`Bz>3TZc5rGNTcZE!B3!LEMt~^%$@IL7_iK|@S^&U+CXVj z-B;Q#f3QE#_(+Zdo4sQBQgHMI!vcw1!i8j}o(7OI=5*RIIsouP%95T*58SNw|Ck&X1GnH+Qq{#dm(QGMqx8JUHptiyhOIz26Smj*d*FL1;Fg9 zo=*;#(l0jvnoBj0xyG~9ChQwe$|^;iv>Dn)N=XgYD?@nkBfGQ5c=jatL4rnqQg2)F z3!FsD^eNg#u&E8M9AIo(+6NZ4?%}xOCBsV+*GIvjW<0&|2wB=o9Et!WVa#c8$sP&O z?$_fzsmT}7*4=8t)=XVp<8#_n!;P?BG2gkBFdSs3*ca54wxht5{_opn$}^&xQ%l-c zDomK=_9|C8Gloobbn$@9BFER(tcS%A&jpSZWp&zGsaH$ktQQkR5>kEHmB5!+Zofk> z>xP_WJQqQHN>AEh$Rw-#9$oPi2A4NOM!rNtXsvs!-1j8qb18mS5Svbxst zIw0C@@J#rxtQ9*0U=o{#A{J&ne_!Vy}WwJzSbF?6tr0@!+6dMG9-+l*A98}tZd)%%Y z)@vb50O*6h9bX-FLjkPRybZ3C#bVf8`VQKJ`s7(~Gy?FFydf1yPcNWtJ2`Ov=26jd z=H<=X_Gj9KWV#Q2aedg<5G8^>_g1uY)}!<237w!E;cHXaQB>NP5ARUMtHaXicm&~* z32kK8ZmNXItKGZO$JVnpjwITgYHHM2`DW{Qm!3>}_*Hs|_Z%V_C*beV^~hmPfmGV0 z{p?hE6G!VDq1UMSbLgU`zb$Eh%~BGP_h+jc z6lmJco1a3fMhhU>Z4oQ}(}?2LeiaBQrVe$K&6j=713uc&l6gLSq+y8nbAb@cI=pNeiW%Un`mkjY_m&x1*DnkCg8*_wLAlktmpZD(I|25k`cmB5- z)#Rii-$(F4x{^}^7eaXoU6#dMb9Wnaf7IJXUgvHWS5&dhG>BFzsWqvL(9CevVc*Gq z!oG5V(`egd(!U;L6y%sgqS@4kWIH=h2s-LprVe(v5jIx6Od{KjjgW)ES{pW3^~wYE z>F4i`DA+(l>qMs#Ke!Y4zd75EzDe$O#U9@{H{VioG6P)pm9_y4*H?V(lm^{<0KVIq zSPaJfup+Pi5z?fx3FrWg7ilbJL>v_~nvm#*|ac-}gcY5S&)@`T~Er)rCW>GxtOaU(sLYCY?0)Pit z_;yO&3dxc|mSb2(*pd6}GoVBKt*$}B&Uf5Q3Puj|1z#_~7u{+*%?;$Df~Z^8q^F}i zB6*2q3>MsDdJk3##crUiiMZWb5PEE~u_V_0{5n>~vib5xJX6)4=Mj9jx|cYi<7pqAY_Vv4M-7*T3b zsLO&=S+^xnHly6B(cN2TBT8wt%e>@geBCBgEq6XZs+rFV}v%%BwX+S=N;m+^-7_i)Ku7B&aDk7rS zs|wt*A*-Ed@2Udjo07(Om7&JNr&^%#i#L?Plf57xi9+1DJrISE2nTm>6_t^iS9OV3 z5%JrBD+M7RxGr*C<&w=i&|qeQT2!V%ofH*gvQ zJRP~1uz$4?zJq(l=r5Y!cmpkX31>uhbt2sS z{s*i3jDOPO?%4z!9M4+rl;}nFcb`14R5yH9(Nx_e!V>t0@5e8~c68}AQQCWfwrrX& zQ<7_Ys};o>%Ea9>dp#cG3Pzw9BbzRa6FhX>rCKEn4PVircL9&?4%OXHqSiLhs;D4C zEspU#3|C|sF%#jJ>uaVwl}g>sxB}g4HiJGTMG1_DThg`ww&39DDyJ1Z8W1N#DPy_Y zzz5y!>2@(3u3AnLg>0Y=do(mkxW%g~$Q1y>h3v&IP$u30B?5%kVYWmtpNkU?|-*WWqvDi0w#_(m^WZ3AD5<#KE!s|277R=rV7$@t# zBywAo?C$0_MHmSq59qhBLlvM%YPbNYxyjxQP}=!zNxCVt-%}aJ14P~|E?!UTb;$HxJB68fC0@|yCdHN(Qpq*#uo77XtRCJh zl}|lFG#{%xPwismk2R;-El{#OapwxDHLJ~}SM}aBxda_oZ?DY$ws%^ZCF#6Oum{8j z#F%)zNG2sECSBe-`^k<;EQlKy>xu<`mrmQWYalY6$Lm5H6qpfq?hxKb4d_cm6SO0T+9iBoUa#*k$%A0FaC7 zOlaO!+!Mv$LlkY(r0BFwrlNfXEzy)i5*pl)yVj7j!!+JxiR-5h+K~0oaP-zbVI4Te zb*>t=(fXU+0DX2fVmIDq!T-~7eVxJiH%3V6i==dQ>RNOeTe<;p)MG$73q#&!(!pdV zxpd}jYd)2wiQnCmx?z3tyWaFS)NChJUBBLTx~Esf$xNL_&!1#yxyZtplq;DqnHwau zA?aU{cF^8}MTv=&^e2L_+#*aK3t&RHkr0biNv=<{5N*fDMN!^}Nn4aMLE01%vlLbi z+_f9YkYd~1P0x^PtPDs}^fca!ThNh(&#l1!p)AFpIu2NjIG+J$n>iAG^2&(h&jH?^ zIQt7{hw0A4@?sD!wgTg|N9KlcLS#NyajjqnYdGGZVdvDDG*!Y|rNjkIRWvtGH}r!z09+K3S(bU;Iq02ML`wE}(*)kKmd#+fOLqZPk&J-U>pKki?~(#NgVYaF>(hU% zjcMMqY1I}U`fjr1It5A+8eiL++8S?EgAR7QYz}Dt%@^LYsNp@^=IscqPzC6**1jj2 z7C)$$dDw~$F>+5rU|Zh6|6&3BhG5$%5nK!AfK-$k;3Cy(QklD3blc z>r!R4A|Q)~=s-)BqLZ8%^9Y@dJkvLZ>@eQeq`5sQ6k#|NAvApIg40=)vHi5!oi$Be zdJjTe@E6|MQMnxd94qU<4JyY-!xZYbvo|4Jc$*A^4tg<7Cmi14z#B$#TNd*^s_1QN zGxZs>ZqM>jJm}~d-ugd~=M3KN-Rh_j|4D9E_7_;*WoAon>oQ?&T^7;V&fkVe88_bv z1%H`${Vr1UD<)5A=G*h3WGRzRqkcV`OW*7lwf^4;f623NxDCiAS&=z2Ah!tG;M4|u zKhVYdCG6scUAf;GV^7K;KL$$v$I=B8r^HW%Yqz}d-$hwpeVdUS#eNKl7k)x2(NveAI!TA7#sL%_hLDB$e zmNdJ&Np;`ML~WmN^xbMiTSH718<|!L4?no^YSu3eAEEBr?t0(;()WtV3>nTIOU7mq zcJj=1{A|4~hSmmqh)M{N;Wgk9!h@@YQ7p#VtAR#RyGl19=zp*^T6)Fk*c8EYkO$xq z%Eo~Lz7%1k?7vLpY;zylNx;o5tpHQW#&C^*`x@XI#(_`FSxG5EOUTq)|7BYBSkyHD zJc>z=PF6XV&@|v79y!;&Vj5H)G%?xEpO(F2v?W zmFfm(=%Ah1P=eOCHx@+TI_u#3=;`1o?a|H!DbZP{)A>1xNRuvMi_W*)&28kl+oep$Oqs}YeAz|ccqUuyr|}}q3?<-2MZOH?BHMZ zNQS#kTteVY?LU8pM^(W%Vp~<&e~Ua|;ZupY*Z>_1hM}`!0BgC=~veoJZhSFCM(Y`Uu&}K#v87-v!|pl^)B5*~I6)f0c3@3{l`? z!(o8?kg}(&A%xf-8uz3cVRJ_tgFtt>pVT5;^QqcAf5b%}suFdcW~@AjePcC} zix=RJgFu4Ps;+g|O?|Kd#)({fMgqZV4w_{NrL(>~IyT^sgFvJPZbUz^5Kx0lN z9$j~%K%??2n#A3thdpw4FOT_{j*UcpsXE}hAVXmbcF==|qE04$Houyf(R>+L$vZcIa1)kGaEP5V!Ap_$Z$~K z>P8b61fWfk7f~^u6aG+@cR}FNHL3adA$YVhs@xr~YyB;s2HP91{Xm>Pp@>ODT6o~( zLPE&fb8q2kh1+BPXCxR6kdy;r<=Tk2fWZ(?Lx$lXPtWccAZXSN!cVIFAY^(BNeZ}ahS*Qb>_T^wSH#l6EX zY_Z`*^tzr)HX=oCgBfM6>UO$Wa-;0CB@e~hc>;IDWPJ_w>*vJY_Yy4>$ZUHqv^hv6V347v_Y|hB55Y*vP!T33X)j0vNexGA?baEalPRy*5}1d?jY;q&2NL-F&rHF;%qV04AmzEi2yO3vX2kPu86 z`H{^MFt*`#_Df((R$q7=OJrwu-R%Dr23_n;&}^uFL*_VGy$|7f92P+jfN0UR=ZXZ& zKHBHZxD~}%7Smg<=~PnAYhU5Pq%39%)pR8L14^8}+j6_S62p8bRs);jmn!6J>f7PL z(r#0raCqP(i9P;~cyJPs!Q-&Gawtw`QjFQZubSb|8b1>7qw7umWUF-*R;-4BM3h+F zyN@}6j)KDB8^___`fly<0bRIeLRR2>l(|ORE3+m`MJX>A&sfZ`M|d;9v329u49R#nIK~pnbGb-QZjQ7q-MjkUa!nns;jjA9zW)U?1WYXwIPR z2NPmslbeBNT-U~SmnUgPxp9MID;C1ZFHPbW0Oi6{+90;$w4Er$$9TBwm%LT}N8~YNs`@R9)g3$_@e?j^!4@#`@d5 zyt99d)*yAurzGf6G&k3OyHDaRU?X>+V&M>F@CE*>KC`e2j5Ei2^3h*V9>3L#)ehn< z$^1`)$n5xNY883N5YCgBQ^_>c8?88PzQ#fobzI^z*vZ|j8@CW#smHkWY&lfti?S3) zfR*kX&EvyBmTBTdpc+KK^Vgo#)7eX{D;FS{wp7g#H3ehp>WZi*C2Znfb-4y(khCpZ zXk_+)cSTM-OX^$Q@D3b8Mqhno$06cpkU{``>*zop6dcYBr|7YD*sy(l{bp8pkP(G6 zmnGtAnzr0zO)*10VRKK7GWm>5JnlMl34@KpOM<`%Xj0;CslzWiyEU(|*2uXcmf%rI zKX;&wN1z%bnw+t$9 z_|NS)kBPKanMsX`SQ>o)?u?k+Z!k*uDd*yY3ku2QWo@xow%HQGbva03QWFO}FhzY!F*=}{H4Ng3Sw{lJn*g;01kGXG zefL>)bo#B%@miU$Evh@I{c+-rs_lL*pfr&}lWQdb74ZcsAxEH%{iUNV{m~;x93JA8 zBl`!rOXYqCmiaM*M-}amWe0d(w9W!b&9x{Hj2_~bzhY*e{f6X1WLAS<9pDqAJ}KQ< zTENTkMX*=#-FD)bQLQDHVNOvekS_fO)V%)|4%eraVo zyF{^%sQMe}3?lXQP9w`ASjt&0tXCZpiAP#-0OVb@mENC=zc@x)8d``Ax)Z81LF9l z?eQrI`c2}-L@5)#2I(|&$>GH*wzn)(9g1;5J;!~>2u;tO6h`94ig>FK^|6oN1n2vf z)EdS^ZMt-IHGChZ`QUy(yO845{EWTsJr4o09vOFe3W>rJ5n73|6L2cqzjA{jDLvxZ zKe-ldoYM+fmR2?koc(8Xve)DxzT(V(!SKQ$MH=GSKe-wBFT*2vW7?O@(uU1E;3hnu zuTY!p8Lp|#Tv6iQxH)&2kt2S8h%3O1-lKU)NsN&yJ4RQ%f)bmq%^>35->*r(wrU_S z$nomQPR`tpquT!==kYz3o za75z$Yp||yt}MvOA^>c#c{?pVH-aIe&x&M8DH?6jpe5rF0-wL|o$+RUmv_Sc55Un3AkR8D!SNPcsRyuW;6;nWt{}gdXD??B;`B zUx$V7YqO3h_a#hDs(ZYEqX)nb>_lt39NgobYDzRVq`#?$ahZ}fosZ@pgRX!}cJPzs zn3;Ah@%Q7eO|*UO8?^VM9Qr}B7b!SugcRhBO0|1N(S-5P@=)Wt!0;MdLqUZJw%AXK zdTC^OIVxsEe1~&7`PjE849w%=3s8)(65~K*^e<=6`9mY-qtg^+0`p>o7tirJI(p;- zjazVOrmAY`|Bw~;BbQn1EAPqH>G-q&h=<3$eM00Qb4iR$TdJ6fU3#&O7Jf02AQ_yI zr;%3@FT|vgBw6Gry7>|v+=ACd7gHluSb&rXHi6DztTQCOT5p6=;NIjcLJiu_d5v)$ zh#8Ch;;%kNgl(xNj&>s{jHh001=-{+kQd544`}qXW1A)?J0q8JeEN=ZcF8wj>W6(S zuwvvoqLgb~Un8wO>jI99z^XczvvC^eujX&qyN&ZLf+OTSe0$1GE%n*+WG)~~&mr!< z_yX%j1v}*nf5&{*X&U4~14uw~nKHwN=9s!n8Z*y5tpbs?0c{@_5b~(_OB>`x8%nq` z7{2Ea__)NwH@VNlh0{y_aotLU*FhlvnK9%^k%gRO#(Acbl8NGHZoBK)AEJ>IriH%S zUa=nN-hJdywCEh#7C2YInLGMRdEd>%9N9-c9bs6MbIEjIMqX(b@_#(`^w)~mq)izik zCIs%~H24bQ^e^OJy!Z|AG zVIHKVTftJmd#mg~etP7Bpc>iRl<)Wj9`@E|V=o_Pf}#4Df0=+OKYWb&6I0}dDIO}8 zWpDT4yvI~z!TtFWw|{Ap(GQKl)|lHfE>Yx$W|_t_uXWJF%jpMyMho%T+?V?JO%7pV z_jOu-G`HlMHL-v{SCqk-w$G;X-n0P{NY>w5rSbdKh)p(^aZ}`*&pwTHmLuU%=#?&H zS~ZArs7=XVjlz5PX1BB>}0L275dj|RsO~NRhgC^vr zydZQea{B#6|6cV!aC6ags!_aS5@Cb7ApYDX7-!_Ss-xl9y`~0MNV7PFfpul9RCGB* zq8|36GpqQO;;!VmfLOItJ?c5hXGeW{CT`}B(|l>S=d#*S{0E zL{O_8+L{c;4+wZ~vd+HZGUMutIW^?jV(F|(7I0}J#H^Aw`0@OJdKS!~Wb9bx%-Ocx zQjO%~ouzWm(l`5HGnYw<{ra$jAO-TiwwrKw)4WcB!Cd6zqm)Ntz`TwAw3toC5Z2;_ ziu&bY(4_!Nip#92sa=n*C2T9`IA$OTgw(6AJ@84_#)3A zsp1ufC$Qw^2snVOdsE>rRPr|n4NUk+Tqk3>#i)^#bCeg|?nLC~2td!wFgg&}e4RFs z^v(yAJs~)uTyL9Zak85M7uw|J2vqj10R^exVJlWe2@6qKIPWMF0yv$Cs?waMosi__ z2x{n8rGqxms%f_fNG4v2m?xmyXcCoo3&I&%aMLUU<4 zxIN_gN5?;L=GAnd1!i62jpL%eq|XK#(u`e;+A^a)pDpDC1+(c#0HGx$n=}o79Y_e! zUUMimh1>!<2$aj?>j~v1T{lEs2m!mO^02Lm!&1mURE*oM5y6yLEh4$LGuD76hY{sC#oih<<^N!TKCqc- z2hSd z$?fX=`GPhp-U{V9Fr7iAUl*u+75f=JnmLMgyYFKeUzk4%mj-AT|EJ|TFrhDS0!B;C zAH$;ZY`Aj{PN{3z&S;oclBo@m1;*t%Ft8c_Rr#Teg+jEud*#zP{R}|y+8SRJmtWUm z-EZYTO7ig;M?WRYF26a-F0MUeqgONPQMzh5|5!<)$IInX=zfXGl&nNaP!s3h2)SpjTd?I{hkQZsMR+%wn*V)D$;=HL2lHA843fmjta)T6YWwAB`dKxR z+spXZw1-qhn?!Sb_24wh%pydckz#*JMf&BE42&Jl)%zyKgD z6Hd9HiF3gP9V_{_?_J$m@ra>Woz zxEpU}aup@H4-Ike>u^V+N2cYYlPOrr1Ri~@K#@7!acdYP2njZT=^+6D1zUD239;p? z!YQlR9HfpOITx@w7uj}pd+{OL;skD1M3q<9x;W*v`D)gd3=z}O0zGl`81SPn?@1uy z4j(#nyxv_d72D{&5bP`Sd{*2~B8`0U<)KF)Z8pG`I%+x`xM}=g{^#|rVG>q?*b~1buj`leZ7buXx zyESS~yD|ZX9$rcUg97G2QE;A8aTO*$%BA6V01c)tjr)i(PubJF@VlF_&)4QlWHk1L zuVy(IxY9-^KBhWQ3CqE+w1WNnEgv5jQhMf40lq##!BU;;016mZlE7|<{01O}U#BvAgI;9)L0onU@qh8j=Ow6%0B4g9p8`$OFi?Wu5&i#lFj3K z^BYxf9LYDdBYz?6Qt|aD4kaqt=|)2nc{V)Z4M0xjrAxz0&#hukrtu;H zY*h1s?G*e8zPJq#KEzq-qHSE}tsx;|@oLR4kBhqZy>0z`Kh`g^Xwqfhjd&fxxjQoE zt{zi^Us*fE9hv)E0{hn|SQAFsfA$eMK?~zq%xrGvu^bS#b!d_3Pkx{TrVJd31{jf- z=-h;4+QIC$M|=T5oTYK*wE%f2FHKc% z?)r@ues#;Xl43$yDQqohnw(@?CsIo0y_I60Kgegt99*T9gJNkHNFRz84X>ZVS!7-V zK=%*kzm#4e=%Fb@<=6yFce@WOU6KXRJb6NhjU3P{GR|A(&#ouC=suZa*kMtOf2wnS z%mZ^ni3?7wqP_%^tpj)F)w0>_7V8muYRJ%i*AX**S4+aXdiDxA)jq{+i*s4#+penn zaf$q$E=WDOao?TErWNX+l*u7B`;rgj_zrsJ;5Q1ABnB?I2n9NYe|(N}C)ZxDHz|~b zMo@RWsAn4H@=`Zbpt{XBgK$CqZlLah<6dmFaZnL+tncxM9`f_L1@d5Mpn_q)$5fIk*u^jl@%pS0VxD zWJN6K7VYW(_+OXXAi>X(M1Ye3_FM4;(r0-xKibtwBvdz472fM`Hc@P zr)FH|)bB;Z#bR=*ci1_aqh^+Nl?UUPCu9LdrR9dGQS}WN4BRb~yVAh$MsE=4 zAy*BKr2xOWo>Ax6vthekmaAQ<)Y*$Jp_^h`xz&T{C0xZ`+Fo~9{nYy#60Y3DZ5W9t zUO%+xy+9~899=NzChm}Wgpr=4?S00fBtaifKGtSpCMGSdoh1vDy5IBYE^Tbt)tu^` zg7@&@n{$NOiZ05BuVwX2iESc6UcO7{FZX<)d>y5U5cf7y(Nj*QR{7EB0+|OVsdZcV z2SR!1FZX=1DegFwU-W;ya6FznYawhG)HmYNF9A4ZDOMNgH^L3Tf=G9mHa&~JGe*@3 zXI|XEcvtO4Ep~v5ar_(TN_sgUrsi*?XX>Q%SZX%;l%$S~H%q`kK_%0XD+dthOF&J) zzWw|S`3k)sy~QvErTjMmFqCvy#-^k{dfe&zM(UPzTkB!g3#KVc*+ zo6*d`eY8eiK!l5I&MU;;jTeOIUR}evG|G$CJ4>R2mE}q-{}(imJ%wEX;!!6cU4nM# zU*p^~xjHjA@1SQJsugl%H=-szSS?q(Rt|%;_n-&pWW2(hWWv)V#0KKAR$7DIA{K>y zWyjX=IA1U@;Nl7BW`iO)-z3~YIhP2k5@KV6kjdAgkTbaI&`k@TJ` zX>e8fIFIHGBP>ky%cf!tX!~U2Z+9vT^?baKeylhreSH<(yyYB{y?V&tY=?+Zj#B}I9E8grV zJ!<4n(-zC-p7CM^ROPW-bO`{OPcdug$Eu#M+G~JOz!VDTjoeSF`X08!)biChe>yc4 z7~%}*$;SxWDG)62!GlMqO0{o_Rh*M^g7W=sC>El#7+HSk%HGx03LAtV21}$O`xQjd z3V7n79Dw;;lT&Rfw$(KNN)4cb0`pvSPq3BpzAl_Crd)5!gm}3g`acwhi~phnW81rZYPpQoP)| zCLhq~{=8y@P~(V!_mb3*uf0DE1Qx0W%{Vl?L!Dl|F$W&$I#29d`wo#3%qk#3fC#6S zt64w`6=Ha>{R*JAPCtL?Q4wq^;Z9J@w~|6pSxJmBDzg+byf*}hOvU@r{gp}SZ3SJw zk>Ln{kH5Y`K zBZ(Eux=AnY970b`EsB9KV~{rL4eJjZ9*}XMQ|U2Q6MD|EwAJT0E|j*&#m)A2Q7A*| z8)XnI)aj1+jWNg8C#y|QCaEnWF0B-GbFJ|$un`#Kz*E+@vrqtXA+)m zUQ1i*SV!0FLiAu`cHw6NGS1>`?Ts%k-ef$x9Ay7m-<2QgT^R;=E}?;C@qH_N$$pt_ zp9uN$U2-N+U!qfqDnk+KV7(=g_i0(x<!JC_ z@e{>P6XkJX-Ia4^7JT^X;|ee8uElbU*6NX9|B|Gev{`b+GSU_@L3Cj>a%!quFLDy< zwcz%GCKM%xkXd_Uj)Rw&sVf5B&#CD*#F5sZ&li{Kyz6s@Y5a&ibDR;eLM(SqF!@bb zlmarf5Vc0=HbevJ(dH#)Q15@)0CHBnz!#wl_pG&Fuj*vw$mOP~D?GljZbb~D2>!BCnsC&j0&Chw=;Xm;E%kB6_ zf!84F?#yW>O7xqS?qAt)wvpRsw=OF;c@+QGaCaJkz}#T!^Q0wdf04?xPoL=fC7vbX zr;rsd+ZnRhFDPN{>Od^&^`0Xuy&+DqOSq(m=ItJI93-VwLoL(fkYtd-yZmG81F33U z2mQ83J?bJ9#aGSF)sXY^pPT`y%C)v~5~W9y-%s4c)ROn> zXa@5oR><`%R*N@QR3LlT0m3PIKJ^O|{$!wE19MjEaPHRNRUn4s{5Zf#f5ZV`a{${D zXyR$otk3-Tmu2_DQYV%lSl(7<79i7V$^dhp-yLKvAxE#CduE`Ccr(&y3 zxZ8LT)=qR0@+QZ&R{8#ZK+F6>=n9(a*=|%6BJSJh4*4SE@!AwL_z3F=XGYjUIdXi- zEJ9rD05O`cJ~8igCv#AOwPi$z_JLH9P(uFNCSU7|`}8jC17s-cO%=BXwrP*o`JGP( zx&9RMuwDF+RM65Wr@cAs4?F^;8Rmy%Uu`KNmX+%yVc;6pfjYOT6iTRGP1{!N88ms} zdkW;eVB6U|o2O_B)n`ZS9;^<1&{O0QRv6=7T{u3sD3>Hs84DP= z1>y&TkRt-@C(o4tF9HI;Ru2ifBxKF-mLkzEd&#;_e_jz&)DFw+Fa)>Rtfg6Y9vzH~ z(RI8cQ-Un=@qkRSDInFC{cQy7UcVTQVlkYQ))d7)JWHuDLNT%|wgHl>4@w;=prZlo zW23g1UU~>M6Ib{@7?V^w%*n*>h!=q#c!qTL`zk=}YsQ<_Ii-J*d|KpuICy8`)=WMz96vr zOvB;qm*BP4zRw#pv4NxrU{8BMF61NZdMOoshL7ieY-m1M-wZH(vto^V11*8#Y_iIP zSw%YRis(En>$Mwxr%j2qGh8)`?KC_aKI8^1EoMCiK+1FMi-5MNh9JbK`FLkiHY~dw z5nXSMC`JFW&*b*Uh-ymgkd0fAsnDk9C0fK)&(l+@>WR}H%_tUb{hR|nYi|_nk;zmU zm?jqK>F3K+oKTek-OIk*5v-LAR!^J>wbe=Nsn+<@Dm^OX$OE|D1H+gfIPW!6Gp`06 zD=kR)4zv&Kuz)2iiKs3RNzkvRfq_$-i?~%TY&_*Zg&hVl?A{dYy0=jE_f|SZ;}1(r z;AA9(0J#ibjRqBoMBJ3TZBjPuzJw*qXIRl&`bh>DGq(s=P!^3Q1zf<4Ng9Q&p=oXG z&i%(0P^VZ-YVWK+Rr6L*ao@}loK261qU72>oOvqj&@sPWb-v(#^-gE9y+uM$GX@~` z6jeOiN;^ys9T8&e+U7Swhgoo!g^s^w0q@>_mzh(60O*i05d@0#UFs(6-km)ZyEBM$ z{$E2>cg5C}pgM5?Z^HpYqr_-`7YrNh;t0yQ`JdEAz?N=INn2ai+`ev^s|Jbj#q99M zob2oEd0s>-z`IVlv}IqhOaxhQ(= z^}m2L4(Qk;_I8F>{ebt0DuG2DYKYR)sAx9O4@kr@|M2dSd5kih46d2T?y>BY=3qmtv;* z94l$=N$wMqnyachefEwoEHnlz(`f5phu|E@8AK5FB8I8%N$wNMmD_~|cOf(tK?=^* zJYZC-?vF1g#tG%&J&!$LQEFfA zhX0=N6wuD`pqb+*ecZW!aAz5b{43>^VTTgReIqCCh?lzUs}a};U9rO_q^Ku&vKkJE zRRX>$^OP0c*_bfyi6=cF*xhs1!)5r_cncNr5bxoA8NGY9`%oawFX&P3mw1`UawmoR z1#%jZA4n2~k{1Ct`q_=<^`{|b z5oxLJo(i1p9heCPYf9Xx(j@9UHJZ7vAGVlaDE@(NH)dMytIF}iRS6h}=w0%Pff+9Q z_q!x;L!U5ud>m-*8h|bCy$dl`K3Q$4;>r^E(k%rql=x<^Bbl+Y@X4^t{55>;&Y?zN zOLNMsnH(XCFRF?=BemkRaedxfbX&8g*!v&u(giD1{VJUQs#W++O23L>LzQaReDGJA zaJs{trOZ(7+e0?C;RL$&S7@k=u}W{tG9IOm(1dQl8N`vri$p^1I-NjB5Z(K?^ zu@Cm^r}JjZ=*8GQvpc(a3$aZK3n64j`d^*?suBOoT5DnVzpF zEQNOOH6=Yq-QUsNHyQW>QLx<%2k?}9X`*C@0duVAkX@YbLz5I_rVC6%PBEz0sp^1* zS+0QI4&o6vy0MZfC7Lbot-~)90_;kYzZgkuHN{caXC2X$gO|MPPI~&%a?+dd0tEu; z+YYreL#d>pj~B~WCuy+xuI(2zufj|5WX3h{90+_$bu7PDu10eC5Uj0BBT9n^7&U8y zc(2Wl1S4SZB=19FTyyA1#ZJ8DG1UUPJh^tIDztam-pU$+#&m4(D44*++nR>ew!|4M zCKPlk~s4{>O%MMJ_w({dV9w*?AIn!{=G==!zYdRa*i;sNcXzeE$KV(QQAS|zA|uQ zryZ;RZesPWnh2)_!KvH)ttKj5Kqm?CRKuU?mfhi6og5XHCAmNwb3>HWx<0p_*`JgA z^n*e0Sf$vVdb;eMEu}r#NC0KIPBJ!?j;gPQMw+$j`fW7uUJTHUjzna%E#1&OL;MyV zi5+oMK6QXm?1$UUJY6O5YPXkToJGOif?TYFS1UfCTd|Feb(^6&C-SHTr%ZS7Z~oQ^ zu5LheP#juP=8h<*;5bg7G?k0I>+l{=QmJ6@eUZD~fdAV}P_w;nuIgl~MBf@O9cn#=*;Ygkyg2fto9C#3G7se(7zzlDCXUf;%YvLHy#-CEGH%VrEP5 zhrB4Xk89+nS_wZJ*_H{NU z_fkl=w;R%kNu6Qvm2>q3V}Hj_Y_d-Sw4{ZHJ&@!Mn8uztOvY<@zXllaqe)4xUM7o8 z&YtrGQ}|YaWe^DYvtl89M(i0|fuy$ZstSxtktTso8m}b?7B;wRl}toL@|pC_dKj$L z-!fY8s_Kikd^0omV-Jk+JtiO?kzJ@O?~FV3E+~DwxTaBNf4H{#hPr*5N~e4cuq6$^P@Zx z@OR@wt0*e0ri$#f8HeyDpnmLniJ6dEOR8t^^(G^z7Wfh60)1J5mAb7bEf%5YhCmgy z`*qTB91|Gu^?-Ren1v-RS;8B}f!iyX0n`bK7`#cT!ub^Fi9;Fi`gmHA_TdIB4LpXk zY0&?R!J=N%#X%4E8|IEPH)_l9`n`?2U?jKGwOiL(H8X-3r0B|p=p9nJLdv}EAW7rxYzW>e$uic=ath0%EM zzVQb2@@pz}8pQqa?k|1%#zBGFju~KyHFZNo^hl>Na{9?;)d7^2y(8N3?lIeP{u6JP zGjhKE>Cvv^Yup8flD5DtYjJ*))<;hA6Sk58l{shS0v<;!me;N5ZiH}0rBMHbyF5>A zbR#nI7__~<^VgUgKj1)FD0c9d8Hm;%M~|6shfH*$n!40?RZwRLvUpIqy}cmv9oWV7 zIZ?i%Mkd-I+6%IJGfEEWAxo~J9&Gm)MHON4E!JyO`y3NZj$Ob^c(@Gs!L&Xz5E_=Y zww3GHJ0=qHOtS>aGtmZ8YXlDD0xILhl+&^=;1^0CV>^-~bA560S+MbQV7rwgu5do9 z&d4n6d!jSkMN|xm?LquWEzg$nUXyL9d<09VfN7XUEKYi7?{w2l$;XjA5fE`H6?q); zc^IPN#M@)vZFtSB(sY6TK4!gJzapmbyN>kG?q+ZDf1&m0g!BA>sn62Q>N!>H0Z$Zs zNWg64>FT0c1pRdKkJC>;CIZ$QK+_g(hlbT@Z!BeNv8eMm1l$0y4s2}lm}D-?GNFj) zxCWcw!>g!LCd8R@sm%Yc3L4H=nZU+*lJQzBy45Z6 z+4p@-R6!bjBbOF6ZB-8PuN1L;FHpdGEneFk&|}RIj{HkKq_ycl%}cdjiwvLgviKI0 zO{F>C4t4K{1q1hh4jwcHDOH?0X*g|L+}eHew>(V%FEd4&8rNa*S9{eT*cwZJ$4ggm z*z~q>1aKh( zqT*o6^DcE7(-DoSKV4(}E%Qw-aV*?(``Cr^27dgF&_fXFjY{?|q8J=k4LS5gC_XAX zxg@Tvqnl6j8`?ETX+dsTS~}yjEF$er@LP5f(F5yzWf<>V(0U#7F-CF&5|q*P0g``G z;=Q;Yc!AP{0N_U)mc4w3Lt6~zsIfz$FB@39pZL1+c^oV74P^C~KE!ZC7ja zt;BXY5{M8&T#mz`g^5>yCCPe3MQG4rQ%`F8B|!P}z|C{qB$5&i8uyRJHOW+ns`qUJ zI(xHLBAM7^%CD;P;y**;Rxa*ml(%OSyj8u+kh=%e&WE3il%5qI=cxAc?UIGq(uU`U z?c{zDT{ik;q}qn`bO`@>FNPUNy#R*u`y(yU^^h&pPKQq4VjVtc6P!2~<(7p~KAdBddO? zcChzZ#s&(i6!Mp79%E?xGVs>Z&YjwG2n{jxD}UK#iC?qRy%b)B@V3>+yFGr} zN^hy%qQD{aJj`n05SdG;B+3-qX8VigI7!)?!o|+JRSSeohfq@VNuJ4TfY+!o6OXS3 zBi1Gz=;l$cmInnGpgT2hyfp#zW8|t@7bzZ9zZ}EL(1P4@w;#-7{(N)c){@Z^c8_-S zd}n+$nXGSlAhdxgys{>t;dcBE5ALuDJJeJTX&pNBi}l+fb;Qvz;0fA7K6_T)eC1Bb zQ@Myr^rvL#8!saCj31j>>;3P(OzHUPugD3_wBZHYfPq1wDHTgtS#b&UkWnpkrVnsq zLy)$M{3BPoLebzgI7k}&k8iVI5Qs_is&KXJArYo4f)6<6UG2)wLzQG>hvGxL96ume z)Yw(@tYsR#(JRPcoRO}n@?)RJwP`swKOO2lg}uMb&8RZ;vayrq;%b}*gMjfxsn_<{ z!|NM~1<)+VpR&IR_9#;HxeS}@p?Rik;-nE2HqW=>ACr@s0>edA=xqp81ob)ez>Qp> zh6B8NRumRX6jhL4aJqaey_5}yluT&_i+8hClu(>R7MR7SChc+H*0e@xR$69OhTU$h(0&;`go98i$G^Dw+>sJl;%bR zeDqn&$p{%b%Ud&)pTl(ZFc>#|b|OfO=e-bEQXHN(8))E4qyI=pLOCFKnDIM!mG z5mC*{TdPbJ8?Qf5WxHq>WsY0T8WmX~@5<)&R|Lx0Mw#)tbHf*1=ExCn=ucGndxc(p zjA&2CB7JG~w|2%k{0Rn~60@oz|AN zFc1u(espqR;_@it=67zB@77}W1d&wIIJ+l~nwJNEX^yzAz9VOAaTuXKZ2BlU#fL+u#$4|rgqJa>%>4`?%o0r`6$J?$2y z%6wv}N}*n|T)CO{A>5`((P~>W$(3Ge38l|Eh#NtLp_2*%$NVxytTQwABpH^nv%;Pc zaON#XgzuN7W)NlXZ14Di-w;&YBu*CgD7+EunMeQ=YHzewe^0NXV`4#ST|(UQKC-mm zz-18jE)Y_O#*yCk8M1Y%r7l{m9Hlnw31}4Cf117{_pv(mMm|R%!qX6r!GO_?_r~@A zEY(ir$p)>pve%BlRM1BDOm*JKrrFnrU;on>#>bb`vXGg`2fYxdzgX-Q)o%&*U5ksb zdm6Uv;MG{G$zKJUKZ{dZJ|QvYT|&@=HJ_I@z=vZ^&1ze9e9#WK#pN4IbGZg1nj{6BLIunt(c zz-1ffryH-dL;VX&uM@lW6*X)2aqsT9(+REf#a{lU=KbktzGJy9?hs@DyaGu{76Bjj zgFoB=Iy7zFMev(n@Lsxd_H@1Bp)$2|t%P=SU$S`ihehSR?B~uCY_rAn*AoP1epx>pOIgkgQhQchprgz;(Fa8 zI^$eb{{#S6bFGFPV%;S6p_Aq%3)-sYQl?>&i&?@pQxVGEmf>(w^S=ctmHr?0rh&L6 zVO-^Id`MBo$;$tYXI$@i?zmJQnoVl~+rnG+sr_^}-M)`l;vga(x5~$JTh_@c%G##5 z_6{pmmQN4%tSyqa{rT$td8LA3pHFnG!I3?q+9yU6x|30-_#Wu?vK?YbG6_oqs%I_% zWMZHo;up+ku|r3Nxsep2wE9~1&gehsni^A~DQsFtjq<4GDgfJGK_@lYCBT5(ScMh# z^nZg52;7F5RA`AhqC`GGaX5|L(op3GsBPnBdy`D|{Ya^T+aN;HCK#R3+K`>Y18r~y z@KPMvxNy6qUY9KQJbl*oERhGR#Z0h3^_cV8QxeDRqHETUlo~c7Chui< zN!c&H)t4fO(}1Dqr0u)+?HtV0XqhG?oKzpzv*C;Zr2=leJ_l~~Xk~Fx5-BZ)R_5WmuYLHG~4+h zX|kC_az$VGGF=g%-p`a-9K1B!CniZ4;FHgs-2jr%Y)*z@ZyYK3G#VWD+Ay2x>&d2z9@wXHB zHrdgviVkTzyR89Cur108*1$sfgB@C~mg3DVyg`2WItKyOVR^3-22T7eCnlMycfShF zNtcH3R+-b(U{x9TI)RTl7LwArP)}%hd!)eq`Nv{nY3QU^f6R*2r-<12I;>*y5&j*% z(T}jMtbZU@b~z{DxMPX)#UC-s&Pe0^jZV2YH*CGUk7U22EhOu*4jD}1sBy% zjY@a;LD53Y$Q$WS8~X{y;Q~J%_faB}jQQ|sDH2Nq;F3D{NZ)lFPao(Ork2b?o`_pE zb_|^s;VmR1ULC^a> zKMtC!y+Q;f%JXC#%nKStejwheLpd4x7PQ;=Zv#+PckBT&DR|s}pP>Nmz8QVAzFuvB zE~pTKm${eta2jjpguz{&V=w*rW5B4n^|EEv!$IkHLe1{TaZG6Vaa;@%2oxPLbhX{t z6X(-$dPSENRLLUL8>MB$zM~QNd~QAeS})Ed0}U-E3|VO(^n@+zJzI$NXn`8sV!n6y zmz5enLYJ3-M#3N`C|0;dkE_w9QlJJoJlq6&^qg$?qZW&N*^Z4cHNS|!MWnI9$`*uv z6~58gXe7@_-THU;VGLt+u2FmV;TjJ?h(YVnxxANQ5W^0q z;(M+M7rri-y=}Ivf-L4?hOxIKow9XZ!$Bwj*TseL!#bIZXI~ZyB_g$Kw z`u&TkCH`3Y=EAtuf3~(_^{@&Xyn9V3E$dhK`>l9qHrH6M8k}6S!oyL11ICM8yVbB* zb|F5gJev*p{!&!G;AjDX2MKxa=PX{ZnFKp92Tw5F3>BzKyhL321&f7PVoU!c3?j5_ zEpFit{t{^qd2yuf0c7X#mCZ)^5QnJ$CEY$@`d2f)^=i)_sAD4p=AnKZ-xA+&V&iZ5 zE93DS?(XQXP@N1#d6P>8qU|yHG?HHBEzzVA|LNRO{fS%~3B~5d zb-d}4ERsKUVnIy#MWCd&!iX1zH{Hi88~qI}hR__i=H0*=%GC-R70V>~PS67#%#G7L z6$|0^wZxK2cur&a(B|?(SJqxd?Y;aIsgd7skqM|b1Y4b z0*p7JZkN-e6>63pysYW@e^S}G5~s|Eu0#p+f^7nZ1+~{gPGJ-uKP`*ApU;K)o*z6b z^!B1v#W2-BUk;10XIdXU9%{-CwQ3(G$Q(xbx~m&EA+Ym?EsFnmcR2VEES1!D!_RS_2<}{fiO+cX+uxv?gh)6^D?J)I zzM`l7wCX*jI{z`FR$IO7JIgTo1h$Q!q~(({K&#qZeQ*cG8@nsSfM@95!2hbvu^1rw z2+t&g51NAQr05pX35W2U)mlW3d86YBW}-64DC1fB5oBU-Jun9GFHf!~We-IAsT>WO zcD3{!wDh;VyT(2G5qX@QcDk5{cHx;1fys^iIk7vTVo^!SOFP@vmsuJ59jzK9mu62q zaOoY^Vz^@@4-;q@u*Yt0xbu%`QU&Z+=&VLO9pIKh{VAie9cqd9ooEP z5gyGYI6z4^oeBB7s*`&9UUW)yj(u3SWtFy7isU>kE90VR-zJC+b1saX#^`MNVeS!p z^oQIzVh^lrK7~;c_JlQpdK_eEq+5!&J9?A)YwR3Z5sSHJ>dY-aQnY7z(h6e%`|WAf zHsuA%_gNYGZi&^Rn#$tA-*nRskAn$QiypTldlT!_T9ro|!cQprbTw~Ww=zVQN3;MF z`=)mmr!vI@84wEc*t^EFC9M$pc^XLD%(xPII8>9T%yb~I>^3~~uZlA}<-3MvyJ=|p zdue`7-i*okmXy_UAFmtwZik|Xg?!V8A=-i_I4u+UecM20l|h(x&Y?S*kZSSjLTpdZ zp5DASSVmK!?<8ybe(V-D%9KIAcA`A!GayO}6WmeoVtsmxu^4v*rW_RdgypPkGiNf^ zioyavb0eV!+gOg@6nG_k?HG^W-#SeCkfCF-w1L3D6W-prc*!r}s!sgBZ1EJq)71x` zFDWbfmVc^Bl?R`eC4D(-^2a!wQf9kS;rX{jg@r!9+UZ96tS$-pUPdi^tYnI4k4tT# zq8&2P(ltOBTm1P{IPpLFtmclVq+^G~3qsGB8a(@tilzL#=4nu_=)CK~G(Bwkx8vO! z6hxJ`%BM^v9;4a8ILLJN<<(}qE}7?@cScb9xZ77clo_)vZxy6{mm)oA&%F-7+;9UF zQ#e$12?kaAyAWn6=*aIw@YnJ#eu^u_BZ%LtrvHp{0R)`Mo+oGezdYkvDwk)r#|{-s zdnJkv$1<>kO5NE_JXpDfPHuhrzip_5g^SmnB&Im$b!Eu#VXe~>ABX5Pyyu()gqs2S z&Y9Cd9J#b!;k*vTFHEyp6x>?Ucm^W{G$Rh}xIsPo&abbVoA49(_^`gcE7Mve&^?BD zBucFsQ^x9J+Wj{A)&d+f8A;_vkH5!WiYQWSqlGpDPbPf$>pgLk^~pv0-vRBHOZ1)c zL*pp+-U7{*0^cot9|I}qzBS^50#Gyh<0}GK@5nACxXG!T<4mZMP__N->BU+<13En&V0ng;7 zQ>>NNt$#UjYGt%^-j?@C*nar5cAb`|ISO<85sXrU&6?#pAboG>-H27S^@_b9wWMS> z;6z|Qd@=0%CZw9fdId8QGV9S6!uqG<3HXGh zv&`5TZ8zvOelm=@$Ac5h3x2u#X=AmRk*{Tl@OK~j_ADPMp|OAJaiS4)IDuhPTBg4H zZb3$g;N=2#>0;~;6d0f_woNEZ=c52EII&-)OnI~WuDo1xClpKN9rIhY5BOm$jGEU! z$F>VYg1LECJ>n1h&x`3?%79V-&uoDs)6j~A7884)R?$)D`AHG&;IksT38hsX~65Ybg?W%F(-m%V*7@NJ7U1PvAil=77@)VjV;=M%sla~ zL|HzNr4~=^+{>dFgoj7#$k?l9gYF(eykM;#4o-8C5a_qme<^jPfnw(92o( z6sq<7nD%ZvFT7E9S(PAUXYrAmpm9J)e`cxHQ_B0S^vfpvnh;4rc!67{n+db`@hqGe zf7L$kraw!gN2o?tQZyy}o@k2HH>+qFyQ)2r@cL+$0vwQZU490mvxXDbjKy61qq?;4 zlJNrBmwDAk?pF~`3+->*D1mR+Z7hUY$HrXzuCf-|2%rSaKP;Inm(8c{CN(Q+x5_`D z1u6^CvH%18v40lIlXGyn5T+x4M~(bkxk_V2vS`#$smlU?H}YNly97>IX*)i6cLiJywztgul_e}oZISMjTRyj(Y5?5>mE|p2oann2Eh;f zy%jZWGrb%0K-xk(^=-#nuH~R?ARzirq2$S*5}FSDy**TnQ^-Krt}!1HR*v5^>2G-R zQU<_an)Z8E06)z9#E}fOHncN6w7kne;?HC!w030}=Tx~KaLIm3hugFK)6F{FQkd1R zrPHsFyB#6$kodd8-sWSWI@~V$8k#8l+RSqy62(a1iE_CI2sT&+D2`Irk(IP$oZjaF zHw%3H>xwkk4#fh{w|SI@*O_+tKQdKE2L9o>Numk%u|Qz_?4Jt}h>Ltoj9%eK4Eg+m z=)xb2y+)$BQ#jE^eUyLwug?NAut6ip(?a>OQ$_WKkZiI>6=`%UgIjbVewkeU z0bt+vnj}T?C$z5afBb>N5c6C9MiFynif(67v(0w?0%EFL?7MsIx|FTYQf44{++x-P zq*$d|g^`3KMS@@c14NVRAZ&TT7%n(k7k(jRkg{rrtcH}54Nbn0m8Q2RiM~QP&lj&YE#vwf#YNt-La4E zthGe`54Np;I!&T-rycy#U^T+IEHMB(Knl541?!d4ecNXK54O7~!yTVDLx9QHXQt_D zW*g5AhAPOWMh_%x>1CV#54`7lWZIYKpC{$k%lMPBfa)5gRk}ZFs(VIUd*PXpFiH#82t=kq&WD zdbzMRC0QQ+5gSZ3GQPvC;pc@0(|JPyg^0z{YhALR6md!DbKg<^5gSd#gzH`)Ol}~U zUXbZ&;|Z8e?Z>GXp(cVK3W9$A5gSy1Mg|9mVw$I~BhiKjy04p-O#D$@5P{EOat#6g z5gS(<3#LrCHe7z2x*kC-Z`F1*rAyJ7V-#qf1{!Go5gTW9e4$BCN{T1wQ_WuG1XFzkxN87+Cv8cKWY^rAY$8R8ZRjd3n*`VwjS zTm%#THX=SFY{_>Mk{U=cyuck##9cdZWfTW8U=Hvx9xuDrxszvBZb46u9qjns7Q2`oQEr~GxW93gI1h%aTsR4XDr6&^WHHdnM z{>E@oC(`(39`!K(Wl6Bc;iyvTZp$FXhWnCL$MON8A9Lb0Mxd63-5$pnig(W-wyhmsX zf~0cs?fGud><|3@S9tO@W``I6*3cCCgcSWN=vGQF zIdO5DJt)-9wb+eme}qo|)RO3kwcYBUOAU%~l|6k{e>J08BQ?60Fg3TKAdX4@>!B!Y e#8CsHht3 Date: Mon, 18 May 2020 13:28:20 +0200 Subject: [PATCH 005/280] Fail test on warnings (#6043) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix (ci): hotfix Docker release * change (ci): fail test on warnings * change (config): stderr msgs * Fix the warnings properly Co-authored-by: Bastian Köcher --- .gitlab-ci.yml | 13 ++----------- .../api/test/tests/ui/declaring_old_block.rs | 2 -- .../api/test/tests/ui/declaring_old_block.stderr | 16 ++++------------ .../declaring_own_block_with_different_name.rs | 2 -- ...eclaring_own_block_with_different_name.stderr | 12 ++---------- .../tests/ui/impl_two_traits_with_same_name.rs | 2 -- .../ui/impl_two_traits_with_same_name.stderr | 12 ++---------- .../test/tests/ui/mock_only_one_block_type.rs | 2 -- .../tests/ui/mock_only_one_block_type.stderr | 16 ++++------------ .../api/test/tests/ui/mock_only_one_self_type.rs | 2 -- .../test/tests/ui/mock_only_one_self_type.stderr | 16 ++++------------ 11 files changed, 18 insertions(+), 77 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c06ace76c..12ae9bfc61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -193,22 +193,13 @@ test-linux-stable: &test-linux variables: # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. - RUSTFLAGS: -Cdebug-assertions=y + RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" except: variables: - $DEPLOY_TAG script: - - WASM_BUILD_NO_COLOR=1 time cargo test --all --release --verbose --locked |& - tee output.log + - WASM_BUILD_NO_COLOR=1 time cargo test --all --release --verbose --locked - sccache -s - - echo "____Test job successful, checking for warnings____" - - awk '/^warning:/,/^$/ { print }' output.log > ${CI_COMMIT_SHORT_SHA}_warnings.log - - if [ -s ${CI_COMMIT_SHORT_SHA}_warnings.log ]; then - cat ${CI_COMMIT_SHORT_SHA}_warnings.log; - exit 1; - else - echo "___No warnings___"; - fi test-dependency-rules: stage: test diff --git a/primitives/api/test/tests/ui/declaring_old_block.rs b/primitives/api/test/tests/ui/declaring_old_block.rs index ba98bf9bf6..fb74159028 100644 --- a/primitives/api/test/tests/ui/declaring_old_block.rs +++ b/primitives/api/test/tests/ui/declaring_old_block.rs @@ -1,5 +1,3 @@ -use sp_runtime::traits::Block as BlockT; - sp_api::decl_runtime_apis! { pub trait Api { fn test(); diff --git a/primitives/api/test/tests/ui/declaring_old_block.stderr b/primitives/api/test/tests/ui/declaring_old_block.stderr index 448dc38594..50dd37582c 100644 --- a/primitives/api/test/tests/ui/declaring_old_block.stderr +++ b/primitives/api/test/tests/ui/declaring_old_block.stderr @@ -1,19 +1,11 @@ error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro! If you try to use a different trait than the substrate `Block` trait, please rename it locally. - --> $DIR/declaring_old_block.rs:4:23 + --> $DIR/declaring_old_block.rs:2:23 | -4 | pub trait Api { +2 | pub trait Api { | ^^^^^^ error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro! - --> $DIR/declaring_old_block.rs:4:16 + --> $DIR/declaring_old_block.rs:2:16 | -4 | pub trait Api { +2 | pub trait Api { | ^^^^^ - -warning: unused import: `sp_runtime::traits::Block as BlockT` - --> $DIR/declaring_old_block.rs:1:5 - | -1 | use sp_runtime::traits::Block as BlockT; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/primitives/api/test/tests/ui/declaring_own_block_with_different_name.rs b/primitives/api/test/tests/ui/declaring_own_block_with_different_name.rs index 67bb9cab10..e3c7ae8a39 100644 --- a/primitives/api/test/tests/ui/declaring_own_block_with_different_name.rs +++ b/primitives/api/test/tests/ui/declaring_own_block_with_different_name.rs @@ -1,5 +1,3 @@ -use sp_runtime::traits::Block as BlockT; - sp_api::decl_runtime_apis! { pub trait Api { fn test(); diff --git a/primitives/api/test/tests/ui/declaring_own_block_with_different_name.stderr b/primitives/api/test/tests/ui/declaring_own_block_with_different_name.stderr index fe445b822d..778de3c9d1 100644 --- a/primitives/api/test/tests/ui/declaring_own_block_with_different_name.stderr +++ b/primitives/api/test/tests/ui/declaring_own_block_with_different_name.stderr @@ -1,13 +1,5 @@ error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro! If you try to use a different trait than the substrate `Block` trait, please rename it locally. - --> $DIR/declaring_own_block_with_different_name.rs:4:19 + --> $DIR/declaring_own_block_with_different_name.rs:2:19 | -4 | pub trait Api { +2 | pub trait Api { | ^^^^^^ - -warning: unused import: `sp_runtime::traits::Block as BlockT` - --> $DIR/declaring_own_block_with_different_name.rs:1:5 - | -1 | use sp_runtime::traits::Block as BlockT; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/primitives/api/test/tests/ui/impl_two_traits_with_same_name.rs b/primitives/api/test/tests/ui/impl_two_traits_with_same_name.rs index 2122a6991a..76555a825d 100644 --- a/primitives/api/test/tests/ui/impl_two_traits_with_same_name.rs +++ b/primitives/api/test/tests/ui/impl_two_traits_with_same_name.rs @@ -15,8 +15,6 @@ sp_api::decl_runtime_apis! { } mod second { - use super::*; - sp_api::decl_runtime_apis! { pub trait Api { fn test2(data: u64); diff --git a/primitives/api/test/tests/ui/impl_two_traits_with_same_name.stderr b/primitives/api/test/tests/ui/impl_two_traits_with_same_name.stderr index 24ee66f84b..17ee56d409 100644 --- a/primitives/api/test/tests/ui/impl_two_traits_with_same_name.stderr +++ b/primitives/api/test/tests/ui/impl_two_traits_with_same_name.stderr @@ -1,13 +1,5 @@ error: Two traits with the same name detected! The trait name is used to generate its ID. Please rename one trait at the declaration! - --> $DIR/impl_two_traits_with_same_name.rs:32:15 + --> $DIR/impl_two_traits_with_same_name.rs:30:15 | -32 | impl second::Api for Runtime { +30 | impl second::Api for Runtime { | ^^^ - -warning: unused import: `super::*` - --> $DIR/impl_two_traits_with_same_name.rs:18:6 - | -18 | use super::*; - | ^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/primitives/api/test/tests/ui/mock_only_one_block_type.rs b/primitives/api/test/tests/ui/mock_only_one_block_type.rs index 969b21d737..f49cafd23a 100644 --- a/primitives/api/test/tests/ui/mock_only_one_block_type.rs +++ b/primitives/api/test/tests/ui/mock_only_one_block_type.rs @@ -1,5 +1,3 @@ -use substrate_test_runtime_client::runtime::Block; - struct Block2; sp_api::decl_runtime_apis! { diff --git a/primitives/api/test/tests/ui/mock_only_one_block_type.stderr b/primitives/api/test/tests/ui/mock_only_one_block_type.stderr index 1abc8db726..1831d0485b 100644 --- a/primitives/api/test/tests/ui/mock_only_one_block_type.stderr +++ b/primitives/api/test/tests/ui/mock_only_one_block_type.stderr @@ -1,19 +1,11 @@ error: Block type should be the same between all runtime apis. - --> $DIR/mock_only_one_block_type.rs:22:12 + --> $DIR/mock_only_one_block_type.rs:20:12 | -22 | impl Api2 for MockApi { +20 | impl Api2 for MockApi { | ^^^^^^ error: First block type found here - --> $DIR/mock_only_one_block_type.rs:18:11 + --> $DIR/mock_only_one_block_type.rs:16:11 | -18 | impl Api for MockApi { +16 | impl Api for MockApi { | ^^^^^ - -warning: unused import: `substrate_test_runtime_client::runtime::Block` - --> $DIR/mock_only_one_block_type.rs:1:5 - | -1 | use substrate_test_runtime_client::runtime::Block; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/primitives/api/test/tests/ui/mock_only_one_self_type.rs b/primitives/api/test/tests/ui/mock_only_one_self_type.rs index 4b29ec2a6a..617031b4d5 100644 --- a/primitives/api/test/tests/ui/mock_only_one_self_type.rs +++ b/primitives/api/test/tests/ui/mock_only_one_self_type.rs @@ -1,5 +1,3 @@ -use substrate_test_runtime_client::runtime::Block; - sp_api::decl_runtime_apis! { pub trait Api { fn test(data: u64); diff --git a/primitives/api/test/tests/ui/mock_only_one_self_type.stderr b/primitives/api/test/tests/ui/mock_only_one_self_type.stderr index 996d1d44c0..5f1e29b281 100644 --- a/primitives/api/test/tests/ui/mock_only_one_self_type.stderr +++ b/primitives/api/test/tests/ui/mock_only_one_self_type.stderr @@ -1,19 +1,11 @@ error: Self type should not change between runtime apis - --> $DIR/mock_only_one_self_type.rs:21:23 + --> $DIR/mock_only_one_self_type.rs:19:23 | -21 | impl Api2 for MockApi2 { +19 | impl Api2 for MockApi2 { | ^^^^^^^^ error: First self type found here - --> $DIR/mock_only_one_self_type.rs:17:22 + --> $DIR/mock_only_one_self_type.rs:15:22 | -17 | impl Api for MockApi { +15 | impl Api for MockApi { | ^^^^^^^ - -warning: unused import: `substrate_test_runtime_client::runtime::Block` - --> $DIR/mock_only_one_self_type.rs:1:5 - | -1 | use substrate_test_runtime_client::runtime::Block; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default -- GitLab From f9fe88f947820031efcaf3244527c53fcee52e3d Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 18 May 2020 14:51:28 +0300 Subject: [PATCH 006/280] fix whitespace (#6062) --- bin/node/bench/src/core.rs | 2 +- bin/node/bench/src/generator.rs | 2 +- bin/node/bench/src/import.rs | 2 +- bin/node/bench/src/main.rs | 2 +- bin/node/bench/src/simple_trie.rs | 2 +- bin/node/bench/src/tempdb.rs | 2 +- bin/node/bench/src/trie.rs | 2 +- bin/node/cli/bin/main.rs | 2 +- bin/node/cli/build.rs | 2 +- bin/node/cli/src/browser.rs | 2 +- bin/node/cli/src/chain_spec.rs | 2 +- bin/node/cli/src/cli.rs | 2 +- bin/node/cli/src/command.rs | 2 +- bin/node/cli/src/lib.rs | 2 +- bin/node/cli/src/service.rs | 2 +- bin/node/cli/tests/build_spec_works.rs | 2 +- bin/node/cli/tests/check_block_works.rs | 2 +- bin/node/cli/tests/common.rs | 2 +- bin/node/cli/tests/import_export_and_revert_work.rs | 2 +- bin/node/cli/tests/inspect_works.rs | 2 +- bin/node/cli/tests/purge_chain_works.rs | 2 +- bin/node/cli/tests/running_the_node_and_interrupt.rs | 2 +- bin/node/cli/tests/version.rs | 2 +- bin/node/inspect/src/cli.rs | 2 +- bin/node/inspect/src/command.rs | 2 +- bin/node/inspect/src/lib.rs | 10 +++++----- bin/node/runtime/src/lib.rs | 2 +- bin/node/testing/src/bench.rs | 2 +- bin/node/testing/src/client.rs | 2 +- bin/node/testing/src/genesis.rs | 2 +- bin/node/testing/src/keyring.rs | 2 +- bin/node/testing/src/lib.rs | 2 +- bin/utils/chain-spec-builder/build.rs | 2 +- bin/utils/chain-spec-builder/src/main.rs | 2 +- bin/utils/subkey/src/main.rs | 4 ++-- bin/utils/subkey/src/rpc.rs | 2 +- bin/utils/subkey/src/vanity.rs | 2 +- client/api/src/backend.rs | 2 +- client/api/src/call_executor.rs | 2 +- client/api/src/cht.rs | 2 +- client/api/src/in_mem.rs | 2 +- client/api/src/leaves.rs | 2 +- client/api/src/notifications.rs | 2 +- client/api/src/proof_provider.rs | 2 +- client/authority-discovery/src/tests.rs | 2 +- client/basic-authorship/src/basic_authorship.rs | 2 +- client/basic-authorship/src/lib.rs | 2 +- client/block-builder/src/lib.rs | 2 +- client/chain-spec/src/chain_spec.rs | 2 +- client/cli/src/arg_enums.rs | 2 +- client/cli/src/commands/build_spec_cmd.rs | 2 +- client/cli/src/commands/check_block_cmd.rs | 2 +- client/cli/src/commands/export_blocks_cmd.rs | 2 +- client/cli/src/commands/export_state_cmd.rs | 2 +- client/cli/src/commands/import_blocks_cmd.rs | 2 +- client/cli/src/commands/mod.rs | 2 +- client/cli/src/commands/purge_chain_cmd.rs | 2 +- client/cli/src/commands/revert_cmd.rs | 2 +- client/cli/src/commands/run_cmd.rs | 2 +- client/cli/src/config.rs | 2 +- client/cli/src/error.rs | 2 +- client/cli/src/lib.rs | 2 +- client/cli/src/params/database_params.rs | 2 +- client/cli/src/params/import_params.rs | 2 +- client/cli/src/params/keystore_params.rs | 2 +- client/cli/src/params/mod.rs | 2 +- client/cli/src/params/network_params.rs | 2 +- client/cli/src/params/node_key_params.rs | 2 +- client/cli/src/params/offchain_worker_params.rs | 2 +- client/cli/src/params/pruning_params.rs | 2 +- client/cli/src/params/shared_params.rs | 2 +- client/cli/src/params/transaction_pool_params.rs | 2 +- client/cli/src/runner.rs | 2 +- client/consensus/aura/src/digests.rs | 2 +- client/consensus/aura/src/lib.rs | 2 +- client/consensus/babe/rpc/src/lib.rs | 2 +- client/consensus/manual-seal/src/error.rs | 2 +- client/consensus/manual-seal/src/lib.rs | 2 +- client/consensus/pow/src/lib.rs | 2 +- client/db/src/bench.rs | 2 +- client/db/src/cache/list_cache.rs | 4 ++-- client/db/src/cache/list_entry.rs | 2 +- client/db/src/cache/list_storage.rs | 2 +- client/db/src/cache/mod.rs | 2 +- client/db/src/lib.rs | 2 +- client/db/src/light.rs | 2 +- client/db/src/offchain.rs | 2 +- client/db/src/parity_db.rs | 2 +- client/db/src/stats.rs | 2 +- client/db/src/subdb.rs | 2 +- client/db/src/utils.rs | 2 +- client/executor/common/src/error.rs | 2 +- client/executor/common/src/sandbox.rs | 2 +- client/executor/common/src/util.rs | 2 +- client/executor/src/integration_tests/mod.rs | 2 +- client/executor/src/integration_tests/sandbox.rs | 2 +- client/executor/src/lib.rs | 2 +- client/executor/src/native_executor.rs | 2 +- client/executor/wasmtime/src/imports.rs | 2 +- client/executor/wasmtime/src/instance_wrapper.rs | 2 +- .../wasmtime/src/instance_wrapper/globals_snapshot.rs | 2 +- client/executor/wasmtime/src/state_holder.rs | 2 +- client/finality-grandpa/rpc/src/error.rs | 2 +- client/finality-grandpa/rpc/src/lib.rs | 2 +- client/finality-grandpa/rpc/src/report.rs | 2 +- client/finality-grandpa/src/authorities.rs | 2 +- client/finality-grandpa/src/communication/mod.rs | 2 +- client/finality-grandpa/src/environment.rs | 2 +- client/finality-grandpa/src/finality_proof.rs | 2 +- client/finality-grandpa/src/import.rs | 2 +- client/finality-grandpa/src/justification.rs | 2 +- client/finality-grandpa/src/lib.rs | 2 +- client/finality-grandpa/src/observer.rs | 2 +- client/finality-grandpa/src/tests.rs | 2 +- client/finality-grandpa/src/until_imported.rs | 2 +- client/finality-grandpa/src/voting_rule.rs | 2 +- client/informant/src/lib.rs | 2 +- client/network-gossip/src/state_machine.rs | 2 +- client/network-gossip/src/validator.rs | 2 +- client/network/src/chain.rs | 2 +- client/network/src/config.rs | 2 +- client/network/src/error.rs | 2 +- client/network/src/lib.rs | 2 +- client/network/src/network_state.rs | 2 +- client/network/src/on_demand_layer.rs | 2 +- client/network/src/protocol.rs | 2 +- client/network/src/protocol/generic_proto/handler.rs | 2 +- .../src/protocol/generic_proto/handler/notif_in.rs | 2 +- client/network/src/protocol/generic_proto/upgrade.rs | 2 +- .../src/protocol/generic_proto/upgrade/legacy.rs | 2 +- client/network/src/protocol/message.rs | 2 +- client/network/src/protocol/sync/blocks.rs | 2 +- client/network/src/protocol/sync/extra_requests.rs | 2 +- client/network/src/schema.rs | 2 +- client/network/src/service.rs | 2 +- client/network/src/service/out_events.rs | 2 +- client/network/src/service/tests.rs | 2 +- client/network/src/transport.rs | 2 +- client/network/test/src/block_import.rs | 2 +- client/network/test/src/lib.rs | 2 +- client/network/test/src/sync.rs | 2 +- client/peerset/src/lib.rs | 2 +- client/peerset/tests/fuzz.rs | 2 +- client/rpc-api/src/author/error.rs | 2 +- client/rpc-api/src/author/mod.rs | 2 +- client/rpc-api/src/chain/error.rs | 2 +- client/rpc-api/src/chain/mod.rs | 2 +- client/rpc-api/src/child_state/mod.rs | 2 +- client/rpc-api/src/errors.rs | 2 +- client/rpc-api/src/helpers.rs | 2 +- client/rpc-api/src/offchain/error.rs | 2 +- client/rpc-api/src/offchain/mod.rs | 2 +- client/rpc-api/src/policy.rs | 2 +- client/rpc-api/src/state/error.rs | 2 +- client/rpc-api/src/state/helpers.rs | 2 +- client/rpc-api/src/state/mod.rs | 2 +- client/rpc-api/src/subscriptions.rs | 2 +- client/rpc-api/src/system/error.rs | 2 +- client/rpc-api/src/system/helpers.rs | 2 +- client/rpc-api/src/system/mod.rs | 2 +- client/rpc-servers/src/lib.rs | 2 +- client/rpc/src/author/mod.rs | 2 +- client/rpc/src/author/tests.rs | 2 +- client/rpc/src/chain/mod.rs | 2 +- client/rpc/src/chain/tests.rs | 2 +- client/rpc/src/lib.rs | 2 +- client/rpc/src/metadata.rs | 2 +- client/rpc/src/offchain/mod.rs | 2 +- client/rpc/src/offchain/tests.rs | 2 +- client/rpc/src/state/mod.rs | 2 +- client/rpc/src/state/tests.rs | 2 +- client/rpc/src/system/mod.rs | 2 +- client/rpc/src/system/tests.rs | 2 +- client/rpc/src/testing.rs | 2 +- client/service/src/builder.rs | 2 +- client/service/src/chain_ops.rs | 2 +- client/service/src/client/block_rules.rs | 2 +- client/service/src/client/call_executor.rs | 2 +- client/service/src/client/client.rs | 2 +- client/service/src/client/genesis.rs | 2 +- client/service/src/client/light/backend.rs | 2 +- client/service/src/client/light/blockchain.rs | 2 +- client/service/src/client/light/call_executor.rs | 2 +- client/service/src/client/light/fetcher.rs | 2 +- client/service/src/client/light/mod.rs | 2 +- client/service/src/client/mod.rs | 2 +- client/service/src/config.rs | 2 +- client/service/src/error.rs | 2 +- client/service/src/lib.rs | 2 +- client/service/src/metrics.rs | 2 +- client/service/test/src/client/db.rs | 2 +- client/service/test/src/client/light.rs | 2 +- client/service/test/src/client/mod.rs | 2 +- client/service/test/src/lib.rs | 2 +- client/state-db/src/lib.rs | 2 +- client/state-db/src/noncanonical.rs | 2 +- client/state-db/src/pruning.rs | 2 +- client/state-db/src/test.rs | 2 +- client/telemetry/src/lib.rs | 2 +- client/telemetry/src/worker.rs | 2 +- client/telemetry/src/worker/node.rs | 2 +- client/transaction-pool/graph/benches/basics.rs | 2 +- client/transaction-pool/graph/src/base_pool.rs | 2 +- client/transaction-pool/graph/src/error.rs | 2 +- client/transaction-pool/graph/src/future.rs | 2 +- client/transaction-pool/graph/src/lib.rs | 2 +- client/transaction-pool/graph/src/listener.rs | 2 +- client/transaction-pool/graph/src/pool.rs | 2 +- client/transaction-pool/graph/src/ready.rs | 2 +- client/transaction-pool/graph/src/rotator.rs | 2 +- client/transaction-pool/graph/src/validated_pool.rs | 2 +- client/transaction-pool/graph/src/watcher.rs | 2 +- client/transaction-pool/src/api.rs | 2 +- client/transaction-pool/src/error.rs | 2 +- client/transaction-pool/src/lib.rs | 2 +- client/transaction-pool/src/metrics.rs | 2 +- client/transaction-pool/src/revalidation.rs | 2 +- client/transaction-pool/src/testing/mod.rs | 2 +- client/transaction-pool/src/testing/pool.rs | 2 +- 219 files changed, 225 insertions(+), 225 deletions(-) diff --git a/bin/node/bench/src/core.rs b/bin/node/bench/src/core.rs index ca297b1a90..a3c25f9ce3 100644 --- a/bin/node/bench/src/core.rs +++ b/bin/node/bench/src/core.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/generator.rs b/bin/node/bench/src/generator.rs index a42dbd748f..759a4299c7 100644 --- a/bin/node/bench/src/generator.rs +++ b/bin/node/bench/src/generator.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs index d98b54ce70..5cbb851867 100644 --- a/bin/node/bench/src/import.rs +++ b/bin/node/bench/src/import.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/main.rs b/bin/node/bench/src/main.rs index fbf203d29e..419aacb6a5 100644 --- a/bin/node/bench/src/main.rs +++ b/bin/node/bench/src/main.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/simple_trie.rs b/bin/node/bench/src/simple_trie.rs index 01ad1bb9b4..3cfd7ddb30 100644 --- a/bin/node/bench/src/simple_trie.rs +++ b/bin/node/bench/src/simple_trie.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/tempdb.rs b/bin/node/bench/src/tempdb.rs index 19f9b9099c..770bafec6f 100644 --- a/bin/node/bench/src/tempdb.rs +++ b/bin/node/bench/src/tempdb.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/bench/src/trie.rs b/bin/node/bench/src/trie.rs index ada18c1016..886dc60114 100644 --- a/bin/node/bench/src/trie.rs +++ b/bin/node/bench/src/trie.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/bin/main.rs b/bin/node/cli/bin/main.rs index 1d0fa639c0..299b760c82 100644 --- a/bin/node/cli/bin/main.rs +++ b/bin/node/cli/bin/main.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/build.rs b/bin/node/cli/build.rs index 1c47dadc8d..a36f0d01a0 100644 --- a/bin/node/cli/build.rs +++ b/bin/node/cli/build.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/browser.rs b/bin/node/cli/src/browser.rs index df74ef3f75..8d74e3cbf3 100644 --- a/bin/node/cli/src/browser.rs +++ b/bin/node/cli/src/browser.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs index 6688c08b8a..c1eadc2f93 100644 --- a/bin/node/cli/src/chain_spec.rs +++ b/bin/node/cli/src/chain_spec.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/cli.rs b/bin/node/cli/src/cli.rs index a653279064..0156faf47e 100644 --- a/bin/node/cli/src/cli.rs +++ b/bin/node/cli/src/cli.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/command.rs b/bin/node/cli/src/command.rs index 3034c81bac..bd5483f2cd 100644 --- a/bin/node/cli/src/command.rs +++ b/bin/node/cli/src/command.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/lib.rs b/bin/node/cli/src/lib.rs index 8edfb5e3fb..bd2298514a 100644 --- a/bin/node/cli/src/lib.rs +++ b/bin/node/cli/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index ee6d11de57..f39d96e1d6 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/build_spec_works.rs b/bin/node/cli/tests/build_spec_works.rs index a6fa2ad4e2..800a4a8c51 100644 --- a/bin/node/cli/tests/build_spec_works.rs +++ b/bin/node/cli/tests/build_spec_works.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs index 209b1122aa..0b340dad64 100644 --- a/bin/node/cli/tests/check_block_works.rs +++ b/bin/node/cli/tests/check_block_works.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index a9df32d792..51f88cd92b 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/import_export_and_revert_work.rs b/bin/node/cli/tests/import_export_and_revert_work.rs index 2655645617..91c8b024e1 100644 --- a/bin/node/cli/tests/import_export_and_revert_work.rs +++ b/bin/node/cli/tests/import_export_and_revert_work.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs index 6787244876..59bdaf7de3 100644 --- a/bin/node/cli/tests/inspect_works.rs +++ b/bin/node/cli/tests/inspect_works.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs index b57084092d..8d637be3e8 100644 --- a/bin/node/cli/tests/purge_chain_works.rs +++ b/bin/node/cli/tests/purge_chain_works.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index fb241e177e..a8c4be4695 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/cli/tests/version.rs b/bin/node/cli/tests/version.rs index 8d8b3a5ce0..c5240257f1 100644 --- a/bin/node/cli/tests/version.rs +++ b/bin/node/cli/tests/version.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/inspect/src/cli.rs b/bin/node/inspect/src/cli.rs index 3a71407ab0..4475d31755 100644 --- a/bin/node/inspect/src/cli.rs +++ b/bin/node/inspect/src/cli.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/inspect/src/command.rs b/bin/node/inspect/src/command.rs index c409aee86e..fae6c10c7f 100644 --- a/bin/node/inspect/src/command.rs +++ b/bin/node/inspect/src/command.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/inspect/src/lib.rs b/bin/node/inspect/src/lib.rs index 5123fc5959..02f5614b81 100644 --- a/bin/node/inspect/src/lib.rs +++ b/bin/node/inspect/src/lib.rs @@ -1,18 +1,18 @@ // This file is part of Substrate. -// +// // Copyright (C) 2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 -// +// // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program 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 this program. If not, see . diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 12c105e940..a7974d9d71 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs index 888ec71cda..6c687d2f2a 100644 --- a/bin/node/testing/src/bench.rs +++ b/bin/node/testing/src/bench.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/testing/src/client.rs b/bin/node/testing/src/client.rs index 5d2795a6f6..f44747b26b 100644 --- a/bin/node/testing/src/client.rs +++ b/bin/node/testing/src/client.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs index f99b559a25..d9c7e24709 100644 --- a/bin/node/testing/src/genesis.rs +++ b/bin/node/testing/src/genesis.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/testing/src/keyring.rs b/bin/node/testing/src/keyring.rs index 99a44e065d..efa47a5982 100644 --- a/bin/node/testing/src/keyring.rs +++ b/bin/node/testing/src/keyring.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/node/testing/src/lib.rs b/bin/node/testing/src/lib.rs index 07859f5fed..d682347e40 100644 --- a/bin/node/testing/src/lib.rs +++ b/bin/node/testing/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/utils/chain-spec-builder/build.rs b/bin/utils/chain-spec-builder/build.rs index cf8afddb54..8d5aac1a08 100644 --- a/bin/utils/chain-spec-builder/build.rs +++ b/bin/utils/chain-spec-builder/build.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/utils/chain-spec-builder/src/main.rs b/bin/utils/chain-spec-builder/src/main.rs index 1561b3a6b0..4fbcc1e850 100644 --- a/bin/utils/chain-spec-builder/src/main.rs +++ b/bin/utils/chain-spec-builder/src/main.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/utils/subkey/src/main.rs b/bin/utils/subkey/src/main.rs index da4f59430f..898e99f062 100644 --- a/bin/utils/subkey/src/main.rs +++ b/bin/utils/subkey/src/main.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, @@ -525,7 +525,7 @@ where let account_id: AccountId = ModuleId(id_fixed_array).into_account(); let v = maybe_network.unwrap_or(Ss58AddressFormat::SubstrateAccount); - + C::print_from_uri(&account_id.to_ss58check_with_version(v), password, maybe_network, output); } _ => print_usage(&matches), diff --git a/bin/utils/subkey/src/rpc.rs b/bin/utils/subkey/src/rpc.rs index c6c63be4d1..e24cf50dc4 100644 --- a/bin/utils/subkey/src/rpc.rs +++ b/bin/utils/subkey/src/rpc.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/bin/utils/subkey/src/vanity.rs b/bin/utils/subkey/src/vanity.rs index 83a71659d8..d09aeeef25 100644 --- a/bin/utils/subkey/src/vanity.rs +++ b/bin/utils/subkey/src/vanity.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/backend.rs b/client/api/src/backend.rs index fd9577695a..6a7114fcc8 100644 --- a/client/api/src/backend.rs +++ b/client/api/src/backend.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/call_executor.rs b/client/api/src/call_executor.rs index 8c69eb8caa..e5b670579a 100644 --- a/client/api/src/call_executor.rs +++ b/client/api/src/call_executor.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/cht.rs b/client/api/src/cht.rs index 55a38a5149..ef282868c9 100644 --- a/client/api/src/cht.rs +++ b/client/api/src/cht.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs index 07df822488..cb1724e468 100644 --- a/client/api/src/in_mem.rs +++ b/client/api/src/in_mem.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/leaves.rs b/client/api/src/leaves.rs index e89aeed8d1..c93446b94d 100644 --- a/client/api/src/leaves.rs +++ b/client/api/src/leaves.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/notifications.rs b/client/api/src/notifications.rs index 72071eb20c..c89e8b6dfd 100644 --- a/client/api/src/notifications.rs +++ b/client/api/src/notifications.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/api/src/proof_provider.rs b/client/api/src/proof_provider.rs index 66039b9601..5749ae0576 100644 --- a/client/api/src/proof_provider.rs +++ b/client/api/src/proof_provider.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/authority-discovery/src/tests.rs b/client/authority-discovery/src/tests.rs index 09c0319d29..106c68b2d0 100644 --- a/client/authority-discovery/src/tests.rs +++ b/client/authority-discovery/src/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index 2deecc72b9..0c1346b368 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs index bebce17059..7f88844d90 100644 --- a/client/basic-authorship/src/lib.rs +++ b/client/basic-authorship/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/block-builder/src/lib.rs b/client/block-builder/src/lib.rs index 730fe0258e..f630d42a9b 100644 --- a/client/block-builder/src/lib.rs +++ b/client/block-builder/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs index 333aa6fb5c..a6bf6212e1 100644 --- a/client/chain-spec/src/chain_spec.rs +++ b/client/chain-spec/src/chain_spec.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/arg_enums.rs b/client/cli/src/arg_enums.rs index 3269a702fd..4dfd384d95 100644 --- a/client/cli/src/arg_enums.rs +++ b/client/cli/src/arg_enums.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs index ca927adacd..e5e7123b4b 100644 --- a/client/cli/src/commands/build_spec_cmd.rs +++ b/client/cli/src/commands/build_spec_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/check_block_cmd.rs b/client/cli/src/commands/check_block_cmd.rs index 7d5110a29c..35f26af667 100644 --- a/client/cli/src/commands/check_block_cmd.rs +++ b/client/cli/src/commands/check_block_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs index b23f16d884..431add4128 100644 --- a/client/cli/src/commands/export_blocks_cmd.rs +++ b/client/cli/src/commands/export_blocks_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/export_state_cmd.rs b/client/cli/src/commands/export_state_cmd.rs index 45b943ba3e..ee022e1afd 100644 --- a/client/cli/src/commands/export_state_cmd.rs +++ b/client/cli/src/commands/export_state_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs index 4690eb23f0..029e447562 100644 --- a/client/cli/src/commands/import_blocks_cmd.rs +++ b/client/cli/src/commands/import_blocks_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs index c1fd9e0328..62757890ef 100644 --- a/client/cli/src/commands/mod.rs +++ b/client/cli/src/commands/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/purge_chain_cmd.rs b/client/cli/src/commands/purge_chain_cmd.rs index 9b77906e38..6b540a66a2 100644 --- a/client/cli/src/commands/purge_chain_cmd.rs +++ b/client/cli/src/commands/purge_chain_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/revert_cmd.rs b/client/cli/src/commands/revert_cmd.rs index 03b16578b3..ea6ba5ecf7 100644 --- a/client/cli/src/commands/revert_cmd.rs +++ b/client/cli/src/commands/revert_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index ea8bd640a5..c34a31e59b 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index d309c1e34a..fb0101ec88 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/error.rs b/client/cli/src/error.rs index 8839ff79c4..fa336974d6 100644 --- a/client/cli/src/error.rs +++ b/client/cli/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index a9195ab383..271572b43d 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/database_params.rs b/client/cli/src/params/database_params.rs index 76e38e424d..62b0436788 100644 --- a/client/cli/src/params/database_params.rs +++ b/client/cli/src/params/database_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs index 5602f098d8..e1c86aec9b 100644 --- a/client/cli/src/params/import_params.rs +++ b/client/cli/src/params/import_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs index aa9ddeef49..4dbd793456 100644 --- a/client/cli/src/params/keystore_params.rs +++ b/client/cli/src/params/keystore_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/mod.rs b/client/cli/src/params/mod.rs index 152fe4c93c..3a66e5f055 100644 --- a/client/cli/src/params/mod.rs +++ b/client/cli/src/params/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index 6f5aea15d3..cd64783ec9 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/node_key_params.rs b/client/cli/src/params/node_key_params.rs index 34d5d618fb..ede9fd02e1 100644 --- a/client/cli/src/params/node_key_params.rs +++ b/client/cli/src/params/node_key_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/offchain_worker_params.rs b/client/cli/src/params/offchain_worker_params.rs index 87f6e23752..ca99ab506e 100644 --- a/client/cli/src/params/offchain_worker_params.rs +++ b/client/cli/src/params/offchain_worker_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index aa86d939e6..d96a44986d 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index d29bd104ad..94fb3ceea6 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/params/transaction_pool_params.rs b/client/cli/src/params/transaction_pool_params.rs index d5205b5c9f..00f5f0dbd6 100644 --- a/client/cli/src/params/transaction_pool_params.rs +++ b/client/cli/src/params/transaction_pool_params.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 042e21e441..1600aed7d6 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/aura/src/digests.rs b/client/consensus/aura/src/digests.rs index b415560e76..8ddcb2bee4 100644 --- a/client/consensus/aura/src/digests.rs +++ b/client/consensus/aura/src/digests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index ae88c1707b..06aa7db400 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 395fa8dc4f..0c8a16e4da 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/manual-seal/src/error.rs b/client/consensus/manual-seal/src/error.rs index 343e50b291..36499893c3 100644 --- a/client/consensus/manual-seal/src/error.rs +++ b/client/consensus/manual-seal/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index 6354e43ed3..754203f7ba 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/consensus/pow/src/lib.rs b/client/consensus/pow/src/lib.rs index 846377b7bc..b0d1e04348 100644 --- a/client/consensus/pow/src/lib.rs +++ b/client/consensus/pow/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/bench.rs b/client/db/src/bench.rs index 2d815bdeba..3b31a37b14 100644 --- a/client/db/src/bench.rs +++ b/client/db/src/bench.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/cache/list_cache.rs b/client/db/src/cache/list_cache.rs index c1d71cfb5d..a2af053e87 100644 --- a/client/db/src/cache/list_cache.rs +++ b/client/db/src/cache/list_cache.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, @@ -1765,7 +1765,7 @@ pub mod tests { Some(Entry { valid_from: test_id(20), value: 20 }), vec![5, 6].into_iter().collect(), ))); - + assert_eq!( ops.operations, vec![CommitOperation::BlockFinalized( diff --git a/client/db/src/cache/list_entry.rs b/client/db/src/cache/list_entry.rs index 744cb226c8..39dee59d55 100644 --- a/client/db/src/cache/list_entry.rs +++ b/client/db/src/cache/list_entry.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/cache/list_storage.rs b/client/db/src/cache/list_storage.rs index 21917e6eb9..1fa26552e9 100644 --- a/client/db/src/cache/list_storage.rs +++ b/client/db/src/cache/list_storage.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/cache/mod.rs b/client/db/src/cache/mod.rs index a6cb93c6ce..03cda1b589 100644 --- a/client/db/src/cache/mod.rs +++ b/client/db/src/cache/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index cbc637cf84..75d36dde5c 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/light.rs b/client/db/src/light.rs index 56c06ff406..8607823462 100644 --- a/client/db/src/light.rs +++ b/client/db/src/light.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/offchain.rs b/client/db/src/offchain.rs index 8cd94a1594..a7cc1345d1 100644 --- a/client/db/src/offchain.rs +++ b/client/db/src/offchain.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/parity_db.rs b/client/db/src/parity_db.rs index 1c8280e730..ea25aaa9f8 100644 --- a/client/db/src/parity_db.rs +++ b/client/db/src/parity_db.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/stats.rs b/client/db/src/stats.rs index cb9c64c850..7a265ddf82 100644 --- a/client/db/src/stats.rs +++ b/client/db/src/stats.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/subdb.rs b/client/db/src/subdb.rs index 683c33dedd..2f72632b04 100644 --- a/client/db/src/subdb.rs +++ b/client/db/src/subdb.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/db/src/utils.rs b/client/db/src/utils.rs index 64734ff7d2..c05a411258 100644 --- a/client/db/src/utils.rs +++ b/client/db/src/utils.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/common/src/error.rs b/client/executor/common/src/error.rs index e2f482f233..8fc0c4392c 100644 --- a/client/executor/common/src/error.rs +++ b/client/executor/common/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/common/src/sandbox.rs b/client/executor/common/src/sandbox.rs index 3500bf8575..d897ef583c 100644 --- a/client/executor/common/src/sandbox.rs +++ b/client/executor/common/src/sandbox.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/common/src/util.rs b/client/executor/common/src/util.rs index 4734e8d6fd..ebd14a5a6e 100644 --- a/client/executor/common/src/util.rs +++ b/client/executor/common/src/util.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 7ec0d22c6d..07add57bb3 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/src/integration_tests/sandbox.rs b/client/executor/src/integration_tests/sandbox.rs index 35ece0a701..8fe7678955 100644 --- a/client/executor/src/integration_tests/sandbox.rs +++ b/client/executor/src/integration_tests/sandbox.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/src/lib.rs b/client/executor/src/lib.rs index 2630282b80..a8b86da714 100644 --- a/client/executor/src/lib.rs +++ b/client/executor/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/src/native_executor.rs b/client/executor/src/native_executor.rs index 61014bab3c..95f5dff8c6 100644 --- a/client/executor/src/native_executor.rs +++ b/client/executor/src/native_executor.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/wasmtime/src/imports.rs b/client/executor/wasmtime/src/imports.rs index 1fc570c200..b427606c3c 100644 --- a/client/executor/wasmtime/src/imports.rs +++ b/client/executor/wasmtime/src/imports.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/wasmtime/src/instance_wrapper.rs b/client/executor/wasmtime/src/instance_wrapper.rs index 006eb5eb20..8b0b5cf382 100644 --- a/client/executor/wasmtime/src/instance_wrapper.rs +++ b/client/executor/wasmtime/src/instance_wrapper.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs index 8dceca70a6..db2cc28e68 100644 --- a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs +++ b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/executor/wasmtime/src/state_holder.rs b/client/executor/wasmtime/src/state_holder.rs index e44bfad122..ac5b64c774 100644 --- a/client/executor/wasmtime/src/state_holder.rs +++ b/client/executor/wasmtime/src/state_holder.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/rpc/src/error.rs b/client/finality-grandpa/rpc/src/error.rs index eab319d3a7..73c36f23f5 100644 --- a/client/finality-grandpa/rpc/src/error.rs +++ b/client/finality-grandpa/rpc/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/rpc/src/lib.rs b/client/finality-grandpa/rpc/src/lib.rs index c146aaf10c..6d8e10622b 100644 --- a/client/finality-grandpa/rpc/src/lib.rs +++ b/client/finality-grandpa/rpc/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/rpc/src/report.rs b/client/finality-grandpa/rpc/src/report.rs index d8667f5609..19b89c5083 100644 --- a/client/finality-grandpa/rpc/src/report.rs +++ b/client/finality-grandpa/rpc/src/report.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/authorities.rs b/client/finality-grandpa/src/authorities.rs index a897ac0209..2105d9ed38 100644 --- a/client/finality-grandpa/src/authorities.rs +++ b/client/finality-grandpa/src/authorities.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/communication/mod.rs b/client/finality-grandpa/src/communication/mod.rs index 1bef06572b..533acb8de6 100644 --- a/client/finality-grandpa/src/communication/mod.rs +++ b/client/finality-grandpa/src/communication/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs index b8996df9d4..85816b110b 100644 --- a/client/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/finality_proof.rs b/client/finality-grandpa/src/finality_proof.rs index d50418128b..82a5220d87 100644 --- a/client/finality-grandpa/src/finality_proof.rs +++ b/client/finality-grandpa/src/finality_proof.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/import.rs b/client/finality-grandpa/src/import.rs index 7118492492..3f3bcc0d8c 100644 --- a/client/finality-grandpa/src/import.rs +++ b/client/finality-grandpa/src/import.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/justification.rs b/client/finality-grandpa/src/justification.rs index 595435e4e3..7f86f7e443 100644 --- a/client/finality-grandpa/src/justification.rs +++ b/client/finality-grandpa/src/justification.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index 3cd5c5791e..ab73abc3de 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index cab2b894ec..ee203a225d 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index dd746edb42..dbc54a0d64 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/until_imported.rs b/client/finality-grandpa/src/until_imported.rs index ab182004a9..6be1a1b1be 100644 --- a/client/finality-grandpa/src/until_imported.rs +++ b/client/finality-grandpa/src/until_imported.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/finality-grandpa/src/voting_rule.rs b/client/finality-grandpa/src/voting_rule.rs index 9e234328a3..d0c47037ab 100644 --- a/client/finality-grandpa/src/voting_rule.rs +++ b/client/finality-grandpa/src/voting_rule.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 3f4724824d..891e9c0211 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network-gossip/src/state_machine.rs b/client/network-gossip/src/state_machine.rs index 693e14f813..0d8ad50970 100644 --- a/client/network-gossip/src/state_machine.rs +++ b/client/network-gossip/src/state_machine.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network-gossip/src/validator.rs b/client/network-gossip/src/validator.rs index 2fb9282c48..cd0a733c91 100644 --- a/client/network-gossip/src/validator.rs +++ b/client/network-gossip/src/validator.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/chain.rs b/client/network/src/chain.rs index e3deda0dc9..f79cf6f61e 100644 --- a/client/network/src/chain.rs +++ b/client/network/src/chain.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/config.rs b/client/network/src/config.rs index f03b2169e9..c1534c6d9c 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/error.rs b/client/network/src/error.rs index 270c0e7b8d..e46273c47b 100644 --- a/client/network/src/error.rs +++ b/client/network/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 8174666ab7..7cc5e85371 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/network_state.rs b/client/network/src/network_state.rs index d8920951bc..ca6733de81 100644 --- a/client/network/src/network_state.rs +++ b/client/network/src/network_state.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/on_demand_layer.rs b/client/network/src/on_demand_layer.rs index 8cf7717407..c76ebb0351 100644 --- a/client/network/src/on_demand_layer.rs +++ b/client/network/src/on_demand_layer.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 4153129a0a..a245659ee0 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/generic_proto/handler.rs b/client/network/src/protocol/generic_proto/handler.rs index a013b933c2..3b4469a872 100644 --- a/client/network/src/protocol/generic_proto/handler.rs +++ b/client/network/src/protocol/generic_proto/handler.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/generic_proto/handler/notif_in.rs b/client/network/src/protocol/generic_proto/handler/notif_in.rs index a979b8f9cd..68708b9fb7 100644 --- a/client/network/src/protocol/generic_proto/handler/notif_in.rs +++ b/client/network/src/protocol/generic_proto/handler/notif_in.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/generic_proto/upgrade.rs b/client/network/src/protocol/generic_proto/upgrade.rs index 7172451cee..6322a10b57 100644 --- a/client/network/src/protocol/generic_proto/upgrade.rs +++ b/client/network/src/protocol/generic_proto/upgrade.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/generic_proto/upgrade/legacy.rs b/client/network/src/protocol/generic_proto/upgrade/legacy.rs index 15e34197d4..aba7fda2c3 100644 --- a/client/network/src/protocol/generic_proto/upgrade/legacy.rs +++ b/client/network/src/protocol/generic_proto/upgrade/legacy.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/message.rs b/client/network/src/protocol/message.rs index 155e945f4e..5baa8ed78f 100644 --- a/client/network/src/protocol/message.rs +++ b/client/network/src/protocol/message.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/sync/blocks.rs b/client/network/src/protocol/sync/blocks.rs index c79c0d7f51..8d7e375d08 100644 --- a/client/network/src/protocol/sync/blocks.rs +++ b/client/network/src/protocol/sync/blocks.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/protocol/sync/extra_requests.rs b/client/network/src/protocol/sync/extra_requests.rs index 1e63749c25..5df77a8228 100644 --- a/client/network/src/protocol/sync/extra_requests.rs +++ b/client/network/src/protocol/sync/extra_requests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/schema.rs b/client/network/src/schema.rs index dbc85dd97b..c736b5c652 100644 --- a/client/network/src/schema.rs +++ b/client/network/src/schema.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 5448568930..132f6be749 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/service/out_events.rs b/client/network/src/service/out_events.rs index 08c0968cf9..024b974266 100644 --- a/client/network/src/service/out_events.rs +++ b/client/network/src/service/out_events.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index eada49d741..cd1ac85497 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/src/transport.rs b/client/network/src/transport.rs index 5dca5ff43b..c241d25034 100644 --- a/client/network/src/transport.rs +++ b/client/network/src/transport.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/test/src/block_import.rs b/client/network/test/src/block_import.rs index 4e66ff879f..34199abde2 100644 --- a/client/network/test/src/block_import.rs +++ b/client/network/test/src/block_import.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/test/src/lib.rs b/client/network/test/src/lib.rs index 25a7f3a606..3ce28c261f 100644 --- a/client/network/test/src/lib.rs +++ b/client/network/test/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/network/test/src/sync.rs b/client/network/test/src/sync.rs index 50051540d2..a87badead7 100644 --- a/client/network/test/src/sync.rs +++ b/client/network/test/src/sync.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/peerset/src/lib.rs b/client/peerset/src/lib.rs index 6a6f3d0905..bde3bf628c 100644 --- a/client/peerset/src/lib.rs +++ b/client/peerset/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/peerset/tests/fuzz.rs b/client/peerset/tests/fuzz.rs index 12e20a04be..dbc688fd5e 100644 --- a/client/peerset/tests/fuzz.rs +++ b/client/peerset/tests/fuzz.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/author/error.rs b/client/rpc-api/src/author/error.rs index 0b7d02a914..192d0c2795 100644 --- a/client/rpc-api/src/author/error.rs +++ b/client/rpc-api/src/author/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/author/mod.rs b/client/rpc-api/src/author/mod.rs index aa3ec9bf5c..d99f854037 100644 --- a/client/rpc-api/src/author/mod.rs +++ b/client/rpc-api/src/author/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/chain/error.rs b/client/rpc-api/src/chain/error.rs index 6b3dd6341a..fd7bd0a43d 100644 --- a/client/rpc-api/src/chain/error.rs +++ b/client/rpc-api/src/chain/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/chain/mod.rs b/client/rpc-api/src/chain/mod.rs index 13afa3ffc6..0d394acd0b 100644 --- a/client/rpc-api/src/chain/mod.rs +++ b/client/rpc-api/src/chain/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/child_state/mod.rs b/client/rpc-api/src/child_state/mod.rs index 8d0d0049af..21045677f4 100644 --- a/client/rpc-api/src/child_state/mod.rs +++ b/client/rpc-api/src/child_state/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/errors.rs b/client/rpc-api/src/errors.rs index 96bbadc27d..a0c9c4cfbe 100644 --- a/client/rpc-api/src/errors.rs +++ b/client/rpc-api/src/errors.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/helpers.rs b/client/rpc-api/src/helpers.rs index 5eaa8d8d8f..5ce9161ad5 100644 --- a/client/rpc-api/src/helpers.rs +++ b/client/rpc-api/src/helpers.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/offchain/error.rs b/client/rpc-api/src/offchain/error.rs index bfdd663121..6e9b531623 100644 --- a/client/rpc-api/src/offchain/error.rs +++ b/client/rpc-api/src/offchain/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/offchain/mod.rs b/client/rpc-api/src/offchain/mod.rs index 9c60cf65b2..c456e56a4d 100644 --- a/client/rpc-api/src/offchain/mod.rs +++ b/client/rpc-api/src/offchain/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/policy.rs b/client/rpc-api/src/policy.rs index 74c2d0594b..3dc3bf8505 100644 --- a/client/rpc-api/src/policy.rs +++ b/client/rpc-api/src/policy.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/state/error.rs b/client/rpc-api/src/state/error.rs index a33bbd3df4..2dabe309ee 100644 --- a/client/rpc-api/src/state/error.rs +++ b/client/rpc-api/src/state/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/state/helpers.rs b/client/rpc-api/src/state/helpers.rs index af414a0498..b740a8e33b 100644 --- a/client/rpc-api/src/state/helpers.rs +++ b/client/rpc-api/src/state/helpers.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/state/mod.rs b/client/rpc-api/src/state/mod.rs index a31ef598c8..cec32a26c6 100644 --- a/client/rpc-api/src/state/mod.rs +++ b/client/rpc-api/src/state/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/subscriptions.rs b/client/rpc-api/src/subscriptions.rs index db5d178450..772e9d4ee8 100644 --- a/client/rpc-api/src/subscriptions.rs +++ b/client/rpc-api/src/subscriptions.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/system/error.rs b/client/rpc-api/src/system/error.rs index a4b7a1ca54..bd75b86493 100644 --- a/client/rpc-api/src/system/error.rs +++ b/client/rpc-api/src/system/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/system/helpers.rs b/client/rpc-api/src/system/helpers.rs index 0b29011f21..fbc68de05a 100644 --- a/client/rpc-api/src/system/helpers.rs +++ b/client/rpc-api/src/system/helpers.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-api/src/system/mod.rs b/client/rpc-api/src/system/mod.rs index 769a914ecb..6a2026c978 100644 --- a/client/rpc-api/src/system/mod.rs +++ b/client/rpc-api/src/system/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc-servers/src/lib.rs b/client/rpc-servers/src/lib.rs index cd1b33ad8b..3366343213 100644 --- a/client/rpc-servers/src/lib.rs +++ b/client/rpc-servers/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index 297fe2794b..fc23db95a8 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index 2f944afc8f..a9caa6d91a 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 23e43e57fb..8341724227 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index 3c8ee5c817..477438e286 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index defb7257a5..0ec44b5663 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/metadata.rs b/client/rpc/src/metadata.rs index cf795197f5..3c2902694e 100644 --- a/client/rpc/src/metadata.rs +++ b/client/rpc/src/metadata.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/offchain/mod.rs b/client/rpc/src/offchain/mod.rs index 4ec11bfeb5..f55148b451 100644 --- a/client/rpc/src/offchain/mod.rs +++ b/client/rpc/src/offchain/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/offchain/tests.rs b/client/rpc/src/offchain/tests.rs index 8fa23715f7..f1fa925a35 100644 --- a/client/rpc/src/offchain/tests.rs +++ b/client/rpc/src/offchain/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index 395da68a10..e4d6918afb 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index 85a12e11f9..a275624053 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/system/mod.rs b/client/rpc/src/system/mod.rs index b73a924c41..92a5f61c89 100644 --- a/client/rpc/src/system/mod.rs +++ b/client/rpc/src/system/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/system/tests.rs b/client/rpc/src/system/tests.rs index 826e85f277..e79e85f771 100644 --- a/client/rpc/src/system/tests.rs +++ b/client/rpc/src/system/tests.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/rpc/src/testing.rs b/client/rpc/src/testing.rs index 48f9f90b9d..afca07a7fb 100644 --- a/client/rpc/src/testing.rs +++ b/client/rpc/src/testing.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 1bbf065825..81a861d621 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/chain_ops.rs b/client/service/src/chain_ops.rs index 7206ab6b3a..f02161fc72 100644 --- a/client/service/src/chain_ops.rs +++ b/client/service/src/chain_ops.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/block_rules.rs b/client/service/src/client/block_rules.rs index 8ea9c42483..0d7e8effc6 100644 --- a/client/service/src/client/block_rules.rs +++ b/client/service/src/client/block_rules.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/call_executor.rs b/client/service/src/client/call_executor.rs index 093d74e3b3..d0304914ff 100644 --- a/client/service/src/client/call_executor.rs +++ b/client/service/src/client/call_executor.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 09b9929a32..9db7b714e1 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/genesis.rs b/client/service/src/client/genesis.rs index 66436ce81f..9f68e20950 100644 --- a/client/service/src/client/genesis.rs +++ b/client/service/src/client/genesis.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/light/backend.rs b/client/service/src/client/light/backend.rs index 7ba60567ab..d336127131 100644 --- a/client/service/src/client/light/backend.rs +++ b/client/service/src/client/light/backend.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/light/blockchain.rs b/client/service/src/client/light/blockchain.rs index 02212a0263..6076b386dc 100644 --- a/client/service/src/client/light/blockchain.rs +++ b/client/service/src/client/light/blockchain.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/light/call_executor.rs b/client/service/src/client/light/call_executor.rs index 76551f2bfd..0f6a8f1372 100644 --- a/client/service/src/client/light/call_executor.rs +++ b/client/service/src/client/light/call_executor.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/light/fetcher.rs b/client/service/src/client/light/fetcher.rs index e3b82bd2b2..b62225c59c 100644 --- a/client/service/src/client/light/fetcher.rs +++ b/client/service/src/client/light/fetcher.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/light/mod.rs b/client/service/src/client/light/mod.rs index 7cc13cfb6b..32288d7b8b 100644 --- a/client/service/src/client/light/mod.rs +++ b/client/service/src/client/light/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/client/mod.rs b/client/service/src/client/mod.rs index 996b885fe5..52a67eb3e3 100644 --- a/client/service/src/client/mod.rs +++ b/client/service/src/client/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/config.rs b/client/service/src/config.rs index 0cc43dac48..7e4949e534 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/error.rs b/client/service/src/error.rs index 0b2bbd8d56..244fa553ff 100644 --- a/client/service/src/error.rs +++ b/client/service/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 5604b98e82..feae664301 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index d1dd1a3bab..040dc8eb62 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/test/src/client/db.rs b/client/service/test/src/client/db.rs index 134075a11d..19cf62b30d 100644 --- a/client/service/test/src/client/db.rs +++ b/client/service/test/src/client/db.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/test/src/client/light.rs b/client/service/test/src/client/light.rs index 0ad5ba78fb..ec319e4832 100644 --- a/client/service/test/src/client/light.rs +++ b/client/service/test/src/client/light.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/test/src/client/mod.rs b/client/service/test/src/client/mod.rs index 0791c421bd..1cfbe2930d 100644 --- a/client/service/test/src/client/mod.rs +++ b/client/service/test/src/client/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index faffce3e0a..a7e4b31ebb 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/state-db/src/lib.rs b/client/state-db/src/lib.rs index 6025501102..68c658beb6 100644 --- a/client/state-db/src/lib.rs +++ b/client/state-db/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/state-db/src/noncanonical.rs b/client/state-db/src/noncanonical.rs index e9b4c829e1..34e7a8725c 100644 --- a/client/state-db/src/noncanonical.rs +++ b/client/state-db/src/noncanonical.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/state-db/src/pruning.rs b/client/state-db/src/pruning.rs index 3ab4a61da4..743db9bc1f 100644 --- a/client/state-db/src/pruning.rs +++ b/client/state-db/src/pruning.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/state-db/src/test.rs b/client/state-db/src/test.rs index d445ce6b6d..17686031a7 100644 --- a/client/state-db/src/test.rs +++ b/client/state-db/src/test.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/telemetry/src/lib.rs b/client/telemetry/src/lib.rs index b959697f39..0752a3c53f 100644 --- a/client/telemetry/src/lib.rs +++ b/client/telemetry/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/telemetry/src/worker.rs b/client/telemetry/src/worker.rs index 04689f7686..b147313aee 100644 --- a/client/telemetry/src/worker.rs +++ b/client/telemetry/src/worker.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/telemetry/src/worker/node.rs b/client/telemetry/src/worker/node.rs index 0662ecab54..bdca054c23 100644 --- a/client/telemetry/src/worker/node.rs +++ b/client/telemetry/src/worker/node.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/benches/basics.rs b/client/transaction-pool/graph/benches/basics.rs index 544d31e176..80d5ac838b 100644 --- a/client/transaction-pool/graph/benches/basics.rs +++ b/client/transaction-pool/graph/benches/basics.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/base_pool.rs b/client/transaction-pool/graph/src/base_pool.rs index 452f9c9feb..2cb9a16126 100644 --- a/client/transaction-pool/graph/src/base_pool.rs +++ b/client/transaction-pool/graph/src/base_pool.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/error.rs b/client/transaction-pool/graph/src/error.rs index c04f90dac0..b970ab6f45 100644 --- a/client/transaction-pool/graph/src/error.rs +++ b/client/transaction-pool/graph/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/future.rs b/client/transaction-pool/graph/src/future.rs index beff5bb2cc..76fa51a3ad 100644 --- a/client/transaction-pool/graph/src/future.rs +++ b/client/transaction-pool/graph/src/future.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/lib.rs b/client/transaction-pool/graph/src/lib.rs index 632f7d3feb..6ef80e2eb2 100644 --- a/client/transaction-pool/graph/src/lib.rs +++ b/client/transaction-pool/graph/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/listener.rs b/client/transaction-pool/graph/src/listener.rs index c8bf2c9d39..0bee4384c2 100644 --- a/client/transaction-pool/graph/src/listener.rs +++ b/client/transaction-pool/graph/src/listener.rs @@ -6,7 +6,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/pool.rs b/client/transaction-pool/graph/src/pool.rs index cef2f0b62e..ffcdcdc06f 100644 --- a/client/transaction-pool/graph/src/pool.rs +++ b/client/transaction-pool/graph/src/pool.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/ready.rs b/client/transaction-pool/graph/src/ready.rs index e759e318a1..dcd55f980f 100644 --- a/client/transaction-pool/graph/src/ready.rs +++ b/client/transaction-pool/graph/src/ready.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/rotator.rs b/client/transaction-pool/graph/src/rotator.rs index 9ce6a43b1e..a6bb855f23 100644 --- a/client/transaction-pool/graph/src/rotator.rs +++ b/client/transaction-pool/graph/src/rotator.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/validated_pool.rs b/client/transaction-pool/graph/src/validated_pool.rs index 4a32c4c58c..66047ad50d 100644 --- a/client/transaction-pool/graph/src/validated_pool.rs +++ b/client/transaction-pool/graph/src/validated_pool.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/graph/src/watcher.rs b/client/transaction-pool/graph/src/watcher.rs index 098e468d22..1c03c0e6a8 100644 --- a/client/transaction-pool/graph/src/watcher.rs +++ b/client/transaction-pool/graph/src/watcher.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs index 90d667d613..f2cd9c707f 100644 --- a/client/transaction-pool/src/api.rs +++ b/client/transaction-pool/src/api.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/error.rs b/client/transaction-pool/src/error.rs index feccf4a7b0..fa05ca6a64 100644 --- a/client/transaction-pool/src/error.rs +++ b/client/transaction-pool/src/error.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 62b99ef505..8976003b7d 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/metrics.rs b/client/transaction-pool/src/metrics.rs index 3b0e48cbfc..68c5042f2d 100644 --- a/client/transaction-pool/src/metrics.rs +++ b/client/transaction-pool/src/metrics.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index f8f7280417..261ef5a140 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/testing/mod.rs b/client/transaction-pool/src/testing/mod.rs index c4bf184a2b..c22d61491a 100644 --- a/client/transaction-pool/src/testing/mod.rs +++ b/client/transaction-pool/src/testing/mod.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 32701d3c2d..0b5ce8e90d 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -5,7 +5,7 @@ // This program 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 +// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, -- GitLab From 4d85a52abde659f83d32db8bf1cf76239f9f203b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 18 May 2020 12:53:33 +0100 Subject: [PATCH 007/280] grandpa: minor cleanup for gossip round start instant (#5976) * grandpa: move gossip round start instant to LocalView * grandpa: round duration is 2 gossip periods --- .../src/communication/gossip.rs | 54 +++++++++++++------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/client/finality-grandpa/src/communication/gossip.rs b/client/finality-grandpa/src/communication/gossip.rs index 7fe17e974b..c96301ede8 100644 --- a/client/finality-grandpa/src/communication/gossip.rs +++ b/client/finality-grandpa/src/communication/gossip.rs @@ -110,7 +110,7 @@ const CATCH_UP_THRESHOLD: u64 = 2; const PROPAGATION_ALL: u32 = 4; //in rounds; const PROPAGATION_ALL_AUTHORITIES: u32 = 2; //in rounds; const PROPAGATION_SOME_NON_AUTHORITIES: u32 = 3; //in rounds; -const ROUND_DURATION: u32 = 4; // measured in gossip durations +const ROUND_DURATION: u32 = 2; // measured in gossip durations const MIN_LUCKY: usize = 5; @@ -181,15 +181,27 @@ impl View { } } -/// A local view of protocol state. Only differs from `View` in that we also -/// track the round and set id at which the last commit was observed. +/// A local view of protocol state. Similar to `View` but we additionally track +/// the round and set id at which the last commit was observed, and the instant +/// at which the current round started. struct LocalView { round: Round, set_id: SetId, last_commit: Option<(N, Round, SetId)>, + round_start: Instant, } impl LocalView { + /// Creates a new `LocalView` at the given set id and round. + fn new(set_id: SetId, round: Round) -> LocalView { + LocalView { + set_id, + round, + last_commit: None, + round_start: Instant::now(), + } + } + /// Converts the local view to a `View` discarding round and set id /// information about the last commit. fn as_view(&self) -> View<&N> { @@ -205,9 +217,16 @@ impl LocalView { if set_id != self.set_id { self.set_id = set_id; self.round = Round(1); + self.round_start = Instant::now(); } } + /// Updates the current round. + fn update_round(&mut self, round: Round) { + self.round = round; + self.round_start = Instant::now(); + } + /// Returns the height of the block that the last observed commit finalizes. fn last_commit_height(&self) -> Option<&N> { self.last_commit.as_ref().map(|(number, _, _)| number) @@ -656,7 +675,6 @@ struct Inner { local_view: Option>>, peers: Peers>, live_topics: KeepTopics, - round_start: Instant, authorities: Vec, config: crate::Config, next_rebroadcast: Instant, @@ -689,7 +707,6 @@ impl Inner { local_view: None, peers: Peers::default(), live_topics: KeepTopics::new(), - round_start: Instant::now(), next_rebroadcast: Instant::now() + REBROADCAST_AFTER, authorities: Vec::new(), pending_catch_up: PendingCatchUp::None, @@ -715,10 +732,9 @@ impl Inner { debug!(target: "afg", "Voter {} noting beginning of round {:?} to network.", self.config.name(), (round, set_id)); - local_view.round = round; + local_view.update_round(round); self.live_topics.push(round, set_id); - self.round_start = Instant::now(); self.peers.reshuffle(); } self.multicast_neighbor_packet() @@ -729,11 +745,10 @@ impl Inner { fn note_set(&mut self, set_id: SetId, authorities: Vec) -> MaybeMessage { { let local_view = match self.local_view { - ref mut x @ None => x.get_or_insert(LocalView { - round: Round(1), + ref mut x @ None => x.get_or_insert(LocalView::new( set_id, - last_commit: None, - }), + Round(1), + )), Some(ref mut v) => if v.set_id == set_id { if self.authorities != authorities { debug!(target: "afg", @@ -1121,8 +1136,10 @@ impl Inner { /// underlying gossip layer, which should happen every 30 seconds. fn round_message_allowed(&self, who: &PeerId, peer: &PeerInfo) -> bool { let round_duration = self.config.gossip_duration * ROUND_DURATION; - let round_elapsed = self.round_start.elapsed(); - + let round_elapsed = match self.local_view { + Some(ref local_view) => local_view.round_start.elapsed(), + None => return false, + }; if !self.config.is_authority && round_elapsed < round_duration * PROPAGATION_ALL @@ -1185,7 +1202,10 @@ impl Inner { /// underlying gossip layer, which should happen every 30 seconds. fn global_message_allowed(&self, who: &PeerId, peer: &PeerInfo) -> bool { let round_duration = self.config.gossip_duration * ROUND_DURATION; - let round_elapsed = self.round_start.elapsed(); + let round_elapsed = match self.local_view { + Some(ref local_view) => local_view.round_start.elapsed(), + None => return false, + }; match peer.roles { ObservedRole::OurSentry | ObservedRole::OurGuardedAuthority => true, @@ -2320,7 +2340,8 @@ mod tests { let test = |num_round, peers| { // rewind n round durations - val.inner.write().round_start = Instant::now() - round_duration * num_round; + val.inner.write().local_view.as_mut().unwrap().round_start = + Instant::now() - round_duration * num_round; let mut message_allowed = val.message_allowed(); move || { @@ -2448,7 +2469,8 @@ mod tests { } { - val.inner.write().round_start = Instant::now() - round_duration * 4; + val.inner.write().local_view.as_mut().unwrap().round_start = + Instant::now() - round_duration * 4; let mut message_allowed = val.message_allowed(); // on the fourth round duration we should allow messages to authorities // (on the second we would do `sqrt(authorities)`) -- GitLab From af463334af10d9c8f09badc6dde3fa5c3eed096f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 18 May 2020 16:48:44 +0300 Subject: [PATCH 008/280] Add block construction prometheus metrics (#6030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add basic authorship metrics * fixes * no arc * move to crate * Update client/proposer-metrics/Cargo.toml Co-authored-by: Max Inden * remove prefix * use HistogramTimer * Update client/proposer-metrics/src/lib.rs Co-authored-by: Bastian Köcher * Update client/basic-authorship/src/basic_authorship.rs Co-authored-by: Bastian Köcher * Update client/basic-authorship/src/basic_authorship.rs Co-authored-by: Bastian Köcher * Update client/basic-authorship/src/basic_authorship.rs Co-authored-by: Bastian Köcher * Update client/basic-authorship/src/basic_authorship.rs Co-authored-by: Bastian Köcher * Update client/basic-authorship/src/basic_authorship.rs Co-authored-by: Bastian Köcher * Update client/proposer-metrics/src/lib.rs Co-authored-by: Bastian Köcher * Update client/proposer-metrics/src/lib.rs Co-authored-by: Bastian Köcher Co-authored-by: Max Inden Co-authored-by: Bastian Köcher --- Cargo.lock | 10 +++ Cargo.toml | 1 + bin/node-template/node/src/service.rs | 7 +- bin/node/cli/src/service.rs | 6 +- client/basic-authorship/Cargo.toml | 8 ++- .../basic-authorship/src/basic_authorship.rs | 27 ++++++-- client/basic-authorship/src/lib.rs | 2 +- client/consensus/manual-seal/src/lib.rs | 7 +- client/proposer-metrics/Cargo.toml | 16 +++++ client/proposer-metrics/src/lib.rs | 67 +++++++++++++++++++ primitives/consensus/common/src/lib.rs | 4 +- 11 files changed, 139 insertions(+), 16 deletions(-) create mode 100644 client/proposer-metrics/Cargo.toml create mode 100644 client/proposer-metrics/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 5c50933839..5e23615fdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5885,6 +5885,7 @@ dependencies = [ "parking_lot 0.10.2", "sc-block-builder", "sc-client-api", + "sc-proposer-metrics", "sc-telemetry", "sc-transaction-pool", "sp-api", @@ -5894,6 +5895,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-transaction-pool", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tokio-executor 0.2.0-alpha.6", ] @@ -6601,6 +6603,14 @@ dependencies = [ "wasm-timer", ] +[[package]] +name = "sc-proposer-metrics" +version = "0.8.0-dev" +dependencies = [ + "log", + "substrate-prometheus-endpoint", +] + [[package]] name = "sc-rpc" version = "2.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index d9ee8709d1..8fbe1cf0d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ members = [ "client/network-gossip", "client/offchain", "client/peerset", + "client/proposer-metrics", "client/rpc-servers", "client/rpc", "client/rpc-api", diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index d02e9ea95e..8e57a04137 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -106,8 +106,11 @@ pub fn new_full(config: Configuration) -> Result. + //! A consensus proposer for "basic" chains which use the primitive inherent-data. // FIXME #1021 move this into sp-consensus @@ -38,21 +39,31 @@ use futures::{executor, future, future::Either}; use sp_blockchain::{HeaderBackend, ApplyExtrinsicFailed::Validity, Error::ApplyExtrinsicFailed}; use std::marker::PhantomData; +use prometheus_endpoint::Registry as PrometheusRegistry; +use sc_proposer_metrics::MetricsLink as PrometheusMetrics; + /// Proposer factory. pub struct ProposerFactory { /// The client instance. client: Arc, /// The transaction pool. transaction_pool: Arc, + /// Prometheus Link, + metrics: PrometheusMetrics, /// phantom member to pin the `Backend` type. _phantom: PhantomData, } impl ProposerFactory { - pub fn new(client: Arc, transaction_pool: Arc) -> Self { + pub fn new( + client: Arc, + transaction_pool: Arc, + prometheus: Option<&PrometheusRegistry>, + ) -> Self { ProposerFactory { client, transaction_pool, + metrics: PrometheusMetrics::new(prometheus), _phantom: PhantomData, } } @@ -87,6 +98,7 @@ impl ProposerFactory parent_number: *parent_header.number(), transaction_pool: self.transaction_pool.clone(), now, + metrics: self.metrics.clone(), _phantom: PhantomData, }), }; @@ -131,6 +143,7 @@ struct ProposerInner { parent_number: <::Header as HeaderT>::Number, transaction_pool: Arc, now: Box time::Instant + Send + Sync>, + metrics: PrometheusMetrics, _phantom: PhantomData, } @@ -219,6 +232,7 @@ impl ProposerInner } // proceed with transactions + let block_timer = self.metrics.report(|metrics| metrics.block_constructed.start_timer()); let mut is_first = true; let mut skipped = 0; let mut unqueue_invalid = Vec::new(); @@ -289,6 +303,9 @@ impl ProposerInner let (block, storage_changes, proof) = block_builder.build()?.into_inner(); + drop(block_timer); + self.metrics.report(|metrics| metrics.number_of_transactions.set(block.extrinsics().len() as u64)); + info!("🎁 Prepared block for proposing at {} [hash: {:?}; parent_hash: {}; extrinsics ({}): [{}]]", block.header().number(), ::Hash::from(block.header().hash()), @@ -379,7 +396,7 @@ mod tests { )) ); - let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone()); + let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None); let cell = Mutex::new((false, time::Instant::now())); let mut proposer = proposer_factory.init_with_now( @@ -420,7 +437,7 @@ mod tests { ).0 ); - let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone()); + let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None); let cell = Mutex::new((false, time::Instant::now())); let mut proposer = proposer_factory.init_with_now( @@ -470,7 +487,7 @@ mod tests { )) ); - let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone()); + let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None); let mut proposer = proposer_factory.init_with_now( &client.header(&block_id).unwrap().unwrap(), @@ -536,7 +553,7 @@ mod tests { ]) ).unwrap(); - let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone()); + let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None); let mut propose_block = | client: &TestClient, number, diff --git a/client/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs index 7f88844d90..7c77dde6b0 100644 --- a/client/basic-authorship/src/lib.rs +++ b/client/basic-authorship/src/lib.rs @@ -29,7 +29,7 @@ //! # let client = Arc::new(substrate_test_runtime_client::new()); //! # let txpool = Arc::new(BasicPool::new(Default::default(), Arc::new(FullChainApi::new(client.clone())), None).0); //! // The first step is to create a `ProposerFactory`. -//! let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone()); +//! let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None); //! //! // From this factory, we create a `Proposer`. //! let proposer = proposer_factory.init( diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index 754203f7ba..de9711b2a8 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -225,7 +225,8 @@ mod tests { let pool = Arc::new(BasicPool::new(Options::default(), api(), None).0); let env = ProposerFactory::new( client.clone(), - pool.clone() + pool.clone(), + None, ); // this test checks that blocks are created as soon as transactions are imported into the pool. let (sender, receiver) = futures::channel::oneshot::channel(); @@ -289,7 +290,8 @@ mod tests { let pool = Arc::new(BasicPool::new(Options::default(), api(), None).0); let env = ProposerFactory::new( client.clone(), - pool.clone() + pool.clone(), + None, ); // this test checks that blocks are created as soon as an engine command is sent over the stream. let (mut sink, stream) = futures::channel::mpsc::channel(1024); @@ -358,6 +360,7 @@ mod tests { let env = ProposerFactory::new( client.clone(), pool.clone(), + None, ); // this test checks that blocks are created as soon as an engine command is sent over the stream. let (mut sink, stream) = futures::channel::mpsc::channel(1024); diff --git a/client/proposer-metrics/Cargo.toml b/client/proposer-metrics/Cargo.toml new file mode 100644 index 0000000000..9d510027ec --- /dev/null +++ b/client/proposer-metrics/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "sc-proposer-metrics" +version = "0.8.0-dev" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/substrate/" +description = "Basic metrics for block production." + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +log = "0.4.8" +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} diff --git a/client/proposer-metrics/src/lib.rs b/client/proposer-metrics/src/lib.rs new file mode 100644 index 0000000000..5cb749f4a2 --- /dev/null +++ b/client/proposer-metrics/src/lib.rs @@ -0,0 +1,67 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Prometheus basic proposer metrics. + +use prometheus_endpoint::{register, PrometheusError, Registry, Histogram, HistogramOpts, Gauge, U64}; + +/// Optional shareable link to basic authorship metrics. +#[derive(Clone, Default)] +pub struct MetricsLink(Option); + +impl MetricsLink { + pub fn new(registry: Option<&Registry>) -> Self { + Self( + registry.and_then(|registry| + Metrics::register(registry) + .map_err(|err| log::warn!("Failed to register proposer prometheus metrics: {}", err)) + .ok() + ) + ) + } + + pub fn report(&self, do_this: impl FnOnce(&Metrics) -> O) -> Option { + Some(do_this(self.0.as_ref()?)) + } +} + +/// Authorship metrics. +#[derive(Clone)] +pub struct Metrics { + pub block_constructed: Histogram, + pub number_of_transactions: Gauge, +} + +impl Metrics { + pub fn register(registry: &Registry) -> Result { + Ok(Self { + block_constructed: register( + Histogram::with_opts(HistogramOpts::new( + "proposer_block_constructed", + "Histogram of time taken to construct new block", + ))?, + registry, + )?, + number_of_transactions: register( + Gauge::new( + "proposer_number_of_transactions", + "Number of transactions included in block", + )?, + registry, + )?, + }) + } +} diff --git a/primitives/consensus/common/src/lib.rs b/primitives/consensus/common/src/lib.rs index 52b034ffdd..fc56b22516 100644 --- a/primitives/consensus/common/src/lib.rs +++ b/primitives/consensus/common/src/lib.rs @@ -72,7 +72,9 @@ pub enum BlockStatus { Unknown, } -/// Environment producer for a Consensus instance. Creates proposer instance and communication streams. +/// Environment for a Consensus instance. +/// +/// Creates proposer instance. pub trait Environment { /// The proposer type this creates. type Proposer: Proposer + Send + 'static; -- GitLab From 05b70542eaf6629f9811e9d8b09bf2baa4ebf884 Mon Sep 17 00:00:00 2001 From: clearloop Date: Tue, 19 May 2020 00:41:28 +0800 Subject: [PATCH 009/280] chore: updates the license badge (#6058) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 874ec99e69..5bb7ebb775 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Substrate · [![GitHub license](https://img.shields.io/github/license/paritytech/substrate)](LICENSE) [![GitLab Status](https://gitlab.parity.io/parity/substrate/badges/master/pipeline.svg)](https://gitlab.parity.io/parity/substrate/pipelines) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](docs/CONTRIBUTING.adoc) +# Substrate · [![GitHub license](https://img.shields.io/badge/license-GPL3%2FApache2-blue)](LICENSE) [![GitLab Status](https://gitlab.parity.io/parity/substrate/badges/master/pipeline.svg)](https://gitlab.parity.io/parity/substrate/pipelines) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](docs/CONTRIBUTING.adoc)

@@ -21,4 +21,4 @@ The security policy and procedures can be found in [`docs/SECURITY.md`](docs/SEC ## License -Substrate Client (`/client/*` / `sc-*`) is licensed under [GPL v3.0 with a classpath linking exception](LICENSE-GPL3), primitives (`sp-*`), FRAME (`frame-*`) and pallets (`pallets-*`), binaries (`/bin`) and all other utilities are licensed under [Apache 2.0](LICENSE-APACHE2). \ No newline at end of file +Substrate Client (`/client/*` / `sc-*`) is licensed under [GPL v3.0 with a classpath linking exception](LICENSE-GPL3), primitives (`sp-*`), FRAME (`frame-*`) and pallets (`pallets-*`), binaries (`/bin`) and all other utilities are licensed under [Apache 2.0](LICENSE-APACHE2). -- GitLab From c17fce21f88a3f462490cc55bd66b39332c84951 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 18 May 2020 18:42:25 +0200 Subject: [PATCH 010/280] Fix parallel code execution in wasmtime (#6055) * Bump wasmtime version * Proper test --- Cargo.lock | 16 ++++---- client/executor/src/integration_tests/mod.rs | 40 +++++++++++++------- client/executor/wasmtime/Cargo.toml | 4 +- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e23615fdc..70fb4956d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8289,9 +8289,9 @@ version = "1.0.6" [[package]] name = "substrate-wasmtime" -version = "0.16.0-threadsafe.2" +version = "0.16.0-threadsafe.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40a6f3d5d3c00754e348863fead4f37763c32eedf950f5b23df87769882311" +checksum = "9b0d8eca5d0186e98c8d13399423853e2356b593e028b53e43b2aa35e9105a82" dependencies = [ "anyhow", "backtrace", @@ -8312,9 +8312,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-jit" -version = "0.16.0-threadsafe.2" +version = "0.16.0-threadsafe.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09712de4f56a2c2912bee7763b0877d17d72cfb2237987d63ab78956907e7692" +checksum = "e95772b1778186e4f5c9ae9148bab9911cddf563805a403dee418780e2ed14b4" dependencies = [ "anyhow", "cfg-if", @@ -8339,9 +8339,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-profiling" -version = "0.16.0-threadsafe.2" +version = "0.16.0-threadsafe.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31505dd221f001634a54ea51472bc0058bcbde9186eaf8dd31d0859638121385" +checksum = "1f8a0bf9ca20bee7d83338470247a3f1823158382ebd51fadefcc986e0a6c3de" dependencies = [ "anyhow", "cfg-if", @@ -8358,9 +8358,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-runtime" -version = "0.16.0-threadsafe.2" +version = "0.16.0-threadsafe.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3708081f04d9216d4dee487abf94872065f930cf82e287bd0c5bdb57895460ba" +checksum = "a559895fe1efab16d1c490199225ae35c153ed432ef87ebc177fb37edbd20c7c" dependencies = [ "backtrace", "cc", diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 07add57bb3..80b123ed4b 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -626,19 +626,33 @@ fn heap_is_reset_between_calls(wasm_method: WasmExecutionMethod) { #[test_case(WasmExecutionMethod::Interpreted)] #[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))] fn parallel_execution(wasm_method: WasmExecutionMethod) { - let threads: Vec<_> = (0..8).map(|_| std::thread::spawn(move || { - let mut ext = TestExternalities::default(); - let mut ext = ext.ext(); - assert_eq!( - call_in_wasm( - "test_twox_128", - &[0], - wasm_method.clone(), - &mut ext, - ).unwrap(), - hex!("99e9d85137db46ef4bbea33613baafd5").to_vec().encode(), - ); - })).collect(); + let executor = std::sync::Arc::new(crate::WasmExecutor::new( + wasm_method, + Some(1024), + HostFunctions::host_functions(), + 8, + )); + let code_hash = blake2_256(WASM_BINARY).to_vec(); + let threads: Vec<_> = (0..8).map(|_| + { + let executor = executor.clone(); + let code_hash = code_hash.clone(); + std::thread::spawn(move || { + let mut ext = TestExternalities::default(); + let mut ext = ext.ext(); + assert_eq!( + executor.call_in_wasm( + &WASM_BINARY[..], + Some(code_hash.clone()), + "test_twox_128", + &[0], + &mut ext, + sp_core::traits::MissingHostFunctions::Allow, + ).unwrap(), + hex!("99e9d85137db46ef4bbea33613baafd5").to_vec().encode(), + ); + }) + }).collect(); for t in threads.into_iter() { t.join().unwrap(); diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 8a424dfc2e..f7f236cb6b 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -21,8 +21,8 @@ sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-in sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } -wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.2" } -wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.2" } +wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.3" } +wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.3" } wasmtime-environ = "0.16" cranelift-wasm = "0.63" cranelift-codegen = "0.63" -- GitLab From adb5acbe7e0216a641d55056d4f016af9e8cf0c7 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 18 May 2020 18:42:44 +0200 Subject: [PATCH 011/280] Print an error if we discover our own network identity (#6047) * Add an error if we discover our own network identity * Fix tests --- client/network/src/protocol.rs | 10 +++++++++- .../src/protocol/generic_proto/behaviour.rs | 18 ++++++++++++++++-- .../src/protocol/generic_proto/tests.rs | 3 ++- client/network/src/service.rs | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index a245659ee0..421035e570 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -363,6 +363,7 @@ impl Protocol { /// Create a new instance. pub fn new( config: ProtocolConfig, + local_peer_id: PeerId, chain: Arc>, transaction_pool: Arc>, finality_proof_provider: Option>>, @@ -396,7 +397,13 @@ impl Protocol { let (peerset, peerset_handle) = sc_peerset::Peerset::from_config(peerset_config); let versions = &((MIN_VERSION as u8)..=(CURRENT_VERSION as u8)).collect::>(); - let mut behaviour = GenericProto::new(protocol_id.clone(), versions, peerset, queue_size_report); + let mut behaviour = GenericProto::new( + local_peer_id, + protocol_id.clone(), + versions, + peerset, + queue_size_report + ); let mut legacy_equiv_by_name = HashMap::new(); @@ -2193,6 +2200,7 @@ mod tests { let (mut protocol, _) = Protocol::::new( ProtocolConfig::default(), + PeerId::random(), client.clone(), Arc::new(EmptyTransactionPool), None, diff --git a/client/network/src/protocol/generic_proto/behaviour.rs b/client/network/src/protocol/generic_proto/behaviour.rs index 4984c0d86d..32cf417ec4 100644 --- a/client/network/src/protocol/generic_proto/behaviour.rs +++ b/client/network/src/protocol/generic_proto/behaviour.rs @@ -109,6 +109,9 @@ use wasm_timer::Instant; /// tries to connect, the connection is accepted. A ban only delays dialing attempts. /// pub struct GenericProto { + /// `PeerId` of the local node. + local_peer_id: PeerId, + /// Legacy protocol to open with peers. Never modified. legacy_protocol: RegisteredProtocol, @@ -321,6 +324,7 @@ impl GenericProto { /// The `queue_size_report` is an optional Prometheus metric that can report the size of the /// messages queue. If passed, it must have one label for the protocol name. pub fn new( + local_peer_id: PeerId, protocol: impl Into, versions: &[u8], peerset: sc_peerset::Peerset, @@ -329,6 +333,7 @@ impl GenericProto { let legacy_protocol = RegisteredProtocol::new(protocol, versions); GenericProto { + local_peer_id, legacy_protocol, notif_protocols: Vec::new(), peerset, @@ -507,9 +512,18 @@ impl GenericProto { /// /// Can be called multiple times with the same `PeerId`s. pub fn add_discovered_nodes(&mut self, peer_ids: impl Iterator) { - self.peerset.discovered(peer_ids.map(|peer_id| { + let local_peer_id = &self.local_peer_id; + self.peerset.discovered(peer_ids.filter_map(|peer_id| { + if peer_id == *local_peer_id { + error!( + target: "sub-libp2p", + "Discovered our own identity. This is a minor inconsequential bug." + ); + return None; + } + debug!(target: "sub-libp2p", "PSM <= Discovered({:?})", peer_id); - peer_id + Some(peer_id) })); } diff --git a/client/network/src/protocol/generic_proto/tests.rs b/client/network/src/protocol/generic_proto/tests.rs index 1bc6e745f8..de02ac5f34 100644 --- a/client/network/src/protocol/generic_proto/tests.rs +++ b/client/network/src/protocol/generic_proto/tests.rs @@ -42,6 +42,7 @@ fn build_nodes() -> (Swarm, Swarm) { for index in 0 .. 2 { let keypair = keypairs[index].clone(); + let local_peer_id = keypair.public().into_peer_id(); let transport = libp2p::core::transport::MemoryTransport .and_then(move |out, endpoint| { let secio = libp2p::secio::SecioConfig::new(keypair); @@ -82,7 +83,7 @@ fn build_nodes() -> (Swarm, Swarm) { }); let behaviour = CustomProtoWithAddr { - inner: GenericProto::new(&b"test"[..], &[1], peerset, None), + inner: GenericProto::new(local_peer_id, &b"test"[..], &[1], peerset, None), addrs: addrs .iter() .enumerate() diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 132f6be749..4b05c26335 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -204,6 +204,7 @@ impl NetworkWorker { roles: From::from(¶ms.role), max_parallel_downloads: params.network_config.max_parallel_downloads, }, + local_peer_id.clone(), params.chain.clone(), params.transaction_pool, params.finality_proof_provider.clone(), -- GitLab From 9bb5cbcc00bf1a1807d38ae93e3a7a54086cab03 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 18 May 2020 18:42:56 +0200 Subject: [PATCH 012/280] Refactor EVM operations to module functions (#6056) * Refactor EVM operations to module functions * Bump impl version --- bin/node/runtime/src/lib.rs | 2 +- frame/evm/src/lib.rs | 129 ++++++++++++++++++++++++++---------- 2 files changed, 96 insertions(+), 35 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index a7974d9d71..7d877676c0 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 248, - impl_version: 1, + impl_version: 2, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index 1c38e22917..a2354c7761 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -256,19 +256,14 @@ decl_module! { let sender = ensure_signed(origin)?; let source = T::ConvertAccountId::convert_account_id(&sender); - Self::execute_evm( + Self::execute_call( source, + target, + input, value, gas_limit, gas_price, nonce, - |executor| ((), executor.transact_call( - source, - target, - value, - input, - gas_limit as usize, - )), ).map_err(Into::into) } @@ -291,22 +286,13 @@ decl_module! { let sender = ensure_signed(origin)?; let source = T::ConvertAccountId::convert_account_id(&sender); - let create_address = Self::execute_evm( + let create_address = Self::execute_create( source, + init, value, gas_limit, gas_price, - nonce, - |executor| { - (executor.create_address( - evm::CreateScheme::Legacy { caller: source }, - ), executor.transact_create( - source, - value, - init, - gas_limit as usize, - )) - }, + nonce )?; Module::::deposit_event(Event::::Created(create_address)); @@ -332,24 +318,14 @@ decl_module! { let sender = ensure_signed(origin)?; let source = T::ConvertAccountId::convert_account_id(&sender); - let code_hash = H256::from_slice(Keccak256::digest(&init).as_slice()); - let create_address = Self::execute_evm( + let create_address = Self::execute_create2( source, + init, + salt, value, gas_limit, gas_price, - nonce, - |executor| { - (executor.create_address( - evm::CreateScheme::Create2 { caller: source, code_hash, salt }, - ), executor.transact_create2( - source, - value, - init, - salt, - gas_limit as usize, - )) - }, + nonce )?; Module::::deposit_event(Event::::Created(create_address)); @@ -391,6 +367,91 @@ impl Module { AccountStorages::remove_prefix(address); } + /// Execute a create transaction on behalf of given sender. + pub fn execute_create( + source: H160, + init: Vec, + value: U256, + gas_limit: u32, + gas_price: U256, + nonce: Option + ) -> Result> { + Self::execute_evm( + source, + value, + gas_limit, + gas_price, + nonce, + |executor| { + (executor.create_address( + evm::CreateScheme::Legacy { caller: source }, + ), executor.transact_create( + source, + value, + init, + gas_limit as usize, + )) + }, + ) + } + + /// Execute a create2 transaction on behalf of a given sender. + pub fn execute_create2( + source: H160, + init: Vec, + salt: H256, + value: U256, + gas_limit: u32, + gas_price: U256, + nonce: Option + ) -> Result> { + let code_hash = H256::from_slice(Keccak256::digest(&init).as_slice()); + Self::execute_evm( + source, + value, + gas_limit, + gas_price, + nonce, + |executor| { + (executor.create_address( + evm::CreateScheme::Create2 { caller: source, code_hash, salt }, + ), executor.transact_create2( + source, + value, + init, + salt, + gas_limit as usize, + )) + }, + ) + } + + /// Execute a call transaction on behalf of a given sender. + pub fn execute_call( + source: H160, + target: H160, + input: Vec, + value: U256, + gas_limit: u32, + gas_price: U256, + nonce: Option, + ) -> Result<(), Error> { + Self::execute_evm( + source, + value, + gas_limit, + gas_price, + nonce, + |executor| ((), executor.transact_call( + source, + target, + value, + input, + gas_limit as usize, + )), + ) + } + /// Execute an EVM operation. fn execute_evm( source: H160, -- GitLab From f6afe5b9af3d63d53ef53de23e052672d833aa30 Mon Sep 17 00:00:00 2001 From: thiolliere Date: Mon, 18 May 2020 18:43:18 +0200 Subject: [PATCH 013/280] Make decl_storage generated code respect clippy (#6065) * fix clippy for code generated by decl_storage * use as_ref --- .../src/storage/genesis_config/builder_def.rs | 10 ++++++++-- .../procedural/src/storage/storage_struct.rs | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/frame/support/procedural/src/storage/genesis_config/builder_def.rs b/frame/support/procedural/src/storage/genesis_config/builder_def.rs index d134108af9..a045794529 100644 --- a/frame/support/procedural/src/storage/genesis_config/builder_def.rs +++ b/frame/support/procedural/src/storage/genesis_config/builder_def.rs @@ -55,10 +55,16 @@ impl BuilderDef { data = Some(match &line.storage_type { StorageLineTypeDef::Simple(_) if line.is_option => quote_spanned!(builder.span() => - let data = (#builder)(self); + // NOTE: the type of `data` is specified when used later in the code + let builder: fn(&Self) -> _ = #builder; + let data = builder(self); let data = Option::as_ref(&data); ), - _ => quote_spanned!(builder.span() => let data = &(#builder)(self); ), + _ => quote_spanned!(builder.span() => + // NOTE: the type of `data` is specified when used later in the code + let builder: fn(&Self) -> _ = #builder; + let data = &builder(self); + ), }); } else if let Some(config) = &line.config { is_generic |= line.is_generic; diff --git a/frame/support/procedural/src/storage/storage_struct.rs b/frame/support/procedural/src/storage/storage_struct.rs index 6052dbfd4a..4cacb35c49 100644 --- a/frame/support/procedural/src/storage/storage_struct.rs +++ b/frame/support/procedural/src/storage/storage_struct.rs @@ -86,7 +86,10 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre Ident::new(INHERENT_INSTANCE_NAME, Span::call_site()) }; - let storage_name_str = syn::LitStr::new(&line.name.to_string(), line.name.span()); + let storage_name_bstr = syn::LitByteStr::new( + line.name.to_string().as_ref(), + line.name.span() + ); let storage_generator_trait = &line.storage_generator_trait; let storage_struct = &line.storage_struct; @@ -107,7 +110,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre } fn storage_prefix() -> &'static [u8] { - #storage_name_str.as_bytes() + #storage_name_bstr } fn from_optional_value_to_query(v: Option<#value_type>) -> Self::Query { @@ -131,7 +134,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre } fn storage_prefix() -> &'static [u8] { - #storage_name_str.as_bytes() + #storage_name_bstr } } @@ -146,7 +149,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre } fn storage_prefix() -> &'static [u8] { - #storage_name_str.as_bytes() + #storage_name_bstr } fn from_optional_value_to_query(v: Option<#value_type>) -> Self::Query { @@ -171,7 +174,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre } fn storage_prefix() -> &'static [u8] { - #storage_name_str.as_bytes() + #storage_name_bstr } } @@ -189,7 +192,7 @@ pub fn decl_and_impl(scrate: &TokenStream, def: &DeclStorageDefExt) -> TokenStre } fn storage_prefix() -> &'static [u8] { - #storage_name_str.as_bytes() + #storage_name_bstr } fn from_optional_value_to_query(v: Option<#value_type>) -> Self::Query { -- GitLab From 05579fe5d500ca08721752fbf14ce40594eaf689 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 18 May 2020 19:43:31 +0300 Subject: [PATCH 014/280] Fix benchmarks and add check so that they won't break again (#6061) * fix benchmarks and add check * address review * fix line width --- .gitlab-ci.yml | 2 ++ bin/node/testing/src/bench.rs | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 12ae9bfc61..d41a86f302 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -175,6 +175,8 @@ cargo-check-benches: <<: *docker-env script: - BUILD_DUMMY_WASM_BINARY=1 time cargo +nightly check --benches --all + - cargo run --release -p node-bench -- ::node::import::native::sr25519::transfer_keep_alive::paritydb::small + - cargo run --release -p node-bench -- ::trie::read::small - sccache -s cargo-check-subkey: diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs index 6c687d2f2a..5b8f2e2083 100644 --- a/bin/node/testing/src/bench.rs +++ b/bin/node/testing/src/bench.rs @@ -297,9 +297,8 @@ impl BenchDb { &self.keyring, ); - let version = client.runtime_version_at(&BlockId::number(0)) - .expect("There should be runtime version at 0") - .spec_version; + let runtime_version = client.runtime_version_at(&BlockId::number(0)) + .expect("There should be runtime version at 0"); let genesis_hash = client.block_hash(Zero::zero()) .expect("Database error?") @@ -364,7 +363,8 @@ impl BenchDb { }, }, }, - version, + runtime_version.spec_version, + runtime_version.transaction_version, genesis_hash, ); @@ -462,10 +462,16 @@ impl BenchKeyring { } /// Sign transaction with keypair from this keyring. - pub fn sign(&self, xt: CheckedExtrinsic, version: u32, genesis_hash: [u8; 32]) -> UncheckedExtrinsic { + pub fn sign( + &self, + xt: CheckedExtrinsic, + spec_version: u32, + tx_version: u32, + genesis_hash: [u8; 32] + ) -> UncheckedExtrinsic { match xt.signed { Some((signed, extra)) => { - let payload = (xt.function, extra.clone(), version, genesis_hash, genesis_hash); + let payload = (xt.function, extra.clone(), spec_version, tx_version, genesis_hash, genesis_hash); let key = self.accounts.get(&signed).expect("Account id not found in keyring"); let signature = payload.using_encoded(|b| { if b.len() > 256 { -- GitLab From 1208821351a89b88315947730577b923a9a81167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 18 May 2020 18:44:29 +0200 Subject: [PATCH 015/280] Include post dispatch corrected weight in extrinsic events (#6024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Include post dispatch corrected weight in extrinsic events * Drop the 'Post' from ApplyExtrinsicResultWithPostInfo to make it less verbose * Apply suggestions from code review Co-authored-by: Bastian Köcher * Use proper Event type in pallet_system tests * Add test that the actual weight is returned by events * Make fn extract_actual_weight cap at pre dispatch weight * Bump spec version Co-authored-by: Bastian Köcher Co-authored-by: Gavin Wood --- bin/node/runtime/src/lib.rs | 4 +- frame/executive/src/lib.rs | 9 +- frame/support/src/weights.rs | 37 +++- frame/system/src/lib.rs | 184 ++++++++++++++---- .../runtime/src/generic/checked_extrinsic.rs | 8 +- primitives/runtime/src/lib.rs | 4 + primitives/runtime/src/testing.rs | 8 +- primitives/runtime/src/traits.rs | 2 +- 8 files changed, 202 insertions(+), 54 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 7d877676c0..bc44bee8db 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -93,8 +93,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 248, - impl_version: 2, + spec_version: 249, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index fcef03883b..499fd3ebdf 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -119,6 +119,7 @@ use sp_std::{prelude::*, marker::PhantomData}; use frame_support::{ storage::StorageValue, weights::{GetDispatchInfo, DispatchInfo, DispatchClass}, traits::{OnInitialize, OnFinalize, OnRuntimeUpgrade, OffchainWorker}, + dispatch::PostDispatchInfo, }; use sp_runtime::{ generic::Digest, ApplyExtrinsicResult, @@ -174,7 +175,7 @@ where CheckedOf: Applyable + GetDispatchInfo, - CallOf: Dispatchable, + CallOf: Dispatchable, OriginOf: From>, UnsignedValidator: ValidateUnsigned>, { @@ -200,7 +201,7 @@ where CheckedOf: Applyable + GetDispatchInfo, - CallOf: Dispatchable, + CallOf: Dispatchable, OriginOf: From>, UnsignedValidator: ValidateUnsigned>, { @@ -368,9 +369,9 @@ where let dispatch_info = xt.get_dispatch_info(); let r = Applyable::apply::(xt, &dispatch_info, encoded_len)?; - >::note_applied_extrinsic(&r, encoded_len as u32, dispatch_info); + >::note_applied_extrinsic(&r, dispatch_info); - Ok(r) + Ok(r.map(|_| ()).map_err(|e| e.error)) } fn final_checks(header: &System::Header) { diff --git a/frame/support/src/weights.rs b/frame/support/src/weights.rs index 27f2aef586..a0d150cbe9 100644 --- a/frame/support/src/weights.rs +++ b/frame/support/src/weights.rs @@ -134,7 +134,7 @@ use sp_runtime::{ traits::SignedExtension, generic::{CheckedExtrinsic, UncheckedExtrinsic}, }; -use crate::dispatch::{DispatchErrorWithPostInfo, DispatchError}; +use crate::dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, DispatchError}; /// Re-export priority as type pub use sp_runtime::transaction_validity::TransactionPriority; @@ -281,6 +281,14 @@ impl PostDispatchInfo { } } +/// Extract the actual weight from a dispatch result if any or fall back to the default weight. +pub fn extract_actual_weight(result: &DispatchResultWithPostInfo, info: &DispatchInfo) -> Weight { + match result { + Ok(post_info) => &post_info.actual_weight, + Err(err) => &err.post_info.actual_weight, + }.unwrap_or_else(|| info.weight).min(info.weight) +} + impl From> for PostDispatchInfo { fn from(actual_weight: Option) -> Self { Self { @@ -616,4 +624,31 @@ mod tests { assert_eq!(Call::::f21().get_dispatch_info().weight, 45600); assert_eq!(Call::::f2().get_dispatch_info().class, DispatchClass::Normal); } + + #[test] + fn extract_actual_weight_works() { + let pre = DispatchInfo { + weight: 1000, + .. Default::default() + }; + assert_eq!(extract_actual_weight(&Ok(Some(7).into()), &pre), 7); + assert_eq!(extract_actual_weight(&Ok(Some(1000).into()), &pre), 1000); + assert_eq!( + extract_actual_weight(&Err(DispatchError::BadOrigin.with_weight(9)), &pre), + 9 + ); + } + + #[test] + fn extract_actual_weight_caps_at_pre_weight() { + let pre = DispatchInfo { + weight: 1000, + .. Default::default() + }; + assert_eq!(extract_actual_weight(&Ok(Some(1250).into()), &pre), 1000); + assert_eq!( + extract_actual_weight(&Err(DispatchError::BadOrigin.with_weight(1300)), &pre), + 1000 + ); + } } diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index e2516740d3..80bb03c963 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -102,7 +102,7 @@ use sp_std::marker::PhantomData; use sp_std::fmt::Debug; use sp_version::RuntimeVersion; use sp_runtime::{ - RuntimeDebug, Perbill, DispatchOutcome, DispatchError, DispatchResult, + RuntimeDebug, Perbill, DispatchError, DispatchResult, generic::{self, Era}, transaction_validity::{ ValidTransaction, TransactionPriority, TransactionLongevity, TransactionValidityError, @@ -126,8 +126,9 @@ use frame_support::{ }, weights::{ Weight, RuntimeDbWeight, DispatchInfo, PostDispatchInfo, DispatchClass, - FunctionOf, Pays, - } + FunctionOf, Pays, extract_actual_weight, + }, + dispatch::DispatchResultWithPostInfo, }; use codec::{Encode, Decode, FullCodec, EncodeLike}; @@ -1150,13 +1151,14 @@ impl Module { } /// To be called immediately after an extrinsic has been applied. - pub fn note_applied_extrinsic(r: &DispatchOutcome, _encoded_len: u32, info: DispatchInfo) { + pub fn note_applied_extrinsic(r: &DispatchResultWithPostInfo, mut info: DispatchInfo) { + info.weight = extract_actual_weight(r, &info); Self::deposit_event( match r { - Ok(()) => RawEvent::ExtrinsicSuccess(info), + Ok(_) => RawEvent::ExtrinsicSuccess(info), Err(err) => { sp_runtime::print(err); - RawEvent::ExtrinsicFailed(err.clone(), info) + RawEvent::ExtrinsicFailed(err.error, info) }, } ); @@ -1830,7 +1832,10 @@ pub(crate) mod tests { use sp_std::cell::RefCell; use sp_core::H256; use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError}; - use frame_support::{impl_outer_origin, parameter_types, assert_ok, assert_noop}; + use frame_support::{ + impl_outer_origin, parameter_types, assert_ok, assert_noop, + weights::WithPostDispatchInfo, + }; impl_outer_origin! { pub enum Origin for Test where system = super {} @@ -1894,7 +1899,7 @@ pub(crate) mod tests { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = u16; + type Event = Event; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type DbWeight = DbWeight; @@ -1909,18 +1914,8 @@ pub(crate) mod tests { type OnKilledAccount = RecordKilled; } - impl From> for u16 { - fn from(e: Event) -> u16 { - match e { - Event::::ExtrinsicSuccess(..) => 100, - Event::::ExtrinsicFailed(..) => 101, - Event::::CodeUpdated => 102, - _ => 103, - } - } - } - type System = Module; + type SysEvent = ::Event; const CALL: &::Call = &Call; @@ -1978,14 +1973,14 @@ pub(crate) mod tests { InitKind::Full, ); System::note_finished_extrinsics(); - System::deposit_event(1u16); + System::deposit_event(SysEvent::CodeUpdated); System::finalize(); assert_eq!( System::events(), vec![ EventRecord { phase: Phase::Finalization, - event: 1u16, + event: SysEvent::CodeUpdated, topics: vec![], } ] @@ -1998,22 +1993,131 @@ pub(crate) mod tests { &Default::default(), InitKind::Full, ); - System::deposit_event(32u16); + System::deposit_event(SysEvent::NewAccount(32)); System::note_finished_initialize(); - System::deposit_event(42u16); - System::note_applied_extrinsic(&Ok(()), 0, Default::default()); - System::note_applied_extrinsic(&Err(DispatchError::BadOrigin), 0, Default::default()); + System::deposit_event(SysEvent::KilledAccount(42)); + System::note_applied_extrinsic(&Ok(().into()), Default::default()); + System::note_applied_extrinsic( + &Err(DispatchError::BadOrigin.into()), + Default::default() + ); System::note_finished_extrinsics(); - System::deposit_event(3u16); + System::deposit_event(SysEvent::NewAccount(3)); System::finalize(); assert_eq!( System::events(), vec![ - EventRecord { phase: Phase::Initialization, event: 32u16, topics: vec![] }, - EventRecord { phase: Phase::ApplyExtrinsic(0), event: 42u16, topics: vec![] }, - EventRecord { phase: Phase::ApplyExtrinsic(0), event: 100u16, topics: vec![] }, - EventRecord { phase: Phase::ApplyExtrinsic(1), event: 101u16, topics: vec![] }, - EventRecord { phase: Phase::Finalization, event: 3u16, topics: vec![] } + EventRecord { + phase: Phase::Initialization, + event: SysEvent::NewAccount(32), + topics: vec![], + }, + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::KilledAccount(42), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::ExtrinsicSuccess(Default::default()), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(1), + event: SysEvent::ExtrinsicFailed( + DispatchError::BadOrigin.into(), + Default::default() + ), + topics: vec![] + }, + EventRecord { + phase: Phase::Finalization, + event: SysEvent::NewAccount(3), + topics: vec![] + }, + ] + ); + }); + } + + #[test] + fn deposit_event_uses_actual_weight() { + new_test_ext().execute_with(|| { + System::initialize( + &1, + &[0u8; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + System::note_finished_initialize(); + + let pre_info = DispatchInfo { + weight: 1000, + .. Default::default() + }; + System::note_applied_extrinsic( + &Ok(Some(300).into()), + pre_info, + ); + System::note_applied_extrinsic( + &Ok(Some(1000).into()), + pre_info, + ); + System::note_applied_extrinsic( + // values over the pre info should be capped at pre dispatch value + &Ok(Some(1200).into()), + pre_info, + ); + System::note_applied_extrinsic( + &Err(DispatchError::BadOrigin.with_weight(999)), + pre_info, + ); + + assert_eq!( + System::events(), + vec![ + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 300, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(1), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 1000, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(2), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 1000, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(3), + event: SysEvent::ExtrinsicFailed( + DispatchError::BadOrigin.into(), + DispatchInfo { + weight: 999, + .. Default::default() + }, + ), + topics: vec![] + }, ] ); }); @@ -2040,9 +2144,9 @@ pub(crate) mod tests { ]; // We deposit a few events with different sets of topics. - System::deposit_event_indexed(&topics[0..3], 1u16); - System::deposit_event_indexed(&topics[0..1], 2u16); - System::deposit_event_indexed(&topics[1..2], 3u16); + System::deposit_event_indexed(&topics[0..3], SysEvent::NewAccount(1)); + System::deposit_event_indexed(&topics[0..1], SysEvent::NewAccount(2)); + System::deposit_event_indexed(&topics[1..2], SysEvent::NewAccount(3)); System::finalize(); @@ -2052,17 +2156,17 @@ pub(crate) mod tests { vec![ EventRecord { phase: Phase::Finalization, - event: 1u16, + event: SysEvent::NewAccount(1), topics: topics[0..3].to_vec(), }, EventRecord { phase: Phase::Finalization, - event: 2u16, + event: SysEvent::NewAccount(2), topics: topics[0..1].to_vec(), }, EventRecord { phase: Phase::Finalization, - event: 3u16, + event: SysEvent::NewAccount(3), topics: topics[1..2].to_vec(), } ] @@ -2485,7 +2589,11 @@ pub(crate) mod tests { assert_eq!( System::events(), - vec![EventRecord { phase: Phase::Initialization, event: 102u16, topics: vec![] }], + vec![EventRecord { + phase: Phase::Initialization, + event: SysEvent::CodeUpdated, + topics: vec![], + }], ); }); } diff --git a/primitives/runtime/src/generic/checked_extrinsic.rs b/primitives/runtime/src/generic/checked_extrinsic.rs index 5e4150cf2b..f355308a59 100644 --- a/primitives/runtime/src/generic/checked_extrinsic.rs +++ b/primitives/runtime/src/generic/checked_extrinsic.rs @@ -19,7 +19,8 @@ //! stage. use crate::traits::{ - self, Member, MaybeDisplay, SignedExtension, Dispatchable, DispatchInfoOf, ValidateUnsigned, + self, Member, MaybeDisplay, SignedExtension, Dispatchable, DispatchInfoOf, PostDispatchInfoOf, + ValidateUnsigned, }; use crate::transaction_validity::{TransactionValidity, TransactionSource}; @@ -67,7 +68,7 @@ where self, info: &DispatchInfoOf, len: usize, - ) -> crate::ApplyExtrinsicResult { + ) -> crate::ApplyExtrinsicResultWithInfo> { let (maybe_who, pre) = if let Some((id, extra)) = self.signed { let pre = Extra::pre_dispatch(extra, &id, &self.function, info, len)?; (Some(id), pre) @@ -81,8 +82,7 @@ where Ok(info) => info, Err(err) => err.post_info, }; - let res = res.map(|_| ()).map_err(|e| e.error); - Extra::post_dispatch(pre, info, &post_info, len, &res)?; + Extra::post_dispatch(pre, info, &post_info, len, &res.map(|_| ()).map_err(|e| e.error))?; Ok(res) } } diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 361da3ee57..e2a489515f 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -536,6 +536,10 @@ pub type DispatchOutcome = Result<(), DispatchError>; /// - The extrinsic supplied a bad signature. This transaction won't become valid ever. pub type ApplyExtrinsicResult = Result; +/// Same as `ApplyExtrinsicResult` but augmented with `PostDispatchInfo` on success. +pub type ApplyExtrinsicResultWithInfo = + Result, transaction_validity::TransactionValidityError>; + /// Verify a signature on an encoded value in a lazy manner. This can be /// an optimization if the signature scheme has an "unsigned" escape hash. pub fn verify_encoded_lazy( diff --git a/primitives/runtime/src/testing.rs b/primitives/runtime/src/testing.rs index 2bb33ba6b5..1b826ace99 100644 --- a/primitives/runtime/src/testing.rs +++ b/primitives/runtime/src/testing.rs @@ -22,10 +22,10 @@ use std::{fmt::{self, Debug}, ops::Deref, cell::RefCell}; use crate::codec::{Codec, Encode, Decode}; use crate::traits::{ self, Checkable, Applyable, BlakeTwo256, OpaqueKeys, - SignedExtension, Dispatchable, DispatchInfoOf, + SignedExtension, Dispatchable, DispatchInfoOf, PostDispatchInfoOf, }; use crate::traits::ValidateUnsigned; -use crate::{generic, KeyTypeId, CryptoTypeId, ApplyExtrinsicResult}; +use crate::{generic, KeyTypeId, CryptoTypeId, ApplyExtrinsicResultWithInfo}; pub use sp_core::{H256, sr25519}; use sp_core::{crypto::{CryptoType, Dummy, key_types, Public}, U256}; use crate::transaction_validity::{TransactionValidity, TransactionValidityError, TransactionSource}; @@ -382,7 +382,7 @@ impl Applyable for TestXt where self, info: &DispatchInfoOf, len: usize, - ) -> ApplyExtrinsicResult { + ) -> ApplyExtrinsicResultWithInfo> { let maybe_who = if let Some((who, extra)) = self.signature { Extra::pre_dispatch(extra, &who, &self.call, info, len)?; Some(who) @@ -391,6 +391,6 @@ impl Applyable for TestXt where None }; - Ok(self.call.dispatch(maybe_who.into()).map(|_| ()).map_err(|e| e.error)) + Ok(self.call.dispatch(maybe_who.into())) } } diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index 345f3db76b..7e7b5558b5 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -892,7 +892,7 @@ pub trait Applyable: Sized + Send + Sync { self, info: &DispatchInfoOf, len: usize, - ) -> crate::ApplyExtrinsicResult; + ) -> crate::ApplyExtrinsicResultWithInfo>; } /// A marker trait for something that knows the type of the runtime block. -- GitLab From 12e08fd25455053e3cedc8b19beb7e77330a5713 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 18 May 2020 19:57:08 +0200 Subject: [PATCH 016/280] Upgrade to libp2p v0.19 - Changes the default PeerId representation (#6064) * Upgrade to libp2p v0.19 * Listen on IPv6 by default * Increase channels sizes * Use spec-compliant noise protocol * Show legacy PeerId * Switch order of Noise protocols * Switch to crates.io version * Fix subkey's version * Fix line width and Wasm build * I think Wasm is fixed for real this time --- Cargo.lock | 118 +++++++++++++----------- bin/node/browser-testing/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/authority-discovery/Cargo.toml | 2 +- client/cli/src/params/network_params.rs | 3 + client/network-gossip/Cargo.toml | 2 +- client/network/Cargo.toml | 7 +- client/network/src/discovery.rs | 35 +++---- client/network/src/service.rs | 15 ++- client/network/src/transport.rs | 40 ++++++-- client/network/test/Cargo.toml | 2 +- client/peerset/Cargo.toml | 2 +- client/telemetry/Cargo.toml | 2 +- primitives/consensus/common/Cargo.toml | 2 +- utils/browser/Cargo.toml | 2 +- 15 files changed, 143 insertions(+), 93 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70fb4956d4..336bc936f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -452,9 +452,9 @@ dependencies = [ [[package]] name = "bs58" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" [[package]] name = "bstr" @@ -2598,9 +2598,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ea742c86405b659c358223a8f0f9f5a9eb27bb6083894c6340959b05269662" +checksum = "3ec214d189b57e4412f079ac5a1442578d06b12ca7282ba4696104cc92ab96c1" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -2627,7 +2627,7 @@ dependencies = [ "libp2p-websocket", "libp2p-yamux", "multihash", - "parity-multiaddr 0.8.0", + "parity-multiaddr 0.9.0", "parking_lot 0.10.2", "pin-project", "smallvec 1.3.0", @@ -2636,9 +2636,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d2c17158c4dca984a77a5927aac6f0862d7f50c013470a415f93be498b5739" +checksum = "80a6000296bdbff540b6c00ef82108ef23aa68d195b9333823ea491562c338d7" dependencies = [ "asn1_der", "bs58", @@ -2652,7 +2652,7 @@ dependencies = [ "log", "multihash", "multistream-select", - "parity-multiaddr 0.8.0", + "parity-multiaddr 0.9.0", "parking_lot 0.10.2", "pin-project", "prost", @@ -2670,9 +2670,9 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329127858e4728db5ab60c33d5ae352a999325fdf190ed022ec7d3a4685ae2e6" +checksum = "67f0d915bee5d457a6d113377101e1f06e86a4286778aa4c6939553e9a4d7033" dependencies = [ "quote 1.0.3", "syn 1.0.17", @@ -2680,9 +2680,9 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad32b006ea922da8cc66e537cf2df4b0fad8ebaa467d2a8c63d7784ac252ec6" +checksum = "975c847575ef9b3d63f9c11d465e9a9b0ea940cfa408b93cc6981bbc3b1bac40" dependencies = [ "flate2", "futures 0.3.4", @@ -2691,9 +2691,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d0993481203d68e5ce2f787d033fb0cac6b850659ed6c784612db678977c71" +checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2702,9 +2702,9 @@ dependencies = [ [[package]] name = "libp2p-floodsub" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3673153ca967c179d745fadf047d069355d6669ecf7f261b450fbaebf1bffd3d" +checksum = "c6dd8cc558e0edde2d4a423d017efd6b36c1b6bf97f4304c83076895c5edaed8" dependencies = [ "cuckoofilter", "fnv", @@ -2719,9 +2719,9 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f7f3f79f060864db0317cc47641b7d35276dee52a0ffa91553fbd0c153863a3" +checksum = "ce48659363fe765c09d77eb5b2248e04362557b11bba3701f05879ad34919ccd" dependencies = [ "base64 0.11.0", "byteorder 1.3.4", @@ -2744,9 +2744,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38ca3eb807789e26f41c82ca7cd2b3843c66c5587b8b5f709a2f421f3061414" +checksum = "6a455af71c59473444eba05e83dbaa20262bdbd9b4154f22389510fbac16f201" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2760,9 +2760,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92cda1fb8149ea64d092a2b99d2bd7a2c309eee38ea322d02e4480bd6ee1759" +checksum = "41d6c1d5100973527ae70d82687465b17049c1b717a7964de38b8e65000878ff" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.4", @@ -2787,9 +2787,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e908d2aaf8ff0ec6ad1f02fe1844fd777fb0b03a68a226423630750ab99471" +checksum = "d5bc788d92111802cb0c92d2e032fa6f46333aaeb5650c2f37b5d3eba78cabe6" dependencies = [ "async-std", "data-encoding", @@ -2809,9 +2809,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0832882b06619b2e81d74e71447753ea3c068164a0bca67847d272e856a04a02" +checksum = "4095bce2100f840883f1f75dbd010c966ee4ad323ae9f82026396da5cf6cce68" dependencies = [ "bytes 0.5.4", "fnv", @@ -2825,9 +2825,9 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918e94a649e1139c24ee9f1f8c1f2adaba6d157b9471af787f2d9beac8c29c77" +checksum = "84fd504e27b0eadd451e06b67694ef714bd8374044e7db339bb0cdb83755ddf4" dependencies = [ "curve25519-dalek", "futures 0.3.4", @@ -2846,9 +2846,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9bfbf87eebb492d040f9899c5c81c9738730465ac5e78d9b7a7d086d0f07230" +checksum = "82930c36490008b1ef2f26c237a2c205c38ef6edc263738d0528b842740ab09f" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2861,9 +2861,9 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabb00553a49bf6d4a8ce362f6eefac410227a14d03c3acffbb8cc3f022ea019" +checksum = "ad28fe7beaa3e516ee8ba2af8c4f6820f269afa60d661831e879f2afea64f4a0" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -2879,9 +2879,9 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f81b8b37ff529e1f51c20c396dac657def2108da174c1d27e57e72c9fe2d411" +checksum = "dabaa2194e1ce3c51cd78d734dd4c81dc5c7b150b309cbf9029df044034ac261" dependencies = [ "futures 0.3.4", "log", @@ -2893,9 +2893,9 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a0509a7e47245259954fef58b85b81bf4d29ae33a4365e38d718a866698774" +checksum = "22e30b873276846181fa9c04126653678c2797cb1556361d01b7b7fd6bf24682" dependencies = [ "aes-ctr", "ctr", @@ -2923,9 +2923,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44ab289ae44cc691da0a6fe96aefa43f26c86c6c7813998e203f6d80f1860f18" +checksum = "b4a8101a0e0d5f04562137a476bf5f5423cd5bdab2f7e43a75909668e63cb102" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2938,9 +2938,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37ea44823d3ed223e4605da94b50177bc520f05ae2452286700549a32d81669" +checksum = "4462bd96b97cac3f3a83b1b343ad3c3460cebbc8d929c040b1520c30e3611e08" dependencies = [ "async-std", "futures 0.3.4", @@ -2949,13 +2949,14 @@ dependencies = [ "ipnet", "libp2p-core", "log", + "socket2", ] [[package]] name = "libp2p-uds" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "281c18ea2faacb9c8a6ff76c4405df5918d9a263770e3847bf03f099abadc010" +checksum = "69660d235449bb2d99333b9892c9176d06fd2b380490cb8213feb5b015678cf1" dependencies = [ "async-std", "futures 0.3.4", @@ -2965,9 +2966,9 @@ dependencies = [ [[package]] name = "libp2p-wasm-ext" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ac7dbde0f88cad191dcdfd073b8bae28d01823e8ca313f117b6ecb914160c3" +checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" dependencies = [ "futures 0.3.4", "js-sys", @@ -2979,9 +2980,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6874c9069ce93d899df9dc7b29f129c706b2a0fdc048f11d878935352b580190" +checksum = "085fbe4c05c4116c2164ab4d5a521eb6e00516c444f61b3ee9f68c7b1e53580b" dependencies = [ "async-tls", "bytes 0.5.4", @@ -3000,9 +3001,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f91aea50f6571e0bc6c058dc0e9b270afd41ec28dd94e9e4bf607e78b9ab87" +checksum = "0b305d3a8981e68f11c0e17f2d11d5c52fae95e0d7c283f9e462b5b2dab413b2" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -3269,9 +3270,9 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" [[package]] name = "multihash" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47fbc227f7e2b1cb701f95404579ecb2668abbdd3c7ef7a6cbb3cc0d3b236869" +checksum = "ae32179a9904ccc6e063de8beee7f5dd55fae85ecb851ca923d55722bc28cf5d" dependencies = [ "blake2b_simd", "blake2s_simd", @@ -4773,9 +4774,9 @@ dependencies = [ [[package]] name = "parity-multiaddr" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db35e222f783ef4e6661873f6c165c4eb7b65e0c408349818517d5705c2d7d3" +checksum = "12ca96399f4a01aa89c59220c4f52ac371940eb4e53e3ce990da796f364bdf69" dependencies = [ "arrayref", "bs58", @@ -6461,6 +6462,7 @@ dependencies = [ "assert_matches", "async-std", "bitflags", + "bs58", "bytes 0.5.4", "derive_more", "either", @@ -7218,6 +7220,18 @@ dependencies = [ "x25519-dalek", ] +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.8", +] + [[package]] name = "soketto" version = "0.3.2" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 3885aa3b09..04d48c8cbd 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" -libp2p = { version = "0.18.0", default-features = false } +libp2p = { version = "0.19.0", default-features = false } jsonrpc-core = "14.0.5" serde = "1.0.106" serde_json = "1.0.48" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 488b0f7fbc..9c4ca36e16 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -33,7 +33,7 @@ derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" -libp2p = "0.18.1" +libp2p = "0.19.0" serde_json = "1.0" [features] diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index d2b74b51e1..69d5c51846 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", default-features = false, version = "1 derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.18.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } +libp2p = { version = "0.19.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} prost = "0.6.1" diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index cd64783ec9..e328c32a40 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -123,6 +123,9 @@ impl NetworkParams { let listen_addresses = if self.listen_addr.is_empty() { vec![ + Multiaddr::empty() + .with(Protocol::Ip6([0, 0, 0, 0, 0, 0, 0, 0].into())) + .with(Protocol::Tcp(port)), Multiaddr::empty() .with(Protocol::Ip4([0, 0, 0, 0].into())) .with(Protocol::Tcp(port)), diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index d46e3420ea..10b4a9446e 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.18.1", default-features = false, features = ["websocket"] } +libp2p = { version = "0.19.0", default-features = false, features = ["websocket"] } log = "0.4.8" lru = "0.4.3" sc-network = { version = "0.8.0-dev", path = "../network" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 537ab43672..01121b922d 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -19,6 +19,7 @@ prost-build = "0.6.1" [dependencies] bitflags = "1.2.0" +bs58 = "0.3.1" bytes = "0.5.0" codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } derive_more = "0.99.2" @@ -62,15 +63,15 @@ wasm-timer = "0.2" zeroize = "1.0.0" [dependencies.libp2p] -version = "0.18.1" +version = "0.19.0" default-features = false -features = ["websocket", "kad", "mdns", "ping", "identify", "mplex", "yamux", "noise"] +features = ["websocket", "kad", "mdns", "ping", "identify", "mplex", "yamux", "noise", "tcp-async-std"] [dev-dependencies] async-std = "1.5" assert_matches = "1.3" env_logger = "0.7.0" -libp2p = { version = "0.18.1", default-features = false, features = ["secio"] } +libp2p = { version = "0.19.0", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } diff --git a/client/network/src/discovery.rs b/client/network/src/discovery.rs index 00adc56ec5..dd5e093876 100644 --- a/client/network/src/discovery.rs +++ b/client/network/src/discovery.rs @@ -52,7 +52,7 @@ use ip_network::IpNetwork; use libp2p::core::{connection::{ConnectionId, ListenerId}, ConnectedPoint, Multiaddr, PeerId, PublicKey}; use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters, ProtocolsHandler}; use libp2p::swarm::protocols_handler::multi::MultiHandler; -use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent, Quorum, Record}; +use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent, QueryResult, Quorum, Record}; use libp2p::kad::GetClosestPeersError; use libp2p::kad::handler::KademliaHandler; use libp2p::kad::QueryId; @@ -177,7 +177,7 @@ impl DiscoveryConfig { kademlias: self.kademlias, next_kad_random_query: Delay::new(Duration::new(0, 0)), duration_to_next_kad: Duration::from_secs(1), - discoveries: VecDeque::new(), + pending_events: VecDeque::new(), local_peer_id: self.local_peer_id, num_connections: 0, allow_private_ipv4: self.allow_private_ipv4, @@ -213,8 +213,8 @@ pub struct DiscoveryBehaviour { next_kad_random_query: Delay, /// After `next_kad_random_query` triggers, the next one triggers after this duration. duration_to_next_kad: Duration, - /// Discovered nodes to return. - discoveries: VecDeque, + /// Events to return in priority when polled. + pending_events: VecDeque, /// Identity of our local node. local_peer_id: PeerId, /// Number of nodes we're currently connected to. @@ -248,7 +248,7 @@ impl DiscoveryBehaviour { for k in self.kademlias.values_mut() { k.add_address(&peer_id, addr.clone()) } - self.discoveries.push_back(peer_id.clone()); + self.pending_events.push_back(DiscoveryOut::Discovered(peer_id.clone())); self.user_defined.push((peer_id, addr)); } } @@ -272,7 +272,7 @@ impl DiscoveryBehaviour { /// A corresponding `ValueFound` or `ValueNotFound` event will later be generated. pub fn get_value(&mut self, key: &record::Key) { for k in self.kademlias.values_mut() { - k.get_record(key, Quorum::One) + k.get_record(key, Quorum::One); } } @@ -282,7 +282,10 @@ impl DiscoveryBehaviour { /// A corresponding `ValuePut` or `ValuePutFailed` event will later be generated. pub fn put_value(&mut self, key: record::Key, value: Vec) { for k in self.kademlias.values_mut() { - k.put_record(Record::new(key.clone(), value.clone()), Quorum::All) + if let Err(e) = k.put_record(Record::new(key.clone(), value.clone()), Quorum::All) { + warn!(target: "sub-libp2p", "Libp2p => Failed to put record: {:?}", e); + self.pending_events.push_back(DiscoveryOut::ValuePutFailed(key.clone())); + } } } @@ -528,8 +531,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { >, > { // Immediately process the content of `discovered`. - if let Some(peer_id) = self.discoveries.pop_front() { - let ev = DiscoveryOut::Discovered(peer_id); + if let Some(ev) = self.pending_events.pop_front() { return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } @@ -541,7 +543,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { "Libp2p <= Starting random Kademlia request for {:?}", random_peer_id); for k in self.kademlias.values_mut() { - k.get_closest_peers(random_peer_id.clone()) + k.get_closest_peers(random_peer_id.clone()); } true } else { @@ -578,7 +580,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { let ev = DiscoveryOut::Discovered(peer); return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } - KademliaEvent::GetClosestPeersResult(res) => { + KademliaEvent::QueryResult { result: QueryResult::GetClosestPeers(res), .. } => { match res { Err(GetClosestPeersError::Timeout { key, peers }) => { debug!(target: "sub-libp2p", @@ -596,7 +598,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { } } } - KademliaEvent::GetRecordResult(res) => { + KademliaEvent::QueryResult { result: QueryResult::GetRecord(res), .. } => { let ev = match res { Ok(ok) => { let results = ok.records @@ -619,7 +621,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { }; return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } - KademliaEvent::PutRecordResult(res) => { + KademliaEvent::QueryResult { result: QueryResult::PutRecord(res), .. } => { let ev = match res { Ok(ok) => DiscoveryOut::ValuePut(ok.key), Err(e) => { @@ -630,7 +632,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { }; return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } - KademliaEvent::RepublishRecordResult(res) => { + KademliaEvent::QueryResult { result: QueryResult::RepublishRecord(res), .. } => { match res { Ok(ok) => debug!(target: "sub-libp2p", "Libp2p => Record republished: {:?}", @@ -675,9 +677,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { continue; } - self.discoveries.extend(list.map(|(peer_id, _)| peer_id)); - if let Some(peer_id) = self.discoveries.pop_front() { - let ev = DiscoveryOut::Discovered(peer_id); + self.pending_events.extend(list.map(|(peer_id, _)| DiscoveryOut::Discovered(peer_id))); + if let Some(ev) = self.pending_events.pop_front() { return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } }, diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 4b05c26335..331580ecb4 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -59,10 +59,11 @@ use sp_runtime::{ }; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; use std::{ - borrow::Cow, + borrow::{Borrow, Cow}, collections::HashSet, fs, io, marker::PhantomData, + num:: NonZeroUsize, pin::Pin, str, sync::{ @@ -185,7 +186,13 @@ impl NetworkWorker { let local_identity = params.network_config.node_key.clone().into_keypair()?; let local_public = local_identity.public(); let local_peer_id = local_public.clone().into_peer_id(); - info!(target: "sub-libp2p", "🏷 Local node identity is: {}", local_peer_id.to_base58()); + let local_peer_id_legacy = bs58::encode(Borrow::<[u8]>::borrow(&local_peer_id)).into_string(); + info!( + target: "sub-libp2p", + "🏷 Local node identity is: {} (legacy representation: {})", + local_peer_id.to_base58(), + local_peer_id_legacy + ); // Initialize the metrics. let metrics = match ¶ms.metrics_registry { @@ -287,7 +294,9 @@ impl NetworkWorker { transport::build_transport(local_identity, config_mem, config_wasm, flowctrl) }; let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id.clone()) - .peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER); + .peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER) + .notify_handler_buffer_size(NonZeroUsize::new(16).expect("16 != 0; qed")) + .connection_event_buffer_size(128); if let Some(spawner) = params.executor { struct SpawnImpl(F); impl + Send>>)> Executor for SpawnImpl { diff --git a/client/network/src/transport.rs b/client/network/src/transport.rs index c241d25034..7b42211433 100644 --- a/client/network/src/transport.rs +++ b/client/network/src/transport.rs @@ -18,11 +18,14 @@ use futures::prelude::*; use libp2p::{ InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport, + core::{ + self, either::{EitherError, EitherOutput}, muxing::StreamMuxerBox, + transport::{boxed::Boxed, OptionalTransport}, upgrade + }, mplex, identity, bandwidth, wasm_ext, noise }; #[cfg(not(target_os = "unknown"))] use libp2p::{tcp, dns, websocket}; -use libp2p::core::{self, upgrade, transport::boxed::Boxed, transport::OptionalTransport, muxing::StreamMuxerBox}; use std::{io, sync::Arc, time::Duration, usize}; pub use self::bandwidth::BandwidthSinks; @@ -42,14 +45,22 @@ pub fn build_transport( ) -> (Boxed<(PeerId, StreamMuxerBox), io::Error>, Arc) { // Build configuration objects for encryption mechanisms. let noise_config = { - let noise_keypair = noise::Keypair::new().into_authentic(&keypair) - // For more information about this panic, see in "On the Importance of Checking - // Cryptographic Protocols for Faults" by Dan Boneh, Richard A. DeMillo, - // and Richard J. Lipton. + // For more information about these two panics, see in "On the Importance of + // Checking Cryptographic Protocols for Faults" by Dan Boneh, Richard A. DeMillo, + // and Richard J. Lipton. + let noise_keypair_legacy = noise::Keypair::::new().into_authentic(&keypair) .expect("can only fail in case of a hardware bug; since this signing is performed only \ once and at initialization, we're taking the bet that the inconvenience of a very \ rare panic here is basically zero"); - noise::NoiseConfig::ix(noise_keypair) + let noise_keypair_spec = noise::Keypair::::new().into_authentic(&keypair) + .expect("can only fail in case of a hardware bug; since this signing is performed only \ + once and at initialization, we're taking the bet that the inconvenience of a very \ + rare panic here is basically zero"); + + core::upgrade::SelectUpgrade::new( + noise::NoiseConfig::xx(noise_keypair_spec), + noise::NoiseConfig::ix(noise_keypair_legacy) + ) }; // Build configuration objects for multiplexing mechanisms. @@ -97,11 +108,22 @@ pub fn build_transport( // Encryption let transport = transport.and_then(move |stream, endpoint| { core::upgrade::apply(stream, noise_config, endpoint, upgrade::Version::V1) - .and_then(|(remote_id, out)| async move { - let remote_key = match remote_id { - noise::RemoteIdentity::IdentityKey(key) => key, + .map_err(|err| + err.map_err(|err| match err { + EitherError::A(err) => err, + EitherError::B(err) => err, + }) + ) + .and_then(|result| async move { + let remote_key = match &result { + EitherOutput::First((noise::RemoteIdentity::IdentityKey(key), _)) => key.clone(), + EitherOutput::Second((noise::RemoteIdentity::IdentityKey(key), _)) => key.clone(), _ => return Err(upgrade::UpgradeError::Apply(noise::NoiseError::InvalidKey)) }; + let out = match result { + EitherOutput::First((_, o)) => o, + EitherOutput::Second((_, o)) => o, + }; Ok((out, remote_key.into_peer_id())) }) }); diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 5abc9a1ea7..58ad79163b 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" -libp2p = { version = "0.18.1", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.19.0", default-features = false, features = ["libp2p-websocket"] } sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } sc-client-api = { version = "2.0.0-dev", path = "../../api" } diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index b4c5005324..f47ea7a70e 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" -libp2p = { version = "0.18.1", default-features = false } +libp2p = { version = "0.19.0", default-features = false } sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index e2c08babf3..8ab0f828d1 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" wasm-timer = "0.2.0" -libp2p = { version = "0.18.1", default-features = false, features = ["websocket", "wasm-ext", "tcp", "dns"] } +libp2p = { version = "0.19.0", default-features = false, features = ["websocket", "wasm-ext", "tcp-async-std", "dns"] } log = "0.4.8" pin-project = "0.4.6" rand = "0.7.2" diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index ec05e9fba1..6fda982dae 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -libp2p = { version = "0.18.1", default-features = false } +libp2p = { version = "0.19.0", default-features = false } log = "0.4.8" sp-core = { path= "../../core", version = "2.0.0-dev"} sp-inherents = { version = "2.0.0-dev", path = "../../inherents" } diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index ec37c8b139..ca69206ce3 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] futures = { version = "0.3", features = ["compat"] } futures01 = { package = "futures", version = "0.1.29" } log = "0.4.8" -libp2p-wasm-ext = { version = "0.18.0", features = ["websocket"] } +libp2p-wasm-ext = { version = "0.19.0", features = ["websocket"] } console_error_panic_hook = "0.1.6" console_log = "0.1.2" js-sys = "0.3.34" -- GitLab From bc413d19e5c63378e9a02faa566aa6571cfe2933 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Mon, 18 May 2020 16:13:30 -0400 Subject: [PATCH 017/280] Make GrandpaBlockImport public (#6068) --- client/finality-grandpa/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index ab73abc3de..41dedc2246 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -118,6 +118,7 @@ mod voting_rule; pub use authorities::SharedAuthoritySet; pub use finality_proof::{FinalityProofProvider, StorageAndProofProvider}; +pub use import::GrandpaBlockImport; pub use justification::GrandpaJustification; pub use light_import::light_block_import; pub use voting_rule::{ @@ -127,7 +128,6 @@ pub use finality_grandpa::voter::report; use aux_schema::PersistentData; use environment::{Environment, VoterSetState}; -use import::GrandpaBlockImport; use until_imported::UntilGlobalMessageBlocksImported; use communication::{NetworkBridge, Network as NetworkT}; use sp_finality_grandpa::{AuthorityList, AuthorityPair, AuthoritySignature, SetId}; -- GitLab From 0947c5b72cebee15e22870cd0087d58727f91aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 19 May 2020 02:16:48 +0100 Subject: [PATCH 018/280] service: fix RPC unsafe exposed address detection (#6070) --- client/service/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index feae664301..9e97bb5756 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -553,8 +553,8 @@ fn start_rpc_servers sc_rpc_server::RpcHandler, methods: &RpcMethods) -> sc_rpc::DenyUnsafe { - let is_exposed_addr = addr.map(|x| x.ip().is_loopback()).unwrap_or(false); + fn deny_unsafe(addr: &SocketAddr, methods: &RpcMethods) -> sc_rpc::DenyUnsafe { + let is_exposed_addr = !addr.ip().is_loopback(); match (is_exposed_addr, methods) { | (_, RpcMethods::Unsafe) | (false, RpcMethods::Auto) => sc_rpc::DenyUnsafe::No, @@ -568,7 +568,7 @@ fn start_rpc_servers sc_rpc_server::RpcHandler sc_rpc_server::RpcHandler Date: Tue, 19 May 2020 11:36:59 +0200 Subject: [PATCH 019/280] Clean a number of sp_io imports (#6072) --- frame/aura/Cargo.toml | 8 +++----- frame/authority-discovery/Cargo.toml | 6 ++---- frame/authorship/Cargo.toml | 8 ++++---- frame/babe/Cargo.toml | 4 ++-- frame/balances/Cargo.toml | 3 +-- frame/benchmarking/Cargo.toml | 2 +- frame/executive/Cargo.toml | 2 +- frame/offences/benchmarking/Cargo.toml | 4 +--- frame/session/Cargo.toml | 5 ++--- frame/session/benchmarking/Cargo.toml | 2 +- frame/society/Cargo.toml | 3 +-- frame/support/test/Cargo.toml | 2 +- frame/system/Cargo.toml | 2 +- frame/system/benchmarking/Cargo.toml | 2 +- frame/vesting/Cargo.toml | 3 +-- 15 files changed, 23 insertions(+), 33 deletions(-) diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index cd7f17ba13..5a8445d270 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -15,20 +15,20 @@ targets = ["x86_64-unknown-linux-gnu"] sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -sp-consensus-aura = { path = "../../primitives/consensus/aura", default-features = false, version = "0.8.0-dev"} +sp-consensus-aura = { version = "0.8.0-dev", path = "../../primitives/consensus/aura", default-features = false } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } [dev-dependencies] +sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } lazy_static = "1.4.0" parking_lot = "0.10.0" @@ -38,8 +38,6 @@ std = [ "sp-application-crypto/std", "codec/std", "sp-inherents/std", - "sp-io/std", - "sp-core/std", "sp-std/std", "serde", "sp-runtime/std", diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 134dff4017..24cbdbde0a 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] sp-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authority-discovery" } sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } pallet-session = { version = "2.0.0-dev", features = ["historical" ], path = "../session", default-features = false } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } [features] @@ -33,8 +33,6 @@ std = [ "sp-application-crypto/std", "sp-authority-discovery/std", "codec/std", - "sp-core/std", - "sp-io/std", "sp-std/std", "serde", "pallet-session/std", diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index d5769783a9..43a48b02a0 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -12,7 +12,6 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } sp-authorship = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authorship" } @@ -20,19 +19,20 @@ sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primit sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} impl-trait-for-tuples = "0.1.3" +[dev-dependencies] +sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } + [features] default = ["std"] std = [ "codec/std", - "sp-core/std", "sp-inherents/std", "sp-runtime/std", "sp-std/std", "frame-support/std", "frame-system/std", - "sp-io/std", "sp-authorship/std", ] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 685e508a3d..23946203f3 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -26,7 +26,7 @@ sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../ pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/babe" } sp-consensus-vrf = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } [dev-dependencies] sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } @@ -34,8 +34,8 @@ sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } [features] default = ["std"] std = [ - "serde", "codec/std", + "serde", "sp-std/std", "sp-application-crypto/std", "frame-support/std", diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 3916d5605f..18b6fe8ced 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } [dev-dependencies] +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } @@ -31,7 +31,6 @@ std = [ "serde", "codec/std", "sp-std/std", - "sp-io/std", "sp-runtime/std", "frame-benchmarking/std", "frame-support/std", diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index fcc8e0bf92..dd7de60c57 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -19,7 +19,7 @@ sp-api = { version = "2.0.0-dev", path = "../../primitives/api", default-feature sp-runtime-interface = { version = "2.0.0-dev", path = "../../primitives/runtime-interface", default-features = false } sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime", default-features = false } sp-std = { version = "2.0.0-dev", path = "../../primitives/std", default-features = false } -sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", path = "../../primitives/io", default-features = false } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 84918f7361..edfd207bc9 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -24,7 +24,7 @@ sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primiti [dev-dependencies] hex-literal = "0.2.1" sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io ={ path = "../../primitives/io", version = "2.0.0-dev"} +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } pallet-indices = { version = "2.0.0-dev", path = "../indices" } pallet-balances = { version = "2.0.0-dev", path = "../balances" } pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index ff77497db0..e9cd2be005 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -23,7 +23,6 @@ pallet-im-online = { version = "2.0.0-dev", default-features = false, path = ".. pallet-offences = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } pallet-session = { version = "2.0.0-dev", default-features = false, path = "../../session" } pallet-staking = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-io = { path = "../../../primitives/io", default-features = false, version = "2.0.0-dev"} sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/staking" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } @@ -34,7 +33,7 @@ pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/rew pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } serde = { version = "1.0.101" } sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } [features] default = ["std"] @@ -52,5 +51,4 @@ std = [ "sp-runtime/std", "sp-staking/std", "sp-std/std", - "sp-io/std", ] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index b03eea494a..8031804fcd 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -21,12 +21,12 @@ sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../pr frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } -sp-trie = { optional = true, path = "../../primitives/trie", default-features = false, version = "2.0.0-dev"} -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} +sp-trie = { version = "2.0.0-dev", optional = true, default-features = false, path = "../../primitives/trie" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" @@ -43,5 +43,4 @@ std = [ "sp-staking/std", "pallet-timestamp/std", "sp-trie/std", - "sp-io/std", ] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index d263e1af9a..20ef9c6eb6 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -25,7 +25,7 @@ serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/reward-curve" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} +sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } pallet-balances = { version = "2.0.0-dev", path = "../../balances" } diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index 24380aff55..86c800d571 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-dev"} sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } @@ -23,6 +22,7 @@ rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } pallet-balances = { version = "2.0.0-dev", path = "../balances" } [features] @@ -30,7 +30,6 @@ default = ["std"] std = [ "codec/std", "serde", - "sp-io/std", "sp-runtime/std", "rand_chacha/std", "sp-std/std", diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 59014d893c..e676106e17 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ path = "../../../primitives/io", default-features = false , version = "2.0.0-dev"} +sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io", default-features = false } sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../../primitives/state-machine" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../" } sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/inherents" } diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 099290f2c7..254938df2b 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -16,7 +16,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { path = "../../primitives/io", default-features = false, version = "2.0.0-dev"} +sp-io = { version = "2.0.0-dev", path = "../../primitives/io", default-features = false } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 60ee030011..7ce619f413 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -22,7 +22,7 @@ sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../pr [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ path = "../../../primitives/io", version = "2.0.0-dev"} +sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 96282db360..70c97006df 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -16,13 +16,13 @@ serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] +sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } pallet-balances = { version = "2.0.0-dev", path = "../balances" } sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } @@ -34,7 +34,6 @@ std = [ "serde", "codec/std", "sp-std/std", - "sp-io/std", "sp-runtime/std", "frame-support/std", "frame-system/std", -- GitLab From 812d94d42c6d6d7fd28cf18a08d84f14c49d8544 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Tue, 19 May 2020 17:06:52 +0200 Subject: [PATCH 020/280] Detect obsolete block responses (#6077) --- client/network/src/behaviour.rs | 4 +- client/network/src/protocol.rs | 97 +++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/client/network/src/behaviour.rs b/client/network/src/behaviour.rs index 2394d22319..dec8788f3f 100644 --- a/client/network/src/behaviour.rs +++ b/client/network/src/behaviour.rs @@ -311,13 +311,13 @@ impl NetworkBehaviourEventProcess { + block_requests::Event::Response { peer, original_request: _, response, request_duration } => { self.events.push_back(BehaviourOut::RequestFinished { peer: peer.clone(), protocol: self.block_requests.protocol_name().to_vec(), request_duration, }); - let ev = self.substrate.on_block_response(peer, original_request, response); + let ev = self.substrate.on_block_response(peer, response); self.inject_event(ev); } block_requests::Event::RequestCancelled { peer, request_duration, .. } | diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 421035e570..8a71494d82 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -548,30 +548,6 @@ impl Protocol { self.sync.update_chain_info(&info.best_hash, info.best_number); } - /// Accepts a response from the legacy substream and determines what the corresponding - /// request was. - fn handle_response( - &mut self, - who: PeerId, - response: &message::BlockResponse - ) -> Option> { - if let Some(ref mut peer) = self.context_data.peers.get_mut(&who) { - if peer.obsolete_requests.remove(&response.id).is_some() { - trace!(target: "sync", "Ignoring obsolete block response packet from {} ({})", who, response.id); - return None; - } - // Clear the request. If the response is invalid peer will be disconnected anyway. - let request = peer.block_request.take(); - if request.as_ref().map_or(false, |(_, r)| r.id == response.id) { - return request.map(|(_, r)| r) - } - trace!(target: "sync", "Unexpected response packet from {} ({})", who, response.id); - self.peerset_handle.report_peer(who.clone(), rep::UNEXPECTED_RESPONSE); - self.behaviour.disconnect_peer(&who); - } - None - } - fn update_peer_info(&mut self, who: &PeerId) { if let Some(info) = self.sync.peer_info(who) { if let Some(ref mut peer) = self.context_data.peers.get_mut(who) { @@ -609,11 +585,9 @@ impl Protocol { GenericMessage::Status(s) => return self.on_status_message(who, s), GenericMessage::BlockRequest(r) => self.on_block_request(who, r), GenericMessage::BlockResponse(r) => { - if let Some(request) = self.handle_response(who.clone(), &r) { - let outcome = self.on_block_response(who.clone(), request, r); - self.update_peer_info(&who); - return outcome - } + let outcome = self.on_block_response(who.clone(), r); + self.update_peer_info(&who); + return outcome }, GenericMessage::BlockAnnounce(announce) => { let outcome = self.on_block_announce(who.clone(), announce); @@ -705,6 +679,10 @@ impl Protocol { ); } + fn update_peer_request(&mut self, who: &PeerId, request: &mut message::BlockRequest) { + update_peer_request::(&mut self.context_data.peers, who, request) + } + /// Called when a new peer is connected pub fn on_peer_connected(&mut self, who: PeerId) { trace!(target: "sync", "Connecting {}", who); @@ -844,9 +822,34 @@ impl Protocol { pub fn on_block_response( &mut self, peer: PeerId, - request: message::BlockRequest, response: message::BlockResponse, ) -> CustomMessageOutcome { + let request = if let Some(ref mut p) = self.context_data.peers.get_mut(&peer) { + if p.obsolete_requests.remove(&response.id).is_some() { + trace!(target: "sync", "Ignoring obsolete block response packet from {} ({})", peer, response.id); + return CustomMessageOutcome::None; + } + // Clear the request. If the response is invalid peer will be disconnected anyway. + match p.block_request.take() { + Some((_, request)) if request.id == response.id => request, + Some(_) => { + trace!(target: "sync", "Ignoring obsolete block response packet from {} ({})", peer, response.id); + return CustomMessageOutcome::None; + } + None => { + trace!(target: "sync", "Unexpected response packet from unknown peer {}", peer); + self.behaviour.disconnect_peer(&peer); + self.peerset_handle.report_peer(peer, rep::UNEXPECTED_RESPONSE); + return CustomMessageOutcome::None; + } + } + } else { + trace!(target: "sync", "Unexpected response packet from unknown peer {}", peer); + self.behaviour.disconnect_peer(&peer); + self.peerset_handle.report_peer(peer, rep::UNEXPECTED_RESPONSE); + return CustomMessageOutcome::None; + }; + let blocks_range = || match ( response.blocks.first().and_then(|b| b.header.as_ref().map(|h| h.number())), response.blocks.last().and_then(|b| b.header.as_ref().map(|h| h.number())), @@ -891,8 +894,9 @@ impl Protocol { match self.sync.on_block_data(&peer, Some(request), response) { Ok(sync::OnBlockData::Import(origin, blocks)) => CustomMessageOutcome::BlockImport(origin, blocks), - Ok(sync::OnBlockData::Request(peer, req)) => { + Ok(sync::OnBlockData::Request(peer, mut req)) => { if self.use_new_block_requests_protocol { + self.update_peer_request(&peer, &mut req); CustomMessageOutcome::BlockRequest { target: peer, request: req, @@ -1076,8 +1080,9 @@ impl Protocol { if info.roles.is_full() { match self.sync.new_peer(who.clone(), info.best_hash, info.best_number) { Ok(None) => (), - Ok(Some(req)) => { + Ok(Some(mut req)) => { if self.use_new_block_requests_protocol { + self.update_peer_request(&who, &mut req); self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { target: who.clone(), request: req, @@ -1413,8 +1418,9 @@ impl Protocol { Ok(sync::OnBlockData::Import(origin, blocks)) => { CustomMessageOutcome::BlockImport(origin, blocks) }, - Ok(sync::OnBlockData::Request(peer, req)) => { + Ok(sync::OnBlockData::Request(peer, mut req)) => { if self.use_new_block_requests_protocol { + self.update_peer_request(&peer, &mut req); CustomMessageOutcome::BlockRequest { target: peer, request: req, @@ -1520,8 +1526,9 @@ impl Protocol { ); for result in results { match result { - Ok((id, req)) => { + Ok((id, mut req)) => { if self.use_new_block_requests_protocol { + update_peer_request(&mut self.context_data.peers, &id, &mut req); self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { target: id, request: req, @@ -1935,6 +1942,22 @@ fn send_request( send_message::(behaviour, stats, who, None, message) } +fn update_peer_request( + peers: &mut HashMap>, + who: &PeerId, + request: &mut message::BlockRequest, +) { + if let Some(ref mut peer) = peers.get_mut(who) { + request.id = peer.next_request_id; + peer.next_request_id += 1; + if let Some((timestamp, request)) = peer.block_request.take() { + trace!(target: "sync", "Request {} for {} is now obsolete.", request.id, who); + peer.obsolete_requests.insert(request.id, timestamp); + } + peer.block_request = Some((Instant::now(), request.clone())); + } +} + fn send_message( behaviour: &mut GenericProto, stats: &mut HashMap<&'static str, PacketStats>, @@ -2012,8 +2035,9 @@ impl NetworkBehaviour for Protocol { self.propagate_extrinsics(); } - for (id, r) in self.sync.block_requests() { + for (id, mut r) in self.sync.block_requests() { if self.use_new_block_requests_protocol { + update_peer_request(&mut self.context_data.peers, &id, &mut r); let event = CustomMessageOutcome::BlockRequest { target: id.clone(), request: r, @@ -2029,8 +2053,9 @@ impl NetworkBehaviour for Protocol { ) } } - for (id, r) in self.sync.justification_requests() { + for (id, mut r) in self.sync.justification_requests() { if self.use_new_block_requests_protocol { + update_peer_request(&mut self.context_data.peers, &id, &mut r); let event = CustomMessageOutcome::BlockRequest { target: id, request: r, -- GitLab From f34752327957f55c9076660b9bfb7ce750719b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 20 May 2020 11:39:45 +0200 Subject: [PATCH 021/280] Refactor OverlayedChanges (#5989) * Hide internal structure of OverlayChanges * Fix tests for OverlayChanges refactor * Do not clone pending changes Discarding prospective changes should be equivalent as a state machine is not to be called with peding changes. This will be replaced by a storage transaction that is rolled back before executing the call the second time removing this constraint. * Doc fixes * Remove overlong line * Revert "Do not clone pending changes" This reverts commit 4799491f4ac16f8517287a0fcf4a3f84ad56f46e. * Deduplicate chield tries returned from child_infos() * Remove redundant type annotation * Avoid changing the storage root in tests * Preserve extrinsic indices in trie build test * Swap order of comitted and prospective in fn child_infos This is only for consistency and does not impact the result. * Rename set_pending to replace_pending for clearity --- .../state-machine/src/changes_trie/build.rs | 138 +++++++----------- primitives/state-machine/src/ext.rs | 49 +++---- primitives/state-machine/src/lib.rs | 36 ++--- .../state-machine/src/overlayed_changes.rs | 68 +++++++-- primitives/state-machine/src/testing.rs | 24 ++- 5 files changed, 150 insertions(+), 165 deletions(-) diff --git a/primitives/state-machine/src/changes_trie/build.rs b/primitives/state-machine/src/changes_trie/build.rs index f8eabfce9b..f9698f1a31 100644 --- a/primitives/state-machine/src/changes_trie/build.rs +++ b/primitives/state-machine/src/changes_trie/build.rs @@ -17,7 +17,7 @@ //! Structures and functions required to build changes trie for given block. -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; use std::collections::btree_map::Entry; use codec::{Decode, Encode}; use hash_db::Hasher; @@ -33,7 +33,7 @@ use crate::{ input::{InputKey, InputPair, DigestIndex, ExtrinsicIndex, ChildIndex}, }, }; -use sp_core::storage::{ChildInfo, ChildType, PrefixedStorageKey}; +use sp_core::storage::{ChildInfo, PrefixedStorageKey}; /// Prepare input pairs for building a changes trie of given block. /// @@ -106,20 +106,18 @@ fn prepare_extrinsics_input<'a, B, H, Number>( H: Hasher + 'a, Number: BlockNumber, { - - let mut children_info = BTreeSet::::new(); let mut children_result = BTreeMap::new(); - for (_storage_key, (_map, child_info)) in changes.prospective.children_default.iter() - .chain(changes.committed.children_default.iter()) { - children_info.insert(child_info.clone()); - } - for child_info in children_info { + + for child_info in changes.child_infos() { let child_index = ChildIndex:: { block: block.clone(), storage_key: child_info.prefixed_storage_key(), }; - let iter = prepare_extrinsics_input_inner(backend, block, changes, Some(child_info))?; + let iter = prepare_extrinsics_input_inner( + backend, block, changes, + Some(child_info.clone()) + )?; children_result.insert(child_index, iter); } @@ -139,19 +137,8 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>( H: Hasher, Number: BlockNumber, { - let (committed, prospective) = if let Some(child_info) = child_info.as_ref() { - match child_info.child_type() { - ChildType::ParentKeyId => ( - changes.committed.children_default.get(child_info.storage_key()).map(|c| &c.0), - changes.prospective.children_default.get(child_info.storage_key()).map(|c| &c.0), - ), - } - } else { - (Some(&changes.committed.top), Some(&changes.prospective.top)) - }; - committed.iter().flat_map(|c| c.iter()) - .chain(prospective.iter().flat_map(|c| c.iter())) - .filter(|( _, v)| v.extrinsics.is_some()) + changes.changes(child_info.as_ref()) + .filter(|( _, v)| v.extrinsics().is_some()) .try_fold(BTreeMap::new(), |mut map: BTreeMap<&[u8], (ExtrinsicIndex, Vec)>, (k, v)| { match map.entry(k) { Entry::Vacant(entry) => { @@ -172,9 +159,10 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>( } }; - let extrinsics = v.extrinsics.as_ref() + let extrinsics = v.extrinsics() .expect("filtered by filter() call above; qed") - .iter().cloned().collect(); + .cloned() + .collect(); entry.insert((ExtrinsicIndex { block: block.clone(), key: k.to_vec(), @@ -185,9 +173,8 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>( // AND we are checking it before insertion let extrinsics = &mut entry.get_mut().1; extrinsics.extend( - v.extrinsics.as_ref() + v.extrinsics() .expect("filtered by filter() call above; qed") - .iter() .cloned() ); extrinsics.sort_unstable(); @@ -341,13 +328,10 @@ fn prepare_digest_input<'a, H, Number>( #[cfg(test)] mod test { - use codec::Encode; use sp_core::Blake2Hasher; - use sp_core::storage::well_known_keys::EXTRINSIC_INDEX; use crate::InMemoryBackend; use crate::changes_trie::{RootsStorage, Configuration, storage::InMemoryStorage}; use crate::changes_trie::build_cache::{IncompleteCacheAction, IncompleteCachedBuildData}; - use crate::overlayed_changes::{OverlayedValue, OverlayedChangeSet}; use super::*; fn prepare_for_build(zero: u64) -> ( @@ -367,8 +351,6 @@ mod test { (vec![105], vec![255]), ].into_iter().collect::>().into(); let prefixed_child_trie_key1 = child_info_1.prefixed_storage_key(); - let child_trie_key1 = child_info_1.storage_key().to_vec(); - let child_trie_key2 = child_info_2.storage_key().to_vec(); let storage = InMemoryStorage::with_inputs(vec![ (zero + 1, vec![ InputPair::ExtrinsicIndex(ExtrinsicIndex { block: zero + 1, key: vec![100] }, vec![1, 3]), @@ -418,58 +400,41 @@ mod test { ]), ]), ]); - let changes = OverlayedChanges { - prospective: OverlayedChangeSet { top: vec![ - (vec![100], OverlayedValue { - value: Some(vec![200]), - extrinsics: Some(vec![0, 2].into_iter().collect()) - }), - (vec![103], OverlayedValue { - value: None, - extrinsics: Some(vec![0, 1].into_iter().collect()) - }), - ].into_iter().collect(), - children_default: vec![ - (child_trie_key1.clone(), (vec![ - (vec![100], OverlayedValue { - value: Some(vec![200]), - extrinsics: Some(vec![0, 2].into_iter().collect()) - }) - ].into_iter().collect(), child_info_1.to_owned())), - (child_trie_key2, (vec![ - (vec![100], OverlayedValue { - value: Some(vec![200]), - extrinsics: Some(vec![0, 2].into_iter().collect()) - }) - ].into_iter().collect(), child_info_2.to_owned())), - ].into_iter().collect() - }, - committed: OverlayedChangeSet { top: vec![ - (EXTRINSIC_INDEX.to_vec(), OverlayedValue { - value: Some(3u32.encode()), - extrinsics: None, - }), - (vec![100], OverlayedValue { - value: Some(vec![202]), - extrinsics: Some(vec![3].into_iter().collect()) - }), - (vec![101], OverlayedValue { - value: Some(vec![203]), - extrinsics: Some(vec![1].into_iter().collect()) - }), - ].into_iter().collect(), - children_default: vec![ - (child_trie_key1, (vec![ - (vec![100], OverlayedValue { - value: Some(vec![202]), - extrinsics: Some(vec![3].into_iter().collect()) - }) - ].into_iter().collect(), child_info_1.to_owned())), - ].into_iter().collect(), - }, - collect_extrinsics: true, - stats: Default::default(), - }; + + let mut changes = OverlayedChanges::default(); + changes.set_collect_extrinsics(true); + + changes.set_extrinsic_index(1); + changes.set_storage(vec![101], Some(vec![203])); + + changes.set_extrinsic_index(3); + changes.set_storage(vec![100], Some(vec![202])); + changes.set_child_storage(&child_info_1, vec![100], Some(vec![202])); + + changes.commit_prospective(); + + changes.set_extrinsic_index(0); + changes.set_storage(vec![100], Some(vec![0])); + changes.set_extrinsic_index(2); + changes.set_storage(vec![100], Some(vec![200])); + + changes.set_extrinsic_index(0); + changes.set_storage(vec![103], Some(vec![0])); + changes.set_extrinsic_index(1); + changes.set_storage(vec![103], None); + + changes.set_extrinsic_index(0); + changes.set_child_storage(&child_info_1, vec![100], Some(vec![0])); + changes.set_extrinsic_index(2); + changes.set_child_storage(&child_info_1, vec![100], Some(vec![200])); + + changes.set_extrinsic_index(0); + changes.set_child_storage(&child_info_2, vec![100], Some(vec![0])); + changes.set_extrinsic_index(2); + changes.set_child_storage(&child_info_2, vec![100], Some(vec![200])); + + changes.set_extrinsic_index(1); + let config = Configuration { digest_interval: 4, digest_levels: 2 }; (backend, storage, changes, config) @@ -667,10 +632,7 @@ mod test { let (backend, storage, mut changes, config) = prepare_for_build(zero); // 110: missing from backend, set to None in overlay - changes.prospective.top.insert(vec![110], OverlayedValue { - value: None, - extrinsics: Some(vec![1].into_iter().collect()) - }); + changes.set_storage(vec![110], None); let parent = AnchorBlockId { hash: Default::default(), number: zero + 3 }; let changes_trie_nodes = prepare_input( diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index e4c619efe3..25c20644f7 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -147,8 +147,7 @@ where self.backend.pairs().iter() .map(|&(ref k, ref v)| (k.to_vec(), Some(v.to_vec()))) - .chain(self.overlay.committed.top.clone().into_iter().map(|(k, v)| (k, v.value))) - .chain(self.overlay.prospective.top.clone().into_iter().map(|(k, v)| (k, v.value))) + .chain(self.overlay.changes(None).map(|(k, v)| (k.clone(), v.value().cloned()))) .collect::>() .into_iter() .filter_map(|(k, maybe_val)| maybe_val.map(|val| (k, val))) @@ -293,7 +292,7 @@ where match (next_backend_key, next_overlay_key_change) { (Some(backend_key), Some(overlay_key)) if &backend_key[..] < overlay_key.0 => Some(backend_key), (backend_key, None) => backend_key, - (_, Some(overlay_key)) => if overlay_key.1.value.is_some() { + (_, Some(overlay_key)) => if overlay_key.1.value().is_some() { Some(overlay_key.0.to_vec()) } else { self.next_storage_key(&overlay_key.0[..]) @@ -317,7 +316,7 @@ where match (next_backend_key, next_overlay_key_change) { (Some(backend_key), Some(overlay_key)) if &backend_key[..] < overlay_key.0 => Some(backend_key), (backend_key, None) => backend_key, - (_, Some(overlay_key)) => if overlay_key.1.value.is_some() { + (_, Some(overlay_key)) => if overlay_key.1.value().is_some() { Some(overlay_key.0.to_vec()) } else { self.next_child_storage_key( @@ -479,18 +478,12 @@ where root.encode() } else { - if let Some(child_info) = self.overlay.default_child_info(storage_key).cloned() { + if let Some(child_info) = self.overlay.default_child_info(storage_key) { let (root, is_empty, _) = { - let delta = self.overlay.committed.children_default.get(storage_key) - .into_iter() - .flat_map(|(map, _)| map.clone().into_iter().map(|(k, v)| (k, v.value))) - .chain( - self.overlay.prospective.children_default.get(storage_key) - .into_iter() - .flat_map(|(map, _)| map.clone().into_iter().map(|(k, v)| (k, v.value))) - ); - - self.backend.child_storage_root(&child_info, delta) + let delta = self.overlay.changes(Some(child_info)) + .map(|(k, v)| (k.clone(), v.value().cloned())); + + self.backend.child_storage_root(child_info, delta) }; let root = root.encode(); @@ -677,28 +670,19 @@ mod tests { changes_trie::{ Configuration as ChangesTrieConfiguration, InMemoryStorage as TestChangesTrieStorage, - }, InMemoryBackend, overlayed_changes::OverlayedValue, + }, InMemoryBackend, }; type TestBackend = InMemoryBackend; type TestExt<'a> = Ext<'a, Blake2Hasher, u64, TestBackend>; fn prepare_overlay_with_changes() -> OverlayedChanges { - OverlayedChanges { - prospective: vec![ - (EXTRINSIC_INDEX.to_vec(), OverlayedValue { - value: Some(3u32.encode()), - extrinsics: Some(vec![1].into_iter().collect()) - }), - (vec![1], OverlayedValue { - value: Some(vec![100].into_iter().collect()), - extrinsics: Some(vec![1].into_iter().collect()) - }), - ].into_iter().collect(), - committed: Default::default(), - collect_extrinsics: true, - stats: Default::default(), - } + let mut changes = OverlayedChanges::default(); + changes.set_collect_extrinsics(true); + changes.set_extrinsic_index(1); + changes.set_storage(vec![1], Some(vec![100])); + changes.set_storage(EXTRINSIC_INDEX.to_vec(), Some(3u32.encode())); + changes } fn prepare_offchain_overlay_with_changes() -> OffchainOverlayedChanges { @@ -755,7 +739,8 @@ mod tests { let mut overlay = prepare_overlay_with_changes(); let mut offchain_overlay = prepare_offchain_overlay_with_changes(); let mut cache = StorageTransactionCache::default(); - overlay.prospective.top.get_mut(&vec![1]).unwrap().value = None; + overlay.set_collect_extrinsics(false); + overlay.set_storage(vec![1], None); let storage = TestChangesTrieStorage::with_blocks(vec![(99, Default::default())]); let state = Some(ChangesTrieState::new(changes_trie_config(), Zero::zero(), &storage)); let backend = TestBackend::default(); diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index e9367cbec5..3a54ef08f3 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -28,7 +28,6 @@ use sp_core::{ storage::ChildInfo, NativeOrEncoded, NeverNativeValue, hexdisplay::HexDisplay, traits::{CodeExecutor, CallInWasmExt, RuntimeCode}, }; -use overlayed_changes::OverlayedChangeSet; use sp_externalities::Extensions; pub mod backend; @@ -336,7 +335,6 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where fn execute_call_with_both_strategy( &mut self, mut native_call: Option, - orig_prospective: OverlayedChangeSet, on_consensus_failure: Handler, ) -> CallResult where @@ -347,10 +345,11 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where CallResult, ) -> CallResult { + let pending_changes = self.overlay.clone_pending(); let (result, was_native) = self.execute_aux(true, native_call.take()); if was_native { - self.overlay.prospective = orig_prospective.clone(); + self.overlay.replace_pending(pending_changes); let (wasm_result, _) = self.execute_aux( false, native_call, @@ -372,12 +371,12 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where fn execute_call_with_native_else_wasm_strategy( &mut self, mut native_call: Option, - orig_prospective: OverlayedChangeSet, ) -> CallResult where R: Decode + Encode + PartialEq, NC: FnOnce() -> result::Result + UnwindSafe, { + let pending_changes = self.overlay.clone_pending(); let (result, was_native) = self.execute_aux( true, native_call.take(), @@ -386,7 +385,7 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where if !was_native || result.is_ok() { result } else { - self.overlay.prospective = orig_prospective.clone(); + self.overlay.replace_pending(pending_changes); let (wasm_result, _) = self.execute_aux( false, native_call, @@ -421,20 +420,16 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where self.overlay.set_collect_extrinsics(changes_tries_enabled); let result = { - let orig_prospective = self.overlay.prospective.clone(); - match manager { ExecutionManager::Both(on_consensus_failure) => { self.execute_call_with_both_strategy( native_call.take(), - orig_prospective, on_consensus_failure, ) }, ExecutionManager::NativeElseWasm => { self.execute_call_with_native_else_wasm_strategy( native_call.take(), - orig_prospective, ) }, ExecutionManager::AlwaysWasm(trust_level) => { @@ -754,7 +749,6 @@ where mod tests { use std::collections::BTreeMap; use codec::Encode; - use overlayed_changes::OverlayedValue; use super::*; use super::ext::Ext; use super::changes_trie::Configuration as ChangesTrieConfig; @@ -977,21 +971,16 @@ mod tests { ]; let mut state = InMemoryBackend::::from(initial); let backend = state.as_trie_backend().unwrap(); - let mut overlay = OverlayedChanges { - committed: map![ - b"aba".to_vec() => OverlayedValue::from(Some(b"1312".to_vec())), - b"bab".to_vec() => OverlayedValue::from(Some(b"228".to_vec())) - ], - prospective: map![ - b"abd".to_vec() => OverlayedValue::from(Some(b"69".to_vec())), - b"bbd".to_vec() => OverlayedValue::from(Some(b"42".to_vec())) - ], - ..Default::default() - }; - let mut offchain_overlay = Default::default(); + let mut overlay = OverlayedChanges::default(); + overlay.set_storage(b"aba".to_vec(), Some(b"1312".to_vec())); + overlay.set_storage(b"bab".to_vec(), Some(b"228".to_vec())); + overlay.commit_prospective(); + overlay.set_storage(b"abd".to_vec(), Some(b"69".to_vec())); + overlay.set_storage(b"bbd".to_vec(), Some(b"42".to_vec())); { + let mut offchain_overlay = Default::default(); let mut cache = StorageTransactionCache::default(); let mut ext = Ext::new( &mut overlay, @@ -1006,7 +995,8 @@ mod tests { overlay.commit_prospective(); assert_eq!( - overlay.committed, + overlay.changes(None).map(|(k, v)| (k.clone(), v.value().cloned())) + .collect::>(), map![ b"abc".to_vec() => None.into(), b"abb".to_vec() => None.into(), diff --git a/primitives/state-machine/src/overlayed_changes.rs b/primitives/state-machine/src/overlayed_changes.rs index 55d4e8db88..2da063c96e 100644 --- a/primitives/state-machine/src/overlayed_changes.rs +++ b/primitives/state-machine/src/overlayed_changes.rs @@ -30,7 +30,7 @@ use crate::{ use std::iter::FromIterator; use std::collections::{HashMap, BTreeMap, BTreeSet}; use codec::{Decode, Encode}; -use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo}; +use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo, ChildType}; use sp_core::offchain::storage::OffchainOverlayedChanges; use std::{mem, ops}; @@ -55,13 +55,13 @@ pub type ChildStorageCollection = Vec<(StorageKey, StorageCollection)>; #[derive(Debug, Default, Clone)] pub struct OverlayedChanges { /// Changes that are not yet committed. - pub(crate) prospective: OverlayedChangeSet, + prospective: OverlayedChangeSet, /// Committed changes. - pub(crate) committed: OverlayedChangeSet, + committed: OverlayedChangeSet, /// True if extrinsics stats must be collected. - pub(crate) collect_extrinsics: bool, + collect_extrinsics: bool, /// Collect statistic on this execution. - pub(crate) stats: StateMachineStats, + stats: StateMachineStats, } /// The storage value, used inside OverlayedChanges. @@ -69,10 +69,10 @@ pub struct OverlayedChanges { #[cfg_attr(test, derive(PartialEq))] pub struct OverlayedValue { /// Current value. None if value has been deleted. - pub value: Option, + value: Option, /// The set of extrinsic indices where the values has been changed. /// Is filled only if runtime has announced changes trie support. - pub extrinsics: Option>, + extrinsics: Option>, } /// Prospective or committed overlayed change set. @@ -80,9 +80,9 @@ pub struct OverlayedValue { #[cfg_attr(test, derive(PartialEq))] pub struct OverlayedChangeSet { /// Top level storage changes. - pub top: BTreeMap, + top: BTreeMap, /// Child storage changes. The map key is the child storage key without the common prefix. - pub children_default: HashMap, ChildInfo)>, + children_default: HashMap, ChildInfo)>, } /// A storage changes structure that can be generated by the data collected in [`OverlayedChanges`]. @@ -187,6 +187,18 @@ impl FromIterator<(StorageKey, OverlayedValue)> for OverlayedChangeSet { } } +impl OverlayedValue { + /// The most recent value contained in this overlay. + pub fn value(&self) -> Option<&StorageValue> { + self.value.as_ref() + } + + /// List of indices of extrinsics which modified the value using this overlay. + pub fn extrinsics(&self) -> Option> { + self.extrinsics.as_ref().map(|v| v.iter()) + } +} + impl OverlayedChangeSet { /// Whether the change set is empty. pub fn is_empty(&self) -> bool { @@ -499,6 +511,44 @@ impl OverlayedChanges { ) } + /// Get an iterator over all pending and committed child tries in the overlay. + pub fn child_infos(&self) -> impl IntoIterator { + self.committed.children_default.iter() + .chain(self.prospective.children_default.iter()) + .map(|(_, v)| &v.1).collect::>() + } + + /// Get an iterator over all pending and committed changes. + /// + /// Supplying `None` for `child_info` will only return changes that are in the top + /// trie. Specifying some `child_info` will return only the changes in that + /// child trie. + pub fn changes(&self, child_info: Option<&ChildInfo>) + -> impl Iterator + { + let (committed, prospective) = if let Some(child_info) = child_info { + match child_info.child_type() { + ChildType::ParentKeyId => ( + self.committed.children_default.get(child_info.storage_key()).map(|c| &c.0), + self.prospective.children_default.get(child_info.storage_key()).map(|c| &c.0), + ), + } + } else { + (Some(&self.committed.top), Some(&self.prospective.top)) + }; + committed.into_iter().flatten().chain(prospective.into_iter().flatten()) + } + + /// Return a clone of the currently pending changes. + pub fn clone_pending(&self) -> OverlayedChangeSet { + self.prospective.clone() + } + + /// Replace the currently pending changes. + pub fn replace_pending(&mut self, pending: OverlayedChangeSet) { + self.prospective = pending; + } + /// Convert this instance with all changes into a [`StorageChanges`] instance. pub fn into_storage_changes< B: Backend, H: Hasher, N: BlockNumber diff --git a/primitives/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs index 47108b884a..71124a68bb 100644 --- a/primitives/state-machine/src/testing.rs +++ b/primitives/state-machine/src/testing.rs @@ -136,21 +136,19 @@ impl TestExternalities /// Return a new backend with all pending value. pub fn commit_all(&self) -> InMemoryBackend { - let top: Vec<_> = self.overlay.committed.top.clone().into_iter() - .chain(self.overlay.prospective.top.clone().into_iter()) - .map(|(k, v)| (k, v.value)).collect(); + let top: Vec<_> = self.overlay.changes(None) + .map(|(k, v)| (k.clone(), v.value().cloned())) + .collect(); let mut transaction = vec![(None, top)]; - self.overlay.committed.children_default.clone().into_iter() - .chain(self.overlay.prospective.children_default.clone().into_iter()) - .for_each(|(_storage_key, (map, child_info))| { - transaction.push(( - Some(child_info), - map.into_iter() - .map(|(k, v)| (k, v.value)) - .collect::>(), - )) - }); + for child_info in self.overlay.child_infos() { + transaction.push(( + Some(child_info.clone()), + self.overlay.changes(Some(child_info)) + .map(|(k, v)| (k.clone(), v.value().cloned())) + .collect(), + )) + } self.backend.update(transaction) } -- GitLab From 4269e2308eca48a90e724890c900f0421b667fcc Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Wed, 20 May 2020 11:43:33 +0200 Subject: [PATCH 022/280] Bump wasmtime version (#6081) --- Cargo.lock | 16 ++++++++-------- client/executor/wasmtime/Cargo.toml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 336bc936f8..42a3c10cbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8303,9 +8303,9 @@ version = "1.0.6" [[package]] name = "substrate-wasmtime" -version = "0.16.0-threadsafe.3" +version = "0.16.0-threadsafe.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b0d8eca5d0186e98c8d13399423853e2356b593e028b53e43b2aa35e9105a82" +checksum = "6bd62264edc1a5f3ef44d86fb0c11c9fb142894b9a2da034f34afae482080d7a" dependencies = [ "anyhow", "backtrace", @@ -8326,9 +8326,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-jit" -version = "0.16.0-threadsafe.3" +version = "0.16.0-threadsafe.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e95772b1778186e4f5c9ae9148bab9911cddf563805a403dee418780e2ed14b4" +checksum = "4ce43c159d4f3ef6b19641e1ae045847fd202d8e2cc74df7ccb2b6475e069d4a" dependencies = [ "anyhow", "cfg-if", @@ -8353,9 +8353,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-profiling" -version = "0.16.0-threadsafe.3" +version = "0.16.0-threadsafe.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8a0bf9ca20bee7d83338470247a3f1823158382ebd51fadefcc986e0a6c3de" +checksum = "c77f0ce539b5a09a54dc80a1cf0c7cd7e694df11029354fe50a2d5fe889bdb97" dependencies = [ "anyhow", "cfg-if", @@ -8372,9 +8372,9 @@ dependencies = [ [[package]] name = "substrate-wasmtime-runtime" -version = "0.16.0-threadsafe.3" +version = "0.16.0-threadsafe.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a559895fe1efab16d1c490199225ae35c153ed432ef87ebc177fb37edbd20c7c" +checksum = "46516af0a64a7d9b652c5aa7436b6ce13edfa54435a66ef177fc02d2283e2dc2" dependencies = [ "backtrace", "cc", diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index f7f236cb6b..e7f19a6c1b 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -21,8 +21,8 @@ sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-in sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } -wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.3" } -wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.3" } +wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.4" } +wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.4" } wasmtime-environ = "0.16" cranelift-wasm = "0.63" cranelift-codegen = "0.63" -- GitLab From a67dcfb281ee54f3bd9a4fc217134d7f7da0e9ee Mon Sep 17 00:00:00 2001 From: Dmitry Kashitsyn Date: Wed, 20 May 2020 17:28:13 +0700 Subject: [PATCH 023/280] Refactor resource and error handling in wasm (#6074) * Refactor resource and error handling in wasm * Fixes based on review --- client/executor/common/src/sandbox.rs | 35 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/client/executor/common/src/sandbox.rs b/client/executor/common/src/sandbox.rs index d897ef583c..37860474cb 100644 --- a/client/executor/common/src/sandbox.rs +++ b/client/executor/common/src/sandbox.rs @@ -237,21 +237,33 @@ impl<'a, FE: SandboxCapabilities + 'a> Externals for GuestExternals<'a, FE> { .supervisor_externals .allocate_memory(invoke_args_len) .map_err(|_| trap("Can't allocate memory in supervisor for the arguments"))?; - self + + let deallocate = |this: &mut GuestExternals, ptr, fail_msg| { + this + .supervisor_externals + .deallocate_memory(ptr) + .map_err(|_| trap(fail_msg)) + }; + + if self .supervisor_externals .write_memory(invoke_args_ptr, &invoke_args_data) - .map_err(|_| trap("Can't write invoke args into memory"))?; + .is_err() + { + deallocate(self, invoke_args_ptr, "Failed dealloction after failed write of invoke arguments")?; + return Err(trap("Can't write invoke args into memory")); + } + let result = self.supervisor_externals.invoke( &self.sandbox_instance.dispatch_thunk, invoke_args_ptr, invoke_args_len, state, func_idx, - )?; - self - .supervisor_externals - .deallocate_memory(invoke_args_ptr) - .map_err(|_| trap("Can't deallocate memory for dispatch thunk's invoke arguments"))?; + ); + + deallocate(self, invoke_args_ptr, "Can't deallocate memory for dispatch thunk's invoke arguments")?; + let result = result?; // dispatch_thunk returns pointer to serialized arguments. // Unpack pointer and len of the serialized result data. @@ -265,12 +277,11 @@ impl<'a, FE: SandboxCapabilities + 'a> Externals for GuestExternals<'a, FE> { let serialized_result_val = self.supervisor_externals .read_memory(serialized_result_val_ptr, serialized_result_val_len) - .map_err(|_| trap("Can't read the serialized result from dispatch thunk"))?; - self.supervisor_externals - .deallocate_memory(serialized_result_val_ptr) - .map_err(|_| trap("Can't deallocate memory for dispatch thunk's result"))?; + .map_err(|_| trap("Can't read the serialized result from dispatch thunk")); - deserialize_result(&serialized_result_val) + deallocate(self, serialized_result_val_ptr, "Can't deallocate memory for dispatch thunk's result") + .and_then(|_| serialized_result_val) + .and_then(|serialized_result_val| deserialize_result(&serialized_result_val)) } } -- GitLab From 899a44864900cb691c99f7421bc85e4118bca93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Wed, 20 May 2020 15:05:16 +0200 Subject: [PATCH 024/280] Maximum extrinsic weight limit (#6067) * Only check single extrinsics weight limit in validate_transaction. * Add missing parameter to all pallets. * Add tests, fix default configuration. * Bump spec version. * Use AvailableBlockRation to calculate MaxExtrinsicWeight --- .../pallets/template/src/mock.rs | 1 + bin/node-template/runtime/src/lib.rs | 8 ++ bin/node/runtime/src/lib.rs | 10 ++- frame/assets/src/lib.rs | 1 + frame/aura/src/mock.rs | 1 + frame/authority-discovery/src/lib.rs | 1 + frame/authorship/src/lib.rs | 1 + frame/babe/src/mock.rs | 1 + frame/balances/src/lib.rs | 1 + frame/balances/src/tests_composite.rs | 1 + frame/balances/src/tests_local.rs | 1 + frame/benchmarking/src/tests.rs | 1 + frame/collective/src/lib.rs | 1 + frame/contracts/src/tests.rs | 1 + frame/democracy/src/tests.rs | 1 + frame/elections-phragmen/src/lib.rs | 1 + frame/elections/src/mock.rs | 1 + frame/example-offchain-worker/src/tests.rs | 1 + frame/example/src/lib.rs | 1 + frame/executive/src/lib.rs | 1 + frame/finality-tracker/src/lib.rs | 1 + frame/generic-asset/src/lib.rs | 1 + frame/generic-asset/src/mock.rs | 1 + frame/grandpa/src/mock.rs | 1 + frame/identity/src/lib.rs | 1 + frame/im-online/src/mock.rs | 1 + frame/indices/src/mock.rs | 1 + frame/membership/src/lib.rs | 1 + frame/nicks/src/lib.rs | 1 + frame/offences/benchmarking/src/mock.rs | 1 + frame/offences/src/mock.rs | 1 + frame/randomness-collective-flip/src/lib.rs | 1 + frame/recovery/src/mock.rs | 1 + frame/scheduler/src/lib.rs | 1 + frame/scored-pool/src/mock.rs | 1 + frame/session/benchmarking/src/mock.rs | 1 + frame/session/src/mock.rs | 1 + frame/society/src/mock.rs | 1 + frame/staking/fuzzer/src/mock.rs | 1 + frame/staking/src/mock.rs | 1 + frame/sudo/src/mock.rs | 1 + frame/system/benches/bench.rs | 1 + frame/system/benchmarking/src/mock.rs | 1 + frame/system/src/lib.rs | 77 ++++++++++++++++--- frame/timestamp/src/lib.rs | 1 + frame/transaction-payment/src/lib.rs | 1 + frame/treasury/src/tests.rs | 1 + frame/utility/src/tests.rs | 1 + frame/vesting/src/lib.rs | 1 + test-utils/runtime/src/lib.rs | 1 + 50 files changed, 129 insertions(+), 13 deletions(-) diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs index 33c66e2a4e..4eed0e1e75 100644 --- a/bin/node-template/pallets/template/src/mock.rs +++ b/bin/node-template/pallets/template/src/mock.rs @@ -39,6 +39,7 @@ impl system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index b1b73f3b49..2037f7bb77 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -16,6 +16,7 @@ use sp_runtime::{ }; use sp_runtime::traits::{ BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount, NumberFor, + Saturating, }; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -127,6 +128,9 @@ parameter_types! { /// We allow for 2 seconds of compute with a 6 second average block time. pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); + /// Assume 10% of weight for average on_initialize calls. + pub const MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; } @@ -164,6 +168,10 @@ impl system::Trait for Runtime { /// The base weight of any extrinsic processed by the runtime, independent of the /// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...) type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + /// The maximum weight that a single extrinsic of `Normal` dispatch class can have, + /// idependent of the logic of that extrinsics. (Roughly max block weight - average on + /// initialize cost). + type MaximumExtrinsicWeight = MaximumExtrinsicWeight; /// Maximum size of all encoded transactions (in bytes) that are allowed in one block. type MaximumBlockLength = MaximumBlockLength; /// Portion of the block weight that is available to all normal transactions. diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index bc44bee8db..834aabbef8 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -47,7 +47,7 @@ use sp_runtime::curve::PiecewiseLinear; use sp_runtime::transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority}; use sp_runtime::traits::{ self, BlakeTwo256, Block as BlockT, StaticLookup, SaturatedConversion, - ConvertInto, OpaqueKeys, NumberFor, + ConvertInto, OpaqueKeys, NumberFor, Saturating, }; use sp_version::RuntimeVersion; #[cfg(any(feature = "std", test))] @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 249, - impl_version: 1, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; @@ -130,9 +130,12 @@ parameter_types! { pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; + pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); + /// Assume 10% of weight for average on_initialize calls. + pub const MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } impl frame_system::Trait for Runtime { @@ -151,6 +154,7 @@ impl frame_system::Trait for Runtime { type DbWeight = RocksDbWeight; type BlockExecutionWeight = BlockExecutionWeight; type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + type MaximumExtrinsicWeight = MaximumExtrinsicWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = Version; diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 6211694c94..48806e30cd 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -317,6 +317,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index db4448bdef..84d895cd06 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -61,6 +61,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index 022ce36281..1b7915ce3a 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -158,6 +158,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index 7605e78097..b9b30bf411 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -433,6 +433,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index bdeb284887..de00928171 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -73,6 +73,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type ModuleToIndex = (); diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index d10909b739..d5f9aab37b 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -863,6 +863,7 @@ impl, I: Instance> frame_system::Trait for ElevatedTrait { type DbWeight = T::DbWeight; type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = T::MaximumBlockWeight; type MaximumBlockLength = T::MaximumBlockLength; type AvailableBlockRatio = T::AvailableBlockRatio; type Version = T::Version; diff --git a/frame/balances/src/tests_composite.rs b/frame/balances/src/tests_composite.rs index e78171376c..78cdc3838b 100644 --- a/frame/balances/src/tests_composite.rs +++ b/frame/balances/src/tests_composite.rs @@ -71,6 +71,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/balances/src/tests_local.rs b/frame/balances/src/tests_local.rs index 736afe9cba..4b0700748c 100644 --- a/frame/balances/src/tests_local.rs +++ b/frame/balances/src/tests_local.rs @@ -71,6 +71,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index 8418cb9081..dc9d160b5e 100644 --- a/frame/benchmarking/src/tests.rs +++ b/frame/benchmarking/src/tests.rs @@ -82,6 +82,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type MaximumBlockLength = (); type AvailableBlockRatio = (); type Version = (); diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 132320c7a3..3d6e41d98d 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -984,6 +984,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 218a5c9937..4dfaa8035f 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -103,6 +103,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index d46214a169..d039f3382f 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -100,6 +100,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 4e2ae09afa..0c35283e1a 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -1087,6 +1087,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/elections/src/mock.rs b/frame/elections/src/mock.rs index c433f8d036..9971dac572 100644 --- a/frame/elections/src/mock.rs +++ b/frame/elections/src/mock.rs @@ -54,6 +54,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/example-offchain-worker/src/tests.rs b/frame/example-offchain-worker/src/tests.rs index d94a989067..30c9c22593 100644 --- a/frame/example-offchain-worker/src/tests.rs +++ b/frame/example-offchain-worker/src/tests.rs @@ -69,6 +69,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/example/src/lib.rs b/frame/example/src/lib.rs index 23f21e30dc..6b3d6b5e5f 100644 --- a/frame/example/src/lib.rs +++ b/frame/example/src/lib.rs @@ -754,6 +754,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index 499fd3ebdf..9ac323828d 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -560,6 +560,7 @@ mod tests { type DbWeight = DbWeight; type BlockExecutionWeight = BlockExecutionWeight; type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = RuntimeVersion; diff --git a/frame/finality-tracker/src/lib.rs b/frame/finality-tracker/src/lib.rs index e5065cd917..a9cf9c2b70 100644 --- a/frame/finality-tracker/src/lib.rs +++ b/frame/finality-tracker/src/lib.rs @@ -267,6 +267,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/generic-asset/src/lib.rs b/frame/generic-asset/src/lib.rs index f2507669e5..646e217366 100644 --- a/frame/generic-asset/src/lib.rs +++ b/frame/generic-asset/src/lib.rs @@ -1127,6 +1127,7 @@ impl frame_system::Trait for ElevatedTrait { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = T::MaximumBlockWeight; type MaximumBlockLength = T::MaximumBlockLength; type AvailableBlockRatio = T::AvailableBlockRatio; type Version = T::Version; diff --git a/frame/generic-asset/src/mock.rs b/frame/generic-asset/src/mock.rs index 3e3bd892d5..04fd565091 100644 --- a/frame/generic-asset/src/mock.rs +++ b/frame/generic-asset/src/mock.rs @@ -60,6 +60,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type BlockHashCount = BlockHashCount; diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 13608db42a..2b9b25eee6 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -109,6 +109,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index 37ed8f8672..6a69797c90 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -1189,6 +1189,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 9d67e78eef..01e84102b1 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -119,6 +119,7 @@ impl frame_system::Trait for Runtime { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index 62f6c93cae..90ac1ae81b 100644 --- a/frame/indices/src/mock.rs +++ b/frame/indices/src/mock.rs @@ -65,6 +65,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 9dd1c8ecfc..29c42f990c 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -318,6 +318,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 205544cdd2..11b23443d6 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -285,6 +285,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 76cd017690..fa6e247abd 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -57,6 +57,7 @@ impl frame_system::Trait for Test { type OnKilledAccount = (Balances,); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 3a407654a2..0f5036edc5 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -104,6 +104,7 @@ impl frame_system::Trait for Runtime { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 16f54fbc44..4a851c926f 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -173,6 +173,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 6345eac5a0..aae9b2b75c 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -79,6 +79,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 08f53cc592..4fefe12a8e 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -502,6 +502,7 @@ mod tests { type DbWeight = RocksDbWeight; type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index aae86973a9..1b61bb1884 100644 --- a/frame/scored-pool/src/mock.rs +++ b/frame/scored-pool/src/mock.rs @@ -70,6 +70,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index 9ec017cf22..5c0e40096e 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/frame/session/benchmarking/src/mock.rs @@ -73,6 +73,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type AvailableBlockRatio = (); type MaximumBlockLength = (); type Version = (); diff --git a/frame/session/src/mock.rs b/frame/session/src/mock.rs index 30fb35b282..e7a9896064 100644 --- a/frame/session/src/mock.rs +++ b/frame/session/src/mock.rs @@ -188,6 +188,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/society/src/mock.rs b/frame/society/src/mock.rs index 3b5cb550a4..7ddd25ee6a 100644 --- a/frame/society/src/mock.rs +++ b/frame/society/src/mock.rs @@ -80,6 +80,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/staking/fuzzer/src/mock.rs b/frame/staking/fuzzer/src/mock.rs index b1e7ed273c..0e3b6cb13f 100644 --- a/frame/staking/fuzzer/src/mock.rs +++ b/frame/staking/fuzzer/src/mock.rs @@ -61,6 +61,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type Index = AccountIndex; type BlockNumber = BlockNumber; type Call = Call; diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index a2d53f6895..094ab6375c 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -215,6 +215,7 @@ impl frame_system::Trait for Test { type DbWeight = RocksDbWeight; type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index e853a29f39..a270787da6 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -136,6 +136,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index 6c25e5d1c9..95b9b88c70 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -76,6 +76,7 @@ impl system::Trait for Runtime { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/system/benchmarking/src/mock.rs b/frame/system/benchmarking/src/mock.rs index ed65f4df93..1e904302e3 100644 --- a/frame/system/benchmarking/src/mock.rs +++ b/frame/system/benchmarking/src/mock.rs @@ -66,6 +66,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type AvailableBlockRatio = (); type MaximumBlockLength = (); type Version = (); diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 80bb03c963..746e6536ea 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -212,6 +212,11 @@ pub trait Trait: 'static + Eq + Clone { /// The base weight of an Extrinsic in the block, independent of the of extrinsic being executed. type ExtrinsicBaseWeight: Get; + /// The maximal weight of a single Extrinsic. This should be set to at most + /// `MaximumBlockWeight - AverageOnInitializeWeight`. The limit only applies to extrinsics + /// containing `Normal` dispatch class calls. + type MaximumExtrinsicWeight: Get; + /// The maximum length of a block (in bytes). type MaximumBlockLength: Get; @@ -1352,10 +1357,29 @@ impl CheckWeight where } } + /// Checks if the current extrinsic does not exceed `MaximumExtrinsicWeight` limit. + fn check_extrinsic_weight( + info: &DispatchInfoOf, + ) -> Result<(), TransactionValidityError> { + match info.class { + // Mandatory and Operational transactions does not + DispatchClass::Mandatory | DispatchClass::Operational => Ok(()), + DispatchClass::Normal => { + let maximum_weight = T::MaximumExtrinsicWeight::get(); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > maximum_weight { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + } + } + } + /// Checks if the current extrinsic can fit into the block with respect to block weight limits. /// /// Upon successes, it returns the new block weight as a `Result`. - fn check_weight( + fn check_block_weight( info: &DispatchInfoOf, ) -> Result { let maximum_weight = T::MaximumBlockWeight::get(); @@ -1446,7 +1470,9 @@ impl CheckWeight where len: usize, ) -> Result<(), TransactionValidityError> { let next_len = Self::check_block_length(info, len)?; - let next_weight = Self::check_weight(info)?; + let next_weight = Self::check_block_weight(info)?; + Self::check_extrinsic_weight(info)?; + AllExtrinsicsLen::put(next_len); AllExtrinsicsWeight::put(next_weight); Ok(()) @@ -1459,9 +1485,12 @@ impl CheckWeight where info: &DispatchInfoOf, len: usize, ) -> TransactionValidity { - // ignore the next weight and length. If they return `Ok`, then it is below the limit. + // ignore the next length. If they return `Ok`, then it is below the limit. let _ = Self::check_block_length(info, len)?; - let _ = Self::check_weight(info)?; + // during validation we skip block limit check. Since the `validate_transaction` + // call runs on an empty block anyway, by this we prevent `on_initialize` weight + // consumption from causing false negatives. + Self::check_extrinsic_weight(info)?; Ok(ValidTransaction { priority: Self::get_priority(info), ..Default::default() }) } @@ -1847,6 +1876,7 @@ pub(crate) mod tests { parameter_types! { pub const BlockHashCount: u64 = 10; pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumExtrinsicWeight: Weight = 768; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const MaximumBlockLength: u32 = 1024; pub const Version: RuntimeVersion = RuntimeVersion { @@ -1905,6 +1935,7 @@ pub(crate) mod tests { type DbWeight = DbWeight; type BlockExecutionWeight = BlockExecutionWeight; type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + type MaximumExtrinsicWeight = MaximumExtrinsicWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = Version; @@ -2344,17 +2375,43 @@ pub(crate) mod tests { #[test] fn mandatory_extrinsic_doesnt_care_about_limits() { + fn check(call: impl FnOnce(&DispatchInfo, usize)) { + new_test_ext().execute_with(|| { + let max = DispatchInfo { + weight: Weight::max_value(), + class: DispatchClass::Mandatory, + ..Default::default() + }; + let len = 0_usize; + + call(&max, len); + }); + } + + check(|max, len| { + assert_ok!(CheckWeight::::do_pre_dispatch(max, len)); + assert_eq!(System::all_extrinsics_weight().total(), Weight::max_value()); + assert!(System::all_extrinsics_weight().total() > ::MaximumBlockWeight::get()); + }); + check(|max, len| { + assert_ok!(CheckWeight::::do_validate(max, len)); + }); + } + + #[test] + fn normal_extrinsic_limited_by_maximum_extrinsic_weight() { new_test_ext().execute_with(|| { let max = DispatchInfo { - weight: Weight::max_value(), - class: DispatchClass::Mandatory, + weight: MaximumExtrinsicWeight::get() + 1, + class: DispatchClass::Normal, ..Default::default() }; let len = 0_usize; - assert_ok!(CheckWeight::::do_pre_dispatch(&max, len)); - assert_eq!(System::all_extrinsics_weight().total(), Weight::max_value()); - assert!(System::all_extrinsics_weight().total() > ::MaximumBlockWeight::get()); + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); }); } @@ -2449,7 +2506,7 @@ pub(crate) mod tests { } #[test] - fn signed_ext_check_weight_priority_works() { + fn signed_ext() { new_test_ext().execute_with(|| { let normal = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes }; let op = DispatchInfo { weight: 100, class: DispatchClass::Operational, pays_fee: Pays::Yes }; diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index e886f8079f..6d38919f31 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -329,6 +329,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 42004021d6..17fe11db6c 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -380,6 +380,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 606abf7765..0b68c51a10 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -75,6 +75,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index 7dfc58350d..da4d41e3b7 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -75,6 +75,7 @@ impl frame_system::Trait for Test { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index a6748b15ce..371fdca691 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -396,6 +396,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 5ac5535a87..eaceef2def 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -414,6 +414,7 @@ impl frame_system::Trait for Runtime { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; type Version = (); -- GitLab From 0227ff513a045305efee0d8c2cb6025bcefb69ff Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 20 May 2020 15:08:27 +0200 Subject: [PATCH 025/280] Restore the empty line after the license (#6088) --- client/api/src/call_executor.rs | 1 + client/api/src/cht.rs | 1 + client/api/src/in_mem.rs | 1 + client/api/src/leaves.rs | 1 + client/api/src/notifications.rs | 1 + client/authority-discovery/src/tests.rs | 1 + client/basic-authorship/src/lib.rs | 1 + client/block-builder/src/lib.rs | 1 + client/chain-spec/src/chain_spec.rs | 1 + client/cli/src/commands/build_spec_cmd.rs | 1 + client/cli/src/commands/check_block_cmd.rs | 1 + client/cli/src/commands/export_blocks_cmd.rs | 1 + client/cli/src/commands/export_state_cmd.rs | 1 + client/cli/src/commands/import_blocks_cmd.rs | 1 + client/cli/src/commands/purge_chain_cmd.rs | 1 + client/cli/src/commands/revert_cmd.rs | 1 + client/cli/src/commands/run_cmd.rs | 1 + client/cli/src/config.rs | 1 + client/cli/src/error.rs | 1 + client/cli/src/lib.rs | 1 + client/cli/src/params/database_params.rs | 1 + client/cli/src/params/import_params.rs | 1 + client/cli/src/params/keystore_params.rs | 1 + client/cli/src/params/network_params.rs | 1 + client/cli/src/params/node_key_params.rs | 1 + client/cli/src/params/pruning_params.rs | 1 + client/cli/src/params/shared_params.rs | 1 + client/cli/src/params/transaction_pool_params.rs | 1 + client/cli/src/runner.rs | 1 + client/consensus/aura/src/digests.rs | 1 + client/consensus/babe/rpc/src/lib.rs | 1 + client/consensus/manual-seal/src/error.rs | 1 + client/consensus/manual-seal/src/lib.rs | 1 + client/consensus/pow/src/lib.rs | 1 + client/db/src/bench.rs | 1 + client/db/src/cache/list_cache.rs | 1 + client/db/src/cache/list_entry.rs | 1 + client/db/src/cache/list_storage.rs | 1 + client/db/src/cache/mod.rs | 1 + client/db/src/lib.rs | 1 + client/db/src/light.rs | 1 + client/db/src/offchain.rs | 1 + client/db/src/stats.rs | 1 + client/db/src/utils.rs | 1 + client/executor/common/src/error.rs | 1 + client/executor/common/src/sandbox.rs | 1 + client/executor/common/src/util.rs | 1 + client/executor/src/integration_tests/sandbox.rs | 1 + client/executor/src/lib.rs | 1 + client/executor/src/native_executor.rs | 1 + client/executor/wasmtime/src/imports.rs | 1 + client/executor/wasmtime/src/instance_wrapper.rs | 1 + .../executor/wasmtime/src/instance_wrapper/globals_snapshot.rs | 1 + client/executor/wasmtime/src/state_holder.rs | 1 + client/finality-grandpa/rpc/src/error.rs | 1 + client/finality-grandpa/rpc/src/lib.rs | 1 + client/finality-grandpa/rpc/src/report.rs | 1 + client/finality-grandpa/src/authorities.rs | 1 + client/finality-grandpa/src/communication/mod.rs | 1 + client/finality-grandpa/src/environment.rs | 1 + client/finality-grandpa/src/finality_proof.rs | 1 + client/finality-grandpa/src/import.rs | 1 + client/finality-grandpa/src/justification.rs | 1 + client/finality-grandpa/src/lib.rs | 1 + client/finality-grandpa/src/observer.rs | 1 + client/finality-grandpa/src/tests.rs | 1 + client/finality-grandpa/src/until_imported.rs | 1 + client/finality-grandpa/src/voting_rule.rs | 1 + client/informant/src/lib.rs | 1 + client/network-gossip/src/state_machine.rs | 1 + client/network-gossip/src/validator.rs | 1 + client/network/src/chain.rs | 1 + client/network/src/config.rs | 1 + client/network/src/error.rs | 1 + client/network/src/network_state.rs | 1 + client/network/src/on_demand_layer.rs | 1 + client/network/src/protocol.rs | 1 + client/network/src/protocol/generic_proto/handler/notif_in.rs | 1 + client/network/src/protocol/generic_proto/upgrade/legacy.rs | 1 + client/network/src/protocol/message.rs | 1 + client/network/src/protocol/sync/blocks.rs | 1 + client/network/src/protocol/sync/extra_requests.rs | 1 + client/network/src/schema.rs | 1 + client/network/src/service.rs | 1 + client/network/src/service/out_events.rs | 1 + client/network/src/service/tests.rs | 1 + client/network/src/transport.rs | 1 + client/network/test/src/block_import.rs | 1 + client/network/test/src/sync.rs | 1 + client/peerset/src/lib.rs | 1 + client/peerset/tests/fuzz.rs | 1 + client/rpc-api/src/author/error.rs | 1 + client/rpc-api/src/author/mod.rs | 1 + client/rpc-api/src/chain/mod.rs | 1 + client/rpc-api/src/child_state/mod.rs | 1 + client/rpc-api/src/errors.rs | 1 + client/rpc-api/src/helpers.rs | 1 + client/rpc-api/src/offchain/error.rs | 1 + client/rpc-api/src/offchain/mod.rs | 1 + client/rpc-api/src/policy.rs | 1 + client/rpc-api/src/state/error.rs | 1 + client/rpc-api/src/state/helpers.rs | 1 + client/rpc-api/src/state/mod.rs | 1 + client/rpc-api/src/subscriptions.rs | 1 + client/rpc-api/src/system/error.rs | 1 + client/rpc-api/src/system/helpers.rs | 1 + client/rpc-api/src/system/mod.rs | 1 + client/rpc-servers/src/lib.rs | 1 + client/rpc/src/author/mod.rs | 1 + client/rpc/src/author/tests.rs | 1 + client/rpc/src/chain/mod.rs | 1 + client/rpc/src/chain/tests.rs | 1 + client/rpc/src/lib.rs | 1 + client/rpc/src/metadata.rs | 1 + client/rpc/src/offchain/mod.rs | 1 + client/rpc/src/offchain/tests.rs | 1 + client/rpc/src/state/mod.rs | 1 + client/rpc/src/state/tests.rs | 1 + client/rpc/src/system/mod.rs | 1 + client/rpc/src/system/tests.rs | 1 + client/service/src/builder.rs | 1 + client/service/src/chain_ops.rs | 1 + client/service/src/client/block_rules.rs | 1 + client/service/src/client/call_executor.rs | 1 + client/service/src/client/client.rs | 1 + client/service/src/client/genesis.rs | 1 + client/service/src/client/light/blockchain.rs | 1 + client/service/src/client/light/call_executor.rs | 1 + client/service/src/client/light/fetcher.rs | 1 + client/service/src/client/light/mod.rs | 1 + client/service/src/client/mod.rs | 1 + client/service/src/config.rs | 1 + client/service/src/error.rs | 1 + client/service/src/lib.rs | 1 + client/service/src/metrics.rs | 1 + client/service/test/src/client/db.rs | 3 ++- client/service/test/src/client/mod.rs | 1 + client/service/test/src/lib.rs | 1 + client/state-db/src/lib.rs | 1 + client/state-db/src/noncanonical.rs | 1 + client/state-db/src/pruning.rs | 1 + client/state-db/src/test.rs | 1 + client/telemetry/src/lib.rs | 1 + client/telemetry/src/worker.rs | 1 + client/telemetry/src/worker/node.rs | 1 + client/transaction-pool/graph/benches/basics.rs | 1 + client/transaction-pool/graph/src/base_pool.rs | 1 + client/transaction-pool/graph/src/error.rs | 1 + client/transaction-pool/graph/src/future.rs | 1 + client/transaction-pool/graph/src/lib.rs | 1 + client/transaction-pool/graph/src/listener.rs | 1 + client/transaction-pool/graph/src/pool.rs | 1 + client/transaction-pool/graph/src/ready.rs | 1 + client/transaction-pool/graph/src/rotator.rs | 1 + client/transaction-pool/graph/src/validated_pool.rs | 1 + client/transaction-pool/graph/src/watcher.rs | 1 + client/transaction-pool/src/api.rs | 1 + client/transaction-pool/src/error.rs | 1 + client/transaction-pool/src/lib.rs | 1 + client/transaction-pool/src/metrics.rs | 1 + client/transaction-pool/src/revalidation.rs | 1 + client/transaction-pool/src/testing/mod.rs | 1 + client/transaction-pool/src/testing/pool.rs | 1 + 163 files changed, 164 insertions(+), 1 deletion(-) diff --git a/client/api/src/call_executor.rs b/client/api/src/call_executor.rs index e5b670579a..d9d43900df 100644 --- a/client/api/src/call_executor.rs +++ b/client/api/src/call_executor.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A method call executor interface. use std::{panic::UnwindSafe, result, cell::RefCell}; diff --git a/client/api/src/cht.rs b/client/api/src/cht.rs index ef282868c9..30cfd3a1b6 100644 --- a/client/api/src/cht.rs +++ b/client/api/src/cht.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Canonical hash trie definitions and helper functions. //! //! Each CHT is a trie mapping block numbers to canonical hash. diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs index cb1724e468..0eb0681a82 100644 --- a/client/api/src/in_mem.rs +++ b/client/api/src/in_mem.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! In memory client backend use std::collections::HashMap; diff --git a/client/api/src/leaves.rs b/client/api/src/leaves.rs index c93446b94d..25f9f3d29b 100644 --- a/client/api/src/leaves.rs +++ b/client/api/src/leaves.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Helper for managing the set of available leaves in the chain for DB implementations. use std::collections::BTreeMap; diff --git a/client/api/src/notifications.rs b/client/api/src/notifications.rs index c89e8b6dfd..ec63c372c7 100644 --- a/client/api/src/notifications.rs +++ b/client/api/src/notifications.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Storage notifications use std::{ diff --git a/client/authority-discovery/src/tests.rs b/client/authority-discovery/src/tests.rs index 106c68b2d0..12edcf5fc9 100644 --- a/client/authority-discovery/src/tests.rs +++ b/client/authority-discovery/src/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{iter::FromIterator, sync::{Arc, Mutex}}; use futures::channel::mpsc::channel; diff --git a/client/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs index 7c77dde6b0..f5f2c089f6 100644 --- a/client/basic-authorship/src/lib.rs +++ b/client/basic-authorship/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Basic implementation of block-authoring logic. //! //! # Example diff --git a/client/block-builder/src/lib.rs b/client/block-builder/src/lib.rs index f630d42a9b..af40b33662 100644 --- a/client/block-builder/src/lib.rs +++ b/client/block-builder/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate block builder //! //! This crate provides the [`BlockBuilder`] utility and the corresponding runtime api diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs index a6bf6212e1..52414f8687 100644 --- a/client/chain-spec/src/chain_spec.rs +++ b/client/chain-spec/src/chain_spec.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate chain configurations. use std::{borrow::Cow, fs::File, path::PathBuf, sync::Arc, collections::HashMap}; diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs index e5e7123b4b..2f9e2fa059 100644 --- a/client/cli/src/commands/build_spec_cmd.rs +++ b/client/cli/src/commands/build_spec_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use crate::params::NodeKeyParams; use crate::params::SharedParams; diff --git a/client/cli/src/commands/check_block_cmd.rs b/client/cli/src/commands/check_block_cmd.rs index 35f26af667..d1241f010d 100644 --- a/client/cli/src/commands/check_block_cmd.rs +++ b/client/cli/src/commands/check_block_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{ CliConfiguration, error, params::{ImportParams, SharedParams, BlockNumberOrHash}, }; diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs index 431add4128..2fdc408250 100644 --- a/client/cli/src/commands/export_blocks_cmd.rs +++ b/client/cli/src/commands/export_blocks_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use crate::params::{BlockNumber, DatabaseParams, PruningParams, SharedParams}; use crate::CliConfiguration; diff --git a/client/cli/src/commands/export_state_cmd.rs b/client/cli/src/commands/export_state_cmd.rs index ee022e1afd..3ad6772882 100644 --- a/client/cli/src/commands/export_state_cmd.rs +++ b/client/cli/src/commands/export_state_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{ CliConfiguration, error, params::{PruningParams, SharedParams, BlockNumberOrHash}, }; diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs index 029e447562..e138850c8b 100644 --- a/client/cli/src/commands/import_blocks_cmd.rs +++ b/client/cli/src/commands/import_blocks_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use crate::params::ImportParams; use crate::params::SharedParams; diff --git a/client/cli/src/commands/purge_chain_cmd.rs b/client/cli/src/commands/purge_chain_cmd.rs index 6b540a66a2..9d364a45f7 100644 --- a/client/cli/src/commands/purge_chain_cmd.rs +++ b/client/cli/src/commands/purge_chain_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use crate::params::{DatabaseParams, SharedParams}; use crate::CliConfiguration; diff --git a/client/cli/src/commands/revert_cmd.rs b/client/cli/src/commands/revert_cmd.rs index ea6ba5ecf7..6117eaf488 100644 --- a/client/cli/src/commands/revert_cmd.rs +++ b/client/cli/src/commands/revert_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use crate::params::{BlockNumber, PruningParams, SharedParams}; use crate::CliConfiguration; diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index c34a31e59b..f87d5bea6e 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::arg_enums::RpcMethods; use crate::error::{Error, Result}; use crate::params::ImportParams; diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index fb0101ec88..fdaee929a6 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Configuration trait for a CLI based on substrate use crate::arg_enums::Database; diff --git a/client/cli/src/error.rs b/client/cli/src/error.rs index fa336974d6..23c2bf05f0 100644 --- a/client/cli/src/error.rs +++ b/client/cli/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Initialization errors. /// Result type alias for the CLI. diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index 271572b43d..36d3649926 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate CLI library. #![warn(missing_docs)] diff --git a/client/cli/src/params/database_params.rs b/client/cli/src/params/database_params.rs index 62b0436788..3ff8eb01d0 100644 --- a/client/cli/src/params/database_params.rs +++ b/client/cli/src/params/database_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::arg_enums::Database; use structopt::StructOpt; diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs index e1c86aec9b..fb683df6d3 100644 --- a/client/cli/src/params/import_params.rs +++ b/client/cli/src/params/import_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::arg_enums::{ ExecutionStrategy, TracingReceiver, WasmExecutionMethod, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION, DEFAULT_EXECUTION_IMPORT_BLOCK, diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs index 4dbd793456..2fd610377d 100644 --- a/client/cli/src/params/keystore_params.rs +++ b/client/cli/src/params/keystore_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error::Result; use sc_service::config::KeystoreConfig; use std::fs; diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index e328c32a40..c1639ad2b4 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::params::node_key_params::NodeKeyParams; use sc_network::{ config::{NetworkConfiguration, NodeKeyConfig, NonReservedPeerMode, TransportConfig}, diff --git a/client/cli/src/params/node_key_params.rs b/client/cli/src/params/node_key_params.rs index ede9fd02e1..7d19971ad6 100644 --- a/client/cli/src/params/node_key_params.rs +++ b/client/cli/src/params/node_key_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sc_network::config::NodeKeyConfig; use sp_core::H256; use std::{path::PathBuf, str::FromStr}; diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index d96a44986d..3617935906 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::error; use sc_service::{PruningMode, Role}; use structopt::StructOpt; diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index 94fb3ceea6..5bf8102466 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::path::PathBuf; use structopt::StructOpt; diff --git a/client/cli/src/params/transaction_pool_params.rs b/client/cli/src/params/transaction_pool_params.rs index 00f5f0dbd6..2283c0f39f 100644 --- a/client/cli/src/params/transaction_pool_params.rs +++ b/client/cli/src/params/transaction_pool_params.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sc_service::config::TransactionPoolOptions; use structopt::StructOpt; diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 1600aed7d6..2d27743163 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::CliConfiguration; use crate::Result; use crate::SubstrateCli; diff --git a/client/consensus/aura/src/digests.rs b/client/consensus/aura/src/digests.rs index 8ddcb2bee4..3332e4c6a6 100644 --- a/client/consensus/aura/src/digests.rs +++ b/client/consensus/aura/src/digests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Aura (Authority-Round) digests //! //! This implements the digests for AuRa, to allow the private diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 0c8a16e4da..925328a856 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! RPC api for babe. use sc_consensus_babe::{Epoch, authorship, Config}; diff --git a/client/consensus/manual-seal/src/error.rs b/client/consensus/manual-seal/src/error.rs index 36499893c3..2411a839b0 100644 --- a/client/consensus/manual-seal/src/error.rs +++ b/client/consensus/manual-seal/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A manual sealing engine: the engine listens for rpc calls to seal blocks and create forks. //! This is suitable for a testing environment. use sp_consensus::{Error as ConsensusError, ImportResult}; diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index de9711b2a8..26f493d5d2 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A manual sealing engine: the engine listens for rpc calls to seal blocks and create forks. //! This is suitable for a testing environment. diff --git a/client/consensus/pow/src/lib.rs b/client/consensus/pow/src/lib.rs index b0d1e04348..2628a11d3b 100644 --- a/client/consensus/pow/src/lib.rs +++ b/client/consensus/pow/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Proof of work consensus for Substrate. //! //! To use this engine, you can need to have a struct that implements diff --git a/client/db/src/bench.rs b/client/db/src/bench.rs index 3b31a37b14..807e8c68e1 100644 --- a/client/db/src/bench.rs +++ b/client/db/src/bench.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! State backend that's useful for benchmarking use std::sync::Arc; diff --git a/client/db/src/cache/list_cache.rs b/client/db/src/cache/list_cache.rs index a2af053e87..0856350fb0 100644 --- a/client/db/src/cache/list_cache.rs +++ b/client/db/src/cache/list_cache.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! List-based cache. //! //! Maintains several lists, containing nodes that are inserted whenever diff --git a/client/db/src/cache/list_entry.rs b/client/db/src/cache/list_entry.rs index 39dee59d55..565a62cff4 100644 --- a/client/db/src/cache/list_entry.rs +++ b/client/db/src/cache/list_entry.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! List-cache storage entries. use sp_blockchain::Result as ClientResult; diff --git a/client/db/src/cache/list_storage.rs b/client/db/src/cache/list_storage.rs index 1fa26552e9..377d744eff 100644 --- a/client/db/src/cache/list_storage.rs +++ b/client/db/src/cache/list_storage.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! List-cache storage definition and implementation. use std::sync::Arc; diff --git a/client/db/src/cache/mod.rs b/client/db/src/cache/mod.rs index 03cda1b589..2b7cd2e620 100644 --- a/client/db/src/cache/mod.rs +++ b/client/db/src/cache/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! DB-backed cache of blockchain data. use std::{sync::Arc, collections::{HashMap, hash_map::Entry}}; diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 75d36dde5c..037409dfc4 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Client backend that is backed by a database. //! //! # Canonicality vs. Finality diff --git a/client/db/src/light.rs b/client/db/src/light.rs index 8607823462..f115ac9599 100644 --- a/client/db/src/light.rs +++ b/client/db/src/light.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! RocksDB-based light client blockchain storage. use std::{sync::Arc, collections::HashMap}; diff --git a/client/db/src/offchain.rs b/client/db/src/offchain.rs index a7cc1345d1..651510d6e8 100644 --- a/client/db/src/offchain.rs +++ b/client/db/src/offchain.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! RocksDB-based offchain workers local storage. use std::{ diff --git a/client/db/src/stats.rs b/client/db/src/stats.rs index 7a265ddf82..8d208024b4 100644 --- a/client/db/src/stats.rs +++ b/client/db/src/stats.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Database usage statistics use std::sync::atomic::{AtomicU64, Ordering as AtomicOrdering}; diff --git a/client/db/src/utils.rs b/client/db/src/utils.rs index c05a411258..80b08b3a6e 100644 --- a/client/db/src/utils.rs +++ b/client/db/src/utils.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Db-based backend utility structures and functions, used by both //! full and light storages. diff --git a/client/executor/common/src/error.rs b/client/executor/common/src/error.rs index 8fc0c4392c..04850e6f8d 100644 --- a/client/executor/common/src/error.rs +++ b/client/executor/common/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Rust executor possible errors. use sp_serializer; diff --git a/client/executor/common/src/sandbox.rs b/client/executor/common/src/sandbox.rs index 37860474cb..b2c35b7582 100644 --- a/client/executor/common/src/sandbox.rs +++ b/client/executor/common/src/sandbox.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! This module implements sandboxing support in the runtime. //! //! Sandboxing is baked by wasmi at the moment. In future, however, we would like to add/switch to diff --git a/client/executor/common/src/util.rs b/client/executor/common/src/util.rs index ebd14a5a6e..92a48e1401 100644 --- a/client/executor/common/src/util.rs +++ b/client/executor/common/src/util.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A set of utilities for resetting a wasm instance to its initial state. use crate::error::{self, Error}; diff --git a/client/executor/src/integration_tests/sandbox.rs b/client/executor/src/integration_tests/sandbox.rs index 8fe7678955..f84e446b41 100644 --- a/client/executor/src/integration_tests/sandbox.rs +++ b/client/executor/src/integration_tests/sandbox.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::{TestExternalities, call_in_wasm}; use crate::WasmExecutionMethod; diff --git a/client/executor/src/lib.rs b/client/executor/src/lib.rs index a8b86da714..c02568c734 100644 --- a/client/executor/src/lib.rs +++ b/client/executor/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A crate that provides means of executing/dispatching calls into the runtime. //! //! There are a few responsibilities of this crate at the moment: diff --git a/client/executor/src/native_executor.rs b/client/executor/src/native_executor.rs index 95f5dff8c6..b1eb504d5a 100644 --- a/client/executor/src/native_executor.rs +++ b/client/executor/src/native_executor.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{ RuntimeInfo, error::{Error, Result}, wasm_runtime::{RuntimeCache, WasmExecutionMethod}, diff --git a/client/executor/wasmtime/src/imports.rs b/client/executor/wasmtime/src/imports.rs index b427606c3c..36752d72fa 100644 --- a/client/executor/wasmtime/src/imports.rs +++ b/client/executor/wasmtime/src/imports.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::state_holder; use sc_executor_common::error::WasmError; use sp_wasm_interface::{Function, Value, ValueType}; diff --git a/client/executor/wasmtime/src/instance_wrapper.rs b/client/executor/wasmtime/src/instance_wrapper.rs index 8b0b5cf382..9026b8054e 100644 --- a/client/executor/wasmtime/src/instance_wrapper.rs +++ b/client/executor/wasmtime/src/instance_wrapper.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Defines data and logic needed for interaction with an WebAssembly instance of a substrate //! runtime module. diff --git a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs index db2cc28e68..01d82451fc 100644 --- a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs +++ b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::InstanceWrapper; use sc_executor_common::{ error::{Error, Result}, diff --git a/client/executor/wasmtime/src/state_holder.rs b/client/executor/wasmtime/src/state_holder.rs index ac5b64c774..711d3bb735 100644 --- a/client/executor/wasmtime/src/state_holder.rs +++ b/client/executor/wasmtime/src/state_holder.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::host::{HostContext, HostState}; scoped_tls::scoped_thread_local!(static HOST_STATE: HostState); diff --git a/client/finality-grandpa/rpc/src/error.rs b/client/finality-grandpa/rpc/src/error.rs index 73c36f23f5..bfd0596fdf 100644 --- a/client/finality-grandpa/rpc/src/error.rs +++ b/client/finality-grandpa/rpc/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::NOT_READY_ERROR_CODE; #[derive(derive_more::Display, derive_more::From)] diff --git a/client/finality-grandpa/rpc/src/lib.rs b/client/finality-grandpa/rpc/src/lib.rs index 6d8e10622b..1af84b7a84 100644 --- a/client/finality-grandpa/rpc/src/lib.rs +++ b/client/finality-grandpa/rpc/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! RPC API for GRANDPA. #![warn(missing_docs)] diff --git a/client/finality-grandpa/rpc/src/report.rs b/client/finality-grandpa/rpc/src/report.rs index 19b89c5083..a635728cb9 100644 --- a/client/finality-grandpa/rpc/src/report.rs +++ b/client/finality-grandpa/rpc/src/report.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ collections::{BTreeSet, HashSet}, fmt::Debug, diff --git a/client/finality-grandpa/src/authorities.rs b/client/finality-grandpa/src/authorities.rs index 2105d9ed38..b4cb254864 100644 --- a/client/finality-grandpa/src/authorities.rs +++ b/client/finality-grandpa/src/authorities.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Utilities for dealing with authorities, authority sets, and handoffs. use fork_tree::ForkTree; diff --git a/client/finality-grandpa/src/communication/mod.rs b/client/finality-grandpa/src/communication/mod.rs index 533acb8de6..abd1c27983 100644 --- a/client/finality-grandpa/src/communication/mod.rs +++ b/client/finality-grandpa/src/communication/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Communication streams for the polite-grandpa networking protocol. //! //! GRANDPA nodes communicate over a gossip network, where messages are not sent to diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs index 85816b110b..afcc3891ac 100644 --- a/client/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::collections::BTreeMap; use std::iter::FromIterator; use std::pin::Pin; diff --git a/client/finality-grandpa/src/finality_proof.rs b/client/finality-grandpa/src/finality_proof.rs index 82a5220d87..55f6376579 100644 --- a/client/finality-grandpa/src/finality_proof.rs +++ b/client/finality-grandpa/src/finality_proof.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! GRANDPA block finality proof generation and check. //! //! Finality of block B is proved by providing: diff --git a/client/finality-grandpa/src/import.rs b/client/finality-grandpa/src/import.rs index 3f3bcc0d8c..7e3799b1e2 100644 --- a/client/finality-grandpa/src/import.rs +++ b/client/finality-grandpa/src/import.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{sync::Arc, collections::HashMap}; use log::{debug, trace}; diff --git a/client/finality-grandpa/src/justification.rs b/client/finality-grandpa/src/justification.rs index 7f86f7e443..b4db81f8a4 100644 --- a/client/finality-grandpa/src/justification.rs +++ b/client/finality-grandpa/src/justification.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::collections::{HashMap, HashSet}; use std::sync::Arc; diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index 41dedc2246..7b20d082a0 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Integration of the GRANDPA finality gadget into substrate. //! //! This crate is unstable and the API and usage may change. diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index ee203a225d..cd678b3bb4 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index dbc54a0d64..25e6253652 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Tests and test helpers for GRANDPA. use super::*; diff --git a/client/finality-grandpa/src/until_imported.rs b/client/finality-grandpa/src/until_imported.rs index 6be1a1b1be..6a39c2637e 100644 --- a/client/finality-grandpa/src/until_imported.rs +++ b/client/finality-grandpa/src/until_imported.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Helper stream for waiting until one or more blocks are imported before //! passing through inner items. This is done in a generic way to support //! many different kinds of items. diff --git a/client/finality-grandpa/src/voting_rule.rs b/client/finality-grandpa/src/voting_rule.rs index d0c47037ab..60493867ce 100644 --- a/client/finality-grandpa/src/voting_rule.rs +++ b/client/finality-grandpa/src/voting_rule.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Handling custom voting rules for GRANDPA. //! //! This exposes the `VotingRule` trait used to implement arbitrary voting diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 891e9c0211..6eea9c1d04 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Console informant. Prints sync progress and block events. Runs on the calling thread. use ansi_term::Colour; diff --git a/client/network-gossip/src/state_machine.rs b/client/network-gossip/src/state_machine.rs index 0d8ad50970..da07bde3e7 100644 --- a/client/network-gossip/src/state_machine.rs +++ b/client/network-gossip/src/state_machine.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{Network, MessageIntent, Validator, ValidatorContext, ValidationResult}; use std::collections::{HashMap, HashSet}; diff --git a/client/network-gossip/src/validator.rs b/client/network-gossip/src/validator.rs index cd0a733c91..fd29aaddaf 100644 --- a/client/network-gossip/src/validator.rs +++ b/client/network-gossip/src/validator.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sc_network::{ObservedRole, PeerId}; use sp_runtime::traits::Block as BlockT; diff --git a/client/network/src/chain.rs b/client/network/src/chain.rs index f79cf6f61e..20fbe02843 100644 --- a/client/network/src/chain.rs +++ b/client/network/src/chain.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Blockchain access trait use sp_blockchain::{Error, HeaderBackend, HeaderMetadata}; diff --git a/client/network/src/config.rs b/client/network/src/config.rs index c1534c6d9c..394e8fc01a 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Configuration of the networking layer. //! //! The [`Params`] struct is the struct that must be passed in order to initialize the networking. diff --git a/client/network/src/error.rs b/client/network/src/error.rs index e46273c47b..fed7a331da 100644 --- a/client/network/src/error.rs +++ b/client/network/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate network possible errors. use libp2p::{PeerId, Multiaddr}; diff --git a/client/network/src/network_state.rs b/client/network/src/network_state.rs index ca6733de81..970a63faed 100644 --- a/client/network/src/network_state.rs +++ b/client/network/src/network_state.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Information about the networking, for diagnostic purposes. //! //! **Warning**: These APIs are not stable. diff --git a/client/network/src/on_demand_layer.rs b/client/network/src/on_demand_layer.rs index c76ebb0351..084172ee57 100644 --- a/client/network/src/on_demand_layer.rs +++ b/client/network/src/on_demand_layer.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! On-demand requests service. use crate::light_client_handler; diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 8a71494d82..b3c08320f9 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{ ExHashT, chain::{Client, FinalityProofProvider}, diff --git a/client/network/src/protocol/generic_proto/handler/notif_in.rs b/client/network/src/protocol/generic_proto/handler/notif_in.rs index 68708b9fb7..ef4644c548 100644 --- a/client/network/src/protocol/generic_proto/handler/notif_in.rs +++ b/client/network/src/protocol/generic_proto/handler/notif_in.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Implementations of the `IntoProtocolsHandler` and `ProtocolsHandler` traits for ingoing //! substreams for a single gossiping protocol. //! diff --git a/client/network/src/protocol/generic_proto/upgrade/legacy.rs b/client/network/src/protocol/generic_proto/upgrade/legacy.rs index aba7fda2c3..13560113bb 100644 --- a/client/network/src/protocol/generic_proto/upgrade/legacy.rs +++ b/client/network/src/protocol/generic_proto/upgrade/legacy.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::config::ProtocolId; use bytes::BytesMut; use futures::prelude::*; diff --git a/client/network/src/protocol/message.rs b/client/network/src/protocol/message.rs index 5baa8ed78f..bb2253b733 100644 --- a/client/network/src/protocol/message.rs +++ b/client/network/src/protocol/message.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Network packet message types. These get serialized and put into the lower level protocol payload. use bitflags::bitflags; diff --git a/client/network/src/protocol/sync/blocks.rs b/client/network/src/protocol/sync/blocks.rs index 8d7e375d08..b64c9e053e 100644 --- a/client/network/src/protocol/sync/blocks.rs +++ b/client/network/src/protocol/sync/blocks.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::cmp; use std::ops::Range; use std::collections::{HashMap, BTreeMap}; diff --git a/client/network/src/protocol/sync/extra_requests.rs b/client/network/src/protocol/sync/extra_requests.rs index 5df77a8228..6d688c130f 100644 --- a/client/network/src/protocol/sync/extra_requests.rs +++ b/client/network/src/protocol/sync/extra_requests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sp_blockchain::Error as ClientError; use crate::protocol::sync::{PeerSync, PeerSyncState}; use fork_tree::ForkTree; diff --git a/client/network/src/schema.rs b/client/network/src/schema.rs index c736b5c652..44fbbffd25 100644 --- a/client/network/src/schema.rs +++ b/client/network/src/schema.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Include sources generated from protobuf definitions. pub mod v1 { diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 331580ecb4..4a52bfebdd 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Main entry point of the sc-network crate. //! //! There are two main structs in this module: [`NetworkWorker`] and [`NetworkService`]. diff --git a/client/network/src/service/out_events.rs b/client/network/src/service/out_events.rs index 024b974266..4a631601a6 100644 --- a/client/network/src/service/out_events.rs +++ b/client/network/src/service/out_events.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Registering events streams. //! //! This code holds the logic that is used for the network service to inform other parts of diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index cd1ac85497..8eaa984492 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{config, Event, NetworkService, NetworkWorker}; use futures::prelude::*; diff --git a/client/network/src/transport.rs b/client/network/src/transport.rs index 7b42211433..0c9a809384 100644 --- a/client/network/src/transport.rs +++ b/client/network/src/transport.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use futures::prelude::*; use libp2p::{ InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport, diff --git a/client/network/test/src/block_import.rs b/client/network/test/src/block_import.rs index 34199abde2..ef6ac9268f 100644 --- a/client/network/test/src/block_import.rs +++ b/client/network/test/src/block_import.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Testing block import logic. use sp_consensus::ImportedAux; diff --git a/client/network/test/src/sync.rs b/client/network/test/src/sync.rs index a87badead7..13d04a8c4e 100644 --- a/client/network/test/src/sync.rs +++ b/client/network/test/src/sync.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sp_consensus::BlockOrigin; use std::time::Duration; use futures::executor::block_on; diff --git a/client/peerset/src/lib.rs b/client/peerset/src/lib.rs index bde3bf628c..e5e8ec826f 100644 --- a/client/peerset/src/lib.rs +++ b/client/peerset/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Peer Set Manager (PSM). Contains the strategy for choosing which nodes the network should be //! connected to. diff --git a/client/peerset/tests/fuzz.rs b/client/peerset/tests/fuzz.rs index dbc688fd5e..aa2de56923 100644 --- a/client/peerset/tests/fuzz.rs +++ b/client/peerset/tests/fuzz.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use futures::prelude::*; use libp2p::PeerId; use rand::distributions::{Distribution, Uniform, WeightedIndex}; diff --git a/client/rpc-api/src/author/error.rs b/client/rpc-api/src/author/error.rs index 192d0c2795..e6ee36cdce 100644 --- a/client/rpc-api/src/author/error.rs +++ b/client/rpc-api/src/author/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Authoring RPC module errors. use crate::errors; diff --git a/client/rpc-api/src/author/mod.rs b/client/rpc-api/src/author/mod.rs index d99f854037..29f5b1d26e 100644 --- a/client/rpc-api/src/author/mod.rs +++ b/client/rpc-api/src/author/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate block-author/full-node API. pub mod error; diff --git a/client/rpc-api/src/chain/mod.rs b/client/rpc-api/src/chain/mod.rs index 0d394acd0b..a7b26f3024 100644 --- a/client/rpc-api/src/chain/mod.rs +++ b/client/rpc-api/src/chain/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate blockchain API. pub mod error; diff --git a/client/rpc-api/src/child_state/mod.rs b/client/rpc-api/src/child_state/mod.rs index 21045677f4..d956a7554f 100644 --- a/client/rpc-api/src/child_state/mod.rs +++ b/client/rpc-api/src/child_state/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate state API. use jsonrpc_derive::rpc; diff --git a/client/rpc-api/src/errors.rs b/client/rpc-api/src/errors.rs index a0c9c4cfbe..4e1a5b10fc 100644 --- a/client/rpc-api/src/errors.rs +++ b/client/rpc-api/src/errors.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use log::warn; pub fn internal(e: E) -> jsonrpc_core::Error { diff --git a/client/rpc-api/src/helpers.rs b/client/rpc-api/src/helpers.rs index 5ce9161ad5..025fef1102 100644 --- a/client/rpc-api/src/helpers.rs +++ b/client/rpc-api/src/helpers.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use jsonrpc_core::futures::prelude::*; use futures::{channel::oneshot, compat::Compat}; diff --git a/client/rpc-api/src/offchain/error.rs b/client/rpc-api/src/offchain/error.rs index 6e9b531623..ea5223f1ce 100644 --- a/client/rpc-api/src/offchain/error.rs +++ b/client/rpc-api/src/offchain/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Offchain RPC errors. use jsonrpc_core as rpc; diff --git a/client/rpc-api/src/offchain/mod.rs b/client/rpc-api/src/offchain/mod.rs index c456e56a4d..427b6a1cc0 100644 --- a/client/rpc-api/src/offchain/mod.rs +++ b/client/rpc-api/src/offchain/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate offchain API. pub mod error; diff --git a/client/rpc-api/src/policy.rs b/client/rpc-api/src/policy.rs index 3dc3bf8505..e6e3380e1a 100644 --- a/client/rpc-api/src/policy.rs +++ b/client/rpc-api/src/policy.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Policy-related types. //! //! Contains a `DenyUnsafe` type that can be used to deny potentially unsafe diff --git a/client/rpc-api/src/state/error.rs b/client/rpc-api/src/state/error.rs index 2dabe309ee..2fcca3c343 100644 --- a/client/rpc-api/src/state/error.rs +++ b/client/rpc-api/src/state/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! State RPC errors. use crate::errors; diff --git a/client/rpc-api/src/state/helpers.rs b/client/rpc-api/src/state/helpers.rs index b740a8e33b..0d176ea67f 100644 --- a/client/rpc-api/src/state/helpers.rs +++ b/client/rpc-api/src/state/helpers.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate state API helpers. use sp_core::Bytes; diff --git a/client/rpc-api/src/state/mod.rs b/client/rpc-api/src/state/mod.rs index cec32a26c6..1bfbb4786e 100644 --- a/client/rpc-api/src/state/mod.rs +++ b/client/rpc-api/src/state/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate state API. pub mod error; diff --git a/client/rpc-api/src/subscriptions.rs b/client/rpc-api/src/subscriptions.rs index 772e9d4ee8..7feae662ee 100644 --- a/client/rpc-api/src/subscriptions.rs +++ b/client/rpc-api/src/subscriptions.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::collections::HashMap; use std::sync::{Arc, atomic::{self, AtomicUsize}}; diff --git a/client/rpc-api/src/system/error.rs b/client/rpc-api/src/system/error.rs index bd75b86493..4897aa485c 100644 --- a/client/rpc-api/src/system/error.rs +++ b/client/rpc-api/src/system/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! System RPC module errors. use crate::system::helpers::Health; diff --git a/client/rpc-api/src/system/helpers.rs b/client/rpc-api/src/system/helpers.rs index fbc68de05a..5dbe93543d 100644 --- a/client/rpc-api/src/system/helpers.rs +++ b/client/rpc-api/src/system/helpers.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate system API helpers. use std::fmt; diff --git a/client/rpc-api/src/system/mod.rs b/client/rpc-api/src/system/mod.rs index 6a2026c978..a7b746ee1b 100644 --- a/client/rpc-api/src/system/mod.rs +++ b/client/rpc-api/src/system/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate system API. pub mod error; diff --git a/client/rpc-servers/src/lib.rs b/client/rpc-servers/src/lib.rs index 3366343213..6fe4586b6e 100644 --- a/client/rpc-servers/src/lib.rs +++ b/client/rpc-servers/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate RPC servers. #![warn(missing_docs)] diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index fc23db95a8..d59fad354e 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate block-author/full-node API. #[cfg(test)] diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index a9caa6d91a..8c1b82028b 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::*; use std::{mem, sync::Arc}; diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 8341724227..6d53fbbb06 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate blockchain API. mod chain_full; diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index 477438e286..e86d1d547f 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::*; use assert_matches::assert_matches; use substrate_test_runtime_client::{ diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 0ec44b5663..f979b0ab69 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate RPC implementation. //! //! A core implementation of Substrate RPC interfaces. diff --git a/client/rpc/src/metadata.rs b/client/rpc/src/metadata.rs index 3c2902694e..0416b07a67 100644 --- a/client/rpc/src/metadata.rs +++ b/client/rpc/src/metadata.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! RPC Metadata use std::sync::Arc; diff --git a/client/rpc/src/offchain/mod.rs b/client/rpc/src/offchain/mod.rs index f55148b451..f8d2bb6a50 100644 --- a/client/rpc/src/offchain/mod.rs +++ b/client/rpc/src/offchain/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate offchain API. #[cfg(test)] diff --git a/client/rpc/src/offchain/tests.rs b/client/rpc/src/offchain/tests.rs index f1fa925a35..f65971a7ff 100644 --- a/client/rpc/src/offchain/tests.rs +++ b/client/rpc/src/offchain/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::*; use assert_matches::assert_matches; use sp_core::{Bytes, offchain::storage::InMemOffchainStorage}; diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index e4d6918afb..168dc3e010 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate state API. mod state_full; diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index a275624053..a610cbbfc8 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::*; use super::state_full::split_range; use self::error::Error; diff --git a/client/rpc/src/system/mod.rs b/client/rpc/src/system/mod.rs index 92a5f61c89..4b8abbe144 100644 --- a/client/rpc/src/system/mod.rs +++ b/client/rpc/src/system/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate system API. #[cfg(test)] diff --git a/client/rpc/src/system/tests.rs b/client/rpc/src/system/tests.rs index e79e85f771..25ebd80953 100644 --- a/client/rpc/src/system/tests.rs +++ b/client/rpc/src/system/tests.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use super::*; use sc_network::{self, PeerId}; diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 81a861d621..cc7929e88c 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::{Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm}; use crate::{start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle}; use crate::status_sinks; diff --git a/client/service/src/chain_ops.rs b/client/service/src/chain_ops.rs index f02161fc72..5c7dca0da7 100644 --- a/client/service/src/chain_ops.rs +++ b/client/service/src/chain_ops.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Chain utilities. use crate::error; diff --git a/client/service/src/client/block_rules.rs b/client/service/src/client/block_rules.rs index 0d7e8effc6..247d09197b 100644 --- a/client/service/src/client/block_rules.rs +++ b/client/service/src/client/block_rules.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Client fixed chain specification rules use std::collections::{HashMap, HashSet}; diff --git a/client/service/src/client/call_executor.rs b/client/service/src/client/call_executor.rs index d0304914ff..049bd888b1 100644 --- a/client/service/src/client/call_executor.rs +++ b/client/service/src/client/call_executor.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{sync::Arc, panic::UnwindSafe, result, cell::RefCell}; use codec::{Encode, Decode}; use sp_runtime::{ diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 9db7b714e1..77b3f065f4 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate Client use std::{ diff --git a/client/service/src/client/genesis.rs b/client/service/src/client/genesis.rs index 9f68e20950..4df08025e3 100644 --- a/client/service/src/client/genesis.rs +++ b/client/service/src/client/genesis.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Tool for creating the genesis block. use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, Zero}; diff --git a/client/service/src/client/light/blockchain.rs b/client/service/src/client/light/blockchain.rs index 6076b386dc..c7b20de594 100644 --- a/client/service/src/client/light/blockchain.rs +++ b/client/service/src/client/light/blockchain.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Light client blockchain backend. Only stores headers and justifications of recent //! blocks. CHT roots are stored for headers of ancient blocks. diff --git a/client/service/src/client/light/call_executor.rs b/client/service/src/client/light/call_executor.rs index 0f6a8f1372..81be65339b 100644 --- a/client/service/src/client/light/call_executor.rs +++ b/client/service/src/client/light/call_executor.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Methods that light client could use to execute runtime calls. use std::{ diff --git a/client/service/src/client/light/fetcher.rs b/client/service/src/client/light/fetcher.rs index b62225c59c..5422554967 100644 --- a/client/service/src/client/light/fetcher.rs +++ b/client/service/src/client/light/fetcher.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Light client data fetcher. Fetches requested data from remote full nodes. use std::sync::Arc; diff --git a/client/service/src/client/light/mod.rs b/client/service/src/client/light/mod.rs index 32288d7b8b..a3456f96a3 100644 --- a/client/service/src/client/light/mod.rs +++ b/client/service/src/client/light/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Light client components. pub mod backend; diff --git a/client/service/src/client/mod.rs b/client/service/src/client/mod.rs index 52a67eb3e3..7c96f61a78 100644 --- a/client/service/src/client/mod.rs +++ b/client/service/src/client/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate Client and associated logic. //! //! The [`Client`] is one of the most important components of Substrate. It mainly comprises two diff --git a/client/service/src/config.rs b/client/service/src/config.rs index 7e4949e534..cc9c742ed6 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Service configuration. pub use sc_client_db::{Database, PruningMode, DatabaseSettingsSrc as DatabaseConfig}; diff --git a/client/service/src/error.rs b/client/service/src/error.rs index 244fa553ff..ffe1b39405 100644 --- a/client/service/src/error.rs +++ b/client/service/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Errors that can occur during the service operation. use sc_network; diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 9e97bb5756..c902e6bb90 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate service. Starts a thread that spins up the network, client, and extrinsic pool. //! Manages communication between them. diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index 040dc8eb62..f3463ffdbe 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::convert::TryFrom; use crate::NetworkStatus; diff --git a/client/service/test/src/client/db.rs b/client/service/test/src/client/db.rs index 19cf62b30d..36d4973224 100644 --- a/client/service/test/src/client/db.rs +++ b/client/service/test/src/client/db.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use sp_core::offchain::{OffchainStorage, storage::InMemOffchainStorage}; use std::sync::Arc; @@ -53,4 +54,4 @@ fn in_memory_offchain_storage() { assert!(!storage.compare_and_set(b"B", b"A", Some(b""), b"Y")); assert!(storage.compare_and_set(b"B", b"A", None, b"X")); assert_eq!(storage.get(b"B", b"A"), Some(b"X".to_vec())); -} \ No newline at end of file +} diff --git a/client/service/test/src/client/mod.rs b/client/service/test/src/client/mod.rs index 1cfbe2930d..2124f0ced4 100644 --- a/client/service/test/src/client/mod.rs +++ b/client/service/test/src/client/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use parity_scale_codec::{Encode, Decode, Joiner}; use sc_executor::native_executor_instance; use sp_state_machine::{StateMachine, OverlayedChanges, ExecutionStrategy, InMemoryBackend}; diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index a7e4b31ebb..63c7e0795d 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Service integration test utils. use std::iter; diff --git a/client/state-db/src/lib.rs b/client/state-db/src/lib.rs index 68c658beb6..61470894e4 100644 --- a/client/state-db/src/lib.rs +++ b/client/state-db/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! State database maintenance. Handles canonicalization and pruning in the database. The input to //! this module is a `ChangeSet` which is basically a list of key-value pairs (trie nodes) that //! were added or deleted during block execution. diff --git a/client/state-db/src/noncanonical.rs b/client/state-db/src/noncanonical.rs index 34e7a8725c..d77f20c50d 100644 --- a/client/state-db/src/noncanonical.rs +++ b/client/state-db/src/noncanonical.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Canonicalization window. //! Maintains trees of block overlays and allows discarding trees/roots //! The overlays are added in `insert` and removed in `canonicalize`. diff --git a/client/state-db/src/pruning.rs b/client/state-db/src/pruning.rs index 743db9bc1f..69b07c285f 100644 --- a/client/state-db/src/pruning.rs +++ b/client/state-db/src/pruning.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Pruning window. //! //! For each block we maintain a list of nodes pending deletion. diff --git a/client/state-db/src/test.rs b/client/state-db/src/test.rs index 17686031a7..11ce4ad822 100644 --- a/client/state-db/src/test.rs +++ b/client/state-db/src/test.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Test utils use std::collections::HashMap; diff --git a/client/telemetry/src/lib.rs b/client/telemetry/src/lib.rs index 0752a3c53f..315bedbe5b 100644 --- a/client/telemetry/src/lib.rs +++ b/client/telemetry/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Telemetry utilities. //! //! Calling `init_telemetry` registers a global `slog` logger using `slog_scope::set_global_logger`. diff --git a/client/telemetry/src/worker.rs b/client/telemetry/src/worker.rs index b147313aee..68d4c4e209 100644 --- a/client/telemetry/src/worker.rs +++ b/client/telemetry/src/worker.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Contains the object that makes the telemetry work. //! //! # Usage diff --git a/client/telemetry/src/worker/node.rs b/client/telemetry/src/worker/node.rs index bdca054c23..6b1a0f62b1 100644 --- a/client/telemetry/src/worker/node.rs +++ b/client/telemetry/src/worker/node.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Contains the `Node` struct, which handles communications with a single telemetry endpoint. use bytes::BytesMut; diff --git a/client/transaction-pool/graph/benches/basics.rs b/client/transaction-pool/graph/benches/basics.rs index 80d5ac838b..ee92b60d54 100644 --- a/client/transaction-pool/graph/benches/basics.rs +++ b/client/transaction-pool/graph/benches/basics.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use criterion::{criterion_group, criterion_main, Criterion}; use futures::{future::{ready, Ready}, executor::block_on}; diff --git a/client/transaction-pool/graph/src/base_pool.rs b/client/transaction-pool/graph/src/base_pool.rs index 2cb9a16126..0128e94675 100644 --- a/client/transaction-pool/graph/src/base_pool.rs +++ b/client/transaction-pool/graph/src/base_pool.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! A basic version of the dependency graph. //! //! For a more full-featured pool, have a look at the `pool` module. diff --git a/client/transaction-pool/graph/src/error.rs b/client/transaction-pool/graph/src/error.rs index b970ab6f45..392ddaa39b 100644 --- a/client/transaction-pool/graph/src/error.rs +++ b/client/transaction-pool/graph/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Transaction pool errors. use sp_runtime::transaction_validity::{ diff --git a/client/transaction-pool/graph/src/future.rs b/client/transaction-pool/graph/src/future.rs index 76fa51a3ad..80e6825d4f 100644 --- a/client/transaction-pool/graph/src/future.rs +++ b/client/transaction-pool/graph/src/future.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ collections::{HashMap, HashSet}, fmt, diff --git a/client/transaction-pool/graph/src/lib.rs b/client/transaction-pool/graph/src/lib.rs index 6ef80e2eb2..04e5d0d3fb 100644 --- a/client/transaction-pool/graph/src/lib.rs +++ b/client/transaction-pool/graph/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Generic Transaction Pool //! //! The pool is based on dependency graph between transactions diff --git a/client/transaction-pool/graph/src/listener.rs b/client/transaction-pool/graph/src/listener.rs index 0bee4384c2..cccf542199 100644 --- a/client/transaction-pool/graph/src/listener.rs +++ b/client/transaction-pool/graph/src/listener.rs @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ collections::HashMap, hash, }; diff --git a/client/transaction-pool/graph/src/pool.rs b/client/transaction-pool/graph/src/pool.rs index ffcdcdc06f..4f41e91109 100644 --- a/client/transaction-pool/graph/src/pool.rs +++ b/client/transaction-pool/graph/src/pool.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ hash, collections::HashMap, diff --git a/client/transaction-pool/graph/src/ready.rs b/client/transaction-pool/graph/src/ready.rs index dcd55f980f..b5807ffce4 100644 --- a/client/transaction-pool/graph/src/ready.rs +++ b/client/transaction-pool/graph/src/ready.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ collections::{HashMap, HashSet, BTreeSet}, cmp, diff --git a/client/transaction-pool/graph/src/rotator.rs b/client/transaction-pool/graph/src/rotator.rs index a6bb855f23..65e21d0d4b 100644 --- a/client/transaction-pool/graph/src/rotator.rs +++ b/client/transaction-pool/graph/src/rotator.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Rotate extrinsic inside the pool. //! //! Keeps only recent extrinsic and discard the ones kept for a significant amount of time. diff --git a/client/transaction-pool/graph/src/validated_pool.rs b/client/transaction-pool/graph/src/validated_pool.rs index 66047ad50d..7e8e91efe8 100644 --- a/client/transaction-pool/graph/src/validated_pool.rs +++ b/client/transaction-pool/graph/src/validated_pool.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use std::{ collections::{HashSet, HashMap}, hash, diff --git a/client/transaction-pool/graph/src/watcher.rs b/client/transaction-pool/graph/src/watcher.rs index 1c03c0e6a8..9d9a91bb23 100644 --- a/client/transaction-pool/graph/src/watcher.rs +++ b/client/transaction-pool/graph/src/watcher.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Extrinsics status updates. use futures::Stream; diff --git a/client/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs index f2cd9c707f..725fb6ec4a 100644 --- a/client/transaction-pool/src/api.rs +++ b/client/transaction-pool/src/api.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Chain api required for the transaction pool. use std::{marker::PhantomData, pin::Pin, sync::Arc}; diff --git a/client/transaction-pool/src/error.rs b/client/transaction-pool/src/error.rs index fa05ca6a64..c0f795df18 100644 --- a/client/transaction-pool/src/error.rs +++ b/client/transaction-pool/src/error.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Transaction pool error. use sp_transaction_pool::error::Error as TxPoolError; diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 8976003b7d..05d7189a04 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Substrate transaction pool implementation. #![recursion_limit="256"] diff --git a/client/transaction-pool/src/metrics.rs b/client/transaction-pool/src/metrics.rs index 68c5042f2d..e377b2fe82 100644 --- a/client/transaction-pool/src/metrics.rs +++ b/client/transaction-pool/src/metrics.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Transaction pool Prometheus metrics. use std::sync::Arc; diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index 261ef5a140..33f3a3da47 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Pool periodic revalidation. use std::{sync::Arc, pin::Pin, collections::{HashMap, HashSet, BTreeMap}}; diff --git a/client/transaction-pool/src/testing/mod.rs b/client/transaction-pool/src/testing/mod.rs index c22d61491a..350c4137c3 100644 --- a/client/transaction-pool/src/testing/mod.rs +++ b/client/transaction-pool/src/testing/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Tests for top-level transaction pool api mod pool; diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 0b5ce8e90d..4f30d5b6c3 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + use crate::*; use sp_transaction_pool::TransactionStatus; use futures::executor::block_on; -- GitLab From b3d38bfdb5842a7eba5bcc8eed9a7cd65aca0d11 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 20 May 2020 21:12:49 +0200 Subject: [PATCH 026/280] Turn a SmallVec into VecDeque for performances (#6091) * Turn a SmallVec into VecDeque for performances * Fix the other SmallVecs --- .../src/protocol/generic_proto/behaviour.rs | 64 ++++++++++--------- .../protocol/generic_proto/handler/legacy.rs | 17 +++-- .../generic_proto/handler/notif_in.rs | 14 ++-- .../generic_proto/handler/notif_out.rs | 22 +++---- 4 files changed, 58 insertions(+), 59 deletions(-) diff --git a/client/network/src/protocol/generic_proto/behaviour.rs b/client/network/src/protocol/generic_proto/behaviour.rs index 32cf417ec4..9d48d40bdf 100644 --- a/client/network/src/protocol/generic_proto/behaviour.rs +++ b/client/network/src/protocol/generic_proto/behaviour.rs @@ -34,7 +34,7 @@ use prometheus_endpoint::HistogramVec; use rand::distributions::{Distribution as _, Uniform}; use smallvec::SmallVec; use std::task::{Context, Poll}; -use std::{borrow::Cow, cmp, collections::hash_map::Entry}; +use std::{borrow::Cow, cmp, collections::{hash_map::Entry, VecDeque}}; use std::{error, mem, pin::Pin, str, time::Duration}; use wasm_timer::Instant; @@ -135,7 +135,7 @@ pub struct GenericProto { next_incoming_index: sc_peerset::IncomingIndex, /// Events to produce from `poll()`. - events: SmallVec<[NetworkBehaviourAction; 4]>, + events: VecDeque>, /// If `Some`, report the message queue sizes on this `Histogram`. queue_size_report: Option, @@ -340,7 +340,7 @@ impl GenericProto { peers: FnvHashMap::default(), incoming: SmallVec::new(), next_incoming_index: sc_peerset::IncomingIndex(0), - events: SmallVec::new(), + events: VecDeque::new(), queue_size_report, } } @@ -374,7 +374,7 @@ impl GenericProto { // Send an event to all the peers we're connected to, updating the handshake message. for (peer_id, _) in self.peers.iter().filter(|(_, state)| state.is_connected()) { - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::UpdateHandshake { @@ -446,7 +446,7 @@ impl GenericProto { debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", peer_id); self.peerset.dropped(peer_id.clone()); debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", peer_id); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, @@ -471,7 +471,7 @@ impl GenericProto { inc.alive = false; debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", peer_id); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, @@ -562,7 +562,7 @@ impl GenericProto { ); trace!(target: "sub-libp2p", "Handler({:?}) <= Packet", target); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: target.clone(), handler: NotifyHandler::One(conn), event: NotifsHandlerIn::SendNotification { @@ -592,7 +592,7 @@ impl GenericProto { trace!(target: "sub-libp2p", "External API => Packet for {:?}", target); trace!(target: "sub-libp2p", "Handler({:?}) <= Packet", target); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: target.clone(), handler: NotifyHandler::One(conn), event: NotifsHandlerIn::SendLegacy { @@ -614,7 +614,7 @@ impl GenericProto { // If there's no entry in `self.peers`, start dialing. debug!(target: "sub-libp2p", "PSM => Connect({:?}): Starting to connect", entry.key()); debug!(target: "sub-libp2p", "Libp2p <= Dial {:?}", entry.key()); - self.events.push(NetworkBehaviourAction::DialPeer { + self.events.push_back(NetworkBehaviourAction::DialPeer { peer_id: entry.key().clone(), condition: DialPeerCondition::Disconnected }); @@ -638,7 +638,7 @@ impl GenericProto { PeerState::Banned { .. } => { debug!(target: "sub-libp2p", "PSM => Connect({:?}): Starting to connect", occ_entry.key()); debug!(target: "sub-libp2p", "Libp2p <= Dial {:?}", occ_entry.key()); - self.events.push(NetworkBehaviourAction::DialPeer { + self.events.push_back(NetworkBehaviourAction::DialPeer { peer_id: occ_entry.key().clone(), condition: DialPeerCondition::Disconnected }); @@ -662,7 +662,7 @@ impl GenericProto { debug!(target: "sub-libp2p", "PSM => Connect({:?}): Enabling connections.", occ_entry.key()); debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", occ_entry.key()); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: occ_entry.key().clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, @@ -681,7 +681,7 @@ impl GenericProto { incoming for incoming peer") } debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", occ_entry.key()); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: occ_entry.key().clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, @@ -746,7 +746,7 @@ impl GenericProto { PeerState::Enabled { open } => { debug!(target: "sub-libp2p", "PSM => Drop({:?}): Disabling connections.", entry.key()); debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", entry.key()); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: entry.key().clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, @@ -801,7 +801,7 @@ impl GenericProto { debug!(target: "sub-libp2p", "PSM => Accept({:?}, {:?}): Enabling connections.", index, incoming.peer_id); debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", incoming.peer_id); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: incoming.peer_id, handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, @@ -834,7 +834,7 @@ impl GenericProto { debug!(target: "sub-libp2p", "PSM => Reject({:?}, {:?}): Rejecting connections.", index, incoming.peer_id); debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", incoming.peer_id); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: incoming.peer_id, handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, @@ -881,7 +881,7 @@ impl NetworkBehaviour for GenericProto { peer_id, endpoint ); *st = PeerState::Enabled { open: SmallVec::new() }; - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::One(*conn), event: NotifsHandlerIn::Enable @@ -925,7 +925,7 @@ impl NetworkBehaviour for GenericProto { "Libp2p => Connected({},{:?}): Not requested by PSM, disabling.", peer_id, endpoint); *st = PeerState::Disabled { open: SmallVec::new(), banned_until }; - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::One(*conn), event: NotifsHandlerIn::Disable @@ -941,7 +941,7 @@ impl NetworkBehaviour for GenericProto { (PeerState::Enabled { .. }, _) => { debug!(target: "sub-libp2p", "Handler({},{:?}) <= Enable secondary connection", peer_id, conn); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::One(*conn), event: NotifsHandlerIn::Enable @@ -951,7 +951,7 @@ impl NetworkBehaviour for GenericProto { (PeerState::Disabled { .. }, _) | (PeerState::DisabledPendingEnable { .. }, _) => { debug!(target: "sub-libp2p", "Handler({},{:?}) <= Disable secondary connection", peer_id, conn); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::One(*conn), event: NotifsHandlerIn::Disable @@ -979,7 +979,7 @@ impl NetworkBehaviour for GenericProto { reason: "Disconnected by libp2p".into(), }; - self.events.push(NetworkBehaviourAction::GenerateEvent(event)); + self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); } } _ => {} @@ -1144,7 +1144,7 @@ impl NetworkBehaviour for GenericProto { debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", source); debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", source); self.peerset.dropped(source.clone()); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: source.clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, @@ -1216,7 +1216,7 @@ impl NetworkBehaviour for GenericProto { reason, peer_id: source, }; - self.events.push(NetworkBehaviourAction::GenerateEvent(event)); + self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); } else { debug!(target: "sub-libp2p", "Secondary connection closed custom protocol."); } @@ -1254,7 +1254,7 @@ impl NetworkBehaviour for GenericProto { if first { debug!(target: "sub-libp2p", "External API <= Open({:?})", source); let event = GenericProtoOut::CustomProtocolOpen { peer_id: source }; - self.events.push(NetworkBehaviourAction::GenerateEvent(event)); + self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); } else { debug!(target: "sub-libp2p", "Secondary connection opened custom protocol."); } @@ -1269,7 +1269,7 @@ impl NetworkBehaviour for GenericProto { message, }; - self.events.push(NetworkBehaviourAction::GenerateEvent(event)); + self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); } NotifsHandlerOut::Notification { protocol_name, message } => { @@ -1287,7 +1287,7 @@ impl NetworkBehaviour for GenericProto { message, }; - self.events.push(NetworkBehaviourAction::GenerateEvent(event)); + self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); } NotifsHandlerOut::Clogged { messages } => { @@ -1296,7 +1296,7 @@ impl NetworkBehaviour for GenericProto { trace!(target: "sub-libp2p", "External API <= Clogged({:?})", source); warn!(target: "sub-libp2p", "Queue of packets to send to {:?} is \ pretty large", source); - self.events.push(NetworkBehaviourAction::GenerateEvent(GenericProtoOut::Clogged { + self.events.push_back(NetworkBehaviourAction::GenerateEvent(GenericProtoOut::Clogged { peer_id: source, messages, })); @@ -1335,6 +1335,10 @@ impl NetworkBehaviour for GenericProto { Self::OutEvent, >, > { + if let Some(event) = self.events.pop_front() { + return Poll::Ready(event); + } + // Poll for instructions from the peerset. // Note that the peerset is a *best effort* crate, and we have to use defensive programming. loop { @@ -1368,7 +1372,7 @@ impl NetworkBehaviour for GenericProto { } debug!(target: "sub-libp2p", "Libp2p <= Dial {:?} now that ban has expired", peer_id); - self.events.push(NetworkBehaviourAction::DialPeer { + self.events.push_back(NetworkBehaviourAction::DialPeer { peer_id: peer_id.clone(), condition: DialPeerCondition::Disconnected }); @@ -1390,7 +1394,7 @@ impl NetworkBehaviour for GenericProto { } debug!(target: "sub-libp2p", "Handler({:?}) <= Enable (ban expired)", peer_id); - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push_back(NetworkBehaviourAction::NotifyHandler { peer_id: peer_id.clone(), handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, @@ -1402,8 +1406,8 @@ impl NetworkBehaviour for GenericProto { } } - if !self.events.is_empty() { - return Poll::Ready(self.events.remove(0)) + if let Some(event) = self.events.pop_front() { + return Poll::Ready(event); } Poll::Pending diff --git a/client/network/src/protocol/generic_proto/handler/legacy.rs b/client/network/src/protocol/generic_proto/handler/legacy.rs index e51b37139b..c7de2d265e 100644 --- a/client/network/src/protocol/generic_proto/handler/legacy.rs +++ b/client/network/src/protocol/generic_proto/handler/legacy.rs @@ -30,7 +30,7 @@ use libp2p::swarm::{ }; use log::{debug, error}; use smallvec::{smallvec, SmallVec}; -use std::{borrow::Cow, error, fmt, io, mem, time::Duration}; +use std::{borrow::Cow, collections::VecDeque, error, fmt, io, mem, time::Duration}; use std::{pin::Pin, task::{Context, Poll}}; /// Implements the `IntoProtocolsHandler` trait of libp2p. @@ -117,7 +117,7 @@ impl IntoProtocolsHandler for LegacyProtoHandlerProto { substreams: SmallVec::new(), init_deadline: Delay::new(Duration::from_secs(20)) }, - events_queue: SmallVec::new(), + events_queue: VecDeque::new(), } } } @@ -142,7 +142,7 @@ pub struct LegacyProtoHandler { /// /// This queue must only ever be modified to insert elements at the back, or remove the first /// element. - events_queue: SmallVec<[ProtocolsHandlerEvent; 16]>, + events_queue: VecDeque>, } /// State of the handler. @@ -277,7 +277,7 @@ impl LegacyProtoHandler { ProtocolState::Init { substreams: incoming, .. } => { if incoming.is_empty() { if let ConnectedPoint::Dialer { .. } = self.endpoint { - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { + self.events_queue.push_back(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(self.protocol.clone()), info: (), }); @@ -290,7 +290,7 @@ impl LegacyProtoHandler { version: incoming[0].protocol_version(), endpoint: self.endpoint.clone() }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(event)); ProtocolState::Normal { substreams: incoming.into_iter().collect(), shutdown: SmallVec::new() @@ -488,7 +488,7 @@ impl LegacyProtoHandler { version: substream.protocol_version(), endpoint: self.endpoint.clone() }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(event)); ProtocolState::Normal { substreams: smallvec![substream], shutdown: SmallVec::new() @@ -565,7 +565,7 @@ impl ProtocolsHandler for LegacyProtoHandler { _ => false, }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(LegacyProtoHandlerOut::ProtocolError { + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(LegacyProtoHandlerOut::ProtocolError { is_severe, error: Box::new(err), })); @@ -587,8 +587,7 @@ impl ProtocolsHandler for LegacyProtoHandler { ProtocolsHandlerEvent > { // Flush the events queue if necessary. - if !self.events_queue.is_empty() { - let event = self.events_queue.remove(0); + if let Some(event) = self.events_queue.pop_front() { return Poll::Ready(event) } diff --git a/client/network/src/protocol/generic_proto/handler/notif_in.rs b/client/network/src/protocol/generic_proto/handler/notif_in.rs index ef4644c548..be78fb970e 100644 --- a/client/network/src/protocol/generic_proto/handler/notif_in.rs +++ b/client/network/src/protocol/generic_proto/handler/notif_in.rs @@ -37,8 +37,7 @@ use libp2p::swarm::{ NegotiatedSubstream, }; use log::{error, warn}; -use smallvec::SmallVec; -use std::{borrow::Cow, fmt, pin::Pin, task::{Context, Poll}}; +use std::{borrow::Cow, collections::VecDeque, fmt, pin::Pin, task::{Context, Poll}}; /// Implements the `IntoProtocolsHandler` trait of libp2p. /// @@ -70,7 +69,7 @@ pub struct NotifsInHandler { /// /// This queue is only ever modified to insert elements at the back, or remove the first /// element. - events_queue: SmallVec<[ProtocolsHandlerEvent; 16]>, + events_queue: VecDeque>, } /// Event that can be received by a `NotifsInHandler`. @@ -130,7 +129,7 @@ impl IntoProtocolsHandler for NotifsInHandlerProto { in_protocol: self.in_protocol, substream: None, pending_accept_refuses: 0, - events_queue: SmallVec::new(), + events_queue: VecDeque::new(), } } } @@ -160,7 +159,7 @@ impl ProtocolsHandler for NotifsInHandler { ) { // If a substream already exists, we drop it and replace it with the new incoming one. if self.substream.is_some() { - self.events_queue.push(ProtocolsHandlerEvent::Custom(NotifsInHandlerOut::Closed)); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(NotifsInHandlerOut::Closed)); } // Note that we drop the existing substream, which will send an equivalent to a TCP "RST" @@ -171,7 +170,7 @@ impl ProtocolsHandler for NotifsInHandler { // and we can't close "more" than that anyway. self.substream = Some(proto); - self.events_queue.push(ProtocolsHandlerEvent::Custom(NotifsInHandlerOut::OpenRequest(msg))); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(NotifsInHandlerOut::OpenRequest(msg))); self.pending_accept_refuses = self.pending_accept_refuses .checked_add(1) .unwrap_or_else(|| { @@ -233,8 +232,7 @@ impl ProtocolsHandler for NotifsInHandler { ProtocolsHandlerEvent > { // Flush the events queue if necessary. - if !self.events_queue.is_empty() { - let event = self.events_queue.remove(0); + if let Some(event) = self.events_queue.pop_front() { return Poll::Ready(event) } diff --git a/client/network/src/protocol/generic_proto/handler/notif_out.rs b/client/network/src/protocol/generic_proto/handler/notif_out.rs index b5d6cd61ad..6b97ad67e3 100644 --- a/client/network/src/protocol/generic_proto/handler/notif_out.rs +++ b/client/network/src/protocol/generic_proto/handler/notif_out.rs @@ -35,8 +35,7 @@ use libp2p::swarm::{ }; use log::{debug, warn, error}; use prometheus_endpoint::Histogram; -use smallvec::SmallVec; -use std::{borrow::Cow, fmt, mem, pin::Pin, task::{Context, Poll}, time::Duration}; +use std::{borrow::Cow, collections::VecDeque, fmt, mem, pin::Pin, task::{Context, Poll}, time::Duration}; use wasm_timer::Instant; /// Maximum duration to open a substream and receive the handshake message. After that, we @@ -85,7 +84,7 @@ impl IntoProtocolsHandler for NotifsOutHandlerProto { when_connection_open: Instant::now(), queue_size_report: self.queue_size_report, state: State::Disabled, - events_queue: SmallVec::new(), + events_queue: VecDeque::new(), peer_id: peer_id.clone(), } } @@ -116,7 +115,7 @@ pub struct NotifsOutHandler { /// /// This queue must only ever be modified to insert elements at the back, or remove the first /// element. - events_queue: SmallVec<[ProtocolsHandlerEvent; 16]>, + events_queue: VecDeque>, /// Who we are connected to. peer_id: PeerId, @@ -247,7 +246,7 @@ impl ProtocolsHandler for NotifsOutHandler { match mem::replace(&mut self.state, State::Poisoned) { State::Opening { initial_message } => { let ev = NotifsOutHandlerOut::Open { handshake: handshake_msg }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(ev)); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(ev)); self.state = State::Open { substream, initial_message }; }, // If the handler was disabled while we were negotiating the protocol, immediately @@ -267,7 +266,7 @@ impl ProtocolsHandler for NotifsOutHandler { match mem::replace(&mut self.state, State::Poisoned) { State::Disabled => { let proto = NotificationsOut::new(self.protocol_name.clone(), initial_message.clone()); - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { + self.events_queue.push_back(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(proto).with_timeout(OPEN_TIMEOUT), info: (), }); @@ -287,7 +286,7 @@ impl ProtocolsHandler for NotifsOutHandler { } let proto = NotificationsOut::new(self.protocol_name.clone(), initial_message.clone()); - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { + self.events_queue.push_back(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(proto).with_timeout(OPEN_TIMEOUT), info: (), }); @@ -347,7 +346,7 @@ impl ProtocolsHandler for NotifsOutHandler { State::Opening { .. } => { self.state = State::Refused; let ev = NotifsOutHandlerOut::Refused; - self.events_queue.push(ProtocolsHandlerEvent::Custom(ev)); + self.events_queue.push_back(ProtocolsHandlerEvent::Custom(ev)); }, State::DisabledOpening => self.state = State::Disabled, State::Poisoned => error!("☎️ Notifications handler in a poisoned state"), @@ -371,9 +370,8 @@ impl ProtocolsHandler for NotifsOutHandler { cx: &mut Context, ) -> Poll> { // Flush the events queue if necessary. - if !self.events_queue.is_empty() { - let event = self.events_queue.remove(0); - return Poll::Ready(event); + if let Some(event) = self.events_queue.pop_front() { + return Poll::Ready(event) } match &mut self.state { @@ -385,7 +383,7 @@ impl ProtocolsHandler for NotifsOutHandler { let initial_message = mem::replace(initial_message, Vec::new()); self.state = State::Opening { initial_message: initial_message.clone() }; let proto = NotificationsOut::new(self.protocol_name.clone(), initial_message); - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { + self.events_queue.push_back(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(proto).with_timeout(OPEN_TIMEOUT), info: (), }); -- GitLab From 9650348f6b24e4d1337710b2b019b01490c186ff Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 20 May 2020 21:33:16 +0200 Subject: [PATCH 027/280] evm: allow setting pre-defined accounts in genesis (#6086) * evm: allow setting pre-defined accounts in genesis * Only build GenesisAccount in std --- bin/node/runtime/src/lib.rs | 2 +- frame/evm/src/lib.rs | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 834aabbef8..eb8344d3e9 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -93,7 +93,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 249, + spec_version: 250, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index a2354c7761..eab3c80a93 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -25,6 +25,10 @@ mod backend; pub use crate::backend::{Account, Log, Vicinity, Backend}; use sp_std::{vec::Vec, marker::PhantomData}; +#[cfg(feature = "std")] +use codec::{Encode, Decode}; +#[cfg(feature = "std")] +use serde::{Serialize, Deserialize}; use frame_support::{ensure, decl_module, decl_storage, decl_event, decl_error}; use frame_support::weights::{Weight, DispatchClass, FunctionOf, Pays}; use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement, Get}; @@ -137,12 +141,43 @@ pub trait Trait: frame_system::Trait + pallet_timestamp::Trait { } } +#[cfg(feature = "std")] +#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, Serialize, Deserialize)] +/// Account definition used for genesis block construction. +pub struct GenesisAccount { + /// Account nonce. + pub nonce: U256, + /// Account balance. + pub balance: U256, + /// Full account storage. + pub storage: std::collections::BTreeMap, + /// Account code. + pub code: Vec, +} + decl_storage! { trait Store for Module as EVM { - Accounts get(fn accounts) config(): map hasher(blake2_128_concat) H160 => Account; + Accounts get(fn accounts): map hasher(blake2_128_concat) H160 => Account; AccountCodes: map hasher(blake2_128_concat) H160 => Vec; AccountStorages: double_map hasher(blake2_128_concat) H160, hasher(blake2_128_concat) H256 => H256; } + + add_extra_genesis { + config(accounts): std::collections::BTreeMap; + build(|config: &GenesisConfig| { + for (address, account) in &config.accounts { + Accounts::insert(address, Account { + balance: account.balance, + nonce: account.nonce, + }); + AccountCodes::insert(address, &account.code); + + for (index, value) in &account.storage { + AccountStorages::insert(address, index, value); + } + } + }); + } } decl_event! { -- GitLab From 7fccdfac8232b2286c3dfd481ffcb2744ebc070b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 20 May 2020 22:08:20 +0200 Subject: [PATCH 028/280] Make planning epoch config change in BABE easier (#5776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make planning epoch config change in BABE easier * Bump node runtime version * Update frame/babe/src/lib.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * BabeEpochConfiguration -> NextConfigDescriptor * Add tests for babe config changes Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva --- frame/babe/src/lib.rs | 21 ++++++++++++++++++--- frame/babe/src/tests.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/frame/babe/src/lib.rs b/frame/babe/src/lib.rs index 6d32c22249..153ff0e992 100644 --- a/frame/babe/src/lib.rs +++ b/frame/babe/src/lib.rs @@ -42,7 +42,7 @@ use sp_inherents::{InherentIdentifier, InherentData, ProvideInherent, MakeFatalE use sp_consensus_babe::{ BABE_ENGINE_ID, ConsensusLog, BabeAuthorityWeight, SlotNumber, inherents::{INHERENT_IDENTIFIER, BabeInherentData}, - digests::{NextEpochDescriptor, PreDigest}, + digests::{NextEpochDescriptor, NextConfigDescriptor, PreDigest}, }; use sp_consensus_vrf::schnorrkel; pub use sp_consensus_babe::{AuthorityId, VRF_OUTPUT_LENGTH, RANDOMNESS_LENGTH, PUBLIC_KEY_LENGTH}; @@ -136,6 +136,9 @@ decl_storage! { // variable to its underlying value. pub Randomness get(fn randomness): schnorrkel::Randomness; + /// Next epoch configuration, if changed. + NextEpochConfig: Option; + /// Next epoch randomness. NextRandomness: schnorrkel::Randomness; @@ -364,6 +367,15 @@ impl Module { }) } + /// Plan an epoch config change. The epoch config change is recorded and will be enacted on the + /// next call to `enact_epoch_change`. The config will be activated one epoch after. Multiple calls to this + /// method will replace any existing planned config change that had not been enacted yet. + pub fn plan_config_change( + config: NextConfigDescriptor, + ) { + NextEpochConfig::put(config); + } + /// DANGEROUS: Enact an epoch change. Should be done on every block where `should_epoch_change` has returned `true`, /// and the caller is the only caller of this function. /// @@ -399,12 +411,15 @@ impl Module { // so that nodes can track changes. let next_randomness = NextRandomness::get(); - let next = NextEpochDescriptor { + let next_epoch = NextEpochDescriptor { authorities: next_authorities, randomness: next_randomness, }; + Self::deposit_consensus(ConsensusLog::NextEpochData(next_epoch)); - Self::deposit_consensus(ConsensusLog::NextEpochData(next)) + if let Some(next_config) = NextEpochConfig::take() { + Self::deposit_consensus(ConsensusLog::NextConfigData(next_config)); + } } // finds the start slot of the current epoch. only guaranteed to diff --git a/frame/babe/src/tests.rs b/frame/babe/src/tests.rs index be2d3ed036..ecb3639fc5 100644 --- a/frame/babe/src/tests.rs +++ b/frame/babe/src/tests.rs @@ -22,6 +22,7 @@ use mock::*; use frame_support::traits::OnFinalize; use pallet_session::ShouldEndSession; use sp_core::crypto::IsWrappedBy; +use sp_consensus_babe::AllowedSlots; use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; const EMPTY_RANDOMNESS: [u8; 32] = [ @@ -150,3 +151,35 @@ fn can_predict_next_epoch_change() { assert_eq!(Babe::next_expected_epoch_change(System::block_number()), Some(5 + 2)); }) } + +#[test] +fn can_enact_next_config() { + new_test_ext(0).1.execute_with(|| { + assert_eq!(::EpochDuration::get(), 3); + // this sets the genesis slot to 6; + go_to_block(1, 6); + assert_eq!(Babe::genesis_slot(), 6); + assert_eq!(Babe::current_slot(), 6); + assert_eq!(Babe::epoch_index(), 0); + go_to_block(2, 7); + + Babe::plan_config_change(NextConfigDescriptor::V1 { + c: (1, 4), + allowed_slots: AllowedSlots::PrimarySlots, + }); + + progress_to_block(4); + Babe::on_finalize(9); + let header = System::finalize(); + + let consensus_log = sp_consensus_babe::ConsensusLog::NextConfigData( + sp_consensus_babe::digests::NextConfigDescriptor::V1 { + c: (1, 4), + allowed_slots: AllowedSlots::PrimarySlots, + } + ); + let consensus_digest = DigestItem::Consensus(BABE_ENGINE_ID, consensus_log.encode()); + + assert_eq!(header.digest.logs[2], consensus_digest.clone()) + }); +} -- GitLab From a97a49347d955716b40ed1185352ba236f9809d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Thu, 21 May 2020 12:16:04 +0200 Subject: [PATCH 029/280] Allow fee calculation to happen off-chain (#6076) * Emit a PaymentParameters event once per block This contains per-block paramaters need to calculate fees off-chain. * Add WeightToFee trait * Add documentation to polynomial types * Ignore pseudo code snippet for doc tests * Use `Mul` implementation of Perbill * Add tests for WeightToFeePolynomial * Revert "Emit a PaymentParameters event once per block" This reverts commit 6c4763baff3d8179676a3c1660fe7063fd56a8ca. Co-authored-by: Gavin Wood --- Cargo.lock | 46 ++++---- bin/node-template/runtime/src/lib.rs | 7 +- bin/node/executor/tests/basic.rs | 11 +- bin/node/executor/tests/fees.rs | 11 +- bin/node/runtime/src/impls.rs | 21 ++-- bin/node/runtime/src/lib.rs | 11 +- frame/balances/src/tests_composite.rs | 6 +- frame/balances/src/tests_local.rs | 6 +- frame/contracts/src/tests.rs | 4 +- frame/executive/src/lib.rs | 12 ++- frame/support/Cargo.toml | 1 + frame/support/src/weights.rs | 147 ++++++++++++++++++++++++++ frame/transaction-payment/Cargo.toml | 1 + frame/transaction-payment/src/lib.rs | 36 +++++-- 14 files changed, 241 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42a3c10cbf..8bd5963b81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -749,7 +749,7 @@ dependencies = [ "log", "regalloc", "serde", - "smallvec 1.3.0", + "smallvec 1.4.0", "target-lexicon", "thiserror", ] @@ -787,7 +787,7 @@ checksum = "e45f82e3446dd1ebb8c2c2f6a6b0e6cd6cd52965c7e5f7b1b35e9a9ace31ccde" dependencies = [ "cranelift-codegen", "log", - "smallvec 1.3.0", + "smallvec 1.4.0", "target-lexicon", ] @@ -1488,6 +1488,7 @@ dependencies = [ "paste", "pretty_assertions", "serde", + "smallvec 1.4.0", "sp-arithmetic", "sp-core", "sp-inherents", @@ -1875,7 +1876,7 @@ dependencies = [ "byteorder 1.3.4", "fallible-iterator", "indexmap", - "smallvec 1.3.0", + "smallvec 1.4.0", "stable_deref_trait", ] @@ -2495,7 +2496,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e763b2a9b500ba47948061d1e8bc3b5f03a8a1f067dbcf822a4d2c84d2b54a3a" dependencies = [ "parity-util-mem", - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] @@ -2524,7 +2525,7 @@ dependencies = [ "parking_lot 0.10.2", "regex", "rocksdb", - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] @@ -2630,7 +2631,7 @@ dependencies = [ "parity-multiaddr 0.9.0", "parking_lot 0.10.2", "pin-project", - "smallvec 1.3.0", + "smallvec 1.4.0", "wasm-timer", ] @@ -2661,7 +2662,7 @@ dependencies = [ "ring", "rw-stream-sink", "sha2", - "smallvec 1.3.0", + "smallvec 1.4.0", "thiserror", "unsigned-varint", "void", @@ -2714,7 +2715,7 @@ dependencies = [ "prost", "prost-build", "rand 0.7.3", - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] @@ -2737,7 +2738,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sha2", - "smallvec 1.3.0", + "smallvec 1.4.0", "unsigned-varint", "wasm-timer", ] @@ -2754,7 +2755,7 @@ dependencies = [ "log", "prost", "prost-build", - "smallvec 1.3.0", + "smallvec 1.4.0", "wasm-timer", ] @@ -2778,7 +2779,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sha2", - "smallvec 1.3.0", + "smallvec 1.4.0", "uint", "unsigned-varint", "void", @@ -2802,7 +2803,7 @@ dependencies = [ "log", "net2", "rand 0.7.3", - "smallvec 1.3.0", + "smallvec 1.4.0", "void", "wasm-timer", ] @@ -2931,7 +2932,7 @@ dependencies = [ "libp2p-core", "log", "rand 0.7.3", - "smallvec 1.3.0", + "smallvec 1.4.0", "void", "wasm-timer", ] @@ -3299,7 +3300,7 @@ dependencies = [ "futures 0.3.4", "log", "pin-project", - "smallvec 1.3.0", + "smallvec 1.4.0", "unsigned-varint", ] @@ -4652,6 +4653,7 @@ dependencies = [ "pallet-balances", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", + "smallvec 1.4.0", "sp-core", "sp-io", "sp-runtime", @@ -4847,7 +4849,7 @@ dependencies = [ "parity-util-mem-derive", "parking_lot 0.10.2", "primitive-types", - "smallvec 1.3.0", + "smallvec 1.4.0", "winapi 0.3.8", ] @@ -4923,7 +4925,7 @@ dependencies = [ "cloudabi", "libc", "redox_syscall", - "smallvec 1.3.0", + "smallvec 1.4.0", "winapi 0.3.8", ] @@ -5614,7 +5616,7 @@ checksum = "b27b256b41986ac5141b37b8bbba85d314fbf546c182eb255af6720e07e4f804" dependencies = [ "log", "rustc-hash", - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] @@ -7198,9 +7200,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" +checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] name = "snow" @@ -7247,7 +7249,7 @@ dependencies = [ "log", "rand 0.7.3", "sha1", - "smallvec 1.3.0", + "smallvec 1.4.0", "static_assertions", "thiserror", ] @@ -8973,7 +8975,7 @@ dependencies = [ "hashbrown", "log", "rustc-hex", - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] @@ -9077,7 +9079,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" dependencies = [ - "smallvec 1.3.0", + "smallvec 1.4.0", ] [[package]] diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 2037f7bb77..55fa4cd4aa 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -15,8 +15,7 @@ use sp_runtime::{ transaction_validity::{TransactionValidity, TransactionSource}, }; use sp_runtime::traits::{ - BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount, NumberFor, - Saturating, + BlakeTwo256, Block as BlockT, IdentityLookup, Verify, IdentifyAccount, NumberFor, Saturating, }; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -36,7 +35,7 @@ pub use frame_support::{ construct_runtime, parameter_types, StorageValue, traits::{KeyOwnerProofSystem, Randomness}, weights::{ - Weight, + Weight, IdentityFee, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, }, }; @@ -244,7 +243,7 @@ impl transaction_payment::Trait for Runtime { type Currency = balances::Module; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 9350c3546f..857f438e1c 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -19,12 +19,15 @@ use codec::{Encode, Decode, Joiner}; use frame_support::{ StorageValue, StorageMap, traits::Currency, - weights::{GetDispatchInfo, DispatchInfo, DispatchClass, constants::ExtrinsicBaseWeight}, + weights::{ + GetDispatchInfo, DispatchInfo, DispatchClass, constants::ExtrinsicBaseWeight, + WeightToFeePolynomial, + }, }; use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys}; use sp_runtime::{ ApplyExtrinsicResult, Fixed128, - traits::{Hash as HashT, Convert}, + traits::Hash as HashT, transaction_validity::InvalidTransaction, }; use pallet_contracts::ContractAddressFor; @@ -54,9 +57,9 @@ fn transfer_fee(extrinsic: &E, fee_multiplier: Fixed128) -> Balance { let length_fee = TransactionByteFee::get() * (extrinsic.encode().len() as Balance); let base_weight = ExtrinsicBaseWeight::get(); - let base_fee = ::WeightToFee::convert(base_weight); + let base_fee = ::WeightToFee::calc(&base_weight); let weight = default_transfer_call().get_dispatch_info().weight; - let weight_fee = ::WeightToFee::convert(weight); + let weight_fee = ::WeightToFee::calc(&weight); base_fee + fee_multiplier.saturated_multiply_accumulate(length_fee + weight_fee) } diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs index 0e55f781e7..c4c3ca0bfc 100644 --- a/bin/node/executor/tests/fees.rs +++ b/bin/node/executor/tests/fees.rs @@ -19,16 +19,15 @@ use codec::{Encode, Joiner}; use frame_support::{ StorageValue, StorageMap, traits::Currency, - weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight}, + weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial}, }; use sp_core::NeverNativeValue; -use sp_runtime::{Fixed128, Perbill, traits::Convert}; +use sp_runtime::{Fixed128, Perbill}; use node_runtime::{ CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, - TransactionByteFee, WeightFeeCoefficient, + TransactionByteFee, constants::currency::*, }; -use node_runtime::impls::LinearWeightToFee; use node_primitives::Balance; use node_testing::keyring::*; @@ -181,13 +180,13 @@ fn transaction_fee_is_correct_ultimate() { let mut balance_alice = (100 - 69) * DOLLARS; let base_weight = ExtrinsicBaseWeight::get(); - let base_fee = LinearWeightToFee::::convert(base_weight); + let base_fee = IdentityFee::::calc(&base_weight); let length_fee = TransactionByteFee::get() * (xt.clone().encode().len() as Balance); balance_alice -= length_fee; let weight = default_transfer_call().get_dispatch_info().weight; - let weight_fee = LinearWeightToFee::::convert(weight); + let weight_fee = IdentityFee::::calc(&weight); // we know that weight to fee multiplier is effect-less in block 1. // current weight of transfer = 200_000_000 diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index ef994392b5..884bde08df 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -21,7 +21,9 @@ use core::num::NonZeroI128; use node_primitives::Balance; use sp_runtime::traits::{Convert, Saturating}; use sp_runtime::{Fixed128, Perquintill}; -use frame_support::{traits::{OnUnbalanced, Currency, Get}, weights::Weight}; +use frame_support::{ + traits::{OnUnbalanced, Currency, Get}, +}; use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance}; pub struct Author; @@ -47,18 +49,6 @@ impl Convert for CurrencyToVoteHandler { fn convert(x: u128) -> Balance { x * Self::factor() } } -/// Convert from weight to balance via a simple coefficient multiplication -/// The associated type C encapsulates a constant in units of balance per weight -pub struct LinearWeightToFee(sp_std::marker::PhantomData); - -impl> Convert for LinearWeightToFee { - fn convert(w: Weight) -> Balance { - // setting this to zero will disable the weight fee. - let coefficient = C::get(); - Balance::from(w).saturating_mul(coefficient) - } -} - /// Update the given multiplier based on the following formula /// /// diff = (previous_block_weight - target_weight)/max_weight @@ -120,7 +110,7 @@ mod tests { use sp_runtime::assert_eq_error_rate; use crate::{MaximumBlockWeight, AvailableBlockRatio, Runtime}; use crate::{constants::currency::*, TransactionPayment, TargetBlockFullness}; - use frame_support::weights::Weight; + use frame_support::weights::{Weight, WeightToFeePolynomial}; use core::num::NonZeroI128; fn max() -> Weight { @@ -228,7 +218,8 @@ mod tests { if fm == next { panic!("The fee should ever increase"); } fm = next; iterations += 1; - let fee = ::WeightToFee::convert(tx_weight); + let fee = + ::WeightToFee::calc(&tx_weight); let adjusted_fee = fm.saturated_multiply_accumulate(fee); println!( "iteration {}, new fm = {:?}. Fee at this point is: {} units / {} millicents, \ diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index eb8344d3e9..209e86e747 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -26,7 +26,7 @@ use sp_std::prelude::*; use frame_support::{ construct_runtime, parameter_types, debug, weights::{ - Weight, + Weight, IdentityFee, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, }, traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier}, @@ -74,7 +74,7 @@ pub use pallet_staking::StakerStatus; /// Implementations of some helper traits passed into runtime modules as associated types. pub mod impls; -use impls::{CurrencyToVoteHandler, Author, LinearWeightToFee, TargetedFeeAdjustment}; +use impls::{CurrencyToVoteHandler, Author, TargetedFeeAdjustment}; /// Constant values used within the runtime. pub mod constants; @@ -228,9 +228,6 @@ impl pallet_balances::Trait for Runtime { parameter_types! { pub const TransactionByteFee: Balance = 10 * MILLICENTS; - // In the Substrate node, a weight of 10_000_000 (smallest non-zero weight) - // is mapped to 10_000_000 units of fees, hence: - pub const WeightFeeCoefficient: Balance = 1; // for a sane configuration, this should always be less than `AvailableBlockRatio`. pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); } @@ -239,7 +236,9 @@ impl pallet_transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; type TransactionByteFee = TransactionByteFee; - type WeightToFee = LinearWeightToFee; + // In the Substrate node, a weight of 10_000_000 (smallest non-zero weight) + // is mapped to 10_000_000 units of fees, hence: + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = TargetedFeeAdjustment; } diff --git a/frame/balances/src/tests_composite.rs b/frame/balances/src/tests_composite.rs index 78cdc3838b..7b9ec1f91e 100644 --- a/frame/balances/src/tests_composite.rs +++ b/frame/balances/src/tests_composite.rs @@ -21,14 +21,14 @@ use sp_runtime::{ Perbill, - traits::{ConvertInto, IdentityLookup}, + traits::IdentityLookup, testing::Header, }; use sp_core::H256; use sp_io; use frame_support::{impl_outer_origin, parameter_types}; use frame_support::traits::Get; -use frame_support::weights::{Weight, DispatchInfo}; +use frame_support::weights::{Weight, DispatchInfo, IdentityFee}; use std::cell::RefCell; use crate::{GenesisConfig, Module, Trait, decl_tests, tests::CallWithDispatchInfo}; @@ -87,7 +87,7 @@ impl pallet_transaction_payment::Trait for Test { type Currency = Module; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } impl Trait for Test { diff --git a/frame/balances/src/tests_local.rs b/frame/balances/src/tests_local.rs index 4b0700748c..9ff76839f4 100644 --- a/frame/balances/src/tests_local.rs +++ b/frame/balances/src/tests_local.rs @@ -21,14 +21,14 @@ use sp_runtime::{ Perbill, - traits::{ConvertInto, IdentityLookup}, + traits::IdentityLookup, testing::Header, }; use sp_core::H256; use sp_io; use frame_support::{impl_outer_origin, parameter_types}; use frame_support::traits::{Get, StorageMapShim}; -use frame_support::weights::{Weight, DispatchInfo}; +use frame_support::weights::{Weight, DispatchInfo, IdentityFee}; use std::cell::RefCell; use crate::{GenesisConfig, Module, Trait, decl_tests, tests::CallWithDispatchInfo}; @@ -87,7 +87,7 @@ impl pallet_transaction_payment::Trait for Test { type Currency = Module; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } impl Trait for Test { diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 4dfaa8035f..23c0417dac 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -37,7 +37,7 @@ use frame_support::{ assert_ok, assert_err, assert_err_ignore_postinfo, impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types, storage::child, StorageMap, StorageValue, traits::{Currency, Get}, - weights::{DispatchInfo, DispatchClass, Weight, PostDispatchInfo, Pays}, + weights::{DispatchInfo, DispatchClass, Weight, PostDispatchInfo, Pays, IdentityFee}, }; use std::{cell::RefCell, sync::atomic::{AtomicUsize, Ordering}}; use sp_core::storage::well_known_keys; @@ -152,7 +152,7 @@ impl pallet_transaction_payment::Trait for Test { type Currency = Balances; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = Test; + type WeightToFee = IdentityFee>; type FeeMultiplierUpdate = (); } diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index 9ac323828d..f7ac060a6c 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -454,12 +454,12 @@ mod tests { use sp_core::H256; use sp_runtime::{ generic::Era, Perbill, DispatchError, testing::{Digest, Header, Block}, - traits::{Header as HeaderT, BlakeTwo256, IdentityLookup, Convert, ConvertInto}, + traits::{Header as HeaderT, BlakeTwo256, IdentityLookup}, transaction_validity::{InvalidTransaction, UnknownTransaction, TransactionValidityError}, }; use frame_support::{ impl_outer_event, impl_outer_origin, parameter_types, impl_outer_dispatch, - weights::{Weight, RuntimeDbWeight}, + weights::{Weight, RuntimeDbWeight, IdentityFee, WeightToFeePolynomial}, traits::{Currency, LockIdentifier, LockableCurrency, WithdrawReasons, WithdrawReason}, }; use frame_system::{self as system, Call as SystemCall, ChainContext, LastRuntimeUpgradeInfo}; @@ -589,7 +589,7 @@ mod tests { type Currency = Balances; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } impl custom::Trait for Runtime {} @@ -675,7 +675,8 @@ mod tests { }.assimilate_storage(&mut t).unwrap(); let xt = TestXt::new(Call::Balances(BalancesCall::transfer(2, 69)), sign_extra(1, 0, 0)); let weight = xt.get_dispatch_info().weight + ::ExtrinsicBaseWeight::get(); - let fee: Balance = ::WeightToFee::convert(weight); + let fee: Balance + = ::WeightToFee::calc(&weight); let mut t = sp_io::TestExternalities::new(t); t.execute_with(|| { Executive::initialize_block(&Header::new( @@ -871,7 +872,8 @@ mod tests { ); let weight = xt.get_dispatch_info().weight + ::ExtrinsicBaseWeight::get(); - let fee: Balance = ::WeightToFee::convert(weight); + let fee: Balance = + ::WeightToFee::calc(&weight); Executive::initialize_block(&Header::new( 1, H256::default(), diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index 3213f0dfe4..61363be2df 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -29,6 +29,7 @@ once_cell = { version = "1", default-features = false, optional = true } sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" +smallvec = "1.4.0" [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/frame/support/src/weights.rs b/frame/support/src/weights.rs index a0d150cbe9..771f908ecf 100644 --- a/frame/support/src/weights.rs +++ b/frame/support/src/weights.rs @@ -135,6 +135,9 @@ use sp_runtime::{ generic::{CheckedExtrinsic, UncheckedExtrinsic}, }; use crate::dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, DispatchError}; +use sp_runtime::traits::SaturatedConversion; +use sp_arithmetic::{Perbill, traits::{BaseArithmetic, Saturating}}; +use smallvec::{smallvec, SmallVec}; /// Re-export priority as type pub use sp_runtime::transaction_validity::TransactionPriority; @@ -530,6 +533,90 @@ impl RuntimeDbWeight { } } +/// One coefficient and its position in the `WeightToFeePolynomial`. +/// +/// One term of polynomial is calculated as: +/// +/// ```ignore +/// coeff_integer * x^(degree) + coeff_frac * x^(degree) +/// ``` +/// +/// The `negative` value encodes whether the term is added or substracted from the +/// overall polynomial result. +#[derive(Clone, Encode, Decode)] +pub struct WeightToFeeCoefficient { + /// The integral part of the coefficient. + pub coeff_integer: Balance, + /// The fractional part of the coefficient. + pub coeff_frac: Perbill, + /// True iff the coefficient should be interpreted as negative. + pub negative: bool, + /// Degree/exponent of the term. + pub degree: u8, +} + +/// A list of coefficients that represent one polynomial. +pub type WeightToFeeCoefficients = SmallVec<[WeightToFeeCoefficient; 4]>; + +/// A trait that describes the weight to fee calculation as polynomial. +/// +/// An implementor should only implement the `polynomial` function. +pub trait WeightToFeePolynomial { + /// The type that is returned as result from polynomial evaluation. + type Balance: BaseArithmetic + From + Copy; + + /// Returns a polynomial that describes the weight to fee conversion. + /// + /// This is the only function that should be manually implemented. Please note + /// that all calculation is done in the probably unsigned `Balance` type. This means + /// that the order of coefficients is important as putting the negative coefficients + /// first will most likely saturate the result to zero mid evaluation. + fn polynomial() -> WeightToFeeCoefficients; + + /// Calculates the fee from the passed `weight` according to the `polynomial`. + /// + /// This should not be overriden in most circumstances. Calculation is done in the + /// `Balance` type and never overflows. All evaluation is saturating. + fn calc(weight: &Weight) -> Self::Balance { + Self::polynomial().iter().fold(Self::Balance::saturated_from(0u32), |mut acc, args| { + let w = Self::Balance::saturated_from(*weight).saturating_pow(args.degree.into()); + + // The sum could get negative. Therefore we only sum with the accumulator. + // The Perbill Mul implementation is non overflowing. + let frac = args.coeff_frac * w; + let integer = args.coeff_integer.saturating_mul(w); + + if args.negative { + acc = acc.saturating_sub(frac); + acc = acc.saturating_sub(integer); + } else { + acc = acc.saturating_add(frac); + acc = acc.saturating_add(integer); + } + + acc + }) + } +} + +/// Implementor of `WeightToFeePolynomial` that maps one unit of weight to one unit of fee. +pub struct IdentityFee(sp_std::marker::PhantomData); + +impl WeightToFeePolynomial for IdentityFee where + T: BaseArithmetic + From + Copy +{ + type Balance = T; + + fn polynomial() -> WeightToFeeCoefficients { + smallvec!(WeightToFeeCoefficient { + coeff_integer: 1u32.into(), + coeff_frac: Perbill::zero(), + negative: false, + degree: 1, + }) + } +} + #[cfg(test)] #[allow(dead_code)] mod tests { @@ -651,4 +738,64 @@ mod tests { 1000 ); } + + type Balance = u64; + + // 0.5x^3 + 2.333x2 + 7x - 10_000 + struct Poly; + impl WeightToFeePolynomial for Poly { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + smallvec![ + WeightToFeeCoefficient { + coeff_integer: 0, + coeff_frac: Perbill::from_fraction(0.5), + negative: false, + degree: 3 + }, + WeightToFeeCoefficient { + coeff_integer: 2, + coeff_frac: Perbill::from_rational_approximation(1u32, 3u32), + negative: false, + degree: 2 + }, + WeightToFeeCoefficient { + coeff_integer: 7, + coeff_frac: Perbill::zero(), + negative: false, + degree: 1 + }, + WeightToFeeCoefficient { + coeff_integer: 10_000, + coeff_frac: Perbill::zero(), + negative: true, + degree: 0 + }, + ] + } + } + + #[test] + fn polynomial_works() { + assert_eq!(Poly::calc(&100), 514033); + assert_eq!(Poly::calc(&10_123), 518917034928); + } + + #[test] + fn polynomial_does_not_underflow() { + assert_eq!(Poly::calc(&0), 0); + } + + #[test] + fn polynomial_does_not_overflow() { + assert_eq!(Poly::calc(&Weight::max_value()), Balance::max_value() - 10_000); + } + + #[test] + fn identity_fee_works() { + assert_eq!(IdentityFee::::calc(&0), 0); + assert_eq!(IdentityFee::::calc(&50), 50); + assert_eq!(IdentityFee::::calc(&Weight::max_value()), Balance::max_value()); + } } diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index 0f8b05c3dd..56efe907f5 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -18,6 +18,7 @@ sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../pr frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "./rpc/runtime-api" } +smallvec = "1.4.0" [dev-dependencies] sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 17fe11db6c..71ef8a56c2 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -37,7 +37,10 @@ use codec::{Encode, Decode}; use frame_support::{ decl_storage, decl_module, traits::{Currency, Get, OnUnbalanced, ExistenceRequirement, WithdrawReason, Imbalance}, - weights::{Weight, DispatchInfo, PostDispatchInfo, GetDispatchInfo, Pays}, + weights::{ + Weight, DispatchInfo, PostDispatchInfo, GetDispatchInfo, Pays, WeightToFeePolynomial, + WeightToFeeCoefficient, + }, dispatch::DispatchResult, }; use sp_runtime::{ @@ -72,7 +75,7 @@ pub trait Trait: frame_system::Trait { type TransactionByteFee: Get>; /// Convert a weight value into a deductible fee based on the currency type. - type WeightToFee: Convert>; + type WeightToFee: WeightToFeePolynomial>; /// Update the multiplier of the next block, based on the previous block's weight. type FeeMultiplierUpdate: Convert; @@ -89,9 +92,13 @@ decl_module! { /// The fee to be paid for making a transaction; the per-byte portion. const TransactionByteFee: BalanceOf = T::TransactionByteFee::get(); + /// The polynomial that is applied in order to derive fee from weight. + const WeightToFee: Vec>> = + T::WeightToFee::polynomial().to_vec(); + fn on_finalize() { NextFeeMultiplier::mutate(|fm| { - *fm = T::FeeMultiplierUpdate::convert(*fm) + *fm = T::FeeMultiplierUpdate::convert(*fm); }); } } @@ -183,7 +190,7 @@ impl Module { // cap the weight to the maximum defined in runtime, otherwise it will be the // `Bounded` maximum of its data type, which is not desired. let capped_weight = weight.min(::MaximumBlockWeight::get()); - T::WeightToFee::convert(capped_weight) + T::WeightToFee::calc(&capped_weight) } } @@ -318,7 +325,10 @@ mod tests { use codec::Encode; use frame_support::{ impl_outer_dispatch, impl_outer_origin, parameter_types, - weights::{DispatchClass, DispatchInfo, PostDispatchInfo, GetDispatchInfo, Weight}, + weights::{ + DispatchClass, DispatchInfo, PostDispatchInfo, GetDispatchInfo, Weight, + WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, + }, }; use pallet_balances::Call as BalancesCall; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; @@ -329,6 +339,7 @@ mod tests { Perbill, }; use std::cell::RefCell; + use smallvec::smallvec; const CALL: &::Call = &Call::Balances(BalancesCall::transfer(2, 69)); @@ -411,10 +422,17 @@ mod tests { fn get() -> u64 { TRANSACTION_BYTE_FEE.with(|v| *v.borrow()) } } - pub struct WeightToFee(u64); - impl Convert for WeightToFee { - fn convert(t: Weight) -> u64 { - WEIGHT_TO_FEE.with(|v| *v.borrow() * (t as u64)) + pub struct WeightToFee; + impl WeightToFeePolynomial for WeightToFee { + type Balance = u64; + + fn polynomial() -> WeightToFeeCoefficients { + smallvec![WeightToFeeCoefficient { + degree: 1, + coeff_frac: Perbill::zero(), + coeff_integer: WEIGHT_TO_FEE.with(|v| *v.borrow()), + negative: false, + }] } } -- GitLab From 1789c6d5983a23d66c59e9a5b6b2b00a0391e027 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Thu, 21 May 2020 13:50:37 +0200 Subject: [PATCH 030/280] Handle piping error for commands that output to stdout (#6098) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Handle piping error for commands that output to stdout * Apply suggestions from code review Co-authored-by: Bastian Köcher --- .gitignore | 1 + client/cli/src/commands/build_spec_cmd.rs | 7 ++++--- client/cli/src/commands/export_state_cmd.rs | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6398c09fe7..353d49df28 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ rls*.log .local **/hfuzz_target/ **/hfuzz_workspace/ +.cargo/ diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs index 2f9e2fa059..d2e2ef3a54 100644 --- a/client/cli/src/commands/build_spec_cmd.rs +++ b/client/cli/src/commands/build_spec_cmd.rs @@ -24,6 +24,7 @@ use log::info; use sc_network::config::build_multiaddr; use sc_service::{config::MultiaddrWithPeerId, Configuration}; use structopt::StructOpt; +use std::io::Write; /// The `build-spec` command used to build a specification. #[derive(Debug, StructOpt, Clone)] @@ -66,9 +67,9 @@ impl BuildSpecCmd { } let json = sc_service::chain_ops::build_spec(&*spec, raw_output)?; - - print!("{}", json); - + if std::io::stdout().write_all(json.as_bytes()).is_err() { + let _ = std::io::stderr().write_all(b"Error writing to stdout\n"); + } Ok(()) } } diff --git a/client/cli/src/commands/export_state_cmd.rs b/client/cli/src/commands/export_state_cmd.rs index 3ad6772882..33111e7737 100644 --- a/client/cli/src/commands/export_state_cmd.rs +++ b/client/cli/src/commands/export_state_cmd.rs @@ -22,7 +22,7 @@ use crate::{ use log::info; use sc_service::{Configuration, ServiceBuilderCommand}; use sp_runtime::traits::{Block as BlockT, NumberFor}; -use std::{fmt::Debug, str::FromStr}; +use std::{fmt::Debug, str::FromStr, io::Write}; use structopt::StructOpt; /// The `export-state` command used to export the state of a given block into @@ -65,9 +65,9 @@ impl ExportStateCmd { info!("Generating new chain spec..."); let json = sc_service::chain_ops::build_spec(&*input_spec, true)?; - - print!("{}", json); - + if std::io::stdout().write_all(json.as_bytes()).is_err() { + let _ = std::io::stderr().write_all(b"Error writing to stdout\n"); + } Ok(()) } } -- GitLab From 292a8a595d75405ce84e9278bda23839f744401a Mon Sep 17 00:00:00 2001 From: thiolliere Date: Thu, 21 May 2020 13:51:47 +0200 Subject: [PATCH 031/280] Allow operational recovery path if on_initialize use fullblock. (#6089) * note_preimage using operational * Update frame/democracy/src/lib.rs Co-authored-by: Gavin Wood --- bin/node/runtime/src/lib.rs | 1 + frame/democracy/src/lib.rs | 157 +++++++++++++++++--------- frame/democracy/src/tests.rs | 7 ++ frame/democracy/src/tests/preimage.rs | 40 ++++--- 4 files changed, 138 insertions(+), 67 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 209e86e747..2f8e393aa4 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -378,6 +378,7 @@ impl pallet_democracy::Trait for Runtime { type VetoOrigin = pallet_collective::EnsureMember; type CooloffPeriod = CooloffPeriod; type PreimageByteDeposit = PreimageByteDeposit; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; type Slash = Treasury; type Scheduler = Scheduler; type MaxVotes = MaxVotes; diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index e0f1ec9b5c..039d48d75c 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -108,8 +108,10 @@ //! Preimage actions: //! - `note_preimage` - Registers the preimage for an upcoming proposal, requires //! a deposit that is returned once the proposal is enacted. +//! - `note_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`. //! - `note_imminent_preimage` - Registers the preimage for an upcoming proposal. //! Does not require a deposit, but the proposal must be in the dispatch queue. +//! - `note_imminent_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`. //! - `reap_preimage` - Removes the preimage for an expired proposal. Will only //! work under the condition that it's the same account that noted it and //! after the voting period, OR it's a different account after the enactment period. @@ -285,6 +287,9 @@ pub trait Trait: frame_system::Trait + Sized { /// The amount of balance that must be deposited per byte of preimage stored. type PreimageByteDeposit: Get>; + /// An origin that can provide a preimage using operational extrinsics. + type OperationalPreimageOrigin: EnsureOrigin; + /// Handler for the unbalanced reduction when slashing a preimage deposit. type Slash: OnUnbalanced>; @@ -542,7 +547,7 @@ mod weight_for { /// - Db writes per votes: `ReferendumInfoOf` /// - Base Weight: 65.78 + 8.229 * R µs // NOTE: weight must cover an incorrect voting of origin with 100 votes. - pub(crate) fn delegate(votes: Weight) -> Weight { + pub fn delegate(votes: Weight) -> Weight { T::DbWeight::get().reads_writes(votes.saturating_add(3), votes.saturating_add(3)) .saturating_add(66_000_000) .saturating_add(votes.saturating_mul(8_100_000)) @@ -554,7 +559,7 @@ mod weight_for { /// - Db reads per votes: `ReferendumInfoOf` /// - Db writes per votes: `ReferendumInfoOf` /// - Base Weight: 33.29 + 8.104 * R µs - pub(crate) fn undelegate(votes: Weight) -> Weight { + pub fn undelegate(votes: Weight) -> Weight { T::DbWeight::get().reads_writes(votes.saturating_add(2), votes.saturating_add(2)) .saturating_add(33_000_000) .saturating_add(votes.saturating_mul(8_000_000)) @@ -565,7 +570,7 @@ mod weight_for { /// - Db reads: `Proxy`, `proxy account` /// - Db writes: `proxy account` /// - Base Weight: 68.61 + 8.039 * R µs - pub(crate) fn proxy_delegate(votes: Weight) -> Weight { + pub fn proxy_delegate(votes: Weight) -> Weight { T::DbWeight::get().reads_writes(votes.saturating_add(5), votes.saturating_add(4)) .saturating_add(69_000_000) .saturating_add(votes.saturating_mul(8_000_000)) @@ -575,11 +580,37 @@ mod weight_for { /// same as `undelegate with additional: /// Db reads: `Proxy` /// Base Weight: 39 + 7.958 * R µs - pub(crate) fn proxy_undelegate(votes: Weight) -> Weight { + pub fn proxy_undelegate(votes: Weight) -> Weight { T::DbWeight::get().reads_writes(votes.saturating_add(3), votes.saturating_add(2)) .saturating_add(40_000_000) .saturating_add(votes.saturating_mul(8_000_000)) } + + /// Calculate the weight for `note_preimage`. + /// # + /// - Complexity: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). + /// - Db reads: `Preimages` + /// - Db writes: `Preimages` + /// - Base Weight: 37.93 + .004 * b µs + /// # + pub fn note_preimage(encoded_proposal_len: Weight) -> Weight { + T::DbWeight::get().reads_writes(1, 1) + .saturating_add(38_000_000) + .saturating_add(encoded_proposal_len.saturating_mul(4_000)) + } + + /// Calculate the weight for `note_imminent_preimage`. + /// # + /// - Complexity: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). + /// - Db reads: `Preimages` + /// - Db writes: `Preimages` + /// - Base Weight: 28.04 + .003 * b µs + /// # + pub fn note_imminent_preimage(encoded_proposal_len: Weight) -> Weight { + T::DbWeight::get().reads_writes(1, 1) + .saturating_add(28_000_000) + .saturating_add(encoded_proposal_len.saturating_mul(3_000)) + } } decl_module! { @@ -1157,33 +1188,21 @@ decl_module! { /// Emits `PreimageNoted`. /// /// # - /// - Complexity: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). - /// - Db reads: `Preimages` - /// - Db writes: `Preimages` - /// - Base Weight: 37.93 + .004 * b µs + /// see `weight_for::note_preimage` /// # - #[weight = 38_000_000 + 4_000 * Weight::from(encoded_proposal.len() as u32) - + T::DbWeight::get().reads_writes(1, 1)] + #[weight = weight_for::note_preimage::((encoded_proposal.len() as u32).into())] fn note_preimage(origin, encoded_proposal: Vec) { - let who = ensure_signed(origin)?; - let proposal_hash = T::Hashing::hash(&encoded_proposal[..]); - ensure!(!>::contains_key(&proposal_hash), Error::::DuplicatePreimage); - - let deposit = >::from(encoded_proposal.len() as u32) - .saturating_mul(T::PreimageByteDeposit::get()); - T::Currency::reserve(&who, deposit)?; - - let now = >::block_number(); - let a = PreimageStatus::Available { - data: encoded_proposal, - provider: who.clone(), - deposit, - since: now, - expiry: None, - }; - >::insert(proposal_hash, a); + Self::note_preimage_inner(ensure_signed(origin)?, encoded_proposal)?; + } - Self::deposit_event(RawEvent::PreimageNoted(proposal_hash, who, deposit)); + /// Same as `note_preimage` but origin is `OperationalPreimageOrigin`. + #[weight = ( + weight_for::note_preimage::((encoded_proposal.len() as u32).into()), + DispatchClass::Operational, + )] + fn note_preimage_operational(origin, encoded_proposal: Vec) { + let who = T::OperationalPreimageOrigin::ensure_origin(origin)?; + Self::note_preimage_inner(who, encoded_proposal)?; } /// Register the preimage for an upcoming proposal. This requires the proposal to be @@ -1196,32 +1215,21 @@ decl_module! { /// Emits `PreimageNoted`. /// /// # - /// - Complexity: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). - /// - Db reads: `Preimages` - /// - Db writes: `Preimages` - /// - Base Weight: 28.04 + .003 * b µs + /// see `weight_for::note_preimage` /// # - #[weight = 28_000_000 + 3_000 * Weight::from(encoded_proposal.len() as u32) - + T::DbWeight::get().reads_writes(1, 1)] + #[weight = weight_for::note_imminent_preimage::((encoded_proposal.len() as u32).into())] fn note_imminent_preimage(origin, encoded_proposal: Vec) { - let who = ensure_signed(origin)?; - let proposal_hash = T::Hashing::hash(&encoded_proposal[..]); - Self::check_pre_image_is_missing(proposal_hash)?; - let status = Preimages::::get(&proposal_hash).ok_or(Error::::NotImminent)?; - let expiry = status.to_missing_expiry().ok_or(Error::::DuplicatePreimage)?; - - let now = >::block_number(); - let free = >::zero(); - let a = PreimageStatus::Available { - data: encoded_proposal, - provider: who.clone(), - deposit: Zero::zero(), - since: now, - expiry: Some(expiry), - }; - >::insert(proposal_hash, a); + Self::note_imminent_preimage_inner(ensure_signed(origin)?, encoded_proposal)?; + } - Self::deposit_event(RawEvent::PreimageNoted(proposal_hash, who, free)); + /// Same as `note_imminent_preimage` but origin is `OperationalPreimageOrigin`. + #[weight = ( + weight_for::note_imminent_preimage::((encoded_proposal.len() as u32).into()), + DispatchClass::Operational, + )] + fn note_imminent_preimage_operational(origin, encoded_proposal: Vec) { + let who = T::OperationalPreimageOrigin::ensure_origin(origin)?; + Self::note_imminent_preimage_inner(who, encoded_proposal)?; } /// Remove an expired proposal preimage and collect the deposit. @@ -2030,6 +2038,53 @@ impl Module { Ok(len) } + + // See `note_preimage` + fn note_preimage_inner(who: T::AccountId, encoded_proposal: Vec) -> DispatchResult { + let proposal_hash = T::Hashing::hash(&encoded_proposal[..]); + ensure!(!>::contains_key(&proposal_hash), Error::::DuplicatePreimage); + + let deposit = >::from(encoded_proposal.len() as u32) + .saturating_mul(T::PreimageByteDeposit::get()); + T::Currency::reserve(&who, deposit)?; + + let now = >::block_number(); + let a = PreimageStatus::Available { + data: encoded_proposal, + provider: who.clone(), + deposit, + since: now, + expiry: None, + }; + >::insert(proposal_hash, a); + + Self::deposit_event(RawEvent::PreimageNoted(proposal_hash, who, deposit)); + + Ok(()) + } + + // See `note_imminent_preimage` + fn note_imminent_preimage_inner(who: T::AccountId, encoded_proposal: Vec) -> DispatchResult { + let proposal_hash = T::Hashing::hash(&encoded_proposal[..]); + Self::check_pre_image_is_missing(proposal_hash)?; + let status = Preimages::::get(&proposal_hash).ok_or(Error::::NotImminent)?; + let expiry = status.to_missing_expiry().ok_or(Error::::DuplicatePreimage)?; + + let now = >::block_number(); + let free = >::zero(); + let a = PreimageStatus::Available { + data: encoded_proposal, + provider: who.clone(), + deposit: Zero::zero(), + since: now, + expiry: Some(expiry), + }; + >::insert(proposal_hash, a); + + Self::deposit_event(RawEvent::PreimageNoted(proposal_hash, who, free)); + + Ok(()) + } } /// Decode `Compact` from the trie at given key. diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index d039f3382f..c567aec0b6 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -187,6 +187,7 @@ impl super::Trait for Test { type InstantAllowed = InstantAllowed; type Scheduler = Scheduler; type MaxVotes = MaxVotes; + type OperationalPreimageOrigin = EnsureSignedBy; } pub fn new_test_ext() -> sp_io::TestExternalities { @@ -200,6 +201,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities { ext } +/// Execute the function two times, with `true` and with `false`. +pub fn new_test_ext_execute_with_cond(execute: impl FnOnce(bool) -> () + Clone) { + new_test_ext().execute_with(|| (execute.clone())(false)); + new_test_ext().execute_with(|| execute(true)); +} + type System = frame_system::Module; type Balances = pallet_balances::Module; type Scheduler = pallet_scheduler::Module; diff --git a/frame/democracy/src/tests/preimage.rs b/frame/democracy/src/tests/preimage.rs index 094cde86d0..4100a6a6b6 100644 --- a/frame/democracy/src/tests/preimage.rs +++ b/frame/democracy/src/tests/preimage.rs @@ -39,13 +39,14 @@ fn missing_preimage_should_fail() { #[test] fn preimage_deposit_should_be_required_and_returned() { - new_test_ext().execute_with(|| { + new_test_ext_execute_with_cond(|operational| { // fee of 100 is too much. PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 100); assert_noop!( - Democracy::note_preimage(Origin::signed(6), vec![0; 500]), - BalancesError::::InsufficientBalance, - ); + if operational { Democracy::note_preimage_operational(Origin::signed(6), vec![0; 500]) } + else { Democracy::note_preimage(Origin::signed(6), vec![0; 500]) }, + BalancesError::::InsufficientBalance, + ); // fee of 1 is reasonable. PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1); let r = Democracy::inject_referendum( @@ -69,17 +70,20 @@ fn preimage_deposit_should_be_required_and_returned() { #[test] fn preimage_deposit_should_be_reapable_earlier_by_owner() { - new_test_ext().execute_with(|| { + new_test_ext_execute_with_cond(|operational| { PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1); - assert_ok!(Democracy::note_preimage(Origin::signed(6), set_balance_proposal(2))); + assert_ok!( + if operational { Democracy::note_preimage_operational(Origin::signed(6), set_balance_proposal(2)) } + else { Democracy::note_preimage(Origin::signed(6), set_balance_proposal(2)) } + ); assert_eq!(Balances::reserved_balance(6), 12); next_block(); assert_noop!( - Democracy::reap_preimage(Origin::signed(6), set_balance_proposal_hash(2), u32::max_value()), - Error::::TooEarly - ); + Democracy::reap_preimage(Origin::signed(6), set_balance_proposal_hash(2), u32::max_value()), + Error::::TooEarly + ); next_block(); assert_ok!(Democracy::reap_preimage(Origin::signed(6), set_balance_proposal_hash(2), u32::max_value())); @@ -90,14 +94,17 @@ fn preimage_deposit_should_be_reapable_earlier_by_owner() { #[test] fn preimage_deposit_should_be_reapable() { - new_test_ext().execute_with(|| { + new_test_ext_execute_with_cond(|operational| { assert_noop!( Democracy::reap_preimage(Origin::signed(5), set_balance_proposal_hash(2), u32::max_value()), Error::::PreimageMissing ); PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1); - assert_ok!(Democracy::note_preimage(Origin::signed(6), set_balance_proposal(2))); + assert_ok!( + if operational { Democracy::note_preimage_operational(Origin::signed(6), set_balance_proposal(2)) } + else { Democracy::note_preimage(Origin::signed(6), set_balance_proposal(2)) } + ); assert_eq!(Balances::reserved_balance(6), 12); next_block(); @@ -118,7 +125,7 @@ fn preimage_deposit_should_be_reapable() { #[test] fn noting_imminent_preimage_for_free_should_work() { - new_test_ext().execute_with(|| { + new_test_ext_execute_with_cond(|operational| { PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1); let r = Democracy::inject_referendum( @@ -130,14 +137,15 @@ fn noting_imminent_preimage_for_free_should_work() { assert_ok!(Democracy::vote(Origin::signed(1), r, aye(1))); assert_noop!( - Democracy::note_imminent_preimage(Origin::signed(7), set_balance_proposal(2)), - Error::::NotImminent - ); + if operational { Democracy::note_imminent_preimage_operational(Origin::signed(6), set_balance_proposal(2)) } + else { Democracy::note_imminent_preimage(Origin::signed(6), set_balance_proposal(2)) }, + Error::::NotImminent + ); next_block(); // Now we're in the dispatch queue it's all good. - assert_ok!(Democracy::note_imminent_preimage(Origin::signed(7), set_balance_proposal(2))); + assert_ok!(Democracy::note_imminent_preimage(Origin::signed(6), set_balance_proposal(2))); next_block(); -- GitLab From 075ef1cac7caa78df134dc0da458aa202556c3b5 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Thu, 21 May 2020 13:54:50 +0200 Subject: [PATCH 032/280] Optimize network poll (#6099) --- .../src/protocol/generic_proto/behaviour.rs | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/client/network/src/protocol/generic_proto/behaviour.rs b/client/network/src/protocol/generic_proto/behaviour.rs index 9d48d40bdf..b3c209eb0c 100644 --- a/client/network/src/protocol/generic_proto/behaviour.rs +++ b/client/network/src/protocol/generic_proto/behaviour.rs @@ -1364,10 +1364,9 @@ impl NetworkBehaviour for GenericProto { } for (peer_id, peer_state) in self.peers.iter_mut() { - match mem::replace(peer_state, PeerState::Poisoned) { - PeerState::PendingRequest { mut timer, timer_deadline } => { - if let Poll::Pending = Pin::new(&mut timer).poll(cx) { - *peer_state = PeerState::PendingRequest { timer, timer_deadline }; + match peer_state { + PeerState::PendingRequest { timer, .. } => { + if let Poll::Pending = Pin::new(timer).poll(cx) { continue; } @@ -1379,17 +1378,8 @@ impl NetworkBehaviour for GenericProto { *peer_state = PeerState::Requested; } - PeerState::DisabledPendingEnable { - mut timer, - open, - timer_deadline - } => { - if let Poll::Pending = Pin::new(&mut timer).poll(cx) { - *peer_state = PeerState::DisabledPendingEnable { - timer, - open, - timer_deadline - }; + PeerState::DisabledPendingEnable { timer, open, .. } => { + if let Poll::Pending = Pin::new(timer).poll(cx) { continue; } @@ -1399,10 +1389,9 @@ impl NetworkBehaviour for GenericProto { handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, }); - *peer_state = PeerState::Enabled { open }; + *peer_state = PeerState::Enabled { open: mem::replace(open, Default::default()) }; } - - st => *peer_state = st, + _ => {}, } } -- GitLab From 28ff83aed9331aabd9ab05f759017889c30deca5 Mon Sep 17 00:00:00 2001 From: mattrutherford <44339188+mattrutherford@users.noreply.github.com> Date: Thu, 21 May 2020 12:55:00 +0100 Subject: [PATCH 033/280] Increase precision of benchmarking results summary (#6092) Co-authored-by: Matt Rutherford --- bin/node/bench/src/core.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/node/bench/src/core.rs b/bin/node/bench/src/core.rs index a3c25f9ce3..c1b1711549 100644 --- a/bin/node/bench/src/core.rs +++ b/bin/node/bench/src/core.rs @@ -75,14 +75,14 @@ impl fmt::Display for NsFormatter { } if self.0 < 1_000_000 { - return write!(f, "{:.2} ms", v as f64 / 1_000_000.0) + return write!(f, "{:.4} ms", v as f64 / 1_000_000.0) } if self.0 < 100_000_000 { - return write!(f, "{} ms", v as f64 / 1_000_000.0) + return write!(f, "{:.1} ms", v as f64 / 1_000_000.0) } - write!(f, "{:.2} s", v as f64 / 1_000_000_000.0) + write!(f, "{:.4} s", v as f64 / 1_000_000_000.0) } } -- GitLab From 73ff9385303dc06665c9753ec3e7303647e3b8bc Mon Sep 17 00:00:00 2001 From: Demi Obenour Date: Thu, 21 May 2020 11:57:29 +0000 Subject: [PATCH 034/280] Add notes about safe uses of twox (#6082) * Add notes about safe uses of twox * Update frame/grandpa/src/lib.rs Co-authored-by: Nikolay Volf * Update frame/elections/src/lib.rs * Apply suggestions from code review Co-authored-by: Gavin Wood Co-authored-by: Nikolay Volf --- frame/assets/src/lib.rs | 2 ++ frame/babe/src/lib.rs | 2 ++ frame/contracts/src/lib.rs | 2 ++ frame/democracy/src/lib.rs | 10 ++++++++++ frame/elections-phragmen/src/lib.rs | 2 ++ frame/elections/src/lib.rs | 9 +++++++++ frame/generic-asset/src/lib.rs | 8 ++++++++ frame/grandpa/src/lib.rs | 2 ++ frame/identity/src/lib.rs | 4 ++++ 9 files changed, 41 insertions(+) diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 48806e30cd..2c67a320c1 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -257,6 +257,8 @@ decl_storage! { /// The next asset identifier up for grabs. NextAssetId get(fn next_asset_id): T::AssetId; /// The total unit supply of an asset. + /// + /// TWOX-NOTE: `AssetId` is trusted, so this is safe. TotalSupply: map hasher(twox_64_concat) T::AssetId => T::Balance; } } diff --git a/frame/babe/src/lib.rs b/frame/babe/src/lib.rs index 153ff0e992..9142173932 100644 --- a/frame/babe/src/lib.rs +++ b/frame/babe/src/lib.rs @@ -152,6 +152,8 @@ decl_storage! { /// We reset all segments and return to `0` at the beginning of every /// epoch. SegmentIndex build(|_| 0): u32; + + /// TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay. UnderConstruction: map hasher(twox_64_concat) u32 => Vec; /// Temporary value (cleared at block finalization) which is `Some` diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index df53cf0a0e..509229cd96 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -836,6 +836,8 @@ decl_storage! { /// The subtrie counter. pub AccountCounter: u64 = 0; /// The code associated with a given account. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. pub ContractInfoOf: map hasher(twox_64_concat) T::AccountId => Option>; } } diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 039d48d75c..ee9417ce0c 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -344,6 +344,8 @@ decl_storage! { /// The public proposals. Unsorted. The second item is the proposal's hash. pub PublicProps get(fn public_props): Vec<(PropIndex, T::Hash, T::AccountId)>; /// Those who have locked a deposit. + /// + /// TWOX-NOTE: Safe, as increasing integer keys are safe. pub DepositOf get(fn deposit_of): map hasher(twox_64_concat) PropIndex => Option<(Vec, BalanceOf)>; @@ -362,22 +364,30 @@ decl_storage! { pub LowestUnbaked get(fn lowest_unbaked) build(|_| 0 as ReferendumIndex): ReferendumIndex; /// Information concerning any given referendum. + /// + /// TWOX-NOTE: SAFE as indexes are not under an attacker’s control. pub ReferendumInfoOf get(fn referendum_info): map hasher(twox_64_concat) ReferendumIndex => Option>>; /// All votes for a particular voter. We store the balance for the number of votes that we /// have recorded. The second item is the total amount of delegations, that will be added. + /// + /// TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway. pub VotingOf: map hasher(twox_64_concat) T::AccountId => Voting, T::AccountId, T::BlockNumber>; /// Who is able to vote for whom. Value is the fund-holding account, key is the /// vote-transaction-sending account. + /// + /// TWOX-NOTE: OK ― `AccountId` is a secure hash. // TODO: Refactor proxy into its own pallet. // https://github.com/paritytech/substrate/issues/5322 pub Proxy get(fn proxy): map hasher(twox_64_concat) T::AccountId => Option>; /// Accounts for which there are locks in action which may be removed at some point in the /// future. The value is the block number at which the lock expires and may be removed. + /// + /// TWOX-NOTE: OK ― `AccountId` is a secure hash. pub Locks get(fn locks): map hasher(twox_64_concat) T::AccountId => Option; /// True if the last referendum tabled was submitted externally. False if it was a public diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 0c35283e1a..5d7d2bf503 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -197,6 +197,8 @@ decl_storage! { pub ElectionRounds get(fn election_rounds): u32 = Zero::zero(); /// Votes and locked stake of a particular voter. + /// + /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash pub Voting get(fn voting): map hasher(twox_64_concat) T::AccountId => (BalanceOf, Vec); /// The present candidate list. Sorted based on account-id. A current member or runner-up diff --git a/frame/elections/src/lib.rs b/frame/elections/src/lib.rs index b87db45909..1085831373 100644 --- a/frame/elections/src/lib.rs +++ b/frame/elections/src/lib.rs @@ -237,16 +237,25 @@ decl_storage! { // bit-wise manner. In order to get a human-readable representation (`Vec`), use // [`all_approvals_of`]. Furthermore, each vector of scalars is chunked with the cap of // `APPROVAL_SET_SIZE`. + /// + /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash and `SetIndex` is not + /// attacker-controlled. pub ApprovalsOf get(fn approvals_of): map hasher(twox_64_concat) (T::AccountId, SetIndex) => Vec; /// The vote index and list slot that the candidate `who` was registered or `None` if they /// are not currently registered. + /// + /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash. pub RegisterInfoOf get(fn candidate_reg_info): map hasher(twox_64_concat) T::AccountId => Option<(VoteIndex, u32)>; /// Basic information about a voter. + /// + /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash. pub VoterInfoOf get(fn voter_info): map hasher(twox_64_concat) T::AccountId => Option>>; /// The present voter list (chunked and capped at [`VOTER_SET_SIZE`]). + /// + /// TWOX-NOTE: OKAY ― `SetIndex` is not user-controlled data. pub Voters get(fn voters): map hasher(twox_64_concat) SetIndex => Vec>; /// the next free set to store a voter in. This will keep growing. pub NextVoterSet get(fn next_nonfull_voter_set): SetIndex = 0; diff --git a/frame/generic-asset/src/lib.rs b/frame/generic-asset/src/lib.rs index 646e217366..f94c83b5ed 100644 --- a/frame/generic-asset/src/lib.rs +++ b/frame/generic-asset/src/lib.rs @@ -442,16 +442,22 @@ pub struct BalanceLock { decl_storage! { trait Store for Module as GenericAsset { /// Total issuance of a given asset. + /// + /// TWOX-NOTE: `AssetId` is trusted. pub TotalIssuance get(fn total_issuance) build(|config: &GenesisConfig| { let issuance = config.initial_balance * (config.endowed_accounts.len() as u32).into(); config.assets.iter().map(|id| (id.clone(), issuance)).collect::>() }): map hasher(twox_64_concat) T::AssetId => T::Balance; /// The free balance of a given asset under an account. + /// + /// TWOX-NOTE: `AssetId` is trusted. pub FreeBalance: double_map hasher(twox_64_concat) T::AssetId, hasher(blake2_128_concat) T::AccountId => T::Balance; /// The reserved balance of a given asset under an account. + /// + /// TWOX-NOTE: `AssetId` is trusted. pub ReservedBalance: double_map hasher(twox_64_concat) T::AssetId, hasher(blake2_128_concat) T::AccountId => T::Balance; @@ -459,6 +465,8 @@ decl_storage! { pub NextAssetId get(fn next_asset_id) config(): T::AssetId; /// Permission options for a given asset. + /// + /// TWOX-NOTE: `AssetId` is trusted. pub Permissions get(fn get_permission): map hasher(twox_64_concat) T::AssetId => PermissionVersions; diff --git a/frame/grandpa/src/lib.rs b/frame/grandpa/src/lib.rs index 43b6ba0b2f..3432c11020 100644 --- a/frame/grandpa/src/lib.rs +++ b/frame/grandpa/src/lib.rs @@ -212,6 +212,8 @@ decl_storage! { /// A mapping from grandpa set ID to the index of the *most recent* session for which its /// members were responsible. + /// + /// TWOX-NOTE: `SetId` is not under user control. SetIdSession get(fn session_for_set): map hasher(twox_64_concat) SetId => Option; } add_extra_genesis { diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index 6a69797c90..2b58437685 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -389,6 +389,8 @@ pub struct RegistrarInfo< decl_storage! { trait Store for Module as Identity { /// Information that is pertinent to identify the entity behind an account. + /// + /// TWOX-NOTE: OK ― `AccountId` is a secure hash. pub IdentityOf get(fn identity): map hasher(twox_64_concat) T::AccountId => Option>>; @@ -400,6 +402,8 @@ decl_storage! { /// Alternative "sub" identities of this account. /// /// The first item is the deposit, the second is a vector of the accounts. + /// + /// TWOX-NOTE: OK ― `AccountId` is a secure hash. pub SubsOf get(fn subs_of): map hasher(twox_64_concat) T::AccountId => (BalanceOf, Vec); -- GitLab From 14d89b7bff014f22ba5ab081c9552c34abc3ce10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 21 May 2020 12:58:04 +0100 Subject: [PATCH 035/280] babe: treat epoch_authorship RPC method as unsafe (#6069) * service: pass DenyUnsafe to rpc extensions * node: add DenyUnsafe to rpc full node dependencies * client: fix whitespace in rpc policy file * babe: treat epochAuthorship rpc method as unsafe * babe: add test for unsafe rpc method * babe: rename babe rpc handler * service: traitify rpc extension builder * service: make the rpc extensions builder api non-breaking * service: revert changes from light node rpc extensions builder * node: remove unnecessary type in service creation * service: cleanup with_rpc_extensions implementation * service: add missing docs to RpcExtensionBuilder --- Cargo.lock | 4 + bin/node/cli/src/service.rs | 65 +++++++++------ bin/node/rpc/Cargo.toml | 1 + bin/node/rpc/src/lib.rs | 15 +++- client/consensus/babe/rpc/Cargo.toml | 5 +- client/consensus/babe/rpc/src/lib.rs | 56 +++++++++++-- client/rpc-api/src/policy.rs | 36 ++++----- client/service/src/builder.rs | 115 ++++++++++++++++++++++----- client/service/src/lib.rs | 2 +- 9 files changed, 223 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8bd5963b81..6674b8d3ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3567,6 +3567,7 @@ dependencies = [ "sc-finality-grandpa", "sc-finality-grandpa-rpc", "sc-keystore", + "sc-rpc-api", "sp-api", "sp-blockchain", "sp-consensus", @@ -6165,10 +6166,13 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", + "sc-consensus", "sc-consensus-babe", "sc-consensus-epochs", "sc-keystore", + "sc-rpc-api", "serde", + "serde_json", "sp-api", "sp-application-crypto", "sp-blockchain", diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index 7798404ff9..b738b5cf1f 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -43,7 +43,6 @@ macro_rules! new_full_start { ($config:expr) => {{ use std::sync::Arc; - type RpcExtension = jsonrpc_core::IoHandler; let mut import_setup = None; let mut rpc_setup = None; let inherent_data_providers = sp_inherents::InherentDataProviders::new(); @@ -99,30 +98,46 @@ macro_rules! new_full_start { import_setup = Some((block_import, grandpa_link, babe_link)); Ok(import_queue) })? - .with_rpc_extensions(|builder| -> std::result::Result { - let babe_link = import_setup.as_ref().map(|s| &s.2) - .expect("BabeLink is present for full services or set up failed; qed."); + .with_rpc_extensions_builder(|builder| { let grandpa_link = import_setup.as_ref().map(|s| &s.1) .expect("GRANDPA LinkHalf is present for full services or set up failed; qed."); - let shared_authority_set = grandpa_link.shared_authority_set(); + + let shared_authority_set = grandpa_link.shared_authority_set().clone(); let shared_voter_state = grandpa::SharedVoterState::empty(); - let deps = node_rpc::FullDeps { - client: builder.client().clone(), - pool: builder.pool(), - select_chain: builder.select_chain().cloned() - .expect("SelectChain is present for full services or set up failed; qed."), - babe: node_rpc::BabeDeps { - keystore: builder.keystore(), - babe_config: sc_consensus_babe::BabeLink::config(babe_link).clone(), - shared_epoch_changes: sc_consensus_babe::BabeLink::epoch_changes(babe_link).clone() - }, - grandpa: node_rpc::GrandpaDeps { - shared_voter_state: shared_voter_state.clone(), - shared_authority_set: shared_authority_set.clone(), - }, - }; - rpc_setup = Some((shared_voter_state)); - Ok(node_rpc::create_full(deps)) + + rpc_setup = Some((shared_voter_state.clone())); + + let babe_link = import_setup.as_ref().map(|s| &s.2) + .expect("BabeLink is present for full services or set up failed; qed."); + + let babe_config = babe_link.config().clone(); + let shared_epoch_changes = babe_link.epoch_changes().clone(); + + let client = builder.client().clone(); + let pool = builder.pool().clone(); + let select_chain = builder.select_chain().cloned() + .expect("SelectChain is present for full services or set up failed; qed."); + let keystore = builder.keystore().clone(); + + Ok(move |deny_unsafe| { + let deps = node_rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + select_chain: select_chain.clone(), + deny_unsafe, + babe: node_rpc::BabeDeps { + babe_config: babe_config.clone(), + shared_epoch_changes: shared_epoch_changes.clone(), + keystore: keystore.clone(), + }, + grandpa: node_rpc::GrandpaDeps { + shared_voter_state: shared_voter_state.clone(), + shared_authority_set: shared_authority_set.clone(), + }, + }; + + node_rpc::create_full(deps) + }) })?; (builder, import_setup, inherent_data_providers, rpc_setup) @@ -302,7 +317,6 @@ pub fn new_full(config: Configuration) /// Builds a new service for a light client. pub fn new_light(config: Configuration) -> Result { - type RpcExtension = jsonrpc_core::IoHandler; let inherent_data_providers = InherentDataProviders::new(); let service = ServiceBuilder::new_light::(config)? @@ -366,9 +380,7 @@ pub fn new_light(config: Configuration) let provider = client as Arc>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) })? - .with_rpc_extensions(|builder,| -> - Result - { + .with_rpc_extensions(|builder| { let fetcher = builder.fetcher() .ok_or_else(|| "Trying to start node RPC without active fetcher")?; let remote_blockchain = builder.remote_backend() @@ -380,6 +392,7 @@ pub fn new_light(config: Configuration) client: builder.client().clone(), pool: builder.pool(), }; + Ok(node_rpc::create_light(light_deps)) })? .build()?; diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index ef948cd009..5eb0d271b9 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -30,3 +30,4 @@ sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/co sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } sc-finality-grandpa = { version = "0.8.0-dev", path = "../../../client/finality-grandpa" } sc-finality-grandpa-rpc = { version = "0.8.0-dev", path = "../../../client/finality-grandpa/rpc" } +sc-rpc-api = { version = "0.8.0-dev", path = "../../../client/rpc-api" } diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs index 02cb44d402..259a792441 100644 --- a/bin/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -42,9 +42,10 @@ use sc_keystore::KeyStorePtr; use sp_consensus_babe::BabeApi; use sc_consensus_epochs::SharedEpochChanges; use sc_consensus_babe::{Config, Epoch}; -use sc_consensus_babe_rpc::BabeRPCHandler; +use sc_consensus_babe_rpc::BabeRpcHandler; use sc_finality_grandpa::{SharedVoterState, SharedAuthoritySet}; use sc_finality_grandpa_rpc::GrandpaRpcHandler; +use sc_rpc_api::DenyUnsafe; /// Light client extra dependencies. pub struct LightDeps { @@ -84,6 +85,8 @@ pub struct FullDeps { pub pool: Arc

, /// The SelectChain Strategy pub select_chain: SC, + /// Whether to deny unsafe calls + pub deny_unsafe: DenyUnsafe, /// BABE specific dependencies. pub babe: BabeDeps, /// GRANDPA specific dependencies. @@ -115,6 +118,7 @@ pub fn create_full( client, pool, select_chain, + deny_unsafe, babe, grandpa, } = deps; @@ -142,7 +146,14 @@ pub fn create_full( ); io.extend_with( sc_consensus_babe_rpc::BabeApi::to_delegate( - BabeRPCHandler::new(client, shared_epoch_changes, keystore, babe_config, select_chain) + BabeRpcHandler::new( + client, + shared_epoch_changes, + keystore, + babe_config, + select_chain, + deny_unsafe, + ), ) ); io.extend_with( diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 2a0762e1a8..900e29bfba 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-consensus-babe = { version = "0.8.0-dev", path = "../" } +sc-rpc-api = { version = "0.8.0-dev", path = "../../../rpc-api" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" @@ -29,7 +30,9 @@ sp-core = { version = "2.0.0-dev", path = "../../../../primitives/core" } sc-keystore = { version = "2.0.0-dev", path = "../../../keystore" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } +sc-consensus = { version = "0.8.0-dev", path = "../../../consensus/common" } +serde_json = "1.0.50" sp-application-crypto = { version = "2.0.0-dev", path = "../../../../primitives/application-crypto" } sp-keyring = { version = "2.0.0-dev", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 925328a856..8e1282a8d7 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -33,6 +33,7 @@ use sp_consensus_babe::{ }; use serde::{Deserialize, Serialize}; use sc_keystore::KeyStorePtr; +use sc_rpc_api::DenyUnsafe; use sp_api::{ProvideRuntimeApi, BlockId}; use sp_runtime::traits::{Block as BlockT, Header as _}; use sp_consensus::{SelectChain, Error as ConsensusError}; @@ -50,8 +51,8 @@ pub trait BabeApi { fn epoch_authorship(&self) -> FutureResult>; } -/// Implements the BabeRPC trait for interacting with Babe. -pub struct BabeRPCHandler { +/// Implements the BabeRpc trait for interacting with Babe. +pub struct BabeRpcHandler { /// shared reference to the client. client: Arc, /// shared reference to EpochChanges @@ -62,9 +63,11 @@ pub struct BabeRPCHandler { babe_config: Config, /// The SelectChain strategy select_chain: SC, + /// Whether to deny unsafe calls + deny_unsafe: DenyUnsafe, } -impl BabeRPCHandler { +impl BabeRpcHandler { /// Creates a new instance of the BabeRpc handler. pub fn new( client: Arc, @@ -72,6 +75,7 @@ impl BabeRPCHandler { keystore: KeyStorePtr, babe_config: Config, select_chain: SC, + deny_unsafe: DenyUnsafe, ) -> Self { Self { client, @@ -79,11 +83,12 @@ impl BabeRPCHandler { keystore, babe_config, select_chain, + deny_unsafe, } } } -impl BabeApi for BabeRPCHandler +impl BabeApi for BabeRpcHandler where B: BlockT, C: ProvideRuntimeApi + HeaderBackend + HeaderMetadata + 'static, @@ -92,6 +97,10 @@ impl BabeApi for BabeRPCHandler SC: SelectChain + Clone + 'static, { fn epoch_authorship(&self) -> FutureResult> { + if let Err(err) = self.deny_unsafe.check_if_safe() { + return Box::new(rpc_future::err(err.into())); + } + let ( babe_config, keystore, @@ -214,7 +223,10 @@ fn epoch_data( mod tests { use super::*; use substrate_test_runtime_client::{ + runtime::Block, + Backend, DefaultTestClientBuilderExt, + TestClient, TestClientBuilderExt, TestClientBuilder, }; @@ -236,8 +248,9 @@ mod tests { (keystore, keystore_path) } - #[test] - fn rpc() { + fn test_babe_rpc_handler( + deny_unsafe: DenyUnsafe + ) -> BabeRpcHandler> { let builder = TestClientBuilder::new(); let (client, longest_chain) = builder.build_with_longest_chain(); let client = Arc::new(client); @@ -249,9 +262,21 @@ mod tests { ).expect("can initialize block-import"); let epoch_changes = link.epoch_changes().clone(); - let select_chain = longest_chain; let keystore = create_temp_keystore::(Ed25519Keyring::Alice).0; - let handler = BabeRPCHandler::new(client.clone(), epoch_changes, keystore, config, select_chain); + + BabeRpcHandler::new( + client.clone(), + epoch_changes, + keystore, + config, + longest_chain, + deny_unsafe, + ) + } + + #[test] + fn epoch_authorship_works() { + let handler = test_babe_rpc_handler(DenyUnsafe::No); let mut io = IoHandler::new(); io.extend_with(BabeApi::to_delegate(handler)); @@ -260,4 +285,19 @@ mod tests { assert_eq!(Some(response.into()), io.handle_request_sync(request)); } + + #[test] + fn epoch_authorship_is_unsafe() { + let handler = test_babe_rpc_handler(DenyUnsafe::Yes); + let mut io = IoHandler::new(); + + io.extend_with(BabeApi::to_delegate(handler)); + let request = r#"{"jsonrpc":"2.0","method":"babe_epochAuthorship","params": [],"id":1}"#; + + let response = io.handle_request_sync(request).unwrap(); + let mut response: serde_json::Value = serde_json::from_str(&response).unwrap(); + let error: RpcError = serde_json::from_value(response["error"].take()).unwrap(); + + assert_eq!(error, RpcError::method_not_found()) + } } diff --git a/client/rpc-api/src/policy.rs b/client/rpc-api/src/policy.rs index e6e3380e1a..141dcfbc41 100644 --- a/client/rpc-api/src/policy.rs +++ b/client/rpc-api/src/policy.rs @@ -26,21 +26,21 @@ use jsonrpc_core as rpc; /// Signifies whether a potentially unsafe RPC should be denied. #[derive(Clone, Copy, Debug)] pub enum DenyUnsafe { - /// Denies only potentially unsafe RPCs. - Yes, - /// Allows calling every RPCs. - No + /// Denies only potentially unsafe RPCs. + Yes, + /// Allows calling every RPCs. + No, } impl DenyUnsafe { - /// Returns `Ok(())` if the RPCs considered unsafe are safe to call, - /// otherwise returns `Err(UnsafeRpcError)`. - pub fn check_if_safe(self) -> Result<(), UnsafeRpcError> { - match self { - DenyUnsafe::Yes => Err(UnsafeRpcError), - DenyUnsafe::No => Ok(()) - } - } + /// Returns `Ok(())` if the RPCs considered unsafe are safe to call, + /// otherwise returns `Err(UnsafeRpcError)`. + pub fn check_if_safe(self) -> Result<(), UnsafeRpcError> { + match self { + DenyUnsafe::Yes => Err(UnsafeRpcError), + DenyUnsafe::No => Ok(()), + } + } } /// Signifies whether an RPC considered unsafe is denied to be called externally. @@ -48,15 +48,15 @@ impl DenyUnsafe { pub struct UnsafeRpcError; impl std::fmt::Display for UnsafeRpcError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "RPC call is unsafe to be called externally") - } + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "RPC call is unsafe to be called externally") + } } impl std::error::Error for UnsafeRpcError {} impl From for rpc::Error { - fn from(_: UnsafeRpcError) -> rpc::Error { - rpc::Error::method_not_found() - } + fn from(_: UnsafeRpcError) -> rpc::Error { + rpc::Error::method_not_found() + } } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index cc7929e88c..16d78c49e1 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -96,12 +96,61 @@ pub struct ServiceBuilder, finality_proof_provider: Option, transaction_pool: Arc, - rpc_extensions: TRpc, + rpc_extensions_builder: Box + Send>, remote_backend: Option>>, marker: PhantomData<(TBl, TRtApi)>, block_announce_validator_builder: Option) -> Box + Send> + Send>>, } +/// A utility trait for building an RPC extension given a `DenyUnsafe` instance. +/// This is useful since at service definition time we don't know whether the +/// specific interface where the RPC extension will be exposed is safe or not. +/// This trait allows us to lazily build the RPC extension whenever we bind the +/// service to an interface. +pub trait RpcExtensionBuilder { + /// The type of the RPC extension that will be built. + type Output: sc_rpc::RpcExtension; + + /// Returns an instance of the RPC extension for a particular `DenyUnsafe` + /// value, e.g. the RPC extension might not expose some unsafe methods. + fn build(&self, deny: sc_rpc::DenyUnsafe) -> Self::Output; +} + +impl RpcExtensionBuilder for F where + F: Fn(sc_rpc::DenyUnsafe) -> R, + R: sc_rpc::RpcExtension, +{ + type Output = R; + + fn build(&self, deny: sc_rpc::DenyUnsafe) -> Self::Output { + (*self)(deny) + } +} + +/// A utility struct for implementing an `RpcExtensionBuilder` given a cloneable +/// `RpcExtension`, the resulting builder will simply ignore the provided +/// `DenyUnsafe` instance and return a static `RpcExtension` instance. +struct NoopRpcExtensionBuilder(R); + +impl RpcExtensionBuilder for NoopRpcExtensionBuilder where + R: Clone + sc_rpc::RpcExtension, +{ + type Output = R; + + fn build(&self, _deny: sc_rpc::DenyUnsafe) -> Self::Output { + self.0.clone() + } +} + +impl From for NoopRpcExtensionBuilder where + R: sc_rpc::RpcExtension, +{ + fn from(e: R) -> NoopRpcExtensionBuilder { + NoopRpcExtensionBuilder(e) + } +} + + /// Full client type. pub type TFullClient = Client< TFullBackend, @@ -311,7 +360,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { finality_proof_request_builder: None, finality_proof_provider: None, transaction_pool: Arc::new(()), - rpc_extensions: Default::default(), + rpc_extensions_builder: Box::new(|_| ()), remote_backend: None, block_announce_validator_builder: None, marker: PhantomData, @@ -394,7 +443,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { finality_proof_request_builder: None, finality_proof_provider: None, transaction_pool: Arc::new(()), - rpc_extensions: Default::default(), + rpc_extensions_builder: Box::new(|_| ()), remote_backend: Some(remote_blockchain), block_announce_validator_builder: None, marker: PhantomData, @@ -467,7 +516,7 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider: self.finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, @@ -512,7 +561,7 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider: self.finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, @@ -550,7 +599,7 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, @@ -616,7 +665,7 @@ impl finality_proof_request_builder: fprb, finality_proof_provider: self.finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, @@ -680,21 +729,30 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider: self.finality_proof_provider, transaction_pool: Arc::new(transaction_pool), - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, }) } - /// Defines the RPC extensions to use. - pub fn with_rpc_extensions( + /// Defines the RPC extension builder to use. Unlike `with_rpc_extensions`, + /// this method is useful in situations where the RPC extensions need to + /// access to a `DenyUnsafe` instance to avoid exposing sensitive methods. + pub fn with_rpc_extensions_builder( self, - rpc_ext_builder: impl FnOnce(&Self) -> Result, - ) -> Result, Error> - where TSc: Clone, TFchr: Clone { - let rpc_extensions = rpc_ext_builder(&self)?; + rpc_extensions_builder: impl FnOnce(&Self) -> Result, + ) -> Result< + ServiceBuilder, + Error, + > + where + TSc: Clone, + TFchr: Clone, + URpcBuilder: RpcExtensionBuilder + Send + 'static, + URpc: sc_rpc::RpcExtension, + { + let rpc_extensions_builder = rpc_extensions_builder(&self)?; Ok(ServiceBuilder { config: self.config, @@ -708,13 +766,30 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider: self.finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions, + rpc_extensions_builder: Box::new(rpc_extensions_builder), remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, marker: self.marker, }) } + /// Defines the RPC extensions to use. + pub fn with_rpc_extensions( + self, + rpc_extensions: impl FnOnce(&Self) -> Result, + ) -> Result< + ServiceBuilder, + Error, + > + where + TSc: Clone, + TFchr: Clone, + URpc: Clone + sc_rpc::RpcExtension + Send + 'static, + { + let rpc_extensions = rpc_extensions(&self)?; + self.with_rpc_extensions_builder(|_| Ok(NoopRpcExtensionBuilder::from(rpc_extensions))) + } + /// Defines the `BlockAnnounceValidator` to use. `DefaultBlockAnnounceValidator` will be used by /// default. pub fn with_block_announce_validator( @@ -736,7 +811,7 @@ impl finality_proof_request_builder: self.finality_proof_request_builder, finality_proof_provider: self.finality_proof_provider, transaction_pool: self.transaction_pool, - rpc_extensions: self.rpc_extensions, + rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: Some(Box::new(block_announce_validator_builder)), marker: self.marker, @@ -816,7 +891,7 @@ ServiceBuilder< TSc: Clone, TImpQu: 'static + ImportQueue, TExPool: MaintainedTransactionPool::Hash> + MallocSizeOfWasm + 'static, - TRpc: sc_rpc::RpcExtension + Clone, + TRpc: sc_rpc::RpcExtension, { /// Set an ExecutionExtensionsFactory @@ -854,7 +929,7 @@ ServiceBuilder< finality_proof_request_builder, finality_proof_provider, transaction_pool, - rpc_extensions, + rpc_extensions_builder, remote_backend, block_announce_validator_builder, } = self; @@ -1160,7 +1235,7 @@ ServiceBuilder< maybe_offchain_rpc, author::AuthorApi::to_delegate(author), system::SystemApi::to_delegate(system), - rpc_extensions.clone(), + rpc_extensions_builder.build(deny_unsafe), )) }; let rpc = start_rpc_servers(&config, gen_handler)?; diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index c902e6bb90..4f2be23f87 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -64,7 +64,7 @@ pub use self::error::Error; pub use self::builder::{ new_full_client, new_client, ServiceBuilder, ServiceBuilderCommand, TFullClient, TLightClient, TFullBackend, TLightBackend, - TFullCallExecutor, TLightCallExecutor, + TFullCallExecutor, TLightCallExecutor, RpcExtensionBuilder, }; pub use config::{Configuration, DatabaseConfig, PruningMode, Role, RpcMethods, TaskType}; pub use sc_chain_spec::{ -- GitLab From 903693105a39f4a88ed99d99a4462616ed059968 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 21 May 2020 14:00:24 +0200 Subject: [PATCH 036/280] Offences Weight for OnInitialize (#5961) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Weight accounting for on_offence. * Try to compute weight. * Guesstimate upper bounds on db read/writes for slashing * greater than or equal to * add new trait * Update mock.rs * Add basic weight test * one more test * Update frame/staking/src/lib.rs Co-authored-by: thiolliere * Update frame/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Add test for offences queue Co-authored-by: Tomasz Drwięga Co-authored-by: thiolliere Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- bin/node/runtime/src/lib.rs | 5 +++ frame/grandpa/src/mock.rs | 5 +++ frame/offences/benchmarking/src/mock.rs | 16 ++++++- frame/offences/src/lib.rs | 55 +++++++++++++++++-------- frame/offences/src/mock.rs | 26 ++++++++---- frame/offences/src/tests.rs | 47 ++++++++++++++++++++- frame/staking/src/lib.rs | 50 ++++++++++++++++++---- frame/staking/src/tests.rs | 43 +++++++++++++++++++ primitives/staking/src/offence.rs | 10 +++-- 9 files changed, 219 insertions(+), 38 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 2f8e393aa4..e484e84d43 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -584,10 +584,15 @@ impl pallet_im_online::Trait for Runtime { type UnsignedPriority = ImOnlineUnsignedPriority; } +parameter_types! { + pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); +} + impl pallet_offences::Trait for Runtime { type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; + type WeightSoftLimit = OffencesWeightSoftLimit; } impl pallet_authority_discovery::Trait for Runtime {} diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 2b9b25eee6..e429212cef 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -231,10 +231,15 @@ impl staking::Trait for Test { type MaxIterations = (); } +parameter_types! { + pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); +} + impl offences::Trait for Test { type Event = TestEvent; type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; + type WeightSoftLimit = OffencesWeightSoftLimit; } impl Trait for Test { diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index fa6e247abd..15b46fc194 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -20,7 +20,10 @@ #![cfg(test)] use super::*; -use frame_support::parameter_types; +use frame_support::{ + parameter_types, + weights::{Weight, constants::WEIGHT_PER_SECOND}, +}; use frame_system as system; use sp_runtime::{ SaturatedConversion, @@ -34,6 +37,10 @@ type AccountIndex = u32; type BlockNumber = u64; type Balance = u64; +parameter_types! { + pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; +} + impl frame_system::Trait for Test { type Origin = Origin; type Index = AccountIndex; @@ -46,7 +53,7 @@ impl frame_system::Trait for Test { type Header = sp_runtime::testing::Header; type Event = Event; type BlockHashCount = (); - type MaximumBlockWeight = (); + type MaximumBlockWeight = MaximumBlockWeight; type DbWeight = (); type AvailableBlockRatio = (); type MaximumBlockLength = (); @@ -179,10 +186,15 @@ impl pallet_im_online::Trait for Test { type UnsignedPriority = (); } +parameter_types! { + pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); +} + impl pallet_offences::Trait for Test { type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; + type WeightSoftLimit = OffencesWeightSoftLimit; } impl frame_system::offchain::SendTransactionTypes for Test where Call: From { diff --git a/frame/offences/src/lib.rs b/frame/offences/src/lib.rs index dd1b052811..a42f09697e 100644 --- a/frame/offences/src/lib.rs +++ b/frame/offences/src/lib.rs @@ -28,9 +28,10 @@ mod tests; use sp_std::vec::Vec; use frame_support::{ decl_module, decl_event, decl_storage, Parameter, debug, + traits::Get, weights::Weight, }; -use sp_runtime::{traits::Hash, Perbill}; +use sp_runtime::{traits::{Hash, Zero}, Perbill}; use sp_staking::{ SessionIndex, offence::{Offence, ReportOffence, Kind, OnOffenceHandler, OffenceDetails, OffenceError}, @@ -58,7 +59,11 @@ pub trait Trait: frame_system::Trait { /// Full identification of the validator. type IdentificationTuple: Parameter + Ord; /// A handler called for every offence report. - type OnOffenceHandler: OnOffenceHandler; + type OnOffenceHandler: OnOffenceHandler; + /// The a soft limit on maximum weight that may be consumed while dispatching deferred offences in + /// `on_initialize`. + /// Note it's going to be exceeded before we stop adding to it, so it has to be set conservatively. + type WeightSoftLimit: Get; } decl_storage! { @@ -102,23 +107,39 @@ decl_module! { fn on_initialize(now: T::BlockNumber) -> Weight { // only decode storage if we can actually submit anything again. - if T::OnOffenceHandler::can_report() { - >::mutate(|deferred| { - // keep those that fail to be reported again. An error log is emitted here; this - // should not happen if staking's `can_report` is implemented properly. - deferred.retain(|(o, p, s)| { - T::OnOffenceHandler::on_offence(&o, &p, *s).map_err(|_| { - debug::native::error!( - target: "pallet-offences", - "re-submitting a deferred slash returned Err at {}. This should not happen with pallet-staking", - now, - ); - }).is_err() - }) - }) + if !T::OnOffenceHandler::can_report() { + return 0; } - 0 + let limit = T::WeightSoftLimit::get(); + let mut consumed = Weight::zero(); + + >::mutate(|deferred| { + deferred.retain(|(offences, perbill, session)| { + if consumed >= limit { + true + } else { + // keep those that fail to be reported again. An error log is emitted here; this + // should not happen if staking's `can_report` is implemented properly. + match T::OnOffenceHandler::on_offence(&offences, &perbill, *session) { + Ok(weight) => { + consumed += weight; + false + }, + Err(_) => { + debug::native::error!( + target: "pallet-offences", + "re-submitting a deferred slash returned Err at {}. This should not happen with pallet-staking", + now, + ); + true + }, + } + } + }) + }); + + consumed } } } diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 0f5036edc5..b3f35e0171 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -32,7 +32,7 @@ use sp_runtime::traits::{IdentityLookup, BlakeTwo256}; use sp_core::H256; use frame_support::{ impl_outer_origin, impl_outer_event, parameter_types, StorageMap, StorageDoubleMap, - weights::Weight, + weights::{Weight, constants::{WEIGHT_PER_SECOND, RocksDbWeight}}, }; use frame_system as system; @@ -45,20 +45,23 @@ pub struct OnOffenceHandler; thread_local! { pub static ON_OFFENCE_PERBILL: RefCell> = RefCell::new(Default::default()); pub static CAN_REPORT: RefCell = RefCell::new(true); + pub static OFFENCE_WEIGHT: RefCell = RefCell::new(Default::default()); } -impl offence::OnOffenceHandler for OnOffenceHandler { +impl + offence::OnOffenceHandler for OnOffenceHandler +{ fn on_offence( _offenders: &[OffenceDetails], slash_fraction: &[Perbill], _offence_session: SessionIndex, - ) -> Result<(), ()> { - if >::can_report() { + ) -> Result { + if >::can_report() { ON_OFFENCE_PERBILL.with(|f| { *f.borrow_mut() = slash_fraction.to_vec(); }); - Ok(()) + Ok(OFFENCE_WEIGHT.with(|w| *w.borrow())) } else { Err(()) } @@ -79,12 +82,16 @@ pub fn with_on_offence_fractions) -> R>(f: F) -> }) } +pub fn set_offence_weight(new: Weight) { + OFFENCE_WEIGHT.with(|w| *w.borrow_mut() = new); +} + // Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted. #[derive(Clone, PartialEq, Eq, Debug)] pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } @@ -101,7 +108,7 @@ impl frame_system::Trait for Runtime { type Event = TestEvent; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); + type DbWeight = RocksDbWeight; type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); type MaximumExtrinsicWeight = MaximumBlockWeight; @@ -114,10 +121,15 @@ impl frame_system::Trait for Runtime { type OnKilledAccount = (); } +parameter_types! { + pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); +} + impl Trait for Runtime { type Event = TestEvent; type IdentificationTuple = u64; type OnOffenceHandler = OnOffenceHandler; + type WeightSoftLimit = OffencesWeightSoftLimit; } mod offences { diff --git a/frame/offences/src/tests.rs b/frame/offences/src/tests.rs index b05fee1790..0fb6620b7d 100644 --- a/frame/offences/src/tests.rs +++ b/frame/offences/src/tests.rs @@ -22,7 +22,7 @@ use super::*; use crate::mock::{ Offences, System, Offence, TestEvent, KIND, new_test_ext, with_on_offence_fractions, - offence_reports, set_can_report, + offence_reports, set_can_report, set_offence_weight, }; use sp_runtime::Perbill; use frame_support::traits::OnInitialize; @@ -265,3 +265,48 @@ fn should_queue_and_resubmit_rejected_offence() { assert_eq!(Offences::deferred_offences().len(), 0); }) } + +#[test] +fn weight_soft_limit_is_used() { + new_test_ext().execute_with(|| { + set_can_report(false); + // Only 2 can fit in one block + set_offence_weight(::WeightSoftLimit::get() / 2); + + // Queue 3 offences + // #1 + let offence = Offence { + validator_set_count: 5, + time_slot: 42, + offenders: vec![5], + }; + Offences::report_offence(vec![], offence).unwrap(); + // #2 + let offence = Offence { + validator_set_count: 5, + time_slot: 62, + offenders: vec![5], + }; + Offences::report_offence(vec![], offence).unwrap(); + // #3 + let offence = Offence { + validator_set_count: 5, + time_slot: 72, + offenders: vec![5], + }; + Offences::report_offence(vec![], offence).unwrap(); + // 3 are queued + assert_eq!(Offences::deferred_offences().len(), 3); + + // Allow reporting + set_can_report(true); + + Offences::on_initialize(3); + // Two are completed, one is left in the queue + assert_eq!(Offences::deferred_offences().len(), 1); + + Offences::on_initialize(4); + // All are done now + assert_eq!(Offences::deferred_offences().len(), 0); + }) +} diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 54e7b5aaaf..bb9664bb2e 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -3218,7 +3218,9 @@ impl Convert> } /// This is intended to be used with `FilterHistoricalOffences`. -impl OnOffenceHandler> for Module where +impl + OnOffenceHandler, Weight> +for Module where T: pallet_session::Trait::AccountId>, T: pallet_session::historical::Trait< FullIdentification = Exposure<::AccountId, BalanceOf>, @@ -3226,24 +3228,32 @@ impl OnOffenceHandler, T::SessionHandler: pallet_session::SessionHandler<::AccountId>, T::SessionManager: pallet_session::SessionManager<::AccountId>, - T::ValidatorIdOf: Convert<::AccountId, Option<::AccountId>> + T::ValidatorIdOf: Convert< + ::AccountId, + Option<::AccountId>, + >, { fn on_offence( offenders: &[OffenceDetails>], slash_fraction: &[Perbill], slash_session: SessionIndex, - ) -> Result<(), ()> { + ) -> Result { if !Self::can_report() { return Err(()) } let reward_proportion = SlashRewardFraction::get(); + let mut consumed_weight: Weight = 0; + let mut add_db_reads_writes = |reads, writes| { + consumed_weight += T::DbWeight::get().reads_writes(reads, writes); + }; let active_era = { let active_era = Self::active_era(); + add_db_reads_writes(1, 0); if active_era.is_none() { // this offence need not be re-submitted. - return Ok(()) + return Ok(consumed_weight) } active_era.expect("value checked not to be `None`; qed").index }; @@ -3252,6 +3262,7 @@ impl OnOffenceHandler OnOffenceHandler return Ok(()), // before bonding period. defensive - should be filtered out. Some(&(ref slash_era, _)) => *slash_era, + // before bonding period. defensive - should be filtered out. + None => return Ok(consumed_weight), } }; @@ -3274,14 +3287,18 @@ impl OnOffenceHandler OnOffenceHandler(unapplied); + { + let slash_cost = (6, 5); + let reward_cost = (2, 2); + add_db_reads_writes( + (1 + nominators_len) * slash_cost.0 + reward_cost.0 * reporters_len, + (1 + nominators_len) * slash_cost.1 + reward_cost.1 * reporters_len + ); + } } else { // defer to end of some `slash_defer_duration` from now. ::UnappliedSlashes::mutate( active_era, move |for_later| for_later.push(unapplied), ); + add_db_reads_writes(1, 1); } + } else { + add_db_reads_writes(4 /* fetch_spans */, 5 /* kick_out_if_recent */) } } - Ok(()) + Ok(consumed_weight) } fn can_report() -> bool { diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 80ffc4b7bf..31137e04eb 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -4667,6 +4667,49 @@ fn migrate_era_should_handle_errors_2() { }); } +#[test] +fn offences_weight_calculated_correctly() { + ExtBuilder::default().nominate(true).build_and_execute(|| { + // On offence with zero offenders: 4 Reads, 1 Write + let zero_offence_weight = ::DbWeight::get().reads_writes(4, 1); + assert_eq!(Staking::on_offence(&[], &[Perbill::from_percent(50)], 0), Ok(zero_offence_weight)); + + // On Offence with N offenders, Unapplied: 4 Reads, 1 Write + 4 Reads, 5 Writes + let n_offence_unapplied_weight = ::DbWeight::get().reads_writes(4, 1) + + ::DbWeight::get().reads_writes(4, 5); + + let offenders: Vec::AccountId, pallet_session::historical::IdentificationTuple>> + = (1..10).map(|i| + OffenceDetails { + offender: (i, Staking::eras_stakers(Staking::active_era().unwrap().index, i)), + reporters: vec![], + } + ).collect(); + assert_eq!(Staking::on_offence(&offenders, &[Perbill::from_percent(50)], 0), Ok(n_offence_unapplied_weight)); + + // On Offence with one offenders, Applied + let one_offender = [ + OffenceDetails { + offender: (11, Staking::eras_stakers(Staking::active_era().unwrap().index, 11)), + reporters: vec![1], + }, + ]; + + let n = 1; // Number of offenders + let rw = 3 + 3 * n; // rw reads and writes + let one_offence_unapplied_weight = ::DbWeight::get().reads_writes(4, 1) + + ::DbWeight::get().reads_writes(rw, rw) + // One `slash_cost` + + ::DbWeight::get().reads_writes(6, 5) + // `slash_cost` * nominators (1) + + ::DbWeight::get().reads_writes(6, 5) + // `reward_cost` * reporters (1) + + ::DbWeight::get().reads_writes(2, 2); + + assert_eq!(Staking::on_offence(&one_offender, &[Perbill::from_percent(50)], 0), Ok(one_offence_unapplied_weight)); + }); +} + #[test] fn on_initialize_weight_is_correct() { ExtBuilder::default().has_stakers(false).build_and_execute(|| { diff --git a/primitives/staking/src/offence.rs b/primitives/staking/src/offence.rs index b250dc6c22..e6536b5709 100644 --- a/primitives/staking/src/offence.rs +++ b/primitives/staking/src/offence.rs @@ -127,7 +127,7 @@ impl> ReportOffence { +pub trait OnOffenceHandler { /// A handler for an offence of a particular kind. /// /// Note that this contains a list of all previous offenders @@ -148,7 +148,7 @@ pub trait OnOffenceHandler { offenders: &[OffenceDetails], slash_fraction: &[Perbill], session: SessionIndex, - ) -> Result<(), ()>; + ) -> Result; /// Can an offence be reported now or not. This is an method to short-circuit a call into /// `on_offence`. Ideally, a correct implementation should return `false` if `on_offence` will @@ -157,12 +157,14 @@ pub trait OnOffenceHandler { fn can_report() -> bool; } -impl OnOffenceHandler for () { +impl OnOffenceHandler for () { fn on_offence( _offenders: &[OffenceDetails], _slash_fraction: &[Perbill], _session: SessionIndex, - ) -> Result<(), ()> { Ok(()) } + ) -> Result { + Ok(Default::default()) + } fn can_report() -> bool { true } } -- GitLab From ea0e23e34a037d351013ca7409e966fa0939206f Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 21 May 2020 16:13:13 +0200 Subject: [PATCH 037/280] Keep `BlockWeight` in Storage (#6046) * keep block weight in storage * Update lib.rs * rename to `BlockWeight`, update tests * remove println * make test better * keep extrinsics length clean --- bin/node/runtime/src/impls.rs | 2 +- frame/executive/src/lib.rs | 41 ++++++++++++++++++------ frame/system/src/lib.rs | 60 +++++++++++++++++------------------ 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index 884bde08df..85c28c9615 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -62,7 +62,7 @@ pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData); impl> Convert for TargetedFeeAdjustment { fn convert(multiplier: Fixed128) -> Fixed128 { let max_weight = MaximumBlockWeight::get(); - let block_weight = System::all_extrinsics_weight().total().min(max_weight); + let block_weight = System::block_weight().total().min(max_weight); let target_weight = (T::get() * max_weight) as u128; let block_weight = block_weight as u128; diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index f7ac060a6c..04e095fec4 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -708,7 +708,7 @@ mod tests { header: Header { parent_hash: [69u8; 32].into(), number: 1, - state_root: hex!("409fb5a14aeb8b8c59258b503396a56dee45a0ee28a78de3e622db957425e275").into(), + state_root: hex!("05a38fa4a48ca80ffa8482304be7749a484dc8c9c31462a570d0fbadde6a3633").into(), extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(), digest: Digest { logs: vec![], }, }, @@ -789,7 +789,7 @@ mod tests { Digest::default(), )); // Base block execution weight + `on_initialize` weight from the custom module. - assert_eq!(>::all_extrinsics_weight().total(), base_block_weight); + assert_eq!(>::block_weight().total(), base_block_weight); for nonce in 0..=num_to_exhaust_block { let xt = TestXt::new( @@ -799,7 +799,7 @@ mod tests { if nonce != num_to_exhaust_block { assert!(res.is_ok()); assert_eq!( - >::all_extrinsics_weight().total(), + >::block_weight().total(), //--------------------- on_initialize + block_execution + extrinsic_base weight (encoded_len + 5) * (nonce + 1) + base_block_weight, ); @@ -819,7 +819,18 @@ mod tests { let len = xt.clone().encode().len() as u32; let mut t = new_test_ext(1); t.execute_with(|| { - assert_eq!(>::all_extrinsics_weight().total(), 0); + // Block execution weight + on_initialize weight from custom module + let base_block_weight = 175 + ::BlockExecutionWeight::get(); + + Executive::initialize_block(&Header::new( + 1, + H256::default(), + H256::default(), + [69u8; 32].into(), + Digest::default(), + )); + + assert_eq!(>::block_weight().total(), base_block_weight); assert_eq!(>::all_extrinsics_len(), 0); assert!(Executive::apply_extrinsic(xt.clone()).unwrap().is_ok()); @@ -827,16 +838,28 @@ mod tests { assert!(Executive::apply_extrinsic(x2.clone()).unwrap().is_ok()); // default weight for `TestXt` == encoded length. + let extrinsic_weight = len as Weight + ::ExtrinsicBaseWeight::get(); assert_eq!( - >::all_extrinsics_weight().total(), - 3 * (len as Weight + ::ExtrinsicBaseWeight::get()), + >::block_weight().total(), + base_block_weight + 3 * extrinsic_weight, ); assert_eq!(>::all_extrinsics_len(), 3 * len); let _ = >::finalize(); - - assert_eq!(>::all_extrinsics_weight().total(), 0); + // All extrinsics length cleaned on `System::finalize` assert_eq!(>::all_extrinsics_len(), 0); + + // New Block + Executive::initialize_block(&Header::new( + 2, + H256::default(), + H256::default(), + [69u8; 32].into(), + Digest::default(), + )); + + // Block weight cleaned up on `System::initialize` + assert_eq!(>::block_weight().total(), base_block_weight); }); } @@ -908,7 +931,7 @@ mod tests { // NOTE: might need updates over time if new weights are introduced. // For now it only accounts for the base block execution weight and // the `on_initialize` weight defined in the custom test module. - assert_eq!(>::all_extrinsics_weight().total(), 175 + 10); + assert_eq!(>::block_weight().total(), 175 + 10); }) } diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 746e6536ea..4fa826ce89 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -429,8 +429,8 @@ decl_storage! { /// Total extrinsics count for the current block. ExtrinsicCount: Option; - /// Total weight for all extrinsics for the current block. - AllExtrinsicsWeight: ExtrinsicsWeight; + /// The current weight for the block. + BlockWeight get(fn block_weight): ExtrinsicsWeight; /// Total length (in bytes) for all extrinsics put together, for the current block. AllExtrinsicsLen: Option; @@ -978,11 +978,6 @@ impl Module { ExtrinsicCount::get().unwrap_or_default() } - /// Gets the weight of all executed extrinsics. - pub fn all_extrinsics_weight() -> ExtrinsicsWeight { - AllExtrinsicsWeight::get() - } - pub fn all_extrinsics_len() -> u32 { AllExtrinsicsLen::get().unwrap_or_default() } @@ -1003,7 +998,7 @@ impl Module { /// /// Another potential use-case could be for the `on_initialize` and `on_finalize` hooks. pub fn register_extra_weight_unchecked(weight: Weight, class: DispatchClass) { - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.add(weight, class); }); } @@ -1025,6 +1020,10 @@ impl Module { >::insert(*number - One::one(), parent_hash); >::put(txs_root); + // Remove previous block data from storage + BlockWeight::kill(); + + // Kill inspectable storage entries in state when `InitKind::Full`. if let InitKind::Full = kind { >::kill(); EventCount::kill(); @@ -1036,7 +1035,6 @@ impl Module { pub fn finalize() -> T::Header { ExecutionPhase::kill(); ExtrinsicCount::kill(); - AllExtrinsicsWeight::kill(); AllExtrinsicsLen::kill(); let number = >::take(); @@ -1126,7 +1124,7 @@ impl Module { /// Set the current block weight. This should only be used in some integration tests. #[cfg(any(feature = "std", test))] pub fn set_block_limits(weight: Weight, len: usize) { - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.put(weight, DispatchClass::Normal) }); AllExtrinsicsLen::put(len as u32); @@ -1383,7 +1381,7 @@ impl CheckWeight where info: &DispatchInfoOf, ) -> Result { let maximum_weight = T::MaximumBlockWeight::get(); - let mut all_weight = Module::::all_extrinsics_weight(); + let mut all_weight = Module::::block_weight(); match info.class { // If we have a dispatch that must be included in the block, it ignores all the limits. DispatchClass::Mandatory => { @@ -1474,7 +1472,7 @@ impl CheckWeight where Self::check_extrinsic_weight(info)?; AllExtrinsicsLen::put(next_len); - AllExtrinsicsWeight::put(next_weight); + BlockWeight::put(next_weight); Ok(()) } @@ -1565,7 +1563,7 @@ impl SignedExtension for CheckWeight where let unspent = post_info.calc_unspent(info); if unspent > 0 { - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.sub(unspent, info.class); }) } @@ -2288,7 +2286,7 @@ pub(crate) mod tests { let len = 0_usize; let reset_check_weight = |i, f, s| { - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.put(s, DispatchClass::Normal) }); let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, i, len); @@ -2310,19 +2308,19 @@ pub(crate) mod tests { let len = 0_usize; // We allow 75% for normal transaction, so we put 25% - extrinsic base weight - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.put(256 - ::ExtrinsicBaseWeight::get(), DispatchClass::Normal) }); let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); - assert_eq!(AllExtrinsicsWeight::get().total(), info.weight + 256); + assert_eq!(BlockWeight::get().total(), info.weight + 256); assert!( CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())) .is_ok() ); assert_eq!( - AllExtrinsicsWeight::get().total(), + BlockWeight::get().total(), post_info.actual_weight.unwrap() + 256, ); }) @@ -2335,13 +2333,13 @@ pub(crate) mod tests { let post_info = PostDispatchInfo { actual_weight: Some(700), }; let len = 0_usize; - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.put(128, DispatchClass::Normal) }); let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); assert_eq!( - AllExtrinsicsWeight::get().total(), + BlockWeight::get().total(), info.weight + 128 + ::ExtrinsicBaseWeight::get(), ); @@ -2350,7 +2348,7 @@ pub(crate) mod tests { .is_ok() ); assert_eq!( - AllExtrinsicsWeight::get().total(), + BlockWeight::get().total(), info.weight + 128 + ::ExtrinsicBaseWeight::get(), ); }) @@ -2363,11 +2361,11 @@ pub(crate) mod tests { let len = 0_usize; // Initial weight from `BlockExecutionWeight` - assert_eq!(System::all_extrinsics_weight().total(), ::BlockExecutionWeight::get()); + assert_eq!(System::block_weight().total(), ::BlockExecutionWeight::get()); let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &free, len); assert!(r.is_ok()); assert_eq!( - System::all_extrinsics_weight().total(), + System::block_weight().total(), ::ExtrinsicBaseWeight::get() + ::BlockExecutionWeight::get() ); }) @@ -2390,8 +2388,8 @@ pub(crate) mod tests { check(|max, len| { assert_ok!(CheckWeight::::do_pre_dispatch(max, len)); - assert_eq!(System::all_extrinsics_weight().total(), Weight::max_value()); - assert!(System::all_extrinsics_weight().total() > ::MaximumBlockWeight::get()); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); }); check(|max, len| { assert_ok!(CheckWeight::::do_validate(max, len)); @@ -2419,8 +2417,8 @@ pub(crate) mod tests { fn register_extra_weight_unchecked_doesnt_care_about_limits() { new_test_ext().execute_with(|| { System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Normal); - assert_eq!(System::all_extrinsics_weight().total(), Weight::max_value()); - assert!(System::all_extrinsics_weight().total() > ::MaximumBlockWeight::get()); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); }); } @@ -2438,10 +2436,10 @@ pub(crate) mod tests { let len = 0_usize; assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); - assert_eq!(System::all_extrinsics_weight().total(), 768); + assert_eq!(System::block_weight().total(), 768); assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); assert_eq!(::MaximumBlockWeight::get(), 1024); - assert_eq!(System::all_extrinsics_weight().total(), ::MaximumBlockWeight::get()); + assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); }); } @@ -2456,10 +2454,10 @@ pub(crate) mod tests { assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); // Extra 15 here from block execution + base extrinsic weight - assert_eq!(System::all_extrinsics_weight().total(), 266); + assert_eq!(System::block_weight().total(), 266); assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); assert_eq!(::MaximumBlockWeight::get(), 1024); - assert_eq!(System::all_extrinsics_weight().total(), ::MaximumBlockWeight::get()); + assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); }); } @@ -2489,7 +2487,7 @@ pub(crate) mod tests { let normal_limit = normal_weight_limit(); // given almost full block - AllExtrinsicsWeight::mutate(|current_weight| { + BlockWeight::mutate(|current_weight| { current_weight.put(normal_limit, DispatchClass::Normal) }); // will not fit. -- GitLab From af950847f3d9da1924b147bc83f33afb3dcfc47d Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Thu, 21 May 2020 16:23:51 +0200 Subject: [PATCH 038/280] clarify docs on query_info and partial_fee (#6090) --- .../rpc/runtime-api/src/lib.rs | 6 ++-- frame/transaction-payment/src/lib.rs | 30 ++++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/frame/transaction-payment/rpc/runtime-api/src/lib.rs b/frame/transaction-payment/rpc/runtime-api/src/lib.rs index 4392807338..17a8bcdf44 100644 --- a/frame/transaction-payment/rpc/runtime-api/src/lib.rs +++ b/frame/transaction-payment/rpc/runtime-api/src/lib.rs @@ -26,7 +26,7 @@ use codec::{Encode, Codec, Decode}; use serde::{Serialize, Deserialize, Serializer, Deserializer}; use sp_runtime::traits::{MaybeDisplay, MaybeFromStr}; -/// Some information related to a dispatchable that can be queried from the runtime. +/// Information related to a dispatchable's class, weight, and fee that can be queried from the runtime. #[derive(Eq, PartialEq, Encode, Decode, Default)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] @@ -35,8 +35,8 @@ pub struct RuntimeDispatchInfo { pub weight: Weight, /// Class of this dispatch. pub class: DispatchClass, - /// The partial inclusion fee of this dispatch. This does not include tip or anything else which - /// is dependent on the signature (aka. depends on a `SignedExtension`). + /// The inclusion fee of this dispatch. This does not include a tip or anything else that + /// depends on the signature (i.e. depends on a `SignedExtension`). #[cfg_attr(feature = "std", serde(bound(serialize = "Balance: std::fmt::Display")))] #[cfg_attr(feature = "std", serde(serialize_with = "serialize_as_string"))] #[cfg_attr(feature = "std", serde(bound(deserialize = "Balance: std::str::FromStr")))] diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 71ef8a56c2..11b86170e7 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -107,8 +107,9 @@ decl_module! { impl Module { /// Query the data that we know about the fee of a given `call`. /// - /// As this module is not and cannot be aware of the internals of a signed extension, it only - /// interprets them as some encoded value and takes their length into account. + /// This module is not and cannot be aware of the internals of a signed extension, for example + /// a tip. It only interprets the extrinsic as some encoded value and accounts for its weight + /// and length, the runtime's extrinsic base weight, and the current fee multiplier. /// /// All dispatchables must be annotated with weight and will have some fee info. This function /// always returns. @@ -137,17 +138,24 @@ impl Module { /// Compute the final fee value for a particular transaction. /// /// The final fee is composed of: - /// - _base_fee_: This is the minimum amount a user pays for a transaction. - /// - _len_fee_: This is the amount paid merely to pay for size of the transaction. - /// - _weight_fee_: This amount is computed based on the weight of the transaction. Unlike - /// size-fee, this is not input dependent and reflects the _complexity_ of the execution - /// and the time it consumes. - /// - _targeted_fee_adjustment_: This is a multiplier that can tune the final fee based on + /// - `base_fee`: This is the minimum amount a user pays for a transaction. It is declared + /// as a base _weight_ in the runtime and converted to a fee using `WeightToFee`. + /// - `len_fee`: The length fee, the amount paid for the encoded length (in bytes) of the + /// transaction. + /// - `weight_fee`: This amount is computed based on the weight of the transaction. Weight + /// accounts for the execution time of a transaction. + /// - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on /// the congestion of the network. - /// - (optional) _tip_: if included in the transaction, it will be added on top. Only signed - /// transactions can have a tip. + /// - (Optional) `tip`: If included in the transaction, the tip will be added on top. Only + /// signed transactions can have a tip. /// - /// final_fee = base_fee + targeted_fee_adjustment(len_fee + weight_fee) + tip; + /// The base fee and adjusted weight and length fees constitute the _inclusion fee,_ which is + /// the minimum fee for a transaction to be included in a block. + /// + /// ```ignore + /// inclusion_fee = base_fee + targeted_fee_adjustment * (len_fee + weight_fee); + /// final_fee = inclusion_fee + tip; + /// ``` pub fn compute_fee( len: u32, info: &DispatchInfoOf, -- GitLab From 15698fcd02f7167d8ad7162db997e2ce39513643 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 21 May 2020 16:26:29 +0200 Subject: [PATCH 039/280] .maintain/monitoring: Add an initial set of Prometheus alerting rules (#6095) Create a place to collaborate on Prometheus alerting rules for Substrate starting with a basic set of rules covering: - Resource usage - Block production - Block finalization - Transaction queue - Networking - ... Others --- .../alerting-rules/alerting-rules.yaml | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .maintain/monitoring/alerting-rules/alerting-rules.yaml diff --git a/.maintain/monitoring/alerting-rules/alerting-rules.yaml b/.maintain/monitoring/alerting-rules/alerting-rules.yaml new file mode 100644 index 0000000000..cb5b3c271d --- /dev/null +++ b/.maintain/monitoring/alerting-rules/alerting-rules.yaml @@ -0,0 +1,113 @@ +groups: +- name: polkadot.rules + rules: + + ############################################################################## + # Resource usage + ############################################################################## + + - alert: HighCPUUsage + expr: polkadot_cpu_usage_percentage >= 100 + for: 5m + labels: + severity: warning + annotations: + message: 'The node {{ $labels.instance }} has a CPU usage higher than 100% for more than 5 minutes' + + ############################################################################## + # Block production + ############################################################################## + + - alert: LowNumberOfNewBlocks + annotations: + message: 'Less than one new block per minute on instance {{ $labels.instance }}.' + expr: increase(polkadot_block_height{status="best"}[1m]) < 1 + for: 3m + labels: + severity: warning + - alert: LowNumberOfNewBlocks + annotations: + message: 'Less than one new block per minute on instance {{ $labels.instance }}.' + expr: increase(polkadot_block_height{status="best"}[1m]) < 1 + for: 10m + labels: + severity: critical + + ############################################################################## + # Block finalization + ############################################################################## + + - alert: BlockFinalizationSlow + expr: increase(polkadot_block_height{status="finalized"}[1m]) < 1 + for: 3m + labels: + severity: warning + annotations: + message: 'Finalized block on instance {{ $labels.instance }} increases by less than 1 per minute.' + - alert: BlockFinalizationSlow + expr: increase(polkadot_block_height{status="finalized"}[1m]) < 1 + for: 10m + labels: + severity: critical + annotations: + message: 'Finalized block on instance {{ $labels.instance }} increases by less than 1 per minute.' + - alert: BlockFinalizationLaggingBehind + # Under the assumption of an average block production of 6 seconds, + # "best" and "finalized" being more than 10 blocks apart would imply + # more than a 1 minute delay between block production and finalization. + expr: (polkadot_block_height_number{status="best"} - ignoring(status) polkadot_block_height_number{status="finalized"}) > 10 + for: 8m + labels: + severity: critical + annotations: + message: "Block finalization on instance {{ $labels.instance }} is behind block production by {{ $value }} for more than 8m" + + ############################################################################## + # Transaction queue + ############################################################################## + + - alert: TransactionQueueSize + expr: polkadot_sub_txpool_validations_scheduled - polkadot_sub_txpool_validations_finished > 10 + for: 10m + labels: + severity: warning + annotations: + message: 'The node {{ $labels.instance }} has more than 10 transactions in the queue for more than 10 minutes' + - alert: TransactionQueueSize + expr: polkadot_sub_txpool_validations_scheduled - polkadot_sub_txpool_validations_finished > 10 + for: 30m + labels: + severity: critical + annotations: + message: 'The node {{ $labels.instance }} has more than 10 transactions in the queue for more than 30 minutes' + + ############################################################################## + # Networking + ############################################################################## + + - alert: LowNumberOfPeers + expr: polkadot_sub_libp2p_peers_count < 3 + for: 3m + labels: + severity: warning + annotations: + message: 'The node {{ $labels.instance }} has less than 3 peers for more than 3 minutes' + - alert: LowNumberOfPeers + expr: polkadot_sub_libp2p_peers_count < 3 + for: 15m + labels: + severity: critical + annotations: + message: 'The node {{ $labels.instance }} has less than 3 peers for more than 15 minutes' + + ############################################################################## + # Others + ############################################################################## + + - alert: AuthorityDiscoveryHighDiscoveryFailure + expr: polkadot_authority_discovery_handle_value_found_event_failure / ignoring(name) polkadot_authority_discovery_dht_event_received{name="value_found"} > 0.5 + for: 2h + labels: + severity: warning + annotations: + message: "Authority discovery on node {{ $labels.instance }} fails to process more than 50 % of the values found on the DHT." -- GitLab From 1ba1e8065bf90391f72ef85fa5b20d02aedff6c9 Mon Sep 17 00:00:00 2001 From: satellitex Date: Fri, 22 May 2020 02:32:23 +0900 Subject: [PATCH 040/280] Add Keccak hasher (#6101) * fix keccak hasher * Update hasher.rs Co-authored-by: Gavin Wood --- primitives/core/src/hasher.rs | 20 ++++++++++++++++++++ primitives/core/src/lib.rs | 2 ++ primitives/io/src/lib.rs | 10 ++++++++++ primitives/runtime/src/traits.rs | 27 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/primitives/core/src/hasher.rs b/primitives/core/src/hasher.rs index 96a79bf5f6..8ccaa4d90a 100644 --- a/primitives/core/src/hasher.rs +++ b/primitives/core/src/hasher.rs @@ -36,3 +36,23 @@ pub mod blake2 { } } } + +pub mod keccak { + use hash_db::Hasher; + use hash256_std_hasher::Hash256StdHasher; + use crate::hash::H256; + + /// Concrete implementation of Hasher using Keccak 256-bit hashes + #[derive(Debug)] + pub struct KeccakHasher; + + impl Hasher for KeccakHasher { + type Out = H256; + type StdHasher = Hash256StdHasher; + const LENGTH: usize = 32; + + fn hash(x: &[u8]) -> Self::Out { + crate::hashing::keccak_256(x).into() + } + } +} diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 91bdf6683d..56dbbc7b78 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -83,6 +83,8 @@ pub use crypto::{DeriveJunction, Pair, Public}; pub use hash_db::Hasher; #[cfg(feature = "std")] pub use self::hasher::blake2::Blake2Hasher; +#[cfg(feature = "std")] +pub use self::hasher::keccak::KeccakHasher; pub use sp_storage as storage; diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index 687e01060f..f28f3e2c95 100644 --- a/primitives/io/src/lib.rs +++ b/primitives/io/src/lib.rs @@ -300,6 +300,16 @@ pub trait Trie { fn blake2_256_ordered_root(input: Vec>) -> H256 { Layout::::ordered_trie_root(input) } + + /// A trie root formed from the iterated items. + fn keccak_256_root(input: Vec<(Vec, Vec)>) -> H256 { + Layout::::trie_root(input) + } + + /// A trie root formed from the enumerated items. + fn keccak_256_ordered_root(input: Vec>) -> H256 { + Layout::::ordered_trie_root(input) + } } /// Interface that provides miscellaneous functions for communicating between the runtime and the node. diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index 7e7b5558b5..7d7e969427 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -376,6 +376,33 @@ impl Hash for BlakeTwo256 { } } +/// Keccak-256 Hash implementation. +#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct Keccak256; + +impl Hasher for Keccak256 { + type Out = sp_core::H256; + type StdHasher = hash256_std_hasher::Hash256StdHasher; + const LENGTH: usize = 32; + + fn hash(s: &[u8]) -> Self::Out { + sp_io::hashing::keccak_256(s).into() + } +} + +impl Hash for Keccak256 { + type Output = sp_core::H256; + + fn trie_root(input: Vec<(Vec, Vec)>) -> Self::Output { + sp_io::trie::keccak_256_root(input) + } + + fn ordered_trie_root(input: Vec>) -> Self::Output { + sp_io::trie::keccak_256_ordered_root(input) + } +} + /// Something that can be checked for equality and printed out to a debug channel if bad. pub trait CheckEqual { /// Perform the equality check. -- GitLab From 0b274c98b2c43c505aca8a144c0138ae0266156d Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Thu, 21 May 2020 19:32:44 +0200 Subject: [PATCH 041/280] Implement FixedPoint trait. (#5877) * Implement Fixed trait. * Fix tests * Fix tests * Fix tests 2 * Address review comment regarding from_i129. * Remove precision by using log10() as suggested in review. * Add small comments. * Use checked versions + panic for ops::*. * Remove repeated test. * Uncomment test. * Remove casts. * Add more comments. * Add tests. * Panic on saturating_div_int * More tests. * More docs. * Saturating renames. * Fix to_bound doc. * Move some impl to trait. * Add range * Add macro pre. * More round() tests. * Delete confusion. * More impl to trait * Add doc for fixedpoint op. * Remove trailing spaces. * Suggested docs changes. * More tests and comments for roundings. * Some quickcheck tests. * Add missing panic, more test/comments. * Nits. * Rename. * Remove primitives-types import. * Apply review suggestions * Fix long lines and add some fuzz. * fix long line * Update fuzzer * Bump impl * fix warnings Co-authored-by: Gavin Wood Co-authored-by: Shawn Tabrizi --- Cargo.lock | 4 +- bin/node/executor/tests/basic.rs | 4 +- bin/node/executor/tests/fees.rs | 4 +- bin/node/runtime/src/impls.rs | 40 +- bin/node/runtime/src/lib.rs | 2 +- frame/balances/src/tests.rs | 4 +- frame/transaction-payment/src/lib.rs | 19 +- primitives/arithmetic/Cargo.toml | 3 +- primitives/arithmetic/fuzzer/Cargo.lock | 401 ------ primitives/arithmetic/fuzzer/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/src/fixed.rs | 82 ++ primitives/arithmetic/src/fixed.rs | 1534 +++++++++++++++++++++ primitives/arithmetic/src/fixed128.rs | 732 ---------- primitives/arithmetic/src/fixed64.rs | 382 ----- primitives/arithmetic/src/lib.rs | 6 +- primitives/arithmetic/src/traits.rs | 4 +- primitives/runtime/src/lib.rs | 2 +- 17 files changed, 1661 insertions(+), 1568 deletions(-) delete mode 100644 primitives/arithmetic/fuzzer/Cargo.lock create mode 100644 primitives/arithmetic/fuzzer/src/fixed.rs create mode 100644 primitives/arithmetic/src/fixed.rs delete mode 100644 primitives/arithmetic/src/fixed128.rs delete mode 100644 primitives/arithmetic/src/fixed64.rs diff --git a/Cargo.lock b/Cargo.lock index 6674b8d3ab..ef0584f4ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2057,9 +2057,9 @@ dependencies = [ [[package]] name = "honggfuzz" -version = "0.5.47" +version = "0.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3de2c3273ef7735df1c5a72128ca85b1d20105b9aac643cdfd7a6e581311150" +checksum = "832bac18a82ec7d6c21887daa8616b238fe90d5d5e762d0d4b9372cdaa9e097f" dependencies = [ "arbitrary", "lazy_static", diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 857f438e1c..7799f0913a 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -26,7 +26,7 @@ use frame_support::{ }; use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys}; use sp_runtime::{ - ApplyExtrinsicResult, Fixed128, + ApplyExtrinsicResult, Fixed128, FixedPointNumber, traits::Hash as HashT, transaction_validity::InvalidTransaction, }; @@ -61,7 +61,7 @@ fn transfer_fee(extrinsic: &E, fee_multiplier: Fixed128) -> Balance { let weight = default_transfer_call().get_dispatch_info().weight; let weight_fee = ::WeightToFee::calc(&weight); - base_fee + fee_multiplier.saturated_multiply_accumulate(length_fee + weight_fee) + base_fee + fee_multiplier.saturating_mul_acc_int(length_fee + weight_fee) } fn xt() -> UncheckedExtrinsic { diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs index c4c3ca0bfc..a4fc3930da 100644 --- a/bin/node/executor/tests/fees.rs +++ b/bin/node/executor/tests/fees.rs @@ -22,7 +22,7 @@ use frame_support::{ weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial}, }; use sp_core::NeverNativeValue; -use sp_runtime::{Fixed128, Perbill}; +use sp_runtime::{FixedPointNumber, Fixed128, Perbill}; use node_runtime::{ CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, TransactionByteFee, @@ -39,7 +39,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() { let mut t = new_test_ext(COMPACT_CODE, false); // initial fee multiplier must be zero - let mut prev_multiplier = Fixed128::from_parts(0); + let mut prev_multiplier = Fixed128::from_inner(0); t.execute_with(|| { assert_eq!(TransactionPayment::next_fee_multiplier(), prev_multiplier); diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index 85c28c9615..0047ae5c1b 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -17,13 +17,10 @@ //! Some configurable implementations as associated type for the substrate runtime. -use core::num::NonZeroI128; use node_primitives::Balance; use sp_runtime::traits::{Convert, Saturating}; -use sp_runtime::{Fixed128, Perquintill}; -use frame_support::{ - traits::{OnUnbalanced, Currency, Get}, -}; +use sp_runtime::{FixedPointNumber, Fixed128, Perquintill}; +use frame_support::traits::{OnUnbalanced, Currency, Get}; use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance}; pub struct Author; @@ -69,18 +66,14 @@ impl> Convert for TargetedFeeAdjustment< // determines if the first_term is positive let positive = block_weight >= target_weight; let diff_abs = block_weight.max(target_weight) - block_weight.min(target_weight); - // safe, diff_abs cannot exceed u64 and it can always be computed safely even with the lossy - // `Fixed128::from_rational`. - let diff = Fixed128::from_rational( - diff_abs as i128, - NonZeroI128::new(max_weight.max(1) as i128).unwrap(), - ); + // safe, diff_abs cannot exceed u64. + let diff = Fixed128::saturating_from_rational(diff_abs, max_weight.max(1)); let diff_squared = diff.saturating_mul(diff); // 0.00004 = 4/100_000 = 40_000/10^9 - let v = Fixed128::from_rational(4, NonZeroI128::new(100_000).unwrap()); + let v = Fixed128::saturating_from_rational(4, 100_000); // 0.00004^2 = 16/10^10 Taking the future /2 into account... 8/10^10 - let v_squared_2 = Fixed128::from_rational(8, NonZeroI128::new(10_000_000_000).unwrap()); + let v_squared_2 = Fixed128::saturating_from_rational(8, 10_000_000_000u64); let first_term = v.saturating_mul(diff); let second_term = v_squared_2.saturating_mul(diff_squared); @@ -99,7 +92,7 @@ impl> Convert for TargetedFeeAdjustment< // multiplier. While at -1, it means that the network is so un-congested that all // transactions have no weight fee. We stop here and only increase if the network // became more busy. - .max(Fixed128::from_natural(-1)) + .max(Fixed128::saturating_from_integer(-1)) } } } @@ -111,7 +104,6 @@ mod tests { use crate::{MaximumBlockWeight, AvailableBlockRatio, Runtime}; use crate::{constants::currency::*, TransactionPayment, TargetBlockFullness}; use frame_support::weights::{Weight, WeightToFeePolynomial}; - use core::num::NonZeroI128; fn max() -> Weight { MaximumBlockWeight::get() @@ -135,7 +127,7 @@ mod tests { let s = block_weight; let fm = v * (s/m - ss/m) + v.powi(2) * (s/m - ss/m).powi(2) / 2.0; - let addition_fm = Fixed128::from_parts((fm * Fixed128::accuracy() as f64).round() as i128); + let addition_fm = Fixed128::from_inner((fm * Fixed128::accuracy() as f64).round() as i128); previous.saturating_add(addition_fm) } @@ -150,7 +142,7 @@ mod tests { #[test] fn fee_multiplier_update_poc_works() { - let fm = Fixed128::from_rational(0, NonZeroI128::new(1).unwrap()); + let fm = Fixed128::saturating_from_rational(0, 1); let test_set = vec![ (0, fm.clone()), (100, fm.clone()), @@ -164,7 +156,7 @@ mod tests { fee_multiplier_update(w, fm), TargetedFeeAdjustment::::convert(fm), // Error is only 1 in 10^18 - Fixed128::from_parts(1), + Fixed128::from_inner(1), ); }) }) @@ -180,7 +172,7 @@ mod tests { loop { let next = TargetedFeeAdjustment::::convert(fm); fm = next; - if fm == Fixed128::from_natural(-1) { break; } + if fm == Fixed128::saturating_from_integer(-1) { break; } iterations += 1; } println!("iteration {}, new fm = {:?}. Weight fee is now zero", iterations, fm); @@ -220,7 +212,7 @@ mod tests { iterations += 1; let fee = ::WeightToFee::calc(&tx_weight); - let adjusted_fee = fm.saturated_multiply_accumulate(fee); + let adjusted_fee = fm.saturating_mul_acc_int(fee); println!( "iteration {}, new fm = {:?}. Fee at this point is: {} units / {} millicents, \ {} cents, {} dollars", @@ -323,8 +315,8 @@ mod tests { // ... stops going down at -1 assert_eq!( - TargetedFeeAdjustment::::convert(Fixed128::from_natural(-1)), - Fixed128::from_natural(-1) + TargetedFeeAdjustment::::convert(Fixed128::saturating_from_integer(-1)), + Fixed128::saturating_from_integer(-1) ); }) } @@ -333,7 +325,7 @@ mod tests { fn weight_to_fee_should_not_overflow_on_large_weights() { let kb = 1024 as Weight; let mb = kb * kb; - let max_fm = Fixed128::from_natural(i128::max_value()); + let max_fm = Fixed128::saturating_from_integer(i128::max_value()); // check that for all values it can compute, correctly. vec![ @@ -356,7 +348,7 @@ mod tests { run_with_system_weight(i, || { let next = TargetedFeeAdjustment::::convert(Fixed128::default()); let truth = fee_multiplier_update(i, Fixed128::default()); - assert_eq_error_rate!(truth, next, Fixed128::from_parts(50_000_000)); + assert_eq_error_rate!(truth, next, Fixed128::from_inner(50_000_000)); }); }); diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e484e84d43..69c8e98316 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 250, - impl_version: 0, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/balances/src/tests.rs b/frame/balances/src/tests.rs index 9cfdc147b4..149b9f07d2 100644 --- a/frame/balances/src/tests.rs +++ b/frame/balances/src/tests.rs @@ -37,7 +37,7 @@ macro_rules! decl_tests { ($test:ty, $ext_builder:ty, $existential_deposit:expr) => { use crate::*; - use sp_runtime::{Fixed128, traits::{SignedExtension, BadOrigin}}; + use sp_runtime::{FixedPointNumber, Fixed128, traits::{SignedExtension, BadOrigin}}; use frame_support::{ assert_noop, assert_ok, assert_err, traits::{ @@ -154,7 +154,7 @@ macro_rules! decl_tests { .monied(true) .build() .execute_with(|| { - pallet_transaction_payment::NextFeeMultiplier::put(Fixed128::from_natural(1)); + pallet_transaction_payment::NextFeeMultiplier::put(Fixed128::saturating_from_integer(1)); Balances::set_lock(ID_1, &1, 10, WithdrawReason::Reserve.into()); assert_noop!( >::transfer(&1, &2, 1, AllowDeath), diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 11b86170e7..c52d698756 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -44,7 +44,7 @@ use frame_support::{ dispatch::DispatchResult, }; use sp_runtime::{ - Fixed128, + Fixed128, FixedPointNumber, transaction_validity::{ TransactionPriority, ValidTransaction, InvalidTransaction, TransactionValidityError, TransactionValidity, @@ -83,7 +83,7 @@ pub trait Trait: frame_system::Trait { decl_storage! { trait Store for Module as TransactionPayment { - pub NextFeeMultiplier get(fn next_fee_multiplier): Multiplier = Multiplier::from_parts(0); + pub NextFeeMultiplier get(fn next_fee_multiplier): Multiplier = Multiplier::from_inner(0); } } @@ -172,7 +172,7 @@ impl Module { // the adjustable part of the fee let adjustable_fee = len_fee.saturating_add(unadjusted_weight_fee); let targeted_fee_adjustment = NextFeeMultiplier::get(); - let adjusted_fee = targeted_fee_adjustment.saturated_multiply_accumulate(adjustable_fee.saturated_into()); + let adjusted_fee = targeted_fee_adjustment.saturating_mul_acc_int(adjustable_fee.saturated_into()); let base_fee = Self::weight_to_fee(T::ExtrinsicBaseWeight::get()); base_fee.saturating_add(adjusted_fee.saturated_into()).saturating_add(tip) @@ -190,7 +190,7 @@ impl Module { { let fee = UniqueSaturatedInto::::unique_saturated_into(Self::weight_to_fee(weight)); UniqueSaturatedFrom::unique_saturated_from( - NextFeeMultiplier::get().saturated_multiply_accumulate(fee) + NextFeeMultiplier::get().saturating_mul_acc_int(fee) ) } @@ -329,7 +329,6 @@ impl SignedExtension for ChargeTransactionPayment whe #[cfg(test)] mod tests { use super::*; - use core::num::NonZeroI128; use codec::Encode; use frame_support::{ impl_outer_dispatch, impl_outer_origin, parameter_types, @@ -575,7 +574,7 @@ mod tests { .execute_with(|| { let len = 10; - NextFeeMultiplier::put(Fixed128::from_rational(1, NonZeroI128::new(2).unwrap())); + NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); let pre = ChargeTransactionPayment::::from(5 /* tipped */) .pre_dispatch(&2, CALL, &info_from_weight(100), len) @@ -663,7 +662,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Fixed128::from_rational(1, NonZeroI128::new(2).unwrap())); + NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); let len = 10; assert!( @@ -691,7 +690,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Fixed128::from_rational(1, NonZeroI128::new(2).unwrap())); + NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); assert_eq!( TransactionPayment::query_info(xt, len), @@ -720,7 +719,7 @@ mod tests { .execute_with(|| { // Next fee multiplier is zero - assert_eq!(NextFeeMultiplier::get(), Fixed128::from_natural(0)); + assert_eq!(NextFeeMultiplier::get(), Fixed128::saturating_from_integer(0)); // Tip only, no fees works let dispatch_info = DispatchInfo { @@ -760,7 +759,7 @@ mod tests { .execute_with(|| { // Add a next fee multiplier - NextFeeMultiplier::put(Fixed128::from_rational(1, NonZeroI128::new(2).unwrap())); // = 1/2 = .5 + NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); // = 1/2 = .5 // Base fee is unaffected by multiplier let dispatch_info = DispatchInfo { weight: 0, diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index c22706e32e..9d080d6010 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -20,12 +20,12 @@ num-traits = { version = "0.2.8", default-features = false } sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-debug-derive = { version = "2.0.0-dev", default-features = false, path = "../../primitives/debug-derive" } -primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] rand = "0.7.2" criterion = "0.3" serde_json = "1.0" +primitive-types = "0.7.0" [features] default = ["std"] @@ -35,7 +35,6 @@ std = [ "sp-std/std", "serde", "sp-debug-derive/std", - "primitive-types/std", ] [[bench]] diff --git a/primitives/arithmetic/fuzzer/Cargo.lock b/primitives/arithmetic/fuzzer/Cargo.lock deleted file mode 100644 index 3a4187437a..0000000000 --- a/primitives/arithmetic/fuzzer/Cargo.lock +++ /dev/null @@ -1,401 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "arbitrary" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cf76cb6e2222ed0ea86b2b0ee2f71c96ec6edd5af42e84d59160e91b836ec4" - -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "bitvec" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993f74b4c99c1908d156b8d2e0fb6277736b0ecbd833982fd1241d39b2766a6" - -[[package]] -name = "byte-slice-cast" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "c2-chacha" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -dependencies = [ - "ppv-lite86", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "fixed-hash" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3367952ceb191f4ab95dd5685dc163ac539e36202f9fcfd0cb22f9f9c542fefc" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "honggfuzz" -version = "0.5.45" -dependencies = [ - "arbitrary", - "lazy_static", - "memmap", -] - -[[package]] -name = "impl-codec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "integer-sqrt" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" -dependencies = [ - "autocfg", -] - -[[package]] -name = "parity-scale-codec" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f509c5e67ca0605ee17dcd3f91ef41cadd685c75a298fb6261b781a5acb3f910" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" - -[[package]] -name = "primitive-types" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4336f4f5d5524fa60bcbd6fe626f9223d8142a50e7053e979acdf0da41ab975" -dependencies = [ - "fixed-hash", - "impl-codec", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" -dependencies = [ - "c2-chacha", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "serde" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-arithmetic" -version = "2.0.0-alpha.3" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-arithmetic-fuzzer" -version = "2.0.0" -dependencies = [ - "honggfuzz", - "num-bigint", - "num-traits", - "primitive-types", - "sp-arithmetic", -] - -[[package]] -name = "sp-debug-derive" -version = "2.0.0-alpha.3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-std" -version = "2.0.0-alpha.3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "syn" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "toml" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -dependencies = [ - "serde", -] - -[[package]] -name = "uint" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" -dependencies = [ - "byteorder", - "crunchy", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "winapi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index fdcf691762..c4842adc84 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-arithmetic = { version = "2.0.0-dev", path = ".." } -honggfuzz = "0.5" +honggfuzz = "0.5.49" primitive-types = "0.7.0" num-bigint = "0.2" num-traits = "0.2" @@ -31,3 +31,7 @@ path = "src/per_thing_rational.rs" [[bin]] name = "rational128" path = "src/rational128.rs" + +[[bin]] +name = "fixed" +path = "src/fixed.rs" \ No newline at end of file diff --git a/primitives/arithmetic/fuzzer/src/fixed.rs b/primitives/arithmetic/fuzzer/src/fixed.rs new file mode 100644 index 0000000000..115d7dbbdb --- /dev/null +++ b/primitives/arithmetic/fuzzer/src/fixed.rs @@ -0,0 +1,82 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Running +//! Running this fuzzer can be done with `cargo hfuzz run fixed`. `honggfuzz` CLI options can +//! be used by setting `HFUZZ_RUN_ARGS`, such as `-n 4` to use 4 threads. +//! +//! # Debugging a panic +//! Once a panic is found, it can be debugged with +//! `cargo hfuzz run-debug fixed hfuzz_workspace/fixed/*.fuzz`. +//! +//! # More information +//! More information about `honggfuzz` can be found +//! [here](https://docs.rs/honggfuzz/). + +use honggfuzz::fuzz; +use sp_arithmetic::{FixedPointNumber, Fixed64, traits::Saturating}; + +fn main() { + loop { + fuzz!(|data: (i32, i32)| { + let x: i128 = data.0.into(); + let y: i128 = data.1.into(); + + // Check `from_rational` and division are consistent. + if y != 0 { + let f1 = Fixed64::saturating_from_integer(x) / Fixed64::saturating_from_integer(y); + let f2 = Fixed64::saturating_from_rational(x, y); + assert_eq!(f1.into_inner(), f2.into_inner()); + } + + // Check `saturating_mul`. + let a = Fixed64::saturating_from_rational(2, 5); + let b = a.saturating_mul(Fixed64::saturating_from_integer(x)); + let n = b.into_inner() as i128; + let m = 2i128 * x * Fixed64::accuracy() as i128 / 5i128; + assert_eq!(n, m); + + // Check `saturating_mul` and division are inverse. + if x != 0 { + assert_eq!(a, b / Fixed64::saturating_from_integer(x)); + } + + // Check `reciprocal`. + let r = a.reciprocal().unwrap().reciprocal().unwrap(); + assert_eq!(a, r); + + // Check addition. + let a = Fixed64::saturating_from_integer(x); + let b = Fixed64::saturating_from_integer(y); + let c = Fixed64::saturating_from_integer(x.saturating_add(y)); + assert_eq!(a.saturating_add(b), c); + + // Check substraction. + let a = Fixed64::saturating_from_integer(x); + let b = Fixed64::saturating_from_integer(y); + let c = Fixed64::saturating_from_integer(x.saturating_sub(y)); + assert_eq!(a.saturating_sub(b), c); + + // Check `saturating_mul_acc_int`. + let a = Fixed64::saturating_from_rational(2, 5); + let b = a.saturating_mul_acc_int(x); + let xx = Fixed64::saturating_from_integer(x); + let d = a.saturating_mul(xx).saturating_add(xx).into_inner() as i128 / Fixed64::accuracy() as i128; + assert_eq!(b, d); + }); + } +} diff --git a/primitives/arithmetic/src/fixed.rs b/primitives/arithmetic/src/fixed.rs new file mode 100644 index 0000000000..19f498593d --- /dev/null +++ b/primitives/arithmetic/src/fixed.rs @@ -0,0 +1,1534 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Decimal Fixed Point implementations for Substrate runtime. + +use sp_std::{ops::{self, Add, Sub, Mul, Div}, fmt::Debug, prelude::*, convert::{TryInto, TryFrom}}; +use codec::{Encode, Decode}; +use crate::{ + helpers_128bit::multiply_by_rational, PerThing, + traits::{ + SaturatedConversion, CheckedSub, CheckedAdd, CheckedMul, CheckedDiv, CheckedNeg, + Bounded, Saturating, UniqueSaturatedInto, Zero, One, Signed + }, +}; + +#[cfg(feature = "std")] +use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; + +/// Integer types that can be used to interact with `FixedPointNumber` implementations. +pub trait FixedPointOperand: Copy + Clone + Bounded + Zero + Saturating + + PartialOrd + UniqueSaturatedInto + TryFrom + CheckedNeg {} + +impl FixedPointOperand for i128 {} +impl FixedPointOperand for u128 {} +impl FixedPointOperand for i64 {} +impl FixedPointOperand for u64 {} +impl FixedPointOperand for i32 {} +impl FixedPointOperand for u32 {} +impl FixedPointOperand for i16 {} +impl FixedPointOperand for u16 {} +impl FixedPointOperand for i8 {} +impl FixedPointOperand for u8 {} + +/// Something that implements a decimal fixed point number. +/// +/// The precision is given by `Self::DIV`, i.e. `1 / DIV` can be represented. +/// +/// Each type can store numbers from `Self::Inner::min_value() / Self::DIV` +/// to `Self::Inner::max_value() / Self::DIV`. +/// This is also referred to as the _accuracy_ of the type in the documentation. +pub trait FixedPointNumber: + Sized + Copy + Default + Debug + + Saturating + Bounded + + Eq + PartialEq + Ord + PartialOrd + + CheckedSub + CheckedAdd + CheckedMul + CheckedDiv + + Add + Sub + Div + Mul +{ + /// The underlying data type used for this fixed point number. + type Inner: Debug + One + CheckedMul + CheckedDiv + CheckedNeg + Signed + FixedPointOperand; + + /// Precision of this fixed point implementation. It should be a power of `10`. + const DIV: Self::Inner; + + /// Precision of this fixed point implementation. + fn accuracy() -> Self::Inner { + Self::DIV + } + + /// Builds this type from an integer number. + fn from_inner(int: Self::Inner) -> Self; + + /// Consumes `self` and returns the inner raw value. + fn into_inner(self) -> Self::Inner; + + /// Creates self from an integer number `int`. + /// + /// Returns `Self::max` or `Self::min` if `int` exceeds accuracy. + fn saturating_from_integer>(int: N) -> Self { + Self::from_inner(int.unique_saturated_into().saturating_mul(Self::DIV)) + } + + /// Creates `self` from an integer number `int`. + /// + /// Returns `None` if `int` exceeds accuracy. + fn checked_from_integer(int: Self::Inner) -> Option { + int.checked_mul(&Self::DIV).map(|inner| Self::from_inner(inner)) + } + + /// Creates `self` from a rational number. Equal to `n / d`. + /// + /// Panics if `d = 0`. Returns `Self::max` or `Self::min` if `n / d` exceeds accuracy. + fn saturating_from_rational(n: N, d: D) -> Self { + if d == D::zero() { + panic!("attempt to divide by zero") + } + Self::checked_from_rational(n, d).unwrap_or(to_bound(n, d)) + } + + /// Creates `self` from a rational number. Equal to `n / d`. + /// + /// Returns `None` if `d == 0` or `n / d` exceeds accuracy. + fn checked_from_rational(n: N, d: D) -> Option { + if d == D::zero() { + return None + } + + let n: I129 = n.into(); + let d: I129 = d.into(); + let negative = n.negative != d.negative; + + multiply_by_rational(n.value, Self::DIV.unique_saturated_into(), d.value).ok() + .and_then(|value| from_i129(I129 { value, negative })) + .map(|inner| Self::from_inner(inner)) + } + + /// Checked multiplication for integer type `N`. Equal to `self * n`. + /// + /// Returns `None` if the result does not fit in `N`. + fn checked_mul_int(self, n: N) -> Option { + let lhs: I129 = self.into_inner().into(); + let rhs: I129 = n.into(); + let negative = lhs.negative != rhs.negative; + + multiply_by_rational(lhs.value, rhs.value, Self::DIV.unique_saturated_into()).ok() + .and_then(|value| from_i129(I129 { value, negative })) + } + + /// Saturating multiplication for integer type `N`. Equal to `self * n`. + /// + /// Returns `N::min` or `N::max` if the result does not fit in `N`. + fn saturating_mul_int(self, n: N) -> N { + self.checked_mul_int(n).unwrap_or(to_bound(self.into_inner(), n)) + } + + /// Checked division for integer type `N`. Equal to `self / d`. + /// + /// Returns `None` if the result does not fit in `N` or `d == 0`. + fn checked_div_int(self, d: N) -> Option { + let lhs: I129 = self.into_inner().into(); + let rhs: I129 = d.into(); + let negative = lhs.negative != rhs.negative; + + lhs.value.checked_div(rhs.value) + .and_then(|n| n.checked_div(Self::DIV.unique_saturated_into())) + .and_then(|value| from_i129(I129 { value, negative })) + } + + /// Saturating division for integer type `N`. Equal to `self / d`. + /// + /// Panics if `d == 0`. Returns `N::min` or `N::max` if the result does not fit in `N`. + fn saturating_div_int(self, d: N) -> N { + if d == N::zero() { + panic!("attempt to divide by zero") + } + self.checked_div_int(d).unwrap_or(to_bound(self.into_inner(), d)) + } + + /// Saturating multiplication for integer type `N`, adding the result back. + /// Equal to `self * n + n`. + /// + /// Returns `N::min` or `N::max` if the multiplication or final result does not fit in `N`. + fn saturating_mul_acc_int(self, n: N) -> N { + self.saturating_mul_int(n).saturating_add(n) + } + + /// Saturating absolute value. + /// + /// Returns `Self::max` if `self == Self::min`. + fn saturating_abs(self) -> Self { + let inner = self.into_inner(); + if inner.is_positive() { + self + } else { + Self::from_inner(inner.checked_neg().unwrap_or(Self::Inner::max_value())) + } + } + + /// Takes the reciprocal (inverse). Equal to `1 / self`. + /// + /// Returns `None` if `self = 0`. + fn reciprocal(self) -> Option { + Self::one().checked_div(&self) + } + + /// Returns zero. + fn zero() -> Self { + Self::from_inner(Self::Inner::zero()) + } + + /// Checks if the number is zero. + fn is_zero(&self) -> bool { + self.into_inner() == Self::Inner::zero() + } + + /// Returns one. + fn one() -> Self { + Self::from_inner(Self::DIV) + } + + /// Checks if the number is one. + fn is_one(&self) -> bool { + self.into_inner() == Self::Inner::one() + } + + /// Checks if the number is positive. + fn is_positive(self) -> bool { + self.into_inner() >= Self::Inner::zero() + } + + /// Checks if the number is negative. + fn is_negative(self) -> bool { + self.into_inner() < Self::Inner::zero() + } + + /// Returns the integer part. + fn trunc(self) -> Self { + self.into_inner().checked_div(&Self::DIV) + .expect("panics only if DIV is zero, DIV is not zero; qed") + .checked_mul(&Self::DIV) + .map(|inner| Self::from_inner(inner)) + .expect("can not overflow since fixed number is >= integer part") + } + + /// Returns the fractional part. + /// + /// Note: the returned fraction will be non-negative for negative numbers, + /// except in the case where the integer part is zero. + fn frac(self) -> Self { + let integer = self.trunc(); + let fractional = self.saturating_sub(integer); + if integer == Self::zero() { + fractional + } else { + fractional.saturating_abs() + } + } + + /// Returns the smallest integer greater than or equal to a number. + /// + /// Saturates to `Self::max` (truncated) if the result does not fit. + fn ceil(self) -> Self { + if self.is_negative() { + self.trunc() + } else { + self.saturating_add(Self::one()).trunc() + } + } + + /// Returns the largest integer less than or equal to a number. + /// + /// Saturates to `Self::min` (truncated) if the result does not fit. + fn floor(self) -> Self { + if self.is_negative() { + self.saturating_sub(Self::one()).trunc() + } else { + self.trunc() + } + } + + /// Returns the number rounded to the nearest integer. Rounds half-way cases away from 0.0. + /// + /// Saturates to `Self::min` or `Self::max` (truncated) if the result does not fit. + fn round(self) -> Self { + let n = self.frac().saturating_mul(Self::saturating_from_integer(10)); + if n < Self::saturating_from_integer(5) { + self.trunc() + } else { + let extra = Self::saturating_from_integer(self.into_inner().signum()); + (self.saturating_add(extra)).trunc() + } + } +} + +/// Data type used as intermediate storage in some computations to avoid overflow. +struct I129 { + value: u128, + negative: bool, +} + +impl From for I129 { + fn from(n: N) -> I129 { + if n < N::zero() { + let value: u128 = n.checked_neg() + .map(|n| n.unique_saturated_into()) + .unwrap_or(N::max_value().unique_saturated_into().saturating_add(1)); + I129 { value, negative: true } + } else { + I129 { value: n.unique_saturated_into(), negative: false } + } + } +} + +/// Transforms an `I129` to `N` if it is possible. +fn from_i129(n: I129) -> Option { + let max_plus_one: u128 = N::max_value().unique_saturated_into().saturating_add(1); + if n.negative && N::min_value() < N::zero() && n.value == max_plus_one { + Some(N::min_value()) + } else { + let unsigned_inner: N = n.value.try_into().ok()?; + let inner = if n.negative { unsigned_inner.checked_neg()? } else { unsigned_inner }; + Some(inner) + } +} + +/// Returns `R::max` if the sign of `n * m` is positive, `R::min` otherwise. +fn to_bound(n: N, m: D) -> R { + if (n < N::zero()) != (m < D::zero()) { + R::min_value() + } else { + R::max_value() + } +} + +macro_rules! implement_fixed { + ( + $name:ident, + $test_mod:ident, + $inner_type:ty, + $div:tt, + $title:expr $(,)? + ) => { + /// A fixed point number representation in the range. + /// + #[doc = $title] + #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] + pub struct $name($inner_type); + + impl From<$inner_type> for $name { + fn from(int: $inner_type) -> Self { + $name::saturating_from_integer(int) + } + } + + impl From<(N, D)> for $name { + fn from(r: (N, D)) -> Self { + $name::saturating_from_rational(r.0, r.1) + } + } + + impl FixedPointNumber for $name { + type Inner = $inner_type; + + const DIV: Self::Inner = $div; + + fn from_inner(inner: Self::Inner) -> Self { + Self(inner) + } + + fn into_inner(self) -> Self::Inner { + self.0 + } + } + + impl Saturating for $name { + fn saturating_add(self, rhs: Self) -> Self { + Self(self.0.saturating_add(rhs.0)) + } + + fn saturating_sub(self, rhs: Self) -> Self { + Self(self.0.saturating_sub(rhs.0)) + } + + fn saturating_mul(self, rhs: Self) -> Self { + self.checked_mul(&rhs).unwrap_or(to_bound(self.0, rhs.0)) + } + + fn saturating_pow(self, exp: usize) -> Self { + if exp == 0 { + return Self::saturating_from_integer(1); + } + + let exp = exp as u32; + let msb_pos = 32 - exp.leading_zeros(); + + let mut result = Self::saturating_from_integer(1); + let mut pow_val = self; + for i in 0..msb_pos { + if ((1 << i) & exp) > 0 { + result = result.saturating_mul(pow_val); + } + pow_val = pow_val.saturating_mul(pow_val); + } + result + } + } + + impl ops::Neg for $name { + type Output = Self; + + fn neg(self) -> Self::Output { + Self(-self.0) + } + } + + impl ops::Add for $name { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self(self.0 + rhs.0) + } + } + + impl ops::Sub for $name { + type Output = Self; + + fn sub(self, rhs: Self) -> Self::Output { + Self(self.0 - rhs.0) + } + } + + impl ops::Mul for $name { + type Output = Self; + + fn mul(self, rhs: Self) -> Self::Output { + self.checked_mul(&rhs) + .unwrap_or_else(|| panic!("attempt to multiply with overflow")) + } + } + + impl ops::Div for $name { + type Output = Self; + + fn div(self, rhs: Self) -> Self::Output { + if rhs.0 == 0 { + panic!("attempt to divide by zero") + } + self.checked_div(&rhs) + .unwrap_or_else(|| panic!("attempt to divide with overflow")) + } + } + + impl CheckedSub for $name { + fn checked_sub(&self, rhs: &Self) -> Option { + self.0.checked_sub(rhs.0).map(Self) + } + } + + impl CheckedAdd for $name { + fn checked_add(&self, rhs: &Self) -> Option { + self.0.checked_add(rhs.0).map(Self) + } + } + + impl CheckedDiv for $name { + fn checked_div(&self, other: &Self) -> Option { + if other.0 == 0 { + return None + } + + let lhs: I129 = self.0.into(); + let rhs: I129 = other.0.into(); + let negative = lhs.negative != rhs.negative; + + multiply_by_rational(lhs.value, Self::DIV as u128, rhs.value).ok() + .and_then(|value| from_i129(I129 { value, negative })) + .map(Self) + } + } + + impl CheckedMul for $name { + fn checked_mul(&self, other: &Self) -> Option { + let lhs: I129 = self.0.into(); + let rhs: I129 = other.0.into(); + let negative = lhs.negative != rhs.negative; + + multiply_by_rational(lhs.value, rhs.value, Self::DIV as u128).ok() + .and_then(|value| from_i129(I129 { value, negative })) + .map(Self) + } + } + + impl Bounded for $name { + fn min_value() -> Self { + Self(::Inner::min_value()) + } + + fn max_value() -> Self { + Self(::Inner::max_value()) + } + } + + impl sp_std::fmt::Debug for $name { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + let integral = { + let int = self.0 / Self::accuracy(); + let signum_for_zero = if int == 0 && self.is_negative() { "-" } else { "" }; + format!("{}{}", signum_for_zero, int) + }; + let precision = (Self::accuracy() as f64).log10() as usize; + let fractional = format!("{:0>weight$}", (self.0 % Self::accuracy()).abs(), weight=precision); + write!(f, "{}({}.{})", stringify!($name), integral, fractional) + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } + } + + impl From

for $name { + fn from(p: P) -> Self { + let accuracy = P::ACCURACY.saturated_into(); + let value = p.deconstruct().saturated_into(); + $name::saturating_from_rational(value, accuracy) + } + } + + #[cfg(feature = "std")] + impl sp_std::fmt::Display for $name { + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "{}", self.0) + } + } + + #[cfg(feature = "std")] + impl sp_std::str::FromStr for $name { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + let inner: ::Inner = s.parse() + .map_err(|_| "invalid string input for fixed point number")?; + Ok(Self::from_inner(inner)) + } + } + + // Manual impl `Serialize` as serde_json does not support i128. + // TODO: remove impl if issue https://github.com/serde-rs/json/issues/548 fixed. + #[cfg(feature = "std")] + impl Serialize for $name { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&self.to_string()) + } + } + + // Manual impl `Deserialize` as serde_json does not support i128. + // TODO: remove impl if issue https://github.com/serde-rs/json/issues/548 fixed. + #[cfg(feature = "std")] + impl<'de> Deserialize<'de> for $name { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + use sp_std::str::FromStr; + let s = String::deserialize(deserializer)?; + $name::from_str(&s).map_err(|err_str| de::Error::custom(err_str)) + } + } + + #[cfg(test)] + mod $test_mod { + use super::*; + use crate::{Perbill, Percent, Permill, Perquintill}; + + fn max() -> $name { + $name::max_value() + } + + fn min() -> $name { + $name::min_value() + } + + fn precision() -> usize { + ($name::accuracy() as f64).log10() as usize + } + + #[test] + fn macro_preconditions() { + assert!($name::DIV > 0); + } + + #[test] + fn from_i129_works() { + let a = I129 { + value: 1, + negative: true, + }; + + // Can't convert negative number to unsigned. + assert_eq!(from_i129::(a), None); + + let a = I129 { + value: u128::max_value() - 1, + negative: false, + }; + + // Max - 1 value fits. + assert_eq!(from_i129::(a), Some(u128::max_value() - 1)); + + let a = I129 { + value: u128::max_value(), + negative: false, + }; + + // Max value fits. + assert_eq!(from_i129::(a), Some(u128::max_value())); + + let a = I129 { + value: i128::max_value() as u128 + 1, + negative: true, + }; + + // Min value fits. + assert_eq!(from_i129::(a), Some(i128::min_value())); + + let a = I129 { + value: i128::max_value() as u128 + 1, + negative: false, + }; + + // Max + 1 does not fit. + assert_eq!(from_i129::(a), None); + + let a = I129 { + value: i128::max_value() as u128, + negative: false, + }; + + // Max value fits. + assert_eq!(from_i129::(a), Some(i128::max_value())); + } + + #[test] + fn to_bound_works() { + let a = 1i32; + let b = 1i32; + + // Pos + Pos => Max. + assert_eq!(to_bound::<_, _, i32>(a, b), i32::max_value()); + + let a = -1i32; + let b = -1i32; + + // Neg + Neg => Max. + assert_eq!(to_bound::<_, _, i32>(a, b), i32::max_value()); + + let a = 1i32; + let b = -1i32; + + // Pos + Neg => Min. + assert_eq!(to_bound::<_, _, i32>(a, b), i32::min_value()); + + let a = -1i32; + let b = 1i32; + + // Neg + Pos => Min. + assert_eq!(to_bound::<_, _, i32>(a, b), i32::min_value()); + + let a = 1i32; + let b = -1i32; + + // Pos + Neg => Min (unsigned). + assert_eq!(to_bound::<_, _, u32>(a, b), 0); + } + + #[test] + #[should_panic(expected = "attempt to negate with overflow")] + fn op_neg_panics() { + let a = $name::min_value(); + let _ = -a; + } + + #[test] + fn op_neg_works() { + let a = $name::saturating_from_integer(5); + let b = -a; + + // Positive. + assert_eq!($name::saturating_from_integer(-5), b); + + let a = $name::saturating_from_integer(-5); + let b = -a; + + // Negative + assert_eq!($name::saturating_from_integer(5), b); + + let a = $name::max_value(); + let b = -a; + + // Max. + assert_eq!($name::min_value() + $name::from_inner(1), b); + + let a = $name::min_value() + $name::from_inner(1); + let b = -a; + + // Min. + assert_eq!($name::max_value(), b); + + let a = $name::zero(); + let b = -a; + + // Zero. + assert_eq!(a, b); + } + + #[test] + #[should_panic(expected = "attempt to add with overflow")] + fn op_add_panics() { + let a = $name::max_value(); + let b = 1.into(); + let _ = a + b; + } + + #[test] + fn op_add_works() { + let a = $name::saturating_from_rational(5, 2); + let b = $name::saturating_from_rational(1, 2); + + // Positive case: 6/2 = 3. + assert_eq!($name::saturating_from_integer(3), a + b); + + let b = $name::saturating_from_rational(1, -2); + + // Negative case: 4/2 = 2. + assert_eq!($name::saturating_from_integer(2), a + b); + } + + #[test] + #[should_panic(expected = "attempt to subtract with overflow")] + fn op_sub_panics() { + let a = $name::min_value(); + let b = 1.into(); + let _c = a - b; + } + + #[test] + fn op_sub_works() { + let a = $name::saturating_from_rational(5, 2); + let b = $name::saturating_from_rational(1, 2); + + // Negative case: 4/2 = 2. + assert_eq!($name::saturating_from_integer(2), a - b); + + let b = $name::saturating_from_rational(1, -2); + + // Positive case: 6/2 = 3. + assert_eq!($name::saturating_from_integer(3), a - b); + } + + #[test] + #[should_panic(expected = "attempt to multiply with overflow")] + fn op_mul_panics() { + let a = $name::max_value(); + let b = 2.into(); + let _c = a * b; + } + + #[test] + fn op_mul_works() { + let a = $name::saturating_from_integer(42); + let b = $name::saturating_from_integer(2); + assert_eq!($name::saturating_from_integer(84), a * b); + + let a = $name::saturating_from_integer(42); + let b = $name::saturating_from_integer(-2); + assert_eq!($name::saturating_from_integer(-84), a * b); + } + + #[test] + #[should_panic(expected = "attempt to divide by zero")] + fn op_div_panics_on_zero_divisor() { + let a = $name::saturating_from_integer(1); + let b = 0.into(); + let _c = a / b; + } + + #[test] + #[should_panic(expected = "attempt to divide with overflow")] + fn op_div_panics_on_overflow() { + let a = $name::min_value(); + let b = (-1).into(); + let _c = a / b; + } + + #[test] + fn op_div_works() { + let a = $name::saturating_from_integer(42); + let b = $name::saturating_from_integer(2); + assert_eq!($name::saturating_from_integer(21), a / b); + + let a = $name::saturating_from_integer(42); + let b = $name::saturating_from_integer(-2); + assert_eq!($name::saturating_from_integer(-21), a / b); + } + + #[test] + fn from_integer_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + // Cases where integer fits. + let a = $name::saturating_from_integer(42); + assert_eq!(a.into_inner(), 42 * accuracy); + + let a = $name::saturating_from_integer(-42); + assert_eq!(a.into_inner(), -42 * accuracy); + + // Max/min integers that fit. + let a = $name::saturating_from_integer(inner_max / accuracy); + assert_eq!(a.into_inner(), (inner_max / accuracy) * accuracy); + + let a = $name::saturating_from_integer(inner_min / accuracy); + assert_eq!(a.into_inner(), (inner_min / accuracy) * accuracy); + + // Cases where integer doesn't fit, so it saturates. + let a = $name::saturating_from_integer(inner_max / accuracy + 1); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_integer(inner_min / accuracy - 1); + assert_eq!(a.into_inner(), inner_min); + } + + #[test] + fn checked_from_integer_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + // Cases where integer fits. + let a = $name::checked_from_integer(42) + .expect("42 * accuracy <= inner_max; qed"); + assert_eq!(a.into_inner(), 42 * accuracy); + + let a = $name::checked_from_integer(-42) + .expect("-42 * accuracy >= inner_min; qed"); + assert_eq!(a.into_inner(), -42 * accuracy); + + // Max/min integers that fit. + let a = $name::checked_from_integer(inner_max / accuracy) + .expect("(inner_max / accuracy) * accuracy <= inner_max; qed"); + assert_eq!(a.into_inner(), (inner_max / accuracy) * accuracy); + + let a = $name::checked_from_integer(inner_min / accuracy) + .expect("(inner_min / accuracy) * accuracy <= inner_min; qed"); + assert_eq!(a.into_inner(), (inner_min / accuracy) * accuracy); + + // Cases where integer doesn't fit, so it returns `None`. + let a = $name::checked_from_integer(inner_max / accuracy + 1); + assert_eq!(a, None); + + let a = $name::checked_from_integer(inner_min / accuracy - 1); + assert_eq!(a, None); + } + + #[test] + fn from_inner_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + + assert_eq!(max(), $name::from_inner(inner_max)); + assert_eq!(min(), $name::from_inner(inner_min)); + } + + #[test] + #[should_panic(expected = "attempt to divide by zero")] + fn saturating_from_rational_panics_on_zero_divisor() { + let _ = $name::saturating_from_rational(1, 0); + } + + #[test] + fn saturating_from_rational_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + let a = $name::saturating_from_rational(5, 2); + + // Positive case: 2.5 + assert_eq!(a.into_inner(), 25 * accuracy / 10); + + let a = $name::saturating_from_rational(-5, 2); + + // Negative case: -2.5 + assert_eq!(a.into_inner(), -25 * accuracy / 10); + + let a = $name::saturating_from_rational(5, -2); + + // Other negative case: -2.5 + assert_eq!(a.into_inner(), -25 * accuracy / 10); + + let a = $name::saturating_from_rational(-5, -2); + + // Other positive case: 2.5 + assert_eq!(a.into_inner(), 25 * accuracy / 10); + + // Max - 1. + let a = $name::saturating_from_rational(inner_max - 1, accuracy); + assert_eq!(a.into_inner(), inner_max - 1); + + // Min + 1. + let a = $name::saturating_from_rational(inner_min + 1, accuracy); + assert_eq!(a.into_inner(), inner_min + 1); + + // Max. + let a = $name::saturating_from_rational(inner_max, accuracy); + assert_eq!(a.into_inner(), inner_max); + + // Min. + let a = $name::saturating_from_rational(inner_min, accuracy); + assert_eq!(a.into_inner(), inner_min); + + // Max + 1, saturates. + let a = $name::saturating_from_rational(inner_max as u128 + 1, accuracy); + assert_eq!(a.into_inner(), inner_max); + + // Min - 1, saturates. + let a = $name::saturating_from_rational(inner_max as u128 + 2, -accuracy); + assert_eq!(a.into_inner(), inner_min); + + // Zero. + let a = $name::saturating_from_rational(0, 1); + assert_eq!(a.into_inner(), 0); + + let a = $name::saturating_from_rational(inner_max, -accuracy); + assert_eq!(a.into_inner(), -inner_max); + + let a = $name::saturating_from_rational(inner_min, -accuracy); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_min + 1, -accuracy); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_max - 1, accuracy); + assert_eq!(a.into_inner(), inner_max - 1); + + let a = $name::saturating_from_rational(inner_min + 1, accuracy); + assert_eq!(a.into_inner(), inner_min + 1); + + let a = $name::saturating_from_rational(inner_max, 1); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_min, 1); + assert_eq!(a.into_inner(), inner_min); + + let a = $name::saturating_from_rational(inner_min, -1); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_max, -1); + assert_eq!(a.into_inner(), inner_min); + + let a = $name::saturating_from_rational(inner_max, inner_max); + assert_eq!(a.into_inner(), accuracy); + + let a = $name::saturating_from_rational(inner_min, inner_min); + assert_eq!(a.into_inner(), accuracy); + + let a = $name::saturating_from_rational(inner_max, -inner_max); + assert_eq!(a.into_inner(), -accuracy); + + let a = $name::saturating_from_rational(-inner_max, inner_max); + assert_eq!(a.into_inner(), -accuracy); + + let a = $name::saturating_from_rational(inner_max, 3 * accuracy); + assert_eq!(a.into_inner(), inner_max / 3); + + let a = $name::saturating_from_rational(inner_max, -3 * accuracy); + assert_eq!(a.into_inner(), -inner_max / 3); + + let a = $name::saturating_from_rational(inner_min, 2 * accuracy); + assert_eq!(a.into_inner(), inner_min / 2); + + let a = $name::saturating_from_rational(inner_min, accuracy / -3); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_min, accuracy / 3); + assert_eq!(a.into_inner(), inner_min); + + let a = $name::saturating_from_rational(1, accuracy); + assert_eq!(a.into_inner(), 1); + + let a = $name::saturating_from_rational(1, -accuracy); + assert_eq!(a.into_inner(), -1); + + // Out of accuracy. + let a = $name::saturating_from_rational(1, accuracy + 1); + assert_eq!(a.into_inner(), 0); + + let a = $name::saturating_from_rational(1, -accuracy - 1); + assert_eq!(a.into_inner(), 0); + } + + #[test] + fn checked_from_rational_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + // Divide by zero => None. + let a = $name::checked_from_rational(1, 0); + assert_eq!(a, None); + + // Max - 1. + let a = $name::checked_from_rational(inner_max - 1, accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_max - 1); + + // Min + 1. + let a = $name::checked_from_rational(inner_min + 1, accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_min + 1); + + // Max. + let a = $name::checked_from_rational(inner_max, accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_max); + + // Min. + let a = $name::checked_from_rational(inner_min, accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_min); + + // Max + 1 => Overflow => None. + let a = $name::checked_from_rational(inner_min, -accuracy); + assert_eq!(a, None); + + // Min - 1 => Underflow => None. + let a = $name::checked_from_rational(inner_max as u128 + 2, -accuracy); + assert_eq!(a, None); + + let a = $name::checked_from_rational(inner_max, 3 * accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_max / 3); + + let a = $name::checked_from_rational(inner_max, -3 * accuracy).unwrap(); + assert_eq!(a.into_inner(), -inner_max / 3); + + let a = $name::checked_from_rational(inner_min, 2 * accuracy).unwrap(); + assert_eq!(a.into_inner(), inner_min / 2); + + let a = $name::checked_from_rational(inner_min, accuracy / -3); + assert_eq!(a, None); + + let a = $name::checked_from_rational(inner_min, accuracy / 3); + assert_eq!(a, None); + + let a = $name::checked_from_rational(1, accuracy).unwrap(); + assert_eq!(a.into_inner(), 1); + + let a = $name::checked_from_rational(1, -accuracy).unwrap(); + assert_eq!(a.into_inner(), -1); + + let a = $name::checked_from_rational(1, accuracy + 1).unwrap(); + assert_eq!(a.into_inner(), 0); + + let a = $name::checked_from_rational(1, -accuracy - 1).unwrap(); + assert_eq!(a.into_inner(), 0); + } + + #[test] + fn checked_mul_int_works() { + let a = $name::saturating_from_integer(2); + // Max - 1. + assert_eq!(a.checked_mul_int((i128::max_value() - 1) / 2), Some(i128::max_value() - 1)); + // Max. + assert_eq!(a.checked_mul_int(i128::max_value() / 2), Some(i128::max_value() - 1)); + // Max + 1 => None. + assert_eq!(a.checked_mul_int(i128::max_value() / 2 + 1), None); + + // Min - 1. + assert_eq!(a.checked_mul_int((i128::min_value() + 1) / 2), Some(i128::min_value() + 2)); + // Min. + assert_eq!(a.checked_mul_int(i128::min_value() / 2), Some(i128::min_value())); + // Min + 1 => None. + assert_eq!(a.checked_mul_int(i128::min_value() / 2 - 1), None); + + let a = $name::saturating_from_rational(1, 2); + assert_eq!(a.checked_mul_int(42i128), Some(21)); + assert_eq!(a.checked_mul_int(i128::max_value()), Some(i128::max_value() / 2)); + assert_eq!(a.checked_mul_int(i128::min_value()), Some(i128::min_value() / 2)); + + let b = $name::saturating_from_rational(1, -2); + assert_eq!(b.checked_mul_int(42i128), Some(-21)); + assert_eq!(b.checked_mul_int(u128::max_value()), None); + assert_eq!(b.checked_mul_int(i128::max_value()), Some(i128::max_value() / -2)); + assert_eq!(b.checked_mul_int(i128::min_value()), Some(i128::min_value() / -2)); + + let c = $name::saturating_from_integer(255); + assert_eq!(c.checked_mul_int(2i8), None); + assert_eq!(c.checked_mul_int(2i128), Some(510)); + assert_eq!(c.checked_mul_int(i128::max_value()), None); + assert_eq!(c.checked_mul_int(i128::min_value()), None); + } + + #[test] + fn saturating_mul_int_works() { + let a = $name::saturating_from_integer(2); + // Max - 1. + assert_eq!(a.saturating_mul_int((i128::max_value() - 1) / 2), i128::max_value() - 1); + // Max. + assert_eq!(a.saturating_mul_int(i128::max_value() / 2), i128::max_value() - 1); + // Max + 1 => saturates to max. + assert_eq!(a.saturating_mul_int(i128::max_value() / 2 + 1), i128::max_value()); + + // Min - 1. + assert_eq!(a.saturating_mul_int((i128::min_value() + 1) / 2), i128::min_value() + 2); + // Min. + assert_eq!(a.saturating_mul_int(i128::min_value() / 2), i128::min_value()); + // Min + 1 => saturates to min. + assert_eq!(a.saturating_mul_int(i128::min_value() / 2 - 1), i128::min_value()); + + let a = $name::saturating_from_rational(1, 2); + assert_eq!(a.saturating_mul_int(42i32), 21); + assert_eq!(a.saturating_mul_int(i128::max_value()), i128::max_value() / 2); + assert_eq!(a.saturating_mul_int(i128::min_value()), i128::min_value() / 2); + + let b = $name::saturating_from_rational(1, -2); + assert_eq!(b.saturating_mul_int(42i32), -21); + assert_eq!(b.saturating_mul_int(i128::max_value()), i128::max_value() / -2); + assert_eq!(b.saturating_mul_int(i128::min_value()), i128::min_value() / -2); + assert_eq!(b.saturating_mul_int(u128::max_value()), u128::min_value()); + + let c = $name::saturating_from_integer(255); + assert_eq!(c.saturating_mul_int(2i8), i8::max_value()); + assert_eq!(c.saturating_mul_int(-2i8), i8::min_value()); + assert_eq!(c.saturating_mul_int(i128::max_value()), i128::max_value()); + assert_eq!(c.saturating_mul_int(i128::min_value()), i128::min_value()); + } + + #[test] + fn checked_mul_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + + let a = $name::saturating_from_integer(2); + + // Max - 1. + let b = $name::from_inner(inner_max - 1); + assert_eq!(a.checked_mul(&(b/2.into())), Some(b)); + + // Max. + let c = $name::from_inner(inner_max); + assert_eq!(a.checked_mul(&(c/2.into())), Some(b)); + + // Max + 1 => None. + let e = $name::from_inner(1); + assert_eq!(a.checked_mul(&(c/2.into()+e)), None); + + // Min + 1. + let b = $name::from_inner(inner_min + 1) / 2.into(); + let c = $name::from_inner(inner_min + 2); + assert_eq!(a.checked_mul(&b), Some(c)); + + // Min. + let b = $name::from_inner(inner_min) / 2.into(); + let c = $name::from_inner(inner_min); + assert_eq!(a.checked_mul(&b), Some(c)); + + // Min - 1 => None. + let b = $name::from_inner(inner_min) / 2.into() - $name::from_inner(1); + assert_eq!(a.checked_mul(&b), None); + + let a = $name::saturating_from_rational(1, 2); + let b = $name::saturating_from_rational(1, -2); + let c = $name::saturating_from_integer(255); + + assert_eq!(a.checked_mul(&42.into()), Some(21.into())); + assert_eq!(b.checked_mul(&42.into()), Some((-21).into())); + assert_eq!(c.checked_mul(&2.into()), Some(510.into())); + + assert_eq!(b.checked_mul(&$name::max_value()), $name::max_value().checked_div(&(-2).into())); + assert_eq!(b.checked_mul(&$name::min_value()), $name::min_value().checked_div(&(-2).into())); + + assert_eq!(c.checked_mul(&$name::max_value()), None); + assert_eq!(c.checked_mul(&$name::min_value()), None); + + assert_eq!(a.checked_mul(&$name::max_value()), $name::max_value().checked_div(&2.into())); + assert_eq!(a.checked_mul(&$name::min_value()), $name::min_value().checked_div(&2.into())); + } + + #[test] + fn checked_div_int_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + let a = $name::from_inner(inner_max); + let b = $name::from_inner(inner_min); + let c = $name::zero(); + let d = $name::one(); + let e = $name::saturating_from_integer(6); + let f = $name::saturating_from_integer(5); + + assert_eq!(e.checked_div_int(2.into()), Some(3)); + assert_eq!(f.checked_div_int(2.into()), Some(2)); + + assert_eq!(a.checked_div_int(i128::max_value()), Some(0)); + assert_eq!(a.checked_div_int(2), Some(inner_max / (2 * accuracy))); + assert_eq!(a.checked_div_int(inner_max / accuracy), Some(1)); + assert_eq!(a.checked_div_int(1i8), None); + + assert_eq!(a.checked_div_int(-2), Some(-inner_max / (2 * accuracy))); + assert_eq!(a.checked_div_int(inner_max / -accuracy), Some(-1)); + + assert_eq!(b.checked_div_int(i128::min_value()), Some(0)); + assert_eq!(b.checked_div_int(2), Some(inner_min / (2 * accuracy))); + assert_eq!(b.checked_div_int(inner_min / accuracy), Some(1)); + assert_eq!(b.checked_div_int(1i8), None); + + assert_eq!(b.checked_div_int(-2), Some(-(inner_min / (2 * accuracy)))); + assert_eq!(b.checked_div_int(-(inner_min / accuracy)), Some(-1)); + + assert_eq!(c.checked_div_int(1), Some(0)); + assert_eq!(c.checked_div_int(i128::max_value()), Some(0)); + assert_eq!(c.checked_div_int(i128::min_value()), Some(0)); + assert_eq!(c.checked_div_int(1i8), Some(0)); + + assert_eq!(d.checked_div_int(1), Some(1)); + assert_eq!(d.checked_div_int(i32::max_value()), Some(0)); + assert_eq!(d.checked_div_int(i32::min_value()), Some(0)); + assert_eq!(d.checked_div_int(1i8), Some(1)); + + assert_eq!(a.checked_div_int(0), None); + assert_eq!(b.checked_div_int(0), None); + assert_eq!(c.checked_div_int(0), None); + assert_eq!(d.checked_div_int(0), None); + } + + #[test] + #[should_panic(expected = "attempt to divide by zero")] + fn saturating_div_int_panics_when_divisor_is_zero() { + let _ = $name::one().saturating_div_int(0); + } + + #[test] + fn saturating_div_int_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + let accuracy = $name::accuracy(); + + let a = $name::saturating_from_integer(5); + assert_eq!(a.saturating_div_int(2), 2); + + let a = $name::saturating_from_integer(5); + assert_eq!(a.saturating_div_int(-2), -2); + + let a = $name::min_value(); + assert_eq!(a.saturating_div_int(-1i128), (inner_max / accuracy) as i128); + + let a = $name::min_value(); + assert_eq!(a.saturating_div_int(1i128), (inner_min / accuracy) as i128); + } + + #[test] + fn saturating_abs_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + + assert_eq!($name::from_inner(inner_min).saturating_abs(), $name::max_value()); + assert_eq!($name::from_inner(inner_max).saturating_abs(), $name::max_value()); + assert_eq!($name::zero().saturating_abs(), 0.into()); + assert_eq!($name::saturating_from_rational(-1, 2).saturating_abs(), (1, 2).into()); + } + + #[test] + fn saturating_mul_acc_int_works() { + assert_eq!($name::zero().saturating_mul_acc_int(42i8), 42i8); + assert_eq!($name::one().saturating_mul_acc_int(42i8), 2 * 42i8); + + assert_eq!($name::one().saturating_mul_acc_int(i128::max_value()), i128::max_value()); + assert_eq!($name::one().saturating_mul_acc_int(i128::min_value()), i128::min_value()); + + assert_eq!($name::one().saturating_mul_acc_int(u128::max_value() / 2), u128::max_value() - 1); + assert_eq!($name::one().saturating_mul_acc_int(u128::min_value()), u128::min_value()); + + let a = $name::saturating_from_rational(-1, 2); + assert_eq!(a.saturating_mul_acc_int(42i8), 21i8); + assert_eq!(a.saturating_mul_acc_int(u128::max_value() - 1), u128::max_value() - 1); + } + + #[test] + fn saturating_pow_should_work() { + assert_eq!($name::saturating_from_integer(2).saturating_pow(0), $name::saturating_from_integer(1)); + assert_eq!($name::saturating_from_integer(2).saturating_pow(1), $name::saturating_from_integer(2)); + assert_eq!($name::saturating_from_integer(2).saturating_pow(2), $name::saturating_from_integer(4)); + assert_eq!($name::saturating_from_integer(2).saturating_pow(3), $name::saturating_from_integer(8)); + assert_eq!($name::saturating_from_integer(2).saturating_pow(50), + $name::saturating_from_integer(1125899906842624i64)); + + // Saturating. + assert_eq!($name::saturating_from_integer(2).saturating_pow(68), $name::max_value()); + + assert_eq!($name::saturating_from_integer(1).saturating_pow(1000), (1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(1000), (1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(1001), (-1).into()); + assert_eq!($name::saturating_from_integer(1).saturating_pow(usize::max_value()), (1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value()), (-1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value() - 1), (1).into()); + + assert_eq!($name::saturating_from_integer(114209).saturating_pow(5), $name::max_value()); + + assert_eq!($name::saturating_from_integer(1).saturating_pow(usize::max_value()), (1).into()); + assert_eq!($name::saturating_from_integer(0).saturating_pow(usize::max_value()), (0).into()); + assert_eq!($name::saturating_from_integer(2).saturating_pow(usize::max_value()), $name::max_value()); + } + + #[test] + fn checked_div_works() { + let inner_max = <$name as FixedPointNumber>::Inner::max_value(); + let inner_min = <$name as FixedPointNumber>::Inner::min_value(); + + let a = $name::from_inner(inner_max); + let b = $name::from_inner(inner_min); + let c = $name::zero(); + let d = $name::one(); + let e = $name::saturating_from_integer(6); + let f = $name::saturating_from_integer(5); + + assert_eq!(e.checked_div(&2.into()), Some(3.into())); + assert_eq!(f.checked_div(&2.into()), Some((5, 2).into())); + + assert_eq!(a.checked_div(&inner_max.into()), Some(1.into())); + assert_eq!(a.checked_div(&2.into()), Some($name::from_inner(inner_max / 2))); + assert_eq!(a.checked_div(&$name::max_value()), Some(1.into())); + assert_eq!(a.checked_div(&d), Some(a)); + + assert_eq!(a.checked_div(&(-2).into()), Some($name::from_inner(-inner_max / 2))); + assert_eq!(a.checked_div(&-$name::max_value()), Some((-1).into())); + + assert_eq!(b.checked_div(&b), Some($name::one())); + assert_eq!(b.checked_div(&2.into()), Some($name::from_inner(inner_min / 2))); + + assert_eq!(b.checked_div(&(-2).into()), Some($name::from_inner(inner_min / -2))); + assert_eq!(b.checked_div(&a), Some((-1).into())); + + assert_eq!(c.checked_div(&1.into()), Some(0.into())); + assert_eq!(c.checked_div(&$name::max_value()), Some(0.into())); + assert_eq!(c.checked_div(&$name::min_value()), Some(0.into())); + + assert_eq!(d.checked_div(&1.into()), Some(1.into())); + + assert_eq!(a.checked_div(&$name::one()), Some(a)); + assert_eq!(b.checked_div(&$name::one()), Some(b)); + assert_eq!(c.checked_div(&$name::one()), Some(c)); + assert_eq!(d.checked_div(&$name::one()), Some(d)); + + assert_eq!(a.checked_div(&$name::zero()), None); + assert_eq!(b.checked_div(&$name::zero()), None); + assert_eq!(c.checked_div(&$name::zero()), None); + assert_eq!(d.checked_div(&$name::zero()), None); + } + + #[test] + fn trunc_works() { + let n = $name::saturating_from_rational(5, 2).trunc(); + assert_eq!(n, $name::saturating_from_integer(2)); + + let n = $name::saturating_from_rational(-5, 2).trunc(); + assert_eq!(n, $name::saturating_from_integer(-2)); + } + + #[test] + fn frac_works() { + let n = $name::saturating_from_rational(5, 2); + let i = n.trunc(); + let f = n.frac(); + + assert_eq!(n, i + f); + + let n = $name::saturating_from_rational(-5, 2); + let i = n.trunc(); + let f = n.frac(); + + assert_eq!(n, i - f); + + let n = $name::saturating_from_rational(5, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, 5.into()); + + let n = $name::saturating_from_rational(1, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, 5.into()); + + // The sign is attached to the integer part unless it is zero. + let n = $name::saturating_from_rational(-5, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, 5.into()); + + let n = $name::saturating_from_rational(-1, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, (-5).into()); + } + + #[test] + fn ceil_works() { + let n = $name::saturating_from_rational(5, 2); + assert_eq!(n.ceil(), 3.into()); + + let n = $name::saturating_from_rational(-5, 2); + assert_eq!(n.ceil(), (-2).into()); + + // On the limits: + let n = $name::max_value(); + assert_eq!(n.ceil(), n.trunc()); + + let n = $name::min_value(); + assert_eq!(n.ceil(), n.trunc()); + } + + #[test] + fn floor_works() { + let n = $name::saturating_from_rational(5, 2); + assert_eq!(n.floor(), 2.into()); + + let n = $name::saturating_from_rational(-5, 2); + assert_eq!(n.floor(), (-3).into()); + + // On the limits: + let n = $name::max_value(); + assert_eq!(n.floor(), n.trunc()); + + let n = $name::min_value(); + assert_eq!(n.floor(), n.trunc()); + } + + #[test] + fn round_works() { + let n = $name::zero(); + assert_eq!(n.round(), n); + + let n = $name::one(); + assert_eq!(n.round(), n); + + let n = $name::saturating_from_rational(5, 2); + assert_eq!(n.round(), 3.into()); + + let n = $name::saturating_from_rational(-5, 2); + assert_eq!(n.round(), (-3).into()); + + // Saturating: + let n = $name::max_value(); + assert_eq!(n.round(), n.trunc()); + + let n = $name::min_value(); + assert_eq!(n.round(), n.trunc()); + + // On the limit: + + // floor(max - 1) + 0.33.. + let n = $name::max_value() + .saturating_sub(1.into()) + .trunc() + .saturating_add((1, 3).into()); + + assert_eq!(n.round(), ($name::max_value() - 1.into()).trunc()); + + // floor(min + 1) - 0.33.. + let n = $name::min_value() + .saturating_add(1.into()) + .trunc() + .saturating_sub((1, 3).into()); + + assert_eq!(n.round(), ($name::min_value() + 1.into()).trunc()); + + // floor(max - 1) + 0.5 + let n = $name::max_value() + .saturating_sub(1.into()) + .trunc() + .saturating_add((1, 2).into()); + + assert_eq!(n.round(), $name::max_value().trunc()); + + // floor(min + 1) - 0.5 + let n = $name::min_value() + .saturating_add(1.into()) + .trunc() + .saturating_sub((1, 2).into()); + + assert_eq!(n.round(), $name::min_value().trunc()); + } + + #[test] + fn perthing_into_works() { + let ten_percent_percent: $name = Percent::from_percent(10).into(); + assert_eq!(ten_percent_percent.into_inner(), $name::accuracy() / 10); + + let ten_percent_permill: $name = Permill::from_percent(10).into(); + assert_eq!(ten_percent_permill.into_inner(), $name::accuracy() / 10); + + let ten_percent_perbill: $name = Perbill::from_percent(10).into(); + assert_eq!(ten_percent_perbill.into_inner(), $name::accuracy() / 10); + + let ten_percent_perquintill: $name = Perquintill::from_percent(10).into(); + assert_eq!(ten_percent_perquintill.into_inner(), $name::accuracy() / 10); + } + + #[test] + fn fmt_should_work() { + let zero = $name::zero(); + assert_eq!(format!("{:?}", zero), format!("{}(0.{:0>weight$})", stringify!($name), 0, weight=precision())); + + let one = $name::one(); + assert_eq!(format!("{:?}", one), format!("{}(1.{:0>weight$})", stringify!($name), 0, weight=precision())); + + let neg = -$name::one(); + assert_eq!(format!("{:?}", neg), format!("{}(-1.{:0>weight$})", stringify!($name), 0, weight=precision())); + + let frac = $name::saturating_from_rational(1, 2); + assert_eq!(format!("{:?}", frac), format!("{}(0.{:0 Self { - Self(int.saturating_mul(DIV)) - } - - /// Accuracy of `Fixed128`. - pub const fn accuracy() -> i128 { - DIV - } - - /// Raw constructor. Equal to `parts / DIV`. - pub const fn from_parts(parts: i128) -> Self { - Self(parts) - } - - /// Creates self from a rational number. Equal to `n/d`. - /// - /// Note that this might be lossy. Only use this if you are sure that `n * DIV` can fit into an - /// i128. - pub fn from_rational>(n: N, d: NonZeroI128) -> Self { - let n = n.unique_saturated_into(); - Self(n.saturating_mul(DIV.into()) / d.get()) - } - - /// Consume self and return the inner raw `i128` value. - /// - /// Note this is a low level function, as the returned value is represented with accuracy. - pub fn deconstruct(self) -> i128 { - self.0 - } - - /// Takes the reciprocal(inverse) of Fixed128, 1/x - pub fn recip(&self) -> Option { - Self::from_natural(1i128).checked_div(self) - } - - /// Checked add. Same semantic to `num_traits::CheckedAdd`. - pub fn checked_add(&self, rhs: &Self) -> Option { - self.0.checked_add(rhs.0).map(Self) - } - - /// Checked sub. Same semantic to `num_traits::CheckedSub`. - pub fn checked_sub(&self, rhs: &Self) -> Option { - self.0.checked_sub(rhs.0).map(Self) - } - - /// Checked mul. Same semantic to `num_traits::CheckedMul`. - pub fn checked_mul(&self, rhs: &Self) -> Option { - let signum = self.0.signum() * rhs.0.signum(); - let mut lhs = self.0; - if lhs.is_negative() { - lhs = lhs.saturating_mul(-1); - } - let mut rhs: i128 = rhs.0.saturated_into(); - if rhs.is_negative() { - rhs = rhs.saturating_mul(-1); - } - - U256::from(lhs) - .checked_mul(U256::from(rhs)) - .and_then(|n| n.checked_div(U256::from(DIV))) - .and_then(|n| TryInto::::try_into(n).ok()) - .map(|n| Self(n * signum)) - } - - /// Checked div. Same semantic to `num_traits::CheckedDiv`. - pub fn checked_div(&self, rhs: &Self) -> Option { - if rhs.0.signum() == 0 { - return None; - } - if self.0 == 0 { - return Some(*self); - } - - let signum = self.0.signum() / rhs.0.signum(); - let mut lhs: i128 = self.0; - if lhs.is_negative() { - lhs = lhs.saturating_mul(-1); - } - let mut rhs: i128 = rhs.0.saturated_into(); - if rhs.is_negative() { - rhs = rhs.saturating_mul(-1); - } - - U256::from(lhs) - .checked_mul(U256::from(DIV)) - .and_then(|n| n.checked_div(U256::from(rhs))) - .and_then(|n| TryInto::::try_into(n).ok()) - .map(|n| Self(n * signum)) - } - - /// Checked mul for int type `N`. - pub fn checked_mul_int(&self, other: &N) -> Option - where - N: Copy + TryFrom + TryInto, - { - N::try_into(*other).ok().and_then(|rhs| { - let mut lhs = self.0; - if lhs.is_negative() { - lhs = lhs.saturating_mul(-1); - } - let mut rhs: i128 = rhs.saturated_into(); - let signum = self.0.signum() * rhs.signum(); - if rhs.is_negative() { - rhs = rhs.saturating_mul(-1); - } - - U256::from(lhs) - .checked_mul(U256::from(rhs)) - .and_then(|n| n.checked_div(U256::from(DIV))) - .and_then(|n| TryInto::::try_into(n).ok()) - .and_then(|n| TryInto::::try_into(n * signum).ok()) - }) - } - - /// Checked mul for int type `N`. - pub fn saturating_mul_int(&self, other: &N) -> N - where - N: Copy + TryFrom + TryInto + Bounded, - { - self.checked_mul_int(other).unwrap_or_else(|| { - N::try_into(*other) - .map(|n| n.signum()) - .map(|n| n * self.0.signum()) - .map(|signum| { - if signum.is_negative() { - Bounded::min_value() - } else { - Bounded::max_value() - } - }) - .unwrap_or(Bounded::max_value()) - }) - } - - /// Checked div for int type `N`. - pub fn checked_div_int(&self, other: &N) -> Option - where - N: Copy + TryFrom + TryInto, - { - N::try_into(*other) - .ok() - .and_then(|n| self.0.checked_div(n)) - .and_then(|n| n.checked_div(DIV)) - .and_then(|n| TryInto::::try_into(n).ok()) - } - - pub fn zero() -> Self { - Self(0) - } - - pub fn is_zero(&self) -> bool { - self.0 == 0 - } - - /// Saturating absolute value. Returning MAX if `parts` == i128::MIN instead of overflowing. - pub fn saturating_abs(&self) -> Self { - if self.0 == i128::min_value() { - return Fixed128::max_value(); - } - - if self.0.is_negative() { - Fixed128::from_parts(self.0 * -1) - } else { - *self - } - } - - pub fn is_positive(&self) -> bool { - self.0.is_positive() - } - - pub fn is_negative(&self) -> bool { - self.0.is_negative() - } - - /// Performs a saturated multiply and accumulate by unsigned number. - /// - /// Returns a saturated `int + (self * int)`. - pub fn saturated_multiply_accumulate(self, int: N) -> N - where - N: TryFrom + From + UniqueSaturatedInto + Bounded + Clone + Saturating + - ops::Rem + ops::Div + ops::Mul + - ops::Add, - { - let div = DIV as u128; - let positive = self.0 > 0; - // safe to convert as absolute value. - let parts = self.0.checked_abs().map(|v| v as u128).unwrap_or(i128::max_value() as u128 + 1); - - - // will always fit. - let natural_parts = parts / div; - // might saturate. - let natural_parts: N = natural_parts.saturated_into(); - // fractional parts can always fit into u64. - let perquintill_parts = (parts % div) as u64; - - let n = int.clone().saturating_mul(natural_parts); - let p = Perquintill::from_parts(perquintill_parts) * int.clone(); - - // everything that needs to be either added or subtracted from the original weight. - let excess = n.saturating_add(p); - - if positive { - int.saturating_add(excess) - } else { - int.saturating_sub(excess) - } - } -} - -/// Note that this is a standard, _potentially-panicking_, implementation. Use `Saturating` trait -/// for safe addition. -impl ops::Add for Fixed128 { - type Output = Self; - - fn add(self, rhs: Self) -> Self::Output { - Self(self.0 + rhs.0) - } -} - -/// Note that this is a standard, _potentially-panicking_, implementation. Use `Saturating` trait -/// for safe subtraction. -impl ops::Sub for Fixed128 { - type Output = Self; - - fn sub(self, rhs: Self) -> Self::Output { - Self(self.0 - rhs.0) - } -} - -impl Saturating for Fixed128 { - fn saturating_add(self, rhs: Self) -> Self { - Self(self.0.saturating_add(rhs.0)) - } - - fn saturating_sub(self, rhs: Self) -> Self { - Self(self.0.saturating_sub(rhs.0)) - } - - fn saturating_mul(self, rhs: Self) -> Self { - self.checked_mul(&rhs).unwrap_or_else(|| { - if (self.0.signum() * rhs.0.signum()).is_negative() { - Bounded::min_value() - } else { - Bounded::max_value() - } - }) - } - - fn saturating_pow(self, exp: usize) -> Self { - if exp == 0 { - return Self::from_natural(1); - } - - let exp = exp as u64; - let msb_pos = 64 - exp.leading_zeros(); - - let mut result = Self::from_natural(1); - let mut pow_val = self; - for i in 0..msb_pos { - if ((1 << i) & exp) > 0 { - result = result.saturating_mul(pow_val); - } - pow_val = pow_val.saturating_mul(pow_val); - } - result - } -} - -impl Bounded for Fixed128 { - fn min_value() -> Self { - Self(Bounded::min_value()) - } - - fn max_value() -> Self { - Self(Bounded::max_value()) - } -} - -impl fmt::Debug for Fixed128 { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let integral = { - let int = self.0 / DIV; - let signum_for_zero = if int == 0 && self.is_negative() { "-" } else { "" }; - format!("{}{}", signum_for_zero, int) - }; - let fractional = format!("{:0>18}", (self.0 % DIV).abs()); - write!(f, "Fixed128({}.{})", integral, fractional) - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { - Ok(()) - } -} - -impl From

for Fixed128 { - fn from(val: P) -> Self { - let accuracy = P::ACCURACY.saturated_into().max(1) as i128; - let value = val.deconstruct().saturated_into() as i128; - Fixed128::from_rational(value, NonZeroI128::new(accuracy).unwrap()) - } -} - -#[cfg(feature = "std")] -impl Fixed128 { - fn i128_str(&self) -> String { - format!("{}", &self.0) - } - - fn try_from_i128_str(s: &str) -> Result { - let parts: i128 = s.parse().map_err(|_| "invalid string input")?; - Ok(Self::from_parts(parts)) - } -} - -// Manual impl `Serialize` as serde_json does not support i128. -// TODO: remove impl if issue https://github.com/serde-rs/json/issues/548 fixed. -#[cfg(feature = "std")] -impl Serialize for Fixed128 { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(&self.i128_str()) - } -} - -// Manual impl `Serialize` as serde_json does not support i128. -// TODO: remove impl if issue https://github.com/serde-rs/json/issues/548 fixed. -#[cfg(feature = "std")] -impl<'de> Deserialize<'de> for Fixed128 { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - Fixed128::try_from_i128_str(&s).map_err(|err_str| de::Error::custom(err_str)) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::{Perbill, Percent, Permill, Perquintill}; - - fn max() -> Fixed128 { - Fixed128::max_value() - } - - fn min() -> Fixed128 { - Fixed128::min_value() - } - - #[test] - fn fixed128_semantics() { - let a = Fixed128::from_rational(5, NonZeroI128::new(2).unwrap()); - let b = Fixed128::from_rational(10, NonZeroI128::new(4).unwrap()); - assert_eq!(a.0, 5 * DIV / 2); - assert_eq!(a, b); - - let a = Fixed128::from_rational(-5, NonZeroI128::new(1).unwrap()); - assert_eq!(a, Fixed128::from_natural(-5)); - - let a = Fixed128::from_rational(5, NonZeroI128::new(-1).unwrap()); - assert_eq!(a, Fixed128::from_natural(-5)); - - // biggest value that can be created. - assert_ne!(max(), Fixed128::from_natural(170_141_183_460_469_231_731)); - assert_eq!(max(), Fixed128::from_natural(170_141_183_460_469_231_732)); - - // the smallest value that can be created. - assert_ne!(min(), Fixed128::from_natural(-170_141_183_460_469_231_731)); - assert_eq!(min(), Fixed128::from_natural(-170_141_183_460_469_231_732)); - } - - #[test] - fn fixed128_operation() { - let a = Fixed128::from_natural(2); - let b = Fixed128::from_natural(1); - assert_eq!(a.checked_add(&b), Some(Fixed128::from_natural(1 + 2))); - assert_eq!(a.checked_sub(&b), Some(Fixed128::from_natural(2 - 1))); - assert_eq!(a.checked_mul(&b), Some(Fixed128::from_natural(1 * 2))); - assert_eq!( - a.checked_div(&b), - Some(Fixed128::from_rational(2, NonZeroI128::new(1).unwrap())) - ); - - let a = Fixed128::from_rational(5, NonZeroI128::new(2).unwrap()); - let b = Fixed128::from_rational(3, NonZeroI128::new(2).unwrap()); - assert_eq!( - a.checked_add(&b), - Some(Fixed128::from_rational(8, NonZeroI128::new(2).unwrap())) - ); - assert_eq!( - a.checked_sub(&b), - Some(Fixed128::from_rational(2, NonZeroI128::new(2).unwrap())) - ); - assert_eq!( - a.checked_mul(&b), - Some(Fixed128::from_rational(15, NonZeroI128::new(4).unwrap())) - ); - assert_eq!( - a.checked_div(&b), - Some(Fixed128::from_rational(10, NonZeroI128::new(6).unwrap())) - ); - - let a = Fixed128::from_natural(120); - assert_eq!(a.checked_div_int(&2i32), Some(60)); - - let a = Fixed128::from_rational(20, NonZeroI128::new(1).unwrap()); - assert_eq!(a.checked_div_int(&2i32), Some(10)); - - let a = Fixed128::from_natural(120); - assert_eq!(a.checked_mul_int(&2i32), Some(240)); - - let a = Fixed128::from_rational(1, NonZeroI128::new(2).unwrap()); - assert_eq!(a.checked_mul_int(&20i32), Some(10)); - - let a = Fixed128::from_rational(-1, NonZeroI128::new(2).unwrap()); - assert_eq!(a.checked_mul_int(&20i32), Some(-10)); - } - - #[test] - fn saturating_mul_should_work() { - let a = Fixed128::from_natural(-1); - assert_eq!(min().saturating_mul(a), max()); - - assert_eq!(Fixed128::from_natural(125).saturating_mul(a).deconstruct(), -125 * DIV); - - let a = Fixed128::from_rational(1, NonZeroI128::new(5).unwrap()); - assert_eq!(Fixed128::from_natural(125).saturating_mul(a).deconstruct(), 25 * DIV); - } - - #[test] - fn saturating_mul_int_works() { - let a = Fixed128::from_rational(10, NonZeroI128::new(1).unwrap()); - assert_eq!(a.saturating_mul_int(&i32::max_value()), i32::max_value()); - - let a = Fixed128::from_rational(-10, NonZeroI128::new(1).unwrap()); - assert_eq!(a.saturating_mul_int(&i32::max_value()), i32::min_value()); - - let a = Fixed128::from_rational(3, NonZeroI128::new(1).unwrap()); - assert_eq!(a.saturating_mul_int(&100i8), i8::max_value()); - - let a = Fixed128::from_rational(10, NonZeroI128::new(1).unwrap()); - assert_eq!(a.saturating_mul_int(&123i128), 1230); - - let a = Fixed128::from_rational(-10, NonZeroI128::new(1).unwrap()); - assert_eq!(a.saturating_mul_int(&123i128), -1230); - - assert_eq!(max().saturating_mul_int(&2i128), 340_282_366_920_938_463_463); - - assert_eq!(max().saturating_mul_int(&i128::min_value()), i128::min_value()); - - assert_eq!(min().saturating_mul_int(&i128::max_value()), i128::min_value()); - - assert_eq!(min().saturating_mul_int(&i128::min_value()), i128::max_value()); - } - - #[test] - fn zero_works() { - assert_eq!(Fixed128::zero(), Fixed128::from_natural(0)); - } - - #[test] - fn is_zero_works() { - assert!(Fixed128::zero().is_zero()); - assert!(!Fixed128::from_natural(1).is_zero()); - } - - #[test] - fn checked_div_with_zero_should_be_none() { - let a = Fixed128::from_natural(1); - let b = Fixed128::from_natural(0); - assert_eq!(a.checked_div(&b), None); - assert_eq!(b.checked_div(&a), Some(b)); - } - - #[test] - fn checked_div_int_with_zero_should_be_none() { - let a = Fixed128::from_natural(1); - assert_eq!(a.checked_div_int(&0i32), None); - let a = Fixed128::from_natural(0); - assert_eq!(a.checked_div_int(&1i32), Some(0)); - } - - #[test] - fn checked_div_with_zero_dividend_should_be_zero() { - let a = Fixed128::zero(); - let b = Fixed128::from_parts(1); - - assert_eq!(a.checked_div(&b), Some(Fixed128::zero())); - } - - #[test] - fn under_flow_should_be_none() { - let b = Fixed128::from_natural(1); - assert_eq!(min().checked_sub(&b), None); - } - - #[test] - fn over_flow_should_be_none() { - let a = Fixed128::from_parts(i128::max_value() - 1); - let b = Fixed128::from_parts(2); - assert_eq!(a.checked_add(&b), None); - - let a = Fixed128::max_value(); - let b = Fixed128::from_rational(2, NonZeroI128::new(1).unwrap()); - assert_eq!(a.checked_mul(&b), None); - - let a = Fixed128::from_natural(255); - let b = 2u8; - assert_eq!(a.checked_mul_int(&b), None); - - let a = Fixed128::from_natural(256); - let b = 1u8; - assert_eq!(a.checked_div_int(&b), None); - - let a = Fixed128::from_natural(256); - let b = -1i8; - assert_eq!(a.checked_div_int(&b), None); - } - - #[test] - fn checked_div_int_should_work() { - // 256 / 10 = 25 (25.6 as int = 25) - let a = Fixed128::from_natural(256); - let result = a.checked_div_int(&10i128).unwrap(); - assert_eq!(result, 25); - - // 256 / 100 = 2 (2.56 as int = 2) - let a = Fixed128::from_natural(256); - let result = a.checked_div_int(&100i128).unwrap(); - assert_eq!(result, 2); - - // 256 / 1000 = 0 (0.256 as int = 0) - let a = Fixed128::from_natural(256); - let result = a.checked_div_int(&1000i128).unwrap(); - assert_eq!(result, 0); - - // 256 / -1 = -256 - let a = Fixed128::from_natural(256); - let result = a.checked_div_int(&-1i128).unwrap(); - assert_eq!(result, -256); - - // -256 / -1 = 256 - let a = Fixed128::from_natural(-256); - let result = a.checked_div_int(&-1i128).unwrap(); - assert_eq!(result, 256); - - // 10 / -5 = -2 - let a = Fixed128::from_rational(20, NonZeroI128::new(2).unwrap()); - let result = a.checked_div_int(&-5i128).unwrap(); - assert_eq!(result, -2); - - // -170_141_183_460_469_231_731 / -2 = 85_070_591_730_234_615_865 - let result = min().checked_div_int(&-2i128).unwrap(); - assert_eq!(result, 85_070_591_730_234_615_865); - - // 85_070_591_730_234_615_865 * -2 = -170_141_183_460_469_231_730 - let result = Fixed128::from_natural(result).checked_mul_int(&-2i128).unwrap(); - assert_eq!(result, -170_141_183_460_469_231_730); - } - - #[test] - fn perthing_into_fixed_i128() { - let ten_percent_percent: Fixed128 = Percent::from_percent(10).into(); - assert_eq!(ten_percent_percent.deconstruct(), DIV / 10); - - let ten_percent_permill: Fixed128 = Permill::from_percent(10).into(); - assert_eq!(ten_percent_permill.deconstruct(), DIV / 10); - - let ten_percent_perbill: Fixed128 = Perbill::from_percent(10).into(); - assert_eq!(ten_percent_perbill.deconstruct(), DIV / 10); - - let ten_percent_perquintill: Fixed128 = Perquintill::from_percent(10).into(); - assert_eq!(ten_percent_perquintill.deconstruct(), DIV / 10); - } - - #[test] - fn recip_should_work() { - let a = Fixed128::from_natural(2); - assert_eq!( - a.recip(), - Some(Fixed128::from_rational(1, NonZeroI128::new(2).unwrap())) - ); - - let a = Fixed128::from_natural(2); - assert_eq!(a.recip().unwrap().checked_mul_int(&4i32), Some(2i32)); - - let a = Fixed128::from_rational(100, NonZeroI128::new(121).unwrap()); - assert_eq!( - a.recip(), - Some(Fixed128::from_rational(121, NonZeroI128::new(100).unwrap())) - ); - - let a = Fixed128::from_rational(1, NonZeroI128::new(2).unwrap()); - assert_eq!(a.recip().unwrap().checked_mul(&a), Some(Fixed128::from_natural(1))); - - let a = Fixed128::from_natural(0); - assert_eq!(a.recip(), None); - - let a = Fixed128::from_rational(-1, NonZeroI128::new(2).unwrap()); - assert_eq!(a.recip(), Some(Fixed128::from_natural(-2))); - } - - #[test] - fn serialize_deserialize_should_work() { - let two_point_five = Fixed128::from_rational(5, NonZeroI128::new(2).unwrap()); - let serialized = serde_json::to_string(&two_point_five).unwrap(); - assert_eq!(serialized, "\"2500000000000000000\""); - let deserialized: Fixed128 = serde_json::from_str(&serialized).unwrap(); - assert_eq!(deserialized, two_point_five); - - let minus_two_point_five = Fixed128::from_rational(-5, NonZeroI128::new(2).unwrap()); - let serialized = serde_json::to_string(&minus_two_point_five).unwrap(); - assert_eq!(serialized, "\"-2500000000000000000\""); - let deserialized: Fixed128 = serde_json::from_str(&serialized).unwrap(); - assert_eq!(deserialized, minus_two_point_five); - } - - #[test] - fn saturating_abs_should_work() { - // normal - assert_eq!(Fixed128::from_parts(1).saturating_abs(), Fixed128::from_parts(1)); - assert_eq!(Fixed128::from_parts(-1).saturating_abs(), Fixed128::from_parts(1)); - - // saturating - assert_eq!(Fixed128::min_value().saturating_abs(), Fixed128::max_value()); - } - - #[test] - fn is_positive_negative_should_work() { - let positive = Fixed128::from_parts(1); - assert!(positive.is_positive()); - assert!(!positive.is_negative()); - - let negative = Fixed128::from_parts(-1); - assert!(!negative.is_positive()); - assert!(negative.is_negative()); - - let zero = Fixed128::zero(); - assert!(!zero.is_positive()); - assert!(!zero.is_negative()); - } - - #[test] - fn fmt_should_work() { - let positive = Fixed128::from_parts(1000000000000000001); - assert_eq!(format!("{:?}", positive), "Fixed128(1.000000000000000001)"); - let negative = Fixed128::from_parts(-1000000000000000001); - assert_eq!(format!("{:?}", negative), "Fixed128(-1.000000000000000001)"); - - let positive_fractional = Fixed128::from_parts(1); - assert_eq!(format!("{:?}", positive_fractional), "Fixed128(0.000000000000000001)"); - let negative_fractional = Fixed128::from_parts(-1); - assert_eq!(format!("{:?}", negative_fractional), "Fixed128(-0.000000000000000001)"); - - let zero = Fixed128::zero(); - assert_eq!(format!("{:?}", zero), "Fixed128(0.000000000000000000)"); - } - - #[test] - fn saturating_pow_should_work() { - assert_eq!(Fixed128::from_natural(2).saturating_pow(0), Fixed128::from_natural(1)); - assert_eq!(Fixed128::from_natural(2).saturating_pow(1), Fixed128::from_natural(2)); - assert_eq!(Fixed128::from_natural(2).saturating_pow(2), Fixed128::from_natural(4)); - assert_eq!(Fixed128::from_natural(2).saturating_pow(3), Fixed128::from_natural(8)); - assert_eq!(Fixed128::from_natural(2).saturating_pow(50), Fixed128::from_natural(1125899906842624)); - - assert_eq!(Fixed128::from_natural(1).saturating_pow(1000), Fixed128::from_natural(1)); - assert_eq!(Fixed128::from_natural(-1).saturating_pow(1000), Fixed128::from_natural(1)); - assert_eq!(Fixed128::from_natural(-1).saturating_pow(1001), Fixed128::from_natural(-1)); - assert_eq!(Fixed128::from_natural(1).saturating_pow(usize::max_value()), Fixed128::from_natural(1)); - assert_eq!(Fixed128::from_natural(-1).saturating_pow(usize::max_value()), Fixed128::from_natural(-1)); - assert_eq!(Fixed128::from_natural(-1).saturating_pow(usize::max_value() - 1), Fixed128::from_natural(1)); - - assert_eq!(Fixed128::from_natural(114209).saturating_pow(4), Fixed128::from_natural(170137997018538053761)); - assert_eq!(Fixed128::from_natural(114209).saturating_pow(5), Fixed128::max_value()); - - assert_eq!(Fixed128::from_natural(1).saturating_pow(usize::max_value()), Fixed128::from_natural(1)); - assert_eq!(Fixed128::from_natural(0).saturating_pow(usize::max_value()), Fixed128::from_natural(0)); - assert_eq!(Fixed128::from_natural(2).saturating_pow(usize::max_value()), Fixed128::max_value()); - } -} diff --git a/primitives/arithmetic/src/fixed64.rs b/primitives/arithmetic/src/fixed64.rs deleted file mode 100644 index 14baad543c..0000000000 --- a/primitives/arithmetic/src/fixed64.rs +++ /dev/null @@ -1,382 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use sp_std::{ - ops, prelude::*, - convert::{TryFrom, TryInto}, -}; -use codec::{Encode, Decode}; -use crate::{ - Perbill, - traits::{ - SaturatedConversion, CheckedSub, CheckedAdd, CheckedDiv, Bounded, UniqueSaturatedInto, Saturating - } -}; - -/// An unsigned fixed point number. Can hold any value in the range [-9_223_372_036, 9_223_372_036] -/// with fixed point accuracy of one billion. -#[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -pub struct Fixed64(i64); - -/// The accuracy of the `Fixed64` type. -const DIV: i64 = 1_000_000_000; - -impl Fixed64 { - /// creates self from a natural number. - /// - /// Note that this might be lossy. - pub fn from_natural(int: i64) -> Self { - Self(int.saturating_mul(DIV)) - } - - /// Return the accuracy of the type. Given that this function returns the value `X`, it means - /// that an instance composed of `X` parts (`Fixed64::from_parts(X)`) is equal to `1`. - pub fn accuracy() -> i64 { - DIV - } - - /// Consume self and return the inner value. - pub fn into_inner(self) -> i64 { self.0 } - - /// Raw constructor. Equal to `parts / 1_000_000_000`. - pub fn from_parts(parts: i64) -> Self { - Self(parts) - } - - /// creates self from a rational number. Equal to `n/d`. - /// - /// Note that this might be lossy. - pub fn from_rational(n: i64, d: u64) -> Self { - Self( - (i128::from(n).saturating_mul(i128::from(DIV)) / i128::from(d).max(1)) - .try_into() - .unwrap_or_else(|_| Bounded::max_value()) - ) - } - - /// Performs a saturated multiply and accumulate by unsigned number. - /// - /// Returns a saturated `int + (self * int)`. - pub fn saturated_multiply_accumulate(self, int: N) -> N - where - N: TryFrom + From + UniqueSaturatedInto + Bounded + Clone + Saturating + - ops::Rem + ops::Div + ops::Mul + - ops::Add, - { - let div = DIV as u64; - let positive = self.0 > 0; - // safe to convert as absolute value. - let parts = self.0.checked_abs().map(|v| v as u64).unwrap_or(i64::max_value() as u64 + 1); - - - // will always fit. - let natural_parts = parts / div; - // might saturate. - let natural_parts: N = natural_parts.saturated_into(); - // fractional parts can always fit into u32. - let perbill_parts = (parts % div) as u32; - - let n = int.clone().saturating_mul(natural_parts); - let p = Perbill::from_parts(perbill_parts) * int.clone(); - - // everything that needs to be either added or subtracted from the original weight. - let excess = n.saturating_add(p); - - if positive { - int.saturating_add(excess) - } else { - int.saturating_sub(excess) - } - } - - pub fn is_negative(&self) -> bool { - self.0.is_negative() - } -} - -impl Saturating for Fixed64 { - fn saturating_add(self, rhs: Self) -> Self { - Self(self.0.saturating_add(rhs.0)) - } - - fn saturating_mul(self, rhs: Self) -> Self { - let a = self.0 as i128; - let b = rhs.0 as i128; - let res = a * b / DIV as i128; - Self(res.saturated_into()) - } - - fn saturating_sub(self, rhs: Self) -> Self { - Self(self.0.saturating_sub(rhs.0)) - } - - fn saturating_pow(self, exp: usize) -> Self { - if exp == 0 { - return Self::from_natural(1); - } - - let exp = exp as u64; - let msb_pos = 64 - exp.leading_zeros(); - - let mut result = Self::from_natural(1); - let mut pow_val = self; - for i in 0..msb_pos { - if ((1 << i) & exp) > 0 { - result = result.saturating_mul(pow_val); - } - pow_val = pow_val.saturating_mul(pow_val); - } - result - } -} - -/// Use `Saturating` trait for safe addition. -impl ops::Add for Fixed64 { - type Output = Self; - - fn add(self, rhs: Self) -> Self::Output { - Self(self.0 + rhs.0) - } -} - -/// Use `Saturating` trait for safe subtraction. -impl ops::Sub for Fixed64 { - type Output = Self; - - fn sub(self, rhs: Self) -> Self::Output { - Self(self.0 - rhs.0) - } -} - -/// Use `CheckedDiv` trait for safe division. -impl ops::Div for Fixed64 { - type Output = Self; - - fn div(self, rhs: Self) -> Self::Output { - if rhs.0 == 0 { - panic!("attempt to divide by zero"); - } - let (n, d) = if rhs.0 < 0 { - (-self.0, rhs.0.abs() as u64) - } else { - (self.0, rhs.0 as u64) - }; - Fixed64::from_rational(n, d) - } -} - -impl CheckedSub for Fixed64 { - fn checked_sub(&self, rhs: &Self) -> Option { - self.0.checked_sub(rhs.0).map(Self) - } -} - -impl CheckedAdd for Fixed64 { - fn checked_add(&self, rhs: &Self) -> Option { - self.0.checked_add(rhs.0).map(Self) - } -} - -impl CheckedDiv for Fixed64 { - fn checked_div(&self, rhs: &Self) -> Option { - if rhs.0 == 0 { - None - } else { - Some(*self / *rhs) - } - } -} - -impl sp_std::fmt::Debug for Fixed64 { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - let integral = { - let int = self.0 / DIV; - let signum_for_zero = if int == 0 && self.is_negative() { "-" } else { "" }; - format!("{}{}", signum_for_zero, int) - }; - let fractional = format!("{:0>9}", (self.0 % DIV).abs()); - write!(f, "Fixed64({}.{})", integral, fractional) - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn max() -> Fixed64 { - Fixed64::from_parts(i64::max_value()) - } - - #[test] - fn fixed64_semantics() { - assert_eq!(Fixed64::from_rational(5, 2).0, 5 * 1_000_000_000 / 2); - assert_eq!(Fixed64::from_rational(5, 2), Fixed64::from_rational(10, 4)); - assert_eq!(Fixed64::from_rational(5, 0), Fixed64::from_rational(5, 1)); - - // biggest value that can be created. - assert_ne!(max(), Fixed64::from_natural(9_223_372_036)); - assert_eq!(max(), Fixed64::from_natural(9_223_372_037)); - } - - #[test] - fn fixed_64_growth_decrease_curve() { - let test_set = vec![0u32, 1, 10, 1000, 1_000_000_000]; - - // negative (1/2) - let mut fm = Fixed64::from_rational(-1, 2); - test_set.clone().into_iter().for_each(|i| { - assert_eq!(fm.saturated_multiply_accumulate(i) as i32, i as i32 - i as i32 / 2); - }); - - // unit (1) multiplier - fm = Fixed64::from_parts(0); - test_set.clone().into_iter().for_each(|i| { - assert_eq!(fm.saturated_multiply_accumulate(i), i); - }); - - // i.5 multiplier - fm = Fixed64::from_rational(1, 2); - test_set.clone().into_iter().for_each(|i| { - assert_eq!(fm.saturated_multiply_accumulate(i), i * 3 / 2); - }); - - // dual multiplier - fm = Fixed64::from_rational(1, 1); - test_set.clone().into_iter().for_each(|i| { - assert_eq!(fm.saturated_multiply_accumulate(i), i * 2); - }); - } - - macro_rules! saturating_mul_acc_test { - ($num_type:tt) => { - assert_eq!( - Fixed64::from_rational(100, 1).saturated_multiply_accumulate(10 as $num_type), - 1010, - ); - assert_eq!( - Fixed64::from_rational(100, 2).saturated_multiply_accumulate(10 as $num_type), - 510, - ); - assert_eq!( - Fixed64::from_rational(100, 3).saturated_multiply_accumulate(0 as $num_type), - 0, - ); - assert_eq!( - Fixed64::from_rational(5, 1).saturated_multiply_accumulate($num_type::max_value()), - $num_type::max_value() - ); - assert_eq!( - max().saturated_multiply_accumulate($num_type::max_value()), - $num_type::max_value() - ); - } - } - - #[test] - fn fixed64_multiply_accumulate_works() { - saturating_mul_acc_test!(u32); - saturating_mul_acc_test!(u64); - saturating_mul_acc_test!(u128); - } - - #[test] - fn div_works() { - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_rational(10, 1); - assert_eq!(a / b, Fixed64::from_rational(12, 100)); - - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_rational(1, 100); - assert_eq!(a / b, Fixed64::from_rational(120, 1)); - - let a = Fixed64::from_rational(12, 100); - let b = Fixed64::from_rational(10, 1); - assert_eq!(a / b, Fixed64::from_rational(12, 1000)); - - let a = Fixed64::from_rational(12, 100); - let b = Fixed64::from_rational(1, 100); - assert_eq!(a / b, Fixed64::from_rational(12, 1)); - - let a = Fixed64::from_rational(-12, 10); - let b = Fixed64::from_rational(10, 1); - assert_eq!(a / b, Fixed64::from_rational(-12, 100)); - - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_rational(-10, 1); - assert_eq!(a / b, Fixed64::from_rational(-12, 100)); - - let a = Fixed64::from_rational(-12, 10); - let b = Fixed64::from_rational(-10, 1); - assert_eq!(a / b, Fixed64::from_rational(12, 100)); - } - - #[test] - #[should_panic(expected = "attempt to divide by zero")] - fn div_zero() { - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_natural(0); - let _ = a / b; - } - - #[test] - fn checked_div_zero() { - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_natural(0); - assert_eq!(a.checked_div(&b), None); - } - - #[test] - fn checked_div_non_zero() { - let a = Fixed64::from_rational(12, 10); - let b = Fixed64::from_rational(1, 100); - assert_eq!(a.checked_div(&b), Some(Fixed64::from_rational(120, 1))); - } - - #[test] - fn saturating_mul_should_work() { - assert_eq!(Fixed64::from_natural(100).saturating_mul(Fixed64::from_natural(100)), Fixed64::from_natural(10000)); - } - - #[test] - fn saturating_pow_should_work() { - assert_eq!(Fixed64::from_natural(2).saturating_pow(0), Fixed64::from_natural(1)); - assert_eq!(Fixed64::from_natural(2).saturating_pow(1), Fixed64::from_natural(2)); - assert_eq!(Fixed64::from_natural(2).saturating_pow(2), Fixed64::from_natural(4)); - assert_eq!(Fixed64::from_natural(2).saturating_pow(3), Fixed64::from_natural(8)); - assert_eq!(Fixed64::from_natural(2).saturating_pow(20), Fixed64::from_natural(1048576)); - - assert_eq!(Fixed64::from_natural(1).saturating_pow(1000), Fixed64::from_natural(1)); - assert_eq!(Fixed64::from_natural(-1).saturating_pow(1000), Fixed64::from_natural(1)); - assert_eq!(Fixed64::from_natural(-1).saturating_pow(1001), Fixed64::from_natural(-1)); - assert_eq!(Fixed64::from_natural(1).saturating_pow(usize::max_value()), Fixed64::from_natural(1)); - assert_eq!(Fixed64::from_natural(-1).saturating_pow(usize::max_value()), Fixed64::from_natural(-1)); - assert_eq!(Fixed64::from_natural(-1).saturating_pow(usize::max_value() - 1), Fixed64::from_natural(1)); - - assert_eq!(Fixed64::from_natural(309).saturating_pow(4), Fixed64::from_natural(9_116_621_361)); - assert_eq!(Fixed64::from_natural(309).saturating_pow(5), Fixed64::from_parts(i64::max_value())); - - assert_eq!(Fixed64::from_natural(1).saturating_pow(usize::max_value()), Fixed64::from_natural(1)); - assert_eq!(Fixed64::from_natural(0).saturating_pow(usize::max_value()), Fixed64::from_natural(0)); - assert_eq!(Fixed64::from_natural(2).saturating_pow(usize::max_value()), Fixed64::from_parts(i64::max_value())); - } -} diff --git a/primitives/arithmetic/src/lib.rs b/primitives/arithmetic/src/lib.rs index e5e7139d7b..0ac58b12fe 100644 --- a/primitives/arithmetic/src/lib.rs +++ b/primitives/arithmetic/src/lib.rs @@ -37,12 +37,10 @@ pub mod biguint; pub mod helpers_128bit; pub mod traits; mod per_things; -mod fixed64; -mod fixed128; +mod fixed; mod rational128; -pub use fixed64::Fixed64; -pub use fixed128::Fixed128; +pub use fixed::{FixedPointNumber, Fixed64, Fixed128}; pub use per_things::{PerThing, Percent, PerU16, Permill, Perbill, Perquintill}; pub use rational128::Rational128; diff --git a/primitives/arithmetic/src/traits.rs b/primitives/arithmetic/src/traits.rs index d8d789577e..7985f09a20 100644 --- a/primitives/arithmetic/src/traits.rs +++ b/primitives/arithmetic/src/traits.rs @@ -21,8 +21,8 @@ use sp_std::{self, convert::{TryFrom, TryInto}}; use codec::HasCompact; pub use integer_sqrt::IntegerSquareRoot; pub use num_traits::{ - Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, - CheckedShl, CheckedShr, checked_pow + Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, CheckedNeg, + CheckedShl, CheckedShr, checked_pow, Signed }; use sp_std::ops::{ Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index e2a489515f..79b9142459 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -72,7 +72,7 @@ pub use sp_core::RuntimeDebug; /// Re-export top-level arithmetic stuff. pub use sp_arithmetic::{ Perquintill, Perbill, Permill, Percent, PerU16, Rational128, Fixed64, Fixed128, - PerThing, traits::SaturatedConversion, + PerThing, traits::SaturatedConversion, FixedPointNumber, }; /// Re-export 128 bit helpers. pub use sp_arithmetic::helpers_128bit; -- GitLab From ddf219143ccceb6b91efe8d5e2f0d73f318f0675 Mon Sep 17 00:00:00 2001 From: clearloop Date: Fri, 22 May 2020 07:38:31 +0800 Subject: [PATCH 042/280] chore(client): remove the unnecessary clap dep (#6107) --- Cargo.lock | 1 - client/cli/Cargo.toml | 1 - client/cli/src/error.rs | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef0584f4ce..23229c365c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5954,7 +5954,6 @@ dependencies = [ "app_dirs", "atty", "chrono", - "clap", "derive_more", "env_logger 0.7.1", "fdlimit", diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 1dc5f1a39f..406bb1becc 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -12,7 +12,6 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = "2.33.0" derive_more = "0.99.2" env_logger = "0.7.0" log = "0.4.8" diff --git a/client/cli/src/error.rs b/client/cli/src/error.rs index 23c2bf05f0..31f6e1c1ff 100644 --- a/client/cli/src/error.rs +++ b/client/cli/src/error.rs @@ -27,7 +27,7 @@ pub enum Error { /// Io error Io(std::io::Error), /// Cli error - Cli(clap::Error), + Cli(structopt::clap::Error), /// Service error Service(sc_service::Error), /// Client error -- GitLab From 6c2fdea1f321b44cda8531d5db19da50afa546f9 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Fri, 22 May 2020 19:04:20 +1200 Subject: [PATCH 043/280] make calls public (#6109) --- bin/node/runtime/src/lib.rs | 2 +- frame/membership/src/lib.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 69c8e98316..6a02ad66cd 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 250, - impl_version: 1, + impl_version: 2, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 29c42f990c..669964c70c 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -119,7 +119,7 @@ decl_module! { /// /// May only be called from `AddOrigin` or root. #[weight = 50_000_000] - fn add_member(origin, who: T::AccountId) { + pub fn add_member(origin, who: T::AccountId) { T::AddOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; @@ -138,7 +138,7 @@ decl_module! { /// /// May only be called from `RemoveOrigin` or root. #[weight = 50_000_000] - fn remove_member(origin, who: T::AccountId) { + pub fn remove_member(origin, who: T::AccountId) { T::RemoveOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; @@ -160,7 +160,7 @@ decl_module! { /// /// Prime membership is *not* passed from `remove` to `add`, if extant. #[weight = 50_000_000] - fn swap_member(origin, remove: T::AccountId, add: T::AccountId) { + pub fn swap_member(origin, remove: T::AccountId, add: T::AccountId) { T::SwapOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; @@ -189,7 +189,7 @@ decl_module! { /// /// May only be called from `ResetOrigin` or root. #[weight = 50_000_000] - fn reset_members(origin, members: Vec) { + pub fn reset_members(origin, members: Vec) { T::ResetOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; @@ -212,7 +212,7 @@ decl_module! { /// /// Prime membership is passed from the origin account to `new`, if extant. #[weight = 50_000_000] - fn change_key(origin, new: T::AccountId) { + pub fn change_key(origin, new: T::AccountId) { let remove = ensure_signed(origin)?; if remove != new { @@ -240,7 +240,7 @@ decl_module! { /// Set the prime member. Must be a current member. #[weight = 50_000_000] - fn set_prime(origin, who: T::AccountId) { + pub fn set_prime(origin, who: T::AccountId) { T::PrimeOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; @@ -251,7 +251,7 @@ decl_module! { /// Remove the prime member if it exists. #[weight = 50_000_000] - fn clear_prime(origin) { + pub fn clear_prime(origin) { T::PrimeOrigin::try_origin(origin) .map(|_| ()) .or_else(ensure_root)?; -- GitLab From f822521adb0dce4025c3f89082a231f912ef43d0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 22 May 2020 12:43:55 +0200 Subject: [PATCH 044/280] Add a note about the deprecation of register_notifications_protocol (#6111) --- client/network/src/service.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 4a52bfebdd..d9de0d05c4 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -559,13 +559,17 @@ impl NetworkService { /// Registers a new notifications protocol. /// - /// After that, you can call `write_notifications`. + /// After a protocol has been registered, you can call `write_notifications`. + /// + /// **Important**: This method is a work-around, and you are instead strongly encouraged to + /// pass the protocol in the `NetworkConfiguration::notifications_protocols` list instead. + /// If you have no other choice but to use this method, you are very strongly encouraged to + /// call it very early on. Any connection open will retain the protocols that were registered + /// then, and not any new one. /// /// Please call `event_stream` before registering a protocol, otherwise you may miss events /// about the protocol that you have registered. - /// - /// You are very strongly encouraged to call this method very early on. Any connection open - /// will retain the protocols that were registered then, and not any new one. + // TODO: remove this method after https://github.com/paritytech/substrate/issues/4587 pub fn register_notifications_protocol( &self, engine_id: ConsensusEngineId, -- GitLab From 2e8a0c08a7db5864862ee3226d346d4a2224ead3 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Fri, 22 May 2020 13:14:26 +0200 Subject: [PATCH 045/280] Fix some flaky offchain HTTP tests (#6038) * http: Use assert_eq in tests for better debuggability * http: Use matches! macro instead of if let ... * http: Simplify some bits and pieces * http: Don't answer immediately in HTTP test server Sometimes it can happen that we receive the response immediately when testing the HTTP api due to kernel scheduling. Because of it, we add a marginal 10ms async-friendly delay to minimize the risk. * http: Use the same async runtime when testing HTTP API/worker * http: Return a future Delay only for non-zero Duration This allows to short-circuit in the response_wait logic and only send/not wait for response. --- client/offchain/src/api/http.rs | 51 +++++++++++++--------------- client/offchain/src/api/timestamp.rs | 14 ++++---- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/client/offchain/src/api/http.rs b/client/offchain/src/api/http.rs index a64fe03897..91a673872f 100644 --- a/client/offchain/src/api/http.rs +++ b/client/offchain/src/api/http.rs @@ -31,7 +31,7 @@ use fnv::FnvHashMap; use futures::{prelude::*, future, channel::mpsc}; use log::error; use sp_core::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError}; -use std::{fmt, io::Read as _, mem, pin::Pin, task::Context, task::Poll}; +use std::{convert::TryFrom, fmt, io::Read as _, pin::Pin, task::{Context, Poll}}; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender, TracingUnboundedReceiver}; /// Creates a pair of [`HttpApi`] and [`HttpWorker`]. @@ -151,8 +151,8 @@ impl HttpApi { _ => return Err(()) }; - let name = hyper::header::HeaderName::from_bytes(name.as_bytes()).map_err(|_| ())?; - let value = hyper::header::HeaderValue::from_str(value).map_err(|_| ())?; + let name = hyper::header::HeaderName::try_from(name).map_err(drop)?; + let value = hyper::header::HeaderValue::try_from(value).map_err(drop)?; // Note that we're always appending headers and never replacing old values. // We assume here that the user knows what they're doing. request.headers_mut().append(name, value); @@ -185,7 +185,7 @@ impl HttpApi { future::MaybeDone::Done(Err(_)) => return Err(HttpError::IoError), future::MaybeDone::Future(_) | future::MaybeDone::Gone => { - debug_assert!(if let future::MaybeDone::Done(_) = deadline { true } else { false }); + debug_assert!(matches!(deadline, future::MaybeDone::Done(..))); return Err(HttpError::DeadlineReached) } }; @@ -347,7 +347,7 @@ impl HttpApi { if let future::MaybeDone::Done(msg) = next_msg { msg } else { - debug_assert!(if let future::MaybeDone::Done(_) = deadline { true } else { false }); + debug_assert!(matches!(deadline, future::MaybeDone::Done(..))); continue } }; @@ -585,25 +585,21 @@ impl Future for HttpWorker { match request { HttpWorkerRequest::Dispatched(mut future) => { // Check for an HTTP response from the Internet. - let mut response = match Future::poll(Pin::new(&mut future), cx) { + let response = match Future::poll(Pin::new(&mut future), cx) { Poll::Pending => { me.requests.push((id, HttpWorkerRequest::Dispatched(future))); continue }, Poll::Ready(Ok(response)) => response, - Poll::Ready(Err(err)) => { - let _ = me.to_api.unbounded_send(WorkerToApi::Fail { - id, - error: err, - }); + Poll::Ready(Err(error)) => { + let _ = me.to_api.unbounded_send(WorkerToApi::Fail { id, error }); continue; // don't insert the request back } }; // We received a response! Decompose it into its parts. - let status_code = response.status(); - let headers = mem::replace(response.headers_mut(), hyper::HeaderMap::new()); - let body = response.into_body(); + let (head, body) = response.into_parts(); + let (status_code, headers) = (head.status, head.headers); let (body_tx, body_rx) = mpsc::channel(3); let _ = me.to_api.unbounded_send(WorkerToApi::Response { @@ -691,15 +687,12 @@ mod tests { use crate::api::timestamp; use super::http; use sp_core::offchain::{HttpError, HttpRequestId, HttpRequestStatus, Duration}; + use futures::future; // Returns an `HttpApi` whose worker is ran in the background, and a `SocketAddr` to an HTTP // server that runs in the background as well. macro_rules! build_api_server { () => {{ - fn tokio_run(future: impl std::future::Future) { - let _ = tokio::runtime::Runtime::new().unwrap().block_on(future); - } - // We spawn quite a bit of HTTP servers here due to how async API // works for offchain workers, so be sure to raise the FD limit // (particularly useful for macOS where the default soft limit may @@ -707,11 +700,12 @@ mod tests { fdlimit::raise_fd_limit(); let (api, worker) = http(); - std::thread::spawn(move || tokio_run(worker)); let (addr_tx, addr_rx) = std::sync::mpsc::channel(); std::thread::spawn(move || { - tokio_run(async move { + let mut rt = tokio::runtime::Runtime::new().unwrap(); + let worker = rt.spawn(worker); + let server = rt.spawn(async move { let server = hyper::Server::bind(&"127.0.0.1:0".parse().unwrap()) .serve(hyper::service::make_service_fn(|_| { async move { Ok::<_, Infallible>(hyper::service::service_fn(move |_req| async move { @@ -721,8 +715,9 @@ mod tests { })) }})); let _ = addr_tx.send(server.local_addr()); - server.await + server.await.map_err(drop) }); + let _ = rt.block_on(future::join(worker, server)); }); (api, addr_rx.recv().unwrap()) }}; @@ -891,10 +886,10 @@ mod tests { #[test] fn response_headers_invalid_call() { let (mut api, addr) = build_api_server!(); - assert!(api.response_headers(HttpRequestId(0xdead)).is_empty()); + assert_eq!(api.response_headers(HttpRequestId(0xdead)), &[]); let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); - assert!(api.response_headers(id).is_empty()); + assert_eq!(api.response_headers(id), &[]); let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_write_body(id, &[], None).unwrap(); @@ -904,12 +899,12 @@ mod tests { let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); api.response_wait(&[id], None); - assert!(!api.response_headers(id).is_empty()); + assert_ne!(api.response_headers(id), &[]); let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); let mut buf = [0; 128]; while api.response_read_body(id, &mut buf, None).unwrap() != 0 {} - assert!(api.response_headers(id).is_empty()); + assert_eq!(api.response_headers(id), &[]); } #[test] @@ -917,11 +912,11 @@ mod tests { let (mut api, addr) = build_api_server!(); let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); - assert!(api.response_headers(id).is_empty()); + assert_eq!(api.response_headers(id), &[]); let id = api.request_start("POST", &format!("http://{}", addr)).unwrap(); api.request_add_header(id, "Foo", "Bar").unwrap(); - assert!(api.response_headers(id).is_empty()); + assert_eq!(api.response_headers(id), &[]); let id = api.request_start("GET", &format!("http://{}", addr)).unwrap(); api.request_add_header(id, "Foo", "Bar").unwrap(); @@ -930,7 +925,7 @@ mod tests { // where we haven't received any response yet. This test can theoretically fail if the // HTTP response comes back faster than the kernel schedules our thread, but that is highly // unlikely. - assert!(api.response_headers(id).is_empty()); + assert_eq!(api.response_headers(id), &[]); } #[test] diff --git a/client/offchain/src/api/timestamp.rs b/client/offchain/src/api/timestamp.rs index e5494fe70d..222d3273cb 100644 --- a/client/offchain/src/api/timestamp.rs +++ b/client/offchain/src/api/timestamp.rs @@ -51,12 +51,14 @@ pub fn timestamp_from_now(timestamp: Timestamp) -> Duration { pub fn deadline_to_future( deadline: Option, ) -> futures::future::MaybeDone { - use futures::future; + use futures::future::{self, Either}; - future::maybe_done(match deadline { - Some(deadline) => future::Either::Left( - futures_timer::Delay::new(timestamp_from_now(deadline)) - ), - None => future::Either::Right(future::pending()) + future::maybe_done(match deadline.map(timestamp_from_now) { + None => Either::Left(future::pending()), + // Only apply delay if we need to wait a non-zero duration + Some(duration) if duration <= Duration::from_secs(0) => + Either::Right(Either::Left(future::ready(()))), + Some(duration) => + Either::Right(Either::Right(futures_timer::Delay::new(duration))), }) } -- GitLab From 9aa7b8f8b8a9b56eb11b00398f697cd277c4b509 Mon Sep 17 00:00:00 2001 From: pscott <30843220+pscott@users.noreply.github.com> Date: Fri, 22 May 2020 13:50:25 +0200 Subject: [PATCH 046/280] Add JSON format to import blocks and set it as default (#5816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add BlockStream Enum and utility fn * WIP: Modify import closure to work with BlockStream * Fix trait bounds * Working prototype * Revamp block importing * Add export_import_flow tests * Add comments and clean code * Add more comments in the import fn * Add link code to import function * Add condition when returning Ready(Ok(()) to make sure we've imported every block * Add check for imported blocks in JSON case * Use rest pattern * Fix compilation error for undeclared variable * Add polling and waker before pending * Print read_block_count instead of count * Simplify binary cli option with structopt * Update test to reflect changes in CLI api * Change Stream to take SignedBlock instead of B * Add comments to BlockStream * Move out logic to smaller functions for clearer code * Remove result over import_blocks return type * Check for error in command output rather than simply checking command exit status * Revamp export/import/revert testing * Fix minor typos and formatting errors Co-authored-by: Bastian Köcher * Remove unnecessary if condition in terminating condition Co-authored-by: Bastian Köcher * Explicit error instead of returning it as a string Co-authored-by: Bastian Köcher * Pass BlockStream to log_importing_status_updates and simplify matching arms for block stream * Use .contains() instead of regex match * Line break in match block; return future::ready instead of poll_fn * Update Cargo.lock * Add check so that queue doesn't grow too big * Use Iterator instead of Stream * Remove allow dead_code * Remove outdated comments Co-authored-by: Bastian Köcher * Return Errors instead of logging them * Simplify match arms Co-authored-by: Bastian Köcher * Remove check before terminating block import * Apply suggestions from code review * Check that queue is not full BEFORE calling * Revert "Remove check before terminating block import" This reverts commit 377823c0a648a3eb2e61185a257a61023067893d. * Improve unit tests to make sure we actually import blocks * Remove Unpin implementation for BlockIter * Add prototype of enum for ImportStates * Add working prototype for StateMachine * Add comments for clearer code * Add sleep before calling Waker when waiting for import queue * Add Speedometer * add dbg!(&log) for test debugging * Fix lines with more than 100 cols * Fix regex capture for test * Update regexes to take to capture the whole number * Rename Cmd to Command Co-authored-by: Gavin Wood * Actually rename Cmd to Command * Apply suggestions from code review Co-authored-by: Gavin Wood * Fix compilation errors for tests * Fix compilation errors from code review suggestion * Update bin/node/cli/tests/export_import_flow.rs Co-authored-by: Bastian Köcher Co-authored-by: Gavin Wood Co-authored-by: Benjamin Kampmann --- bin/node/cli/tests/check_block_works.rs | 2 +- bin/node/cli/tests/common.rs | 1 - bin/node/cli/tests/export_import_flow.rs | 212 ++++++++++ .../tests/import_export_and_revert_work.rs | 61 --- bin/node/cli/tests/inspect_works.rs | 2 +- bin/node/cli/tests/purge_chain_works.rs | 2 +- .../tests/running_the_node_and_interrupt.rs | 2 +- client/cli/src/commands/import_blocks_cmd.rs | 6 +- client/service/src/builder.rs | 1 + client/service/src/chain_ops.rs | 399 ++++++++++++++---- 10 files changed, 546 insertions(+), 142 deletions(-) create mode 100644 bin/node/cli/tests/export_import_flow.rs delete mode 100644 bin/node/cli/tests/import_export_and_revert_work.rs diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs index 0b340dad64..34078b08cf 100644 --- a/bin/node/cli/tests/check_block_works.rs +++ b/bin/node/cli/tests/check_block_works.rs @@ -22,7 +22,7 @@ use assert_cmd::cargo::cargo_bin; use std::process::Command; use tempfile::tempdir; -mod common; +pub mod common; #[test] fn check_block_works() { diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 51f88cd92b..61a07dd1ca 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -17,7 +17,6 @@ // along with this program. If not, see . #![cfg(unix)] -#![allow(dead_code)] use std::{process::{Child, ExitStatus}, thread, time::Duration, path::Path}; use assert_cmd::cargo::cargo_bin; diff --git a/bin/node/cli/tests/export_import_flow.rs b/bin/node/cli/tests/export_import_flow.rs new file mode 100644 index 0000000000..85a49b005a --- /dev/null +++ b/bin/node/cli/tests/export_import_flow.rs @@ -0,0 +1,212 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +#![cfg(unix)] + +use assert_cmd::cargo::cargo_bin; +use std::{process::Command, fs, path::PathBuf}; +use tempfile::{tempdir, TempDir}; +use regex::Regex; + +pub mod common; + +fn contains_error(logged_output: &str) -> bool { + logged_output.contains("Error") +} + +/// Helper struct to execute the export/import/revert tests. +/// The fields are paths to a temporary directory +struct ExportImportRevertExecutor<'a> { + base_path: &'a TempDir, + exported_blocks_file: &'a PathBuf, + db_path: &'a PathBuf, + num_exported_blocks: Option, +} + +/// Format options for export / import commands. +enum FormatOpt { + Json, + Binary, +} + +/// Command corresponding to the different commands we would like to run. +enum SubCommand { + ExportBlocks, + ImportBlocks, +} + +impl ToString for SubCommand { + fn to_string(&self) -> String { + match self { + SubCommand::ExportBlocks => String::from("export-blocks"), + SubCommand::ImportBlocks => String::from("import-blocks"), + } + } +} + +impl<'a> ExportImportRevertExecutor<'a> { + fn new( + base_path: &'a TempDir, + exported_blocks_file: &'a PathBuf, + db_path: &'a PathBuf + ) -> Self { + Self { + base_path, + exported_blocks_file, + db_path, + num_exported_blocks: None, + } + } + + /// Helper method to run a command. Returns a string corresponding to what has been logged. + fn run_block_command(&self, + sub_command: SubCommand, + format_opt: FormatOpt, + expected_to_fail: bool + ) -> String { + let sub_command_str = sub_command.to_string(); + // Adding "--binary" if need be. + let arguments: Vec<&str> = match format_opt { + FormatOpt::Binary => vec![&sub_command_str, "--dev", "--pruning", "archive", "--binary", "-d"], + FormatOpt::Json => vec![&sub_command_str, "--dev", "--pruning", "archive", "-d"], + }; + + let tmp: TempDir; + // Setting base_path to be a temporary folder if we are importing blocks. + // This allows us to make sure we are importing from scratch. + let base_path = match sub_command { + SubCommand::ExportBlocks => &self.base_path.path(), + SubCommand::ImportBlocks => { + tmp = tempdir().unwrap(); + tmp.path() + } + }; + + // Running the command and capturing the output. + let output = Command::new(cargo_bin("substrate")) + .args(&arguments) + .arg(&base_path) + .arg(&self.exported_blocks_file) + .output() + .unwrap(); + + let logged_output = String::from_utf8_lossy(&output.stderr).to_string(); + + if expected_to_fail { + // Checking that we did indeed find an error. + assert!(contains_error(&logged_output), "expected to error but did not error!"); + assert!(!output.status.success()); + } else { + // Making sure no error were logged. + assert!(!contains_error(&logged_output), "expected not to error but error'd!"); + assert!(output.status.success()); + } + + logged_output + } + + /// Runs the `export-blocks` command. + fn run_export(&mut self, fmt_opt: FormatOpt) { + let log = self.run_block_command(SubCommand::ExportBlocks, fmt_opt, false); + + // Using regex to find out how many block we exported. + let re = Regex::new(r"Exporting blocks from #\d* to #(?P\d*)").unwrap(); + let caps = re.captures(&log).unwrap(); + // Saving the number of blocks we've exported for further use. + self.num_exported_blocks = Some(caps["exported_blocks"].parse::().unwrap()); + + let metadata = fs::metadata(&self.exported_blocks_file).unwrap(); + assert!(metadata.len() > 0, "file exported_blocks should not be empty"); + + let _ = fs::remove_dir_all(&self.db_path); + } + + /// Runs the `import-blocks` command, asserting that an error was found or + /// not depending on `expected_to_fail`. + fn run_import(&mut self, fmt_opt: FormatOpt, expected_to_fail: bool) { + let log = self.run_block_command(SubCommand::ImportBlocks, fmt_opt, expected_to_fail); + + if !expected_to_fail { + // Using regex to find out how much block we imported, + // and what's the best current block. + let re = Regex::new(r"Imported (?P\d*) blocks. Best: #(?P\d*)").unwrap(); + let caps = re.captures(&log).expect("capture should have succeeded"); + let imported = caps["imported"].parse::().unwrap(); + let best = caps["best"].parse::().unwrap(); + + assert_eq!( + imported, + best, + "numbers of blocks imported and best number differs" + ); + assert_eq!( + best, + self.num_exported_blocks.expect("number of exported blocks cannot be None; qed"), + "best block number and number of expected blocks should not differ" + ); + } + self.num_exported_blocks = None; + } + + /// Runs the `revert` command. + fn run_revert(&self) { + let output = Command::new(cargo_bin("substrate")) + .args(&["revert", "--dev", "--pruning", "archive", "-d"]) + .arg(&self.base_path.path()) + .output() + .unwrap(); + + let logged_output = String::from_utf8_lossy(&output.stderr).to_string(); + + // Reverting should not log any error. + assert!(!contains_error(&logged_output)); + // Command should never fail. + assert!(output.status.success()); + } + + /// Helper function that runs the whole export / import / revert flow and checks for errors. + fn run(&mut self, export_fmt: FormatOpt, import_fmt: FormatOpt, expected_to_fail: bool) { + self.run_export(export_fmt); + self.run_import(import_fmt, expected_to_fail); + self.run_revert(); + } +} + +#[test] +fn export_import_revert() { + let base_path = tempdir().expect("could not create a temp dir"); + let exported_blocks_file = base_path.path().join("exported_blocks"); + let db_path = base_path.path().join("db"); + + common::run_dev_node_for_a_while(base_path.path()); + + let mut executor = ExportImportRevertExecutor::new( + &base_path, + &exported_blocks_file, + &db_path, + ); + + // Binary and binary should work. + executor.run(FormatOpt::Binary, FormatOpt::Binary, false); + // Binary and JSON should fail. + executor.run(FormatOpt::Binary, FormatOpt::Json, true); + // JSON and JSON should work. + executor.run(FormatOpt::Json, FormatOpt::Json, false); + // JSON and binary should fail. + executor.run(FormatOpt::Json, FormatOpt::Binary, true); +} diff --git a/bin/node/cli/tests/import_export_and_revert_work.rs b/bin/node/cli/tests/import_export_and_revert_work.rs deleted file mode 100644 index 91c8b024e1..0000000000 --- a/bin/node/cli/tests/import_export_and_revert_work.rs +++ /dev/null @@ -1,61 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program 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. - -// This program 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 this program. If not, see . - -#![cfg(unix)] - -use assert_cmd::cargo::cargo_bin; -use std::{process::Command, fs}; -use tempfile::tempdir; - -mod common; - -#[test] -fn import_export_and_revert_work() { - let base_path = tempdir().expect("could not create a temp dir"); - let exported_blocks = base_path.path().join("exported_blocks"); - - common::run_dev_node_for_a_while(base_path.path()); - - let status = Command::new(cargo_bin("substrate")) - .args(&["export-blocks", "--dev", "--pruning", "archive", "-d"]) - .arg(base_path.path()) - .arg(&exported_blocks) - .status() - .unwrap(); - assert!(status.success()); - - let metadata = fs::metadata(&exported_blocks).unwrap(); - assert!(metadata.len() > 0, "file exported_blocks should not be empty"); - - let _ = fs::remove_dir_all(base_path.path().join("db")); - - let status = Command::new(cargo_bin("substrate")) - .args(&["import-blocks", "--dev", "--pruning", "archive", "-d"]) - .arg(base_path.path()) - .arg(&exported_blocks) - .status() - .unwrap(); - assert!(status.success()); - - let status = Command::new(cargo_bin("substrate")) - .args(&["revert", "--dev", "--pruning", "archive", "-d"]) - .arg(base_path.path()) - .status() - .unwrap(); - assert!(status.success()); -} diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs index 59bdaf7de3..aa9653acad 100644 --- a/bin/node/cli/tests/inspect_works.rs +++ b/bin/node/cli/tests/inspect_works.rs @@ -22,7 +22,7 @@ use assert_cmd::cargo::cargo_bin; use std::process::Command; use tempfile::tempdir; -mod common; +pub mod common; #[test] fn inspect_works() { diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs index 8d637be3e8..001bed8b13 100644 --- a/bin/node/cli/tests/purge_chain_works.rs +++ b/bin/node/cli/tests/purge_chain_works.rs @@ -20,7 +20,7 @@ use assert_cmd::cargo::cargo_bin; use std::process::Command; use tempfile::tempdir; -mod common; +pub mod common; #[test] #[cfg(unix)] diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index a8c4be4695..bd79dcd77a 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -20,7 +20,7 @@ use assert_cmd::cargo::cargo_bin; use std::{convert::TryInto, process::Command, thread, time::Duration}; use tempfile::tempdir; -mod common; +pub mod common; #[test] #[cfg(unix)] diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs index e138850c8b..a74f4d524c 100644 --- a/client/cli/src/commands/import_blocks_cmd.rs +++ b/client/cli/src/commands/import_blocks_cmd.rs @@ -41,6 +41,10 @@ pub struct ImportBlocksCmd { #[structopt(long = "default-heap-pages", value_name = "COUNT")] pub default_heap_pages: Option, + /// Try importing blocks from binary format rather than JSON. + #[structopt(long)] + pub binary: bool, + #[allow(missing_docs)] #[structopt(flatten)] pub shared_params: SharedParams, @@ -79,7 +83,7 @@ impl ImportBlocksCmd { }; builder(config)? - .import_blocks(file, false) + .import_blocks(file, false, self.binary) .await .map_err(Into::into) } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 16d78c49e1..d921606ea6 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -831,6 +831,7 @@ pub trait ServiceBuilderCommand { self, input: impl Read + Seek + Send + 'static, force: bool, + binary: bool, ) -> Pin> + Send>>; /// Performs the blocks export. diff --git a/client/service/src/chain_ops.rs b/client/service/src/chain_ops.rs index 5c7dca0da7..0297ad5c90 100644 --- a/client/service/src/chain_ops.rs +++ b/client/service/src/chain_ops.rs @@ -25,10 +25,10 @@ use sc_chain_spec::ChainSpec; use log::{warn, info}; use futures::{future, prelude::*}; use sp_runtime::traits::{ - Block as BlockT, NumberFor, One, Zero, Header, SaturatedConversion + Block as BlockT, NumberFor, One, Zero, Header, SaturatedConversion, MaybeSerializeDeserialize, }; use sp_runtime::generic::{BlockId, SignedBlock}; -use codec::{Decode, Encode, IoReader}; +use codec::{Decode, Encode, IoReader as CodecIoReader}; use crate::client::{Client, LocalCallExecutor}; use sp_consensus::{ BlockOrigin, @@ -39,12 +39,250 @@ use sp_core::storage::{StorageKey, well_known_keys, ChildInfo, Storage, StorageC use sc_client_api::{StorageProvider, BlockBackend, UsageProvider}; use std::{io::{Read, Write, Seek}, pin::Pin, collections::HashMap}; +use std::{thread, time::{Duration, Instant}}; +use serde_json::{de::IoRead as JsonIoRead, Deserializer, StreamDeserializer}; +use std::convert::{TryFrom, TryInto}; +use sp_runtime::traits::{CheckedDiv, Saturating}; + +/// Number of blocks we will add to the queue before waiting for the queue to catch up. +const MAX_PENDING_BLOCKS: u64 = 1_024; + +/// Number of milliseconds to wait until next poll. +const DELAY_TIME: u64 = 2_000; + +/// Number of milliseconds that must have passed between two updates. +const TIME_BETWEEN_UPDATES: u64 = 3_000; /// Build a chain spec json pub fn build_spec(spec: &dyn ChainSpec, raw: bool) -> error::Result { spec.as_json(raw).map_err(Into::into) } + +/// Helper enum that wraps either a binary decoder (from parity-scale-codec), or a JSON decoder (from serde_json). +/// Implements the Iterator Trait, calling `next()` will decode the next SignedBlock and return it. +enum BlockIter where + R: std::io::Read + std::io::Seek, +{ + Binary { + // Total number of blocks we are expecting to decode. + num_expected_blocks: u64, + // Number of blocks we have decoded thus far. + read_block_count: u64, + // Reader to the data, used for decoding new blocks. + reader: CodecIoReader, + }, + Json { + // Nubmer of blocks we have decoded thus far. + read_block_count: u64, + // Stream to the data, used for decoding new blocks. + reader: StreamDeserializer<'static, JsonIoRead, SignedBlock>, + }, +} + +impl BlockIter where + R: Read + Seek + 'static, + B: BlockT + MaybeSerializeDeserialize, +{ + fn new(input: R, binary: bool) -> Result { + if binary { + let mut reader = CodecIoReader(input); + // If the file is encoded in binary format, it is expected to first specify the number + // of blocks that are going to be decoded. We read it and add it to our enum struct. + let num_expected_blocks: u64 = Decode::decode(&mut reader) + .map_err(|e| format!("Failed to decode the number of blocks: {:?}", e))?; + Ok(BlockIter::Binary { + num_expected_blocks, + read_block_count: 0, + reader, + }) + } else { + let stream_deser = Deserializer::from_reader(input) + .into_iter::>(); + Ok(BlockIter::Json { + reader: stream_deser, + read_block_count: 0, + }) + } + } + + /// Returns the number of blocks read thus far. + fn read_block_count(&self) -> u64 { + match self { + BlockIter::Binary { read_block_count, .. } + | BlockIter::Json { read_block_count, .. } + => *read_block_count, + } + } + + /// Returns the total number of blocks to be imported, if possible. + fn num_expected_blocks(&self) -> Option { + match self { + BlockIter::Binary { num_expected_blocks, ..} => Some(*num_expected_blocks), + BlockIter::Json {..} => None + } + } +} + +impl Iterator for BlockIter where + R: Read + Seek + 'static, + B: BlockT + MaybeSerializeDeserialize, +{ + type Item = Result, String>; + + fn next(&mut self) -> Option { + match self { + BlockIter::Binary { num_expected_blocks, read_block_count, reader } => { + if read_block_count < num_expected_blocks { + let block_result: Result, _> = SignedBlock::::decode(reader) + .map_err(|e| e.to_string()); + *read_block_count += 1; + Some(block_result) + } else { + // `read_block_count` == `num_expected_blocks` so we've read enough blocks. + None + } + } + BlockIter::Json { reader, read_block_count } => { + let res = Some(reader.next()?.map_err(|e| e.to_string())); + *read_block_count += 1; + res + } + } + } +} + +/// Imports the SignedBlock to the queue. +fn import_block_to_queue( + signed_block: SignedBlock, + queue: &mut TImpQu, + force: bool +) where + TBl: BlockT + MaybeSerializeDeserialize, + TImpQu: 'static + ImportQueue, +{ + let (header, extrinsics) = signed_block.block.deconstruct(); + let hash = header.hash(); + // import queue handles verification and importing it into the client. + queue.import_blocks(BlockOrigin::File, vec![ + IncomingBlock:: { + hash, + header: Some(header), + body: Some(extrinsics), + justification: signed_block.justification, + origin: None, + allow_missing_state: false, + import_existing: force, + } + ]); +} + +/// Returns true if we have imported every block we were supposed to import, else returns false. +fn importing_is_done( + num_expected_blocks: Option, + read_block_count: u64, + imported_blocks: u64 +) -> bool { + if let Some(num_expected_blocks) = num_expected_blocks { + imported_blocks >= num_expected_blocks + } else { + imported_blocks >= read_block_count + } +} + +/// Structure used to log the block importing speed. +struct Speedometer { + best_number: NumberFor, + last_number: Option>, + last_update: Instant, +} + +impl Speedometer { + /// Creates a fresh Speedometer. + fn new() -> Self { + Self { + best_number: NumberFor::::from(0), + last_number: None, + last_update: Instant::now(), + } + } + + /// Calculates `(best_number - last_number) / (now - last_update)` and + /// logs the speed of import. + fn display_speed(&self) { + // Number of milliseconds elapsed since last time. + let elapsed_ms = { + let elapsed = self.last_update.elapsed(); + let since_last_millis = elapsed.as_secs() * 1000; + let since_last_subsec_millis = elapsed.subsec_millis() as u64; + since_last_millis + since_last_subsec_millis + }; + + // Number of blocks that have been imported since last time. + let diff = match self.last_number { + None => return, + Some(n) => self.best_number.saturating_sub(n) + }; + + if let Ok(diff) = TryInto::::try_into(diff) { + // If the number of blocks can be converted to a regular integer, then it's easy: just + // do the math and turn it into a `f64`. + let speed = diff.saturating_mul(10_000).checked_div(u128::from(elapsed_ms)) + .map_or(0.0, |s| s as f64) / 10.0; + info!("📦 Current best block: {} ({:4.1} bps)", self.best_number, speed); + } else { + // If the number of blocks can't be converted to a regular integer, then we need a more + // algebraic approach and we stay within the realm of integers. + let one_thousand = NumberFor::::from(1_000); + let elapsed = NumberFor::::from( + >::try_from(elapsed_ms).unwrap_or(u32::max_value()) + ); + + let speed = diff.saturating_mul(one_thousand).checked_div(&elapsed) + .unwrap_or_else(Zero::zero); + info!("📦 Current best block: {} ({} bps)", self.best_number, speed) + } + } + + /// Updates the Speedometer. + fn update(&mut self, best_number: NumberFor) { + self.last_number = Some(self.best_number); + self.best_number = best_number; + self.last_update = Instant::now(); + } + + // If more than TIME_BETWEEN_UPDATES has elapsed since last update, + // then print and update the speedometer. + fn notify_user(&mut self, best_number: NumberFor) { + let delta = Duration::from_millis(TIME_BETWEEN_UPDATES); + if Instant::now().duration_since(self.last_update) >= delta { + self.display_speed(); + self.update(best_number); + } + } +} + +/// Different State that the `import_blocks` future could be in. +enum ImportState where + R: Read + Seek + 'static, + B: BlockT + MaybeSerializeDeserialize, +{ + /// We are reading from the BlockIter structure, adding those blocks to the queue if possible. + Reading{block_iter: BlockIter}, + /// The queue is full (contains at least MAX_PENDING_BLOCKS blocks) and we are waiting for it to catch up. + WaitingForImportQueueToCatchUp{ + block_iter: BlockIter, + delay: Duration, + block: SignedBlock + }, + // We have added all the blocks to the queue but they are still being processed. + WaitingForImportQueueToFinish{ + num_expected_blocks: Option, + read_block_count: u64, + delay: Duration, + }, +} + impl< TBl, TRtApi, TBackend, TExecDisp, TFchr, TSc, TImpQu, TFprb, TFpp, @@ -54,7 +292,7 @@ impl< Client>, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend > where - TBl: BlockT, + TBl: BlockT + MaybeSerializeDeserialize, TBackend: 'static + sc_client_api::backend::Backend + Send, TExecDisp: 'static + NativeExecutionDispatch, TImpQu: 'static + ImportQueue, @@ -68,6 +306,7 @@ impl< mut self, input: impl Read + Seek + Send + 'static, force: bool, + binary: bool, ) -> Pin> + Send>> { struct WaitLink { imported_blocks: u64, @@ -87,7 +326,7 @@ impl< fn blocks_processed( &mut self, imported: usize, - _count: usize, + _num_expected_blocks: usize, results: Vec<(Result>, BlockImportError>, B::Hash)> ) { self.imported_blocks += imported as u64; @@ -102,10 +341,20 @@ impl< } } - let mut io_reader_input = IoReader(input); - let mut count = None::; - let mut read_block_count = 0; let mut link = WaitLink::new(); + let block_iter_res: Result, String> = BlockIter::new(input, binary); + + let block_iter = match block_iter_res { + Ok(block_iter) => block_iter, + Err(e) => { + // We've encountered an error while creating the block iterator + // so we can just return a future that returns an error. + return future::ready(Err(Error::Other(e))).boxed() + } + }; + + let mut state = Some(ImportState::Reading{block_iter}); + let mut speedometer = Speedometer::::new(); // Importing blocks is implemented as a future, because we want the operation to be // interruptible. @@ -117,85 +366,85 @@ impl< let import = future::poll_fn(move |cx| { let client = &self.client; let queue = &mut self.import_queue; - - // Start by reading the number of blocks if not done so already. - let count = match count { - Some(c) => c, - None => { - let c: u64 = match Decode::decode(&mut io_reader_input) { - Ok(c) => c, - Err(err) => { - let err = format!("Error reading file: {}", err); - return std::task::Poll::Ready(Err(From::from(err))); + match state.take().expect("state should never be None; qed") { + ImportState::Reading{mut block_iter} => { + match block_iter.next() { + None => { + // The iterator is over: we now need to wait for the import queue to finish. + let num_expected_blocks = block_iter.num_expected_blocks(); + let read_block_count = block_iter.read_block_count(); + let delay = Duration::from_millis(DELAY_TIME); + state = Some(ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay}); }, - }; - info!("📦 Importing {} blocks", c); - count = Some(c); - c - } - }; - - // Read blocks from the input. - if read_block_count < count { - match SignedBlock::::decode(&mut io_reader_input) { - Ok(signed) => { - let (header, extrinsics) = signed.block.deconstruct(); - let hash = header.hash(); - // import queue handles verification and importing it into the client - queue.import_blocks(BlockOrigin::File, vec![ - IncomingBlock:: { - hash, - header: Some(header), - body: Some(extrinsics), - justification: signed.justification, - origin: None, - allow_missing_state: false, - import_existing: force, + Some(block_result) => { + let read_block_count = block_iter.read_block_count(); + match block_result { + Ok(block) => { + if read_block_count - link.imported_blocks >= MAX_PENDING_BLOCKS { + // The queue is full, so do not add this block and simply wait until + // the queue has made some progress. + let delay = Duration::from_millis(DELAY_TIME); + state = Some(ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block}); + } else { + // Queue is not full, we can keep on adding blocks to the queue. + import_block_to_queue(block, queue, force); + state = Some(ImportState::Reading{block_iter}); + } + } + Err(e) => { + return std::task::Poll::Ready( + Err(Error::Other(format!("Error reading block #{}: {}", read_block_count, e)))) + } } - ]); + } + } + }, + ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block} => { + let read_block_count = block_iter.read_block_count(); + if read_block_count - link.imported_blocks >= MAX_PENDING_BLOCKS { + thread::sleep(delay); + // Queue is still full, so wait until there is room to insert our block. + state = Some(ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block}); + } else { + // Queue is no longer full, so we can add our block to the queue. + import_block_to_queue(block, queue, force); + // Switch back to Reading state. + state = Some(ImportState::Reading{block_iter}); } - Err(e) => { - warn!("Error reading block data at {}: {}", read_block_count, e); - return std::task::Poll::Ready(Ok(())); + }, + ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay} => { + // All the blocks have been added to the queue, which doesn't mean they + // have all been properly imported. + if importing_is_done(num_expected_blocks, read_block_count, link.imported_blocks) { + // Importing is done, we can log the result and return. + info!( + "🎉 Imported {} blocks. Best: #{}", + read_block_count, client.chain_info().best_number + ); + return std::task::Poll::Ready(Ok(())) + } else { + thread::sleep(delay); + // Importing is not done, we still have to wait for the queue to finish. + state = Some(ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay}); } } - - read_block_count += 1; - if read_block_count % 1000 == 0 { - info!("#{} blocks were added to the queue", read_block_count); - } - - cx.waker().wake_by_ref(); - return std::task::Poll::Pending; } - let blocks_before = link.imported_blocks; queue.poll_actions(cx, &mut link); - if link.has_error { - info!( - "Stopping after #{} blocks because of an error", - link.imported_blocks, - ); - return std::task::Poll::Ready(Ok(())); - } + let best_number = client.chain_info().best_number; + speedometer.notify_user(best_number); - if link.imported_blocks / 1000 != blocks_before / 1000 { - info!( - "#{} blocks were imported (#{} left)", - link.imported_blocks, - count - link.imported_blocks - ); + if link.has_error { + return std::task::Poll::Ready(Err( + Error::Other( + format!("Stopping after #{} blocks because of an error", link.imported_blocks) + ) + )) } - if link.imported_blocks >= count { - info!("🎉 Imported {} blocks. Best: #{}", read_block_count, client.chain_info().best_number); - return std::task::Poll::Ready(Ok(())); - - } else { - // Polling the import queue will re-schedule the task when ready. - return std::task::Poll::Pending; - } + cx.waker().wake_by_ref(); + std::task::Poll::Pending }); Box::pin(import) } @@ -295,7 +544,7 @@ impl< 1u64.encode_to(&mut buf); block.encode_to(&mut buf); let reader = std::io::Cursor::new(buf); - self.import_blocks(reader, true) + self.import_blocks(reader, true, true) } Ok(None) => Box::pin(future::err("Unknown block".into())), Err(e) => Box::pin(future::err(format!("Error reading block: {:?}", e).into())), -- GitLab From 1b41fe71e90cc486c89e85f6bb948909c2812bfd Mon Sep 17 00:00:00 2001 From: thiolliere Date: Fri, 22 May 2020 15:08:51 +0200 Subject: [PATCH 047/280] put max votes into metadata (#6114) --- frame/democracy/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index ee9417ce0c..580e80cce0 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -652,6 +652,9 @@ decl_module! { /// The amount of balance that must be deposited per byte of preimage stored. const PreimageByteDeposit: BalanceOf = T::PreimageByteDeposit::get(); + /// The maximum number of votes for an account. + const MaxVotes: u32 = T::MaxVotes::get(); + fn deposit_event() = default; fn on_runtime_upgrade() -> Weight { -- GitLab From b3e0cb68129eef29fd4521b23c39d1c8dd2e28cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 23 May 2020 11:28:34 +0200 Subject: [PATCH 048/280] Don't clone values when calculating storage root (#6108) * Don't clone values when calculating storage root Instead of cloning all the keys and values of the overlay when calculating the storage root, we pass all the values by reference. This should probably bring some performance improvements when calculating the storage root. * no cow version (#6113) Co-authored-by: cheme --- client/api/src/in_mem.rs | 17 +++-- client/db/src/bench.rs | 23 ++++--- client/db/src/lib.rs | 52 +++++++-------- client/db/src/storage_cache.rs | 34 ++++------ client/service/src/client/light/backend.rs | 31 ++++----- primitives/state-machine/src/backend.rs | 65 +++++++++---------- primitives/state-machine/src/basic.rs | 2 +- primitives/state-machine/src/ext.rs | 2 +- .../state-machine/src/overlayed_changes.rs | 24 ++++--- .../state-machine/src/proving_backend.rs | 32 ++++----- primitives/state-machine/src/trie_backend.rs | 36 +++++----- primitives/trie/src/lib.rs | 34 +++++----- 12 files changed, 165 insertions(+), 187 deletions(-) diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs index 0eb0681a82..45c41fbcb7 100644 --- a/client/api/src/in_mem.rs +++ b/client/api/src/in_mem.rs @@ -21,9 +21,8 @@ use std::collections::HashMap; use std::sync::Arc; use parking_lot::RwLock; -use sp_core::storage::well_known_keys; -use sp_core::offchain::storage::{ - InMemOffchainStorage as OffchainStorage +use sp_core::{ + storage::well_known_keys, offchain::storage::InMemOffchainStorage as OffchainStorage, }; use sp_runtime::generic::BlockId; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Zero, NumberFor, HashFor}; @@ -519,13 +518,17 @@ impl backend::BlockImportOperation for BlockImportOperatio fn reset_storage(&mut self, storage: Storage) -> sp_blockchain::Result { check_genesis_storage(&storage)?; - let child_delta = storage.children_default.into_iter() + let child_delta = storage.children_default.iter() .map(|(_storage_key, child_content)| - (child_content.child_info, child_content.data.into_iter().map(|(k, v)| (k, Some(v))))); + ( + &child_content.child_info, + child_content.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))) + ) + ); let (root, transaction) = self.old_state.full_storage_root( - storage.top.into_iter().map(|(k, v)| (k, Some(v))), - child_delta + storage.top.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))), + child_delta, ); self.new_state = Some(transaction); diff --git a/client/db/src/bench.rs b/client/db/src/bench.rs index 807e8c68e1..99ce1edae0 100644 --- a/client/db/src/bench.rs +++ b/client/db/src/bench.rs @@ -79,12 +79,12 @@ impl BenchmarkingState { }; state.reopen()?; - let child_delta = genesis.children_default.into_iter().map(|(_storage_key, child_content)| ( - child_content.child_info, - child_content.data.into_iter().map(|(k, v)| (k, Some(v))), + let child_delta = genesis.children_default.iter().map(|(_storage_key, child_content)| ( + &child_content.child_info, + child_content.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))), )); let (root, transaction): (B::Hash, _) = state.state.borrow_mut().as_mut().unwrap().full_storage_root( - genesis.top.into_iter().map(|(k, v)| (k, Some(v))), + genesis.top.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))), child_delta, ); state.genesis = transaction.clone().drain(); @@ -193,19 +193,18 @@ impl StateBackend> for BenchmarkingState { } } - fn storage_root(&self, delta: I) -> (B::Hash, Self::Transaction) where - I: IntoIterator, Option>)> - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (B::Hash, Self::Transaction) where B::Hash: Ord { self.state.borrow().as_ref().map_or(Default::default(), |s| s.storage_root(delta)) } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (B::Hash, bool, Self::Transaction) where - I: IntoIterator, Option>)>, - { + delta: impl Iterator)>, + ) -> (B::Hash, bool, Self::Transaction) where B::Hash: Ord { self.state.borrow().as_ref().map_or(Default::default(), |s| s.child_storage_root(child_info, delta)) } diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 037409dfc4..9fb8f3c8c0 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -212,21 +212,18 @@ impl StateBackend> for RefTrackingState { self.state.for_child_keys_with_prefix(child_info, prefix, f) } - fn storage_root(&self, delta: I) -> (B::Hash, Self::Transaction) - where - I: IntoIterator, Option>)> - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (B::Hash, Self::Transaction) where B::Hash: Ord { self.state.storage_root(delta) } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (B::Hash, bool, Self::Transaction) - where - I: IntoIterator, Option>)>, - { + delta: impl Iterator)>, + ) -> (B::Hash, bool, Self::Transaction) where B::Hash: Ord { self.state.child_storage_root(child_info, delta) } @@ -605,26 +602,25 @@ impl sc_client_api::backend::BlockImportOperation for Bloc &mut self, storage: Storage, ) -> ClientResult { - - if storage.top.iter().any(|(k, _)| well_known_keys::is_child_storage_key(k)) { + if storage.top.keys().any(|k| well_known_keys::is_child_storage_key(&k)) { return Err(sp_blockchain::Error::GenesisInvalid.into()); } - let child_delta = storage.children_default.into_iter().map(|(_storage_key, child_content)|( - child_content.child_info, - child_content.data.into_iter().map(|(k, v)| (k, Some(v))), + let child_delta = storage.children_default.iter().map(|(_storage_key, child_content)|( + &child_content.child_info, + child_content.data.iter().map(|(k, v)| (&k[..], Some(&v[..]))), )); let mut changes_trie_config: Option = None; let (root, transaction) = self.old_state.full_storage_root( - storage.top.into_iter().map(|(k, v)| { - if k == well_known_keys::CHANGES_TRIE_CONFIG { + storage.top.iter().map(|(k, v)| { + if &k[..] == well_known_keys::CHANGES_TRIE_CONFIG { changes_trie_config = Some( Decode::decode(&mut &v[..]) .expect("changes trie configuration is encoded properly at genesis") ); } - (k, Some(v)) + (&k[..], Some(&v[..])) }), child_delta ); @@ -1810,13 +1806,12 @@ pub(crate) mod tests { header.state_root = op.old_state.storage_root(storage .iter() - .cloned() - .map(|(x, y)| (x, Some(y))) + .map(|(x, y)| (&x[..], Some(&y[..]))) ).0.into(); let hash = header.hash(); op.reset_storage(Storage { - top: storage.iter().cloned().collect(), + top: storage.into_iter().collect(), children_default: Default::default(), }).unwrap(); op.set_block_data( @@ -1853,7 +1848,10 @@ pub(crate) mod tests { (vec![5, 5, 5], Some(vec![4, 5, 6])), ]; - let (root, overlay) = op.old_state.storage_root(storage.iter().cloned()); + let (root, overlay) = op.old_state.storage_root( + storage.iter() + .map(|(k, v)| (&k[..], v.as_ref().map(|v| &v[..]))) + ); op.update_db_storage(overlay).unwrap(); header.state_root = root.into(); @@ -1892,17 +1890,11 @@ pub(crate) mod tests { extrinsics_root: Default::default(), }; - let storage: Vec<(_, _)> = vec![]; - - header.state_root = op.old_state.storage_root(storage - .iter() - .cloned() - .map(|(x, y)| (x, Some(y))) - ).0.into(); + header.state_root = op.old_state.storage_root(std::iter::empty()).0.into(); let hash = header.hash(); op.reset_storage(Storage { - top: storage.iter().cloned().collect(), + top: Default::default(), children_default: Default::default(), }).unwrap(); diff --git a/client/db/src/storage_cache.rs b/client/db/src/storage_cache.rs index 66ac74afa4..434b301ed6 100644 --- a/client/db/src/storage_cache.rs +++ b/client/db/src/storage_cache.rs @@ -621,21 +621,18 @@ impl>, B: BlockT> StateBackend> for Cachin self.state.for_child_keys_with_prefix(child_info, prefix, f) } - fn storage_root(&self, delta: I) -> (B::Hash, Self::Transaction) - where - I: IntoIterator, Option>)>, - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (B::Hash, Self::Transaction) where B::Hash: Ord { self.state.storage_root(delta) } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (B::Hash, bool, Self::Transaction) - where - I: IntoIterator, Option>)>, - { + delta: impl Iterator)>, + ) -> (B::Hash, bool, Self::Transaction) where B::Hash: Ord { self.state.child_storage_root(child_info, delta) } @@ -806,21 +803,18 @@ impl>, B: BlockT> StateBackend> for Syncin self.caching_state().for_child_keys_with_prefix(child_info, prefix, f) } - fn storage_root(&self, delta: I) -> (B::Hash, Self::Transaction) - where - I: IntoIterator, Option>)>, - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (B::Hash, Self::Transaction) where B::Hash: Ord { self.caching_state().storage_root(delta) } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (B::Hash, bool, Self::Transaction) - where - I: IntoIterator, Option>)>, - { + delta: impl Iterator)>, + ) -> (B::Hash, bool, Self::Transaction) where B::Hash: Ord { self.caching_state().child_storage_root(child_info, delta) } diff --git a/client/service/src/client/light/backend.rs b/client/service/src/client/light/backend.rs index d336127131..2cf994d3f5 100644 --- a/client/service/src/client/light/backend.rs +++ b/client/service/src/client/light/backend.rs @@ -318,12 +318,12 @@ impl BlockImportOperation for ImportOperation storage.insert(None, input.top); // create a list of children keys to re-compute roots for - let child_delta = input.children_default.iter() - .map(|(_storage_key, storage_child)| (storage_child.child_info.clone(), None)) - .collect::>(); + let child_delta = input.children_default + .iter() + .map(|(_storage_key, storage_child)| (&storage_child.child_info, std::iter::empty())); // make sure to persist the child storage - for (_child_key, storage_child) in input.children_default { + for (_child_key, storage_child) in input.children_default.clone() { storage.insert(Some(storage_child.child_info), storage_child.data); } @@ -350,7 +350,11 @@ impl BlockImportOperation for ImportOperation Ok(()) } - fn mark_finalized(&mut self, block: BlockId, _justification: Option) -> ClientResult<()> { + fn mark_finalized( + &mut self, + block: BlockId, + _justification: Option, + ) -> ClientResult<()> { self.finalized_blocks.push(block); Ok(()) } @@ -459,10 +463,10 @@ impl StateBackend for GenesisOrUnavailableState } } - fn storage_root(&self, delta: I) -> (H::Out, Self::Transaction) - where - I: IntoIterator, Option>)> - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord { match *self { GenesisOrUnavailableState::Genesis(ref state) => state.storage_root(delta), @@ -470,14 +474,11 @@ impl StateBackend for GenesisOrUnavailableState } } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (H::Out, bool, Self::Transaction) - where - I: IntoIterator, Option>)> - { + delta: impl Iterator)>, + ) -> (H::Out, bool, Self::Transaction) where H::Out: Ord { match *self { GenesisOrUnavailableState::Genesis(ref state) => { let (root, is_equal, _) = state.child_storage_root(child_info, delta); diff --git a/primitives/state-machine/src/backend.rs b/primitives/state-machine/src/backend.rs index f689357eb9..20a3ab7500 100644 --- a/primitives/state-machine/src/backend.rs +++ b/primitives/state-machine/src/backend.rs @@ -20,7 +20,6 @@ use hash_db::Hasher; use codec::{Decode, Encode}; use sp_core::{traits::RuntimeCode, storage::{ChildInfo, well_known_keys}}; - use crate::{ trie_backend::TrieBackend, trie_backend_essence::TrieBackendStorage, @@ -119,22 +118,19 @@ pub trait Backend: std::fmt::Debug { /// Calculate the storage root, with given delta over what is already stored in /// the backend, and produce a "transaction" that can be used to commit. /// Does not include child storage updates. - fn storage_root(&self, delta: I) -> (H::Out, Self::Transaction) - where - I: IntoIterator)>, - H::Out: Ord; + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord; /// Calculate the child storage root, with given delta over what is already stored in /// the backend, and produce a "transaction" that can be used to commit. The second argument /// is true if child storage root equals default storage root. - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (H::Out, bool, Self::Transaction) - where - I: IntoIterator)>, - H::Out: Ord; + delta: impl Iterator)>, + ) -> (H::Out, bool, Self::Transaction) where H::Out: Ord; /// Get all key/value pairs into a Vec. fn pairs(&self) -> Vec<(StorageKey, StorageValue)>; @@ -165,17 +161,14 @@ pub trait Backend: std::fmt::Debug { /// Calculate the storage root, with given delta over what is already stored /// in the backend, and produce a "transaction" that can be used to commit. /// Does include child storage updates. - fn full_storage_root( + fn full_storage_root<'a>( &self, - delta: I1, - child_deltas: I2) - -> (H::Out, Self::Transaction) - where - I1: IntoIterator)>, - I2i: IntoIterator)>, - I2: IntoIterator, - H::Out: Ord + Encode, - { + delta: impl Iterator)>, + child_deltas: impl Iterator)>, + )>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord + Encode { let mut txs: Self::Transaction = Default::default(); let mut child_roots: Vec<_> = Default::default(); // child first @@ -190,8 +183,13 @@ pub trait Backend: std::fmt::Debug { child_roots.push((prefixed_storage_key.into_inner(), Some(child_root.encode()))); } } - let (root, parent_txs) = self.storage_root( - delta.into_iter().chain(child_roots.into_iter()) + let (root, parent_txs) = self.storage_root(delta + .map(|(k, v)| (&k[..], v.as_ref().map(|v| &v[..]))) + .chain( + child_roots + .iter() + .map(|(k, v)| (&k[..], v.as_ref().map(|v| &v[..]))) + ) ); txs.consolidate(parent_txs); (root, txs) @@ -214,7 +212,7 @@ pub trait Backend: std::fmt::Debug { } /// Commit given transaction to storage. - fn commit(&self, _storage_root: H::Out, _transaction: Self::Transaction) -> Result<(), Self::Error> { + fn commit(&self, _: H::Out, _: Self::Transaction) -> Result<(), Self::Error> { unimplemented!() } } @@ -269,23 +267,18 @@ impl<'a, T: Backend, H: Hasher> Backend for &'a T { (*self).for_child_keys_with_prefix(child_info, prefix, f) } - fn storage_root(&self, delta: I) -> (H::Out, Self::Transaction) - where - I: IntoIterator)>, - H::Out: Ord, - { + fn storage_root<'b>( + &self, + delta: impl Iterator)>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord { (*self).storage_root(delta) } - fn child_storage_root( + fn child_storage_root<'b>( &self, child_info: &ChildInfo, - delta: I, - ) -> (H::Out, bool, Self::Transaction) - where - I: IntoIterator)>, - H::Out: Ord, - { + delta: impl Iterator)>, + ) -> (H::Out, bool, Self::Transaction) where H::Out: Ord { (*self).child_storage_root(child_info, delta) } diff --git a/primitives/state-machine/src/basic.rs b/primitives/state-machine/src/basic.rs index 7aa75cec70..917e41f33d 100644 --- a/primitives/state-machine/src/basic.rs +++ b/primitives/state-machine/src/basic.rs @@ -295,7 +295,7 @@ impl Externalities for BasicExternalities { child_info: &ChildInfo, ) -> Vec { if let Some(child) = self.inner.children_default.get(child_info.storage_key()) { - let delta = child.data.clone().into_iter().map(|(k, v)| (k, Some(v))); + let delta = child.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))); crate::in_memory_backend::new_in_mem::() .child_storage_root(&child.child_info, delta).0 } else { diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index 25c20644f7..7e805250e7 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -481,7 +481,7 @@ where if let Some(child_info) = self.overlay.default_child_info(storage_key) { let (root, is_empty, _) = { let delta = self.overlay.changes(Some(child_info)) - .map(|(k, v)| (k.clone(), v.value().cloned())); + .map(|(k, v)| (k.as_ref(), v.value().map(AsRef::as_ref))); self.backend.child_storage_root(child_info, delta) }; diff --git a/primitives/state-machine/src/overlayed_changes.rs b/primitives/state-machine/src/overlayed_changes.rs index 2da063c96e..b0259c2b85 100644 --- a/primitives/state-machine/src/overlayed_changes.rs +++ b/primitives/state-machine/src/overlayed_changes.rs @@ -26,13 +26,10 @@ use crate::{ stats::StateMachineStats, }; -#[cfg(test)] -use std::iter::FromIterator; -use std::collections::{HashMap, BTreeMap, BTreeSet}; +use std::{mem, ops, collections::{HashMap, BTreeMap, BTreeSet}}; use codec::{Decode, Encode}; use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo, ChildType}; use sp_core::offchain::storage::OffchainOverlayedChanges; -use std::{mem, ops}; use hash_db::Hasher; @@ -178,7 +175,7 @@ impl Default for StorageChanges } #[cfg(test)] -impl FromIterator<(StorageKey, OverlayedValue)> for OverlayedChangeSet { +impl std::iter::FromIterator<(StorageKey, OverlayedValue)> for OverlayedChangeSet { fn from_iter>(iter: T) -> Self { Self { top: iter.into_iter().collect(), @@ -646,22 +643,29 @@ impl OverlayedChanges { .chain(self.committed.children_default.keys()); let child_delta_iter = child_storage_keys.map(|storage_key| ( - self.default_child_info(storage_key).cloned() + self.default_child_info(storage_key) .expect("child info initialized in either committed or prospective"), self.committed.children_default.get(storage_key) .into_iter() - .flat_map(|(map, _)| map.iter().map(|(k, v)| (k.clone(), v.value.clone()))) + .flat_map(|(map, _)| + map.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) + ) .chain( self.prospective.children_default.get(storage_key) .into_iter() - .flat_map(|(map, _)| map.iter().map(|(k, v)| (k.clone(), v.value.clone()))) + .flat_map(|(map, _)| + map.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) + ) ), ) ); // compute and memoize - let delta = self.committed.top.iter().map(|(k, v)| (k.clone(), v.value.clone())) - .chain(self.prospective.top.iter().map(|(k, v)| (k.clone(), v.value.clone()))); + let delta = self.committed + .top + .iter() + .map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) + .chain(self.prospective.top.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..])))); let (root, transaction) = backend.full_storage_root(delta, child_delta_iter); diff --git a/primitives/state-machine/src/proving_backend.rs b/primitives/state-machine/src/proving_backend.rs index 1d38d578a2..1f25005bc3 100644 --- a/primitives/state-machine/src/proving_backend.rs +++ b/primitives/state-machine/src/proving_backend.rs @@ -17,7 +17,7 @@ //! Proving state machine backend. -use std::sync::Arc; +use std::{sync::Arc, collections::HashMap}; use parking_lot::RwLock; use codec::{Decode, Codec}; use log::debug; @@ -26,13 +26,10 @@ use sp_trie::{ MemoryDB, empty_child_trie_root, read_trie_value_with, read_child_trie_value_with, record_all_keys, StorageProof, }; -pub use sp_trie::Recorder; -pub use sp_trie::trie_types::{Layout, TrieError}; +pub use sp_trie::{Recorder, trie_types::{Layout, TrieError}}; use crate::trie_backend::TrieBackend; use crate::trie_backend_essence::{Ephemeral, TrieBackendEssence, TrieBackendStorage}; -use crate::{Error, ExecutionError, Backend}; -use std::collections::HashMap; -use crate::DBValue; +use crate::{Error, ExecutionError, Backend, DBValue}; use sp_core::storage::ChildInfo; /// Patricia trie-based backend specialized in get value proofs. @@ -260,21 +257,18 @@ impl<'a, S, H> Backend for ProvingBackend<'a, S, H> self.0.child_keys(child_info, prefix) } - fn storage_root(&self, delta: I) -> (H::Out, Self::Transaction) - where I: IntoIterator, Option>)> - { + fn storage_root<'b>( + &self, + delta: impl Iterator)>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord { self.0.storage_root(delta) } - fn child_storage_root( + fn child_storage_root<'b>( &self, child_info: &ChildInfo, - delta: I, - ) -> (H::Out, bool, Self::Transaction) - where - I: IntoIterator, Option>)>, - H::Out: Ord - { + delta: impl Iterator)>, + ) -> (H::Out, bool, Self::Transaction) where H::Out: Ord { self.0.child_storage_root(child_info, delta) } @@ -393,9 +387,9 @@ mod tests { let in_memory = InMemoryBackend::::default(); let mut in_memory = in_memory.update(contents); let child_storage_keys = vec![child_info_1.to_owned(), child_info_2.to_owned()]; - let in_memory_root = in_memory.full_storage_root::<_, Vec<_>, _>( - ::std::iter::empty(), - child_storage_keys.into_iter().map(|k|(k.to_owned(), Vec::new())) + let in_memory_root = in_memory.full_storage_root( + std::iter::empty(), + child_storage_keys.iter().map(|k|(k, std::iter::empty())) ).0; (0..64).for_each(|i| assert_eq!( in_memory.storage(&[i]).unwrap().unwrap(), diff --git a/primitives/state-machine/src/trie_backend.rs b/primitives/state-machine/src/trie_backend.rs index 3016647191..2d4ab782cb 100644 --- a/primitives/state-machine/src/trie_backend.rs +++ b/primitives/state-machine/src/trie_backend.rs @@ -167,9 +167,10 @@ impl, H: Hasher> Backend for TrieBackend where collect_all().map_err(|e| debug!(target: "trie", "Error extracting trie keys: {}", e)).unwrap_or_default() } - fn storage_root(&self, delta: I) -> (H::Out, S::Overlay) - where I: IntoIterator)> - { + fn storage_root<'a>( + &self, + delta: impl Iterator)>, + ) -> (H::Out, Self::Transaction) where H::Out: Ord { let mut write_overlay = S::Overlay::default(); let mut root = *self.essence.root(); @@ -179,8 +180,7 @@ impl, H: Hasher> Backend for TrieBackend where &mut write_overlay, ); - let delta: Vec<_> = delta.into_iter().collect(); - match delta_trie_root::, _, _, _, _>(&mut eph, root, delta) { + match delta_trie_root::, _, _, _, _, _>(&mut eph, root, delta) { Ok(ret) => root = ret, Err(e) => warn!(target: "trie", "Failed to write to trie: {}", e), } @@ -189,15 +189,11 @@ impl, H: Hasher> Backend for TrieBackend where (root, write_overlay) } - fn child_storage_root( + fn child_storage_root<'a>( &self, child_info: &ChildInfo, - delta: I, - ) -> (H::Out, bool, Self::Transaction) - where - I: IntoIterator)>, - H::Out: Ord, - { + delta: impl Iterator)>, + ) -> (H::Out, bool, Self::Transaction) where H::Out: Ord { let default_root = match child_info.child_type() { ChildType::ParentKeyId => empty_child_trie_root::>() }; @@ -219,11 +215,11 @@ impl, H: Hasher> Backend for TrieBackend where &mut write_overlay, ); - match child_delta_trie_root::, _, _, _, _, _>( + match child_delta_trie_root::, _, _, _, _, _, _>( child_info.keyspace(), &mut eph, root, - delta + delta, ) { Ok(ret) => root = ret, Err(e) => warn!(target: "trie", "Failed to write to trie: {}", e), @@ -252,7 +248,7 @@ impl, H: Hasher> Backend for TrieBackend where #[cfg(test)] pub mod tests { - use std::collections::HashSet; + use std::{collections::HashSet, iter}; use sp_core::H256; use codec::Encode; use sp_trie::{TrieMut, PrefixedMemoryDB, trie_types::TrieDBMut, KeySpacedDBMut}; @@ -328,19 +324,21 @@ pub mod tests { #[test] fn storage_root_is_non_default() { - assert!(test_trie().storage_root(::std::iter::empty()).0 != H256::repeat_byte(0)); + assert!(test_trie().storage_root(iter::empty()).0 != H256::repeat_byte(0)); } #[test] fn storage_root_transaction_is_empty() { - assert!(test_trie().storage_root(::std::iter::empty()).1.drain().is_empty()); + assert!(test_trie().storage_root(iter::empty()).1.drain().is_empty()); } #[test] fn storage_root_transaction_is_non_empty() { - let (new_root, mut tx) = test_trie().storage_root(vec![(b"new-key".to_vec(), Some(b"new-value".to_vec()))]); + let (new_root, mut tx) = test_trie().storage_root( + iter::once((&b"new-key"[..], Some(&b"new-value"[..]))), + ); assert!(!tx.drain().is_empty()); - assert!(new_root != test_trie().storage_root(::std::iter::empty()).0); + assert!(new_root != test_trie().storage_root(iter::empty()).0); } #[test] diff --git a/primitives/trie/src/lib.rs b/primitives/trie/src/lib.rs index f328b71750..db471fd713 100644 --- a/primitives/trie/src/lib.rs +++ b/primitives/trie/src/lib.rs @@ -24,9 +24,7 @@ mod node_codec; mod storage_proof; mod trie_stream; -use sp_std::boxed::Box; -use sp_std::marker::PhantomData; -use sp_std::vec::Vec; +use sp_std::{boxed::Box, marker::PhantomData, vec::Vec, borrow::Borrow}; use hash_db::{Hasher, Prefix}; use trie_db::proof::{generate_proof, verify_proof}; pub use trie_db::proof::VerifyError; @@ -162,23 +160,24 @@ pub fn verify_trie_proof<'a, L: TrieConfiguration, I, K, V>( } /// Determine a trie root given a hash DB and delta values. -pub fn delta_trie_root( +pub fn delta_trie_root( db: &mut DB, mut root: TrieHash, delta: I ) -> Result, Box>> where - I: IntoIterator)>, - A: AsRef<[u8]> + Ord, - B: AsRef<[u8]>, + I: IntoIterator, + A: Borrow<[u8]>, + B: Borrow>, + V: Borrow<[u8]>, DB: hash_db::HashDB, { { let mut trie = TrieDBMut::::from_existing(&mut *db, &mut root)?; for (key, change) in delta { - match change { - Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, + match change.borrow() { + Some(val) => trie.insert(key.borrow(), val.borrow())?, + None => trie.remove(key.borrow())?, }; } } @@ -230,16 +229,17 @@ pub fn child_trie_root( /// Determine a child trie root given a hash DB and delta values. H is the default hasher, /// but a generic implementation may ignore this type parameter and use other hashers. -pub fn child_delta_trie_root( +pub fn child_delta_trie_root( keyspace: &[u8], db: &mut DB, root_data: RD, delta: I, ) -> Result<::Out, Box>> where - I: IntoIterator)>, - A: AsRef<[u8]> + Ord, - B: AsRef<[u8]>, + I: IntoIterator, + A: Borrow<[u8]>, + B: Borrow>, + V: Borrow<[u8]>, RD: AsRef<[u8]>, DB: hash_db::HashDB { @@ -252,9 +252,9 @@ pub fn child_delta_trie_root( let mut trie = TrieDBMut::::from_existing(&mut db, &mut root)?; for (key, change) in delta { - match change { - Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, + match change.borrow() { + Some(val) => trie.insert(key.borrow(), val.borrow())?, + None => trie.remove(key.borrow())?, }; } } -- GitLab From b8c493d0af30674f7d4a2ad6f179b264a295b1e9 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Sat, 23 May 2020 20:08:42 +0200 Subject: [PATCH 049/280] First draft of offchain phragmen weights (#6032) * Fist draft of offchain weights * Round of review feedback * Update frame/staking/src/lib.rs * Fix fuzzer * Remove some redundant comment * Weight refund for submit solution -- potentially revert. * First version with custom trimming of the result. * Update frame/staking/src/benchmarking.rs Co-authored-by: Alexander Popiak * Update frame/staking/src/benchmarking.rs Co-authored-by: Alexander Popiak * Apply suggestions from code review Co-authored-by: Alexander Popiak Co-authored-by: thiolliere * Update frame/staking/src/benchmarking.rs Co-authored-by: Alexander Popiak * Update frame/staking/src/benchmarking.rs Co-authored-by: Alexander Popiak * Some improvements * Benchmark submit solution without phragmen (PR for First draft of offchain phragmen weights) (#6073) * implementation of new benchmark * address comments * replace test * Update frame/staking/src/lib.rs Co-authored-by: Alexander Popiak * update weight * Fix refund * Clean and rady for final bench * Fix line-wdith * Fix gitlab build * Fix line-wdith * Fix test macro * Update frame/staking/src/lib.rs Co-authored-by: Alexander Popiak * Update frame/staking/src/benchmarking.rs Co-authored-by: Alexander Popiak * Better length check * Update frame/staking/src/lib.rs Co-authored-by: Alexander Popiak * Update final weight coefficients * Update frame/staking/src/lib.rs * Apply suggestions from code review * Update frame/staking/src/testing_utils.rs * Try and fix the line-width * Revert "Try and fix the line-width" This reverts commit b4e284727220085b9b3daf7682c4bbf29621da09. * Try and fix the line-width the correct way * Revert "Try and fix the line-width the correct way" This reverts commit 04fce128e851c9584f9f0d708a5a73cae799d8c8. Co-authored-by: Alexander Popiak Co-authored-by: thiolliere Co-authored-by: Gavin Wood --- .gitlab-ci.yml | 2 +- Cargo.lock | 798 ++++++++++---------- frame/staking/Cargo.toml | 20 +- frame/staking/fuzzer/Cargo.toml | 2 +- frame/staking/fuzzer/src/submit_solution.rs | 67 +- frame/staking/src/benchmarking.rs | 333 +++++--- frame/staking/src/lib.rs | 235 ++++-- frame/staking/src/offchain_election.rs | 20 +- frame/staking/src/testing_utils.rs | 384 +++++----- frame/staking/src/tests.rs | 133 ++-- frame/support/src/lib.rs | 1 + primitives/phragmen/compact/src/lib.rs | 39 + primitives/phragmen/src/tests.rs | 14 + utils/frame/benchmarking-cli/src/command.rs | 9 +- 14 files changed, 1202 insertions(+), 855 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d41a86f302..0944ec8cde 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -235,7 +235,7 @@ test-frame-staking: - $DEPLOY_TAG script: - cd frame/staking/ - - WASM_BUILD_NO_COLOR=1 time cargo test --release --verbose --no-default-features --features "std testing-utils" + - WASM_BUILD_NO_COLOR=1 time cargo test --release --verbose --no-default-features --features "std" - sccache -s test-frame-examples-compile-to-wasm: diff --git a/Cargo.lock b/Cargo.lock index 23229c365c..fc2c435b3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,6 +10,15 @@ dependencies = [ "regex", ] +[[package]] +name = "addr2line" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456d75cbb82da1ad150c8a9d97285ffcd21c9931dcb11e995903e7d75141b38b" +dependencies = [ + "gimli 0.21.0", +] + [[package]] name = "adler32" version = "1.0.4" @@ -99,9 +108,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" +checksum = "2494382e9ba43995f3c56359e518641f450f5c36feeb4632a75cde2ec297c867" [[package]] name = "app_dirs" @@ -126,15 +135,15 @@ dependencies = [ [[package]] name = "arbitrary" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75153c95fdedd7db9732dfbfc3702324a1627eec91ba56e37cd0ac78314ab2ed" +checksum = "c5eb01a9ab8a3369f2f7632b9461c34f5920bd454774bab5b9fc6744f21d6143" [[package]] name = "arc-swap" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825" +checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" [[package]] name = "arrayref" @@ -172,8 +181,8 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -237,7 +246,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "rustls", "webpki", "webpki-roots 0.19.0", @@ -268,26 +277,17 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" +checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" dependencies = [ - "backtrace-sys", + "addr2line", "cfg-if", "libc", + "object 0.19.0", "rustc-demangle", ] -[[package]] -name = "backtrace-sys" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "base58" version = "0.1.0" @@ -302,9 +302,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3" +checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" [[package]] name = "bincode" @@ -333,7 +333,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.3", + "quote 1.0.5", "regex", "rustc-hash", "shlex", @@ -458,9 +458,9 @@ checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" [[package]] name = "bstr" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" +checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" dependencies = [ "lazy_static", "memchr", @@ -479,9 +479,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" +checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6" [[package]] name = "byte-slice-cast" @@ -553,9 +553,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.50" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" dependencies = [ "jobserver", ] @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.0" +version = "2.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" dependencies = [ "ansi_term 0.11.0", "atty", @@ -745,7 +745,7 @@ dependencies = [ "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli", + "gimli 0.20.0", "log", "regalloc", "serde", @@ -837,7 +837,7 @@ dependencies = [ "clap", "criterion-plot 0.3.1", "csv", - "itertools", + "itertools 0.8.2", "lazy_static", "libc", "num-traits 0.2.11", @@ -855,16 +855,16 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc755679c12bda8e5523a71e4d654b6bf2e14bd838dfc48cde6559a05caf7d1" +checksum = "63f696897c88b57f4ffe3c69d8e1a0613c7d0e6c4833363c8560fbde9c47b966" dependencies = [ "atty", "cast", "clap", - "criterion-plot 0.4.1", + "criterion-plot 0.4.2", "csv", - "itertools", + "itertools 0.9.0", "lazy_static", "num-traits 0.2.11", "oorandom", @@ -886,17 +886,17 @@ checksum = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" dependencies = [ "byteorder 1.3.4", "cast", - "itertools", + "itertools 0.8.2", ] [[package]] name = "criterion-plot" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545" +checksum = "ddeaf7989f00f2e1d871a26a110f3ed713632feac17f65f03ca938c542618b60" dependencies = [ "cast", - "itertools", + "itertools 0.9.0", ] [[package]] @@ -1005,12 +1005,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" +checksum = "cf6b25ee9ac1995c54d7adb2eff8cfffb7260bc774fb63c601ec65467f43cd9d" dependencies = [ - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1054,13 +1054,13 @@ checksum = "11c0346158a19b3627234e15596f5e465c360fcdb97d817bcb255e0510f5a788" [[package]] name = "derive_more" -version = "0.99.5" +version = "0.99.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" +checksum = "46b046a346c374c6c3c84d2070bfe33904504686bdf949c2d8eb22edad3f270c" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1147,22 +1147,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a80e524ebf194285b57e5e7944018721c7fffc673253f5183f7accd88a2a3b0c" +checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ed9afacaea0301eefb738c9deea725e6d53938004597cdc518a8cf9a7aa2f03" +checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1279,7 +1279,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", ] [[package]] @@ -1299,9 +1299,9 @@ dependencies = [ [[package]] name = "failure" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" dependencies = [ "backtrace", "failure_derive", @@ -1309,13 +1309,13 @@ dependencies = [ [[package]] name = "failure_derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "synstructure", ] @@ -1357,7 +1357,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" dependencies = [ "either", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 2.0.2", "log", "num-traits 0.2.11", @@ -1368,9 +1368,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ "byteorder 1.3.4", "rand 0.7.3", @@ -1505,8 +1505,8 @@ version = "2.0.0-dev" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1516,8 +1516,8 @@ dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1525,8 +1525,8 @@ name = "frame-support-procedural-tools-derive" version = "2.0.0-dev" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -1645,9 +1645,9 @@ checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" dependencies = [ "futures-channel", "futures-core", @@ -1660,9 +1660,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" dependencies = [ "futures-core", "futures-sink", @@ -1679,9 +1679,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" [[package]] name = "futures-core-preview" @@ -1706,7 +1706,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "log", "parking_lot 0.9.0", @@ -1717,9 +1717,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" dependencies = [ "futures-core", "futures-task", @@ -1729,33 +1729,36 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" [[package]] name = "futures-macro" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] name = "futures-sink" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" [[package]] name = "futures-task" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] [[package]] name = "futures-timer" @@ -1775,9 +1778,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ "futures 0.1.29", "futures-channel", @@ -1787,6 +1790,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1812,7 +1816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "memchr", "pin-project", ] @@ -1880,6 +1884,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" + [[package]] name = "glob" version = "0.2.11" @@ -1949,9 +1959,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" dependencies = [ "bytes 0.5.4", "fnv", @@ -1962,7 +1972,7 @@ dependencies = [ "indexmap", "log", "slab", - "tokio 0.2.18", + "tokio 0.2.21", "tokio-util", ] @@ -2002,9 +2012,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" +checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" dependencies = [ "libc", ] @@ -2157,15 +2167,15 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6081100e960d9d74734659ffc9cc91daf1c0fc7aceb8eaa94ee1a3f5046f2e" +checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" dependencies = [ "bytes 0.5.4", "futures-channel", "futures-core", "futures-util", - "h2 0.2.4", + "h2 0.2.5", "http 0.2.1", "http-body 0.3.1", "httparse", @@ -2174,7 +2184,7 @@ dependencies = [ "net2", "pin-project", "time", - "tokio 0.2.18", + "tokio 0.2.21", "tower-service", "want 0.3.0", ] @@ -2188,11 +2198,11 @@ dependencies = [ "bytes 0.5.4", "ct-logs", "futures-util", - "hyper 0.13.4", + "hyper 0.13.5", "log", "rustls", "rustls-native-certs", - "tokio 0.2.18", + "tokio 0.2.21", "tokio-rustls", "webpki", ] @@ -2248,9 +2258,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bbe9ea9b182f0fb1cabbd61f4ff9b7b7b9197955e95a7e4c27de5055eb29ff8" +checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" dependencies = [ "serde", ] @@ -2262,8 +2272,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -2287,7 +2297,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 2.0.2", ] @@ -2321,6 +2331,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.5" @@ -2338,9 +2357,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.37" +version = "0.3.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" +checksum = "fa5a448de267e7358beaf4a5d849518fe9a0c13fce7afd44b06e68550e5562a7" dependencies = [ "wasm-bindgen", ] @@ -2392,8 +2411,8 @@ checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -2482,9 +2501,9 @@ dependencies = [ [[package]] name = "kv-log-macro" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" +checksum = "2a2d3beed37e5483887d81eb39de6de03a8346531410e1306ca48a9a89bd3a51" dependencies = [ "log", ] @@ -2534,7 +2553,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c7f36acb1841d4c701d30ae1f2cfd242e805991443f75f6935479ed3de64903" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "kvdb", "kvdb-memorydb", @@ -2565,22 +2584,28 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" +checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" [[package]] name = "libflate" -version = "0.1.27" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" +checksum = "a1fbe6b967a94346446d37ace319ae85be7eca261bb8149325811ac435d35d64" dependencies = [ "adler32", "crc32fast", + "libflate_lz77", "rle-decode-fast", - "take_mut", ] +[[package]] +name = "libflate_lz77" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b" + [[package]] name = "libloading" version = "0.5.2" @@ -2604,7 +2629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ec214d189b57e4412f079ac5a1442578d06b12ca7282ba4696104cc92ab96c1" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "libp2p-core-derive", @@ -2646,7 +2671,7 @@ dependencies = [ "ed25519-dalek", "either", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", @@ -2675,8 +2700,8 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67f0d915bee5d457a6d113377101e1f06e86a4286778aa4c6939553e9a4d7033" dependencies = [ - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -2686,7 +2711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "975c847575ef9b3d63f9c11d465e9a9b0ea940cfa408b93cc6981bbc3b1bac40" dependencies = [ "flate2", - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", ] @@ -2696,7 +2721,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", ] @@ -2709,7 +2734,7 @@ checksum = "c6dd8cc558e0edde2d4a423d017efd6b36c1b6bf97f4304c83076895c5edaed8" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "libp2p-swarm", "prost", @@ -2728,7 +2753,7 @@ dependencies = [ "byteorder 1.3.4", "bytes 0.5.4", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures_codec", "libp2p-core", "libp2p-swarm", @@ -2749,7 +2774,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a455af71c59473444eba05e83dbaa20262bdbd9b4154f22389510fbac16f201" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "libp2p-swarm", "log", @@ -2769,7 +2794,7 @@ dependencies = [ "bytes 0.5.4", "either", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures_codec", "libp2p-core", "libp2p-swarm", @@ -2796,7 +2821,7 @@ dependencies = [ "data-encoding", "dns-parser", "either", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "libp2p-swarm", @@ -2816,7 +2841,7 @@ checksum = "4095bce2100f840883f1f75dbd010c966ee4ad323ae9f82026396da5cf6cce68" dependencies = [ "bytes 0.5.4", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures_codec", "libp2p-core", "log", @@ -2831,7 +2856,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84fd504e27b0eadd451e06b67694ef714bd8374044e7db339bb0cdb83755ddf4" dependencies = [ "curve25519-dalek", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "log", @@ -2851,7 +2876,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82930c36490008b1ef2f26c237a2c205c38ef6edc263738d0528b842740ab09f" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "libp2p-swarm", "log", @@ -2867,7 +2892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad28fe7beaa3e516ee8ba2af8c4f6820f269afa60d661831e879f2afea64f4a0" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "futures_codec", "libp2p-core", "log", @@ -2884,7 +2909,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dabaa2194e1ce3c51cd78d734dd4c81dc5c7b150b309cbf9029df044034ac261" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "log", "pin-project", "rand 0.7.3", @@ -2900,7 +2925,7 @@ checksum = "22e30b873276846181fa9c04126653678c2797cb1556361d01b7b7fd6bf24682" dependencies = [ "aes-ctr", "ctr", - "futures 0.3.4", + "futures 0.3.5", "hmac", "js-sys", "lazy_static", @@ -2928,7 +2953,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4a8101a0e0d5f04562137a476bf5f5423cd5bdab2f7e43a75909668e63cb102" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", "rand 0.7.3", @@ -2944,7 +2969,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4462bd96b97cac3f3a83b1b343ad3c3460cebbc8d929c040b1520c30e3611e08" dependencies = [ "async-std", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "get_if_addrs", "ipnet", @@ -2960,7 +2985,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69660d235449bb2d99333b9892c9176d06fd2b380490cb8213feb5b015678cf1" dependencies = [ "async-std", - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", ] @@ -2971,7 +2996,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -2988,7 +3013,7 @@ dependencies = [ "async-tls", "bytes 0.5.4", "either", - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", "quicksink", @@ -3006,7 +3031,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b305d3a8981e68f11c0e17f2d11d5c52fae95e0d7c283f9e462b5b2dab413b2" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "parking_lot 0.10.2", "thiserror", @@ -3055,9 +3080,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" [[package]] name = "linked_hash_set" @@ -3211,9 +3236,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.21" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ "cfg-if", "fuchsia-zircon", @@ -3242,9 +3267,9 @@ dependencies = [ [[package]] name = "mio-uds" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" dependencies = [ "iovec", "libc", @@ -3297,7 +3322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74cdcf7cfb3402881e15a1f95116cb033d69b33c83d481e1234777f5ef0c3d2c" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "log", "pin-project", "smallvec 1.4.0", @@ -3332,9 +3357,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", @@ -3401,7 +3426,7 @@ dependencies = [ name = "node-browser-testing" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "jsonrpc-core", "libp2p", @@ -3422,7 +3447,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-support", "frame-system", - "futures 0.3.4", + "futures 0.3.5", "hex-literal", "jsonrpc-core", "log", @@ -3492,7 +3517,7 @@ dependencies = [ name = "node-executor" version = "2.0.0-dev" dependencies = [ - "criterion 0.3.1", + "criterion 0.3.2", "frame-benchmarking", "frame-support", "frame-system", @@ -3660,7 +3685,7 @@ dependencies = [ name = "node-template" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "log", "node-template-runtime", "parking_lot 0.10.2", @@ -3721,11 +3746,11 @@ dependencies = [ name = "node-testing" version = "2.0.0-dev" dependencies = [ - "criterion 0.3.1", + "criterion 0.3.2", "frame-support", "frame-system", "fs_extra", - "futures 0.3.4", + "futures 0.3.5", "log", "node-executor", "node-primitives", @@ -3787,9 +3812,9 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26e041cd983acbc087e30fcba770380cfa352d0e392e175b2344ebaf7ea0602" +checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" dependencies = [ "winapi 0.3.8", ] @@ -3858,9 +3883,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", "libc", @@ -3875,6 +3900,12 @@ dependencies = [ "target-lexicon", ] +[[package]] +name = "object" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" + [[package]] name = "ole32-sys" version = "0.2.0" @@ -3887,18 +3918,18 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" +checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" dependencies = [ - "parking_lot 0.9.0", + "parking_lot 0.10.2", ] [[package]] name = "oorandom" -version = "11.1.0" +version = "11.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405" +checksum = "94af325bc33c7f60191be4e2c984d48aaa21e2854f473b85398344b60c9b6358" [[package]] name = "opaque-debug" @@ -4548,13 +4579,11 @@ dependencies = [ "hex", "pallet-authorship", "pallet-balances", - "pallet-indices", "pallet-session", "pallet-staking-reward-curve", "pallet-timestamp", "parity-scale-codec", "parking_lot 0.10.2", - "rand 0.7.3", "rand_chacha 0.2.2", "serde", "sp-application-crypto", @@ -4596,9 +4625,9 @@ version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.5", "sp-runtime", - "syn 1.0.17", + "syn 1.0.21", ] [[package]] @@ -4829,8 +4858,8 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -4861,7 +4890,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2", - "syn 1.0.17", + "syn 1.0.21", "synstructure", ] @@ -4898,7 +4927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ "lock_api", - "parking_lot_core 0.7.1", + "parking_lot_core 0.7.2", ] [[package]] @@ -4918,9 +4947,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if", "cloudabi", @@ -4932,9 +4961,9 @@ dependencies = [ [[package]] name = "paste" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4fb1930692d1b6a9cfabdde3d06ea0a7d186518e2f4d67660d8970e2fa647a" +checksum = "0a229b1c58c692edcaa5b9b0948084f130f55d2dcc15b02fcc5340b2b4521476" dependencies = [ "paste-impl", "proc-macro-hack", @@ -4942,14 +4971,14 @@ dependencies = [ [[package]] name = "paste-impl" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" +checksum = "2e0bf239e447e67ff6d16a8bb5e4d4bd2343acf5066061c0e8e06ac5ba8ca68c" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -4998,35 +5027,35 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.9" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" +checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.9" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" +checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] name = "pin-project-lite" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" +checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" [[package]] name = "pin-utils" -version = "0.1.0-alpha.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" @@ -5048,9 +5077,9 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" [[package]] name = "plotters" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb" +checksum = "f9b1d9ca091d370ea3a78d5619145d1b59426ab0c9eedbad2514a4cee08bf389" dependencies = [ "js-sys", "num-traits 0.2.11", @@ -5104,14 +5133,14 @@ dependencies = [ [[package]] name = "primitive-types" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.3.0", + "impl-serde 0.3.1", "uint", ] @@ -5132,8 +5161,8 @@ checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "version_check", ] @@ -5144,8 +5173,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "syn-mid", "version_check", ] @@ -5164,18 +5193,18 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" +checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319" dependencies = [ "unicode-xid 0.2.0", ] [[package]] name = "procfs" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe50036aa1b71e553a4a0c48ab7baabf8aa8c7a5a61aae06bf38c2eab7430475" +checksum = "c434e93ef69c216e68e4f417c927b4f31502c3560b72cfdb6827e2321c5c6b3e" dependencies = [ "bitflags", "byteorder 1.3.4", @@ -5218,7 +5247,7 @@ checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" dependencies = [ "bytes 0.5.4", "heck", - "itertools", + "itertools 0.8.2", "log", "multimap", "petgraph", @@ -5235,10 +5264,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", - "itertools", + "itertools 0.8.2", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -5305,9 +5334,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e" dependencies = [ "proc-macro2", ] @@ -5605,8 +5634,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -5622,9 +5651,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.6" +version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" +checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" dependencies = [ "aho-corasick", "memchr", @@ -5670,13 +5699,13 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.12" +version = "0.16.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" +checksum = "703516ae74571f24b465b4a1431e81e2ad51336cb0ded733a55a1aa3eccac196" dependencies = [ "cc", - "lazy_static", "libc", + "once_cell", "spin", "untrusted", "web-sys", @@ -5789,8 +5818,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -5799,16 +5828,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "pin-project", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" +checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" [[package]] name = "safe-mix" @@ -5855,7 +5884,7 @@ dependencies = [ "bytes 0.5.4", "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -5882,7 +5911,7 @@ dependencies = [ name = "sc-basic-authorship" version = "0.8.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -5942,8 +5971,8 @@ version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -5957,7 +5986,7 @@ dependencies = [ "derive_more", "env_logger 0.7.1", "fdlimit", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "log", "names", @@ -5984,7 +6013,7 @@ dependencies = [ "substrate-prometheus-endpoint", "tempfile", "time", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] @@ -5993,7 +6022,7 @@ version = "2.0.0-dev" dependencies = [ "derive_more", "fnv", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "hex-literal", "kvdb", @@ -6074,7 +6103,7 @@ version = "0.8.0-dev" dependencies = [ "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6113,7 +6142,7 @@ dependencies = [ "derive_more", "env_logger 0.7.1", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "merlin", @@ -6161,7 +6190,7 @@ name = "sc-consensus-babe-rpc" version = "0.8.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6203,7 +6232,7 @@ dependencies = [ "assert_matches", "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6223,7 +6252,7 @@ dependencies = [ "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", "tempfile", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] @@ -6231,7 +6260,7 @@ name = "sc-consensus-pow" version = "0.8.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-scale-codec", "sc-client-api", @@ -6251,7 +6280,7 @@ dependencies = [ name = "sc-consensus-slots" version = "0.8.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6377,7 +6406,7 @@ dependencies = [ "env_logger 0.7.1", "finality-grandpa", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6409,7 +6438,7 @@ dependencies = [ "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] @@ -6418,7 +6447,7 @@ version = "0.8.0-dev" dependencies = [ "derive_more", "finality-grandpa", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6434,7 +6463,7 @@ name = "sc-informant" version = "0.8.0-dev" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-util-mem", "sc-client-api", @@ -6475,7 +6504,7 @@ dependencies = [ "erased-serde", "fnv", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "futures_codec", "hex", @@ -6525,7 +6554,7 @@ name = "sc-network-gossip" version = "0.8.0-dev" dependencies = [ "async-std", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6543,7 +6572,7 @@ name = "sc-network-test" version = "0.8.0-dev" dependencies = [ "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6572,9 +6601,9 @@ dependencies = [ "env_logger 0.7.1", "fdlimit", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", - "hyper 0.13.4", + "hyper 0.13.5", "hyper-rustls", "log", "num_cpus", @@ -6594,14 +6623,14 @@ dependencies = [ "sp-utils", "substrate-test-runtime-client", "threadpool", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] name = "sc-peerset" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p", "log", "rand 0.7.3", @@ -6624,7 +6653,7 @@ version = "2.0.0-dev" dependencies = [ "assert_matches", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", @@ -6662,7 +6691,7 @@ name = "sc-rpc-api" version = "0.8.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6714,7 +6743,7 @@ dependencies = [ "derive_more", "exit-future", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "hash-db", "lazy_static", @@ -6775,7 +6804,7 @@ dependencies = [ "env_logger 0.7.1", "fdlimit", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "hex-literal", "log", "parity-scale-codec", @@ -6822,7 +6851,7 @@ name = "sc-telemetry" version = "2.0.0-dev" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6858,9 +6887,9 @@ name = "sc-transaction-graph" version = "2.0.0-dev" dependencies = [ "assert_matches", - "criterion 0.3.1", + "criterion 0.3.2", "derive_more", - "futures 0.3.4", + "futures 0.3.5", "linked-hash-map", "log", "parity-scale-codec", @@ -6882,7 +6911,7 @@ version = "2.0.0-dev" dependencies = [ "assert_matches", "derive_more", - "futures 0.3.4", + "futures 0.3.5", "futures-diagnose", "hex", "intervalier", @@ -6908,9 +6937,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", "winapi 0.3.8", @@ -6957,13 +6986,13 @@ dependencies = [ [[package]] name = "scroll_derive" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" +checksum = "e367622f934864ffa1c704ba2b82280aab856e3d8213c84c5720257eb34b15b9" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -6978,9 +7007,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" +checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" dependencies = [ "bitflags", "core-foundation", @@ -6991,9 +7020,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" +checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" dependencies = [ "core-foundation-sys", "libc", @@ -7044,29 +7073,29 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.106" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.106" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" +checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] name = "serde_json" -version = "1.0.51" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" +checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" dependencies = [ "itoa", "ryu", @@ -7188,8 +7217,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -7246,7 +7275,7 @@ dependencies = [ "base64 0.11.0", "bytes 0.5.4", "flate2", - "futures 0.3.4", + "futures 0.3.5", "http 0.2.1", "httparse", "log", @@ -7290,15 +7319,15 @@ dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] name = "sp-api-test" version = "2.0.0-dev" dependencies = [ - "criterion 0.3.1", + "criterion 0.3.2", "parity-scale-codec", "rustversion", "sc-block-builder", @@ -7339,7 +7368,7 @@ dependencies = [ name = "sp-arithmetic" version = "2.0.0-dev" dependencies = [ - "criterion 0.3.1", + "criterion 0.3.2", "integer-sqrt", "num-traits 0.2.11", "parity-scale-codec", @@ -7422,7 +7451,7 @@ name = "sp-consensus" version = "0.8.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -7501,12 +7530,12 @@ dependencies = [ "criterion 0.2.11", "derive_more", "ed25519-dalek", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "hash256-std-hasher", "hex", "hex-literal", - "impl-serde 0.3.0", + "impl-serde 0.3.1", "lazy_static", "libsecp256k1", "log", @@ -7550,8 +7579,8 @@ name = "sp-debug-derive" version = "2.0.0-dev" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -7603,7 +7632,7 @@ dependencies = [ name = "sp-io" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "hash-db", "libsecp256k1", "log", @@ -7667,8 +7696,8 @@ version = "2.0.0-dev" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -7740,8 +7769,8 @@ dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -7896,7 +7925,7 @@ name = "sp-transaction-pool" version = "2.0.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-scale-codec", "serde", @@ -7927,7 +7956,7 @@ dependencies = [ name = "sp-utils" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-core", "lazy_static", "prometheus", @@ -8016,9 +8045,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6da2e8d107dfd7b74df5ef4d205c6aebee0706c647f6bc6a2d5789905c00fb" +checksum = "863246aaf5ddd0d6928dfeb1a9ca65f505599e4e1b399935ef7e75107516b4ef" dependencies = [ "clap", "lazy_static", @@ -8027,15 +8056,15 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a489c87c08fbaf12e386665109dd13470dcc9c4583ea3e10dd2b4523e5ebd9ac" +checksum = "d239ca4b13aee7a2142e6795cbd69e457665ff8037aed33b3effdc430d2f927a" dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -8055,8 +8084,8 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -8070,7 +8099,7 @@ dependencies = [ "hex", "hex-literal", "hyper 0.12.35", - "itertools", + "itertools 0.8.2", "jsonrpc-core-client", "libp2p", "node-primitives", @@ -8110,7 +8139,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "js-sys", "kvdb-web", @@ -8140,14 +8169,14 @@ version = "2.0.0-dev" dependencies = [ "frame-support", "frame-system", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-client-transports", "jsonrpc-core", "parity-scale-codec", "sc-rpc-api", "serde", "sp-storage", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] @@ -8156,7 +8185,7 @@ version = "2.0.0-dev" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8180,17 +8209,17 @@ dependencies = [ "async-std", "derive_more", "futures-util", - "hyper 0.13.4", + "hyper 0.13.5", "log", "prometheus", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] name = "substrate-test-client" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "hash-db", "parity-scale-codec", "sc-client-api", @@ -8253,7 +8282,7 @@ dependencies = [ name = "substrate-test-runtime-client" version = "2.0.0-dev" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "parity-scale-codec", "sc-block-builder", "sc-client-api", @@ -8273,7 +8302,7 @@ name = "substrate-test-runtime-transaction-pool" version = "2.0.0-dev" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "parity-scale-codec", "parking_lot 0.10.2", "sc-transaction-graph", @@ -8295,7 +8324,7 @@ dependencies = [ "build-helper", "cargo_metadata", "fs2", - "itertools", + "itertools 0.8.2", "tempfile", "toml", "walkdir", @@ -8342,7 +8371,7 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli", + "gimli 0.20.0", "log", "more-asserts", "region", @@ -8364,10 +8393,10 @@ checksum = "c77f0ce539b5a09a54dc80a1cf0c7cd7e694df11029354fe50a2d5fe889bdb97" dependencies = [ "anyhow", "cfg-if", - "gimli", + "gimli 0.20.0", "lazy_static", "libc", - "object", + "object 0.18.0", "scroll", "serde", "substrate-wasmtime-runtime", @@ -8420,12 +8449,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.17" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" +checksum = "4696caa4048ac7ce2bcd2e484b3cef88c1004e41b8e945a277e2c25dc0b72060" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.5", "unicode-xid 0.2.0", ] @@ -8436,8 +8465,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -8456,16 +8485,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "unicode-xid 0.2.0", ] [[package]] name = "sysinfo" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0338198966bde7feb14b011a33d404a62a6e03b843352c71512a2a002634b7" +checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e" dependencies = [ "cfg-if", "doc-comment", @@ -8519,8 +8548,8 @@ checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9" dependencies = [ "lazy_static", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "version_check", ] @@ -8535,22 +8564,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" +checksum = "467e5ff447618a916519a4e0d62772ab14f434897f3d63f05d8700ef1e9b22c1" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" +checksum = "e63c1091225b9834089b429bc4a2e01223470e3183e891582909e9d1c4cb55d9" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -8564,21 +8593,20 @@ dependencies = [ [[package]] name = "threadpool" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" dependencies = [ "num_cpus", ] [[package]] name = "time" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "redox_syscall", "winapi 0.3.8", ] @@ -8618,9 +8646,9 @@ dependencies = [ [[package]] name = "tinytemplate" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a" +checksum = "45e4bc5ac99433e0dcb8b9f309dd271a165ae37dde129b9e0ce1bfdd8bfe4891" dependencies = [ "serde", "serde_json", @@ -8652,9 +8680,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" dependencies = [ "bytes 0.5.4", "fnv", @@ -8755,8 +8783,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -8786,7 +8814,7 @@ checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" dependencies = [ "futures-core", "rustls", - "tokio 0.2.18", + "tokio 0.2.21", "webpki", ] @@ -8898,7 +8926,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite", - "tokio 0.2.18", + "tokio 0.2.21", ] [[package]] @@ -8933,8 +8961,8 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", ] [[package]] @@ -9008,9 +9036,9 @@ checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" [[package]] name = "trybuild" -version = "1.0.25" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459186ab1afd6d93bd23c2269125f4f7694f8771fe0e64434b4bdc212b94034d" +checksum = "744665442556a91933cee5e75b0371376eb03498c4d0bfbcebd2a9882b4fb5ef" dependencies = [ "glob 0.3.0", "lazy_static", @@ -9048,9 +9076,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" +checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" dependencies = [ "byteorder 1.3.4", "crunchy", @@ -9123,9 +9151,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" @@ -9157,9 +9185,9 @@ checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" [[package]] name = "vec_map" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" @@ -9265,16 +9293,16 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" +checksum = "8a369c5e1dfb7569e14d62af4da642a3cbc2f9a3652fe586e26ac22222aa4b04" dependencies = [ "cfg-if", "js-sys", @@ -9288,7 +9316,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.3", + "quote 1.0.5", "wasm-bindgen-macro-support", ] @@ -9299,8 +9327,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9313,9 +9341,9 @@ checksum = "a91c2916119c17a8e316507afaaa2dd94b47646048014bbdf6bef098c1bb58ad" [[package]] name = "wasm-bindgen-test" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648da3460c6d2aa04b715a936329e2e311180efe650b2127d6267f4193ccac14" +checksum = "fd8e9dad8040e378f0696b017570c6bc929aac373180e06b3d67ac5059c52da3" dependencies = [ "console_error_panic_hook", "js-sys", @@ -9327,12 +9355,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" +checksum = "c358c8d2507c1bae25efa069e62ea907aa28700b25c8c33dafb0b15ba4603627" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.5", ] [[package]] @@ -9352,7 +9380,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "parking_lot 0.9.0", "pin-utils", @@ -9406,7 +9434,7 @@ checksum = "d39ba645aee700b29ff0093028b4123556dd142a74973f04ed6225eedb40e77d" dependencies = [ "anyhow", "faerie", - "gimli", + "gimli 0.20.0", "more-asserts", "target-lexicon", "thiserror", @@ -9421,7 +9449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed54fd9d64dfeeee7c285fd126174a6b5e6d4efc7e5a1566fdb635e60ff6a74e" dependencies = [ "anyhow", - "base64 0.12.0", + "base64 0.12.1", "bincode", "cranelift-codegen", "cranelift-entity", @@ -9445,27 +9473,27 @@ dependencies = [ [[package]] name = "wast" -version = "13.0.0" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b20abd8b4a26f7e0d4dd5e357e90a3d555ec190e94472c9b2b27c5b9777f9ae" +checksum = "5a0e1c36b928fca33dbaf96235188f5fad22ee87100e26cc606bd0fbabdf1932" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51a615830ee3e7200b505c441fec09aac2f114deae69df52f215cb828ba112c4" +checksum = "2b50f9e5e5c81e6fd987ae6997a9f4bbb751df2dec1d8cadb0b5778f1ec13bbe" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.37" +version = "0.3.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" +checksum = "8bc359e5dd3b46cb9687a051d50a2fdd228e4ba7cf6fcf861a5365c3d671a642" dependencies = [ "js-sys", "wasm-bindgen", @@ -9538,9 +9566,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ "winapi 0.3.8", ] @@ -9602,7 +9630,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84300bb493cc878f3638b981c62b4632ec1a5c52daaa3036651e8c106d3b55ea" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "log", "nohash-hasher", "parking_lot 0.10.2", @@ -9626,8 +9654,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.3", - "syn 1.0.17", + "quote 1.0.5", + "syn 1.0.21", "synstructure", ] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 022baa0f13..3147e79803 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -12,24 +12,19 @@ description = "FRAME pallet staking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] +static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } sp-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../primitives/phragmen" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io", default-features = false } +sp-io ={ version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-dev", features = ["historical"], path = "../session", default-features = false } +pallet-session = { version = "2.0.0-dev", default-features = false, features = ["historical"], path = "../session" } pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../authorship" } sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } -static_assertions = "1.1.0" - -# Optional imports for tesing-utils feature -pallet-indices = { version = "2.0.0-dev", optional = true, path = "../indices", default-features = false } -sp-core = { version = "2.0.0-dev", optional = true, path = "../../primitives/core", default-features = false } -rand = { version = "0.7.3", optional = true, default-features = false } # Optional imports for benchmarking frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } @@ -49,12 +44,6 @@ env_logger = "0.7.1" hex = "0.4" [features] -testing-utils = [ - "std", - "pallet-indices/std", - "sp-core/std", - "rand/std", -] default = ["std"] std = [ "serde", @@ -69,9 +58,8 @@ std = [ "frame-system/std", "pallet-authorship/std", "sp-application-crypto/std", - "sp-core/std", ] runtime-benchmarks = [ - "rand_chacha", "frame-benchmarking", + "rand_chacha", ] diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index c717dd8598..44075aa572 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-dev", path = "..", features = ["testing-utils"] } +pallet-staking = { version = "2.0.0-dev", path = "..", features = ["runtime-benchmarks"] } pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../reward-curve" } pallet-session = { version = "2.0.0-dev", path = "../../session" } pallet-indices = { version = "2.0.0-dev", path = "../../indices" } diff --git a/frame/staking/fuzzer/src/submit_solution.rs b/frame/staking/fuzzer/src/submit_solution.rs index 067ab0c631..fafd686c9d 100644 --- a/frame/staking/fuzzer/src/submit_solution.rs +++ b/frame/staking/fuzzer/src/submit_solution.rs @@ -16,17 +16,18 @@ // limitations under the License. //! Fuzzing for staking pallet. +//! +//! HFUZZ_RUN_ARGS="-n 8" cargo hfuzz run submit_solution use honggfuzz::fuzz; use mock::Test; -use pallet_staking::testing_utils::{ - USER, get_seq_phragmen_solution, get_weak_solution, setup_chain_stakers, - set_validator_count, signed_account, -}; +use pallet_staking::testing_utils::*; use frame_support::{assert_ok, storage::StorageValue}; +use frame_system::RawOrigin; use sp_runtime::{traits::Dispatchable, DispatchError}; use sp_core::offchain::{testing::TestOffchainExt, OffchainExt}; +use pallet_staking::{EraElectionStatus, ElectionStatus, Module as Staking, Call as StakingCall}; mod mock; @@ -88,47 +89,52 @@ fn main() { ext.execute_with(|| { // initial setup - set_validator_count::(to_elect); - pallet_staking::testing_utils::init_active_era(); - setup_chain_stakers::( + init_active_era(); + assert_ok!(create_validators_with_nominators_for_era::( num_validators, num_nominators, - edge_per_voter, - ); - >::put(pallet_staking::ElectionStatus::Open(1)); + edge_per_voter as usize, + true, + None, + )); + >::put(ElectionStatus::Open(1)); + assert!(>::create_stakers_snapshot().0); + let origin = RawOrigin::Signed(create_funded_user::("fuzzer", 0, 100)); println!("++ Chain setup done."); // stuff to submit - let (winners, compact, score) = match mode { + let (winners, compact, score, size) = match mode { Mode::InitialSubmission => { /* No need to setup anything */ get_seq_phragmen_solution::(do_reduce) }, Mode::StrongerSubmission => { - let (winners, compact, score) = get_weak_solution::(false); + let (winners, compact, score, size) = get_weak_solution::(false); println!("Weak on chain score = {:?}", score); assert_ok!( - >::submit_election_solution( - signed_account::(USER), + >::submit_election_solution( + origin.clone().into(), winners, compact, score, - pallet_staking::testing_utils::active_era::(), + current_era::(), + size, ) ); get_seq_phragmen_solution::(do_reduce) }, Mode::WeakerSubmission => { - let (winners, compact, score) = get_seq_phragmen_solution::(do_reduce); + let (winners, compact, score, size) = get_seq_phragmen_solution::(do_reduce); println!("Strong on chain score = {:?}", score); assert_ok!( - >::submit_election_solution( - signed_account::(USER), + >::submit_election_solution( + origin.clone().into(), winners, compact, score, - pallet_staking::testing_utils::active_era::(), + current_era::(), + size, ) ); get_weak_solution::(false) @@ -138,27 +144,34 @@ fn main() { println!("++ Submission ready. Score = {:?}", score); // must have chosen correct number of winners. - assert_eq!(winners.len() as u32, >::validator_count()); + assert_eq!(winners.len() as u32, >::validator_count()); // final call and origin - let call = pallet_staking::Call::::submit_election_solution( + let call = StakingCall::::submit_election_solution( winners, compact, score, - pallet_staking::testing_utils::active_era::(), + current_era::(), + size, ); - let caller = signed_account::(USER); // actually submit match mode { Mode::WeakerSubmission => { assert_eq!( - call.dispatch(caller.into()).unwrap_err().error, - DispatchError::Module { index: 0, error: 16, message: Some("PhragmenWeakSubmission") }, + call.dispatch(origin.clone().into()).unwrap_err().error, + DispatchError::Module { + index: 0, + error: 16, + message: Some("PhragmenWeakSubmission"), + }, ); }, - // NOTE: so exhaustive pattern doesn't work here.. maybe some rust issue? or due to `#[repr(u32)]`? - Mode::InitialSubmission | Mode::StrongerSubmission => assert!(call.dispatch(caller.into()).is_ok()), + // NOTE: so exhaustive pattern doesn't work here.. maybe some rust issue? + // or due to `#[repr(u32)]`? + Mode::InitialSubmission | Mode::StrongerSubmission => { + assert_ok!(call.dispatch(origin.into())); + } }; }) }); diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index cd6d0badd0..d3723dce1c 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -18,53 +18,17 @@ //! Staking pallet benchmarking. use super::*; - -use rand_chacha::{rand_core::{RngCore, SeedableRng}, ChaChaRng}; - -use sp_runtime::traits::{Dispatchable, One}; -use sp_io::hashing::blake2_256; - -use frame_system::RawOrigin; -use frame_benchmarking::{benchmarks, account}; - use crate::Module as Staking; +use testing_utils::*; +use sp_runtime::{traits::{Dispatchable, One}}; +use frame_system::RawOrigin; +pub use frame_benchmarking::{benchmarks, account}; const SEED: u32 = 0; const MAX_SPANS: u32 = 100; const MAX_VALIDATORS: u32 = 1000; const MAX_SLASHES: u32 = 1000; -fn create_funded_user(string: &'static str, n: u32) -> T::AccountId { - let user = account(string, n, SEED); - let balance = T::Currency::minimum_balance() * 100.into(); - T::Currency::make_free_balance_be(&user, balance); - user -} - -pub fn create_stash_controller(n: u32) -> Result<(T::AccountId, T::AccountId), &'static str> { - let stash = create_funded_user::("stash", n); - let controller = create_funded_user::("controller", n); - let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); - let reward_destination = RewardDestination::Staked; - let amount = T::Currency::minimum_balance() * 10.into(); - Staking::::bond(RawOrigin::Signed(stash.clone()).into(), controller_lookup, amount, reward_destination)?; - return Ok((stash, controller)) -} - -fn create_validators(max: u32) -> Result::Source>, &'static str> { - let mut validators: Vec<::Source> = Vec::with_capacity(max as usize); - for i in 0 .. max { - let (stash, controller) = create_stash_controller::(i)?; - let validator_prefs = ValidatorPrefs { - commission: Perbill::from_percent(50), - }; - Staking::::validate(RawOrigin::Signed(controller).into(), validator_prefs)?; - let stash_lookup: ::Source = T::Lookup::unlookup(stash); - validators.push(stash_lookup); - } - Ok(validators) -} - // Add slashing spans to a user account. Not relevant for actual use, only to benchmark // read and write operations. fn add_slashing_spans(who: &T::AccountId, spans: u32) { @@ -81,51 +45,15 @@ fn add_slashing_spans(who: &T::AccountId, spans: u32) { SlashingSpans::::insert(who, slashing_spans); } -// This function generates v validators and n nominators who are randomly nominating up to MAX_NOMINATIONS. -pub fn create_validators_with_nominators_for_era(v: u32, n: u32) -> Result<(), &'static str> { - let mut validators: Vec<::Source> = Vec::with_capacity(v as usize); - let mut rng = ChaChaRng::from_seed(SEED.using_encoded(blake2_256)); - - // Create v validators - for i in 0 .. v { - let (v_stash, v_controller) = create_stash_controller::(i)?; - let validator_prefs = ValidatorPrefs { - commission: Perbill::from_percent(50), - }; - Staking::::validate(RawOrigin::Signed(v_controller.clone()).into(), validator_prefs)?; - let stash_lookup: ::Source = T::Lookup::unlookup(v_stash.clone()); - validators.push(stash_lookup.clone()); - } - - // Create n nominators - for j in 0 .. n { - let (_n_stash, n_controller) = create_stash_controller::(u32::max_value() - j)?; - - // Have them randomly validate - let mut available_validators = validators.clone(); - let mut selected_validators: Vec<::Source> = Vec::with_capacity(MAX_NOMINATIONS); - for _ in 0 .. v.min(MAX_NOMINATIONS as u32) { - let selected = rng.next_u32() as usize % available_validators.len(); - let validator = available_validators.remove(selected); - selected_validators.push(validator); - } - Staking::::nominate(RawOrigin::Signed(n_controller.clone()).into(), selected_validators)?; - } - - ValidatorCount::put(v); - - Ok(()) -} - -// This function generates one validator being nominated by n nominators, and returns -//the validator stash account. It also starts an era and creates pending payouts. +// This function generates one validator being nominated by n nominators, and returns the validator +// stash account. It also starts an era and creates pending payouts. pub fn create_validator_with_nominators(n: u32, upper_bound: u32) -> Result { let mut points_total = 0; let mut points_individual = Vec::new(); MinimumValidatorCount::put(0); - let (v_stash, v_controller) = create_stash_controller::(0)?; + let (v_stash, v_controller) = create_stash_controller::(0, 100)?; let validator_prefs = ValidatorPrefs { commission: Perbill::from_percent(50), }; @@ -137,7 +65,7 @@ pub fn create_validator_with_nominators(n: u32, upper_bound: u32) -> R // Give the validator n nominators, but keep total users in the system the same. for i in 0 .. upper_bound { - let (_n_stash, n_controller) = create_stash_controller::(u32::max_value() - i)?; + let (_n_stash, n_controller) = create_stash_controller::(u32::max_value() - i, 100)?; if i < n { Staking::::nominate(RawOrigin::Signed(n_controller.clone()).into(), vec![stash_lookup.clone()])?; } @@ -174,8 +102,8 @@ benchmarks! { bond { let u in ...; - let stash = create_funded_user::("stash",u); - let controller = create_funded_user::("controller", u); + let stash = create_funded_user::("stash", u, 100); + let controller = create_funded_user::("controller", u, 100); let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); let reward_destination = RewardDestination::Staked; let amount = T::Currency::minimum_balance() * 10.into(); @@ -187,7 +115,7 @@ benchmarks! { bond_extra { let u in ...; - let (stash, controller) = create_stash_controller::(u)?; + let (stash, controller) = create_stash_controller::(u, 100)?; let max_additional = T::Currency::minimum_balance() * 10.into(); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; @@ -200,7 +128,7 @@ benchmarks! { unbond { let u in ...; - let (_, controller) = create_stash_controller::(u)?; + let (_, controller) = create_stash_controller::(u, 100)?; let amount = T::Currency::minimum_balance() * 10.into(); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; @@ -215,7 +143,7 @@ benchmarks! { withdraw_unbonded_update { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0)?; + let (stash, controller) = create_stash_controller::(0, 100)?; add_slashing_spans::(&stash, s); let amount = T::Currency::minimum_balance() * 5.into(); // Half of total Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; @@ -233,7 +161,7 @@ benchmarks! { withdraw_unbonded_kill { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0)?; + let (stash, controller) = create_stash_controller::(0, 100)?; add_slashing_spans::(&stash, s); let amount = T::Currency::minimum_balance() * 10.into(); Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; @@ -247,7 +175,7 @@ benchmarks! { validate { let u in ...; - let (stash, controller) = create_stash_controller::(u)?; + let (stash, controller) = create_stash_controller::(u, 100)?; let prefs = ValidatorPrefs::default(); }: _(RawOrigin::Signed(controller), prefs) verify { @@ -257,8 +185,8 @@ benchmarks! { // Worst case scenario, MAX_NOMINATIONS nominate { let n in 1 .. MAX_NOMINATIONS as u32; - let (stash, controller) = create_stash_controller::(n + 1)?; - let validators = create_validators::(n)?; + let (stash, controller) = create_stash_controller::(n + 1, 100)?; + let validators = create_validators::(n, 100)?; }: _(RawOrigin::Signed(controller), validators) verify { assert!(Nominators::::contains_key(stash)); @@ -266,12 +194,12 @@ benchmarks! { chill { let u in ...; - let (_, controller) = create_stash_controller::(u)?; + let (_, controller) = create_stash_controller::(u, 100)?; }: _(RawOrigin::Signed(controller)) set_payee { let u in ...; - let (stash, controller) = create_stash_controller::(u)?; + let (stash, controller) = create_stash_controller::(u, 100)?; assert_eq!(Payee::::get(&stash), RewardDestination::Staked); }: _(RawOrigin::Signed(controller), RewardDestination::Controller) verify { @@ -280,8 +208,8 @@ benchmarks! { set_controller { let u in ...; - let (stash, _) = create_stash_controller::(u)?; - let new_controller = create_funded_user::("new_controller", u); + let (stash, _) = create_stash_controller::(u, 100)?; + let new_controller = create_funded_user::("new_controller", u, 100); let new_controller_lookup = T::Lookup::unlookup(new_controller.clone()); }: _(RawOrigin::Signed(stash), new_controller_lookup) verify { @@ -319,7 +247,7 @@ benchmarks! { force_unstake { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0)?; + let (stash, controller) = create_stash_controller::(0, 100)?; add_slashing_spans::(&stash, s); }: _(RawOrigin::Root, stash, s) verify { @@ -356,7 +284,7 @@ benchmarks! { rebond { let l in 1 .. MAX_UNLOCKING_CHUNKS as u32; - let (_, controller) = create_stash_controller::(u)?; + let (_, controller) = create_stash_controller::(u, 100)?; let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); let unlock_chunk = UnlockChunk::> { value: 1.into(), @@ -394,7 +322,7 @@ benchmarks! { reap_stash { let s in 1 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0)?; + let (stash, controller) = create_stash_controller::(0, 100)?; add_slashing_spans::(&stash, s); T::Currency::make_free_balance_be(&stash, 0.into()); }: _(RawOrigin::Signed(controller), stash.clone(), s) @@ -406,7 +334,7 @@ benchmarks! { let v in 1 .. 10; let n in 1 .. 100; MinimumValidatorCount::put(0); - create_validators_with_nominators_for_era::(v, n)?; + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None)?; let session_index = SessionIndex::one(); }: { let validators = Staking::::new_era(session_index).ok_or("`new_era` failed")?; @@ -415,7 +343,7 @@ benchmarks! { do_slash { let l in 1 .. MAX_UNLOCKING_CHUNKS as u32; - let (stash, controller) = create_stash_controller::(0)?; + let (stash, controller) = create_stash_controller::(0, 100)?; let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); let unlock_chunk = UnlockChunk::> { value: 1.into(), @@ -443,7 +371,7 @@ benchmarks! { let v in 1 .. 10; let n in 1 .. 100; MinimumValidatorCount::put(0); - create_validators_with_nominators_for_era::(v, n)?; + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None)?; // Start a new Era let new_validators = Staking::::new_era(SessionIndex::one()).unwrap(); assert!(new_validators.len() == v as usize); @@ -477,6 +405,198 @@ benchmarks! { call.dispatch(RawOrigin::Signed(caller.clone()).into())?; } } + + // This benchmark create `v` validators intent, `n` nominators intent, each nominator nominate + // MAX_NOMINATIONS in the set of the first `w` validators. + // It builds a solution with `w` winners composed of nominated validators randomly nominated, + // `a` assignment with MAX_NOMINATIONS. + submit_solution_initial { + // number of validator intent + let v in 1000 .. 2000; + // number of nominator intent + let n in 1000 .. 2000; + // number of assignments. Basically, number of active nominators. + let a in 200 .. 500; + // number of winners, also ValidatorCount + let w in 16 .. 100; + + ensure!(w as usize >= MAX_NOMINATIONS, "doesn't support lower value"); + + let winners = create_validators_with_nominators_for_era::( + v, + n, + MAX_NOMINATIONS, + false, + Some(w), + )?; + + // needed for the solution to be generates. + assert!(>::create_stakers_snapshot().0); + + // set number of winners + ValidatorCount::put(w); + + // create a assignments in total for the w winners. + let (winners, assignments) = create_assignments_for_offchain::(a, winners)?; + + let ( + winners, + compact, + score, + size + ) = offchain_election::prepare_submission::(assignments, winners, false).unwrap(); + + // needed for the solution to be accepted + >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); + + let era = >::current_era().unwrap_or(0); + let caller: T::AccountId = account("caller", n, SEED); + }: { + let result = >::submit_election_solution( + RawOrigin::Signed(caller.clone()).into(), + winners, + compact, + score.clone(), + era, + size, + ); + assert!(result.is_ok()); + } + verify { + // new solution has been accepted. + assert_eq!(>::queued_score().unwrap(), score); + } + + // same as submit_solution_initial but we place a very weak solution on chian first. + submit_solution_better { + // number of validator intent + let v in 1000 .. 2000; + // number of nominator intent + let n in 1000 .. 2000; + // number of assignments. Basically, number of active nominators. + let a in 200 .. 500; + // number of winners, also ValidatorCount + let w in 16 .. 100; + + ensure!(w as usize >= MAX_NOMINATIONS, "doesn't support lower value"); + + let winners = create_validators_with_nominators_for_era::( + v, + n, + MAX_NOMINATIONS, + false, + Some(w), + )?; + + // needed for the solution to be generates. + assert!(>::create_stakers_snapshot().0); + + // set number of winners + ValidatorCount::put(w); + + // create a assignments in total for the w winners. + let (winners, assignments) = create_assignments_for_offchain::(a, winners)?; + + let single_winner = winners[0].0.clone(); + + let ( + winners, + compact, + score, + size + ) = offchain_election::prepare_submission::(assignments, winners, false).unwrap(); + + // needed for the solution to be accepted + >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); + + let era = >::current_era().unwrap_or(0); + let caller: T::AccountId = account("caller", n, SEED); + + // submit a very bad solution on-chain + { + // this is needed to fool the chain to accept this solution. + ValidatorCount::put(1); + let (winners, compact, score, size) = get_single_winner_solution::(single_winner)?; + assert!( + >::submit_election_solution( + RawOrigin::Signed(caller.clone()).into(), + winners, + compact, + score.clone(), + era, + size, + ).is_ok()); + + // new solution has been accepted. + assert_eq!(>::queued_score().unwrap(), score); + ValidatorCount::put(w); + } + }: { + let result = >::submit_election_solution( + RawOrigin::Signed(caller.clone()).into(), + winners, + compact, + score.clone(), + era, + size, + ); + assert!(result.is_ok()); + } + verify { + // new solution has been accepted. + assert_eq!(>::queued_score().unwrap(), score); + } + + // This will be early rejected based on the score. + submit_solution_weaker { + // number of validator intent + let v in 1000 .. 2000; + // number of nominator intent + let n in 1000 .. 2000; + + MinimumValidatorCount::put(0); + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None)?; + + // needed for the solution to be generates. + assert!(>::create_stakers_snapshot().0); + + // needed for the solution to be accepted + >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); + let caller: T::AccountId = account("caller", n, SEED); + let era = >::current_era().unwrap_or(0); + + // submit a seq-phragmen with all the good stuff on chain + { + let (winners, compact, score, size) = get_seq_phragmen_solution::(true); + assert!( + >::submit_election_solution( + RawOrigin::Signed(caller.clone()).into(), + winners, + compact, + score.clone(), + era, + size, + ).is_ok() + ); + + // new solution has been accepted. + assert_eq!(>::queued_score().unwrap(), score); + } + + // prepare a bad solution. This will be very early rejected. + let (winners, compact, score, size) = get_weak_solution::(true); + }: { + assert!( + >::submit_election_solution( + RawOrigin::Signed(caller.clone()).into(), + winners, + compact, + score.clone(), + era, + size, + ).is_err() + ); + } } #[cfg(test)] @@ -491,7 +611,8 @@ mod tests { let v = 10; let n = 100; - create_validators_with_nominators_for_era::(v,n).unwrap(); + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None) + .unwrap(); let count_validators = Validators::::iter().count(); let count_nominators = Nominators::::iter().count(); @@ -595,6 +716,18 @@ mod tests { assert_ok!(test_benchmark_new_era::()); assert_ok!(test_benchmark_do_slash::()); assert_ok!(test_benchmark_payout_all::()); + // only run one of them to same time on the CI. ignore the other two. + assert_ok!(test_benchmark_submit_solution_initial::()); }); } + + #[test] + #[ignore] + fn test_benchmarks_offchain() { + ExtBuilder::default().has_stakers(false).build().execute_with(|| { + assert_ok!(test_benchmark_submit_solution_better::()); + assert_ok!(test_benchmark_submit_solution_weaker::()); + }); + } + } diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index bb9664bb2e..526d094eac 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -272,7 +272,7 @@ mod mock; #[cfg(test)] mod tests; -#[cfg(feature = "testing-utils")] +#[cfg(any(feature = "runtime-benchmarks", test))] pub mod testing_utils; #[cfg(any(feature = "runtime-benchmarks", test))] pub mod benchmarking; @@ -293,7 +293,7 @@ use frame_support::{ decl_module, decl_event, decl_storage, ensure, decl_error, debug, weights::{Weight, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, storage::IterableStorageMap, - dispatch::{IsSubType, DispatchResult, DispatchResultWithPostInfo}, + dispatch::{IsSubType, DispatchResult, DispatchResultWithPostInfo, WithPostDispatchInfo}, traits::{ Currency, LockIdentifier, LockableCurrency, WithdrawReasons, OnUnbalanced, Imbalance, Get, UnixTime, EstimateNextNewSession, EnsureOrigin, @@ -680,6 +680,22 @@ pub enum ElectionStatus { Open(BlockNumber), } +/// Some indications about the size of the election. This must be submitted with the solution. +/// +/// Note that these values must reflect the __total__ number, not only those that are present in the +/// solution. In short, these should be the same size as the size of the values dumped in +/// `SnapshotValidators` and `SnapshotNominators`. +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, Default)] +pub struct ElectionSize { + /// Number of validators in the snapshot of the current election round. + #[codec(compact)] + pub validators: ValidatorIndex, + /// Number of nominators in the snapshot of the current election round. + #[codec(compact)] + pub nominators: NominatorIndex, +} + + impl ElectionStatus { fn is_open_at(&self, n: BlockNumber) -> bool { *self == Self::Open(n) @@ -743,6 +759,72 @@ impl SessionInterface<::AccountId> for T whe } } +pub mod weight { + use super::*; + + /// All weight notes are pertaining to the case of a better solution, in which we execute + /// the longest code path. + /// Weight: 0 + (0.63 μs * v) + (0.36 μs * n) + (96.53 μs * a ) + (8 μs * w ) with: + /// * v validators in snapshot validators, + /// * n nominators in snapshot nominators, + /// * a assignment in the submitted solution + /// * w winners in the submitted solution + /// + /// State reads: + /// - Initial checks: + /// - ElectionState, CurrentEra, QueuedScore + /// - SnapshotValidators.len() + SnapShotNominators.len() + /// - ValidatorCount + /// - SnapshotValidators + /// - SnapshotNominators + /// - Iterate over nominators: + /// - compact.len() * Nominators(who) + /// - (non_self_vote_edges) * SlashingSpans + /// - For `assignment_ratio_to_staked`: Basically read the staked value of each stash. + /// - (winners.len() + compact.len()) * (Ledger + Bonded) + /// - TotalIssuance (read a gzillion times potentially, but well it is cached.) + /// - State writes: + /// - QueuedElected, QueuedScore + pub fn weight_for_submit_solution( + winners: &Vec, + compact: &CompactAssignments, + size: &ElectionSize, + ) -> Weight { + (630 * WEIGHT_PER_NANOS).saturating_mul(size.validators as Weight) + .saturating_add((360 * WEIGHT_PER_NANOS).saturating_mul(size.nominators as Weight)) + .saturating_add((96 * WEIGHT_PER_MICROS).saturating_mul(compact.len() as Weight)) + .saturating_add((8 * WEIGHT_PER_MICROS).saturating_mul(winners.len() as Weight)) + // Initial checks + .saturating_add(T::DbWeight::get().reads(8)) + // Nominators + .saturating_add(T::DbWeight::get().reads(compact.len() as Weight)) + // SlashingSpans (upper bound for invalid solution) + .saturating_add(T::DbWeight::get().reads(compact.edge_count() as Weight)) + // `assignment_ratio_to_staked` + .saturating_add(T::DbWeight::get().reads(2 * ((winners.len() + compact.len()) as Weight))) + .saturating_add(T::DbWeight::get().reads(1)) + // write queued score and elected + .saturating_add(T::DbWeight::get().writes(2)) + } + + /// Weight of `submit_solution` in case of a correct submission. + /// + /// refund: we charged compact.len() * read(1) for SlashingSpans. A valid solution only reads + /// winners.len(). + pub fn weight_for_correct_submit_solution( + winners: &Vec, + compact: &CompactAssignments, + size: &ElectionSize, + ) -> Weight { + // NOTE: for consistency, we re-compute the original weight to maintain their relation and + // prevent any foot-guns. + let original_weight = weight_for_submit_solution::(winners, compact, size); + original_weight + .saturating_sub(T::DbWeight::get().reads(compact.edge_count() as Weight)) + .saturating_add(T::DbWeight::get().reads(winners.len() as Weight)) + } +} + pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// The staking balance. type Currency: LockableCurrency; @@ -1163,6 +1245,8 @@ decl_error! { PhragmenBogusEdge, /// The claimed score does not match with the one computed from the data. PhragmenBogusScore, + /// The election size is invalid. + PhragmenBogusElectionSize, /// The call is not allowed at the given time due to restrictions of election period. CallNotAllowed, /// Incorrect previous history depth input provided. @@ -2063,51 +2147,26 @@ decl_module! { /// minimized (to ensure less variance) /// /// # - /// E: number of edges. m: size of winner committee. n: number of nominators. d: edge degree - /// (16 for now) v: number of on-chain validator candidates. - /// - /// NOTE: given a solution which is reduced, we can enable a new check the ensure `|E| < n + - /// m`. We don't do this _yet_, but our offchain worker code executes it nonetheless. - /// - /// major steps (all done in `check_and_replace_solution`): - /// - /// - Storage: O(1) read `ElectionStatus`. - /// - Storage: O(1) read `PhragmenScore`. - /// - Storage: O(1) read `ValidatorCount`. - /// - Storage: O(1) length read from `SnapshotValidators`. - /// - /// - Storage: O(v) reads of `AccountId` to fetch `snapshot_validators`. - /// - Memory: O(m) iterations to map winner index to validator id. - /// - Storage: O(n) reads `AccountId` to fetch `snapshot_nominators`. - /// - Memory: O(n + m) reads to map index to `AccountId` for un-compact. - /// - /// - Storage: O(e) accountid reads from `Nomination` to read correct nominations. - /// - Storage: O(e) calls into `slashable_balance_of_vote_weight` to convert ratio to staked. - /// - /// - Memory: build_support_map. O(e). - /// - Memory: evaluate_support: O(E). - /// - /// - Storage: O(e) writes to `QueuedElected`. - /// - Storage: O(1) write to `QueuedScore` - /// - /// The weight of this call is 1/10th of the blocks total weight. + /// See `crate::weight` module. /// # - #[weight = 100_000_000_000] + #[weight = weight::weight_for_submit_solution::(winners, compact, size)] pub fn submit_election_solution( origin, winners: Vec, - compact_assignments: CompactAssignments, + compact: CompactAssignments, score: PhragmenScore, era: EraIndex, - ) { + size: ElectionSize, + ) -> DispatchResultWithPostInfo { let _who = ensure_signed(origin)?; Self::check_and_replace_solution( winners, - compact_assignments, + compact, ElectionCompute::Signed, score, era, - )? + size, + ) } /// Unsigned version of `submit_election_solution`. @@ -2115,22 +2174,28 @@ decl_module! { /// Note that this must pass the [`ValidateUnsigned`] check which only allows transactions /// from the local node to be included. In other words, only the block author can include a /// transaction in the block. - #[weight = 100_000_000_000] + /// + /// # + /// See `crate::weight` module. + /// # + #[weight = weight::weight_for_submit_solution::(winners, compact, size)] pub fn submit_election_solution_unsigned( origin, winners: Vec, - compact_assignments: CompactAssignments, + compact: CompactAssignments, score: PhragmenScore, era: EraIndex, - ) { + size: ElectionSize, + ) -> DispatchResultWithPostInfo { ensure_none(origin)?; Self::check_and_replace_solution( winners, - compact_assignments, + compact, ElectionCompute::Unsigned, score, era, - )? + size, + ) // TODO: instead of returning an error, panic. This makes the entire produced block // invalid. // This ensures that block authors will not ever try and submit a solution which is not @@ -2142,6 +2207,7 @@ decl_module! { impl Module { /// The total balance that can be slashed from a stash account as of right now. pub fn slashable_balance_of(stash: &T::AccountId) -> BalanceOf { + // Weight note: consider making the stake accessible through stash. Self::bonded(stash).and_then(Self::ledger).map(|l| l.active).unwrap_or_default() } @@ -2156,7 +2222,7 @@ impl Module { /// /// This data is used to efficiently evaluate election results. returns `true` if the operation /// is successful. - fn create_stakers_snapshot() -> (bool, Weight) { + pub fn create_stakers_snapshot() -> (bool, Weight) { let mut consumed_weight = 0; let mut add_db_reads_writes = |reads, writes| { consumed_weight += T::DbWeight::get().reads_writes(reads, writes); @@ -2518,19 +2584,24 @@ impl Module { } /// Basic and cheap checks that we perform in validate unsigned, and in the execution. - pub fn pre_dispatch_checks(score: PhragmenScore, era: EraIndex) -> Result<(), Error> { + /// + /// State reads: ElectionState, CurrentEr, QueuedScore. + /// + /// This function does weight refund in case of errors, which is based upon the fact that it is + /// called at the very beginning of the call site's function. + pub fn pre_dispatch_checks(score: PhragmenScore, era: EraIndex) -> DispatchResultWithPostInfo { // discard solutions that are not in-time // check window open ensure!( Self::era_election_status().is_open(), - Error::::PhragmenEarlySubmission, + Error::::PhragmenEarlySubmission.with_weight(T::DbWeight::get().reads(1)), ); // check current era. if let Some(current_era) = Self::current_era() { ensure!( current_era == era, - Error::::PhragmenEarlySubmission, + Error::::PhragmenEarlySubmission.with_weight(T::DbWeight::get().reads(2)), ) } @@ -2538,11 +2609,11 @@ impl Module { if let Some(queued_score) = Self::queued_score() { ensure!( is_score_better(queued_score, score), - Error::::PhragmenWeakSubmission, + Error::::PhragmenWeakSubmission.with_weight(T::DbWeight::get().reads(3)), ) } - Ok(()) + Ok(None.into()) } /// Checks a given solution and if correct and improved, writes it on chain as the queued result @@ -2553,21 +2624,46 @@ impl Module { compute: ElectionCompute, claimed_score: PhragmenScore, era: EraIndex, - ) -> Result<(), Error> { + election_size: ElectionSize, + ) -> DispatchResultWithPostInfo { // Do the basic checks. era, claimed score and window open. Self::pre_dispatch_checks(claimed_score, era)?; + // the weight that we will refund in case of a correct submission. We compute this now + // because the data needed for it will be consumed further down. + let adjusted_weight = weight::weight_for_correct_submit_solution::( + &winners, + &compact_assignments, + &election_size, + ); // Check that the number of presented winners is sane. Most often we have more candidates - // that we need. Then it should be Self::validator_count(). Else it should be all the + // than we need. Then it should be `Self::validator_count()`. Else it should be all the // candidates. - let snapshot_length = >::decode_len() + let snapshot_validators_length = >::decode_len() + .map(|l| l as u32) .ok_or_else(|| Error::::SnapshotUnavailable)?; + // size of the solution must be correct. + ensure!( + snapshot_validators_length == u32::from(election_size.validators), + Error::::PhragmenBogusElectionSize, + ); + // check the winner length only here and when we know the length of the snapshot validators // length. - let desired_winners = Self::validator_count().min(snapshot_length as u32); + let desired_winners = Self::validator_count().min(snapshot_validators_length); ensure!(winners.len() as u32 == desired_winners, Error::::PhragmenBogusWinnerCount); + let snapshot_nominators_len = >::decode_len() + .map(|l| l as u32) + .ok_or_else(|| Error::::SnapshotUnavailable)?; + + // rest of the size of the solution must be correct. + ensure!( + snapshot_nominators_len == election_size.nominators, + Error::::PhragmenBogusElectionSize, + ); + // decode snapshot validators. let snapshot_validators = Self::snapshot_validators() .ok_or(Error::::SnapshotUnavailable)?; @@ -2581,7 +2677,7 @@ impl Module { }).collect::, Error>>()?; // decode the rest of the snapshot. - let snapshot_nominators = >::snapshot_nominators() + let snapshot_nominators = Self::snapshot_nominators() .ok_or(Error::::SnapshotUnavailable)?; // helpers @@ -2615,7 +2711,7 @@ impl Module { // have bigger problems. log!(error, "💸 detected an error in the staking locking and snapshot."); // abort. - return Err(Error::::PhragmenBogusNominator); + return Err(Error::::PhragmenBogusNominator.into()); } if !is_validator { @@ -2632,14 +2728,14 @@ impl Module { // each target in the provided distribution must be actually nominated by the // nominator after the last non-zero slash. if nomination.targets.iter().find(|&tt| tt == t).is_none() { - return Err(Error::::PhragmenBogusNomination); + return Err(Error::::PhragmenBogusNomination.into()); } if ::SlashingSpans::get(&t).map_or( false, |spans| nomination.submitted_in < spans.last_nonzero_slash(), ) { - return Err(Error::::PhragmenSlashedNomination); + return Err(Error::::PhragmenSlashedNomination.into()); } } } else { @@ -2679,8 +2775,9 @@ impl Module { let exposures = Self::collect_exposure(supports); log!( info, - "💸 A better solution (with compute {:?}) has been validated and stored on chain.", + "💸 A better solution (with compute {:?} and score {:?}) has been validated and stored on chain.", compute, + submitted_score, ); // write new results. @@ -2691,8 +2788,7 @@ impl Module { }); QueuedScore::put(submitted_score); - Ok(()) - + Ok(Some(adjusted_weight).into()) } /// Start a session potentially starting an era. @@ -2996,7 +3092,7 @@ impl Module { supports.into_iter().map(|(validator, support)| { // build `struct exposure` from `support` - let mut others = Vec::new(); + let mut others = Vec::with_capacity(support.voters.len()); let mut own: BalanceOf = Zero::zero(); let mut total: BalanceOf = Zero::zero(); support.voters @@ -3381,12 +3477,6 @@ impl ReportOffence } } -impl From> for InvalidTransaction { - fn from(e: Error) -> Self { - InvalidTransaction::Custom(e.as_u8()) - } -} - #[allow(deprecated)] impl frame_support::unsigned::ValidateUnsigned for Module { type Call = Call; @@ -3396,8 +3486,10 @@ impl frame_support::unsigned::ValidateUnsigned for Module { _, score, era, + _, ) = call { use offchain_election::DEFAULT_LONGEVITY; + use sp_runtime::DispatchError; // discard solution not coming from the local OCW. match source { @@ -3408,9 +3500,18 @@ impl frame_support::unsigned::ValidateUnsigned for Module { } } - if let Err(e) = Self::pre_dispatch_checks(*score, *era) { - log!(debug, "validate unsigned pre dispatch checks failed due to {:?}.", e); - return InvalidTransaction::from(e).into(); + if let Err(error_with_post_info) = Self::pre_dispatch_checks(*score, *era) { + let error = error_with_post_info.error; + let error_number = match error { + DispatchError::Module { error, ..} => error, + _ => 0, + }; + log!( + debug, + "validate unsigned pre dispatch checks failed due to module error #{:?}.", + error, + ); + return InvalidTransaction::Custom(error_number).into(); } log!(debug, "validateUnsigned succeeded for a solution at era {}.", era); diff --git a/frame/staking/src/offchain_election.rs b/frame/staking/src/offchain_election.rs index 4e32d75f21..d93b5b2b27 100644 --- a/frame/staking/src/offchain_election.rs +++ b/frame/staking/src/offchain_election.rs @@ -20,6 +20,7 @@ use codec::Decode; use crate::{ Call, CompactAssignments, Module, NominatorIndex, OffchainAccuracy, Trait, ValidatorIndex, + ElectionSize, }; use frame_system::offchain::SubmitTransaction; use sp_phragmen::{ @@ -113,7 +114,7 @@ pub(crate) fn compute_offchain_election() -> Result<(), OffchainElecti .ok_or(OffchainElectionError::ElectionFailed)?; // process and prepare it for submission. - let (winners, compact, score) = prepare_submission::(assignments, winners, true)?; + let (winners, compact, score, size) = prepare_submission::(assignments, winners, true)?; // defensive-only: current era can never be none except genesis. let current_era = >::current_era().unwrap_or_default(); @@ -124,12 +125,14 @@ pub(crate) fn compute_offchain_election() -> Result<(), OffchainElecti compact, score, current_era, + size, ).into(); SubmitTransaction::>::submit_unsigned_transaction(call) .map_err(|_| OffchainElectionError::PoolSubmissionFailed) } + /// Takes a phragmen result and spits out some data that can be submitted to the chain. /// /// This does a lot of stuff; read the inline comments. @@ -137,7 +140,12 @@ pub fn prepare_submission( assignments: Vec>, winners: Vec<(T::AccountId, ExtendedBalance)>, do_reduce: bool, -) -> Result<(Vec, CompactAssignments, PhragmenScore), OffchainElectionError> where +) -> Result<( + Vec, + CompactAssignments, + PhragmenScore, + ElectionSize, +), OffchainElectionError> where ExtendedBalance: From<::Inner>, { // make sure that the snapshot is available. @@ -235,6 +243,12 @@ pub fn prepare_submission( } } + // both conversions are safe; snapshots are not created if they exceed. + let size = ElectionSize { + validators: snapshot_validators.len() as ValidatorIndex, + nominators: snapshot_nominators.len() as NominatorIndex, + }; + debug::native::debug!( target: "staking", "prepared solution after {} equalization iterations with score {:?}", @@ -242,5 +256,5 @@ pub fn prepare_submission( score, ); - Ok((winners_indexed, compact, score)) + Ok((winners_indexed, compact, score, size)) } diff --git a/frame/staking/src/testing_utils.rs b/frame/staking/src/testing_utils.rs index 6a95838a09..2a38f47f4e 100644 --- a/frame/staking/src/testing_utils.rs +++ b/frame/staking/src/testing_utils.rs @@ -15,142 +15,130 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Testing utils for staking. Needs the `testing-utils` feature to be enabled. -//! -//! Note that these helpers should NOT be used with the actual crate tests, but are rather designed -//! for when the module is being externally tested (i.e. fuzzing, benchmarking, e2e tests). Enabling -//! this feature in the current crate's Cargo.toml will leak all of this into a normal release -//! build. Just don't do it. +//! Testing utils for staking. Provides some common functions to setup staking state, such as +//! bonding validators, nominators, and generating different types of solutions. use crate::*; -use codec::{Decode, Encode}; -use frame_support::assert_ok; +use crate::Module as Staking; +use frame_benchmarking::{account}; use frame_system::RawOrigin; -use pallet_indices::address::Address; -use rand::Rng; -use sp_core::hashing::blake2_256; -use sp_phragmen::{ - build_support_map, evaluate_support, reduce, Assignment, PhragmenScore, StakedAssignment, -}; - -const CTRL_PREFIX: u32 = 1000; -const NOMINATOR_PREFIX: u32 = 1_000_000; - -/// A dummy suer. -pub const USER: u32 = 999_999_999; - -/// Address type of the `T` -pub type AddressOf = Address<::AccountId, u32>; - -/// Random number in the range `[a, b]`. -pub fn random(a: u32, b: u32) -> u32 { - rand::thread_rng().gen_range(a, b) +use sp_io::hashing::blake2_256; +use rand_chacha::{rand_core::{RngCore, SeedableRng}, ChaChaRng}; +use sp_phragmen::*; + +const SEED: u32 = 0; + +/// Grab a funded user. +pub fn create_funded_user(string: &'static str, n: u32, balance_factor: u32) -> T::AccountId { + let user = account(string, n, SEED); + let balance = T::Currency::minimum_balance() * balance_factor.into(); + T::Currency::make_free_balance_be(&user, balance); + // ensure T::CurrencyToVote will work correctly. + T::Currency::issue(balance); + user } -/// Set the desired validator count, with related storage items. -pub fn set_validator_count(to_elect: u32) { - ValidatorCount::put(to_elect); - MinimumValidatorCount::put(to_elect / 2); - >::put(ElectionStatus::Closed); -} - -/// Build an account with the given index. -pub fn account(index: u32) -> T::AccountId { - let entropy = (b"benchmark/staking", index).using_encoded(blake2_256); - T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() +/// Create a stash and controller pair. +pub fn create_stash_controller(n: u32, balance_factor: u32) + -> Result<(T::AccountId, T::AccountId), &'static str> +{ + let stash = create_funded_user::("stash", n, balance_factor); + let controller = create_funded_user::("controller", n, balance_factor); + let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); + let reward_destination = RewardDestination::Staked; + let amount = T::Currency::minimum_balance() * (balance_factor / 10).max(1).into(); + Staking::::bond(RawOrigin::Signed(stash.clone()).into(), controller_lookup, amount, reward_destination)?; + return Ok((stash, controller)) } -/// Build an address given Index -pub fn address(index: u32) -> AddressOf { - pallet_indices::address::Address::Id(account::(index)) +/// create `max` validators. +pub fn create_validators( + max: u32, + balance_factor: u32, +) -> Result::Source>, &'static str> { + let mut validators: Vec<::Source> = Vec::with_capacity(max as usize); + for i in 0 .. max { + let (stash, controller) = create_stash_controller::(i, balance_factor)?; + let validator_prefs = ValidatorPrefs { + commission: Perbill::from_percent(50), + }; + Staking::::validate(RawOrigin::Signed(controller).into(), validator_prefs)?; + let stash_lookup: ::Source = T::Lookup::unlookup(stash); + validators.push(stash_lookup); + } + Ok(validators) } -/// Generate signed origin from `who`. -pub fn signed(who: T::AccountId) -> T::Origin { - RawOrigin::Signed(who).into() -} +/// This function generates validators and nominators who are randomly nominating +/// `edge_per_nominator` random validators (until `to_nominate` if provided). +/// +/// Parameters: +/// - `validators`: number of bonded validators +/// - `nominators`: number of bonded nominators. +/// - `edge_per_nominator`: number of edge (vote) per nominator. +/// - `randomize_stake`: whether to randomize the stakes. +/// - `to_nominate`: if `Some(n)`, only the first `n` bonded validator are voted upon. +/// Else, all of them are considered and `edge_per_nominator` random validators are voted for. +/// +/// Return the validators choosen to be nominated. +pub fn create_validators_with_nominators_for_era( + validators: u32, + nominators: u32, + edge_per_nominator: usize, + randomize_stake: bool, + to_nominate: Option, +) -> Result::Source>, &'static str> { + let mut validators_stash: Vec<::Source> + = Vec::with_capacity(validators as usize); + let mut rng = ChaChaRng::from_seed(SEED.using_encoded(blake2_256)); + + // Create validators + for i in 0 .. validators { + let balance_factor = if randomize_stake { rng.next_u32() % 255 + 10 } else { 100u32 }; + let (v_stash, v_controller) = create_stash_controller::(i, balance_factor)?; + let validator_prefs = ValidatorPrefs { + commission: Perbill::from_percent(50), + }; + Staking::::validate(RawOrigin::Signed(v_controller.clone()).into(), validator_prefs)?; + let stash_lookup: ::Source = T::Lookup::unlookup(v_stash.clone()); + validators_stash.push(stash_lookup.clone()); + } -/// Generate signed origin from `index`. -pub fn signed_account(index: u32) -> T::Origin { - signed::(account::(index)) -} + let to_nominate = to_nominate.unwrap_or(validators_stash.len() as u32) as usize; + let validator_choosen = validators_stash[0..to_nominate].to_vec(); + + // Create nominators + for j in 0 .. nominators { + let balance_factor = if randomize_stake { rng.next_u32() % 255 + 10 } else { 100u32 }; + let (_n_stash, n_controller) = create_stash_controller::( + u32::max_value() - j, + balance_factor, + )?; + + // Have them randomly validate + let mut available_validators = validator_choosen.clone(); + let mut selected_validators: Vec<::Source> = + Vec::with_capacity(edge_per_nominator); + + for _ in 0 .. validators.min(edge_per_nominator as u32) { + let selected = rng.next_u32() as usize % available_validators.len(); + let validator = available_validators.remove(selected); + selected_validators.push(validator); + } + Staking::::nominate(RawOrigin::Signed(n_controller.clone()).into(), selected_validators)?; + } -/// Bond a validator. -pub fn bond_validator(stash: T::AccountId, ctrl: u32, val: BalanceOf) -where - T::Lookup: StaticLookup>, -{ - let _ = T::Currency::make_free_balance_be(&stash, val); - assert_ok!(>::bond( - signed::(stash), - address::(ctrl), - val, - RewardDestination::Controller - )); - assert_ok!(>::validate( - signed_account::(ctrl), - ValidatorPrefs::default() - )); -} + ValidatorCount::put(validators); -pub fn bond_nominator( - stash: T::AccountId, - ctrl: u32, - val: BalanceOf, - target: Vec>, -) where - T::Lookup: StaticLookup>, -{ - let _ = T::Currency::make_free_balance_be(&stash, val); - assert_ok!(>::bond( - signed::(stash), - address::(ctrl), - val, - RewardDestination::Controller - )); - assert_ok!(>::nominate(signed_account::(ctrl), target)); + Ok(validator_choosen) } -/// Bond `nun_validators` validators and `num_nominator` nominators with `edge_per_voter` random -/// votes per nominator. -pub fn setup_chain_stakers(num_validators: u32, num_voters: u32, edge_per_voter: u32) -where - T::Lookup: StaticLookup>, -{ - (0..num_validators).for_each(|i| { - bond_validator::( - account::(i), - i + CTRL_PREFIX, - >::from(random(1, 1000)) * T::Currency::minimum_balance(), - ); - }); - - (0..num_voters).for_each(|i| { - let mut targets: Vec> = Vec::with_capacity(edge_per_voter as usize); - let mut all_targets = (0..num_validators) - .map(|t| address::(t)) - .collect::>(); - assert!(num_validators >= edge_per_voter); - (0..edge_per_voter).for_each(|_| { - let target = all_targets.remove(random(0, all_targets.len() as u32 - 1) as usize); - targets.push(target); - }); - bond_nominator::( - account::(i + NOMINATOR_PREFIX), - i + NOMINATOR_PREFIX + CTRL_PREFIX, - >::from(random(1, 1000)) * T::Currency::minimum_balance(), - targets, - ); - }); - - >::create_stakers_snapshot(); -} /// Build a _really bad_ but acceptable solution for election. This should always yield a solution /// which has a less score than the seq-phragmen. pub fn get_weak_solution( do_reduce: bool, -) -> (Vec, CompactAssignments, PhragmenScore) { +) -> (Vec, CompactAssignments, PhragmenScore, ElectionSize) { let mut backing_stake_of: BTreeMap> = BTreeMap::new(); // self stake @@ -159,68 +147,19 @@ pub fn get_weak_solution( >::slashable_balance_of(&who) }); - // add nominator stuff - >::iter().for_each(|(who, nomination)| { - nomination.targets.into_iter().for_each(|v| { - *backing_stake_of.entry(v).or_insert(Zero::zero()) += - >::slashable_balance_of(&who) - }) - }); - - // elect winners + // elect winners. We chose the.. least backed ones. let mut sorted: Vec = backing_stake_of.keys().cloned().collect(); sorted.sort_by_key(|x| backing_stake_of.get(x).unwrap()); let winners: Vec = sorted .iter() + .rev() .cloned() .take(>::validator_count() as usize) .collect(); let mut staked_assignments: Vec> = Vec::new(); - >::iter().for_each(|(who, nomination)| { - let mut dist: Vec<(T::AccountId, ExtendedBalance)> = Vec::new(); - nomination.targets.into_iter().for_each(|v| { - if winners.iter().find(|&w| *w == v).is_some() { - dist.push((v, ExtendedBalance::zero())); - } - }); - - if dist.len() == 0 { - return; - } - - // assign real stakes. just split the stake. - let stake = , u64>>::convert( - >::slashable_balance_of(&who), - ) as ExtendedBalance; - - let mut sum: ExtendedBalance = Zero::zero(); - let dist_len = dist.len() as ExtendedBalance; - - // assign main portion - // only take the first half into account. This should highly imbalance stuff, which is good. - dist.iter_mut() - .take(if dist_len > 1 { - (dist_len as usize) / 2 - } else { - 1 - }) - .for_each(|(_, w)| { - let partial = stake / dist_len; - *w = partial; - sum += partial; - }); - - // assign the leftover to last. - let leftover = stake - sum; - let last = dist.last_mut().unwrap(); - last.1 += leftover; - - staked_assignments.push(StakedAssignment { - who, - distribution: dist, - }); - }); + // you could at this point start adding some of the nominator's stake, but for now we don't. + // This solution must be bad. // add self support to winners. winners.iter().for_each(|w| { @@ -255,10 +194,10 @@ pub fn get_weak_solution( .position(|x| x == a) .and_then(|i| >::try_into(i).ok()) }; - let stake_of = |who: &T::AccountId| -> ExtendedBalance { + let stake_of = |who: &T::AccountId| -> VoteWeight { , u64>>::convert( >::slashable_balance_of(who), - ) as ExtendedBalance + ) }; // convert back to ratio assignment. This takes less space. @@ -270,13 +209,10 @@ pub fn get_weak_solution( // re-calculate score based on what the chain will decode. let score = { - let staked: Vec> = low_accuracy_assignment - .iter() - .map(|a| { - let stake = stake_of(&a.who); - a.clone().into_staked(stake, true) - }) - .collect(); + let staked = assignment_ratio_to_staked::<_, OffchainAccuracy, _>( + low_accuracy_assignment.clone(), + stake_of + ); let (support_map, _) = build_support_map::(winners.as_slice(), staked.as_slice()); @@ -304,14 +240,19 @@ pub fn get_weak_solution( }) .collect::>(); - (winners, compact, score) + let size = ElectionSize { + validators: snapshot_validators.len() as ValidatorIndex, + nominators: snapshot_nominators.len() as NominatorIndex, + }; + + (winners, compact, score, size) } /// Create a solution for seq-phragmen. This uses the same internal function as used by the offchain /// worker code. pub fn get_seq_phragmen_solution( do_reduce: bool, -) -> (Vec, CompactAssignments, PhragmenScore) { +) -> (Vec, CompactAssignments, PhragmenScore, ElectionSize) { let sp_phragmen::PhragmenResult { winners, assignments, @@ -320,29 +261,40 @@ pub fn get_seq_phragmen_solution( offchain_election::prepare_submission::(assignments, winners, do_reduce).unwrap() } -/// Remove all validator, nominators, votes and exposures. -pub fn clean(era: EraIndex) - where - ::AccountId: codec::EncodeLike, - u32: codec::EncodeLike, -{ - >::iter().for_each(|(k, _)| { - let ctrl = >::bonded(&k).unwrap(); - >::remove(&k); - >::remove(&k); - >::remove(&ctrl); - >::remove(k, era); - }); - >::iter().for_each(|(k, _)| >::remove(k)); - >::remove_all(); - >::remove_all(); - >::kill(); - QueuedScore::kill(); +/// Returns a solution in which only one winner is elected with just a self vote. +pub fn get_single_winner_solution( + winner: T::AccountId +) -> Result<(Vec, CompactAssignments, PhragmenScore, ElectionSize), &'static str> { + let snapshot_validators = >::snapshot_validators().unwrap(); + let snapshot_nominators = >::snapshot_nominators().unwrap(); + + let val_index = snapshot_validators.iter().position(|x| *x == winner).ok_or("not a validator")?; + let nom_index = snapshot_nominators.iter().position(|x| *x == winner).ok_or("not a nominator")?; + + let stake = >::slashable_balance_of(&winner); + let stake = , VoteWeight>>::convert(stake) + as ExtendedBalance; + + let val_index = val_index as ValidatorIndex; + let nom_index = nom_index as NominatorIndex; + + let winners = vec![val_index]; + let compact = CompactAssignments { + votes1: vec![(nom_index, val_index)], + ..Default::default() + }; + let score = [stake, stake, stake * stake]; + let size = ElectionSize { + validators: snapshot_validators.len() as ValidatorIndex, + nominators: snapshot_nominators.len() as NominatorIndex, + }; + + Ok((winners, compact, score, size)) } /// get the active era. -pub fn active_era() -> EraIndex { - >::active_era().unwrap().index +pub fn current_era() -> EraIndex { + >::current_era().unwrap_or(0) } /// initialize the first era. @@ -352,3 +304,33 @@ pub fn init_active_era() { start: None, }) } + +/// Create random assignments for the given list of winners. Each assignment will have +/// MAX_NOMINATIONS edges. +pub fn create_assignments_for_offchain( + num_assignments: u32, + winners: Vec<::Source>, +) -> Result< + ( + Vec<(T::AccountId, ExtendedBalance)>, + Vec>, + ), + &'static str +> { + let ratio = OffchainAccuracy::from_rational_approximation(1, MAX_NOMINATIONS); + let assignments: Vec> = >::iter() + .take(num_assignments as usize) + .map(|(n, t)| Assignment { + who: n, + distribution: t.targets.iter().map(|v| (v.clone(), ratio)).collect(), + }) + .collect(); + + ensure!(assignments.len() == num_assignments as usize, "must bench for `a` assignments"); + + let winners = winners.into_iter().map(|v| { + (::lookup(v).unwrap(), 0) + }).collect(); + + Ok((winners, assignments)) +} diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 31137e04eb..12ae71c1cd 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -2753,7 +2753,10 @@ fn remove_multi_deferred() { mod offchain_phragmen { use crate::*; use codec::Encode; - use frame_support::{assert_noop, assert_ok}; + use frame_support::{ + assert_noop, assert_ok, assert_err_with_weight, + dispatch::DispatchResultWithPostInfo, + }; use sp_runtime::transaction_validity::TransactionSource; use mock::*; use parking_lot::RwLock; @@ -2808,6 +2811,29 @@ mod offchain_phragmen { pool_state } + fn election_size() -> ElectionSize { + ElectionSize { + validators: Staking::snapshot_validators().unwrap().len() as ValidatorIndex, + nominators: Staking::snapshot_nominators().unwrap().len() as NominatorIndex, + } + } + + fn submit_solution( + origin: Origin, + winners: Vec, + compact: CompactAssignments, + score: PhragmenScore, + ) -> DispatchResultWithPostInfo { + Staking::submit_election_solution( + origin, + winners, + compact, + score, + current_era(), + election_size(), + ) + } + #[test] fn is_current_session_final_works() { ExtBuilder::default() @@ -2996,12 +3022,11 @@ mod offchain_phragmen { assert!(Staking::snapshot_validators().is_some()); let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), )); let queued_result = Staking::queued_elected().unwrap(); @@ -3039,13 +3064,7 @@ mod offchain_phragmen { assert_eq!(Staking::era_election_status(), ElectionStatus::Open(12)); let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); - assert_ok!(Staking::submit_election_solution( - Origin::signed(10), - winners, - compact, - score, - current_era(), - )); + assert_ok!(submit_solution(Origin::signed(10), winners, compact, score)); let queued_result = Staking::queued_elected().unwrap(); assert_eq!(queued_result.compute, ElectionCompute::Signed); @@ -3088,15 +3107,17 @@ mod offchain_phragmen { let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); Staking::kill_stakers_snapshot(); - assert_noop!( + assert_err_with_weight!( Staking::submit_election_solution( Origin::signed(10), - winners, - compact, + winners.clone(), + compact.clone(), score, current_era(), + ElectionSize::default(), ), Error::::PhragmenEarlySubmission, + Some(::DbWeight::get().reads(1)), ); }) } @@ -3115,25 +3136,24 @@ mod offchain_phragmen { // a good solution let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), )); // a bad solution let (compact, winners, score) = horrible_phragmen_with_post_processing(false); - assert_noop!( - Staking::submit_election_solution( + assert_err_with_weight!( + submit_solution( Origin::signed(10), - winners, - compact, + winners.clone(), + compact.clone(), score, - current_era(), ), Error::::PhragmenWeakSubmission, + Some(::DbWeight::get().reads(3)) ); }) } @@ -3152,22 +3172,20 @@ mod offchain_phragmen { // a meeeeh solution let (compact, winners, score) = horrible_phragmen_with_post_processing(false); - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), )); // a better solution let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), )); }) } @@ -3268,12 +3286,11 @@ mod offchain_phragmen { run_to_block(12); // put a good solution on-chain let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ),); // now run the offchain worker in the same chain state. @@ -3318,6 +3335,28 @@ mod offchain_phragmen { assert_eq!(winners.len(), 3); + assert_noop!( + submit_solution( + Origin::signed(10), + winners, + compact, + score, + ), + Error::::PhragmenBogusWinnerCount, + ); + }) + } + + #[test] + fn invalid_phragmen_result_solution_size() { + ExtBuilder::default() + .offchain_phragmen_ext() + .build() + .execute_with(|| { + run_to_block(12); + + let (compact, winners, score) = prepare_submission_with(true, 2, |_| {}); + assert_noop!( Staking::submit_election_solution( Origin::signed(10), @@ -3325,8 +3364,9 @@ mod offchain_phragmen { compact, score, current_era(), + ElectionSize::default(), ), - Error::::PhragmenBogusWinnerCount, + Error::::PhragmenBogusElectionSize, ); }) } @@ -3350,12 +3390,11 @@ mod offchain_phragmen { assert_eq!(winners.len(), 3); assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusWinnerCount, ); @@ -3379,12 +3418,11 @@ mod offchain_phragmen { assert_eq!(winners.len(), 4); // all good. We chose 4 and it works. - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ),); }) } @@ -3410,12 +3448,11 @@ mod offchain_phragmen { // The error type sadly cannot be more specific now. assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusCompact, ); @@ -3443,12 +3480,11 @@ mod offchain_phragmen { // The error type sadly cannot be more specific now. assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusCompact, ); @@ -3475,12 +3511,11 @@ mod offchain_phragmen { let winners = vec![0, 1, 2, 4]; assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusWinner, ); @@ -3511,12 +3546,11 @@ mod offchain_phragmen { }); assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusEdge, ); @@ -3547,12 +3581,11 @@ mod offchain_phragmen { }); assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusSelfVote, ); @@ -3583,12 +3616,11 @@ mod offchain_phragmen { // This raises score issue. assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusSelfVote, ); @@ -3618,12 +3650,11 @@ mod offchain_phragmen { } assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusCompact, ); @@ -3660,12 +3691,11 @@ mod offchain_phragmen { }); assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusNomination, ); @@ -3723,12 +3753,11 @@ mod offchain_phragmen { }); // can be submitted. - assert_ok!(Staking::submit_election_solution( + assert_ok!(submit_solution( Origin::signed(10), winners, compact, score, - current_era(), )); // a wrong solution. @@ -3742,12 +3771,11 @@ mod offchain_phragmen { // is rejected. assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenSlashedNomination, ); @@ -3770,12 +3798,11 @@ mod offchain_phragmen { score[0] += 1; assert_noop!( - Staking::submit_election_solution( + submit_solution( Origin::signed(10), winners, compact, score, - current_era(), ), Error::::PhragmenBogusScore, ); diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 11109fb177..68d56ee955 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -218,6 +218,7 @@ macro_rules! assert_err_ignore_postinfo { } } +/// Assert an expression returns error with the given weight. #[macro_export] #[cfg(feature = "std")] macro_rules! assert_err_with_weight { diff --git a/primitives/phragmen/compact/src/lib.rs b/primitives/phragmen/compact/src/lib.rs index cbd8596a59..735e0abaa6 100644 --- a/primitives/phragmen/compact/src/lib.rs +++ b/primitives/phragmen/compact/src/lib.rs @@ -158,6 +158,23 @@ fn struct_def( ) }).collect::(); + + let len_impl = (1..=count).map(|c| { + let field_name = field_name_for(c); + quote!( + all_len = all_len.saturating_add(self.#field_name.len()); + ) + }).collect::(); + + let edge_count_impl = (1..count).map(|c| { + let field_name = field_name_for(c); + quote!( + all_edges = all_edges.saturating_add( + self.#field_name.len().saturating_mul(#c as usize) + ); + ) + }).collect::(); + Ok(quote! ( /// A struct to encode a Phragmen assignment in a compact way. #[derive( @@ -181,6 +198,28 @@ fn struct_def( { const LIMIT: usize = #count; } + + impl<#voter_type, #target_type, #weight_type> #ident<#voter_type, #target_type, #weight_type> { + /// Get the length of all the assignments that this type is encoding. This is basically + /// the same as the number of assignments, or the number of voters in total. + pub fn len(&self) -> usize { + let mut all_len = 0usize; + #len_impl + all_len + } + + /// Get the total count of edges. + pub fn edge_count(&self) -> usize { + let mut all_edges = 0usize; + #edge_count_impl + all_edges + } + + /// Get the average edge count. + pub fn average_edge_count(&self) -> usize { + self.edge_count().checked_div(self.len()).unwrap_or(0) + } + } )) } diff --git a/primitives/phragmen/src/tests.rs b/primitives/phragmen/src/tests.rs index c7b43e8a3c..0219c35a8b 100644 --- a/primitives/phragmen/src/tests.rs +++ b/primitives/phragmen/src/tests.rs @@ -672,6 +672,8 @@ mod compact { compact, Decode::decode(&mut &encoded[..]).unwrap(), ); + assert_eq!(compact.len(), 4); + assert_eq!(compact.edge_count(), 2 + 4); } fn basic_ratio_test_with() where @@ -747,6 +749,13 @@ mod compact { target_index, ).unwrap(); + // basically number of assignments that it is encoding. + assert_eq!(compacted.len(), assignments.len()); + assert_eq!( + compacted.edge_count(), + assignments.iter().fold(0, |a, b| a + b.distribution.len()), + ); + assert_eq!( compacted, TestCompact { @@ -844,6 +853,11 @@ mod compact { voter_index, target_index, ).unwrap(); + assert_eq!(compacted.len(), assignments.len()); + assert_eq!( + compacted.edge_count(), + assignments.iter().fold(0, |a, b| a + b.distribution.len()), + ); assert_eq!( compacted, diff --git a/utils/frame/benchmarking-cli/src/command.rs b/utils/frame/benchmarking-cli/src/command.rs index ed63ec5e5d..f867d75d2a 100644 --- a/utils/frame/benchmarking-cli/src/command.rs +++ b/utils/frame/benchmarking-cli/src/command.rs @@ -27,7 +27,12 @@ use sc_service::{Configuration, NativeExecutionDispatch}; use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, NumberFor}, }; -use sp_core::{tasks, testing::KeyStore, traits::KeystoreExt}; +use sp_core::{ + tasks, + testing::KeyStore, + traits::KeystoreExt, + offchain::{OffchainExt, testing::TestOffchainExt}, +}; use std::fmt::Debug; impl BenchmarkCmd { @@ -56,6 +61,8 @@ impl BenchmarkCmd { let mut extensions = Extensions::default(); extensions.register(KeystoreExt(KeyStore::new())); + let (offchain, _) = TestOffchainExt::new(); + extensions.register(OffchainExt::new(offchain)); let result = StateMachine::<_, _, NumberFor, _>::new( &state, -- GitLab From ffa32fa60767838b4ec779fb6ac42e7516600a7d Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 25 May 2020 13:25:49 +0200 Subject: [PATCH 050/280] Fix default base path on windows (#6120) * Use directories instead of app_dirs * Use local data dir --- Cargo.lock | 40 +--------------------------------------- client/cli/Cargo.toml | 2 +- client/cli/src/config.rs | 13 ++++--------- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc2c435b3a..77119aa760 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,18 +112,6 @@ version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2494382e9ba43995f3c56359e518641f450f5c36feeb4632a75cde2ec297c867" -[[package]] -name = "app_dirs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" -dependencies = [ - "ole32-sys", - "shell32-sys", - "winapi 0.2.8", - "xdg", -] - [[package]] name = "approx" version = "0.3.2" @@ -3906,16 +3894,6 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" -[[package]] -name = "ole32-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "once_cell" version = "1.4.0" @@ -5980,10 +5958,10 @@ name = "sc-cli" version = "0.8.0-dev" dependencies = [ "ansi_term 0.12.1", - "app_dirs", "atty", "chrono", "derive_more", + "directories", "env_logger 0.7.1", "fdlimit", "futures 0.3.5", @@ -7145,16 +7123,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "shell32-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "shlex" version = "0.1.1" @@ -9618,12 +9586,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "xdg" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" - [[package]] name = "yamux" version = "0.4.5" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 406bb1becc..de67879295 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -20,7 +20,7 @@ regex = "1.3.1" time = "0.1.42" ansi_term = "0.12.1" lazy_static = "1.4.0" -app_dirs = "1.2.1" +directories = "2.0.2" tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index fdaee929a6..a1ee1b0cc1 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -24,7 +24,6 @@ use crate::{ init_logger, DatabaseParams, ImportParams, KeystoreParams, NetworkParams, NodeKeyParams, OffchainWorkerParams, PruningParams, SharedParams, SubstrateCli, }; -use app_dirs::{AppDataType, AppInfo}; use names::{Generator, Name}; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_service::config::{ @@ -406,14 +405,10 @@ pub trait CliConfiguration: Sized { let config_dir = self .base_path()? .unwrap_or_else(|| { - app_dirs::get_app_root( - AppDataType::UserData, - &AppInfo { - name: C::executable_name(), - author: C::author(), - }, - ) - .expect("app directories exist on all supported platforms; qed") + directories::ProjectDirs::from("", "", C::executable_name()) + .expect("app directories exist on all supported platforms; qed") + .data_local_dir() + .into() }) .join("chains") .join(chain_spec.id()); -- GitLab From 6dd95319ed853aee046f3fd86fb64b61f9d1d725 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 25 May 2020 17:52:50 +0300 Subject: [PATCH 051/280] Benchmarks sanity checks (#6119) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add read-only externalities * sanity checks * cleanup * Update primitives/state-machine/src/read_only.rs Co-authored-by: Bastian Köcher * fix typo * add error exit code if nothing was run Co-authored-by: Bastian Köcher --- Cargo.lock | 1 + bin/node/bench/Cargo.toml | 1 + bin/node/bench/src/import.rs | 38 +++++ bin/node/bench/src/main.rs | 5 + primitives/state-machine/src/lib.rs | 2 + primitives/state-machine/src/read_only.rs | 194 ++++++++++++++++++++++ 6 files changed, 241 insertions(+) create mode 100644 primitives/state-machine/src/read_only.rs diff --git a/Cargo.lock b/Cargo.lock index 77119aa760..8194436e1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3394,6 +3394,7 @@ dependencies = [ "lazy_static", "log", "node-primitives", + "node-runtime", "node-testing", "parity-db", "parity-util-mem", diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index ec72a125bb..70147db207 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -12,6 +12,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" log = "0.4.8" node-primitives = { version = "2.0.0-dev", path = "../primitives" } node-testing = { version = "2.0.0-dev", path = "../testing" } +node-runtime = { version = "2.0.0-dev", path = "../runtime" } sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" } sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs index 5cbb851867..c1b324c03c 100644 --- a/bin/node/bench/src/import.rs +++ b/bin/node/bench/src/import.rs @@ -36,6 +36,7 @@ use node_testing::bench::{BenchDb, Profile, BlockType, KeyTypes, DatabaseType}; use node_primitives::Block; use sc_client_api::backend::Backend; use sp_runtime::generic::BlockId; +use sp_state_machine::InspectState; use crate::core::{self, Path, Mode}; @@ -81,6 +82,7 @@ pub struct ImportBenchmark { profile: Profile, database: BenchDb, block: Block, + block_type: BlockType, } impl core::BenchmarkDescription for ImportBenchmarkDescription { @@ -124,6 +126,7 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription { let block = bench_db.generate_block(self.block_type.to_content(self.size.transactions())); Box::new(ImportBenchmark { database: bench_db, + block_type: self.block_type, block, profile, }) @@ -155,6 +158,41 @@ impl core::Benchmark for ImportBenchmark { context.import_block(self.block.clone()); let elapsed = start.elapsed(); + // Sanity checks. + context.client.state_at(&BlockId::number(1)).expect("state_at failed for block#1") + .inspect_with(|| { + match self.block_type { + BlockType::RandomTransfersKeepAlive => { + // should be 5 per signed extrinsic + 1 per unsigned + // we have 1 unsigned and the rest are signed in the block + // those 5 events per signed are: + // - new account (RawEvent::NewAccount) as we always transfer fund to non-existant account + // - endowed (RawEvent::Endowed) for this new account + // - successful transfer (RawEvent::Transfer) for this transfer operation + // - deposit event for charging transaction fee + // - extrinsic success + assert_eq!( + node_runtime::System::events().len(), + (self.block.extrinsics.len() - 1) * 5 + 1, + ); + }, + BlockType::Noop => { + assert_eq!( + node_runtime::System::events().len(), + + // should be 2 per signed extrinsic + 1 per unsigned + // we have 1 unsigned and the rest are signed in the block + // those 2 events per signed are: + // - deposit event for charging transaction fee + // - extrinsic success + (self.block.extrinsics.len() - 1) * 2 + 1, + ); + }, + _ => {}, + } + } + ); + if mode == Mode::Profile { std::thread::park_timeout(std::time::Duration::from_secs(1)); } diff --git a/bin/node/bench/src/main.rs b/bin/node/bench/src/main.rs index 419aacb6a5..5c5af37038 100644 --- a/bin/node/bench/src/main.rs +++ b/bin/node/bench/src/main.rs @@ -152,6 +152,11 @@ fn main() { } } + if results.is_empty() { + eprintln!("No benchmark was found for query"); + std::process::exit(1); + } + if opt.json { let json_result: String = serde_json::to_string(&results).expect("Failed to construct json"); println!("{}", json_result); diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index 3a54ef08f3..693a7bc12f 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -42,10 +42,12 @@ mod proving_backend; mod trie_backend; mod trie_backend_essence; mod stats; +mod read_only; pub use sp_trie::{trie_types::{Layout, TrieDBMut}, StorageProof, TrieMut, DBValue, MemoryDB}; pub use testing::TestExternalities; pub use basic::BasicExternalities; +pub use read_only::{ReadOnlyExternalities, InspectState}; pub use ext::Ext; pub use backend::Backend; pub use changes_trie::{ diff --git a/primitives/state-machine/src/read_only.rs b/primitives/state-machine/src/read_only.rs new file mode 100644 index 0000000000..817282f8e7 --- /dev/null +++ b/primitives/state-machine/src/read_only.rs @@ -0,0 +1,194 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Read-only version of Externalities. + +use std::{ + any::{TypeId, Any}, + marker::PhantomData, +}; +use crate::{Backend, StorageKey, StorageValue}; +use hash_db::Hasher; +use sp_core::{ + storage::ChildInfo, + traits::Externalities, Blake2Hasher, +}; +use codec::Encode; + +/// Trait for inspecting state in any backend. +/// +/// Implemented for any backend. +pub trait InspectState> { + /// Inspect state with a closure. + /// + /// Self will be set as read-only externalities and inspection + /// closure will be run against it. + fn inspect_with(&self, f: F); +} + +impl> InspectState for B { + fn inspect_with(&self, f: F) { + ReadOnlyExternalities::from(self).execute_with(f) + } +} + +/// Simple read-only externalities for any backend. +/// +/// To be used in test for state inspection. Will panic if something writes +/// to the storage. +#[derive(Debug)] +pub struct ReadOnlyExternalities<'a, H: Hasher, B: 'a + Backend> { + backend: &'a B, + _phantom: PhantomData, +} + +impl<'a, H: Hasher, B: 'a + Backend> From<&'a B> for ReadOnlyExternalities<'a, H, B> { + fn from(backend: &'a B) -> Self { + ReadOnlyExternalities { backend, _phantom: PhantomData } + } +} + +impl<'a, H: Hasher, B: 'a + Backend> ReadOnlyExternalities<'a, H, B> { + /// Execute the given closure while `self` is set as externalities. + /// + /// Returns the result of the given closure. + pub fn execute_with(&mut self, f: impl FnOnce() -> R) -> R { + sp_externalities::set_and_run_with_externalities(self, f) + } +} + +impl<'a, H: Hasher, B: 'a + Backend> Externalities for ReadOnlyExternalities<'a, H, B> { + fn set_offchain_storage(&mut self, _key: &[u8], _value: Option<&[u8]>) { + panic!("Should not be used in read-only externalities!") + } + + fn storage(&self, key: &[u8]) -> Option { + self.backend.storage(key).expect("Backed failed for storage in ReadOnlyExternalities") + } + + fn storage_hash(&self, key: &[u8]) -> Option> { + self.storage(key).map(|v| Blake2Hasher::hash(&v).encode()) + } + + fn child_storage( + &self, + child_info: &ChildInfo, + key: &[u8], + ) -> Option { + self.backend.child_storage(child_info, key).expect("Backed failed for child_storage in ReadOnlyExternalities") + } + + fn child_storage_hash( + &self, + child_info: &ChildInfo, + key: &[u8], + ) -> Option> { + self.child_storage(child_info, key).map(|v| Blake2Hasher::hash(&v).encode()) + } + + fn next_storage_key(&self, key: &[u8]) -> Option { + self.backend.next_storage_key(key).expect("Backed failed for next_storage_key in ReadOnlyExternalities") + } + + fn next_child_storage_key( + &self, + child_info: &ChildInfo, + key: &[u8], + ) -> Option { + self.backend.next_child_storage_key(child_info, key) + .expect("Backed failed for next_child_storage_key in ReadOnlyExternalities") + } + + fn place_storage(&mut self, _key: StorageKey, _maybe_value: Option) { + unimplemented!("place_storage not supported in ReadOnlyExternalities") + } + + fn place_child_storage( + &mut self, + _child_info: &ChildInfo, + _key: StorageKey, + _value: Option, + ) { + unimplemented!("place_child_storage not supported in ReadOnlyExternalities") + } + + fn kill_child_storage( + &mut self, + _child_info: &ChildInfo, + ) { + unimplemented!("kill_child_storage is not supported in ReadOnlyExternalities") + } + + fn clear_prefix(&mut self, _prefix: &[u8]) { + unimplemented!("clear_prefix is not supported in ReadOnlyExternalities") + } + + fn clear_child_prefix( + &mut self, + _child_info: &ChildInfo, + _prefix: &[u8], + ) { + unimplemented!("clear_child_prefix is not supported in ReadOnlyExternalities") + } + + fn storage_append( + &mut self, + _key: Vec, + _value: Vec, + ) { + unimplemented!("storage_append is not supported in ReadOnlyExternalities") + } + + fn chain_id(&self) -> u64 { 42 } + + fn storage_root(&mut self) -> Vec { + unimplemented!("storage_root is not supported in ReadOnlyExternalities") + } + + fn child_storage_root( + &mut self, + _child_info: &ChildInfo, + ) -> Vec { + unimplemented!("child_storage_root is not supported in ReadOnlyExternalities") + } + + fn storage_changes_root(&mut self, _parent: &[u8]) -> Result>, ()> { + unimplemented!("storage_changes_root is not supported in ReadOnlyExternalities") + } + + fn wipe(&mut self) {} + + fn commit(&mut self) {} +} + +impl<'a, H: Hasher, B: 'a + Backend> sp_externalities::ExtensionStore for ReadOnlyExternalities<'a, H, B> { + fn extension_by_type_id(&mut self, _type_id: TypeId) -> Option<&mut dyn Any> { + unimplemented!("extension_by_type_id is not supported in ReadOnlyExternalities") + } + + fn register_extension_with_type_id( + &mut self, + _type_id: TypeId, + _extension: Box, + ) -> Result<(), sp_externalities::Error> { + unimplemented!("register_extension_with_type_id is not supported in ReadOnlyExternalities") + } + + fn deregister_extension_by_type_id(&mut self, _type_id: TypeId) -> Result<(), sp_externalities::Error> { + unimplemented!("deregister_extension_by_type_id is not supported in ReadOnlyExternalities") + } +} -- GitLab From b5e84bb598be11469a9875ad9e17b228701ddc3f Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Mon, 25 May 2020 17:11:47 +0200 Subject: [PATCH 052/280] Events and better log for staking. (#6118) * Events and better log for staking. * Fix build * Update frame/staking/src/lib.rs Co-authored-by: Marcio Diaz Co-authored-by: Marcio Diaz --- frame/staking/src/lib.rs | 22 ++++++++++++++-------- frame/staking/src/offchain_election.rs | 6 +++--- frame/staking/src/tests.rs | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 526d094eac..4e9a8918c5 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -290,7 +290,7 @@ use sp_std::{ }; use codec::{HasCompact, Encode, Decode}; use frame_support::{ - decl_module, decl_event, decl_storage, ensure, decl_error, debug, + decl_module, decl_event, decl_storage, ensure, decl_error, weights::{Weight, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, storage::IterableStorageMap, dispatch::{IsSubType, DispatchResult, DispatchResultWithPostInfo, WithPostDispatchInfo}, @@ -332,13 +332,14 @@ const STAKING_ID: LockIdentifier = *b"staking "; pub const MAX_UNLOCKING_CHUNKS: usize = 32; pub const MAX_NOMINATIONS: usize = ::LIMIT; -// syntactic sugar for logging -#[cfg(feature = "std")] -const LOG_TARGET: &'static str = "staking"; +pub(crate) const LOG_TARGET: &'static str = "staking"; + +// syntactic sugar for logging. +#[macro_export] macro_rules! log { ($level:tt, $patter:expr $(, $values:expr)* $(,)?) => { - debug::native::$level!( - target: LOG_TARGET, + frame_support::debug::$level!( + target: crate::LOG_TARGET, $patter $(, $values)* ) }; @@ -372,7 +373,7 @@ generate_compact_solution_type!(pub GenericCompactAssignments, 16); pub struct ActiveEraInfo { /// Index of era. pub index: EraIndex, - /// Moment of start expresed as millisecond from `$UNIX_EPOCH`. + /// Moment of start expressed as millisecond from `$UNIX_EPOCH`. /// /// Start can be none if start hasn't been set for the era yet, /// Start is set on the first on_finalize of the era to guarantee usage of `Time`. @@ -1172,6 +1173,8 @@ decl_event!( OldSlashingReportDiscarded(SessionIndex), /// A new set of stakers was elected with the given computation method. StakingElection(ElectionCompute), + /// A new solution for the upcoming election has been stored. + SolutionStored(ElectionCompute), /// An account has bonded this amount. /// /// NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably, @@ -1327,7 +1330,7 @@ decl_module! { log!(debug, "skipping offchain worker in open election window due to [{}]", why); } else { if let Err(e) = compute_offchain_election::() { - log!(warn, "💸 Error in phragmen offchain worker: {:?}", e); + log!(error, "💸 Error in phragmen offchain worker: {:?}", e); } else { log!(debug, "Executed offchain worker thread without errors."); } @@ -2788,6 +2791,9 @@ impl Module { }); QueuedScore::put(submitted_score); + // emit event. + Self::deposit_event(RawEvent::SolutionStored(compute)); + Ok(Some(adjusted_weight).into()) } diff --git a/frame/staking/src/offchain_election.rs b/frame/staking/src/offchain_election.rs index d93b5b2b27..ce9b77aef7 100644 --- a/frame/staking/src/offchain_election.rs +++ b/frame/staking/src/offchain_election.rs @@ -29,7 +29,7 @@ use sp_phragmen::{ }; use sp_runtime::offchain::storage::StorageValueRef; use sp_runtime::{PerThing, RuntimeDebug, traits::{TrailingZeroInput, Zero}}; -use frame_support::{debug, traits::Get}; +use frame_support::traits::Get; use sp_std::{convert::TryInto, prelude::*}; /// Error types related to the offchain election machinery. @@ -249,8 +249,8 @@ pub fn prepare_submission( nominators: snapshot_nominators.len() as NominatorIndex, }; - debug::native::debug!( - target: "staking", + crate::log!( + info, "prepared solution after {} equalization iterations with score {:?}", iterations_executed, score, diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 12ae71c1cd..f43c6383ea 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -3031,6 +3031,21 @@ mod offchain_phragmen { let queued_result = Staking::queued_elected().unwrap(); assert_eq!(queued_result.compute, ElectionCompute::Signed); + assert_eq!( + System::events() + .into_iter() + .map(|r| r.event) + .filter_map(|e| { + if let MetaEvent::staking(inner) = e { + Some(inner) + } else { + None + } + }) + .last() + .unwrap(), + RawEvent::SolutionStored(ElectionCompute::Signed), + ); run_to_block(15); assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); -- GitLab From df30fd4b26c9b1e00a08cd16fcbdc8772d8459d9 Mon Sep 17 00:00:00 2001 From: Sergei Pepyakin Date: Mon, 25 May 2020 17:25:57 +0200 Subject: [PATCH 053/280] Tidy tests a bit. (#6122) --- .../{tests => fixtures}/caller_contract.wat | 0 .../check_default_rent_allowance.wat | 0 .../{tests => fixtures}/crypto_hashes.wat | 0 .../destroy_and_transfer.wat | 0 .../{tests => fixtures}/dispatch_call.wat | 0 .../dispatch_call_then_trap.wat | 0 frame/contracts/{tests => fixtures}/drain.wat | 0 .../get_runtime_storage.wat | 0 .../{tests => fixtures}/restoration.wat | 0 .../return_from_start_fn.wat | 0 .../{tests => fixtures}/return_with_data.wat | 0 .../{tests => fixtures}/run_out_of_gas.wat | 0 .../{tests => fixtures}/self_destruct.wat | 0 .../self_destructing_constructor.wat | 0 .../{tests => fixtures}/set_rent.wat | 0 .../{tests => fixtures}/storage_size.wat | 0 frame/contracts/src/tests.rs | 2276 +++++++++-------- 17 files changed, 1193 insertions(+), 1083 deletions(-) rename frame/contracts/{tests => fixtures}/caller_contract.wat (100%) rename frame/contracts/{tests => fixtures}/check_default_rent_allowance.wat (100%) rename frame/contracts/{tests => fixtures}/crypto_hashes.wat (100%) rename frame/contracts/{tests => fixtures}/destroy_and_transfer.wat (100%) rename frame/contracts/{tests => fixtures}/dispatch_call.wat (100%) rename frame/contracts/{tests => fixtures}/dispatch_call_then_trap.wat (100%) rename frame/contracts/{tests => fixtures}/drain.wat (100%) rename frame/contracts/{tests => fixtures}/get_runtime_storage.wat (100%) rename frame/contracts/{tests => fixtures}/restoration.wat (100%) rename frame/contracts/{tests => fixtures}/return_from_start_fn.wat (100%) rename frame/contracts/{tests => fixtures}/return_with_data.wat (100%) rename frame/contracts/{tests => fixtures}/run_out_of_gas.wat (100%) rename frame/contracts/{tests => fixtures}/self_destruct.wat (100%) rename frame/contracts/{tests => fixtures}/self_destructing_constructor.wat (100%) rename frame/contracts/{tests => fixtures}/set_rent.wat (100%) rename frame/contracts/{tests => fixtures}/storage_size.wat (100%) diff --git a/frame/contracts/tests/caller_contract.wat b/frame/contracts/fixtures/caller_contract.wat similarity index 100% rename from frame/contracts/tests/caller_contract.wat rename to frame/contracts/fixtures/caller_contract.wat diff --git a/frame/contracts/tests/check_default_rent_allowance.wat b/frame/contracts/fixtures/check_default_rent_allowance.wat similarity index 100% rename from frame/contracts/tests/check_default_rent_allowance.wat rename to frame/contracts/fixtures/check_default_rent_allowance.wat diff --git a/frame/contracts/tests/crypto_hashes.wat b/frame/contracts/fixtures/crypto_hashes.wat similarity index 100% rename from frame/contracts/tests/crypto_hashes.wat rename to frame/contracts/fixtures/crypto_hashes.wat diff --git a/frame/contracts/tests/destroy_and_transfer.wat b/frame/contracts/fixtures/destroy_and_transfer.wat similarity index 100% rename from frame/contracts/tests/destroy_and_transfer.wat rename to frame/contracts/fixtures/destroy_and_transfer.wat diff --git a/frame/contracts/tests/dispatch_call.wat b/frame/contracts/fixtures/dispatch_call.wat similarity index 100% rename from frame/contracts/tests/dispatch_call.wat rename to frame/contracts/fixtures/dispatch_call.wat diff --git a/frame/contracts/tests/dispatch_call_then_trap.wat b/frame/contracts/fixtures/dispatch_call_then_trap.wat similarity index 100% rename from frame/contracts/tests/dispatch_call_then_trap.wat rename to frame/contracts/fixtures/dispatch_call_then_trap.wat diff --git a/frame/contracts/tests/drain.wat b/frame/contracts/fixtures/drain.wat similarity index 100% rename from frame/contracts/tests/drain.wat rename to frame/contracts/fixtures/drain.wat diff --git a/frame/contracts/tests/get_runtime_storage.wat b/frame/contracts/fixtures/get_runtime_storage.wat similarity index 100% rename from frame/contracts/tests/get_runtime_storage.wat rename to frame/contracts/fixtures/get_runtime_storage.wat diff --git a/frame/contracts/tests/restoration.wat b/frame/contracts/fixtures/restoration.wat similarity index 100% rename from frame/contracts/tests/restoration.wat rename to frame/contracts/fixtures/restoration.wat diff --git a/frame/contracts/tests/return_from_start_fn.wat b/frame/contracts/fixtures/return_from_start_fn.wat similarity index 100% rename from frame/contracts/tests/return_from_start_fn.wat rename to frame/contracts/fixtures/return_from_start_fn.wat diff --git a/frame/contracts/tests/return_with_data.wat b/frame/contracts/fixtures/return_with_data.wat similarity index 100% rename from frame/contracts/tests/return_with_data.wat rename to frame/contracts/fixtures/return_with_data.wat diff --git a/frame/contracts/tests/run_out_of_gas.wat b/frame/contracts/fixtures/run_out_of_gas.wat similarity index 100% rename from frame/contracts/tests/run_out_of_gas.wat rename to frame/contracts/fixtures/run_out_of_gas.wat diff --git a/frame/contracts/tests/self_destruct.wat b/frame/contracts/fixtures/self_destruct.wat similarity index 100% rename from frame/contracts/tests/self_destruct.wat rename to frame/contracts/fixtures/self_destruct.wat diff --git a/frame/contracts/tests/self_destructing_constructor.wat b/frame/contracts/fixtures/self_destructing_constructor.wat similarity index 100% rename from frame/contracts/tests/self_destructing_constructor.wat rename to frame/contracts/fixtures/self_destructing_constructor.wat diff --git a/frame/contracts/tests/set_rent.wat b/frame/contracts/fixtures/set_rent.wat similarity index 100% rename from frame/contracts/tests/set_rent.wat rename to frame/contracts/fixtures/set_rent.wat diff --git a/frame/contracts/tests/storage_size.wat b/frame/contracts/fixtures/storage_size.wat similarity index 100% rename from frame/contracts/tests/storage_size.wat rename to frame/contracts/fixtures/storage_size.wat diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 23c0417dac..944bca622b 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -14,33 +14,27 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -// TODO: #1417 Add more integration tests -// also remove the #![allow(unused)] below. - -#![allow(unused)] - use crate::{ - BalanceOf, ComputeDispatchFee, ContractAddressFor, ContractInfo, ContractInfoOf, GenesisConfig, - Module, RawAliveContractInfo, RawEvent, Trait, TrieId, TrieIdFromParentCounter, Schedule, - TrieIdGenerator, account_db::{AccountDb, DirectAccountDb, OverlayAccountDb}, + BalanceOf, ContractAddressFor, ContractInfo, ContractInfoOf, GenesisConfig, Module, + RawAliveContractInfo, RawEvent, Trait, TrieId, Schedule, TrieIdGenerator, + account_db::{AccountDb, DirectAccountDb, OverlayAccountDb}, gas::Gas, }; use assert_matches::assert_matches; use hex_literal::*; -use codec::{Decode, Encode, KeyedVec}; +use codec::Encode; use sp_runtime::{ - Perbill, BuildStorage, transaction_validity::{InvalidTransaction, ValidTransaction}, - traits::{BlakeTwo256, Hash, IdentityLookup, SignedExtension, Convert}, - testing::{Digest, DigestItem, Header, UintAuthorityId, H256}, + Perbill, + traits::{BlakeTwo256, Hash, IdentityLookup, Convert}, + testing::{Header, H256}, }; use frame_support::{ - assert_ok, assert_err, assert_err_ignore_postinfo, impl_outer_dispatch, impl_outer_event, - impl_outer_origin, parameter_types, - storage::child, StorageMap, StorageValue, traits::{Currency, Get}, - weights::{DispatchInfo, DispatchClass, Weight, PostDispatchInfo, Pays, IdentityFee}, + assert_ok, assert_err_ignore_postinfo, impl_outer_dispatch, impl_outer_event, + impl_outer_origin, parameter_types, StorageMap, StorageValue, + traits::{Currency, Get}, + weights::{Weight, PostDispatchInfo, IdentityFee}, }; -use std::{cell::RefCell, sync::atomic::{AtomicUsize, Ordering}}; -use sp_core::storage::well_known_keys; +use std::cell::RefCell; use frame_system::{self as system, EventRecord, Phase}; mod contracts { @@ -48,7 +42,7 @@ mod contracts { // needs to give a name for the current crate. // This hack is required for `impl_outer_event!`. pub use super::super::*; - use frame_support::impl_outer_event; + pub use frame_support::impl_outer_event; } use pallet_balances as balances; @@ -190,8 +184,6 @@ impl ContractAddressFor for DummyContractAddressFor { pub struct DummyTrieIdGenerator; impl TrieIdGenerator for DummyTrieIdGenerator { fn trie_id(account_id: &u64) -> TrieId { - use sp_core::storage::well_known_keys; - let new_seed = super::AccountCounter::mutate(|v| { *v = v.wrapping_add(1); *v @@ -204,13 +196,6 @@ impl TrieIdGenerator for DummyTrieIdGenerator { } } -pub struct DummyComputeDispatchFee; -impl ComputeDispatchFee for DummyComputeDispatchFee { - fn compute_dispatch_fee(call: &Call) -> u64 { - 69 - } -} - const ALICE: u64 = 1; const BOB: u64 = 2; const CHARLIE: u64 = 3; @@ -254,14 +239,24 @@ impl ExtBuilder { } } -/// Generate Wasm binary and code hash from wabt source. -fn compile_module(wabt_module: &str) - -> Result<(Vec, ::Output), wabt::Error> - where T: frame_system::Trait +/// Load a given wasm module represented by a .wat file and returns a wasm binary contents along +/// with it's hash. +/// +/// The fixture files are located under the `fixtures/` directory. +fn compile_module( + fixture_name: &str, +) -> Result<(Vec, ::Output), wabt::Error> +where + T: frame_system::Trait, { - let wasm = wabt::wat2wasm(wabt_module)?; - let code_hash = T::Hashing::hash(&wasm); - Ok((wasm, code_hash)) + use std::fs; + + let fixture_path = ["fixtures/", fixture_name, ".wat"].concat(); + let module_wat_source = + fs::read_to_string(&fixture_path).expect(&format!("Unable to find {} fixture", fixture_name)); + let wasm_binary = wabt::wat2wasm(module_wat_source)?; + let code_hash = T::Hashing::hash(&wasm_binary); + Ok((wasm_binary, code_hash)) } // Perform a simple transfer to a non-existent account. @@ -269,7 +264,7 @@ fn compile_module(wabt_module: &str) #[test] fn returns_base_call_cost() { ExtBuilder::default().build().execute_with(|| { - Balances::deposit_creating(&ALICE, 100_000_000); + let _ = Balances::deposit_creating(&ALICE, 100_000_000); assert_eq!( Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, Vec::new()), @@ -292,7 +287,7 @@ fn account_removal_does_not_remove_storage() { // Set up two accounts with free balance above the existential threshold. { - Balances::deposit_creating(&1, 110); + let _ = Balances::deposit_creating(&1, 110); ContractInfoOf::::insert(1, &ContractInfo::Alive(RawAliveContractInfo { trie_id: trie_id1.clone(), storage_size: ::StorageSizeOffset::get(), @@ -307,7 +302,7 @@ fn account_removal_does_not_remove_storage() { overlay.set_storage(&1, key2.clone(), Some(b"2".to_vec())); DirectAccountDb.commit(overlay.into_change_set()); - Balances::deposit_creating(&2, 110); + let _ = Balances::deposit_creating(&2, 110); ContractInfoOf::::insert(2, &ContractInfo::Alive(RawAliveContractInfo { trie_id: trie_id2.clone(), storage_size: ::StorageSizeOffset::get(), @@ -357,71 +352,73 @@ fn account_removal_does_not_remove_storage() { #[test] fn instantiate_and_call_and_deposit_event() { - let (wasm, code_hash) = compile_module::(&load_wasm("return_from_start_fn.wat")) - .unwrap(); + let (wasm, code_hash) = compile_module::("return_from_start_fn").unwrap(); - ExtBuilder::default().existential_deposit(100).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); + ExtBuilder::default() + .existential_deposit(100) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Check at the end to get hash on error easily - let creation = Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - ); + // Check at the end to get hash on error easily + let creation = Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, + code_hash.into(), + vec![], + ); - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::ContractExecution(BOB, vec![1, 2, 3, 4])), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), - topics: vec![], - } - ]); + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances( + pallet_balances::RawEvent::Endowed(BOB, 100) + ), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::ContractExecution(BOB, vec![1, 2, 3, 4])), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), + topics: vec![], + } + ]); - assert_ok!(creation); - assert!(ContractInfoOf::::contains_key(BOB)); - }); + assert_ok!(creation); + assert!(ContractInfoOf::::contains_key(BOB)); + }); } #[test] @@ -431,118 +428,120 @@ fn dispatch_call() { let encoded = Encode::encode(&Call::Balances(pallet_balances::Call::transfer(CHARLIE, 50))); assert_eq!(&encoded[..], &hex!("00000300000000000000C8")[..]); - let (wasm, code_hash) = compile_module::(&load_wasm("dispatch_call.wat")) - .unwrap(); + let (wasm, code_hash) = compile_module::("dispatch_call").unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Let's keep this assert even though it's redundant. If you ever need to update the - // wasm source this test will fail and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - ]); - - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, // newly created account - 0, - GAS_LIMIT, - vec![], - )); - - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), - topics: vec![], - }, + // Let's keep this assert even though it's redundant. If you ever need to update the + // wasm source this test will fail and will show you the actual hash. + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + ]); - // Dispatching the call. - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(CHARLIE)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(CHARLIE, 50) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Transfer(BOB, CHARLIE, 50) - ), - topics: vec![], - }, + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, + code_hash.into(), + vec![], + )); - // Event emitted as a result of dispatch. - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Dispatched(BOB, true)), - topics: vec![], - } - ]); - }); + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, // newly created account + 0, + GAS_LIMIT, + vec![], + )); + + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances( + pallet_balances::RawEvent::Endowed(BOB, 100) + ), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), + topics: vec![], + }, + + // Dispatching the call. + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(CHARLIE)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances( + pallet_balances::RawEvent::Endowed(CHARLIE, 50) + ), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances( + pallet_balances::RawEvent::Transfer(BOB, CHARLIE, 50) + ), + topics: vec![], + }, + + // Event emitted as a result of dispatch. + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Dispatched(BOB, true)), + topics: vec![], + } + ]); + }); } #[test] @@ -552,107 +551,108 @@ fn dispatch_call_not_dispatched_after_top_level_transaction_failure() { let encoded = Encode::encode(&Call::Balances(pallet_balances::Call::transfer(CHARLIE, 50))); assert_eq!(&encoded[..], &hex!("00000300000000000000C8")[..]); - let (wasm, code_hash) = compile_module::(&load_wasm("dispatch_call_then_trap.wat")) - .unwrap(); + let (wasm, code_hash) = compile_module::("dispatch_call_then_trap").unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Let's keep this assert even though it's redundant. If you ever need to update the - // wasm source this test will fail and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - ]); - - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Call the newly instantiated contract. The contract is expected to dispatch a call - // and then trap. - assert_err_ignore_postinfo!( - Contracts::call( + // Let's keep this assert even though it's redundant. If you ever need to update the + // wasm source this test will fail and will show you the actual hash. + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + ]); + + assert_ok!(Contracts::instantiate( Origin::signed(ALICE), - BOB, // newly created account - 0, + 100, GAS_LIMIT, + code_hash.into(), vec![], - ), - "contract trapped during execution" - ); - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(BOB, 100) + )); + + // Call the newly instantiated contract. The contract is expected to dispatch a call + // and then trap. + assert_err_ignore_postinfo!( + Contracts::call( + Origin::signed(ALICE), + BOB, // newly created account + 0, + GAS_LIMIT, + vec![], ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), - topics: vec![], - }, - // ABSENCE of events which would be caused by dispatched Balances::transfer call - ]); - }); + "contract trapped during execution" + ); + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances( + pallet_balances::RawEvent::Endowed(BOB, 100) + ), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), + topics: vec![], + }, + // ABSENCE of events which would be caused by dispatched Balances::transfer call + ]); + }); } #[test] fn run_out_of_gas() { - let (wasm, code_hash) = compile_module::(&load_wasm("run_out_of_gas.wat")) - .unwrap(); + let (wasm, code_hash) = compile_module::("run_out_of_gas").unwrap(); ExtBuilder::default() .existential_deposit(50) .build() .execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); + let _ = Balances::deposit_creating(&ALICE, 1_000_000); assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); @@ -696,60 +696,97 @@ fn test_set_rent_code_and_hash() { let encoded = Encode::encode(&Call::Balances(pallet_balances::Call::transfer(CHARLIE, 50))); assert_eq!(&encoded[..], &hex!("00000300000000000000C8")[..]); - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // If you ever need to update the wasm source this test will fail - // and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - ]); - }); -} + // If you ever need to update the wasm source this test will fail + // and will show you the actual hash. + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), + topics: vec![], + }, + ]); + }); +} #[test] fn storage_size() { - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); // Storage size - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 30_000, - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.storage_size, ::StorageSizeOffset::get() + 4); - - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::set_storage_4_byte())); - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.storage_size, ::StorageSizeOffset::get() + 4 + 4); - - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::remove_storage_4_byte())); - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.storage_size, ::StorageSizeOffset::get() + 4); - }); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 30_000, + GAS_LIMIT, + code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); + let bob_contract = ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap(); + assert_eq!( + bob_contract.storage_size, + ::StorageSizeOffset::get() + 4 + ); + + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + call::set_storage_4_byte() + )); + let bob_contract = ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap(); + assert_eq!( + bob_contract.storage_size, + ::StorageSizeOffset::get() + 4 + 4 + ); + + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + call::remove_storage_4_byte() + )); + let bob_contract = ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap(); + assert_eq!( + bob_contract.storage_size, + ::StorageSizeOffset::get() + 4 + ); + }); } fn initialize_block(number: u64) { @@ -764,68 +801,71 @@ fn initialize_block(number: u64) { #[test] fn deduct_blocks() { - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 30_000, - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - - // Check creation - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 1_000); - - // Advance 4 blocks - initialize_block(5); - - // Trigger rent through call - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); - - // Check result - let rent = (8 + 4 - 3) // storage size = size_offset + deploy_set_storage - deposit_offset - * 4 // rent byte price - * 4; // blocks to rent - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 1_000 - rent); - assert_eq!(bob_contract.deduct_block, 5); - assert_eq!(Balances::free_balance(BOB), 30_000 - rent); - - // Advance 7 blocks more - initialize_block(12); - - // Trigger rent through call - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); - - // Check result - let rent_2 = (8 + 4 - 2) // storage size = size_offset + deploy_set_storage - deposit_offset - * 4 // rent byte price - * 7; // blocks to rent - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 1_000 - rent - rent_2); - assert_eq!(bob_contract.deduct_block, 12); - assert_eq!(Balances::free_balance(BOB), 30_000 - rent - rent_2); - - // Second call on same block should have no effect on rent - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); - - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 1_000 - rent - rent_2); - assert_eq!(bob_contract.deduct_block, 12); - assert_eq!(Balances::free_balance(BOB), 30_000 - rent - rent_2); - }); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 30_000, + GAS_LIMIT, code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); + + // Check creation + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 1_000); + + // Advance 4 blocks + initialize_block(5); + + // Trigger rent through call + assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); + + // Check result + let rent = (8 + 4 - 3) // storage size = size_offset + deploy_set_storage - deposit_offset + * 4 // rent byte price + * 4; // blocks to rent + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 1_000 - rent); + assert_eq!(bob_contract.deduct_block, 5); + assert_eq!(Balances::free_balance(BOB), 30_000 - rent); + + // Advance 7 blocks more + initialize_block(12); + + // Trigger rent through call + assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); + + // Check result + let rent_2 = (8 + 4 - 2) // storage size = size_offset + deploy_set_storage - deposit_offset + * 4 // rent byte price + * 7; // blocks to rent + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 1_000 - rent - rent_2); + assert_eq!(bob_contract.deduct_block, 12); + assert_eq!(Balances::free_balance(BOB), 30_000 - rent - rent_2); + + // Second call on same block should have no effect on rent + assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); + + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 1_000 - rent - rent_2); + assert_eq!(bob_contract.deduct_block, 12); + assert_eq!(Balances::free_balance(BOB), 30_000 - rent - rent_2); + }); } #[test] fn call_contract_removals() { removals(|| { // Call on already-removed account might fail, and this is fine. - Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()); + let _ = Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()); true }); } @@ -858,31 +898,34 @@ fn claim_surcharge_malus() { /// Claim surcharge with the given trigger_call at the given blocks. /// If `removes` is true then assert that the contract is a tombstone. fn claim_surcharge(blocks: u64, trigger_call: impl Fn() -> bool, removes: bool) { - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - - // Advance blocks - initialize_block(blocks); - - // Trigger rent through call - assert!(trigger_call()); - - if removes { - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - } else { - assert!(ContractInfoOf::::get(BOB).unwrap().get_alive().is_some()); - } - }); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); + + // Advance blocks + initialize_block(blocks); + + // Trigger rent through call + assert!(trigger_call()); + + if removes { + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); + } else { + assert!(ContractInfoOf::::get(BOB).unwrap().get_alive().is_some()); + } + }); } /// Test for all kind of removals for the given trigger: @@ -890,194 +933,246 @@ fn claim_surcharge(blocks: u64, trigger_call: impl Fn() -> bool, removes: bool) /// * if allowance is exceeded /// * if balance is reached and balance < subsistence threshold fn removals(trigger_call: impl Fn() -> bool) { - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); // Balance reached and superior to subsistence threshold - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - - let subsistence_threshold = 50 /*existential_deposit*/ + 16 /*tombstone_deposit*/; - - // Trigger rent must have no effect - assert!(trigger_call()); - assert_eq!(ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap().rent_allowance, 1_000); - assert_eq!(Balances::free_balance(BOB), 100); - - // Advance blocks - initialize_block(10); - - // Trigger rent through call - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - assert_eq!(Balances::free_balance(BOB), subsistence_threshold); - - // Advance blocks - initialize_block(20); - - // Trigger rent must have no effect - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - assert_eq!(Balances::free_balance(BOB), subsistence_threshold); - }); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); + + let subsistence_threshold = 50 /*existential_deposit*/ + 16 /*tombstone_deposit*/; + + // Trigger rent must have no effect + assert!(trigger_call()); + assert_eq!(ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap().rent_allowance, 1_000); + assert_eq!(Balances::free_balance(BOB), 100); + + // Advance blocks + initialize_block(10); + + // Trigger rent through call + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); + assert_eq!(Balances::free_balance(BOB), subsistence_threshold); + + // Advance blocks + initialize_block(20); + + // Trigger rent must have no effect + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); + assert_eq!(Balances::free_balance(BOB), subsistence_threshold); + }); // Allowance exceeded - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 1_000, - GAS_LIMIT, code_hash.into(), - ::Balance::from(100u32).encode() // rent allowance - )); - - // Trigger rent must have no effect - assert!(trigger_call()); - assert_eq!(ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap().rent_allowance, 100); - assert_eq!(Balances::free_balance(BOB), 1_000); - - // Advance blocks - initialize_block(10); - - // Trigger rent through call - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - // Balance should be initial balance - initial rent_allowance - assert_eq!(Balances::free_balance(BOB), 900); - - // Advance blocks - initialize_block(20); - - // Trigger rent must have no effect - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - assert_eq!(Balances::free_balance(BOB), 900); - }); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 1_000, + GAS_LIMIT, + code_hash.into(), + ::Balance::from(100u32).encode() // rent allowance + )); + + // Trigger rent must have no effect + assert!(trigger_call()); + assert_eq!( + ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap() + .rent_allowance, + 100 + ); + assert_eq!(Balances::free_balance(BOB), 1_000); + + // Advance blocks + initialize_block(10); + + // Trigger rent through call + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB) + .unwrap() + .get_tombstone() + .is_some()); + // Balance should be initial balance - initial rent_allowance + assert_eq!(Balances::free_balance(BOB), 900); + + // Advance blocks + initialize_block(20); + + // Trigger rent must have no effect + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB) + .unwrap() + .get_tombstone() + .is_some()); + assert_eq!(Balances::free_balance(BOB), 900); + }); // Balance reached and inferior to subsistence threshold - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 50+Balances::minimum_balance(), - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - - // Trigger rent must have no effect - assert!(trigger_call()); - assert_eq!(ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap().rent_allowance, 1_000); - assert_eq!(Balances::free_balance(BOB), 50 + Balances::minimum_balance()); - - // Transfer funds - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::transfer())); - assert_eq!(ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap().rent_allowance, 1_000); - assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); - - // Advance blocks - initialize_block(10); - - // Trigger rent through call - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).is_none()); - assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); - - // Advance blocks - initialize_block(20); - - // Trigger rent must have no effect - assert!(trigger_call()); - assert!(ContractInfoOf::::get(BOB).is_none()); - assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); - }); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 50 + Balances::minimum_balance(), + GAS_LIMIT, + code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); + + // Trigger rent must have no effect + assert!(trigger_call()); + assert_eq!( + ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap() + .rent_allowance, + 1_000 + ); + assert_eq!( + Balances::free_balance(BOB), + 50 + Balances::minimum_balance() + ); + + // Transfer funds + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + call::transfer() + )); + assert_eq!( + ContractInfoOf::::get(BOB) + .unwrap() + .get_alive() + .unwrap() + .rent_allowance, + 1_000 + ); + assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); + + // Advance blocks + initialize_block(10); + + // Trigger rent through call + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB).is_none()); + assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); + + // Advance blocks + initialize_block(20); + + // Trigger rent must have no effect + assert!(trigger_call()); + assert!(ContractInfoOf::::get(BOB).is_none()); + assert_eq!(Balances::free_balance(BOB), Balances::minimum_balance()); + }); } #[test] fn call_removed_contract() { - let (wasm, code_hash) = compile_module::(&load_wasm("set_rent.wat")).unwrap(); + let (wasm, code_hash) = compile_module::("set_rent").unwrap(); // Balance reached and superior to subsistence threshold - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, code_hash.into(), - ::Balance::from(1_000u32).encode() // rent allowance - )); - - // Calling contract should succeed. - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); - - // Advance blocks - initialize_block(10); - - // Calling contract should remove contract and fail. - assert_err_ignore_postinfo!( - Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), - "contract has been evicted" - ); - // Calling a contract that is about to evict shall emit an event. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Evicted(BOB, true)), - topics: vec![], - }, - ]); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm.clone())); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, code_hash.into(), + ::Balance::from(1_000u32).encode() // rent allowance + )); - // Subsequent contract calls should also fail. - assert_err_ignore_postinfo!( - Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), - "contract has been evicted" - ); - }) + // Calling contract should succeed. + assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); + + // Advance blocks + initialize_block(10); + + // Calling contract should remove contract and fail. + assert_err_ignore_postinfo!( + Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), + "contract has been evicted" + ); + // Calling a contract that is about to evict shall emit an event. + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Evicted(BOB, true)), + topics: vec![], + }, + ]); + + // Subsequent contract calls should also fail. + assert_err_ignore_postinfo!( + Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), + "contract has been evicted" + ); + }) } #[test] fn default_rent_allowance_on_instantiate() { - let (wasm, code_hash) = compile_module::( - &load_wasm("check_default_rent_allowance.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 30_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Check creation - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, >::max_value()); - - // Advance blocks - initialize_block(5); - - // Trigger rent through call - assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); - - // Check contract is still alive - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive(); - assert!(bob_contract.is_some()) - }); + let (wasm, code_hash) = compile_module::("check_default_rent_allowance").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 30_000, + GAS_LIMIT, + code_hash.into(), + vec![], + )); + + // Check creation + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, >::max_value()); + + // Advance blocks + initialize_block(5); + + // Trigger rent through call + assert_ok!(Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null())); + + // Check contract is still alive + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive(); + assert!(bob_contract.is_some()) + }); } #[test] @@ -1101,571 +1196,586 @@ fn restoration_success() { } fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: bool) { - let (set_rent_wasm, set_rent_code_hash) = - compile_module::(&load_wasm("set_rent.wat")).unwrap(); - let (restoration_wasm, restoration_code_hash) = - compile_module::(&load_wasm("restoration.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), restoration_wasm)); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), set_rent_wasm)); - - // If you ever need to update the wasm source this test will fail - // and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(restoration_code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(set_rent_code_hash.into())), - topics: vec![], - }, - ]); - - // Create an account with address `BOB` with code `CODE_SET_RENT`. - // The input parameter sets the rent allowance to 0. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 30_000, - GAS_LIMIT, - set_rent_code_hash.into(), - ::Balance::from(0u32).encode() - )); - - // Check if `BOB` was created successfully and that the rent allowance is - // set to 0. - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 0); - - if test_different_storage { - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, 0, GAS_LIMIT, - call::set_storage_4_byte()) - ); - } + let (set_rent_wasm, set_rent_code_hash) = compile_module::("set_rent").unwrap(); + let (restoration_wasm, restoration_code_hash) = compile_module::("restoration").unwrap(); - // Advance 4 blocks, to the 5th. - initialize_block(5); - - /// Preserve `BOB`'s code hash for later introspection. - let bob_code_hash = ContractInfoOf::::get(BOB).unwrap() - .get_alive().unwrap().code_hash; - // Call `BOB`, which makes it pay rent. Since the rent allowance is set to 0 - // we expect that it will get removed leaving tombstone. - assert_err_ignore_postinfo!( - Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), - "contract has been evicted" - ); - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts( - RawEvent::Evicted(BOB.clone(), true) - ), - topics: vec![], - }, - ]); - - /// Create another account with the address `DJANGO` with `CODE_RESTORATION`. - /// - /// Note that we can't use `ALICE` for creating `DJANGO` so we create yet another - /// account `CHARLIE` and create `DJANGO` with it. - Balances::deposit_creating(&CHARLIE, 1_000_000); - assert_ok!(Contracts::instantiate( - Origin::signed(CHARLIE), - 30_000, - GAS_LIMIT, - restoration_code_hash.into(), - ::Balance::from(0u32).encode() - )); - - // Before performing a call to `DJANGO` save its original trie id. - let django_trie_id = ContractInfoOf::::get(DJANGO).unwrap() - .get_alive().unwrap().trie_id; - - if !test_restore_to_with_dirty_storage { - // Advance 1 block, to the 6th. - initialize_block(6); - } + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), restoration_wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), set_rent_wasm)); - // Perform a call to `DJANGO`. This should either perform restoration successfully or - // fail depending on the test parameters. - assert_ok!(Contracts::call( - Origin::signed(ALICE), - DJANGO, - 0, - GAS_LIMIT, - vec![], - )); - - if test_different_storage || test_restore_to_with_dirty_storage { - // Parametrization of the test imply restoration failure. Check that `DJANGO` aka - // restoration contract is still in place and also that `BOB` doesn't exist. - assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); - let django_contract = ContractInfoOf::::get(DJANGO).unwrap() - .get_alive().unwrap(); - assert_eq!(django_contract.storage_size, 16); - assert_eq!(django_contract.trie_id, django_trie_id); - assert_eq!(django_contract.deduct_block, System::block_number()); - match (test_different_storage, test_restore_to_with_dirty_storage) { - (true, false) => { - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts( - RawEvent::Restored(DJANGO, BOB, bob_code_hash, 50, false) - ), - topics: vec![], - }, - ]); - } - (_, true) => { - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Evicted(BOB, true)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(CHARLIE)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(CHARLIE, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(DJANGO)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(DJANGO, 30_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(CHARLIE, DJANGO, 30_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(CHARLIE, DJANGO)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Restored( - DJANGO, - BOB, - bob_code_hash, - 50, - false, - )), - topics: vec![], - }, - ]); - } - _ => unreachable!(), - } - } else { - // Here we expect that the restoration is succeeded. Check that the restoration - // contract `DJANGO` ceased to exist and that `BOB` returned back. - println!("{:?}", ContractInfoOf::::get(BOB)); - let bob_contract = ContractInfoOf::::get(BOB).unwrap() - .get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, 50); - assert_eq!(bob_contract.storage_size, 12); - assert_eq!(bob_contract.trie_id, django_trie_id); - assert_eq!(bob_contract.deduct_block, System::block_number()); - assert!(ContractInfoOf::::get(DJANGO).is_none()); + // If you ever need to update the wasm source this test will fail + // and will show you the actual hash. assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, - event: MetaEvent::system(system::RawEvent::KilledAccount(DJANGO)), + event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), topics: vec![], }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(restoration_code_hash.into())), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::CodeStored(set_rent_code_hash.into())), + topics: vec![], + }, + ]); + + // Create an account with address `BOB` with code `CODE_SET_RENT`. + // The input parameter sets the rent allowance to 0. + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 30_000, + GAS_LIMIT, + set_rent_code_hash.into(), + ::Balance::from(0u32).encode() + )); + + // Check if `BOB` was created successfully and that the rent allowance is + // set to 0. + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 0); + + if test_different_storage { + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, 0, GAS_LIMIT, + call::set_storage_4_byte()) + ); + } + + // Advance 4 blocks, to the 5th. + initialize_block(5); + + // Preserve `BOB`'s code hash for later introspection. + let bob_code_hash = ContractInfoOf::::get(BOB).unwrap() + .get_alive().unwrap().code_hash; + // Call `BOB`, which makes it pay rent. Since the rent allowance is set to 0 + // we expect that it will get removed leaving tombstone. + assert_err_ignore_postinfo!( + Contracts::call(Origin::signed(ALICE), BOB, 0, GAS_LIMIT, call::null()), + "contract has been evicted" + ); + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); + assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, event: MetaEvent::contracts( - RawEvent::Restored(DJANGO, BOB, bob_contract.code_hash, 50, true) + RawEvent::Evicted(BOB.clone(), true) ), topics: vec![], }, ]); - } - }); + + // Create another account with the address `DJANGO` with `CODE_RESTORATION`. + // + // Note that we can't use `ALICE` for creating `DJANGO` so we create yet another + // account `CHARLIE` and create `DJANGO` with it. + let _ = Balances::deposit_creating(&CHARLIE, 1_000_000); + assert_ok!(Contracts::instantiate( + Origin::signed(CHARLIE), + 30_000, + GAS_LIMIT, + restoration_code_hash.into(), + ::Balance::from(0u32).encode() + )); + + // Before performing a call to `DJANGO` save its original trie id. + let django_trie_id = ContractInfoOf::::get(DJANGO).unwrap() + .get_alive().unwrap().trie_id; + + if !test_restore_to_with_dirty_storage { + // Advance 1 block, to the 6th. + initialize_block(6); + } + + // Perform a call to `DJANGO`. This should either perform restoration successfully or + // fail depending on the test parameters. + assert_ok!(Contracts::call( + Origin::signed(ALICE), + DJANGO, + 0, + GAS_LIMIT, + vec![], + )); + + if test_different_storage || test_restore_to_with_dirty_storage { + // Parametrization of the test imply restoration failure. Check that `DJANGO` aka + // restoration contract is still in place and also that `BOB` doesn't exist. + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); + let django_contract = ContractInfoOf::::get(DJANGO).unwrap() + .get_alive().unwrap(); + assert_eq!(django_contract.storage_size, 16); + assert_eq!(django_contract.trie_id, django_trie_id); + assert_eq!(django_contract.deduct_block, System::block_number()); + match (test_different_storage, test_restore_to_with_dirty_storage) { + (true, false) => { + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts( + RawEvent::Restored(DJANGO, BOB, bob_code_hash, 50, false) + ), + topics: vec![], + }, + ]); + } + (_, true) => { + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Evicted(BOB, true)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(CHARLIE)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(CHARLIE, 1_000_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(frame_system::RawEvent::NewAccount(DJANGO)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(DJANGO, 30_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Transfer(CHARLIE, DJANGO, 30_000)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Instantiated(CHARLIE, DJANGO)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts(RawEvent::Restored( + DJANGO, + BOB, + bob_code_hash, + 50, + false, + )), + topics: vec![], + }, + ]); + } + _ => unreachable!(), + } + } else { + // Here we expect that the restoration is succeeded. Check that the restoration + // contract `DJANGO` ceased to exist and that `BOB` returned back. + println!("{:?}", ContractInfoOf::::get(BOB)); + let bob_contract = ContractInfoOf::::get(BOB).unwrap() + .get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, 50); + assert_eq!(bob_contract.storage_size, 12); + assert_eq!(bob_contract.trie_id, django_trie_id); + assert_eq!(bob_contract.deduct_block, System::block_number()); + assert!(ContractInfoOf::::get(DJANGO).is_none()); + assert_eq!(System::events(), vec![ + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::system(system::RawEvent::KilledAccount(DJANGO)), + topics: vec![], + }, + EventRecord { + phase: Phase::Initialization, + event: MetaEvent::contracts( + RawEvent::Restored(DJANGO, BOB, bob_contract.code_hash, 50, true) + ), + topics: vec![], + }, + ]); + } + }); } #[test] fn storage_max_value_limit() { - let (wasm, code_hash) = compile_module::(&load_wasm("storage_size.wat")) - .unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 30_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Check creation - let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); - assert_eq!(bob_contract.rent_allowance, >::max_value()); - - // Call contract with allowed storage value. - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, - 0, - GAS_LIMIT, - Encode::encode(&self::MaxValueSize::get()), - )); - - // Call contract with too large a storage value. - assert_err_ignore_postinfo!( - Contracts::call( + let (wasm, code_hash) = compile_module::("storage_size").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 30_000, + GAS_LIMIT, + code_hash.into(), + vec![], + )); + + // Check creation + let bob_contract = ContractInfoOf::::get(BOB).unwrap().get_alive().unwrap(); + assert_eq!(bob_contract.rent_allowance, >::max_value()); + + // Call contract with allowed storage value. + assert_ok!(Contracts::call( Origin::signed(ALICE), BOB, 0, GAS_LIMIT, - Encode::encode(&(self::MaxValueSize::get() + 1)), - ), - "contract trapped during execution" - ); - }); + Encode::encode(&self::MaxValueSize::get()), + )); + + // Call contract with too large a storage value. + assert_err_ignore_postinfo!( + Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + Encode::encode(&(self::MaxValueSize::get() + 1)), + ), + "contract trapped during execution" + ); + }); } #[test] fn deploy_and_call_other_contract() { - let (callee_wasm, callee_code_hash) = - compile_module::(&load_wasm("return_with_data.wat")).unwrap(); - let (caller_wasm, caller_code_hash) = - compile_module::(&load_wasm("caller_contract.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), callee_wasm)); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), caller_wasm)); - - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100_000, - GAS_LIMIT, - caller_code_hash.into(), - vec![], - )); - - // Call BOB contract, which attempts to instantiate and call the callee contract and - // makes various assertions on the results from those calls. - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, - 0, - GAS_LIMIT, - callee_code_hash.as_ref().to_vec(), - )); - }); + let (callee_wasm, callee_code_hash) = compile_module::("return_with_data").unwrap(); + let (caller_wasm, caller_code_hash) = compile_module::("caller_contract").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), callee_wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), caller_wasm)); + + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100_000, + GAS_LIMIT, + caller_code_hash.into(), + vec![], + )); + + // Call BOB contract, which attempts to instantiate and call the callee contract and + // makes various assertions on the results from those calls. + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + callee_code_hash.as_ref().to_vec(), + )); + }); } #[test] fn cannot_self_destruct_through_draning() { - let (wasm, code_hash) = compile_module::(&load_wasm("drain.wat")).unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Instantiate the BOB contract. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Check that the BOB contract has been instantiated. - assert_matches!( - ContractInfoOf::::get(BOB), - Some(ContractInfo::Alive(_)) - ); + let (wasm, code_hash) = compile_module::("drain").unwrap(); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Call BOB with no input data, forcing it to run until out-of-balance - // and eventually trapping because below existential deposit. - assert_err_ignore_postinfo!( - Contracts::call( + // Instantiate the BOB contract. + assert_ok!(Contracts::instantiate( Origin::signed(ALICE), - BOB, - 0, + 100_000, GAS_LIMIT, + code_hash.into(), vec![], - ), - "contract trapped during execution" - ); - }); + )); + + // Check that the BOB contract has been instantiated. + assert_matches!( + ContractInfoOf::::get(BOB), + Some(ContractInfo::Alive(_)) + ); + + // Call BOB with no input data, forcing it to run until out-of-balance + // and eventually trapping because below existential deposit. + assert_err_ignore_postinfo!( + Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + vec![], + ), + "contract trapped during execution" + ); + }); } #[test] fn cannot_self_destruct_while_live() { - let (wasm, code_hash) = compile_module::(&load_wasm("self_destruct.wat")) - .unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Instantiate the BOB contract. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Check that the BOB contract has been instantiated. - assert_matches!( - ContractInfoOf::::get(BOB), - Some(ContractInfo::Alive(_)) - ); + let (wasm, code_hash) = compile_module::("self_destruct").unwrap(); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Call BOB with input data, forcing it make a recursive call to itself to - // self-destruct, resulting in a trap. - assert_err_ignore_postinfo!( - Contracts::call( + // Instantiate the BOB contract. + assert_ok!(Contracts::instantiate( Origin::signed(ALICE), - BOB, - 0, + 100_000, GAS_LIMIT, - vec![0], - ), - "contract trapped during execution" - ); + code_hash.into(), + vec![], + )); - // Check that BOB is still alive. - assert_matches!( - ContractInfoOf::::get(BOB), - Some(ContractInfo::Alive(_)) - ); - }); + // Check that the BOB contract has been instantiated. + assert_matches!( + ContractInfoOf::::get(BOB), + Some(ContractInfo::Alive(_)) + ); + + // Call BOB with input data, forcing it make a recursive call to itself to + // self-destruct, resulting in a trap. + assert_err_ignore_postinfo!( + Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + vec![0], + ), + "contract trapped during execution" + ); + + // Check that BOB is still alive. + assert_matches!( + ContractInfoOf::::get(BOB), + Some(ContractInfo::Alive(_)) + ); + }); } #[test] fn self_destruct_works() { - let (wasm, code_hash) = compile_module::(&load_wasm("self_destruct.wat")) - .unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Instantiate the BOB contract. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Check that the BOB contract has been instantiated. - assert_matches!( - ContractInfoOf::::get(BOB), - Some(ContractInfo::Alive(_)) - ); + let (wasm, code_hash) = compile_module::("self_destruct").unwrap(); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - // Call BOB without input data which triggers termination. - assert_matches!( - Contracts::call( + // Instantiate the BOB contract. + assert_ok!(Contracts::instantiate( Origin::signed(ALICE), - BOB, - 0, + 100_000, GAS_LIMIT, + code_hash.into(), vec![], - ), - Ok(_) - ); + )); - // Check that account is gone - assert!(ContractInfoOf::::get(BOB).is_none()); + // Check that the BOB contract has been instantiated. + assert_matches!( + ContractInfoOf::::get(BOB), + Some(ContractInfo::Alive(_)) + ); - // check that the beneficiary (django) got remaining balance - assert_eq!(Balances::free_balance(DJANGO), 100_000); - }); + // Call BOB without input data which triggers termination. + assert_matches!( + Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + vec![], + ), + Ok(_) + ); + + // Check that account is gone + assert!(ContractInfoOf::::get(BOB).is_none()); + + // check that the beneficiary (django) got remaining balance + assert_eq!(Balances::free_balance(DJANGO), 100_000); + }); } // This tests that one contract cannot prevent another from self-destructing by sending it // additional funds after it has been drained. #[test] fn destroy_contract_and_transfer_funds() { - let (callee_wasm, callee_code_hash) = - compile_module::(&load_wasm("self_destruct.wat")).unwrap(); - let (caller_wasm, caller_code_hash) = - compile_module::(&load_wasm("destroy_and_transfer.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - // Create - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), callee_wasm)); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), caller_wasm)); - - // This deploys the BOB contract, which in turn deploys the CHARLIE contract during - // construction. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 200_000, - GAS_LIMIT, - caller_code_hash.into(), - callee_code_hash.as_ref().to_vec(), - )); - - // Check that the CHARLIE contract has been instantiated. - assert_matches!( - ContractInfoOf::::get(CHARLIE), - Some(ContractInfo::Alive(_)) - ); + let (callee_wasm, callee_code_hash) = compile_module::("self_destruct").unwrap(); + let (caller_wasm, caller_code_hash) = compile_module::("destroy_and_transfer").unwrap(); - // Call BOB, which calls CHARLIE, forcing CHARLIE to self-destruct. - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, - 0, - GAS_LIMIT, - CHARLIE.encode(), - )); - - // Check that CHARLIE has moved on to the great beyond (ie. died). - assert!(ContractInfoOf::::get(CHARLIE).is_none()); - }); -} + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + // Create + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), callee_wasm)); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), caller_wasm)); -#[test] -fn cannot_self_destruct_in_constructor() { - let (wasm, code_hash) = - compile_module::(&load_wasm("self_destructing_constructor.wat")).unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Fail to instantiate the BOB because the call that is issued in the deploy - // function exhausts all balances which puts it below the existential deposit. - assert_err_ignore_postinfo!( - Contracts::instantiate( + // This deploys the BOB contract, which in turn deploys the CHARLIE contract during + // construction. + assert_ok!(Contracts::instantiate( Origin::signed(ALICE), - 100_000, + 200_000, GAS_LIMIT, - code_hash.into(), - vec![], - ), - "contract trapped during execution" - ); - }); + caller_code_hash.into(), + callee_code_hash.as_ref().to_vec(), + )); + + // Check that the CHARLIE contract has been instantiated. + assert_matches!( + ContractInfoOf::::get(CHARLIE), + Some(ContractInfo::Alive(_)) + ); + + // Call BOB, which calls CHARLIE, forcing CHARLIE to self-destruct. + assert_ok!(Contracts::call( + Origin::signed(ALICE), + BOB, + 0, + GAS_LIMIT, + CHARLIE.encode(), + )); + + // Check that CHARLIE has moved on to the great beyond (ie. died). + assert!(ContractInfoOf::::get(CHARLIE).is_none()); + }); } -fn get_runtime_storage() { - let (wasm, code_hash) = compile_module::(&load_wasm("get_runtime_storage.wat")) - .unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - - frame_support::storage::unhashed::put_raw( - &[1, 2, 3, 4], - 0x14144020u32.to_le_bytes().to_vec().as_ref() - ); +#[test] +fn cannot_self_destruct_in_constructor() { + let (wasm, code_hash) = compile_module::("self_destructing_constructor").unwrap(); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, - 0, - GAS_LIMIT, - vec![], - )); - }); + // Fail to instantiate the BOB because the call that is issued in the deploy + // function exhausts all balances which puts it below the existential deposit. + assert_err_ignore_postinfo!( + Contracts::instantiate( + Origin::signed(ALICE), + 100_000, + GAS_LIMIT, + code_hash.into(), + vec![], + ), + "contract trapped during execution" + ); + }); } #[test] -fn crypto_hashes() { - let (wasm, code_hash) = compile_module::(&load_wasm("crypto_hashes.wat")).unwrap(); - - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - Balances::deposit_creating(&ALICE, 1_000_000); - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Instantiate the CRYPTO_HASHES contract. - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100_000, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - // Perform the call. - let input = b"_DEAD_BEEF"; - use sp_io::hashing::*; - // Wraps a hash function into a more dynamic form usable for testing. - macro_rules! dyn_hash_fn { - ($name:ident) => { - Box::new(|input| $name(input).as_ref().to_vec().into_boxed_slice()) - }; - } - // All hash functions and their associated output byte lengths. - let test_cases: &[(Box Box<[u8]>>, usize)] = &[ - (dyn_hash_fn!(sha2_256), 32), - (dyn_hash_fn!(keccak_256), 32), - (dyn_hash_fn!(blake2_256), 32), - (dyn_hash_fn!(blake2_128), 16), - ]; - // Test the given hash functions for the input: "_DEAD_BEEF" - for (n, (hash_fn, expected_size)) in test_cases.iter().enumerate() { - // We offset data in the contract tables by 1. - let mut params = vec![(n + 1) as u8]; - params.extend_from_slice(input); - let result = >::bare_call( - ALICE, +fn get_runtime_storage() { + let (wasm, code_hash) = compile_module::("get_runtime_storage").unwrap(); + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + + frame_support::storage::unhashed::put_raw( + &[1, 2, 3, 4], + 0x14144020u32.to_le_bytes().to_vec().as_ref() + ); + + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100, + GAS_LIMIT, + code_hash.into(), + vec![], + )); + assert_ok!(Contracts::call( + Origin::signed(ALICE), BOB, 0, GAS_LIMIT, - params, - ).unwrap(); - assert_eq!(result.status, 0); - let expected = hash_fn(input.as_ref()); - assert_eq!(&result.data[..*expected_size], &*expected); - } - }) + vec![], + )); + }); } -fn load_wasm(file_name: &str) -> String { - let path = ["tests/", file_name].concat(); - std::fs::read_to_string(&path).expect(&format!("Unable to read {} file", path)) +#[test] +fn crypto_hashes() { + let (wasm, code_hash) = compile_module::("crypto_hashes").unwrap(); + + ExtBuilder::default() + .existential_deposit(50) + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); + + // Instantiate the CRYPTO_HASHES contract. + assert_ok!(Contracts::instantiate( + Origin::signed(ALICE), + 100_000, + GAS_LIMIT, + code_hash.into(), + vec![], + )); + // Perform the call. + let input = b"_DEAD_BEEF"; + use sp_io::hashing::*; + // Wraps a hash function into a more dynamic form usable for testing. + macro_rules! dyn_hash_fn { + ($name:ident) => { + Box::new(|input| $name(input).as_ref().to_vec().into_boxed_slice()) + }; + } + // All hash functions and their associated output byte lengths. + let test_cases: &[(Box Box<[u8]>>, usize)] = &[ + (dyn_hash_fn!(sha2_256), 32), + (dyn_hash_fn!(keccak_256), 32), + (dyn_hash_fn!(blake2_256), 32), + (dyn_hash_fn!(blake2_128), 16), + ]; + // Test the given hash functions for the input: "_DEAD_BEEF" + for (n, (hash_fn, expected_size)) in test_cases.iter().enumerate() { + // We offset data in the contract tables by 1. + let mut params = vec![(n + 1) as u8]; + params.extend_from_slice(input); + let result = >::bare_call( + ALICE, + BOB, + 0, + GAS_LIMIT, + params, + ).unwrap(); + assert_eq!(result.status, 0); + let expected = hash_fn(input.as_ref()); + assert_eq!(&result.data[..*expected_size], &*expected); + } + }) } -- GitLab From e6d5d499fb37fac3eee04a0394f21c678a504d3e Mon Sep 17 00:00:00 2001 From: pscott <30843220+pscott@users.noreply.github.com> Date: Mon, 25 May 2020 17:26:13 +0200 Subject: [PATCH 054/280] Remove sleep in import blocks (#6124) * Add Delay and info logging * Switch from Duration to Delay in enum declaration * Remove sleep from import_blocks fn * Set back constans and remove unnecessary code * Fix hot loop * Reset timer once poll is ready, not when it's pending --- client/service/src/chain_ops.rs | 54 ++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/client/service/src/chain_ops.rs b/client/service/src/chain_ops.rs index 0297ad5c90..cb4ed24b60 100644 --- a/client/service/src/chain_ops.rs +++ b/client/service/src/chain_ops.rs @@ -39,7 +39,9 @@ use sp_core::storage::{StorageKey, well_known_keys, ChildInfo, Storage, StorageC use sc_client_api::{StorageProvider, BlockBackend, UsageProvider}; use std::{io::{Read, Write, Seek}, pin::Pin, collections::HashMap}; -use std::{thread, time::{Duration, Instant}}; +use std::time::{Duration, Instant}; +use futures_timer::Delay; +use std::task::Poll; use serde_json::{de::IoRead as JsonIoRead, Deserializer, StreamDeserializer}; use std::convert::{TryFrom, TryInto}; use sp_runtime::traits::{CheckedDiv, Saturating}; @@ -272,14 +274,14 @@ enum ImportState where /// The queue is full (contains at least MAX_PENDING_BLOCKS blocks) and we are waiting for it to catch up. WaitingForImportQueueToCatchUp{ block_iter: BlockIter, - delay: Duration, + delay: Delay, block: SignedBlock }, // We have added all the blocks to the queue but they are still being processed. WaitingForImportQueueToFinish{ num_expected_blocks: Option, read_block_count: u64, - delay: Duration, + delay: Delay, }, } @@ -373,7 +375,7 @@ impl< // The iterator is over: we now need to wait for the import queue to finish. let num_expected_blocks = block_iter.num_expected_blocks(); let read_block_count = block_iter.read_block_count(); - let delay = Duration::from_millis(DELAY_TIME); + let delay = Delay::new(Duration::from_millis(DELAY_TIME)); state = Some(ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay}); }, Some(block_result) => { @@ -383,7 +385,7 @@ impl< if read_block_count - link.imported_blocks >= MAX_PENDING_BLOCKS { // The queue is full, so do not add this block and simply wait until // the queue has made some progress. - let delay = Duration::from_millis(DELAY_TIME); + let delay = Delay::new(Duration::from_millis(DELAY_TIME)); state = Some(ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block}); } else { // Queue is not full, we can keep on adding blocks to the queue. @@ -392,18 +394,26 @@ impl< } } Err(e) => { - return std::task::Poll::Ready( + return Poll::Ready( Err(Error::Other(format!("Error reading block #{}: {}", read_block_count, e)))) } } } } }, - ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block} => { + ImportState::WaitingForImportQueueToCatchUp{block_iter, mut delay, block} => { let read_block_count = block_iter.read_block_count(); if read_block_count - link.imported_blocks >= MAX_PENDING_BLOCKS { - thread::sleep(delay); // Queue is still full, so wait until there is room to insert our block. + match Pin::new(&mut delay).poll(cx) { + Poll::Pending => { + state = Some(ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block}); + return Poll::Pending + }, + Poll::Ready(_) => { + delay.reset(Duration::from_millis(DELAY_TIME)); + }, + } state = Some(ImportState::WaitingForImportQueueToCatchUp{block_iter, delay, block}); } else { // Queue is no longer full, so we can add our block to the queue. @@ -412,7 +422,7 @@ impl< state = Some(ImportState::Reading{block_iter}); } }, - ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay} => { + ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, mut delay} => { // All the blocks have been added to the queue, which doesn't mean they // have all been properly imported. if importing_is_done(num_expected_blocks, read_block_count, link.imported_blocks) { @@ -421,10 +431,20 @@ impl< "🎉 Imported {} blocks. Best: #{}", read_block_count, client.chain_info().best_number ); - return std::task::Poll::Ready(Ok(())) + return Poll::Ready(Ok(())) } else { - thread::sleep(delay); // Importing is not done, we still have to wait for the queue to finish. + // Wait for the delay, because we know the queue is lagging behind. + match Pin::new(&mut delay).poll(cx) { + Poll::Pending => { + state = Some(ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay}); + return Poll::Pending + }, + Poll::Ready(_) => { + delay.reset(Duration::from_millis(DELAY_TIME)); + }, + } + state = Some(ImportState::WaitingForImportQueueToFinish{num_expected_blocks, read_block_count, delay}); } } @@ -436,7 +456,7 @@ impl< speedometer.notify_user(best_number); if link.has_error { - return std::task::Poll::Ready(Err( + return Poll::Ready(Err( Error::Other( format!("Stopping after #{} blocks because of an error", link.imported_blocks) ) @@ -444,7 +464,7 @@ impl< } cx.waker().wake_by_ref(); - std::task::Poll::Pending + Poll::Pending }); Box::pin(import) } @@ -477,7 +497,7 @@ impl< let client = &self.client; if last < block { - return std::task::Poll::Ready(Err("Invalid block range specified".into())); + return Poll::Ready(Err("Invalid block range specified".into())); } if !wrote_header { @@ -501,19 +521,19 @@ impl< } }, // Reached end of the chain. - None => return std::task::Poll::Ready(Ok(())), + None => return Poll::Ready(Ok(())), } if (block % 10000.into()).is_zero() { info!("#{}", block); } if block == last { - return std::task::Poll::Ready(Ok(())); + return Poll::Ready(Ok(())); } block += One::one(); // Re-schedule the task in order to continue the operation. cx.waker().wake_by_ref(); - std::task::Poll::Pending + Poll::Pending }); Box::pin(export) -- GitLab From d74902446ac5f88a4061f3a6dd4e948a79a135da Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 25 May 2020 17:26:36 +0200 Subject: [PATCH 055/280] Bump to libp2p v0.19.1 (#6125) --- Cargo.lock | 44 +++++++++++++------------- bin/node/browser-testing/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/authority-discovery/Cargo.toml | 2 +- client/network-gossip/Cargo.toml | 2 +- client/network/Cargo.toml | 4 +-- client/network/test/Cargo.toml | 2 +- client/peerset/Cargo.toml | 2 +- client/telemetry/Cargo.toml | 2 +- primitives/consensus/common/Cargo.toml | 2 +- primitives/phragmen/fuzzer/Cargo.lock | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8194436e1f..569f21c3cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2612,9 +2612,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec214d189b57e4412f079ac5a1442578d06b12ca7282ba4696104cc92ab96c1" +checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67" dependencies = [ "bytes 0.5.4", "futures 0.3.5", @@ -2684,9 +2684,9 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67f0d915bee5d457a6d113377101e1f06e86a4286778aa4c6939553e9a4d7033" +checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" dependencies = [ "quote 1.0.5", "syn 1.0.21", @@ -2694,9 +2694,9 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975c847575ef9b3d63f9c11d465e9a9b0ea940cfa408b93cc6981bbc3b1bac40" +checksum = "5c4acff33f5bfe154bafe14c6c08655d4b1e1736afaca78014111bc1742a2016" dependencies = [ "flate2", "futures 0.3.5", @@ -2733,9 +2733,9 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce48659363fe765c09d77eb5b2248e04362557b11bba3701f05879ad34919ccd" +checksum = "1675c23765e37ddbf6bf05fb520be8f7df3f5f4981d68f185bb95f9b047c576a" dependencies = [ "base64 0.11.0", "byteorder 1.3.4", @@ -2758,9 +2758,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a455af71c59473444eba05e83dbaa20262bdbd9b4154f22389510fbac16f201" +checksum = "6438ed8ca240c7635c9caa3be6c5258bc0058553ae97ba81737f04e5d33804f5" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2801,9 +2801,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5bc788d92111802cb0c92d2e032fa6f46333aaeb5650c2f37b5d3eba78cabe6" +checksum = "51b00163d13f705aae67c427bea0575f8aaf63da6524f9bd4a5a093b8bda0b38" dependencies = [ "async-std", "data-encoding", @@ -2823,9 +2823,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4095bce2100f840883f1f75dbd010c966ee4ad323ae9f82026396da5cf6cce68" +checksum = "34ce63313ad4bce2d76e54c292a1293ea47a0ebbe16708f1513fa62184992f53" dependencies = [ "bytes 0.5.4", "fnv", @@ -2860,9 +2860,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82930c36490008b1ef2f26c237a2c205c38ef6edc263738d0528b842740ab09f" +checksum = "c189cf1dfe4b3f01e2c0fe5e97a6f5df8aeb6f3569e26981015eb7c08015ce5f" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2907,9 +2907,9 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e30b873276846181fa9c04126653678c2797cb1556361d01b7b7fd6bf24682" +checksum = "7b73f0cc119c83a5b619d6d11074a319fdb4aa4daf8088ade00d511418566e28" dependencies = [ "aes-ctr", "ctr", @@ -2952,9 +2952,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4462bd96b97cac3f3a83b1b343ad3c3460cebbc8d929c040b1520c30e3611e08" +checksum = "309f95fce9bec755eff5406f8b822fd3969990830c2b54f752e1fc181d5ace3e" dependencies = [ "async-std", "futures 0.3.5", @@ -2968,9 +2968,9 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69660d235449bb2d99333b9892c9176d06fd2b380490cb8213feb5b015678cf1" +checksum = "78d51726e063e8d73b103331576bb7e8fad187a3f0c227933a10b3542e2ad3f4" dependencies = [ "async-std", "futures 0.3.5", diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 04d48c8cbd..bd7854b0ba 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" -libp2p = { version = "0.19.0", default-features = false } +libp2p = { version = "0.19.1", default-features = false } jsonrpc-core = "14.0.5" serde = "1.0.106" serde_json = "1.0.48" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 9c4ca36e16..950e77a8e1 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -33,7 +33,7 @@ derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" -libp2p = "0.19.0" +libp2p = "0.19.1" serde_json = "1.0" [features] diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 69d5c51846..92cf15051e 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", default-features = false, version = "1 derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } +libp2p = { version = "0.19.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} prost = "0.6.1" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index 10b4a9446e..3ccdae6b5c 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.0", default-features = false, features = ["websocket"] } +libp2p = { version = "0.19.1", default-features = false, features = ["websocket"] } log = "0.4.8" lru = "0.4.3" sc-network = { version = "0.8.0-dev", path = "../network" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 01121b922d..9c32eeaf7d 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -63,7 +63,7 @@ wasm-timer = "0.2" zeroize = "1.0.0" [dependencies.libp2p] -version = "0.19.0" +version = "0.19.1" default-features = false features = ["websocket", "kad", "mdns", "ping", "identify", "mplex", "yamux", "noise", "tcp-async-std"] @@ -71,7 +71,7 @@ features = ["websocket", "kad", "mdns", "ping", "identify", "mplex", "yamux", "n async-std = "1.5" assert_matches = "1.3" env_logger = "0.7.0" -libp2p = { version = "0.19.0", default-features = false, features = ["secio"] } +libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 58ad79163b..554a30c111 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" -libp2p = { version = "0.19.0", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.19.1", default-features = false, features = ["libp2p-websocket"] } sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } sc-client-api = { version = "2.0.0-dev", path = "../../api" } diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index f47ea7a70e..851128e358 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" -libp2p = { version = "0.19.0", default-features = false } +libp2p = { version = "0.19.1", default-features = false } sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index 8ab0f828d1..bf8440356f 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" wasm-timer = "0.2.0" -libp2p = { version = "0.19.0", default-features = false, features = ["websocket", "wasm-ext", "tcp-async-std", "dns"] } +libp2p = { version = "0.19.1", default-features = false, features = ["websocket", "wasm-ext", "tcp-async-std", "dns"] } log = "0.4.8" pin-project = "0.4.6" rand = "0.7.2" diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index 6fda982dae..b7b0f111de 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -libp2p = { version = "0.19.0", default-features = false } +libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" sp-core = { path= "../../core", version = "2.0.0-dev"} sp-inherents = { version = "2.0.0-dev", path = "../../inherents" } diff --git a/primitives/phragmen/fuzzer/Cargo.lock b/primitives/phragmen/fuzzer/Cargo.lock index 3ef2a27324..49006f5be8 100644 --- a/primitives/phragmen/fuzzer/Cargo.lock +++ b/primitives/phragmen/fuzzer/Cargo.lock @@ -540,7 +540,7 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "198831fe8722331a395bc199a5d08efbc197497ef354cb4c77b969c02ffc0fc4" dependencies = [ -- GitLab From 599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 25 May 2020 18:30:48 +0200 Subject: [PATCH 056/280] Tagging as rc1 --- Cargo.lock | 1152 ++++++++--------- bin/node-template/node/Cargo.toml | 40 +- bin/node-template/pallets/template/Cargo.toml | 12 +- bin/node-template/runtime/Cargo.toml | 48 +- bin/node/bench/Cargo.toml | 20 +- bin/node/browser-testing/Cargo.toml | 6 +- bin/node/cli/Cargo.toml | 118 +- bin/node/cli/tests/build_spec_works.rs | 2 +- bin/node/cli/tests/check_block_works.rs | 2 +- bin/node/cli/tests/common.rs | 2 +- bin/node/cli/tests/export_import_flow.rs | 6 +- bin/node/cli/tests/inspect_works.rs | 2 +- bin/node/cli/tests/purge_chain_works.rs | 2 +- .../tests/running_the_node_and_interrupt.rs | 2 +- bin/node/executor/Cargo.toml | 50 +- bin/node/inspect/Cargo.toml | 14 +- bin/node/primitives/Cargo.toml | 12 +- bin/node/rpc-client/Cargo.toml | 6 +- bin/node/rpc/Cargo.toml | 40 +- bin/node/runtime/Cargo.toml | 112 +- bin/node/testing/Cargo.toml | 68 +- bin/utils/chain-spec-builder/Cargo.toml | 10 +- bin/utils/subkey/Cargo.toml | 20 +- client/api/Cargo.toml | 44 +- client/authority-discovery/Cargo.toml | 24 +- client/basic-authorship/Cargo.toml | 30 +- client/block-builder/Cargo.toml | 20 +- client/chain-spec/Cargo.toml | 14 +- client/chain-spec/derive/Cargo.toml | 2 +- client/cli/Cargo.toml | 32 +- client/consensus/aura/Cargo.toml | 50 +- client/consensus/babe/Cargo.toml | 58 +- client/consensus/babe/rpc/Cargo.toml | 30 +- client/consensus/common/Cargo.toml | 10 +- client/consensus/epochs/Cargo.toml | 10 +- client/consensus/manual-seal/Cargo.toml | 26 +- client/consensus/pow/Cargo.toml | 24 +- client/consensus/slots/Cargo.toml | 24 +- client/consensus/uncles/Cargo.toml | 14 +- client/db/Cargo.toml | 28 +- client/executor/Cargo.toml | 36 +- client/executor/common/Cargo.toml | 12 +- client/executor/runtime-test/Cargo.toml | 14 +- client/executor/wasmi/Cargo.toml | 12 +- client/executor/wasmtime/Cargo.toml | 12 +- client/finality-grandpa/Cargo.toml | 54 +- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/informant/Cargo.toml | 12 +- client/keystore/Cargo.toml | 6 +- client/network-gossip/Cargo.toml | 8 +- client/network/Cargo.toml | 32 +- client/network/test/Cargo.toml | 26 +- client/offchain/Cargo.toml | 26 +- client/peerset/Cargo.toml | 4 +- client/proposer-metrics/Cargo.toml | 4 +- client/rpc-api/Cargo.toml | 14 +- client/rpc-servers/Cargo.toml | 4 +- client/rpc/Cargo.toml | 44 +- client/service/Cargo.toml | 68 +- client/service/test/Cargo.toml | 40 +- client/state-db/Cargo.toml | 6 +- client/telemetry/Cargo.toml | 2 +- client/tracing/Cargo.toml | 4 +- client/transaction-pool/Cargo.toml | 28 +- client/transaction-pool/graph/Cargo.toml | 14 +- frame/assets/Cargo.toml | 14 +- frame/aura/Cargo.toml | 26 +- frame/authority-discovery/Cargo.toml | 22 +- frame/authorship/Cargo.toml | 18 +- frame/babe/Cargo.toml | 30 +- frame/balances/Cargo.toml | 18 +- frame/benchmark/Cargo.toml | 14 +- frame/benchmarking/Cargo.toml | 16 +- frame/collective/Cargo.toml | 18 +- frame/contracts/Cargo.toml | 26 +- frame/contracts/common/Cargo.toml | 6 +- frame/contracts/rpc/Cargo.toml | 16 +- frame/contracts/rpc/runtime-api/Cargo.toml | 10 +- frame/democracy/Cargo.toml | 24 +- frame/elections-phragmen/Cargo.toml | 22 +- frame/elections/Cargo.toml | 16 +- frame/evm/Cargo.toml | 18 +- frame/example-offchain-worker/Cargo.toml | 14 +- frame/example/Cargo.toml | 18 +- frame/executive/Cargo.toml | 26 +- frame/finality-tracker/Cargo.toml | 18 +- frame/generic-asset/Cargo.toml | 14 +- frame/grandpa/Cargo.toml | 38 +- frame/identity/Cargo.toml | 18 +- frame/im-online/Cargo.toml | 24 +- frame/indices/Cargo.toml | 18 +- frame/membership/Cargo.toml | 14 +- frame/metadata/Cargo.toml | 6 +- frame/nicks/Cargo.toml | 16 +- frame/offences/Cargo.toml | 18 +- frame/offences/benchmarking/Cargo.toml | 36 +- frame/randomness-collective-flip/Cargo.toml | 14 +- frame/recovery/Cargo.toml | 16 +- frame/scheduler/Cargo.toml | 16 +- frame/scored-pool/Cargo.toml | 16 +- frame/session/Cargo.toml | 24 +- frame/session/benchmarking/Cargo.toml | 26 +- frame/society/Cargo.toml | 16 +- frame/staking/Cargo.toml | 38 +- frame/staking/fuzzer/Cargo.lock | 2 +- frame/staking/fuzzer/Cargo.toml | 26 +- frame/staking/reward-curve/Cargo.toml | 4 +- frame/sudo/Cargo.toml | 14 +- frame/support/Cargo.toml | 24 +- frame/support/procedural/Cargo.toml | 4 +- frame/support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 14 +- frame/system/Cargo.toml | 18 +- frame/system/benchmarking/Cargo.toml | 16 +- frame/system/rpc/runtime-api/Cargo.toml | 4 +- frame/timestamp/Cargo.toml | 22 +- frame/transaction-payment/Cargo.toml | 20 +- frame/transaction-payment/rpc/Cargo.toml | 14 +- .../rpc/runtime-api/Cargo.toml | 10 +- frame/treasury/Cargo.toml | 18 +- frame/utility/Cargo.toml | 20 +- frame/vesting/Cargo.toml | 20 +- primitives/allocator/Cargo.toml | 8 +- primitives/api/Cargo.toml | 16 +- primitives/api/proc-macro/Cargo.toml | 2 +- primitives/api/test/Cargo.toml | 22 +- primitives/application-crypto/Cargo.toml | 8 +- primitives/application-crypto/test/Cargo.toml | 12 +- primitives/arithmetic/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- primitives/authority-discovery/Cargo.toml | 10 +- primitives/authorship/Cargo.toml | 8 +- primitives/block-builder/Cargo.toml | 10 +- primitives/blockchain/Cargo.toml | 10 +- primitives/chain-spec/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 14 +- primitives/consensus/babe/Cargo.toml | 18 +- primitives/consensus/common/Cargo.toml | 20 +- primitives/consensus/pow/Cargo.toml | 10 +- primitives/consensus/vrf/Cargo.toml | 8 +- primitives/core/Cargo.toml | 14 +- primitives/database/Cargo.toml | 2 +- primitives/debug-derive/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 6 +- primitives/finality-grandpa/Cargo.toml | 12 +- primitives/finality-tracker/Cargo.toml | 6 +- primitives/inherents/Cargo.toml | 6 +- primitives/io/Cargo.toml | 16 +- primitives/keyring/Cargo.toml | 6 +- primitives/offchain/Cargo.toml | 10 +- primitives/panic-handler/Cargo.toml | 2 +- primitives/phragmen/Cargo.toml | 14 +- primitives/phragmen/compact/Cargo.toml | 2 +- primitives/phragmen/fuzzer/Cargo.lock | 2 +- primitives/phragmen/fuzzer/Cargo.toml | 6 +- primitives/rpc/Cargo.toml | 4 +- primitives/runtime-interface/Cargo.toml | 20 +- .../runtime-interface/proc-macro/Cargo.toml | 2 +- .../test-wasm-deprecated/Cargo.toml | 10 +- .../runtime-interface/test-wasm/Cargo.toml | 10 +- primitives/runtime-interface/test/Cargo.toml | 18 +- primitives/runtime/Cargo.toml | 16 +- primitives/sandbox/Cargo.toml | 10 +- primitives/serializer/Cargo.toml | 2 +- primitives/session/Cargo.toml | 12 +- primitives/staking/Cargo.toml | 6 +- primitives/state-machine/Cargo.toml | 12 +- primitives/std/Cargo.toml | 2 +- primitives/storage/Cargo.toml | 6 +- primitives/test-primitives/Cargo.toml | 8 +- primitives/timestamp/Cargo.toml | 10 +- primitives/tracing/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 8 +- primitives/trie/Cargo.toml | 8 +- primitives/utils/Cargo.toml | 2 +- primitives/version/Cargo.toml | 6 +- primitives/wasm-interface/Cargo.toml | 4 +- test-utils/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 24 +- test-utils/runtime/Cargo.toml | 60 +- test-utils/runtime/client/Cargo.toml | 24 +- .../runtime/transaction-pool/Cargo.toml | 12 +- utils/browser/Cargo.toml | 12 +- utils/build-script-utils/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 20 +- utils/frame/rpc/support/Cargo.toml | 10 +- utils/frame/rpc/system/Cargo.toml | 20 +- utils/prometheus/Cargo.toml | 2 +- 190 files changed, 2160 insertions(+), 2190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 569f21c3cf..f7decfec32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,15 +10,6 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456d75cbb82da1ad150c8a9d97285ffcd21c9931dcb11e995903e7d75141b38b" -dependencies = [ - "gimli 0.21.0", -] - [[package]] name = "adler32" version = "1.0.4" @@ -108,9 +99,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.30" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2494382e9ba43995f3c56359e518641f450f5c36feeb4632a75cde2ec297c867" +checksum = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" [[package]] name = "approx" @@ -123,15 +114,15 @@ dependencies = [ [[package]] name = "arbitrary" -version = "0.4.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5eb01a9ab8a3369f2f7632b9461c34f5920bd454774bab5b9fc6744f21d6143" +checksum = "75153c95fdedd7db9732dfbfc3702324a1627eec91ba56e37cd0ac78314ab2ed" [[package]] name = "arc-swap" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +checksum = "d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825" [[package]] name = "arrayref" @@ -169,8 +160,8 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -234,7 +225,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "rustls", "webpki", "webpki-roots 0.19.0", @@ -265,17 +256,26 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.48" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" +checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" dependencies = [ - "addr2line", + "backtrace-sys", "cfg-if", "libc", - "object 0.19.0", "rustc-demangle", ] +[[package]] +name = "backtrace-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "base58" version = "0.1.0" @@ -290,9 +290,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.12.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" +checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3" [[package]] name = "bincode" @@ -321,7 +321,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.5", + "quote 1.0.3", "regex", "rustc-hash", "shlex", @@ -446,9 +446,9 @@ checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" [[package]] name = "bstr" -version = "0.2.13" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" +checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" dependencies = [ "lazy_static", "memchr", @@ -467,9 +467,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.3.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6" +checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byte-slice-cast" @@ -541,9 +541,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.52" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" +checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" dependencies = [ "jobserver", ] @@ -574,7 +574,7 @@ dependencies = [ [[package]] name = "chain-spec-builder" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "ansi_term 0.12.1", "node-cli", @@ -611,9 +611,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.1" +version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" +checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" dependencies = [ "ansi_term 0.11.0", "atty", @@ -733,7 +733,7 @@ dependencies = [ "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli 0.20.0", + "gimli", "log", "regalloc", "serde", @@ -825,7 +825,7 @@ dependencies = [ "clap", "criterion-plot 0.3.1", "csv", - "itertools 0.8.2", + "itertools", "lazy_static", "libc", "num-traits 0.2.11", @@ -843,16 +843,16 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f696897c88b57f4ffe3c69d8e1a0613c7d0e6c4833363c8560fbde9c47b966" +checksum = "1fc755679c12bda8e5523a71e4d654b6bf2e14bd838dfc48cde6559a05caf7d1" dependencies = [ "atty", "cast", "clap", - "criterion-plot 0.4.2", + "criterion-plot 0.4.1", "csv", - "itertools 0.9.0", + "itertools", "lazy_static", "num-traits 0.2.11", "oorandom", @@ -874,17 +874,17 @@ checksum = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" dependencies = [ "byteorder 1.3.4", "cast", - "itertools 0.8.2", + "itertools", ] [[package]] name = "criterion-plot" -version = "0.4.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddeaf7989f00f2e1d871a26a110f3ed713632feac17f65f03ca938c542618b60" +checksum = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545" dependencies = [ "cast", - "itertools 0.9.0", + "itertools", ] [[package]] @@ -993,12 +993,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.14" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6b25ee9ac1995c54d7adb2eff8cfffb7260bc774fb63c601ec65467f43cd9d" +checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" dependencies = [ - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -1042,13 +1042,13 @@ checksum = "11c0346158a19b3627234e15596f5e465c360fcdb97d817bcb255e0510f5a788" [[package]] name = "derive_more" -version = "0.99.6" +version = "0.99.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46b046a346c374c6c3c84d2070bfe33904504686bdf949c2d8eb22edad3f270c" +checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -1135,22 +1135,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.6.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +checksum = "a80e524ebf194285b57e5e7944018721c7fffc673253f5183f7accd88a2a3b0c" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.6.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +checksum = "2ed9afacaea0301eefb738c9deea725e6d53938004597cdc518a8cf9a7aa2f03" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -1267,7 +1267,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", ] [[package]] @@ -1287,9 +1287,9 @@ dependencies = [ [[package]] name = "failure" -version = "0.1.8" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" dependencies = [ "backtrace", "failure_derive", @@ -1297,13 +1297,13 @@ dependencies = [ [[package]] name = "failure_derive" -version = "0.1.8" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "synstructure", ] @@ -1345,7 +1345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" dependencies = [ "either", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 2.0.2", "log", "num-traits 0.2.11", @@ -1356,9 +1356,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.6.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" +checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" dependencies = [ "byteorder 1.3.4", "rand 0.7.3", @@ -1393,14 +1393,14 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1433,7 +1433,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-dev" +version = "11.0.0-rc1" dependencies = [ "parity-scale-codec", "serde", @@ -1463,7 +1463,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "bitmask", "frame-metadata", @@ -1489,37 +1489,37 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-support-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "parity-scale-codec", @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "criterion 0.2.11", "frame-support", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -1569,7 +1569,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -1633,9 +1633,9 @@ checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" dependencies = [ "futures-channel", "futures-core", @@ -1648,9 +1648,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" dependencies = [ "futures-core", "futures-sink", @@ -1667,9 +1667,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" +checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" [[package]] name = "futures-core-preview" @@ -1694,7 +1694,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ "futures 0.1.29", - "futures 0.3.5", + "futures 0.3.4", "lazy_static", "log", "parking_lot 0.9.0", @@ -1705,9 +1705,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" dependencies = [ "futures-core", "futures-task", @@ -1717,36 +1717,33 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" [[package]] name = "futures-macro" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "futures-sink" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" +checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" [[package]] name = "futures-task" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" -dependencies = [ - "once_cell", -] +checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" [[package]] name = "futures-timer" @@ -1766,9 +1763,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" dependencies = [ "futures 0.1.29", "futures-channel", @@ -1778,7 +1775,6 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1804,7 +1800,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" dependencies = [ "bytes 0.5.4", - "futures 0.3.5", + "futures 0.3.4", "memchr", "pin-project", ] @@ -1872,12 +1868,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" - [[package]] name = "glob" version = "0.2.11" @@ -1947,9 +1937,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" dependencies = [ "bytes 0.5.4", "fnv", @@ -1960,7 +1950,7 @@ dependencies = [ "indexmap", "log", "slab", - "tokio 0.2.21", + "tokio 0.2.18", "tokio-util", ] @@ -2000,9 +1990,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.12" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" +checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" dependencies = [ "libc", ] @@ -2155,15 +2145,15 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.5" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +checksum = "ed6081100e960d9d74734659ffc9cc91daf1c0fc7aceb8eaa94ee1a3f5046f2e" dependencies = [ "bytes 0.5.4", "futures-channel", "futures-core", "futures-util", - "h2 0.2.5", + "h2 0.2.4", "http 0.2.1", "http-body 0.3.1", "httparse", @@ -2172,7 +2162,7 @@ dependencies = [ "net2", "pin-project", "time", - "tokio 0.2.21", + "tokio 0.2.18", "tower-service", "want 0.3.0", ] @@ -2186,11 +2176,11 @@ dependencies = [ "bytes 0.5.4", "ct-logs", "futures-util", - "hyper 0.13.5", + "hyper 0.13.4", "log", "rustls", "rustls-native-certs", - "tokio 0.2.21", + "tokio 0.2.18", "tokio-rustls", "webpki", ] @@ -2246,9 +2236,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +checksum = "5bbe9ea9b182f0fb1cabbd61f4ff9b7b7b9197955e95a7e4c27de5055eb29ff8" dependencies = [ "serde", ] @@ -2260,8 +2250,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -2285,7 +2275,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "futures-timer 2.0.2", ] @@ -2319,15 +2309,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.5" @@ -2345,9 +2326,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.39" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa5a448de267e7358beaf4a5d849518fe9a0c13fce7afd44b06e68550e5562a7" +checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" dependencies = [ "wasm-bindgen", ] @@ -2399,8 +2380,8 @@ checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -2489,9 +2470,9 @@ dependencies = [ [[package]] name = "kv-log-macro" -version = "1.0.5" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d3beed37e5483887d81eb39de6de03a8346531410e1306ca48a9a89bd3a51" +checksum = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" dependencies = [ "log", ] @@ -2541,7 +2522,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c7f36acb1841d4c701d30ae1f2cfd242e805991443f75f6935479ed3de64903" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "js-sys", "kvdb", "kvdb-memorydb", @@ -2572,28 +2553,22 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" [[package]] name = "libflate" -version = "1.0.0" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fbe6b967a94346446d37ace319ae85be7eca261bb8149325811ac435d35d64" +checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" dependencies = [ "adler32", "crc32fast", - "libflate_lz77", "rle-decode-fast", + "take_mut", ] -[[package]] -name = "libflate_lz77" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b" - [[package]] name = "libloading" version = "0.5.2" @@ -2617,7 +2592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67" dependencies = [ "bytes 0.5.4", - "futures 0.3.5", + "futures 0.3.4", "lazy_static", "libp2p-core", "libp2p-core-derive", @@ -2659,7 +2634,7 @@ dependencies = [ "ed25519-dalek", "either", "fnv", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", @@ -2688,8 +2663,8 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" dependencies = [ - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -2699,7 +2674,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c4acff33f5bfe154bafe14c6c08655d4b1e1736afaca78014111bc1742a2016" dependencies = [ "flate2", - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", ] @@ -2709,7 +2684,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "log", ] @@ -2722,7 +2697,7 @@ checksum = "c6dd8cc558e0edde2d4a423d017efd6b36c1b6bf97f4304c83076895c5edaed8" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "libp2p-swarm", "prost", @@ -2741,7 +2716,7 @@ dependencies = [ "byteorder 1.3.4", "bytes 0.5.4", "fnv", - "futures 0.3.5", + "futures 0.3.4", "futures_codec", "libp2p-core", "libp2p-swarm", @@ -2762,7 +2737,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6438ed8ca240c7635c9caa3be6c5258bc0058553ae97ba81737f04e5d33804f5" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "libp2p-swarm", "log", @@ -2782,7 +2757,7 @@ dependencies = [ "bytes 0.5.4", "either", "fnv", - "futures 0.3.5", + "futures 0.3.4", "futures_codec", "libp2p-core", "libp2p-swarm", @@ -2809,7 +2784,7 @@ dependencies = [ "data-encoding", "dns-parser", "either", - "futures 0.3.5", + "futures 0.3.4", "lazy_static", "libp2p-core", "libp2p-swarm", @@ -2829,7 +2804,7 @@ checksum = "34ce63313ad4bce2d76e54c292a1293ea47a0ebbe16708f1513fa62184992f53" dependencies = [ "bytes 0.5.4", "fnv", - "futures 0.3.5", + "futures 0.3.4", "futures_codec", "libp2p-core", "log", @@ -2844,7 +2819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84fd504e27b0eadd451e06b67694ef714bd8374044e7db339bb0cdb83755ddf4" dependencies = [ "curve25519-dalek", - "futures 0.3.5", + "futures 0.3.4", "lazy_static", "libp2p-core", "log", @@ -2864,7 +2839,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c189cf1dfe4b3f01e2c0fe5e97a6f5df8aeb6f3569e26981015eb7c08015ce5f" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "libp2p-swarm", "log", @@ -2880,7 +2855,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad28fe7beaa3e516ee8ba2af8c4f6820f269afa60d661831e879f2afea64f4a0" dependencies = [ "bytes 0.5.4", - "futures 0.3.5", + "futures 0.3.4", "futures_codec", "libp2p-core", "log", @@ -2897,7 +2872,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dabaa2194e1ce3c51cd78d734dd4c81dc5c7b150b309cbf9029df044034ac261" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "log", "pin-project", "rand 0.7.3", @@ -2913,7 +2888,7 @@ checksum = "7b73f0cc119c83a5b619d6d11074a319fdb4aa4daf8088ade00d511418566e28" dependencies = [ "aes-ctr", "ctr", - "futures 0.3.5", + "futures 0.3.4", "hmac", "js-sys", "lazy_static", @@ -2941,7 +2916,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4a8101a0e0d5f04562137a476bf5f5423cd5bdab2f7e43a75909668e63cb102" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "log", "rand 0.7.3", @@ -2957,7 +2932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "309f95fce9bec755eff5406f8b822fd3969990830c2b54f752e1fc181d5ace3e" dependencies = [ "async-std", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "get_if_addrs", "ipnet", @@ -2973,7 +2948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78d51726e063e8d73b103331576bb7e8fad187a3f0c227933a10b3542e2ad3f4" dependencies = [ "async-std", - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "log", ] @@ -2984,7 +2959,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3001,7 +2976,7 @@ dependencies = [ "async-tls", "bytes 0.5.4", "either", - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "log", "quicksink", @@ -3019,7 +2994,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b305d3a8981e68f11c0e17f2d11d5c52fae95e0d7c283f9e462b5b2dab413b2" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p-core", "parking_lot 0.10.2", "thiserror", @@ -3068,9 +3043,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" [[package]] name = "linked_hash_set" @@ -3224,9 +3199,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" dependencies = [ "cfg-if", "fuchsia-zircon", @@ -3255,9 +3230,9 @@ dependencies = [ [[package]] name = "mio-uds" -version = "0.6.8" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" dependencies = [ "iovec", "libc", @@ -3310,7 +3285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74cdcf7cfb3402881e15a1f95116cb033d69b33c83d481e1234777f5ef0c3d2c" dependencies = [ "bytes 0.5.4", - "futures 0.3.5", + "futures 0.3.4", "log", "pin-project", "smallvec 1.4.0", @@ -3345,9 +3320,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.34" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" dependencies = [ "cfg-if", "libc", @@ -3383,7 +3358,7 @@ dependencies = [ [[package]] name = "node-bench" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "fs_extra", @@ -3413,9 +3388,9 @@ dependencies = [ [[package]] name = "node-browser-testing" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "jsonrpc-core", "libp2p", @@ -3430,13 +3405,13 @@ dependencies = [ [[package]] name = "node-cli" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "assert_cmd", "frame-benchmarking-cli", "frame-support", "frame-system", - "futures 0.3.5", + "futures 0.3.4", "hex-literal", "jsonrpc-core", "log", @@ -3504,9 +3479,9 @@ dependencies = [ [[package]] name = "node-executor" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "criterion 0.3.2", + "criterion 0.3.1", "frame-benchmarking", "frame-support", "frame-system", @@ -3538,7 +3513,7 @@ dependencies = [ [[package]] name = "node-inspect" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "log", @@ -3554,7 +3529,7 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-system", "parity-scale-codec", @@ -3567,7 +3542,7 @@ dependencies = [ [[package]] name = "node-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "jsonrpc-core", "node-primitives", @@ -3593,7 +3568,7 @@ dependencies = [ [[package]] name = "node-rpc-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "env_logger 0.7.1", "futures 0.1.29", @@ -3606,7 +3581,7 @@ dependencies = [ [[package]] name = "node-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-executive", @@ -3672,9 +3647,9 @@ dependencies = [ [[package]] name = "node-template" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "log", "node-template-runtime", "parking_lot 0.10.2", @@ -3701,7 +3676,7 @@ dependencies = [ [[package]] name = "node-template-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-executive", "frame-support", @@ -3733,13 +3708,13 @@ dependencies = [ [[package]] name = "node-testing" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "criterion 0.3.2", + "criterion 0.3.1", "frame-support", "frame-system", "fs_extra", - "futures 0.3.5", + "futures 0.3.4", "log", "node-executor", "node-primitives", @@ -3801,9 +3776,9 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" +checksum = "f26e041cd983acbc087e30fcba770380cfa352d0e392e175b2344ebaf7ea0602" dependencies = [ "winapi 0.3.8", ] @@ -3872,9 +3847,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" dependencies = [ "hermit-abi", "libc", @@ -3889,26 +3864,20 @@ dependencies = [ "target-lexicon", ] -[[package]] -name = "object" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" - [[package]] name = "once_cell" -version = "1.4.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" dependencies = [ - "parking_lot 0.10.2", + "parking_lot 0.9.0", ] [[package]] name = "oorandom" -version = "11.1.1" +version = "11.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af325bc33c7f60191be4e2c984d48aaa21e2854f473b85398344b60c9b6358" +checksum = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405" [[package]] name = "opaque-debug" @@ -3942,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -3956,7 +3925,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -3978,7 +3947,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -3996,7 +3965,7 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4012,7 +3981,7 @@ dependencies = [ [[package]] name = "pallet-babe" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4034,7 +4003,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4050,7 +4019,7 @@ dependencies = [ [[package]] name = "pallet-benchmark" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4064,7 +4033,7 @@ dependencies = [ [[package]] name = "pallet-collective" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4081,7 +4050,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "assert_matches", "frame-support", @@ -4107,7 +4076,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -4116,7 +4085,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4135,7 +4104,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4146,7 +4115,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4166,7 +4135,7 @@ dependencies = [ [[package]] name = "pallet-elections" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4182,7 +4151,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4201,7 +4170,7 @@ dependencies = [ [[package]] name = "pallet-evm" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "evm", "frame-support", @@ -4221,7 +4190,7 @@ dependencies = [ [[package]] name = "pallet-example" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4237,7 +4206,7 @@ dependencies = [ [[package]] name = "pallet-example-offchain-worker" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4252,7 +4221,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4269,7 +4238,7 @@ dependencies = [ [[package]] name = "pallet-generic-asset" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4283,7 +4252,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "finality-grandpa", "frame-support", @@ -4310,7 +4279,7 @@ dependencies = [ [[package]] name = "pallet-identity" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4327,7 +4296,7 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4346,7 +4315,7 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4362,7 +4331,7 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4376,7 +4345,7 @@ dependencies = [ [[package]] name = "pallet-nicks" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4391,7 +4360,7 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4407,7 +4376,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4432,7 +4401,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4446,7 +4415,7 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "enumflags2", "frame-support", @@ -4462,7 +4431,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4477,7 +4446,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4492,7 +4461,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4513,7 +4482,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4533,7 +4502,7 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4549,7 +4518,7 @@ dependencies = [ [[package]] name = "pallet-staking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4600,18 +4569,18 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.5", + "quote 1.0.3", "sp-runtime", - "syn 1.0.21", + "syn 1.0.17", ] [[package]] name = "pallet-sudo" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4625,7 +4594,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4637,7 +4606,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4655,7 +4624,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", @@ -4672,7 +4641,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4689,7 +4658,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "parity-scale-codec", @@ -4702,7 +4671,7 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4718,7 +4687,7 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4734,7 +4703,7 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4837,8 +4806,8 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -4869,7 +4838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2", - "syn 1.0.21", + "syn 1.0.17", "synstructure", ] @@ -4906,7 +4875,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ "lock_api", - "parking_lot_core 0.7.2", + "parking_lot_core 0.7.1", ] [[package]] @@ -4926,9 +4895,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.7.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb" dependencies = [ "cfg-if", "cloudabi", @@ -4940,9 +4909,9 @@ dependencies = [ [[package]] name = "paste" -version = "0.1.12" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a229b1c58c692edcaa5b9b0948084f130f55d2dcc15b02fcc5340b2b4521476" +checksum = "ab4fb1930692d1b6a9cfabdde3d06ea0a7d186518e2f4d67660d8970e2fa647a" dependencies = [ "paste-impl", "proc-macro-hack", @@ -4950,14 +4919,14 @@ dependencies = [ [[package]] name = "paste-impl" -version = "0.1.12" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0bf239e447e67ff6d16a8bb5e4d4bd2343acf5066061c0e8e06ac5ba8ca68c" +checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5006,35 +4975,35 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.16" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" +checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.16" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" +checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "pin-project-lite" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" +checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" [[package]] name = "pin-utils" -version = "0.1.0" +version = "0.1.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" [[package]] name = "pkg-config" @@ -5056,9 +5025,9 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" [[package]] name = "plotters" -version = "0.2.14" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b1d9ca091d370ea3a78d5619145d1b59426ab0c9eedbad2514a4cee08bf389" +checksum = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb" dependencies = [ "js-sys", "num-traits 0.2.11", @@ -5112,14 +5081,14 @@ dependencies = [ [[package]] name = "primitive-types" -version = "0.7.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" +checksum = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.3.1", + "impl-serde 0.3.0", "uint", ] @@ -5140,8 +5109,8 @@ checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "version_check", ] @@ -5152,8 +5121,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "syn-mid", "version_check", ] @@ -5172,18 +5141,18 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" -version = "1.0.12" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319" +checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" dependencies = [ "unicode-xid 0.2.0", ] [[package]] name = "procfs" -version = "0.7.9" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c434e93ef69c216e68e4f417c927b4f31502c3560b72cfdb6827e2321c5c6b3e" +checksum = "fe50036aa1b71e553a4a0c48ab7baabf8aa8c7a5a61aae06bf38c2eab7430475" dependencies = [ "bitflags", "byteorder 1.3.4", @@ -5226,7 +5195,7 @@ checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" dependencies = [ "bytes 0.5.4", "heck", - "itertools 0.8.2", + "itertools", "log", "multimap", "petgraph", @@ -5243,10 +5212,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", - "itertools 0.8.2", + "itertools", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5313,9 +5282,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.5" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e" +checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" dependencies = [ "proc-macro2", ] @@ -5613,8 +5582,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5630,9 +5599,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.7" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" +checksum = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" dependencies = [ "aho-corasick", "memchr", @@ -5678,13 +5647,13 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.13" +version = "0.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703516ae74571f24b465b4a1431e81e2ad51336cb0ded733a55a1aa3eccac196" +checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" dependencies = [ "cc", + "lazy_static", "libc", - "once_cell", "spin", "untrusted", "web-sys", @@ -5797,8 +5766,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5807,16 +5776,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "pin-project", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" [[package]] name = "safe-mix" @@ -5858,12 +5827,12 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "bytes 0.5.4", "derive_more", "env_logger 0.7.1", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", @@ -5888,9 +5857,9 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -5914,7 +5883,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5931,7 +5900,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5946,17 +5915,17 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sc-cli" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5965,7 +5934,7 @@ dependencies = [ "directories", "env_logger 0.7.1", "fdlimit", - "futures 0.3.5", + "futures 0.3.4", "lazy_static", "log", "names", @@ -5992,16 +5961,16 @@ dependencies = [ "substrate-prometheus-endpoint", "tempfile", "time", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "sc-client-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", "fnv", - "futures 0.3.5", + "futures 0.3.4", "hash-db", "hex-literal", "kvdb", @@ -6035,7 +6004,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "blake2-rfc", "env_logger 0.7.1", @@ -6068,7 +6037,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6078,11 +6047,11 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "env_logger 0.7.1", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6116,12 +6085,12 @@ dependencies = [ [[package]] name = "sc-consensus-babe" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "env_logger 0.7.1", "fork-tree", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "log", "merlin", @@ -6166,10 +6135,10 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6194,7 +6163,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6206,12 +6175,12 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "derive_more", "env_logger 0.7.1", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6231,15 +6200,15 @@ dependencies = [ "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", "tempfile", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "sc-consensus-pow" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "log", "parity-scale-codec", "sc-client-api", @@ -6257,9 +6226,9 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6279,7 +6248,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "log", "sc-client-api", @@ -6292,7 +6261,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "derive_more", @@ -6327,7 +6296,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "log", @@ -6343,7 +6312,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "log", "parity-scale-codec", @@ -6357,7 +6326,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "cranelift-codegen", @@ -6378,14 +6347,14 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "derive_more", "env_logger 0.7.1", "finality-grandpa", "fork-tree", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6417,16 +6386,16 @@ dependencies = [ "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "finality-grandpa", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6439,10 +6408,10 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.5", + "futures 0.3.4", "log", "parity-util-mem", "sc-client-api", @@ -6455,7 +6424,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", "hex", @@ -6470,7 +6439,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "async-std", @@ -6483,7 +6452,7 @@ dependencies = [ "erased-serde", "fnv", "fork-tree", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "futures_codec", "hex", @@ -6530,10 +6499,10 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "async-std", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", @@ -6548,10 +6517,10 @@ dependencies = [ [[package]] name = "sc-network-test" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "env_logger 0.7.1", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", @@ -6574,15 +6543,15 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", "fdlimit", "fnv", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", - "hyper 0.13.5", + "hyper 0.13.4", "hyper-rustls", "log", "num_cpus", @@ -6602,14 +6571,14 @@ dependencies = [ "sp-utils", "substrate-test-runtime-client", "threadpool", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "sc-peerset" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "libp2p", "log", "rand 0.7.3", @@ -6620,7 +6589,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6628,11 +6597,11 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "assert_matches", "futures 0.1.29", - "futures 0.3.5", + "futures 0.3.4", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", @@ -6667,10 +6636,10 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6690,7 +6659,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6704,7 +6673,7 @@ dependencies = [ [[package]] name = "sc-runtime-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sp-allocator", "sp-core", @@ -6717,12 +6686,12 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", "exit-future", "futures 0.1.29", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "hash-db", "lazy_static", @@ -6778,12 +6747,12 @@ dependencies = [ [[package]] name = "sc-service-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "env_logger 0.7.1", "fdlimit", "futures 0.1.29", - "futures 0.3.5", + "futures 0.3.4", "hex-literal", "log", "parity-scale-codec", @@ -6813,7 +6782,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "env_logger 0.7.1", "log", @@ -6827,10 +6796,10 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "bytes 0.5.4", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", @@ -6848,7 +6817,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "erased-serde", "log", @@ -6863,12 +6832,12 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "assert_matches", - "criterion 0.3.2", + "criterion 0.3.1", "derive_more", - "futures 0.3.5", + "futures 0.3.4", "linked-hash-map", "log", "parity-scale-codec", @@ -6886,11 +6855,11 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "assert_matches", "derive_more", - "futures 0.3.5", + "futures 0.3.4", "futures-diagnose", "hex", "intervalier", @@ -6916,9 +6885,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" dependencies = [ "lazy_static", "winapi 0.3.8", @@ -6965,13 +6934,13 @@ dependencies = [ [[package]] name = "scroll_derive" -version = "0.10.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e367622f934864ffa1c704ba2b82280aab856e3d8213c84c5720257eb34b15b9" +checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -6986,9 +6955,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" dependencies = [ "bitflags", "core-foundation", @@ -6999,9 +6968,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.4.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" dependencies = [ "core-foundation-sys", "libc", @@ -7052,29 +7021,29 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.110" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.110" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" dependencies = [ "itoa", "ryu", @@ -7186,8 +7155,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -7244,7 +7213,7 @@ dependencies = [ "base64 0.11.0", "bytes 0.5.4", "flate2", - "futures 0.3.5", + "futures 0.3.4", "http 0.2.1", "httparse", "log", @@ -7257,7 +7226,7 @@ dependencies = [ [[package]] name = "sp-allocator" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", "log", @@ -7268,7 +7237,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "hash-db", "parity-scale-codec", @@ -7283,20 +7252,20 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-api-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "criterion 0.3.2", + "criterion 0.3.1", "parity-scale-codec", "rustversion", "sc-block-builder", @@ -7313,7 +7282,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "serde", @@ -7324,7 +7293,7 @@ dependencies = [ [[package]] name = "sp-application-crypto-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sp-api", "sp-application-crypto", @@ -7335,9 +7304,9 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "criterion 0.3.2", + "criterion 0.3.1", "integer-sqrt", "num-traits 0.2.11", "parity-scale-codec", @@ -7351,7 +7320,7 @@ dependencies = [ [[package]] name = "sp-arithmetic-fuzzer" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "honggfuzz", "num-bigint", @@ -7362,7 +7331,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -7373,7 +7342,7 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7383,7 +7352,7 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -7394,7 +7363,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", "log", @@ -7409,7 +7378,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "serde", "serde_json", @@ -7417,10 +7386,10 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", @@ -7440,7 +7409,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -7453,7 +7422,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "merlin", "parity-scale-codec", @@ -7469,7 +7438,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -7480,7 +7449,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7491,7 +7460,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "base58", "blake2-rfc", @@ -7499,12 +7468,12 @@ dependencies = [ "criterion 0.2.11", "derive_more", "ed25519-dalek", - "futures 0.3.5", + "futures 0.3.4", "hash-db", "hash256-std-hasher", "hex", "hex-literal", - "impl-serde 0.3.1", + "impl-serde 0.3.0", "lazy_static", "libsecp256k1", "log", @@ -7537,7 +7506,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7545,16 +7514,16 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-externalities" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "environmental", "parity-scale-codec", @@ -7564,7 +7533,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "finality-grandpa", "log", @@ -7579,7 +7548,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7588,7 +7557,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", "parity-scale-codec", @@ -7599,9 +7568,9 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "hash-db", "libsecp256k1", "log", @@ -7618,7 +7587,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "lazy_static", "sp-core", @@ -7628,7 +7597,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sp-api", "sp-core", @@ -7638,7 +7607,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "backtrace", "log", @@ -7646,7 +7615,7 @@ dependencies = [ [[package]] name = "sp-phragmen" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "rand 0.7.3", @@ -7661,12 +7630,12 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -7682,7 +7651,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "serde", "serde_json", @@ -7691,7 +7660,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -7713,7 +7682,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7733,18 +7702,18 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-runtime-interface-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sc-executor", "sp-core", @@ -7759,7 +7728,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sp-core", "sp-io", @@ -7770,7 +7739,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "sp-core", "sp-io", @@ -7781,7 +7750,7 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "assert_matches", "parity-scale-codec", @@ -7795,7 +7764,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "serde", "serde_json", @@ -7803,7 +7772,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-api", @@ -7815,7 +7784,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7824,7 +7793,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "hash-db", "hex-literal", @@ -7844,11 +7813,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-dev" +version = "2.0.0-rc1" [[package]] name = "sp-storage" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7859,7 +7828,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7871,7 +7840,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7884,17 +7853,17 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "tracing", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "log", "parity-scale-codec", "serde", @@ -7905,7 +7874,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "criterion 0.2.11", "hash-db", @@ -7923,9 +7892,9 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "futures-core", "lazy_static", "prometheus", @@ -7933,7 +7902,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7944,7 +7913,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8014,9 +7983,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.14" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863246aaf5ddd0d6928dfeb1a9ca65f505599e4e1b399935ef7e75107516b4ef" +checksum = "ff6da2e8d107dfd7b74df5ef4d205c6aebee0706c647f6bc6a2d5789905c00fb" dependencies = [ "clap", "lazy_static", @@ -8025,15 +7994,15 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d239ca4b13aee7a2142e6795cbd69e457665ff8037aed33b3effdc430d2f927a" +checksum = "a489c87c08fbaf12e386665109dd13470dcc9c4583ea3e10dd2b4523e5ebd9ac" dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -8053,13 +8022,13 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "subkey" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "clap", "derive_more", @@ -8068,7 +8037,7 @@ dependencies = [ "hex", "hex-literal", "hyper 0.12.35", - "itertools 0.8.2", + "itertools", "jsonrpc-core-client", "libp2p", "node-primitives", @@ -8101,14 +8070,14 @@ dependencies = [ [[package]] name = "substrate-browser-utils" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "chrono", "clear_on_drop", "console_error_panic_hook", "console_log", "futures 0.1.29", - "futures 0.3.5", + "futures 0.3.4", "futures-timer 3.0.2", "js-sys", "kvdb-web", @@ -8127,34 +8096,34 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-support" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "frame-support", "frame-system", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-client-transports", "jsonrpc-core", "parity-scale-codec", "sc-rpc-api", "serde", "sp-storage", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", - "futures 0.3.5", + "futures 0.3.4", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8173,22 +8142,22 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-dev" +version = "0.8.0-rc1" dependencies = [ "async-std", "derive_more", "futures-util", - "hyper 0.13.5", + "hyper 0.13.4", "log", "prometheus", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] name = "substrate-test-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "hash-db", "parity-scale-codec", "sc-client-api", @@ -8206,7 +8175,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "cfg-if", "frame-executive", @@ -8249,9 +8218,9 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "parity-scale-codec", "sc-block-builder", "sc-client-api", @@ -8268,10 +8237,10 @@ dependencies = [ [[package]] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.4", "parity-scale-codec", "parking_lot 0.10.2", "sc-transaction-graph", @@ -8283,7 +8252,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" [[package]] name = "substrate-wasm-builder" @@ -8293,7 +8262,7 @@ dependencies = [ "build-helper", "cargo_metadata", "fs2", - "itertools 0.8.2", + "itertools", "tempfile", "toml", "walkdir", @@ -8340,7 +8309,7 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.20.0", + "gimli", "log", "more-asserts", "region", @@ -8362,10 +8331,10 @@ checksum = "c77f0ce539b5a09a54dc80a1cf0c7cd7e694df11029354fe50a2d5fe889bdb97" dependencies = [ "anyhow", "cfg-if", - "gimli 0.20.0", + "gimli", "lazy_static", "libc", - "object 0.18.0", + "object", "scroll", "serde", "substrate-wasmtime-runtime", @@ -8418,12 +8387,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.21" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4696caa4048ac7ce2bcd2e484b3cef88c1004e41b8e945a277e2c25dc0b72060" +checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ "proc-macro2", - "quote 1.0.5", + "quote 1.0.3", "unicode-xid 0.2.0", ] @@ -8434,8 +8403,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -8454,16 +8423,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "unicode-xid 0.2.0", ] [[package]] name = "sysinfo" -version = "0.13.4" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e" +checksum = "5a0338198966bde7feb14b011a33d404a62a6e03b843352c71512a2a002634b7" dependencies = [ "cfg-if", "doc-comment", @@ -8517,8 +8486,8 @@ checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9" dependencies = [ "lazy_static", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "version_check", ] @@ -8533,22 +8502,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.17" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467e5ff447618a916519a4e0d62772ab14f434897f3d63f05d8700ef1e9b22c1" +checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.17" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63c1091225b9834089b429bc4a2e01223470e3183e891582909e9d1c4cb55d9" +checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -8562,20 +8531,21 @@ dependencies = [ [[package]] name = "threadpool" -version = "1.8.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +checksum = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" dependencies = [ "num_cpus", ] [[package]] name = "time" -version = "0.1.43" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ "libc", + "redox_syscall", "winapi 0.3.8", ] @@ -8615,9 +8585,9 @@ dependencies = [ [[package]] name = "tinytemplate" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e4bc5ac99433e0dcb8b9f309dd271a165ae37dde129b9e0ce1bfdd8bfe4891" +checksum = "57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a" dependencies = [ "serde", "serde_json", @@ -8649,9 +8619,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.21" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" dependencies = [ "bytes 0.5.4", "fnv", @@ -8752,8 +8722,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -8783,7 +8753,7 @@ checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" dependencies = [ "futures-core", "rustls", - "tokio 0.2.21", + "tokio 0.2.18", "webpki", ] @@ -8895,7 +8865,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite", - "tokio 0.2.21", + "tokio 0.2.18", ] [[package]] @@ -8930,8 +8900,8 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -9005,9 +8975,9 @@ checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" [[package]] name = "trybuild" -version = "1.0.27" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744665442556a91933cee5e75b0371376eb03498c4d0bfbcebd2a9882b4fb5ef" +checksum = "459186ab1afd6d93bd23c2269125f4f7694f8771fe0e64434b4bdc212b94034d" dependencies = [ "glob 0.3.0", "lazy_static", @@ -9045,9 +9015,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.3" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" dependencies = [ "byteorder 1.3.4", "crunchy", @@ -9120,9 +9090,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" [[package]] name = "url" @@ -9154,9 +9124,9 @@ checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" [[package]] name = "vec_map" -version = "0.8.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" [[package]] name = "version_check" @@ -9262,16 +9232,16 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.12" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a369c5e1dfb7569e14d62af4da642a3cbc2f9a3652fe586e26ac22222aa4b04" +checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" dependencies = [ "cfg-if", "js-sys", @@ -9285,7 +9255,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.5", + "quote 1.0.3", "wasm-bindgen-macro-support", ] @@ -9296,8 +9266,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9310,9 +9280,9 @@ checksum = "a91c2916119c17a8e316507afaaa2dd94b47646048014bbdf6bef098c1bb58ad" [[package]] name = "wasm-bindgen-test" -version = "0.3.12" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8e9dad8040e378f0696b017570c6bc929aac373180e06b3d67ac5059c52da3" +checksum = "648da3460c6d2aa04b715a936329e2e311180efe650b2127d6267f4193ccac14" dependencies = [ "console_error_panic_hook", "js-sys", @@ -9324,12 +9294,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.12" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c358c8d2507c1bae25efa069e62ea907aa28700b25c8c33dafb0b15ba4603627" +checksum = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" dependencies = [ "proc-macro2", - "quote 1.0.5", + "quote 1.0.3", ] [[package]] @@ -9349,7 +9319,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "js-sys", "parking_lot 0.9.0", "pin-utils", @@ -9403,7 +9373,7 @@ checksum = "d39ba645aee700b29ff0093028b4123556dd142a74973f04ed6225eedb40e77d" dependencies = [ "anyhow", "faerie", - "gimli 0.20.0", + "gimli", "more-asserts", "target-lexicon", "thiserror", @@ -9418,7 +9388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed54fd9d64dfeeee7c285fd126174a6b5e6d4efc7e5a1566fdb635e60ff6a74e" dependencies = [ "anyhow", - "base64 0.12.1", + "base64 0.12.0", "bincode", "cranelift-codegen", "cranelift-entity", @@ -9442,27 +9412,27 @@ dependencies = [ [[package]] name = "wast" -version = "17.0.0" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0e1c36b928fca33dbaf96235188f5fad22ee87100e26cc606bd0fbabdf1932" +checksum = "5b20abd8b4a26f7e0d4dd5e357e90a3d555ec190e94472c9b2b27c5b9777f9ae" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.18" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b50f9e5e5c81e6fd987ae6997a9f4bbb751df2dec1d8cadb0b5778f1ec13bbe" +checksum = "51a615830ee3e7200b505c441fec09aac2f114deae69df52f215cb828ba112c4" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.39" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc359e5dd3b46cb9687a051d50a2fdd228e4ba7cf6fcf861a5365c3d671a642" +checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" dependencies = [ "js-sys", "wasm-bindgen", @@ -9535,9 +9505,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" dependencies = [ "winapi 0.3.8", ] @@ -9593,7 +9563,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84300bb493cc878f3638b981c62b4632ec1a5c52daaa3036651e8c106d3b55ea" dependencies = [ - "futures 0.3.5", + "futures 0.3.4", "log", "nohash-hasher", "parking_lot 0.10.2", @@ -9617,8 +9587,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.21", + "quote 1.0.3", + "syn 1.0.17", "synstructure", ] diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 030672ee6f..4e8b3ff196 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -21,25 +21,25 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } -sc-service = { version = "0.8.0-dev", path = "../../../client/service" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sc-transaction-pool = { version = "2.0.0-dev", path = "../../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } -sc-network = { version = "0.8.0-dev", path = "../../../client/network" } -sc-consensus-aura = { version = "0.8.0-dev", path = "../../../client/consensus/aura" } -sp-consensus-aura = { version = "0.8.0-dev", path = "../../../primitives/consensus/aura" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } -sc-finality-grandpa = { version = "0.8.0-dev", path = "../../../client/finality-grandpa" } -sp-finality-grandpa = { version = "2.0.0-dev", path = "../../../primitives/finality-grandpa" } -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-dev"} +sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } +sc-service = { version = "0.8.0-rc1", path = "../../../client/service" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +sc-network = { version = "0.8.0-rc1", path = "../../../client/network" } +sc-consensus-aura = { version = "0.8.0-rc1", path = "../../../client/consensus/aura" } +sp-consensus-aura = { version = "0.8.0-rc1", path = "../../../primitives/consensus/aura" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } +sc-finality-grandpa = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa" } +sp-finality-grandpa = { version = "2.0.0-rc1", path = "../../../primitives/finality-grandpa" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc1"} -node-template-runtime = { version = "2.0.0-dev", path = "../runtime" } +node-template-runtime = { version = "2.0.0-rc1", path = "../runtime" } [build-dependencies] -substrate-build-script-utils = { version = "2.0.0-dev", path = "../../../utils/build-script-utils" } +substrate-build-script-utils = { version = "2.0.0-rc1", path = "../../../utils/build-script-utils" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 01484c608c..1bfd6fe5b2 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Anonymous'] edition = '2018' name = 'pallet-template' -version = "2.0.0-dev" +version = "2.0.0-rc1" license = "Unlicense" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" @@ -16,26 +16,26 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = [dependencies.frame-support] default-features = false -version = "2.0.0-dev" +version = "2.0.0-rc1" path = "../../../../frame/support" [dependencies.frame-system] default-features = false -version = "2.0.0-dev" +version = "2.0.0-rc1" path = "../../../../frame/system" [dev-dependencies.sp-core] default-features = false -version = "2.0.0-dev" +version = "2.0.0-rc1" path = "../../../../primitives/core" [dev-dependencies.sp-io] default-features = false -version = "2.0.0-dev" +version = "2.0.0-rc1" path = "../../../../primitives/io" [dev-dependencies.sp-runtime] default-features = false -version = "2.0.0-dev" +version = "2.0.0-rc1" path = "../../../../primitives/runtime" diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index dfd517130b..fcec09ccea 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,31 +13,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-dev", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } -balances = { version = "2.0.0-dev", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } -grandpa = { version = "2.0.0-dev", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } -randomness-collective-flip = { version = "2.0.0-dev", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } -sudo = { version = "2.0.0-dev", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } -system = { version = "2.0.0-dev", default-features = false, package = "frame-system", path = "../../../frame/system" } -timestamp = { version = "2.0.0-dev", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } -transaction-payment = { version = "2.0.0-dev", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } -frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../../frame/executive" } +aura = { version = "2.0.0-rc1", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } +balances = { version = "2.0.0-rc1", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } +grandpa = { version = "2.0.0-rc1", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } +randomness-collective-flip = { version = "2.0.0-rc1", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } +sudo = { version = "2.0.0-rc1", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } +system = { version = "2.0.0-rc1", default-features = false, package = "frame-system", path = "../../../frame/system" } +timestamp = { version = "2.0.0-rc1", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } +transaction-payment = { version = "2.0.0-rc1", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } +frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/executive" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/api" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-dev"} -sp-consensus-aura = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/consensus/aura" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } -sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-dev"} -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/io" } -sp-offchain = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/offchain" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -sp-session = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/session" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/version" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/api" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc1"} +sp-consensus-aura = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/consensus/aura" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc1"} +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/io" } +sp-offchain = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/session" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/version" } -template = { version = "2.0.0-dev", default-features = false, path = "../pallets/template", package = "pallet-template" } +template = { version = "2.0.0-rc1", default-features = false, path = "../pallets/template", package = "pallet-template" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 70147db207..53eb5d507a 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-bench" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." edition = "2018" @@ -10,21 +10,21 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] log = "0.4.8" -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -node-testing = { version = "2.0.0-dev", path = "../testing" } -node-runtime = { version = "2.0.0-dev", path = "../runtime" } -sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +node-testing = { version = "2.0.0-rc1", path = "../testing" } +node-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api/" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } serde = "1.0.101" serde_json = "1.0.41" structopt = "0.3" derive_more = "0.99.2" kvdb = "0.6" kvdb-rocksdb = "0.8" -sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index bd7854b0ba..07a74b5671 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-browser-testing" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Tests for the in-browser light client." edition = "2018" @@ -17,5 +17,5 @@ wasm-bindgen-futures = "0.4.10" wasm-bindgen-test = "0.3.10" futures = "0.3.4" -node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-dev"} -sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-dev"} +node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc1"} +sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc1"} diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 281bee8dbb..2efb58aeeb 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Generic Substrate node implementation in Rust." build = "build.rs" @@ -46,76 +46,76 @@ tracing = "0.1.10" parking_lot = "0.10.0" # primitives -sp-authority-discovery = { version = "2.0.0-dev", path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } -grandpa-primitives = { version = "2.0.0-dev", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/timestamp" } -sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/finality-tracker" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +sp-authority-discovery = { version = "2.0.0-rc1", path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } +grandpa-primitives = { version = "2.0.0-rc1", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/timestamp" } +sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/finality-tracker" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } # client dependencies -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } -sc-chain-spec = { version = "2.0.0-dev", path = "../../../client/chain-spec" } -sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } -sc-transaction-pool = { version = "2.0.0-dev", path = "../../../client/transaction-pool" } -sc-network = { version = "0.8.0-dev", path = "../../../client/network" } -sc-consensus-babe = { version = "0.8.0-dev", path = "../../../client/consensus/babe" } -grandpa = { version = "0.8.0-dev", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } -sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../../../client/db" } -sc-offchain = { version = "2.0.0-dev", path = "../../../client/offchain" } -sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } -sc-basic-authorship = { version = "0.8.0-dev", path = "../../../client/basic-authorship" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } -sc-tracing = { version = "2.0.0-dev", path = "../../../client/tracing" } -sc-telemetry = { version = "2.0.0-dev", path = "../../../client/telemetry" } -sc-authority-discovery = { version = "0.8.0-dev", path = "../../../client/authority-discovery" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } +sc-chain-spec = { version = "2.0.0-rc1", path = "../../../client/chain-spec" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../client/transaction-pool" } +sc-network = { version = "0.8.0-rc1", path = "../../../client/network" } +sc-consensus-babe = { version = "0.8.0-rc1", path = "../../../client/consensus/babe" } +grandpa = { version = "0.8.0-rc1", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } +sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../../../client/db" } +sc-offchain = { version = "2.0.0-rc1", path = "../../../client/offchain" } +sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } +sc-basic-authorship = { version = "0.8.0-rc1", path = "../../../client/basic-authorship" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } +sc-tracing = { version = "2.0.0-rc1", path = "../../../client/tracing" } +sc-telemetry = { version = "2.0.0-rc1", path = "../../../client/telemetry" } +sc-authority-discovery = { version = "0.8.0-rc1", path = "../../../client/authority-discovery" } # frame dependencies -pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../frame/timestamp" } -pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } -frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } -pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../../frame/im-online" } -pallet-authority-discovery = { version = "2.0.0-dev", path = "../../../frame/authority-discovery" } -pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } -pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/timestamp" } +pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } +frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } +pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/im-online" } +pallet-authority-discovery = { version = "2.0.0-rc1", path = "../../../frame/authority-discovery" } +pallet-staking = { version = "2.0.0-rc1", path = "../../../frame/staking" } +pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } # node-specific dependencies -node-runtime = { version = "2.0.0-dev", path = "../runtime" } -node-rpc = { version = "2.0.0-dev", path = "../rpc" } -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -node-executor = { version = "2.0.0-dev", path = "../executor" } +node-runtime = { version = "2.0.0-rc1", path = "../runtime" } +node-rpc = { version = "2.0.0-rc1", path = "../rpc" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +node-executor = { version = "2.0.0-rc1", path = "../executor" } # CLI-specific dependencies -sc-cli = { version = "0.8.0-dev", optional = true, path = "../../../client/cli" } -frame-benchmarking-cli = { version = "2.0.0-dev", optional = true, path = "../../../utils/frame/benchmarking-cli" } -node-inspect = { version = "0.8.0-dev", optional = true, path = "../inspect" } +sc-cli = { version = "0.8.0-rc1", optional = true, path = "../../../client/cli" } +frame-benchmarking-cli = { version = "2.0.0-rc1", optional = true, path = "../../../utils/frame/benchmarking-cli" } +node-inspect = { version = "0.8.0-rc1", optional = true, path = "../inspect" } # WASM-specific dependencies wasm-bindgen = { version = "0.2.57", optional = true } wasm-bindgen-futures = { version = "0.4.7", optional = true } -browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-dev"} +browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc1"} [target.'cfg(target_arch="x86_64")'.dependencies] -node-executor = { version = "2.0.0-dev", path = "../executor", features = [ "wasmtime" ] } -sc-cli = { version = "0.8.0-dev", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } +node-executor = { version = "2.0.0-rc1", path = "../executor", features = [ "wasmtime" ] } +sc-cli = { version = "0.8.0-rc1", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } [dev-dependencies] -sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } -sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } -sc-consensus-babe = { version = "0.8.0-dev", features = ["test-helpers"], path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.8.0-dev", path = "../../../client/consensus/epochs" } -sc-service-test = { version = "2.0.0-dev", path = "../../../client/service/test" } +sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } +sc-consensus-babe = { version = "0.8.0-rc1", features = ["test-helpers"], path = "../../../client/consensus/babe" } +sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../../client/consensus/epochs" } +sc-service-test = { version = "2.0.0-rc1", path = "../../../client/service/test" } futures = "0.3.4" tempfile = "3.1.0" assert_cmd = "1.0" @@ -126,12 +126,12 @@ platforms = "0.2.1" [build-dependencies] structopt = { version = "0.3.8", optional = true } -node-inspect = { version = "0.8.0-dev", optional = true, path = "../inspect" } -frame-benchmarking-cli = { version = "2.0.0-dev", optional = true, path = "../../../utils/frame/benchmarking-cli" } -substrate-build-script-utils = { version = "2.0.0-dev", optional = true, path = "../../../utils/build-script-utils" } +node-inspect = { version = "0.8.0-rc1", optional = true, path = "../inspect" } +frame-benchmarking-cli = { version = "2.0.0-rc1", optional = true, path = "../../../utils/frame/benchmarking-cli" } +substrate-build-script-utils = { version = "2.0.0-rc1", optional = true, path = "../../../utils/build-script-utils" } [build-dependencies.sc-cli] -version = "0.8.0-dev" +version = "0.8.0-rc1" package = "sc-cli" path = "../../../client/cli" optional = true diff --git a/bin/node/cli/tests/build_spec_works.rs b/bin/node/cli/tests/build_spec_works.rs index 800a4a8c51..d4f6de3b87 100644 --- a/bin/node/cli/tests/build_spec_works.rs +++ b/bin/node/cli/tests/build_spec_works.rs @@ -25,7 +25,7 @@ fn build_spec_works() { let base_path = tempdir().expect("could not create a temp dir"); let output = Command::new(cargo_bin("substrate")) - .args(&["build-spec", "--dev", "-d"]) + .args(&["build-spec", "--rc1", "-d"]) .arg(base_path.path()) .output() .unwrap(); diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs index 34078b08cf..744effeef1 100644 --- a/bin/node/cli/tests/check_block_works.rs +++ b/bin/node/cli/tests/check_block_works.rs @@ -31,7 +31,7 @@ fn check_block_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["check-block", "--dev", "--pruning", "archive", "-d"]) + .args(&["check-block", "--rc1", "--pruning", "archive", "-d"]) .arg(base_path.path()) .arg("1") .status() diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 61a07dd1ca..6f2714988f 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -51,7 +51,7 @@ pub fn run_dev_node_for_a_while(base_path: &Path) { let mut cmd = Command::new(cargo_bin("substrate")); let mut cmd = cmd - .args(&["--dev"]) + .args(&["--rc1"]) .arg("-d") .arg(base_path) .spawn() diff --git a/bin/node/cli/tests/export_import_flow.rs b/bin/node/cli/tests/export_import_flow.rs index 85a49b005a..a37dc6e88a 100644 --- a/bin/node/cli/tests/export_import_flow.rs +++ b/bin/node/cli/tests/export_import_flow.rs @@ -82,8 +82,8 @@ impl<'a> ExportImportRevertExecutor<'a> { let sub_command_str = sub_command.to_string(); // Adding "--binary" if need be. let arguments: Vec<&str> = match format_opt { - FormatOpt::Binary => vec![&sub_command_str, "--dev", "--pruning", "archive", "--binary", "-d"], - FormatOpt::Json => vec![&sub_command_str, "--dev", "--pruning", "archive", "-d"], + FormatOpt::Binary => vec![&sub_command_str, "--rc1", "--pruning", "archive", "--binary", "-d"], + FormatOpt::Json => vec![&sub_command_str, "--rc1", "--pruning", "archive", "-d"], }; let tmp: TempDir; @@ -166,7 +166,7 @@ impl<'a> ExportImportRevertExecutor<'a> { /// Runs the `revert` command. fn run_revert(&self) { let output = Command::new(cargo_bin("substrate")) - .args(&["revert", "--dev", "--pruning", "archive", "-d"]) + .args(&["revert", "--rc1", "--pruning", "archive", "-d"]) .arg(&self.base_path.path()) .output() .unwrap(); diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs index aa9653acad..fd23bb6399 100644 --- a/bin/node/cli/tests/inspect_works.rs +++ b/bin/node/cli/tests/inspect_works.rs @@ -31,7 +31,7 @@ fn inspect_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["inspect", "--dev", "--pruning", "archive", "-d"]) + .args(&["inspect", "--rc1", "--pruning", "archive", "-d"]) .arg(base_path.path()) .args(&["block", "1"]) .status() diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs index 001bed8b13..67a4649a6f 100644 --- a/bin/node/cli/tests/purge_chain_works.rs +++ b/bin/node/cli/tests/purge_chain_works.rs @@ -30,7 +30,7 @@ fn purge_chain_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["purge-chain", "--dev", "-d"]) + .args(&["purge-chain", "--rc1", "-d"]) .arg(base_path.path()) .arg("-y") .status() diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index bd79dcd77a..efd9f14762 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -31,7 +31,7 @@ fn running_the_node_works_and_can_be_interrupted() { fn run_command_and_kill(signal: Signal) { let base_path = tempdir().expect("could not create a temp dir"); let mut cmd = Command::new(cargo_bin("substrate")) - .args(&["--dev", "-d"]) + .args(&["--rc1", "-d"]) .arg(base_path.path()) .spawn() .unwrap(); diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 014ac9a4c8..101a080668 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-executor" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." edition = "2018" @@ -13,34 +13,34 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -node-runtime = { version = "2.0.0-dev", path = "../runtime" } -sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } -sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +node-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } trie-root = "0.16.0" -frame-benchmarking = { version = "2.0.0-dev", path = "../../../frame/benchmarking" } +frame-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/benchmarking" } [dev-dependencies] criterion = "0.3.0" -frame-support = { version = "2.0.0-dev", path = "../../../frame/support" } -frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } -node-testing = { version = "2.0.0-dev", path = "../testing" } -pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } -pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-dev", path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } -pallet-session = { version = "2.0.0-dev", path = "../../../frame/session" } -pallet-timestamp = { version = "2.0.0-dev", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-dev", path = "../../../frame/treasury" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } -substrate-test-client = { version = "2.0.0-dev", path = "../../../test-utils/client" } +frame-support = { version = "2.0.0-rc1", path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } +node-testing = { version = "2.0.0-rc1", path = "../testing" } +pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } +pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc1", path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } +pallet-session = { version = "2.0.0-rc1", path = "../../../frame/session" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc1", path = "../../../frame/treasury" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } +substrate-test-client = { version = "2.0.0-rc1", path = "../../../test-utils/client" } wabt = "0.9.2" [features] diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index 5beb1f948e..7f75bd2ca3 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-inspect" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99" log = "0.4.8" -sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } structopt = "0.3.8" diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index 5850db83d4..ff45a3d81d 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system" } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/application-crypto" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } [dev-dependencies] -sp-serializer = { version = "2.0.0-dev", path = "../../../primitives/serializer" } +sp-serializer = { version = "2.0.0-rc1", path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index 8ba5aed4aa..c81a5a5ba9 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,5 +16,5 @@ futures = "0.1.29" hyper = "0.12.35" jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } log = "0.4.8" -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 5eb0d271b9..f5dbf72ea1 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -11,23 +11,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } jsonrpc-core = "14.0.3" -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -node-runtime = { version = "2.0.0-dev", path = "../runtime" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -pallet-contracts-rpc = { version = "0.8.0-dev", path = "../../../frame/contracts/rpc/" } -pallet-transaction-payment-rpc = { version = "2.0.0-dev", path = "../../../frame/transaction-payment/rpc/" } -substrate-frame-rpc-system = { version = "2.0.0-dev", path = "../../../utils/frame/rpc/system" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } -sc-consensus-babe = { version = "0.8.0-dev", path = "../../../client/consensus/babe" } -sc-consensus-babe-rpc = { version = "0.8.0-dev", path = "../../../client/consensus/babe/rpc" } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } -sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } -sc-consensus-epochs = { version = "0.8.0-dev", path = "../../../client/consensus/epochs" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sc-finality-grandpa = { version = "0.8.0-dev", path = "../../../client/finality-grandpa" } -sc-finality-grandpa-rpc = { version = "0.8.0-dev", path = "../../../client/finality-grandpa/rpc" } -sc-rpc-api = { version = "0.8.0-dev", path = "../../../client/rpc-api" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +node-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +pallet-contracts-rpc = { version = "0.8.0-rc1", path = "../../../frame/contracts/rpc/" } +pallet-transaction-payment-rpc = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment/rpc/" } +substrate-frame-rpc-system = { version = "2.0.0-rc1", path = "../../../utils/frame/rpc/system" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +sc-consensus-babe = { version = "0.8.0-rc1", path = "../../../client/consensus/babe" } +sc-consensus-babe-rpc = { version = "0.8.0-rc1", path = "../../../client/consensus/babe/rpc" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } +sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } +sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../../client/consensus/epochs" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sc-finality-grandpa = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa" } +sc-finality-grandpa-rpc = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa/rpc" } +sc-rpc-api = { version = "0.8.0-rc1", path = "../../../client/rpc-api" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 8ca89367fe..b3591f12bc 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -20,68 +20,68 @@ serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" # primitives -sp-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/consensus/babe" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-dev"} -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/inherents" } -node-primitives = { version = "2.0.0-dev", default-features = false, path = "../primitives" } -sp-offchain = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/offchain" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/staking" } -sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../../primitives/keyring" } -sp-session = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/session" } -sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/version" } +sp-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/consensus/babe" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc1"} +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/inherents" } +node-primitives = { version = "2.0.0-rc1", default-features = false, path = "../primitives" } +sp-offchain = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/offchain" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/staking" } +sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../../primitives/keyring" } +sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/session" } +sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/version" } # frame dependencies -frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../../frame/executive" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system" } -frame-system-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system/benchmarking", optional = true } -frame-system-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } -pallet-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../../frame/authority-discovery" } -pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../../../frame/authorship" } -pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../../frame/babe" } -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../../../frame/balances" } -pallet-collective = { version = "2.0.0-dev", default-features = false, path = "../../../frame/collective" } -pallet-contracts = { version = "2.0.0-dev", default-features = false, path = "../../../frame/contracts" } -pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "../../../frame/contracts/common/" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-dev", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } -pallet-democracy = { version = "2.0.0-dev", default-features = false, path = "../../../frame/democracy" } -pallet-elections-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../../frame/elections-phragmen" } -pallet-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../frame/finality-tracker" } -pallet-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-dev", default-features = false, path = "../../../frame/indices" } -pallet-identity = { version = "2.0.0-dev", default-features = false, path = "../../../frame/identity" } -pallet-membership = { version = "2.0.0-dev", default-features = false, path = "../../../frame/membership" } -pallet-offences = { version = "2.0.0-dev", default-features = false, path = "../../../frame/offences" } -pallet-offences-benchmarking = { version = "2.0.0-dev", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } -pallet-randomness-collective-flip = { version = "2.0.0-dev", default-features = false, path = "../../../frame/randomness-collective-flip" } -pallet-recovery = { version = "2.0.0-dev", default-features = false, path = "../../../frame/recovery" } -pallet-session = { version = "2.0.0-dev", features = ["historical"], path = "../../../frame/session", default-features = false } -pallet-session-benchmarking = { version = "2.0.0-dev", path = "../../../frame/session/benchmarking", default-features = false, optional = true } -pallet-staking = { version = "2.0.0-dev", default-features = false, path = "../../../frame/staking" } -pallet-staking-reward-curve = { version = "2.0.0-dev", default-features = false, path = "../../../frame/staking/reward-curve" } -pallet-scheduler = { version = "2.0.0-dev", default-features = false, path = "../../../frame/scheduler" } -pallet-society = { version = "2.0.0-dev", default-features = false, path = "../../../frame/society" } -pallet-sudo = { version = "2.0.0-dev", default-features = false, path = "../../../frame/sudo" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../frame/timestamp" } -pallet-treasury = { version = "2.0.0-dev", default-features = false, path = "../../../frame/treasury" } -pallet-utility = { version = "2.0.0-dev", default-features = false, path = "../../../frame/utility" } -pallet-transaction-payment = { version = "2.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } -pallet-vesting = { version = "2.0.0-dev", default-features = false, path = "../../../frame/vesting" } +frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/executive" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system" } +frame-system-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system/benchmarking", optional = true } +frame-system-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } +pallet-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/authority-discovery" } +pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/authorship" } +pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/babe" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/balances" } +pallet-collective = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/collective" } +pallet-contracts = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/contracts" } +pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/contracts/common/" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc1", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } +pallet-democracy = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/democracy" } +pallet-elections-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/elections-phragmen" } +pallet-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/finality-tracker" } +pallet-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/indices" } +pallet-identity = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/identity" } +pallet-membership = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/membership" } +pallet-offences = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/offences" } +pallet-offences-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-randomness-collective-flip = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/randomness-collective-flip" } +pallet-recovery = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/recovery" } +pallet-session = { version = "2.0.0-rc1", features = ["historical"], path = "../../../frame/session", default-features = false } +pallet-session-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/session/benchmarking", default-features = false, optional = true } +pallet-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/staking/reward-curve" } +pallet-scheduler = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/scheduler" } +pallet-society = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/society" } +pallet-sudo = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/sudo" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/timestamp" } +pallet-treasury = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/treasury" } +pallet-utility = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/utility" } +pallet-transaction-payment = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/transaction-payment" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } +pallet-vesting = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/vesting" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index dded81ac8e..1feb707125 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-testing" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." edition = "2018" @@ -13,40 +13,40 @@ publish = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } -sc-service = { version = "0.8.0-dev", features = ["test-helpers", "db"], path = "../../../client/service" } -sc-client-db = { version = "0.8.0-dev", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" } +pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } +sc-service = { version = "0.8.0-rc1", features = ["test-helpers", "db"], path = "../../../client/service" } +sc-client-db = { version = "0.8.0-rc1", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api/" } codec = { package = "parity-scale-codec", version = "1.3.0" } -pallet-contracts = { version = "2.0.0-dev", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } -pallet-indices = { version = "2.0.0-dev", path = "../../../frame/indices" } -sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } -node-executor = { version = "2.0.0-dev", path = "../executor" } -node-primitives = { version = "2.0.0-dev", path = "../primitives" } -node-runtime = { version = "2.0.0-dev", path = "../runtime" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } -frame-support = { version = "2.0.0-dev", path = "../../../frame/support" } -pallet-session = { version = "2.0.0-dev", path = "../../../frame/session" } -pallet-society = { version = "2.0.0-dev", path = "../../../frame/society" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -pallet-staking = { version = "2.0.0-dev", path = "../../../frame/staking" } -sc-executor = { version = "0.8.0-dev", path = "../../../client/executor", features = ["wasmtime"] } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } -substrate-test-client = { version = "2.0.0-dev", path = "../../../test-utils/client" } -pallet-timestamp = { version = "2.0.0-dev", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-dev", path = "../../../frame/treasury" } +pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } +sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } +node-executor = { version = "2.0.0-rc1", path = "../executor" } +node-primitives = { version = "2.0.0-rc1", path = "../primitives" } +node-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +frame-support = { version = "2.0.0-rc1", path = "../../../frame/support" } +pallet-session = { version = "2.0.0-rc1", path = "../../../frame/session" } +pallet-society = { version = "2.0.0-rc1", path = "../../../frame/society" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc1", path = "../../../frame/staking" } +sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor", features = ["wasmtime"] } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } +substrate-test-client = { version = "2.0.0-rc1", path = "../../../test-utils/client" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc1", path = "../../../frame/treasury" } wabt = "0.9.2" -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/finality-tracker" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/timestamp" } -sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/timestamp" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -54,4 +54,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } diff --git a/bin/utils/chain-spec-builder/Cargo.toml b/bin/utils/chain-spec-builder/Cargo.toml index 211460400c..919a500718 100644 --- a/bin/utils/chain-spec-builder/Cargo.toml +++ b/bin/utils/chain-spec-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-spec-builder" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" -sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" } -sc-chain-spec = { version = "2.0.0-dev", path = "../../../client/chain-spec" } -node-cli = { version = "2.0.0-dev", path = "../../node/cli" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } +sc-chain-spec = { version = "2.0.0-rc1", path = "../../../client/chain-spec" } +node-cli = { version = "2.0.0-rc1", path = "../../node/cli" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.8" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 950e77a8e1..43076062d3 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subkey" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,10 +12,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.1.29" -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -node-runtime = { version = "2.0.0-dev", path = "../../node/runtime" } -node-primitives = { version = "2.0.0-dev", path = "../../node/primitives" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +node-runtime = { version = "2.0.0-rc1", path = "../../node/runtime" } +node-primitives = { version = "2.0.0-rc1", path = "../../node/primitives" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } rand = "0.7.2" clap = "2.33.0" tiny-bip39 = "0.7" @@ -23,14 +23,14 @@ substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.3.0" } -frame-system = { version = "2.0.0-dev", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../../../frame/transaction-payment" } -pallet-grandpa = { version = "2.0.0-dev", path = "../../../frame/grandpa" } +frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } +pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } -sc-rpc = { version = "2.0.0-dev", path = "../../../client/rpc" } +sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" libp2p = "0.19.1" diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index 9e983eb966..8afe365363 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,36 +14,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } -sc-executor = { version = "0.8.0-dev", path = "../executor" } -sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } +sc-executor = { version = "0.8.0-rc1", path = "../executor" } +sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } fnv = { version = "1.0.6" } futures = { version = "0.3.1" } hash-db = { version = "0.15.2", default-features = false } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } hex-literal = { version = "0.2.1" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } kvdb = "0.6.0" log = { version = "0.4.8" } parking_lot = "0.10.0" lazy_static = "1.4.0" -sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } -sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } -sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } +sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } +sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } [dev-dependencies] kvdb-memorydb = "0.6.0" -sp-test-primitives = { version = "2.0.0-dev", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } +sp-test-primitives = { version = "2.0.0-rc1", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 92cf15051e..3a40adf7c6 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-authority-discovery" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -23,21 +23,21 @@ futures = "0.3.4" futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} prost = "0.6.1" rand = "0.7.2" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sc-keystore = { version = "2.0.0-dev", path = "../keystore" } -sc-network = { version = "0.8.0-dev", path = "../network" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } +sc-network = { version = "0.8.0-rc1", path = "../network" } serde_json = "1.0.41" -sp-authority-discovery = { version = "2.0.0-dev", path = "../../primitives/authority-discovery" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-authority-discovery = { version = "2.0.0-rc1", path = "../../primitives/authority-discovery" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } [dev-dependencies] env_logger = "0.7.0" quickcheck = "0.9.0" -sc-peerset = { version = "2.0.0-dev", path = "../peerset" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client"} +sc-peerset = { version = "2.0.0-rc1", path = "../peerset" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client"} diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index 6beb7b7f34..a452f08524 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-basic-authorship" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,21 +16,21 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-dev", path = "../../primitives/inherents" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } -sc-proposer-metrics = { version = "0.8.0-dev", path = "../proposer-metrics" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc1", path = "../../primitives/inherents" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } +sc-proposer-metrics = { version = "0.8.0-rc1", path = "../proposer-metrics" } tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] } [dev-dependencies] -sc-transaction-pool = { version = "2.0.0-dev", path = "../../client/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../../client/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } parking_lot = "0.10.0" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index df2aca9cf5..0be48deb49 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-block-builder" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-block-builder = { version = "2.0.0-dev", path = "../../primitives/block-builder" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../primitives/block-builder" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } -sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } +sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml index fbbf05f55b..aa32d97b25 100644 --- a/client/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,12 +12,12 @@ description = "Substrate chain configurations." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-chain-spec-derive = { version = "2.0.0-dev", path = "./derive" } +sc-chain-spec-derive = { version = "2.0.0-rc1", path = "./derive" } impl-trait-for-tuples = "0.1.3" -sc-network = { version = "0.8.0-dev", path = "../network" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-chain-spec = { version = "2.0.0-dev", path = "../../primitives/chain-spec" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-chain-spec = { version = "2.0.0-rc1", path = "../../primitives/chain-spec" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index 643b3bab82..4bda059264 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index de67879295..dd751612df 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-cli" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Substrate CLI interface." edition = "2018" @@ -25,23 +25,23 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" serde_json = "1.0.41" -sc-informant = { version = "0.8.0-dev", path = "../informant" } -sp-panic-handler = { version = "2.0.0-dev", path = "../../primitives/panic-handler" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../service" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } -substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-dev"} -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +sc-informant = { version = "0.8.0-rc1", path = "../informant" } +sp-panic-handler = { version = "2.0.0-rc1", path = "../../primitives/panic-handler" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../service" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc1"} +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.8" -sc-tracing = { version = "2.0.0-dev", path = "../tracing" } +sc-tracing = { version = "2.0.0-rc1", path = "../tracing" } chrono = "0.4.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index c8a00f9185..b9be82bd63 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-aura" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Aura consensus algorithm for substrate" edition = "2018" @@ -12,37 +12,37 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-dev", path = "../../../primitives/consensus/aura" } -sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc1", path = "../../../primitives/consensus/aura" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sc-keystore = { version = "2.0.0-dev", path = "../../keystore" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sc-keystore = { version = "2.0.0-rc1", path = "../../keystore" } log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } -sp-version = { version = "2.0.0-dev", path = "../../../primitives/version" } -sc-consensus-slots = { version = "0.8.0-dev", path = "../slots" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-version = { version = "2.0.0-rc1", path = "../../../primitives/version" } +sc-consensus-slots = { version = "0.8.0-rc1", path = "../slots" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} [dev-dependencies] -sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-dev", path = "../../executor" } -sc-network = { version = "0.8.0-dev", path = "../../network" } -sc-network-test = { version = "0.8.0-dev", path = "../../network/test" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc1", path = "../../executor" } +sc-network = { version = "0.8.0-rc1", path = "../../network" } +sc-network-test = { version = "0.8.0-rc1", path = "../../network/test" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 1a0c7b2985..154d1509d2 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "BABE consensus algorithm for substrate" edition = "2018" @@ -14,31 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" serde = { version = "1.0.104", features = ["derive"] } -sp-version = { version = "2.0.0-dev", path = "../../../primitives/version" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } -sc-keystore = { version = "2.0.0-dev", path = "../../keystore" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sc-consensus-epochs = { version = "0.8.0-dev", path = "../epochs" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-consensus-vrf = { version = "0.8.0-dev", path = "../../../primitives/consensus/vrf" } -sc-consensus-uncles = { version = "0.8.0-dev", path = "../uncles" } -sc-consensus-slots = { version = "0.8.0-dev", path = "../slots" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -fork-tree = { version = "2.0.0-dev", path = "../../../utils/fork-tree" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} +sp-version = { version = "2.0.0-rc1", path = "../../../primitives/version" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } +sc-keystore = { version = "2.0.0-rc1", path = "../../keystore" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sc-consensus-epochs = { version = "0.8.0-rc1", path = "../epochs" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-consensus-vrf = { version = "0.8.0-rc1", path = "../../../primitives/consensus/vrf" } +sc-consensus-uncles = { version = "0.8.0-rc1", path = "../uncles" } +sc-consensus-slots = { version = "0.8.0-rc1", path = "../slots" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +fork-tree = { version = "2.0.0-rc1", path = "../../../utils/fork-tree" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" @@ -50,13 +50,13 @@ pdqselect = "0.1.0" derive_more = "0.99.2" [dev-dependencies] -sp-keyring = { version = "2.0.0-dev", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-dev", path = "../../executor" } -sc-network = { version = "0.8.0-dev", path = "../../network" } -sc-network-test = { version = "0.8.0-dev", path = "../../network/test" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } +sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc1", path = "../../executor" } +sc-network = { version = "0.8.0-rc1", path = "../../network" } +sc-network-test = { version = "0.8.0-rc1", path = "../../network/test" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 900e29bfba..22c95b6cd1 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "RPC extensions for the BABE consensus algorithm" edition = "2018" @@ -12,27 +12,27 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-consensus-babe = { version = "0.8.0-dev", path = "../" } -sc-rpc-api = { version = "0.8.0-dev", path = "../../../rpc-api" } +sc-consensus-babe = { version = "0.8.0-rc1", path = "../" } +sc-rpc-api = { version = "0.8.0-rc1", path = "../../../rpc-api" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-consensus-babe = { version = "0.8.0-dev", path = "../../../../primitives/consensus/babe" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } -sp-blockchain = { version = "2.0.0-dev", path = "../../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.8.0-dev", path = "../../epochs" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../../primitives/runtime" } +sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../epochs" } futures = { version = "0.3.4", features = ["compat"] } derive_more = "0.99.2" -sp-api = { version = "2.0.0-dev", path = "../../../../primitives/api" } -sp-consensus = { version = "0.8.0-dev", path = "../../../../primitives/consensus/common" } -sp-core = { version = "2.0.0-dev", path = "../../../../primitives/core" } -sc-keystore = { version = "2.0.0-dev", path = "../../../keystore" } +sp-api = { version = "2.0.0-rc1", path = "../../../../primitives/api" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc1", path = "../../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc1", path = "../../../keystore" } [dev-dependencies] -sc-consensus = { version = "0.8.0-dev", path = "../../../consensus/common" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../consensus/common" } serde_json = "1.0.50" -sp-application-crypto = { version = "2.0.0-dev", path = "../../../../primitives/application-crypto" } -sp-keyring = { version = "2.0.0-dev", path = "../../../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../../../primitives/application-crypto" } +sp-keyring = { version = "2.0.0-rc1", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index bf7fac9568..c4743c2175 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,7 +12,7 @@ description = "Collection of common consensus specific imlementations for Substr targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index 7c2edffc53..04397da31d 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-epochs" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Generic epochs-based utilities for consensus" edition = "2018" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -fork-tree = { version = "2.0.0-dev", path = "../../../utils/fork-tree" } -sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-dev"} -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sc-client-api = { path = "../../api" , version = "2.0.0-dev"} +fork-tree = { version = "2.0.0-rc1", path = "../../../utils/fork-tree" } +sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc1"} +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sc-client-api = { path = "../../api" , version = "2.0.0-rc1"} diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 3d42412f2f..84050547a5 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-manual-seal" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Manual sealing engine for Substrate" edition = "2018" @@ -22,20 +22,20 @@ parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } assert_matches = "1.3.0" -sc-client-api = { path = "../../../client/api", version = "2.0.0-dev" } -sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-dev" } -sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-dev" } -sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-dev" } -sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-dev" } -sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-dev" } -sp-core = { path = "../../../primitives/core", version = "2.0.0-dev" } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-dev" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev" } +sc-client-api = { path = "../../../client/api", version = "2.0.0-rc1" } +sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc1" } +sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc1" } +sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc1" } +sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc1" } +sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc1" } +sp-core = { path = "../../../primitives/core", version = "2.0.0-rc1" } +sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc1" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1" } [dev-dependencies] -sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-dev" } -substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-dev" } -substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-dev" } +sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc1" } +substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc1" } +substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc1" } tokio = { version = "0.2", features = ["rt-core", "macros"] } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index 3d47a983ea..252bd04990 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-pow" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "PoW consensus algorithm for substrate" edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-builder" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } -sp-consensus-pow = { version = "0.8.0-dev", path = "../../../primitives/consensus/pow" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sp-consensus-pow = { version = "0.8.0-rc1", path = "../../../primitives/consensus/pow" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } log = "0.4.8" futures = { version = "0.3.1", features = ["compat"] } -sp-timestamp = { version = "2.0.0-dev", path = "../../../primitives/timestamp" } +sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } derive_more = "0.99.2" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index f778cbf2f0..25c6917138 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-slots" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Generic slots-based utilities for consensus" edition = "2018" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../../primitives/application-crypto" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sc-telemetry = { version = "2.0.0-dev", path = "../../telemetry" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" log = "0.4.8" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml index b9039d8189..cc97f18386 100644 --- a/client/consensus/uncles/Cargo.toml +++ b/client/consensus/uncles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-uncles" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Generic uncle inclusion utilities for consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-authorship = { version = "2.0.0-dev", path = "../../../primitives/authorship" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-dev", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-authorship = { version = "2.0.0-rc1", path = "../../../primitives/authorship" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } log = "0.4.8" diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index c9006ee2f6..a33fe69643 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-db" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -23,22 +23,22 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["st codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } blake2-rfc = "0.2.18" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sc-executor = { version = "0.8.0-dev", path = "../executor" } -sc-state-db = { version = "0.8.0-dev", path = "../state-db" } -sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-executor = { version = "0.8.0-rc1", path = "../executor" } +sc-state-db = { version = "0.8.0-rc1", path = "../state-db" } +sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } parity-db = { version = "0.1.2", optional = true } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } [dev-dependencies] -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.9" kvdb-rocksdb = "0.8" diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index ac863fbd8c..2fbc1714c8 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,22 +15,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } -sp-serializer = { version = "2.0.0-dev", path = "../../primitives/serializer" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } -sp-panic-handler = { version = "2.0.0-dev", path = "../../primitives/panic-handler" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } +sp-serializer = { version = "2.0.0-rc1", path = "../../primitives/serializer" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-panic-handler = { version = "2.0.0-rc1", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.41.0" lazy_static = "1.4.0" -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sp-wasm-interface = { version = "2.0.0-dev", path = "../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-dev", path = "../../primitives/runtime-interface" } -sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } -sc-executor-common = { version = "0.8.0-dev", path = "common" } -sc-executor-wasmi = { version = "0.8.0-dev", path = "wasmi" } -sc-executor-wasmtime = { version = "0.8.0-dev", path = "wasmtime", optional = true } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../../primitives/runtime-interface" } +sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } +sc-executor-common = { version = "0.8.0-rc1", path = "common" } +sc-executor-wasmi = { version = "0.8.0-rc1", path = "wasmi" } +sc-executor-wasmtime = { version = "0.8.0-rc1", path = "wasmtime", optional = true } parking_lot = "0.10.0" log = "0.4.8" libsecp256k1 = "0.3.4" @@ -39,11 +39,11 @@ libsecp256k1 = "0.3.4" assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" -sc-runtime-test = { version = "2.0.0-dev", path = "runtime-test" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-runtime-test = { version = "2.0.0-rc1", path = "runtime-test" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } test-case = "0.3.3" -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } [features] default = [ "std" ] diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index ed91c353b9..df9141d80c 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-common" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,11 +18,11 @@ derive_more = "0.99.2" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } wasmi = "0.6.2" -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } -sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } -sp-serializer = { version = "2.0.0-dev", path = "../../../primitives/serializer" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } +sp-serializer = { version = "2.0.0-rc1", path = "../../../primitives/serializer" } [features] default = [] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index c675e72e0f..6ad0338b59 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-runtime-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,12 +13,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/io" } -sp-sandbox = { version = "0.8.0-dev", default-features = false, path = "../../../primitives/sandbox" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -sp-allocator = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/allocator" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/io" } +sp-sandbox = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/sandbox" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-allocator = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/allocator" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index 7ccb167325..c170187658 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmi" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,8 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" wasmi = "0.6.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-dev", path = "../common" } -sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc1", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index e7f19a6c1b..b2b4ee1753 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmtime" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,11 +16,11 @@ log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-dev", path = "../common" } -sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc1", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.4" } wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.4" } wasmtime-environ = "0.16" diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index f0f89b6278..40dfe7c319 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -fork-tree = { version = "2.0.0-dev", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc1", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" @@ -23,37 +23,37 @@ parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" parity-scale-codec = { version = "1.3.0", features = ["derive"] } -sp-arithmetic = { version = "2.0.0-dev", path = "../../primitives/arithmetic" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-dev", path = "../../client/consensus/common" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } -sc-keystore = { version = "2.0.0-dev", path = "../keystore" } +sp-arithmetic = { version = "2.0.0-rc1", path = "../../primitives/arithmetic" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc1", path = "../../client/consensus/common" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } serde_json = "1.0.41" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-inherents = { version = "2.0.0-dev", path = "../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sc-network-gossip = { version = "0.8.0-dev", path = "../network-gossip" } -sp-finality-tracker = { version = "2.0.0-dev", path = "../../primitives/finality-tracker" } -sp-finality-grandpa = { version = "2.0.0-dev", path = "../../primitives/finality-grandpa" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} -sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-inherents = { version = "2.0.0-rc1", path = "../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-network-gossip = { version = "0.8.0-rc1", path = "../network-gossip" } +sp-finality-tracker = { version = "2.0.0-rc1", path = "../../primitives/finality-tracker" } +sp-finality-grandpa = { version = "2.0.0-rc1", path = "../../primitives/finality-grandpa" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} +sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } pin-project = "0.4.6" [dev-dependencies] finality-grandpa = { version = "0.12.3", features = ["derive-codec", "test-helpers"] } -sc-network = { version = "0.8.0-dev", path = "../network" } -sc-network-test = { version = "0.8.0-dev", path = "../network/test" } -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../primitives/consensus/babe" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-network-test = { version = "0.8.0-rc1", path = "../network/test" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../primitives/consensus/babe" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = { version = "0.2", features = ["rt-core"] } tempfile = "3.1.0" -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index 0eecec19f7..dbff14bd16 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "RPC extensions for the GRANDPA finality gadget" repository = "https://github.com/paritytech/substrate/" @@ -8,7 +8,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -sc-finality-grandpa = { version = "0.8.0-dev", path = "../" } +sc-finality-grandpa = { version = "0.8.0-rc1", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.3" @@ -20,4 +20,4 @@ log = "0.4.8" derive_more = "0.99.2" [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index 5957cfc297..d4b6b96a27 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-informant" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Substrate informant." edition = "2018" @@ -17,8 +17,8 @@ futures = "0.3.4" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } wasm-timer = "0.2" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../service" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../service" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index 6de93f28be..1d4312f816 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-keystore" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } hex = "0.4.0" rand = "0.7.2" serde_json = "1.0.41" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index 3ccdae6b5c..a45f96e8b9 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Gossiping for the Substrate network protocol" name = "sc-network-gossip" -version = "0.8.0-dev" +version = "0.8.0-rc1" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -19,12 +19,12 @@ futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["websocket"] } log = "0.4.8" lru = "0.4.3" -sc-network = { version = "0.8.0-dev", path = "../network" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } wasm-timer = "0.2" [dev-dependencies] async-std = "1.5" quickcheck = "0.9.0" rand = "0.7.2" -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 9c32eeaf7d..daa5df0e15 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate network protocol" name = "sc-network" -version = "0.8.0-dev" +version = "0.8.0-rc1" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -26,7 +26,7 @@ derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" fnv = "1.0.6" -fork-tree = { version = "2.0.0-dev", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc1", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" futures_codec = "0.3.3" @@ -39,23 +39,23 @@ lru = "0.4.0" nohash-hasher = "0.2.0" parking_lot = "0.10.0" pin-project = "0.4.6" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-dev", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } prost = "0.6.1" rand = "0.7.2" -sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sc-peerset = { version = "2.0.0-dev", path = "../peerset" } +sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sc-peerset = { version = "2.0.0-rc1", path = "../peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -sp-arithmetic = { version = "2.0.0-dev", path = "../../primitives/arithmetic" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +sp-arithmetic = { version = "2.0.0-rc1", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } thiserror = "1" unsigned-varint = { version = "0.3.1", features = ["futures", "futures-codec"] } void = "1.0.2" @@ -74,10 +74,10 @@ env_logger = "0.7.0" libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } -sp-test-primitives = { version = "2.0.0-dev", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +sp-test-primitives = { version = "2.0.0-rc1", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } tempfile = "3.1.0" [features] diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 554a30c111..73a5d729d9 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Integration tests for Substrate network protocol" name = "sc-network-test" -version = "0.8.0-dev" +version = "0.8.0-rc1" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-network = { version = "0.8.0-dev", path = "../" } +sc-network = { version = "0.8.0-rc1", path = "../" } log = "0.4.8" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" libp2p = { version = "0.19.1", default-features = false, features = ["libp2p-websocket"] } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../../primitives/consensus/babe" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } env_logger = "0.7.0" -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } tempfile = "3.1.0" -sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../service" } diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 5a13b44a80..93d2ea5603 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers" name = "sc-offchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bytes = "0.5" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } fnv = "1.0.6" futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -sp-offchain = { version = "2.0.0-dev", path = "../../primitives/offchain" } +sp-offchain = { version = "2.0.0-rc1", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } rand = "0.7.2" -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sc-keystore = { version = "2.0.0-dev", path = "../keystore" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] hyper = "0.13.2" @@ -38,10 +38,10 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" fdlimit = "0.1.4" -sc-client-db = { version = "0.8.0-dev", default-features = true, path = "../db/" } -sc-transaction-pool = { version = "2.0.0-dev", path = "../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sc-client-db = { version = "0.8.0-rc1", default-features = true, path = "../db/" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } tokio = "0.2" [features] diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index 851128e358..668d40cd60 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -3,7 +3,7 @@ description = "Connectivity manager based on reputation" homepage = "http://parity.io" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" name = "sc-peerset" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" repository = "https://github.com/paritytech/substrate/" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" libp2p = { version = "0.19.1", default-features = false } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils"} +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" wasm-timer = "0.2" diff --git a/client/proposer-metrics/Cargo.toml b/client/proposer-metrics/Cargo.toml index 9d510027ec..406f98fa71 100644 --- a/client/proposer-metrics/Cargo.toml +++ b/client/proposer-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-proposer-metrics" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,4 +13,4 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index f591a6d853..e993291bad 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-api" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -21,11 +21,11 @@ jsonrpc-derive = "14.0.3" jsonrpc-pubsub = "14.0.3" log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } -sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-dev"} -sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-dev"} +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc1"} +sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc1"} serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -sp-rpc = { version = "2.0.0-dev", path = "../../primitives/rpc" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +sp-rpc = { version = "2.0.0-rc1", path = "../../primitives/rpc" } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index a57baf1db7..65f4bb1a1e 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-server" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,7 +17,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.0.3" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 94d4b38600..ed67592741 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,38 +12,38 @@ description = "Substrate Client RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-rpc-api = { version = "0.8.0-dev", path = "../rpc-api" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } +sc-rpc-api = { version = "0.8.0-rc1", path = "../rpc-api" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.0.3" log = "0.4.8" -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.0.3" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } serde_json = "1.0.41" -sp-session = { version = "2.0.0-dev", path = "../../primitives/session" } -sp-offchain = { version = "2.0.0-dev", path = "../../primitives/offchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sp-rpc = { version = "2.0.0-dev", path = "../../primitives/rpc" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sp-chain-spec = { version = "2.0.0-dev", path = "../../primitives/chain-spec" } -sc-executor = { version = "0.8.0-dev", path = "../executor" } -sc-block-builder = { version = "0.8.0-dev", path = "../../client/block-builder" } -sc-keystore = { version = "2.0.0-dev", path = "../keystore" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } +sp-session = { version = "2.0.0-rc1", path = "../../primitives/session" } +sp-offchain = { version = "2.0.0-rc1", path = "../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-rpc = { version = "2.0.0-rc1", path = "../../primitives/rpc" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-chain-spec = { version = "2.0.0-rc1", path = "../../primitives/chain-spec" } +sc-executor = { version = "0.8.0-rc1", path = "../executor" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../client/block-builder" } +sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.10.0" [dev-dependencies] assert_matches = "1.3.0" futures01 = { package = "futures", version = "0.1.29" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } tokio = "0.1.22" -sc-transaction-pool = { version = "2.0.0-dev", path = "../transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../transaction-pool" } lazy_static = "1.4.0" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 5a026e5890..699da80c46 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -39,38 +39,38 @@ hash-db = "0.15.2" serde = "1.0.101" serde_json = "1.0.41" sysinfo = "0.13.3" -sc-keystore = { version = "2.0.0-dev", path = "../keystore" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-trie = { version = "2.0.0-dev", path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-session = { version = "2.0.0-dev", path = "../../primitives/session" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sc-network = { version = "0.8.0-dev", path = "../network" } -sc-chain-spec = { version = "2.0.0-dev", path = "../chain-spec" } -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../db" } +sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-session = { version = "2.0.0-rc1", path = "../../primitives/session" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-chain-spec = { version = "2.0.0-rc1", path = "../chain-spec" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../db" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor = { version = "0.8.0-dev", path = "../executor" } -sc-transaction-pool = { version = "2.0.0-dev", path = "../transaction-pool" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -sc-rpc-server = { version = "2.0.0-dev", path = "../rpc-servers" } -sc-rpc = { version = "2.0.0-dev", path = "../rpc" } -sc-block-builder = { version = "0.8.0-dev", path = "../block-builder" } -sp-block-builder = { version = "2.0.0-dev", path = "../../primitives/block-builder" } +sc-executor = { version = "0.8.0-rc1", path = "../executor" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +sc-rpc-server = { version = "2.0.0-rc1", path = "../rpc-servers" } +sc-rpc = { version = "2.0.0-rc1", path = "../rpc" } +sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } +sp-block-builder = { version = "2.0.0-rc1", path = "../../primitives/block-builder" } -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } -sc-offchain = { version = "2.0.0-dev", path = "../offchain" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sc-offchain = { version = "2.0.0-rc1", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-dev"} -sc-tracing = { version = "2.0.0-dev", path = "../tracing" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc1"} +sc-tracing = { version = "2.0.0-rc1", path = "../tracing" } tracing = "0.1.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } @@ -83,7 +83,7 @@ procfs = '0.7.8' [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-dev", path = "../../primitives/consensus/babe" } -grandpa = { version = "0.8.0-dev", package = "sc-finality-grandpa", path = "../finality-grandpa" } -grandpa-primitives = { version = "2.0.0-dev", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc1", path = "../../primitives/consensus/babe" } +grandpa = { version = "0.8.0-rc1", package = "sc-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { version = "2.0.0-rc1", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index c44f436513..d846638dca 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,24 +20,24 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } -sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } -sp-trie = { version = "2.0.0-dev", path = "../../../primitives/trie" } -sp-storage = { version = "2.0.0-dev", path = "../../../primitives/storage" } -sc-client-db = { version = "0.8.0-dev", default-features = false, path = "../../db" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } +sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } +sp-storage = { version = "2.0.0-rc1", path = "../../../primitives/storage" } +sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../../db" } futures = { version = "0.3.1", features = ["compat"] } -sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../service" } -sc-network = { version = "0.8.0-dev", path = "../../network" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -sc-client-api = { version = "2.0.0-dev", path = "../../api" } -sc-block-builder = { version = "0.8.0-dev", path = "../../block-builder" } -sc-executor = { version = "0.8.0-dev", path = "../../executor" } -sp-panic-handler = { version = "2.0.0-dev", path = "../../../primitives/panic-handler" } +sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-network = { version = "0.8.0-rc1", path = "../../network" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } +sc-executor = { version = "0.8.0-rc1", path = "../../executor" } +sp-panic-handler = { version = "2.0.0-rc1", path = "../../../primitives/panic-handler" } parity-scale-codec = "1.3.0" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index f4f084bc89..ddcaa1f139 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-state-db" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = "0.10.0" log = "0.4.8" -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index bf8440356f..0f78e5d5bf 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-telemetry" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Telemetry utils" edition = "2018" diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index 52fa8d6600..1a59106bbe 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-tracing" -version = "2.0.0-dev" +version = "2.0.0-rc1" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -20,7 +20,7 @@ serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" -sc-telemetry = { version = "2.0.0-dev", path = "../telemetry" } +sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } [dev-dependencies] tracing = "0.1.10" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index 8b51bc7418..de3d34f1d4 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,21 +20,21 @@ intervalier = "0.4.0" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parking_lot = "0.10.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-dev"} -sc-client-api = { version = "2.0.0-dev", path = "../api" } -sc-transaction-graph = { version = "2.0.0-dev", path = "./graph" } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-dev", path = "../../primitives/tracing" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} +sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sc-transaction-graph = { version = "2.0.0-rc1", path = "./graph" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc1", path = "../../primitives/tracing" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } wasm-timer = "0.2" [dev-dependencies] assert_matches = "1.3.0" hex = "0.4" -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } -substrate-test-runtime-transaction-pool = { version = "2.0.0-dev", path = "../../test-utils/runtime/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +substrate-test-runtime-transaction-pool = { version = "2.0.0-rc1", path = "../../test-utils/runtime/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index 4f9131aa96..d7ad5db6a5 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-graph" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,18 +18,18 @@ log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0.101", features = ["derive"] } wasm-timer = "0.2" -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-utils = { version = "2.0.0-dev", path = "../../../primitives/utils" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc1", path = "../../../primitives/utils" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../../test-utils/runtime" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } criterion = "0.3" [[bench]] diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index dc2a838d1c..9b34e968ee 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index 5a8445d270..7221d2c2ce 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aura" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,23 +12,23 @@ description = "FRAME AURA consensus pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -sp-consensus-aura = { version = "0.8.0-dev", path = "../../primitives/consensus/aura", default-features = false } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +sp-consensus-aura = { version = "0.8.0-rc1", path = "../../primitives/consensus/aura", default-features = false } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } lazy_static = "1.4.0" parking_lot = "0.10.0" diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 24cbdbde0a..99a17ec910 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authority-discovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME pallet for authority discovery" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-authority-discovery = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authority-discovery" } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/authority-discovery" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-dev", features = ["historical" ], path = "../session", default-features = false } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc1", features = ["historical" ], path = "../session", default-features = false } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } [features] default = ["std"] diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 43a48b02a0..32faaa23b1 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authorship" -version = "2.0.0-dev" +version = "2.0.0-rc1" description = "Block and Uncle Author tracking for the FRAME" authors = ["Parity Technologies "] edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-authorship = { version = "2.0.0-dev", default-features = false, path = "../../primitives/authorship" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-authorship = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/authorship" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 23946203f3..6ad153ed5a 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-babe" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,22 +14,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } -sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } +sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/babe" } +sp-consensus-vrf = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/vrf" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 18b6fe8ced..9fc875f907 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../transaction-payment" } [features] default = ["std"] diff --git a/frame/benchmark/Cargo.toml b/frame/benchmark/Cargo.toml index 7fab3642f2..2d5f32d58e 100644 --- a/frame/benchmark/Cargo.toml +++ b/frame/benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-benchmark" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std"] diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index dd7de60c57..078283dfac 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] linregress = "0.1" paste = "0.1" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api = { version = "2.0.0-dev", path = "../../primitives/api", default-features = false } -sp-runtime-interface = { version = "2.0.0-dev", path = "../../primitives/runtime-interface", default-features = false } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime", default-features = false } -sp-std = { version = "2.0.0-dev", path = "../../primitives/std", default-features = false } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-api = { version = "2.0.0-rc1", path = "../../primitives/api", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../../primitives/runtime-interface", default-features = false } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "2.0.0-rc1", path = "../../primitives/std", default-features = false } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io", default-features = false } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [features] default = [ "std" ] diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index f2a7f46b06..5a44cd8c79 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-collective" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 3350e815b2..b0f3760a3d 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ pwasm-utils = { version = "0.12.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-sandbox = { version = "0.8.0-dev", default-features = false, path = "../../primitives/sandbox" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "common" } -pallet-transaction-payment = { version = "2.0.0-dev", default-features = false, path = "../transaction-payment" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-sandbox = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/sandbox" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "common" } +pallet-transaction-payment = { version = "2.0.0-rc1", default-features = false, path = "../transaction-payment" } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } -pallet-randomness-collective-flip = { version = "2.0.0-dev", path = "../randomness-collective-flip" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } +pallet-randomness-collective-flip = { version = "2.0.0-rc1", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index d834be7437..00fa3917bc 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } [features] default = ["std"] diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index f3d32e7696..4bc3c84cb8 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-dev", path = "../../../primitives/rpc" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc1", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -pallet-contracts-primitives = { version = "2.0.0-dev", path = "../common" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-dev", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +pallet-contracts-primitives = { version = "2.0.0-rc1", path = "../common" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc1", path = "./runtime-api" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index fdcfb5149a..93b945c053 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Runtime API definition required by Contracts RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/runtime" } -pallet-contracts-primitives = { version = "2.0.0-dev", default-features = false, path = "../../common" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/runtime" } +pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "../../common" } [features] default = ["std"] diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index 5c339d2bc5..040571c5b3 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -pallet-scheduler = { version = "2.0.0-dev", path = "../scheduler" } -sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } -substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-scheduler = { version = "2.0.0-rc1", path = "../scheduler" } +sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } +substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } hex-literal = "0.2.1" [features] diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index f9a3ec0b21..3a46b710b6 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections-phragmen" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../primitives/phragmen" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/phragmen" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } [features] default = ["std"] diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index 3109a13392..af5bc6d558 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index c7aea6eb9b..6d14dd1d95 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-evm" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } primitive-types = { version = "0.7.0", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.16", default-features = false } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index 30381adb49..d6ff25c841 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example-offchain-worker" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -13,13 +13,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } lite-json = { version = "0.1", default-features = false } [features] diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index d12b1e7c83..caeb34f532 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index edfd207bc9..07df7ce5a0 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-executive" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../../primitives/tracing" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/tracing" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } [dev-dependencies] hex-literal = "0.2.1" -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -pallet-indices = { version = "2.0.0-dev", path = "../indices" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -pallet-transaction-payment = { version = "2.0.0-dev", path = "../transaction-payment" } -sp-version = { version = "2.0.0-dev", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +pallet-indices = { version = "2.0.0-rc1", path = "../indices" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-transaction-payment = { version = "2.0.0-rc1", path = "../transaction-payment" } +sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } [features] default = ["std"] diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index 9c2019bfb5..02c15eebeb 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-finality-tracker" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-tracker" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-tracker" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index 9b32d718ac..4e2f85e890 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-generic-asset" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Centrality Developers "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 7a9a00a282..9146b17a9e 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-grandpa" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,27 +14,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-finality-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-grandpa" } -sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } -pallet-finality-tracker = { version = "2.0.0-dev", default-features = false, path = "../finality-tracker" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-finality-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-grandpa" } +sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } +pallet-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../finality-tracker" } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.12.3", features = ["derive-codec"] } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -pallet-offences = { version = "2.0.0-dev", path = "../offences" } -pallet-staking = { version = "2.0.0-dev", path = "../staking" } -pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-offences = { version = "2.0.0-rc1", path = "../offences" } +pallet-staking = { version = "2.0.0-rc1", path = "../staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } [features] default = ["std"] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index bfe2a7d492..5973f12988 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 964bd2f69a..29dc1af011 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-im-online" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME's I'm online pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } -pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../authorship" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../session" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std", "pallet-session/historical"] diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index db0f4cbf55..32b5b81c64 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-indices" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../primitives/keyring" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../primitives/keyring" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index befca54ad1..e881364579 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-membership" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index 1241c3b4ab..71ae6858ee 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-metadata" -version = "11.0.0-dev" +version = "11.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 140a48523b..059e81408b 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-nicks" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index ebb31d680d..92770ba47b 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ description = "FRAME offences pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index e9cd2be005..c4564d6c82 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,27 +13,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } -pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../babe" } -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../../balances" } -pallet-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../grandpa" } -pallet-im-online = { version = "2.0.0-dev", default-features = false, path = "../../im-online" } -pallet-offences = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../../session" } -pallet-staking = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/staking" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } +pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../babe" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../../balances" } +pallet-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../grandpa" } +pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../im-online" } +pallet-offences = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../../session" } +pallet-staking = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/staking" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } [dev-dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } serde = { version = "1.0.101" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-dev", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index 2c6e733cae..7653d2256b 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-randomness-collective-flip" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index b0a5982714..482cde4cd2 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-recovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 6cc9161eea..e150d3b43b 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scheduler" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -11,16 +11,16 @@ description = "FRAME example pallet" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index 83d1402957..e72e1bd1ad 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scored-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 8031804fcd..b653f2bd98 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../timestamp" } -sp-trie = { version = "2.0.0-dev", optional = true, default-features = false, path = "../../primitives/trie" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } +sp-trie = { version = "2.0.0-rc1", optional = true, default-features = false, path = "../../primitives/trie" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -sp-application-crypto = { version = "2.0.0-dev", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" [features] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index 20ef9c6eb6..c8fa5d4453 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ description = "FRAME sessions pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } -pallet-staking = { version = "2.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -pallet-session = { version = "2.0.0-dev", default-features = false, path = "../../session" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } +pallet-staking = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../../session" } [dev-dependencies] serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../../staking/reward-curve" } -sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } -pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } -pallet-balances = { version = "2.0.0-dev", path = "../../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../../staking/reward-curve" } +sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } +pallet-balances = { version = "2.0.0-rc1", path = "../../balances" } [features] default = ["std"] diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index 86c800d571..41162f457c 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-society" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 3147e79803..f6fa826a3d 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,29 +15,29 @@ targets = ["x86_64-unknown-linux-gnu"] static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-phragmen = { version = "2.0.0-dev", default-features = false, path = "../../primitives/phragmen" } -sp-io ={ version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-dev", default-features = false, features = ["historical"], path = "../session" } -pallet-authorship = { version = "2.0.0-dev", default-features = false, path = "../authorship" } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/phragmen" } +sp-io ={ version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc1", default-features = false, features = ["historical"], path = "../session" } +pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } # Optional imports for benchmarking -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -pallet-timestamp = { version = "2.0.0-dev", path = "../timestamp" } -pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../staking/reward-curve" } -substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } -frame-benchmarking = { version = "2.0.0-dev", path = "../benchmarking" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../staking/reward-curve" } +substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } +frame-benchmarking = { version = "2.0.0-rc1", path = "../benchmarking" } rand_chacha = { version = "0.2" } parking_lot = "0.10.2" env_logger = "0.7.1" diff --git a/frame/staking/fuzzer/Cargo.lock b/frame/staking/fuzzer/Cargo.lock index a45f33fdce..b73462e2df 100644 --- a/frame/staking/fuzzer/Cargo.lock +++ b/frame/staking/fuzzer/Cargo.lock @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index 44075aa572..edd3037a7e 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-dev", path = "..", features = ["runtime-benchmarks"] } -pallet-staking-reward-curve = { version = "2.0.0-dev", path = "../reward-curve" } -pallet-session = { version = "2.0.0-dev", path = "../../session" } -pallet-indices = { version = "2.0.0-dev", path = "../../indices" } -pallet-balances = { version = "2.0.0-dev", path = "../../balances" } -pallet-timestamp = { version = "2.0.0-dev", path = "../../timestamp" } -frame-system = { version = "2.0.0-dev", path = "../../system" } -frame-support = { version = "2.0.0-dev", path = "../../support" } -sp-std = { version = "2.0.0-dev", path = "../../../primitives/std" } -sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-phragmen = { version = "2.0.0-dev", path = "../../../primitives/phragmen" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc1", path = "..", features = ["runtime-benchmarks"] } +pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../reward-curve" } +pallet-session = { version = "2.0.0-rc1", path = "../../session" } +pallet-indices = { version = "2.0.0-rc1", path = "../../indices" } +pallet-balances = { version = "2.0.0-rc1", path = "../../balances" } +pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } +frame-system = { version = "2.0.0-rc1", path = "../../system" } +frame-support = { version = "2.0.0-rc1", path = "../../support" } +sp-std = { version = "2.0.0-rc1", path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-phragmen = { version = "2.0.0-rc1", path = "../../../primitives/phragmen" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } [[bin]] name = "submit_solution" diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index b5ec29060a..3e6e4ca738 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking-reward-curve" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -21,4 +21,4 @@ proc-macro2 = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index bbceac1496..f6df3ec03e 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-sudo" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index 61363be2df..ba98adb8fc 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,25 +15,25 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-metadata = { version = "11.0.0-dev", default-features = false, path = "../metadata" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../../primitives/tracing" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../../primitives/arithmetic" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -frame-support-procedural = { version = "2.0.0-dev", path = "./procedural" } +frame-metadata = { version = "11.0.0-rc1", default-features = false, path = "../metadata" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/tracing" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/arithmetic" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +frame-support-procedural = { version = "2.0.0-rc1", path = "./procedural" } paste = "0.1.6" once_cell = { version = "1", default-features = false, optional = true } -sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" smallvec = "1.4.0" [dev-dependencies] pretty_assertions = "0.6.1" -frame-system = { version = "2.0.0-dev", path = "../system" } +frame-system = { version = "2.0.0-rc1", path = "../system" } [features] default = ["std"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 4d05685f9d..90c90f4ca0 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -frame-support-procedural-tools = { version = "2.0.0-dev", path = "./tools" } +frame-support-procedural-tools = { version = "2.0.0-rc1", path = "./tools" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full"] } diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index 5e5e0eb4c4..2f6d124063 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Proc macro helpers for procedural macros" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support-procedural-tools-derive = { version = "2.0.0-dev", path = "./derive" } +frame-support-procedural-tools-derive = { version = "2.0.0-rc1", path = "./derive" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full", "visit"] } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index 7cc657e685..20d427de47 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index e676106e17..8b858cf5b0 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io", default-features = false } -sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../../primitives/state-machine" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/inherents" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io", default-features = false } +sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../../primitives/state-machine" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/inherents" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 254938df2b..b88553729d 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", path = "../../primitives/io", default-features = false } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" -sp-externalities = { version = "0.8.0-dev", path = "../../primitives/externalities" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" } +sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 7ce619f413..748dc31467 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-benchmarking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../../benchmarking" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../system" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../support" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ version = "2.0.0-dev", path = "../../../primitives/io" } +sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index d0644931ae..72e2837037 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-rpc-runtime-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Runtime API definition required by System RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [features] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 49abf80254..6146700cd5 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-timestamp" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,19 +16,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io", optional = true } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../primitives/timestamp" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io", optional = true } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index 56efe907f5..e4af397388 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,18 +13,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "./rpc/runtime-api" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "./rpc/runtime-api" } smallvec = "1.4.0" [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index 3851c988e2..e3e935c3c8 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,10 +16,10 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-dev", path = "../../../primitives/rpc" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc1", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-dev", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", path = "./runtime-api" } diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index f8e948ea10..4466a2e53d 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../support" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../support" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 9b031c4a0c..a78037ebe0 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-treasury" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-dev", default-features = false, path = "../balances" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io ={ version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index fff5513682..b6c7fffdaa 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-utility" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 70c97006df..311fd5ae40 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-dev", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-dev", path = "../../primitives/io" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-dev", path = "../balances" } -sp-storage = { version = "2.0.0-dev", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } hex-literal = "0.2.1" [features] diff --git a/primitives/allocator/Cargo.toml b/primitives/allocator/Cargo.toml index d56b4e34b2..e83d70b4dc 100644 --- a/primitives/allocator/Cargo.toml +++ b/primitives/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-allocator" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/sp-allocator" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-dev", path = "../std", default-features = false } -sp-core = { version = "2.0.0-dev", path = "../core", default-features = false } -sp-wasm-interface = { version = "2.0.0-dev", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc1", path = "../std", default-features = false } +sp-core = { version = "2.0.0-rc1", path = "../core", default-features = false } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../wasm-interface", default-features = false } log = { version = "0.4.8", optional = true } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index f82bcac77e..f38da4da0c 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api-proc-macro = { version = "2.0.0-dev", path = "proc-macro" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../version" } -sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } +sp-api-proc-macro = { version = "2.0.0-rc1", path = "proc-macro" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../version" } +sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } hash-db = { version = "0.15.2", optional = true } [dev-dependencies] -sp-test-primitives = { version = "2.0.0-dev", path = "../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc1", path = "../test-primitives" } [features] default = [ "std" ] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index 46f804f32c..c0441de584 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-proc-macro" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 9e2d894a01..0760472b77 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-dev", path = "../" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -sp-version = { version = "2.0.0-dev", path = "../../version" } -sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } -sp-blockchain = { version = "2.0.0-dev", path = "../../blockchain" } -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } +sp-api = { version = "2.0.0-rc1", path = "../" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sp-version = { version = "2.0.0-rc1", path = "../../version" } +sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../blockchain" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" [dev-dependencies] criterion = "0.3.0" -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -sp-core = { version = "2.0.0-dev", path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sp-core = { version = "2.0.0-rc1", path = "../../core" } [[bench]] name = "bench" diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index b350dee843..fa13fd947e 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" description = "Provides facilities for generating application specific crypto wrapper types." @@ -14,11 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } [features] default = [ "std" ] diff --git a/primitives/application-crypto/test/Cargo.toml b/primitives/application-crypto/test/Cargo.toml index 6e2c81f3a6..284af732a1 100644 --- a/primitives/application-crypto/test/Cargo.toml +++ b/primitives/application-crypto/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" description = "Integration tests for application-crypto" @@ -13,8 +13,8 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" } -sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } -sp-api = { version = "2.0.0-dev", path = "../../api" } -sp-application-crypto = { version = "2.0.0-dev", path = "../" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc1", path = "../" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index 9d080d6010..50eab59c86 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-debug-derive = { version = "2.0.0-dev", default-features = false, path = "../../primitives/debug-derive" } +sp-debug-derive = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/debug-derive" } [dev-dependencies] rand = "0.7.2" diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index c4842adc84..c388d0259f 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic-fuzzer" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-arithmetic = { version = "2.0.0-dev", path = ".." } +sp-arithmetic = { version = "2.0.0-rc1", path = ".." } honggfuzz = "0.5.49" primitive-types = "0.7.0" num-bigint = "0.2" diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index 286a2e3141..5d3db31f8a 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authority-discovery" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Authority discovery primitives" edition = "2018" @@ -12,11 +12,11 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index 0888878ab8..f28f5b6efe 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authorship" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Authorship primitives" edition = "2018" @@ -12,9 +12,9 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index b9793621c9..565caffe9d 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-block-builder" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "The block builder runtime api." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } [features] default = [ "std" ] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index 9eb619ccb9..36d13f0cec 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-blockchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,7 +19,7 @@ lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-dev", path = "../consensus/common" } -sp-runtime = { version = "2.0.0-dev", path = "../runtime" } -sp-block-builder = { version = "2.0.0-dev", path = "../block-builder" } -sp-state-machine = { version = "0.8.0-dev", path = "../state-machine" } +sp-consensus = { version = "0.8.0-rc1", path = "../consensus/common" } +sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-block-builder = { version = "2.0.0-rc1", path = "../block-builder" } +sp-state-machine = { version = "0.8.0-rc1", path = "../state-machine" } diff --git a/primitives/chain-spec/Cargo.toml b/primitives/chain-spec/Cargo.toml index 1d482c5970..d530592fec 100644 --- a/primitives/chain-spec/Cargo.toml +++ b/primitives/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-chain-spec" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index b907b5689b..9323788300 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-aura" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,13 +12,13 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../inherents" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../inherents" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 6a5da2788f..3a92b2f2c6 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-babe" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Primitives for BABE consensus" edition = "2018" @@ -12,16 +12,16 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } merlin = { version = "2.0", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } -sp-consensus = { version = "0.8.0-dev", optional = true, path = "../common" } -sp-consensus-vrf = { version = "0.8.0-dev", path = "../vrf", default-features = false } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../inherents" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } -sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } +sp-consensus = { version = "0.8.0-rc1", optional = true, path = "../common" } +sp-consensus-vrf = { version = "0.8.0-rc1", path = "../vrf", default-features = false } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../inherents" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } +sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index b7b0f111de..a652569895 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,22 +17,22 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" -sp-core = { path= "../../core", version = "2.0.0-dev"} -sp-inherents = { version = "2.0.0-dev", path = "../../inherents" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +sp-core = { path= "../../core", version = "2.0.0-rc1"} +sp-inherents = { version = "2.0.0-rc1", path = "../../inherents" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "3.0.1" -sp-std = { version = "2.0.0-dev", path = "../../std" } -sp-version = { version = "2.0.0-dev", path = "../../version" } -sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } -sp-utils = { version = "2.0.0-dev", path = "../../utils" } +sp-std = { version = "2.0.0-rc1", path = "../../std" } +sp-version = { version = "2.0.0-rc1", path = "../../version" } +sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-utils = { version = "2.0.0-rc1", path = "../../utils" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-dev"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} [dev-dependencies] -sp-test-primitives = { version = "2.0.0-dev", path = "../../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc1", path = "../../test-primitives" } [features] default = [] diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index aedc50ab51..8ac24db410 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-pow" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../api" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index fce027e7a0..cb4b270744 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-vrf" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Primitives for VRF based consensus" edition = "2018" @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { version = "1.0.0", package = "parity-scale-codec", default-features = false } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } -sp-std = { version = "2.0.0-dev", path = "../../std", default-features = false } -sp-core = { version = "2.0.0-dev", path = "../../core", default-features = false } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../runtime" } +sp-std = { version = "2.0.0-rc1", path = "../../std", default-features = false } +sp-core = { version = "2.0.0-rc1", path = "../../core", default-features = false } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index d028141d3d..85564274b0 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-core" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -33,9 +33,9 @@ num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } -sp-debug-derive = { version = "2.0.0-dev", path = "../debug-derive" } -sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } -sp-storage = { version = "2.0.0-dev", default-features = false, path = "../storage" } +sp-debug-derive = { version = "2.0.0-rc1", path = "../debug-derive" } +sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } +sp-storage = { version = "2.0.0-rc1", default-features = false, path = "../storage" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } futures = { version = "0.3.1", optional = true } @@ -50,10 +50,10 @@ twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } merlin = { version = "2.0", default-features = false, optional = true } -sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../runtime-interface" } +sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../runtime-interface" } [dev-dependencies] -sp-serializer = { version = "2.0.0-dev", path = "../serializer" } +sp-serializer = { version = "2.0.0-rc1", path = "../serializer" } pretty_assertions = "0.6.1" hex-literal = "0.2.1" rand = "0.7.2" diff --git a/primitives/database/Cargo.toml b/primitives/database/Cargo.toml index ef65a8b940..5754227632 100644 --- a/primitives/database/Cargo.toml +++ b/primitives/database/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-database" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index d620d2bc71..a703dcc5f1 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-debug-derive" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 31dde81d7e..66367b7e79 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-externalities" -version = "0.8.0-dev" +version = "0.8.0-rc1" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-externalities" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-storage = { version = "2.0.0-dev", path = "../storage" } -sp-std = { version = "2.0.0-dev", path = "../std" } +sp-storage = { version = "2.0.0-rc1", path = "../storage" } +sp-std = { version = "2.0.0-rc1", path = "../std" } environmental = { version = "1.1.1" } codec = { package = "parity-scale-codec", version = "1.3.0" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index 36af9319e7..a4154caac0 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-grandpa" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index 9e40cb8551..c8e663455d 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-tracker" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } [features] default = ["std"] diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 287f4d7b9d..57434a2a7d 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-inherents" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = { version = "0.10.0", optional = true } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index 2bba4e94cb..ca12371406 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-io" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } hash-db = { version = "0.15.2", default-features = false } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } libsecp256k1 = { version = "0.3.4", optional = true } -sp-state-machine = { version = "0.8.0-dev", optional = true, path = "../../primitives/state-machine" } -sp-wasm-interface = { version = "2.0.0-dev", path = "../../primitives/wasm-interface", default-features = false } -sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../runtime-interface" } -sp-trie = { version = "2.0.0-dev", optional = true, path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } +sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../../primitives/wasm-interface", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../runtime-interface" } +sp-trie = { version = "2.0.0-rc1", optional = true, path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/keyring/Cargo.toml b/primitives/keyring/Cargo.toml index b9fe7cb7a0..b096e6d6c1 100644 --- a/primitives/keyring/Cargo.toml +++ b/primitives/keyring/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-keyring" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-dev", path = "../core" } -sp-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-core = { version = "2.0.0-rc1", path = "../core" } +sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } lazy_static = "1.4.0" strum = { version = "0.16.0", features = ["derive"] } diff --git a/primitives/offchain/Cargo.toml b/primitives/offchain/Cargo.toml index 1ed6c3342a..eb9e319869 100644 --- a/primitives/offchain/Cargo.toml +++ b/primitives/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers primitives" name = "sp-offchain" -version = "2.0.0-dev" +version = "2.0.0-rc1" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } [dev-dependencies] -sp-state-machine = { version = "0.8.0-dev", default-features = false, path = "../state-machine" } +sp-state-machine = { version = "0.8.0-rc1", default-features = false, path = "../state-machine" } [features] default = ["std"] diff --git a/primitives/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml index bc3ef2bdc6..886f979311 100644 --- a/primitives/panic-handler/Cargo.toml +++ b/primitives/panic-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-panic-handler" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/Cargo.toml b/primitives/phragmen/Cargo.toml index 3317b2fac0..021c60325c 100644 --- a/primitives/phragmen/Cargo.toml +++ b/primitives/phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-phragmen-compact = { version = "2.0.0-dev", path = "./compact" } -sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-phragmen-compact = { version = "2.0.0-rc1", path = "./compact" } +sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../arithmetic" } [dev-dependencies] -substrate-test-utils = { version = "2.0.0-dev", path = "../../test-utils" } +substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } rand = "0.7.3" -sp-phragmen = { version = "2.0.0-dev", path = "." } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-rc1", path = "." } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } [features] default = ["std"] diff --git a/primitives/phragmen/compact/Cargo.toml b/primitives/phragmen/compact/Cargo.toml index 1e5afd6c49..c3f8748a9d 100644 --- a/primitives/phragmen/compact/Cargo.toml +++ b/primitives/phragmen/compact/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen-compact" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/fuzzer/Cargo.lock b/primitives/phragmen/fuzzer/Cargo.lock index 49006f5be8..19f8114f36 100644 --- a/primitives/phragmen/fuzzer/Cargo.lock +++ b/primitives/phragmen/fuzzer/Cargo.lock @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-dev" +version = "2.0.0-rc1" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/primitives/phragmen/fuzzer/Cargo.toml b/primitives/phragmen/fuzzer/Cargo.toml index d81d23c476..82f33c173d 100644 --- a/primitives/phragmen/fuzzer/Cargo.toml +++ b/primitives/phragmen/fuzzer/Cargo.toml @@ -14,9 +14,9 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-phragmen = { version = "2.0.0-dev", path = ".." } -sp-std = { version = "2.0.0-dev", path = "../../std" } -sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } +sp-phragmen = { version = "2.0.0-rc1", path = ".." } +sp-std = { version = "2.0.0-rc1", path = "../../std" } +sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } honggfuzz = "0.5" rand = { version = "0.7.3", features = ["std", "small_rng"] } diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index 4c9dfb5d7b..2b476bd872 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-rpc" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", features = ["derive"] } -sp-core = { version = "2.0.0-dev", path = "../core" } +sp-core = { version = "2.0.0-rc1", path = "../core" } [dev-dependencies] serde_json = "1.0.41" diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index df1b32d73f..0f78b410e3 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,20 +13,20 @@ documentation = "https://docs.rs/sp-runtime-interface/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-wasm-interface = { version = "2.0.0-dev", path = "../wasm-interface", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-tracing = { version = "2.0.0-dev", default-features = false, path = "../tracing" } -sp-runtime-interface-proc-macro = { version = "2.0.0-dev", path = "proc-macro" } -sp-externalities = { version = "0.8.0-dev", optional = true, path = "../externalities" } +sp-wasm-interface = { version = "2.0.0-rc1", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../tracing" } +sp-runtime-interface-proc-macro = { version = "2.0.0-rc1", path = "proc-macro" } +sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] -sp-runtime-interface-test-wasm = { version = "2.0.0-dev", path = "test-wasm" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } -sp-core = { version = "2.0.0-dev", path = "../core" } -sp-io = { version = "2.0.0-dev", path = "../io" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc1", path = "test-wasm" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc1", path = "../core" } +sp-io = { version = "2.0.0-rc1", path = "../io" } rustversion = "1.0.0" trybuild = "1.0.23" diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index 429168fe7b..4ea3fce0be 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 5bf47afd78..99baf624a5 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index 5029d4fa3e..ce236ae16c 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-dev", default-features = false, path = "../" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test/Cargo.toml b/primitives/runtime-interface/test/Cargo.toml index 3aab396e2e..efd474dc93 100644 --- a/primitives/runtime-interface/test/Cargo.toml +++ b/primitives/runtime-interface/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-dev", path = "../" } -sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } -sp-runtime-interface-test-wasm = { version = "2.0.0-dev", path = "../test-wasm" } -sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-dev", path = "../test-wasm-deprecated" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-dev", path = "../../runtime" } -sp-core = { version = "2.0.0-dev", path = "../../core" } -sp-io = { version = "2.0.0-dev", path = "../../io" } +sp-runtime-interface = { version = "2.0.0-rc1", path = "../" } +sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc1", path = "../test-wasm" } +sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc1", path = "../test-wasm-deprecated" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-core = { version = "2.0.0-rc1", path = "../../core" } +sp-io = { version = "2.0.0-rc1", path = "../../io" } tracing = "0.1.13" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index cc87a21f97..3c5fdde12b 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,23 +16,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } -sp-arithmetic = { version = "2.0.0-dev", default-features = false, path = "../arithmetic" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../io" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } +sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../io" } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } impl-trait-for-tuples = "0.1.3" -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } [dev-dependencies] serde_json = "1.0.41" rand = "0.7.2" -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } [features] bench = [] diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index 73755d17c3..d5e3113511 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-sandbox" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,10 +13,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-dev", default-features = false, path = "../io" } -sp-wasm-interface = { version = "2.0.0-dev", default-features = false, path = "../wasm-interface" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../io" } +sp-wasm-interface = { version = "2.0.0-rc1", default-features = false, path = "../wasm-interface" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [dev-dependencies] diff --git a/primitives/serializer/Cargo.toml b/primitives/serializer/Cargo.toml index ded058caa1..ad57cdda4b 100644 --- a/primitives/serializer/Cargo.toml +++ b/primitives/serializer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-serializer" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index f910d85440..656db4ec92 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-session" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-staking = { version = "2.0.0-dev", default-features = false, path = "../staking" } -sp-runtime = { version = "2.0.0-dev", optional = true, path = "../runtime" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../staking" } +sp-runtime = { version = "2.0.0-rc1", optional = true, path = "../runtime" } [features] default = [ "std" ] diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index f22e88855d..75fbb0020c 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-staking" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index 470ad33fc3..b8ce048b2e 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-state-machine" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Substrate State Machine" edition = "2018" @@ -18,17 +18,17 @@ parking_lot = "0.10.0" hash-db = "0.15.2" trie-db = "0.20.1" trie-root = "0.16.0" -sp-trie = { version = "2.0.0-dev", path = "../trie" } -sp-core = { version = "2.0.0-dev", path = "../core" } -sp-panic-handler = { version = "2.0.0-dev", path = "../panic-handler" } +sp-trie = { version = "2.0.0-rc1", path = "../trie" } +sp-core = { version = "2.0.0-rc1", path = "../core" } +sp-panic-handler = { version = "2.0.0-rc1", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.3.0" } num-traits = "0.2.8" rand = "0.7.2" -sp-externalities = { version = "0.8.0-dev", path = "../externalities" } +sp-externalities = { version = "0.8.0-rc1", path = "../externalities" } [dev-dependencies] hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } [features] default = [] diff --git a/primitives/std/Cargo.toml b/primitives/std/Cargo.toml index 8f9d626e25..d7ed5615ae 100644 --- a/primitives/std/Cargo.toml +++ b/primitives/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-std" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/storage/Cargo.toml b/primitives/storage/Cargo.toml index a2ac2b1308..94db0a4f4d 100644 --- a/primitives/storage/Cargo.toml +++ b/primitives/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-storage" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" description = "Storage related primitives" @@ -13,11 +13,11 @@ documentation = "https://docs.rs/sp-storage/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } ref-cast = "1.0.0" -sp-debug-derive = { version = "2.0.0-dev", path = "../debug-derive" } +sp-debug-derive = { version = "2.0.0-rc1", path = "../debug-derive" } [features] default = [ "std" ] diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index b6d4972dd9..707b049533 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-test-primitives" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } [features] diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 4279538c24..570c878f7d 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-timestamp" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Substrate core types and inherents for timestamps." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index 2bdf76bc06..13c5d1c25c 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-tracing" -version = "2.0.0-dev" +version = "2.0.0-rc1" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index 5acb86ade4..312fb71353 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,9 +19,9 @@ derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} -sp-api = { version = "2.0.0-dev", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } -sp-utils = { version = "2.0.0-dev", default-features = false, path = "../utils" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-utils = { version = "2.0.0-rc1", default-features = false, path = "../utils" } [features] default = [ "std" ] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index b3cf58ec59..8eacd4a628 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-trie" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] description = "Patricia trie stuff using a parity-scale-codec node format" repository = "https://github.com/paritytech/substrate/" @@ -18,19 +18,19 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.20.1", default-features = false } trie-root = { version = "0.16.0", default-features = false } memory-db = { version = "0.20.0", default-features = false } -sp-core = { version = "2.0.0-dev", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } [dev-dependencies] trie-bench = "0.21.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-dev", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } [features] default = ["std"] diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index 7ed50c9f32..6c5488f389 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index dc9f562ccd..19a773d306 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-version" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index d9d17b9edb..d83a586827 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-wasm-interface" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" -sp-std = { version = "2.0.0-dev", path = "../std", default-features = false } +sp-std = { version = "2.0.0-rc1", path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index e19592a82b..4f6a46e145 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index 082d9941d8..ae0dfb3808 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,17 +12,17 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-dev", path = "../../client/api" } -sc-client-db = { version = "0.8.0-dev", features = ["test-helpers"], path = "../../client/db" } -sp-consensus = { version = "0.8.0-dev", path = "../../primitives/consensus/common" } -sc-executor = { version = "0.8.0-dev", path = "../../client/executor" } -sc-consensus = { version = "0.8.0-dev", path = "../../client/consensus/common" } -sc-service = { version = "0.8.0-dev", default-features = false, features = ["test-helpers"], path = "../../client/service" } +sc-client-api = { version = "2.0.0-rc1", path = "../../client/api" } +sc-client-db = { version = "0.8.0-rc1", features = ["test-helpers"], path = "../../client/db" } +sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sc-executor = { version = "0.8.0-rc1", path = "../../client/executor" } +sc-consensus = { version = "0.8.0-rc1", path = "../../client/consensus/common" } +sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../client/service" } futures = "0.3.4" hash-db = "0.15.2" -sp-keyring = { version = "2.0.0-dev", path = "../../primitives/keyring" } +sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-core = { version = "2.0.0-dev", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" } -sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 6cd82ce029..70e98b2466 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,35 +13,35 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-dev", default-features = false, path = "../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/aura" } -sp-consensus-babe = { version = "0.8.0-dev", default-features = false, path = "../../primitives/consensus/babe" } -sp-block-builder = { version = "2.0.0-dev", default-features = false, path = "../../primitives/block-builder" } +sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/aura" } +sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/babe" } +sp-block-builder = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-executive = { version = "2.0.0-dev", default-features = false, path = "../../frame/executive" } -sp-inherents = { version = "2.0.0-dev", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-dev", optional = true, path = "../../primitives/keyring" } +frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../frame/executive" } +sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.20.0", default-features = false } -sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-dev"} -sp-core = { version = "2.0.0-dev", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-dev", default-features = false, path = "../../primitives/std" } -sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-dev"} -sp-io = { version = "2.0.0-dev", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-dev", default-features = false, path = "../../frame/support" } -sp-version = { version = "2.0.0-dev", default-features = false, path = "../../primitives/version" } -sp-session = { version = "2.0.0-dev", default-features = false, path = "../../primitives/session" } -sp-api = { version = "2.0.0-dev", default-features = false, path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-dev", default-features = false, path = "../../primitives/runtime" } -pallet-babe = { version = "2.0.0-dev", default-features = false, path = "../../frame/babe" } -frame-system = { version = "2.0.0-dev", default-features = false, path = "../../frame/system" } -frame-system-rpc-runtime-api = { version = "2.0.0-dev", default-features = false, path = "../../frame/system/rpc/runtime-api" } -pallet-timestamp = { version = "2.0.0-dev", default-features = false, path = "../../frame/timestamp" } -sp-finality-grandpa = { version = "2.0.0-dev", default-features = false, path = "../../primitives/finality-grandpa" } -sp-trie = { version = "2.0.0-dev", default-features = false, path = "../../primitives/trie" } -sp-transaction-pool = { version = "2.0.0-dev", default-features = false, path = "../../primitives/transaction-pool" } +sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc1"} +sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc1"} +sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../frame/support" } +sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } +sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } +sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../frame/babe" } +frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../frame/system" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../frame/system/rpc/runtime-api" } +pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../frame/timestamp" } +sp-finality-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-grandpa" } +sp-trie = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/trie" } +sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/transaction-pool" } trie-db = { version = "0.20.1", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.8.0-dev", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } +sc-service = { version = "0.8.0-rc1", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } # 3rd party cfg-if = "0.1.10" @@ -49,10 +49,10 @@ log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.8.0-dev", path = "../../client/block-builder" } -sc-executor = { version = "0.8.0-dev", path = "../../client/executor" } -substrate-test-runtime-client = { version = "2.0.0-dev", path = "./client" } -sp-state-machine = { version = "0.8.0-dev", path = "../../primitives/state-machine" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../client/block-builder" } +sc-executor = { version = "0.8.0-rc1", path = "../../client/executor" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "./client" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../utils/wasm-builder-runner" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 32091a8e00..388a5e159b 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-client" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,16 +12,16 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" } -substrate-test-client = { version = "2.0.0-dev", path = "../../client" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -substrate-test-runtime = { version = "2.0.0-dev", path = "../../runtime" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } +substrate-test-client = { version = "2.0.0-rc1", path = "../../client" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +substrate-test-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" } -sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } +sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } futures = "0.3.4" diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index 3184527308..a240984883 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../client" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../client" } parking_lot = "0.10.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/transaction-pool" } -sc-transaction-graph = { version = "2.0.0-dev", path = "../../../client/transaction-pool/graph" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +sc-transaction-graph = { version = "2.0.0-rc1", path = "../../../client/transaction-pool/graph" } futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.99.2" diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index ca69206ce3..6b15cf4346 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-browser-utils" -version = "0.8.0-dev" +version = "0.8.0-rc1" authors = ["Parity Technologies "] description = "Utilities for creating a browser light-client." edition = "2018" @@ -22,11 +22,11 @@ js-sys = "0.3.34" wasm-bindgen = "0.2.57" wasm-bindgen-futures = "0.4.7" kvdb-web = "0.6" -sp-database = { version = "2.0.0-dev", path = "../../primitives/database" } -sc-informant = { version = "0.8.0-dev", path = "../../client/informant" } -sc-service = { version = "0.8.0-dev", path = "../../client/service", default-features = false } -sc-network = { path = "../../client/network", version = "0.8.0-dev"} -sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-dev"} +sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } +sc-informant = { version = "0.8.0-rc1", path = "../../client/informant" } +sc-service = { version = "0.8.0-rc1", path = "../../client/service", default-features = false } +sc-network = { path = "../../client/network", version = "0.8.0-rc1"} +sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc1"} # Imported just for the `no_cc` feature clear_on_drop = { version = "0.2.3", features = ["no_cc"] } diff --git a/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml index 72374a531c..02a5e13c88 100644 --- a/utils/build-script-utils/Cargo.toml +++ b/utils/build-script-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-build-script-utils" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index 7062a61ae5..357016cd2a 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-tree" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index fc681bd044..7a0be9ec55 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking-cli" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,15 +12,15 @@ description = "CLI for benchmarking FRAME" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-benchmarking = { version = "2.0.0-dev", path = "../../../frame/benchmarking" } -sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" } -sc-service = { version = "0.8.0-dev", default-features = false, path = "../../../client/service" } -sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" } -sc-client-db = { version = "0.8.0-dev", path = "../../../client/db" } -sc-executor = { version = "0.8.0-dev", path = "../../../client/executor" } -sp-externalities = { version = "0.8.0-dev", path = "../../../primitives/externalities" } -sp-runtime = { version = "2.0.0-dev", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-dev", path = "../../../primitives/state-machine" } +frame-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/benchmarking" } +sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } +sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } +sc-client-db = { version = "0.8.0-rc1", path = "../../../client/db" } +sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } +sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } structopt = "0.3.8" codec = { version = "1.3.0", package = "parity-scale-codec" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index b086f6aa5f..14cf65742e 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-support" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies ", "Andrew Dirksen "] edition = "2018" license = "Apache-2.0" @@ -17,10 +17,10 @@ jsonrpc-client-transports = { version = "14.0.5", default-features = false, feat jsonrpc-core = "14" codec = { package = "parity-scale-codec", version = "1" } serde = "1" -frame-support = { version = "2.0.0-dev", path = "../../../../frame/support" } -sp-storage = { version = "2.0.0-dev", path = "../../../../primitives/storage" } -sc-rpc-api = { version = "0.8.0-dev", path = "../../../../client/rpc-api" } +frame-support = { version = "2.0.0-rc1", path = "../../../../frame/support" } +sp-storage = { version = "2.0.0-rc1", path = "../../../../primitives/storage" } +sc-rpc-api = { version = "0.8.0-rc1", path = "../../../../client/rpc-api" } [dev-dependencies] -frame-system = { version = "2.0.0-dev", path = "../../../../frame/system" } +frame-system = { version = "2.0.0-rc1", path = "../../../../frame/system" } tokio = "0.2" diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 33fd3b399a..ed00809a3b 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-system" -version = "2.0.0-dev" +version = "2.0.0-rc1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "FRAME's system exposed over Substrate RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-dev", path = "../../../../client/api" } +sc-client-api = { version = "2.0.0-rc1", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.0.3" @@ -20,14 +20,14 @@ jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-dev", path = "../../../../primitives/runtime" } -sp-api = { version = "2.0.0-dev", path = "../../../../primitives/api" } -frame-system-rpc-runtime-api = { version = "2.0.0-dev", path = "../../../../frame/system/rpc/runtime-api" } -sp-core = { version = "2.0.0-dev", path = "../../../../primitives/core" } -sp-blockchain = { version = "2.0.0-dev", path = "../../../../primitives/blockchain" } -sp-transaction-pool = { version = "2.0.0-dev", path = "../../../../primitives/transaction-pool" } +sp-runtime = { version = "2.0.0-rc1", path = "../../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc1", path = "../../../../primitives/api" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc1", path = "../../../../frame/system/rpc/runtime-api" } +sp-core = { version = "2.0.0-rc1", path = "../../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc1", path = "../../../../primitives/blockchain" } +sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../../primitives/transaction-pool" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../../test-utils/runtime/client" } env_logger = "0.7.0" -sc-transaction-pool = { version = "2.0.0-dev", path = "../../../../client/transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../../client/transaction-pool" } diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index 9ecf5325cd..697e186db6 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Endpoint to expose Prometheus metrics" name = "substrate-prometheus-endpoint" -version = "0.8.0-dev" +version = "0.8.0-rc1" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" -- GitLab From 597622e2c0203d1327de34d2803a00429e7ed355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 25 May 2020 18:37:53 +0200 Subject: [PATCH 057/280] Make sure fixed arithmetic tests don't rely on debug assertions (#6126) --- primitives/arithmetic/src/fixed.rs | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/primitives/arithmetic/src/fixed.rs b/primitives/arithmetic/src/fixed.rs index 19f498593d..5c87891432 100644 --- a/primitives/arithmetic/src/fixed.rs +++ b/primitives/arithmetic/src/fixed.rs @@ -659,13 +659,6 @@ macro_rules! implement_fixed { assert_eq!(to_bound::<_, _, u32>(a, b), 0); } - #[test] - #[should_panic(expected = "attempt to negate with overflow")] - fn op_neg_panics() { - let a = $name::min_value(); - let _ = -a; - } - #[test] fn op_neg_works() { let a = $name::saturating_from_integer(5); @@ -700,11 +693,10 @@ macro_rules! implement_fixed { } #[test] - #[should_panic(expected = "attempt to add with overflow")] - fn op_add_panics() { + fn op_checked_add_overflow_works() { let a = $name::max_value(); let b = 1.into(); - let _ = a + b; + assert!(a.checked_add(&b).is_none()); } #[test] @@ -722,11 +714,10 @@ macro_rules! implement_fixed { } #[test] - #[should_panic(expected = "attempt to subtract with overflow")] - fn op_sub_panics() { + fn op_checked_sub_underflow_works() { let a = $name::min_value(); let b = 1.into(); - let _c = a - b; + assert!(a.checked_sub(&b).is_none()); } #[test] @@ -744,11 +735,10 @@ macro_rules! implement_fixed { } #[test] - #[should_panic(expected = "attempt to multiply with overflow")] - fn op_mul_panics() { + fn op_checked_mul_overflow_works() { let a = $name::max_value(); let b = 2.into(); - let _c = a * b; + assert!(a.checked_mul(&b).is_none()); } #[test] @@ -771,11 +761,10 @@ macro_rules! implement_fixed { } #[test] - #[should_panic(expected = "attempt to divide with overflow")] - fn op_div_panics_on_overflow() { + fn op_checked_div_overflow_works() { let a = $name::min_value(); let b = (-1).into(); - let _c = a / b; + assert!(a.checked_div(&b).is_none()); } #[test] -- GitLab From 3dedc031d6d6e6316f2e39b81bf0ddb5f282d7fd Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 25 May 2020 21:09:39 +0200 Subject: [PATCH 058/280] Add Changelog for rc1 (#6128) --- docs/CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 84c469386a..76fb1ac579 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,22 @@ The format is based on [Keep a Changelog]. ## Unreleased + +## 2.0.0-alpha.8 -> 2.0.0-rc1 + +Runtime +------- + +* Allow operational recovery path if on_initialize use fullblock. (#6089) +* Maximum extrinsic weight limit (#6067) + +Client +------ + +* Add JSON format to import blocks and set it as default (#5816) +* Upgrade to libp2p v0.19 - Changes the default PeerId representation (#6064) + + ## 2.0.0-alpha.7 -> 2.0.0-alpha.8 **License Changed** -- GitLab From ffcce8538f08ad64656ac5eb8da783dce1a79eae Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 26 May 2020 06:34:25 +0200 Subject: [PATCH 059/280] Filter calls in utility (#6131) * Filter calls. * Remove old proxy code * Docs and repot * Update frame/utility/src/tests.rs Co-authored-by: Marcio Diaz * fix test * Grumble * Bump runtime version * fix * Attempt general fix Co-authored-by: Marcio Diaz Co-authored-by: NikVolf --- bin/node/cli/tests/build_spec_works.rs | 2 +- bin/node/cli/tests/check_block_works.rs | 2 +- bin/node/cli/tests/common.rs | 2 +- bin/node/cli/tests/export_import_flow.rs | 8 ++-- bin/node/cli/tests/inspect_works.rs | 2 +- bin/node/cli/tests/purge_chain_works.rs | 2 +- .../tests/running_the_node_and_interrupt.rs | 2 +- bin/node/runtime/src/lib.rs | 5 ++- frame/support/src/traits.rs | 10 +++++ frame/utility/src/lib.rs | 29 +++++++++--- frame/utility/src/tests.rs | 45 +++++++++++++++++++ 11 files changed, 92 insertions(+), 17 deletions(-) diff --git a/bin/node/cli/tests/build_spec_works.rs b/bin/node/cli/tests/build_spec_works.rs index d4f6de3b87..800a4a8c51 100644 --- a/bin/node/cli/tests/build_spec_works.rs +++ b/bin/node/cli/tests/build_spec_works.rs @@ -25,7 +25,7 @@ fn build_spec_works() { let base_path = tempdir().expect("could not create a temp dir"); let output = Command::new(cargo_bin("substrate")) - .args(&["build-spec", "--rc1", "-d"]) + .args(&["build-spec", "--dev", "-d"]) .arg(base_path.path()) .output() .unwrap(); diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs index 744effeef1..34078b08cf 100644 --- a/bin/node/cli/tests/check_block_works.rs +++ b/bin/node/cli/tests/check_block_works.rs @@ -31,7 +31,7 @@ fn check_block_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["check-block", "--rc1", "--pruning", "archive", "-d"]) + .args(&["check-block", "--dev", "--pruning", "archive", "-d"]) .arg(base_path.path()) .arg("1") .status() diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 6f2714988f..61a07dd1ca 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -51,7 +51,7 @@ pub fn run_dev_node_for_a_while(base_path: &Path) { let mut cmd = Command::new(cargo_bin("substrate")); let mut cmd = cmd - .args(&["--rc1"]) + .args(&["--dev"]) .arg("-d") .arg(base_path) .spawn() diff --git a/bin/node/cli/tests/export_import_flow.rs b/bin/node/cli/tests/export_import_flow.rs index a37dc6e88a..557e722ddb 100644 --- a/bin/node/cli/tests/export_import_flow.rs +++ b/bin/node/cli/tests/export_import_flow.rs @@ -82,8 +82,8 @@ impl<'a> ExportImportRevertExecutor<'a> { let sub_command_str = sub_command.to_string(); // Adding "--binary" if need be. let arguments: Vec<&str> = match format_opt { - FormatOpt::Binary => vec![&sub_command_str, "--rc1", "--pruning", "archive", "--binary", "-d"], - FormatOpt::Json => vec![&sub_command_str, "--rc1", "--pruning", "archive", "-d"], + FormatOpt::Binary => vec![&sub_command_str, "--dev", "--pruning", "archive", "--binary", "-d"], + FormatOpt::Json => vec![&sub_command_str, "--dev", "--pruning", "archive", "-d"], }; let tmp: TempDir; @@ -136,7 +136,7 @@ impl<'a> ExportImportRevertExecutor<'a> { let _ = fs::remove_dir_all(&self.db_path); } - /// Runs the `import-blocks` command, asserting that an error was found or + /// Runs the `import-blocks` command, asserting that an error was found or /// not depending on `expected_to_fail`. fn run_import(&mut self, fmt_opt: FormatOpt, expected_to_fail: bool) { let log = self.run_block_command(SubCommand::ImportBlocks, fmt_opt, expected_to_fail); @@ -166,7 +166,7 @@ impl<'a> ExportImportRevertExecutor<'a> { /// Runs the `revert` command. fn run_revert(&self) { let output = Command::new(cargo_bin("substrate")) - .args(&["revert", "--rc1", "--pruning", "archive", "-d"]) + .args(&["revert", "--dev", "--pruning", "archive", "-d"]) .arg(&self.base_path.path()) .output() .unwrap(); diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs index fd23bb6399..aa9653acad 100644 --- a/bin/node/cli/tests/inspect_works.rs +++ b/bin/node/cli/tests/inspect_works.rs @@ -31,7 +31,7 @@ fn inspect_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["inspect", "--rc1", "--pruning", "archive", "-d"]) + .args(&["inspect", "--dev", "--pruning", "archive", "-d"]) .arg(base_path.path()) .args(&["block", "1"]) .status() diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs index 67a4649a6f..001bed8b13 100644 --- a/bin/node/cli/tests/purge_chain_works.rs +++ b/bin/node/cli/tests/purge_chain_works.rs @@ -30,7 +30,7 @@ fn purge_chain_works() { common::run_dev_node_for_a_while(base_path.path()); let status = Command::new(cargo_bin("substrate")) - .args(&["purge-chain", "--rc1", "-d"]) + .args(&["purge-chain", "--dev", "-d"]) .arg(base_path.path()) .arg("-y") .status() diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index efd9f14762..bd79dcd77a 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -31,7 +31,7 @@ fn running_the_node_works_and_can_be_interrupted() { fn run_command_and_kill(signal: Signal) { let base_path = tempdir().expect("could not create a temp dir"); let mut cmd = Command::new(cargo_bin("substrate")) - .args(&["--rc1", "-d"]) + .args(&["--dev", "-d"]) .arg(base_path.path()) .spawn() .unwrap(); diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 6a02ad66cd..67e988f496 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -93,8 +93,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 250, - impl_version: 2, + spec_version: 251, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; @@ -179,6 +179,7 @@ impl pallet_utility::Trait for Runtime { type MultisigDepositBase = MultisigDepositBase; type MultisigDepositFactor = MultisigDepositFactor; type MaxSignatories = MaxSignatories; + type IsCallable = (); } parameter_types! { diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 99a5abcbac..0b48ac7f41 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -33,6 +33,16 @@ use crate::storage::StorageMap; use crate::weights::Weight; use impl_trait_for_tuples::impl_for_tuples; +/// Simple trait for providing a filter over a reference to some type. +pub trait Filter { + /// Determine if a given value should be allowed through the filter (returns `true`) or not. + fn filter(_: &T) -> bool; +} + +impl Filter for () { + fn filter(_: &T) -> bool { true } +} + /// An abstraction of a value stored within storage, but possibly as part of a larger composite /// item. pub trait StoredMap { diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index 6692848609..546af51bdd 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -67,11 +67,11 @@ use codec::{Encode, Decode}; use sp_core::TypeId; use sp_io::hashing::blake2_256; use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, RuntimeDebug}; -use frame_support::{traits::{Get, ReservableCurrency, Currency}, +use frame_support::{traits::{Get, ReservableCurrency, Currency, Filter}, weights::{Weight, GetDispatchInfo, DispatchClass, FunctionOf, Pays}, dispatch::{DispatchResultWithPostInfo, DispatchErrorWithPostInfo, PostDispatchInfo}, }; -use frame_system::{self as system, ensure_signed}; +use frame_system::{self as system, ensure_signed, ensure_root}; use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; mod tests; @@ -85,7 +85,8 @@ pub trait Trait: frame_system::Trait { type Event: From> + Into<::Event>; /// The overarching call type. - type Call: Parameter + Dispatchable + GetDispatchInfo + From>; + type Call: Parameter + Dispatchable + + GetDispatchInfo + From>; /// The currency mechanism. type Currency: ReservableCurrency; @@ -103,6 +104,9 @@ pub trait Trait: frame_system::Trait { /// The maximum amount of signatories allowed in the multisig. type MaxSignatories: Get; + + /// Is a given call compatible with the proxying subsystem? + type IsCallable: Filter<::Call>; } /// A global extrinsic index, formed as the extrinsic index within a block, together with that @@ -164,6 +168,8 @@ decl_error! { WrongTimepoint, /// A timepoint was given, yet no multisig operation is underway. UnexpectedTimepoint, + /// A call with a `false` IsCallable filter was attempted. + Uncallable, } } @@ -191,6 +197,8 @@ decl_event! { /// A multisig operation has been cancelled. First param is the account that is /// cancelling, third is the multisig account, fourth is hash of the call. MultisigCancelled(AccountId, Timepoint, AccountId, CallHash), + /// A call with a `false` IsCallable filter was attempted. + Uncallable(u32), } } @@ -230,7 +238,8 @@ decl_module! { /// Send a batch of dispatch calls. /// - /// This will execute until the first one fails and then stop. + /// This will execute until the first one fails and then stop. Calls must fulfil the + /// `IsCallable` filter unless the origin is `Root`. /// /// May be called from any origin. /// @@ -266,7 +275,12 @@ decl_module! { Pays::Yes, )] fn batch(origin, calls: Vec<::Call>) { + let is_root = ensure_root(origin.clone()).is_ok(); for (index, call) in calls.into_iter().enumerate() { + if !is_root && !T::IsCallable::filter(&call) { + Self::deposit_event(Event::::Uncallable(index as u32)); + return Ok(()) + } let result = call.dispatch(origin.clone()); if let Err(e) = result { Self::deposit_event(Event::::BatchInterrupted(index as u32, e.error)); @@ -278,6 +292,8 @@ decl_module! { /// Send a call through an indexed pseudonym of the sender. /// + /// Calls must each fulfil the `IsCallable` filter. + /// /// The dispatch origin for this call must be _Signed_. /// /// # @@ -293,6 +309,7 @@ decl_module! { )] fn as_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; + ensure!(T::IsCallable::filter(&call), Error::::Uncallable); let pseudonym = Self::sub_account_id(who, index); call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) .map(|_| ()).map_err(|e| e.error) @@ -301,7 +318,8 @@ decl_module! { /// Register approval for a dispatch to be made from a deterministic composite account if /// approved by a total of `threshold - 1` of `other_signatories`. /// - /// If there are enough, then dispatch the call. + /// If there are enough, then dispatch the call. Calls must each fulfil the `IsCallable` + /// filter. /// /// Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus /// `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or @@ -364,6 +382,7 @@ decl_module! { call: Box<::Call>, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; + ensure!(T::IsCallable::filter(call.as_ref()), Error::::Uncallable); ensure!(threshold >= 1, Error::::ZeroThreshold); let max_sigs = T::MaxSignatories::get() as usize; ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index da4d41e3b7..daf3d6c53a 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -99,6 +99,16 @@ parameter_types! { pub const MultisigDepositFactor: u64 = 1; pub const MaxSignatories: u16 = 3; } + +pub struct TestIsCallable; +impl Filter for TestIsCallable { + fn filter(c: &Call) -> bool { + match *c { + Call::Balances(pallet_balances::Call::transfer(..)) => true, + _ => false, + } + } +} impl Trait for Test { type Event = TestEvent; type Call = Call; @@ -106,6 +116,7 @@ impl Trait for Test { type MultisigDepositBase = MultisigDepositBase; type MultisigDepositFactor = MultisigDepositFactor; type MaxSignatories = MaxSignatories; + type IsCallable = TestIsCallable; } type System = frame_system::Module; type Balances = pallet_balances::Module; @@ -379,6 +390,17 @@ fn multisig_1_of_3_works() { }); } +#[test] +fn multisig_filters() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::System(frame_system::Call::remark(vec![]))); + assert_noop!( + Utility::as_multi(Origin::signed(1), 1, vec![], None, call.clone()), + Error::::Uncallable, + ); + }); +} + #[test] fn as_sub_works() { new_test_ext().execute_with(|| { @@ -399,6 +421,17 @@ fn as_sub_works() { }); } +#[test] +fn as_sub_filters() { + new_test_ext().execute_with(|| { + assert_noop!(Utility::as_sub( + Origin::signed(1), + 1, + Box::new(Call::System(frame_system::Call::remark(vec![]))), + ), Error::::Uncallable); + }); +} + #[test] fn batch_with_root_works() { new_test_ext().execute_with(|| { @@ -429,6 +462,18 @@ fn batch_with_signed_works() { }); } +#[test] +fn batch_with_signed_filters() { + new_test_ext().execute_with(|| { + assert_ok!( + Utility::batch(Origin::signed(1), vec![ + Call::System(frame_system::Call::remark(vec![])) + ]), + ); + expect_event(RawEvent::Uncallable(0)); + }); +} + #[test] fn batch_early_exit_works() { new_test_ext().execute_with(|| { -- GitLab From 45b9f0a9cbf901abaa9f1fca5fe8baeed029133d Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 26 May 2020 14:32:23 +0200 Subject: [PATCH 060/280] Releasing rc2 (#6136) --- Cargo.lock | 356 +++++++++--------- bin/node-template/node/Cargo.toml | 40 +- bin/node-template/pallets/template/Cargo.toml | 12 +- bin/node-template/runtime/Cargo.toml | 48 +-- bin/node/bench/Cargo.toml | 20 +- bin/node/browser-testing/Cargo.toml | 6 +- bin/node/cli/Cargo.toml | 118 +++--- bin/node/executor/Cargo.toml | 50 +-- bin/node/inspect/Cargo.toml | 14 +- bin/node/primitives/Cargo.toml | 12 +- bin/node/rpc-client/Cargo.toml | 6 +- bin/node/rpc/Cargo.toml | 40 +- bin/node/runtime/Cargo.toml | 112 +++--- bin/node/testing/Cargo.toml | 68 ++-- bin/utils/chain-spec-builder/Cargo.toml | 10 +- bin/utils/subkey/Cargo.toml | 20 +- client/api/Cargo.toml | 44 +-- client/authority-discovery/Cargo.toml | 24 +- client/basic-authorship/Cargo.toml | 30 +- client/block-builder/Cargo.toml | 20 +- client/chain-spec/Cargo.toml | 14 +- client/chain-spec/derive/Cargo.toml | 2 +- client/cli/Cargo.toml | 32 +- client/consensus/aura/Cargo.toml | 50 +-- client/consensus/babe/Cargo.toml | 58 +-- client/consensus/babe/rpc/Cargo.toml | 30 +- client/consensus/common/Cargo.toml | 10 +- client/consensus/epochs/Cargo.toml | 10 +- client/consensus/manual-seal/Cargo.toml | 26 +- client/consensus/pow/Cargo.toml | 24 +- client/consensus/slots/Cargo.toml | 24 +- client/consensus/uncles/Cargo.toml | 14 +- client/db/Cargo.toml | 28 +- client/executor/Cargo.toml | 36 +- client/executor/common/Cargo.toml | 12 +- client/executor/runtime-test/Cargo.toml | 14 +- client/executor/wasmi/Cargo.toml | 12 +- client/executor/wasmtime/Cargo.toml | 12 +- client/finality-grandpa/Cargo.toml | 54 +-- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/informant/Cargo.toml | 12 +- client/keystore/Cargo.toml | 6 +- client/network-gossip/Cargo.toml | 8 +- client/network/Cargo.toml | 32 +- client/network/test/Cargo.toml | 26 +- client/offchain/Cargo.toml | 26 +- client/peerset/Cargo.toml | 4 +- client/proposer-metrics/Cargo.toml | 4 +- client/rpc-api/Cargo.toml | 14 +- client/rpc-servers/Cargo.toml | 4 +- client/rpc/Cargo.toml | 44 +-- client/service/Cargo.toml | 68 ++-- client/service/test/Cargo.toml | 40 +- client/state-db/Cargo.toml | 6 +- client/telemetry/Cargo.toml | 2 +- client/tracing/Cargo.toml | 4 +- client/transaction-pool/Cargo.toml | 28 +- client/transaction-pool/graph/Cargo.toml | 14 +- docs/CHANGELOG.md | 3 + frame/assets/Cargo.toml | 14 +- frame/aura/Cargo.toml | 26 +- frame/authority-discovery/Cargo.toml | 22 +- frame/authorship/Cargo.toml | 18 +- frame/babe/Cargo.toml | 30 +- frame/balances/Cargo.toml | 18 +- frame/benchmark/Cargo.toml | 14 +- frame/benchmarking/Cargo.toml | 16 +- frame/collective/Cargo.toml | 18 +- frame/contracts/Cargo.toml | 26 +- frame/contracts/common/Cargo.toml | 6 +- frame/contracts/rpc/Cargo.toml | 16 +- frame/contracts/rpc/runtime-api/Cargo.toml | 10 +- frame/democracy/Cargo.toml | 24 +- frame/elections-phragmen/Cargo.toml | 22 +- frame/elections/Cargo.toml | 16 +- frame/evm/Cargo.toml | 18 +- frame/example-offchain-worker/Cargo.toml | 14 +- frame/example/Cargo.toml | 18 +- frame/executive/Cargo.toml | 26 +- frame/finality-tracker/Cargo.toml | 18 +- frame/generic-asset/Cargo.toml | 14 +- frame/grandpa/Cargo.toml | 38 +- frame/identity/Cargo.toml | 18 +- frame/im-online/Cargo.toml | 24 +- frame/indices/Cargo.toml | 18 +- frame/membership/Cargo.toml | 14 +- frame/metadata/Cargo.toml | 6 +- frame/nicks/Cargo.toml | 16 +- frame/offences/Cargo.toml | 18 +- frame/offences/benchmarking/Cargo.toml | 36 +- frame/randomness-collective-flip/Cargo.toml | 14 +- frame/recovery/Cargo.toml | 16 +- frame/scheduler/Cargo.toml | 16 +- frame/scored-pool/Cargo.toml | 16 +- frame/session/Cargo.toml | 24 +- frame/session/benchmarking/Cargo.toml | 26 +- frame/society/Cargo.toml | 16 +- frame/staking/Cargo.toml | 38 +- frame/staking/fuzzer/Cargo.lock | 2 +- frame/staking/fuzzer/Cargo.toml | 26 +- frame/staking/reward-curve/Cargo.toml | 4 +- frame/sudo/Cargo.toml | 14 +- frame/support/Cargo.toml | 24 +- frame/support/procedural/Cargo.toml | 4 +- frame/support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 14 +- frame/system/Cargo.toml | 18 +- frame/system/benchmarking/Cargo.toml | 16 +- frame/system/rpc/runtime-api/Cargo.toml | 4 +- frame/timestamp/Cargo.toml | 22 +- frame/transaction-payment/Cargo.toml | 20 +- frame/transaction-payment/rpc/Cargo.toml | 14 +- .../rpc/runtime-api/Cargo.toml | 10 +- frame/treasury/Cargo.toml | 18 +- frame/utility/Cargo.toml | 20 +- frame/vesting/Cargo.toml | 20 +- primitives/allocator/Cargo.toml | 8 +- primitives/api/Cargo.toml | 16 +- primitives/api/proc-macro/Cargo.toml | 2 +- primitives/api/test/Cargo.toml | 22 +- primitives/application-crypto/Cargo.toml | 8 +- primitives/application-crypto/test/Cargo.toml | 12 +- primitives/arithmetic/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- primitives/authority-discovery/Cargo.toml | 10 +- primitives/authorship/Cargo.toml | 8 +- primitives/block-builder/Cargo.toml | 10 +- primitives/blockchain/Cargo.toml | 10 +- primitives/chain-spec/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 14 +- primitives/consensus/babe/Cargo.toml | 18 +- primitives/consensus/common/Cargo.toml | 20 +- primitives/consensus/pow/Cargo.toml | 10 +- primitives/consensus/vrf/Cargo.toml | 8 +- primitives/core/Cargo.toml | 14 +- primitives/database/Cargo.toml | 2 +- primitives/debug-derive/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 6 +- primitives/finality-grandpa/Cargo.toml | 12 +- primitives/finality-tracker/Cargo.toml | 6 +- primitives/inherents/Cargo.toml | 6 +- primitives/io/Cargo.toml | 16 +- primitives/keyring/Cargo.toml | 6 +- primitives/offchain/Cargo.toml | 10 +- primitives/panic-handler/Cargo.toml | 2 +- primitives/phragmen/Cargo.toml | 14 +- primitives/phragmen/compact/Cargo.toml | 2 +- primitives/phragmen/fuzzer/Cargo.lock | 2 +- primitives/phragmen/fuzzer/Cargo.toml | 6 +- primitives/rpc/Cargo.toml | 4 +- primitives/runtime-interface/Cargo.toml | 20 +- .../runtime-interface/proc-macro/Cargo.toml | 2 +- .../test-wasm-deprecated/Cargo.toml | 10 +- .../runtime-interface/test-wasm/Cargo.toml | 10 +- primitives/runtime-interface/test/Cargo.toml | 18 +- primitives/runtime/Cargo.toml | 16 +- primitives/sandbox/Cargo.toml | 10 +- primitives/serializer/Cargo.toml | 2 +- primitives/session/Cargo.toml | 12 +- primitives/staking/Cargo.toml | 6 +- primitives/state-machine/Cargo.toml | 12 +- primitives/std/Cargo.toml | 2 +- primitives/storage/Cargo.toml | 6 +- primitives/test-primitives/Cargo.toml | 8 +- primitives/timestamp/Cargo.toml | 10 +- primitives/tracing/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 8 +- primitives/trie/Cargo.toml | 8 +- primitives/utils/Cargo.toml | 2 +- primitives/version/Cargo.toml | 6 +- primitives/wasm-interface/Cargo.toml | 4 +- test-utils/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 24 +- test-utils/runtime/Cargo.toml | 60 +-- test-utils/runtime/client/Cargo.toml | 24 +- .../runtime/transaction-pool/Cargo.toml | 12 +- utils/browser/Cargo.toml | 12 +- utils/build-script-utils/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 20 +- utils/frame/rpc/support/Cargo.toml | 10 +- utils/frame/rpc/system/Cargo.toml | 20 +- utils/prometheus/Cargo.toml | 2 +- 184 files changed, 1771 insertions(+), 1768 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7decfec32..f3c9672e37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,7 +574,7 @@ dependencies = [ [[package]] name = "chain-spec-builder" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "ansi_term 0.12.1", "node-cli", @@ -1393,14 +1393,14 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1433,7 +1433,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-rc1" +version = "11.0.0-rc2" dependencies = [ "parity-scale-codec", "serde", @@ -1463,7 +1463,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "bitmask", "frame-metadata", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1499,7 +1499,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro2", "quote 1.0.3", @@ -1519,7 +1519,7 @@ dependencies = [ [[package]] name = "frame-support-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "parity-scale-codec", @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.2.11", "frame-support", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -1569,7 +1569,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -3358,7 +3358,7 @@ dependencies = [ [[package]] name = "node-bench" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "fs_extra", @@ -3388,7 +3388,7 @@ dependencies = [ [[package]] name = "node-browser-testing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -3405,7 +3405,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "assert_cmd", "frame-benchmarking-cli", @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "node-executor" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.3.1", "frame-benchmarking", @@ -3513,7 +3513,7 @@ dependencies = [ [[package]] name = "node-inspect" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "log", @@ -3529,7 +3529,7 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-system", "parity-scale-codec", @@ -3542,7 +3542,7 @@ dependencies = [ [[package]] name = "node-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "jsonrpc-core", "node-primitives", @@ -3568,7 +3568,7 @@ dependencies = [ [[package]] name = "node-rpc-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "env_logger 0.7.1", "futures 0.1.29", @@ -3581,7 +3581,7 @@ dependencies = [ [[package]] name = "node-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-executive", @@ -3647,7 +3647,7 @@ dependencies = [ [[package]] name = "node-template" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "log", @@ -3676,7 +3676,7 @@ dependencies = [ [[package]] name = "node-template-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-executive", "frame-support", @@ -3708,7 +3708,7 @@ dependencies = [ [[package]] name = "node-testing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.3.1", "frame-support", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -3925,7 +3925,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -3947,7 +3947,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -3965,7 +3965,7 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -3981,7 +3981,7 @@ dependencies = [ [[package]] name = "pallet-babe" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4019,7 +4019,7 @@ dependencies = [ [[package]] name = "pallet-benchmark" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4033,7 +4033,7 @@ dependencies = [ [[package]] name = "pallet-collective" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4050,7 +4050,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "assert_matches", "frame-support", @@ -4076,7 +4076,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -4085,7 +4085,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4104,7 +4104,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4115,7 +4115,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4135,7 +4135,7 @@ dependencies = [ [[package]] name = "pallet-elections" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4151,7 +4151,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "pallet-evm" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "evm", "frame-support", @@ -4190,7 +4190,7 @@ dependencies = [ [[package]] name = "pallet-example" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4206,7 +4206,7 @@ dependencies = [ [[package]] name = "pallet-example-offchain-worker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4221,7 +4221,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4238,7 +4238,7 @@ dependencies = [ [[package]] name = "pallet-generic-asset" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4252,7 +4252,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "finality-grandpa", "frame-support", @@ -4279,7 +4279,7 @@ dependencies = [ [[package]] name = "pallet-identity" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4315,7 +4315,7 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4331,7 +4331,7 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4345,7 +4345,7 @@ dependencies = [ [[package]] name = "pallet-nicks" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4360,7 +4360,7 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4376,7 +4376,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4401,7 +4401,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4415,7 +4415,7 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "enumflags2", "frame-support", @@ -4431,7 +4431,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4446,7 +4446,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4461,7 +4461,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4482,7 +4482,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4502,7 +4502,7 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4518,7 +4518,7 @@ dependencies = [ [[package]] name = "pallet-staking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4569,7 +4569,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4580,7 +4580,7 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4594,7 +4594,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4624,7 +4624,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -4641,7 +4641,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4658,7 +4658,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "parity-scale-codec", @@ -4671,7 +4671,7 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4687,7 +4687,7 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4703,7 +4703,7 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5827,7 +5827,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "bytes 0.5.4", "derive_more", @@ -5857,7 +5857,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -5883,7 +5883,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5900,7 +5900,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5915,7 +5915,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5925,7 +5925,7 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5966,7 +5966,7 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "fnv", @@ -6004,7 +6004,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "blake2-rfc", "env_logger 0.7.1", @@ -6037,7 +6037,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6047,7 +6047,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6085,7 +6085,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6135,7 +6135,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -6163,7 +6163,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6175,7 +6175,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "derive_more", @@ -6205,7 +6205,7 @@ dependencies = [ [[package]] name = "sc-consensus-pow" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -6226,7 +6226,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -6248,7 +6248,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "log", "sc-client-api", @@ -6261,7 +6261,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "derive_more", @@ -6296,7 +6296,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "log", @@ -6312,7 +6312,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "log", "parity-scale-codec", @@ -6326,7 +6326,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "cranelift-codegen", @@ -6347,7 +6347,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "derive_more", @@ -6391,7 +6391,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "finality-grandpa", @@ -6408,7 +6408,7 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "ansi_term 0.12.1", "futures 0.3.4", @@ -6424,7 +6424,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "hex", @@ -6439,7 +6439,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "async-std", @@ -6499,7 +6499,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "async-std", "futures 0.3.4", @@ -6517,7 +6517,7 @@ dependencies = [ [[package]] name = "sc-network-test" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "env_logger 0.7.1", "futures 0.3.4", @@ -6543,7 +6543,7 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", @@ -6576,7 +6576,7 @@ dependencies = [ [[package]] name = "sc-peerset" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "libp2p", @@ -6589,7 +6589,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6597,7 +6597,7 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "assert_matches", "futures 0.1.29", @@ -6636,7 +6636,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -6659,7 +6659,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6673,7 +6673,7 @@ dependencies = [ [[package]] name = "sc-runtime-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sp-allocator", "sp-core", @@ -6686,7 +6686,7 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "exit-future", @@ -6747,7 +6747,7 @@ dependencies = [ [[package]] name = "sc-service-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "env_logger 0.7.1", "fdlimit", @@ -6782,7 +6782,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "env_logger 0.7.1", "log", @@ -6796,7 +6796,7 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -6817,7 +6817,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "erased-serde", "log", @@ -6832,7 +6832,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "assert_matches", "criterion 0.3.1", @@ -6855,7 +6855,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "assert_matches", "derive_more", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "sp-allocator" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "log", @@ -7237,7 +7237,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "hash-db", "parity-scale-codec", @@ -7252,7 +7252,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7263,7 +7263,7 @@ dependencies = [ [[package]] name = "sp-api-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.3.1", "parity-scale-codec", @@ -7282,7 +7282,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "serde", @@ -7293,7 +7293,7 @@ dependencies = [ [[package]] name = "sp-application-crypto-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sp-api", "sp-application-crypto", @@ -7304,7 +7304,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.3.1", "integer-sqrt", @@ -7320,7 +7320,7 @@ dependencies = [ [[package]] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "honggfuzz", "num-bigint", @@ -7331,7 +7331,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -7342,7 +7342,7 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7352,7 +7352,7 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -7363,7 +7363,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "log", @@ -7378,7 +7378,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "serde", "serde_json", @@ -7386,7 +7386,7 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -7409,7 +7409,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -7422,7 +7422,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "merlin", "parity-scale-codec", @@ -7438,7 +7438,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -7449,7 +7449,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7460,7 +7460,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "base58", "blake2-rfc", @@ -7506,7 +7506,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7514,7 +7514,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro2", "quote 1.0.3", @@ -7523,7 +7523,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "environmental", "parity-scale-codec", @@ -7533,7 +7533,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "finality-grandpa", "log", @@ -7548,7 +7548,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7557,7 +7557,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "parity-scale-codec", @@ -7568,7 +7568,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "hash-db", @@ -7587,7 +7587,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "lazy_static", "sp-core", @@ -7597,7 +7597,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sp-api", "sp-core", @@ -7607,7 +7607,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "backtrace", "log", @@ -7615,7 +7615,7 @@ dependencies = [ [[package]] name = "sp-phragmen" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "rand 0.7.3", @@ -7630,7 +7630,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7651,7 +7651,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "serde", "serde_json", @@ -7660,7 +7660,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -7682,7 +7682,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7702,7 +7702,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "Inflector", "proc-macro-crate", @@ -7713,7 +7713,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sc-executor", "sp-core", @@ -7728,7 +7728,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sp-core", "sp-io", @@ -7739,7 +7739,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "sp-core", "sp-io", @@ -7750,7 +7750,7 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "assert_matches", "parity-scale-codec", @@ -7764,7 +7764,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "serde", "serde_json", @@ -7772,7 +7772,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-api", @@ -7784,7 +7784,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7793,7 +7793,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "hash-db", "hex-literal", @@ -7813,11 +7813,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-rc1" +version = "2.0.0-rc2" [[package]] name = "sp-storage" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7828,7 +7828,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7840,7 +7840,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7853,14 +7853,14 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "tracing", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -7874,7 +7874,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "criterion 0.2.11", "hash-db", @@ -7892,7 +7892,7 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "futures-core", @@ -7902,7 +7902,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7913,7 +7913,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8028,7 +8028,7 @@ dependencies = [ [[package]] name = "subkey" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "clap", "derive_more", @@ -8070,7 +8070,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "chrono", "clear_on_drop", @@ -8096,14 +8096,14 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-support" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "frame-support", "frame-system", @@ -8119,7 +8119,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", @@ -8142,7 +8142,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-rc1" +version = "0.8.0-rc2" dependencies = [ "async-std", "derive_more", @@ -8155,7 +8155,7 @@ dependencies = [ [[package]] name = "substrate-test-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "hash-db", @@ -8175,7 +8175,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "cfg-if", "frame-executive", @@ -8218,7 +8218,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "futures 0.3.4", "parity-scale-codec", @@ -8237,7 +8237,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "derive_more", "futures 0.3.4", @@ -8252,7 +8252,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" [[package]] name = "substrate-wasm-builder" diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 4e8b3ff196..79f63f211a 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -21,25 +21,25 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } -sc-service = { version = "0.8.0-rc1", path = "../../../client/service" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } -sc-network = { version = "0.8.0-rc1", path = "../../../client/network" } -sc-consensus-aura = { version = "0.8.0-rc1", path = "../../../client/consensus/aura" } -sp-consensus-aura = { version = "0.8.0-rc1", path = "../../../primitives/consensus/aura" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } -sc-finality-grandpa = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa" } -sp-finality-grandpa = { version = "2.0.0-rc1", path = "../../../primitives/finality-grandpa" } -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc1"} +sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } +sc-service = { version = "0.8.0-rc2", path = "../../../client/service" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +sc-network = { version = "0.8.0-rc2", path = "../../../client/network" } +sc-consensus-aura = { version = "0.8.0-rc2", path = "../../../client/consensus/aura" } +sp-consensus-aura = { version = "0.8.0-rc2", path = "../../../primitives/consensus/aura" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } +sc-finality-grandpa = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa" } +sp-finality-grandpa = { version = "2.0.0-rc2", path = "../../../primitives/finality-grandpa" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc2"} -node-template-runtime = { version = "2.0.0-rc1", path = "../runtime" } +node-template-runtime = { version = "2.0.0-rc2", path = "../runtime" } [build-dependencies] -substrate-build-script-utils = { version = "2.0.0-rc1", path = "../../../utils/build-script-utils" } +substrate-build-script-utils = { version = "2.0.0-rc2", path = "../../../utils/build-script-utils" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 1bfd6fe5b2..15e7cfd4ba 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Anonymous'] edition = '2018' name = 'pallet-template' -version = "2.0.0-rc1" +version = "2.0.0-rc2" license = "Unlicense" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" @@ -16,26 +16,26 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = [dependencies.frame-support] default-features = false -version = "2.0.0-rc1" +version = "2.0.0-rc2" path = "../../../../frame/support" [dependencies.frame-system] default-features = false -version = "2.0.0-rc1" +version = "2.0.0-rc2" path = "../../../../frame/system" [dev-dependencies.sp-core] default-features = false -version = "2.0.0-rc1" +version = "2.0.0-rc2" path = "../../../../primitives/core" [dev-dependencies.sp-io] default-features = false -version = "2.0.0-rc1" +version = "2.0.0-rc2" path = "../../../../primitives/io" [dev-dependencies.sp-runtime] default-features = false -version = "2.0.0-rc1" +version = "2.0.0-rc2" path = "../../../../primitives/runtime" diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index fcec09ccea..d6ee62cb1a 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,31 +13,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-rc1", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } -balances = { version = "2.0.0-rc1", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } -grandpa = { version = "2.0.0-rc1", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } -randomness-collective-flip = { version = "2.0.0-rc1", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } -sudo = { version = "2.0.0-rc1", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } -system = { version = "2.0.0-rc1", default-features = false, package = "frame-system", path = "../../../frame/system" } -timestamp = { version = "2.0.0-rc1", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } -transaction-payment = { version = "2.0.0-rc1", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } -frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/executive" } +aura = { version = "2.0.0-rc2", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } +balances = { version = "2.0.0-rc2", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } +grandpa = { version = "2.0.0-rc2", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } +randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } +sudo = { version = "2.0.0-rc2", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } +system = { version = "2.0.0-rc2", default-features = false, package = "frame-system", path = "../../../frame/system" } +timestamp = { version = "2.0.0-rc2", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } +transaction-payment = { version = "2.0.0-rc2", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } +frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/executive" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/api" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc1"} -sp-consensus-aura = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/consensus/aura" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } -sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc1"} -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/io" } -sp-offchain = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/session" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/version" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/api" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc2"} +sp-consensus-aura = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/consensus/aura" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc2"} +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/io" } +sp-offchain = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/session" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/version" } -template = { version = "2.0.0-rc1", default-features = false, path = "../pallets/template", package = "pallet-template" } +template = { version = "2.0.0-rc2", default-features = false, path = "../pallets/template", package = "pallet-template" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 53eb5d507a..0cb8e006d0 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-bench" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." edition = "2018" @@ -10,21 +10,21 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] log = "0.4.8" -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -node-testing = { version = "2.0.0-rc1", path = "../testing" } -node-runtime = { version = "2.0.0-rc1", path = "../runtime" } -sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api/" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +node-testing = { version = "2.0.0-rc2", path = "../testing" } +node-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api/" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } serde = "1.0.101" serde_json = "1.0.41" structopt = "0.3" derive_more = "0.99.2" kvdb = "0.6" kvdb-rocksdb = "0.8" -sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 07a74b5671..7628582fbb 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-browser-testing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Tests for the in-browser light client." edition = "2018" @@ -17,5 +17,5 @@ wasm-bindgen-futures = "0.4.10" wasm-bindgen-test = "0.3.10" futures = "0.3.4" -node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc1"} -sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc1"} +node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc2"} +sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc2"} diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 2efb58aeeb..f2b25068ed 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Generic Substrate node implementation in Rust." build = "build.rs" @@ -46,76 +46,76 @@ tracing = "0.1.10" parking_lot = "0.10.0" # primitives -sp-authority-discovery = { version = "2.0.0-rc1", path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } -grandpa-primitives = { version = "2.0.0-rc1", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/timestamp" } -sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/finality-tracker" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +sp-authority-discovery = { version = "2.0.0-rc2", path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } +grandpa-primitives = { version = "2.0.0-rc2", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/timestamp" } +sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/finality-tracker" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } # client dependencies -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } -sc-chain-spec = { version = "2.0.0-rc1", path = "../../../client/chain-spec" } -sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } -sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../client/transaction-pool" } -sc-network = { version = "0.8.0-rc1", path = "../../../client/network" } -sc-consensus-babe = { version = "0.8.0-rc1", path = "../../../client/consensus/babe" } -grandpa = { version = "0.8.0-rc1", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } -sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../../../client/db" } -sc-offchain = { version = "2.0.0-rc1", path = "../../../client/offchain" } -sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } -sc-basic-authorship = { version = "0.8.0-rc1", path = "../../../client/basic-authorship" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } -sc-tracing = { version = "2.0.0-rc1", path = "../../../client/tracing" } -sc-telemetry = { version = "2.0.0-rc1", path = "../../../client/telemetry" } -sc-authority-discovery = { version = "0.8.0-rc1", path = "../../../client/authority-discovery" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } +sc-chain-spec = { version = "2.0.0-rc2", path = "../../../client/chain-spec" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../client/transaction-pool" } +sc-network = { version = "0.8.0-rc2", path = "../../../client/network" } +sc-consensus-babe = { version = "0.8.0-rc2", path = "../../../client/consensus/babe" } +grandpa = { version = "0.8.0-rc2", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } +sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../../../client/db" } +sc-offchain = { version = "2.0.0-rc2", path = "../../../client/offchain" } +sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } +sc-basic-authorship = { version = "0.8.0-rc2", path = "../../../client/basic-authorship" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } +sc-tracing = { version = "2.0.0-rc2", path = "../../../client/tracing" } +sc-telemetry = { version = "2.0.0-rc2", path = "../../../client/telemetry" } +sc-authority-discovery = { version = "0.8.0-rc2", path = "../../../client/authority-discovery" } # frame dependencies -pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/timestamp" } -pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } -frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } -pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/im-online" } -pallet-authority-discovery = { version = "2.0.0-rc1", path = "../../../frame/authority-discovery" } -pallet-staking = { version = "2.0.0-rc1", path = "../../../frame/staking" } -pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/timestamp" } +pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } +frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } +pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/im-online" } +pallet-authority-discovery = { version = "2.0.0-rc2", path = "../../../frame/authority-discovery" } +pallet-staking = { version = "2.0.0-rc2", path = "../../../frame/staking" } +pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } # node-specific dependencies -node-runtime = { version = "2.0.0-rc1", path = "../runtime" } -node-rpc = { version = "2.0.0-rc1", path = "../rpc" } -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -node-executor = { version = "2.0.0-rc1", path = "../executor" } +node-runtime = { version = "2.0.0-rc2", path = "../runtime" } +node-rpc = { version = "2.0.0-rc2", path = "../rpc" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +node-executor = { version = "2.0.0-rc2", path = "../executor" } # CLI-specific dependencies -sc-cli = { version = "0.8.0-rc1", optional = true, path = "../../../client/cli" } -frame-benchmarking-cli = { version = "2.0.0-rc1", optional = true, path = "../../../utils/frame/benchmarking-cli" } -node-inspect = { version = "0.8.0-rc1", optional = true, path = "../inspect" } +sc-cli = { version = "0.8.0-rc2", optional = true, path = "../../../client/cli" } +frame-benchmarking-cli = { version = "2.0.0-rc2", optional = true, path = "../../../utils/frame/benchmarking-cli" } +node-inspect = { version = "0.8.0-rc2", optional = true, path = "../inspect" } # WASM-specific dependencies wasm-bindgen = { version = "0.2.57", optional = true } wasm-bindgen-futures = { version = "0.4.7", optional = true } -browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc1"} +browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc2"} [target.'cfg(target_arch="x86_64")'.dependencies] -node-executor = { version = "2.0.0-rc1", path = "../executor", features = [ "wasmtime" ] } -sc-cli = { version = "0.8.0-rc1", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } +node-executor = { version = "2.0.0-rc2", path = "../executor", features = [ "wasmtime" ] } +sc-cli = { version = "0.8.0-rc2", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } [dev-dependencies] -sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } -sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } -sc-consensus-babe = { version = "0.8.0-rc1", features = ["test-helpers"], path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../../client/consensus/epochs" } -sc-service-test = { version = "2.0.0-rc1", path = "../../../client/service/test" } +sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } +sc-consensus-babe = { version = "0.8.0-rc2", features = ["test-helpers"], path = "../../../client/consensus/babe" } +sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../../client/consensus/epochs" } +sc-service-test = { version = "2.0.0-rc2", path = "../../../client/service/test" } futures = "0.3.4" tempfile = "3.1.0" assert_cmd = "1.0" @@ -126,12 +126,12 @@ platforms = "0.2.1" [build-dependencies] structopt = { version = "0.3.8", optional = true } -node-inspect = { version = "0.8.0-rc1", optional = true, path = "../inspect" } -frame-benchmarking-cli = { version = "2.0.0-rc1", optional = true, path = "../../../utils/frame/benchmarking-cli" } -substrate-build-script-utils = { version = "2.0.0-rc1", optional = true, path = "../../../utils/build-script-utils" } +node-inspect = { version = "0.8.0-rc2", optional = true, path = "../inspect" } +frame-benchmarking-cli = { version = "2.0.0-rc2", optional = true, path = "../../../utils/frame/benchmarking-cli" } +substrate-build-script-utils = { version = "2.0.0-rc2", optional = true, path = "../../../utils/build-script-utils" } [build-dependencies.sc-cli] -version = "0.8.0-rc1" +version = "0.8.0-rc2" package = "sc-cli" path = "../../../client/cli" optional = true diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 101a080668..83a16a023f 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-executor" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." edition = "2018" @@ -13,34 +13,34 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -node-runtime = { version = "2.0.0-rc1", path = "../runtime" } -sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } -sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +node-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } trie-root = "0.16.0" -frame-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/benchmarking" } +frame-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/benchmarking" } [dev-dependencies] criterion = "0.3.0" -frame-support = { version = "2.0.0-rc1", path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } -node-testing = { version = "2.0.0-rc1", path = "../testing" } -pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } -pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc1", path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } -pallet-session = { version = "2.0.0-rc1", path = "../../../frame/session" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc1", path = "../../../frame/treasury" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } -substrate-test-client = { version = "2.0.0-rc1", path = "../../../test-utils/client" } +frame-support = { version = "2.0.0-rc2", path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } +node-testing = { version = "2.0.0-rc2", path = "../testing" } +pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } +pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc2", path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } +pallet-session = { version = "2.0.0-rc2", path = "../../../frame/session" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc2", path = "../../../frame/treasury" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } +substrate-test-client = { version = "2.0.0-rc2", path = "../../../test-utils/client" } wabt = "0.9.2" [features] diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index 7f75bd2ca3..6006e8c15c 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-inspect" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99" log = "0.4.8" -sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } structopt = "0.3.8" diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index ff45a3d81d..55ee2c3829 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system" } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc1", path = "../../../primitives/serializer" } +sp-serializer = { version = "2.0.0-rc2", path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index c81a5a5ba9..0b529d116c 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,5 +16,5 @@ futures = "0.1.29" hyper = "0.12.35" jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } log = "0.4.8" -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index f5dbf72ea1..00b8be99b1 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -11,23 +11,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } jsonrpc-core = "14.0.3" -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -node-runtime = { version = "2.0.0-rc1", path = "../runtime" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -pallet-contracts-rpc = { version = "0.8.0-rc1", path = "../../../frame/contracts/rpc/" } -pallet-transaction-payment-rpc = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment/rpc/" } -substrate-frame-rpc-system = { version = "2.0.0-rc1", path = "../../../utils/frame/rpc/system" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } -sc-consensus-babe = { version = "0.8.0-rc1", path = "../../../client/consensus/babe" } -sc-consensus-babe-rpc = { version = "0.8.0-rc1", path = "../../../client/consensus/babe/rpc" } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } -sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } -sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../../client/consensus/epochs" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sc-finality-grandpa = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa" } -sc-finality-grandpa-rpc = { version = "0.8.0-rc1", path = "../../../client/finality-grandpa/rpc" } -sc-rpc-api = { version = "0.8.0-rc1", path = "../../../client/rpc-api" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +node-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +pallet-contracts-rpc = { version = "0.8.0-rc2", path = "../../../frame/contracts/rpc/" } +pallet-transaction-payment-rpc = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment/rpc/" } +substrate-frame-rpc-system = { version = "2.0.0-rc2", path = "../../../utils/frame/rpc/system" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +sc-consensus-babe = { version = "0.8.0-rc2", path = "../../../client/consensus/babe" } +sc-consensus-babe-rpc = { version = "0.8.0-rc2", path = "../../../client/consensus/babe/rpc" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } +sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } +sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../../client/consensus/epochs" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sc-finality-grandpa = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa" } +sc-finality-grandpa-rpc = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa/rpc" } +sc-rpc-api = { version = "0.8.0-rc2", path = "../../../client/rpc-api" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index b3591f12bc..1bf61c046d 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -20,68 +20,68 @@ serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" # primitives -sp-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/consensus/babe" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc1"} -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/inherents" } -node-primitives = { version = "2.0.0-rc1", default-features = false, path = "../primitives" } -sp-offchain = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/offchain" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/staking" } -sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../../primitives/keyring" } -sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/session" } -sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/version" } +sp-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/consensus/babe" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc2"} +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/inherents" } +node-primitives = { version = "2.0.0-rc2", default-features = false, path = "../primitives" } +sp-offchain = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/offchain" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/staking" } +sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../../primitives/keyring" } +sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/session" } +sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/version" } # frame dependencies -frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/executive" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system" } -frame-system-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system/benchmarking", optional = true } -frame-system-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } -pallet-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/authority-discovery" } -pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/authorship" } -pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/babe" } -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/balances" } -pallet-collective = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/collective" } -pallet-contracts = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/contracts" } -pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/contracts/common/" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc1", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } -pallet-democracy = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/democracy" } -pallet-elections-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/elections-phragmen" } -pallet-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/finality-tracker" } -pallet-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/indices" } -pallet-identity = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/identity" } -pallet-membership = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/membership" } -pallet-offences = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/offences" } -pallet-offences-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } -pallet-randomness-collective-flip = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/randomness-collective-flip" } -pallet-recovery = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/recovery" } -pallet-session = { version = "2.0.0-rc1", features = ["historical"], path = "../../../frame/session", default-features = false } -pallet-session-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/session/benchmarking", default-features = false, optional = true } -pallet-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/staking/reward-curve" } -pallet-scheduler = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/scheduler" } -pallet-society = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/society" } -pallet-sudo = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/sudo" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/timestamp" } -pallet-treasury = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/treasury" } -pallet-utility = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/utility" } -pallet-transaction-payment = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/transaction-payment" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } -pallet-vesting = { version = "2.0.0-rc1", default-features = false, path = "../../../frame/vesting" } +frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/executive" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system" } +frame-system-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system/benchmarking", optional = true } +frame-system-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } +pallet-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/authority-discovery" } +pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/authorship" } +pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/babe" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/balances" } +pallet-collective = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/collective" } +pallet-contracts = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/contracts" } +pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/contracts/common/" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc2", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } +pallet-democracy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/democracy" } +pallet-elections-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/elections-phragmen" } +pallet-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/finality-tracker" } +pallet-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/indices" } +pallet-identity = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/identity" } +pallet-membership = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/membership" } +pallet-offences = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/offences" } +pallet-offences-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/randomness-collective-flip" } +pallet-recovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/recovery" } +pallet-session = { version = "2.0.0-rc2", features = ["historical"], path = "../../../frame/session", default-features = false } +pallet-session-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/session/benchmarking", default-features = false, optional = true } +pallet-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/staking/reward-curve" } +pallet-scheduler = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/scheduler" } +pallet-society = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/society" } +pallet-sudo = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/sudo" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/timestamp" } +pallet-treasury = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/treasury" } +pallet-utility = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/utility" } +pallet-transaction-payment = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/transaction-payment" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } +pallet-vesting = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/vesting" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index 1feb707125..7fe39763a4 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-testing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." edition = "2018" @@ -13,40 +13,40 @@ publish = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } -sc-service = { version = "0.8.0-rc1", features = ["test-helpers", "db"], path = "../../../client/service" } -sc-client-db = { version = "0.8.0-rc1", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api/" } +pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } +sc-service = { version = "0.8.0-rc2", features = ["test-helpers", "db"], path = "../../../client/service" } +sc-client-db = { version = "0.8.0-rc2", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api/" } codec = { package = "parity-scale-codec", version = "1.3.0" } -pallet-contracts = { version = "2.0.0-rc1", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } -pallet-indices = { version = "2.0.0-rc1", path = "../../../frame/indices" } -sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } -node-executor = { version = "2.0.0-rc1", path = "../executor" } -node-primitives = { version = "2.0.0-rc1", path = "../primitives" } -node-runtime = { version = "2.0.0-rc1", path = "../runtime" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } -frame-support = { version = "2.0.0-rc1", path = "../../../frame/support" } -pallet-session = { version = "2.0.0-rc1", path = "../../../frame/session" } -pallet-society = { version = "2.0.0-rc1", path = "../../../frame/society" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -pallet-staking = { version = "2.0.0-rc1", path = "../../../frame/staking" } -sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor", features = ["wasmtime"] } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } -substrate-test-client = { version = "2.0.0-rc1", path = "../../../test-utils/client" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc1", path = "../../../frame/treasury" } +pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } +sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } +node-executor = { version = "2.0.0-rc2", path = "../executor" } +node-primitives = { version = "2.0.0-rc2", path = "../primitives" } +node-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +frame-support = { version = "2.0.0-rc2", path = "../../../frame/support" } +pallet-session = { version = "2.0.0-rc2", path = "../../../frame/session" } +pallet-society = { version = "2.0.0-rc2", path = "../../../frame/society" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc2", path = "../../../frame/staking" } +sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor", features = ["wasmtime"] } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } +substrate-test-client = { version = "2.0.0-rc2", path = "../../../test-utils/client" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc2", path = "../../../frame/treasury" } wabt = "0.9.2" -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/finality-tracker" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/timestamp" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/timestamp" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -54,4 +54,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } diff --git a/bin/utils/chain-spec-builder/Cargo.toml b/bin/utils/chain-spec-builder/Cargo.toml index 919a500718..7ac1da4606 100644 --- a/bin/utils/chain-spec-builder/Cargo.toml +++ b/bin/utils/chain-spec-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-spec-builder" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" -sc-keystore = { version = "2.0.0-rc1", path = "../../../client/keystore" } -sc-chain-spec = { version = "2.0.0-rc1", path = "../../../client/chain-spec" } -node-cli = { version = "2.0.0-rc1", path = "../../node/cli" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } +sc-chain-spec = { version = "2.0.0-rc2", path = "../../../client/chain-spec" } +node-cli = { version = "2.0.0-rc2", path = "../../node/cli" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.8" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 43076062d3..c955ac3dd1 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subkey" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,10 +12,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.1.29" -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -node-runtime = { version = "2.0.0-rc1", path = "../../node/runtime" } -node-primitives = { version = "2.0.0-rc1", path = "../../node/primitives" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +node-runtime = { version = "2.0.0-rc2", path = "../../node/runtime" } +node-primitives = { version = "2.0.0-rc2", path = "../../node/primitives" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } rand = "0.7.2" clap = "2.33.0" tiny-bip39 = "0.7" @@ -23,14 +23,14 @@ substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.3.0" } -frame-system = { version = "2.0.0-rc1", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc1", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../../../frame/transaction-payment" } -pallet-grandpa = { version = "2.0.0-rc1", path = "../../../frame/grandpa" } +frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } +pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } -sc-rpc = { version = "2.0.0-rc1", path = "../../../client/rpc" } +sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" libp2p = "0.19.1" diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index 8afe365363..f46c45a691 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,36 +14,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } -sc-executor = { version = "0.8.0-rc1", path = "../executor" } -sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } +sc-executor = { version = "0.8.0-rc2", path = "../executor" } +sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } fnv = { version = "1.0.6" } futures = { version = "0.3.1" } hash-db = { version = "0.15.2", default-features = false } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } hex-literal = { version = "0.2.1" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } kvdb = "0.6.0" log = { version = "0.4.8" } parking_lot = "0.10.0" lazy_static = "1.4.0" -sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } -sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } -sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } +sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } +sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } [dev-dependencies] kvdb-memorydb = "0.6.0" -sp-test-primitives = { version = "2.0.0-rc1", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } +sp-test-primitives = { version = "2.0.0-rc2", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 3a40adf7c6..c32fb67c51 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-authority-discovery" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -23,21 +23,21 @@ futures = "0.3.4" futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} prost = "0.6.1" rand = "0.7.2" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } -sc-network = { version = "0.8.0-rc1", path = "../network" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } +sc-network = { version = "0.8.0-rc2", path = "../network" } serde_json = "1.0.41" -sp-authority-discovery = { version = "2.0.0-rc1", path = "../../primitives/authority-discovery" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-authority-discovery = { version = "2.0.0-rc2", path = "../../primitives/authority-discovery" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } [dev-dependencies] env_logger = "0.7.0" quickcheck = "0.9.0" -sc-peerset = { version = "2.0.0-rc1", path = "../peerset" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client"} +sc-peerset = { version = "2.0.0-rc2", path = "../peerset" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client"} diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index a452f08524..dad9c54f84 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-basic-authorship" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,21 +16,21 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc1", path = "../../primitives/inherents" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } -sc-proposer-metrics = { version = "0.8.0-rc1", path = "../proposer-metrics" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc2", path = "../../primitives/inherents" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } +sc-proposer-metrics = { version = "0.8.0-rc2", path = "../proposer-metrics" } tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] } [dev-dependencies] -sc-transaction-pool = { version = "2.0.0-rc1", path = "../../client/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../../client/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } parking_lot = "0.10.0" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index 0be48deb49..fb5add1d8f 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-block-builder" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../primitives/block-builder" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../primitives/block-builder" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } -sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } +sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml index aa32d97b25..eee78ef676 100644 --- a/client/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,12 +12,12 @@ description = "Substrate chain configurations." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-chain-spec-derive = { version = "2.0.0-rc1", path = "./derive" } +sc-chain-spec-derive = { version = "2.0.0-rc2", path = "./derive" } impl-trait-for-tuples = "0.1.3" -sc-network = { version = "0.8.0-rc1", path = "../network" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-chain-spec = { version = "2.0.0-rc1", path = "../../primitives/chain-spec" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-chain-spec = { version = "2.0.0-rc2", path = "../../primitives/chain-spec" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index 4bda059264..1f753689ae 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index dd751612df..8c19da95c4 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-cli" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Substrate CLI interface." edition = "2018" @@ -25,23 +25,23 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" serde_json = "1.0.41" -sc-informant = { version = "0.8.0-rc1", path = "../informant" } -sp-panic-handler = { version = "2.0.0-rc1", path = "../../primitives/panic-handler" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../service" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } -substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc1"} -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +sc-informant = { version = "0.8.0-rc2", path = "../informant" } +sp-panic-handler = { version = "2.0.0-rc2", path = "../../primitives/panic-handler" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../service" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc2"} +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.8" -sc-tracing = { version = "2.0.0-rc1", path = "../tracing" } +sc-tracing = { version = "2.0.0-rc2", path = "../tracing" } chrono = "0.4.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index b9be82bd63..afd7246266 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-aura" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Aura consensus algorithm for substrate" edition = "2018" @@ -12,37 +12,37 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc1", path = "../../../primitives/consensus/aura" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc2", path = "../../../primitives/consensus/aura" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sc-keystore = { version = "2.0.0-rc1", path = "../../keystore" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sc-keystore = { version = "2.0.0-rc2", path = "../../keystore" } log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } -sp-version = { version = "2.0.0-rc1", path = "../../../primitives/version" } -sc-consensus-slots = { version = "0.8.0-rc1", path = "../slots" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-version = { version = "2.0.0-rc2", path = "../../../primitives/version" } +sc-consensus-slots = { version = "0.8.0-rc2", path = "../slots" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} [dev-dependencies] -sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc1", path = "../../executor" } -sc-network = { version = "0.8.0-rc1", path = "../../network" } -sc-network-test = { version = "0.8.0-rc1", path = "../../network/test" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc2", path = "../../executor" } +sc-network = { version = "0.8.0-rc2", path = "../../network" } +sc-network-test = { version = "0.8.0-rc2", path = "../../network/test" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 154d1509d2..ca77b14d0e 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "BABE consensus algorithm for substrate" edition = "2018" @@ -14,31 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" serde = { version = "1.0.104", features = ["derive"] } -sp-version = { version = "2.0.0-rc1", path = "../../../primitives/version" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } -sc-keystore = { version = "2.0.0-rc1", path = "../../keystore" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sc-consensus-epochs = { version = "0.8.0-rc1", path = "../epochs" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-consensus-vrf = { version = "0.8.0-rc1", path = "../../../primitives/consensus/vrf" } -sc-consensus-uncles = { version = "0.8.0-rc1", path = "../uncles" } -sc-consensus-slots = { version = "0.8.0-rc1", path = "../slots" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -fork-tree = { version = "2.0.0-rc1", path = "../../../utils/fork-tree" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} +sp-version = { version = "2.0.0-rc2", path = "../../../primitives/version" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } +sc-keystore = { version = "2.0.0-rc2", path = "../../keystore" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sc-consensus-epochs = { version = "0.8.0-rc2", path = "../epochs" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-consensus-vrf = { version = "0.8.0-rc2", path = "../../../primitives/consensus/vrf" } +sc-consensus-uncles = { version = "0.8.0-rc2", path = "../uncles" } +sc-consensus-slots = { version = "0.8.0-rc2", path = "../slots" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +fork-tree = { version = "2.0.0-rc2", path = "../../../utils/fork-tree" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" @@ -50,13 +50,13 @@ pdqselect = "0.1.0" derive_more = "0.99.2" [dev-dependencies] -sp-keyring = { version = "2.0.0-rc1", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc1", path = "../../executor" } -sc-network = { version = "0.8.0-rc1", path = "../../network" } -sc-network-test = { version = "0.8.0-rc1", path = "../../network/test" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } +sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc2", path = "../../executor" } +sc-network = { version = "0.8.0-rc2", path = "../../network" } +sc-network-test = { version = "0.8.0-rc2", path = "../../network/test" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 22c95b6cd1..20f7e48758 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "RPC extensions for the BABE consensus algorithm" edition = "2018" @@ -12,27 +12,27 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-consensus-babe = { version = "0.8.0-rc1", path = "../" } -sc-rpc-api = { version = "0.8.0-rc1", path = "../../../rpc-api" } +sc-consensus-babe = { version = "0.8.0-rc2", path = "../" } +sc-rpc-api = { version = "0.8.0-rc2", path = "../../../rpc-api" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../../primitives/consensus/babe" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.8.0-rc1", path = "../../epochs" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } +sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../epochs" } futures = { version = "0.3.4", features = ["compat"] } derive_more = "0.99.2" -sp-api = { version = "2.0.0-rc1", path = "../../../../primitives/api" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc1", path = "../../../../primitives/core" } -sc-keystore = { version = "2.0.0-rc1", path = "../../../keystore" } +sp-api = { version = "2.0.0-rc2", path = "../../../../primitives/api" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc2", path = "../../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc2", path = "../../../keystore" } [dev-dependencies] -sc-consensus = { version = "0.8.0-rc1", path = "../../../consensus/common" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../consensus/common" } serde_json = "1.0.50" -sp-application-crypto = { version = "2.0.0-rc1", path = "../../../../primitives/application-crypto" } -sp-keyring = { version = "2.0.0-rc1", path = "../../../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../../test-utils/runtime/client" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../../../primitives/application-crypto" } +sp-keyring = { version = "2.0.0-rc2", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index c4743c2175..256237900b 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,7 +12,7 @@ description = "Collection of common consensus specific imlementations for Substr targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index 04397da31d..969d4f7d2c 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-epochs" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Generic epochs-based utilities for consensus" edition = "2018" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -fork-tree = { version = "2.0.0-rc1", path = "../../../utils/fork-tree" } -sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc1"} -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sc-client-api = { path = "../../api" , version = "2.0.0-rc1"} +fork-tree = { version = "2.0.0-rc2", path = "../../../utils/fork-tree" } +sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc2"} +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sc-client-api = { path = "../../api" , version = "2.0.0-rc2"} diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 84050547a5..de2bf68d76 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-manual-seal" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Manual sealing engine for Substrate" edition = "2018" @@ -22,20 +22,20 @@ parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } assert_matches = "1.3.0" -sc-client-api = { path = "../../../client/api", version = "2.0.0-rc1" } -sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc1" } -sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc1" } -sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc1" } -sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc1" } -sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc1" } -sp-core = { path = "../../../primitives/core", version = "2.0.0-rc1" } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc1" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1" } +sc-client-api = { path = "../../../client/api", version = "2.0.0-rc2" } +sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc2" } +sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc2" } +sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc2" } +sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc2" } +sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc2" } +sp-core = { path = "../../../primitives/core", version = "2.0.0-rc2" } +sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc2" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2" } [dev-dependencies] -sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc1" } -substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc1" } -substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc1" } +sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc2" } +substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc2" } +substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc2" } tokio = { version = "0.2", features = ["rt-core", "macros"] } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index 252bd04990..c6eab29781 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-pow" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "PoW consensus algorithm for substrate" edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../../primitives/block-builder" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } -sp-consensus-pow = { version = "0.8.0-rc1", path = "../../../primitives/consensus/pow" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sp-consensus-pow = { version = "0.8.0-rc2", path = "../../../primitives/consensus/pow" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } log = "0.4.8" futures = { version = "0.3.1", features = ["compat"] } -sp-timestamp = { version = "2.0.0-rc1", path = "../../../primitives/timestamp" } +sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } derive_more = "0.99.2" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index 25c6917138..6cc4a658e3 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-slots" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Generic slots-based utilities for consensus" edition = "2018" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../../primitives/application-crypto" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc1", path = "../../telemetry" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" log = "0.4.8" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml index cc97f18386..e01e0720b4 100644 --- a/client/consensus/uncles/Cargo.toml +++ b/client/consensus/uncles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-uncles" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Generic uncle inclusion utilities for consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-authorship = { version = "2.0.0-rc1", path = "../../../primitives/authorship" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc1", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-authorship = { version = "2.0.0-rc2", path = "../../../primitives/authorship" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } log = "0.4.8" diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index a33fe69643..32e6f9daa2 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-db" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -23,22 +23,22 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["st codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } blake2-rfc = "0.2.18" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sc-executor = { version = "0.8.0-rc1", path = "../executor" } -sc-state-db = { version = "0.8.0-rc1", path = "../state-db" } -sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-executor = { version = "0.8.0-rc2", path = "../executor" } +sc-state-db = { version = "0.8.0-rc2", path = "../state-db" } +sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } parity-db = { version = "0.1.2", optional = true } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } [dev-dependencies] -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.9" kvdb-rocksdb = "0.8" diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index 2fbc1714c8..7290538f48 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,22 +15,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } -sp-serializer = { version = "2.0.0-rc1", path = "../../primitives/serializer" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } -sp-panic-handler = { version = "2.0.0-rc1", path = "../../primitives/panic-handler" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } +sp-serializer = { version = "2.0.0-rc2", path = "../../primitives/serializer" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-panic-handler = { version = "2.0.0-rc2", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.41.0" lazy_static = "1.4.0" -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc1", path = "../../primitives/runtime-interface" } -sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } -sc-executor-common = { version = "0.8.0-rc1", path = "common" } -sc-executor-wasmi = { version = "0.8.0-rc1", path = "wasmi" } -sc-executor-wasmtime = { version = "0.8.0-rc1", path = "wasmtime", optional = true } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../../primitives/runtime-interface" } +sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } +sc-executor-common = { version = "0.8.0-rc2", path = "common" } +sc-executor-wasmi = { version = "0.8.0-rc2", path = "wasmi" } +sc-executor-wasmtime = { version = "0.8.0-rc2", path = "wasmtime", optional = true } parking_lot = "0.10.0" log = "0.4.8" libsecp256k1 = "0.3.4" @@ -39,11 +39,11 @@ libsecp256k1 = "0.3.4" assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" -sc-runtime-test = { version = "2.0.0-rc1", path = "runtime-test" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-runtime-test = { version = "2.0.0-rc2", path = "runtime-test" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } test-case = "0.3.3" -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [features] default = [ "std" ] diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index df9141d80c..f5d3c38c61 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-common" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,11 +18,11 @@ derive_more = "0.99.2" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } wasmi = "0.6.2" -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } -sp-serializer = { version = "2.0.0-rc1", path = "../../../primitives/serializer" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } +sp-serializer = { version = "2.0.0-rc2", path = "../../../primitives/serializer" } [features] default = [] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index 6ad0338b59..5700ee2f98 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-runtime-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,12 +13,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/io" } -sp-sandbox = { version = "0.8.0-rc1", default-features = false, path = "../../../primitives/sandbox" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -sp-allocator = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/allocator" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/io" } +sp-sandbox = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/sandbox" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-allocator = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/allocator" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index c170187658..0c16758c19 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmi" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,8 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" wasmi = "0.6.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-rc1", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc2", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index b2b4ee1753..2e6d33910c 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmtime" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,11 +16,11 @@ log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-rc1", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc1", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc1", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc2", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.4" } wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.4" } wasmtime-environ = "0.16" diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index 40dfe7c319..44c9e0f0f3 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -fork-tree = { version = "2.0.0-rc1", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc2", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" @@ -23,37 +23,37 @@ parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" parity-scale-codec = { version = "1.3.0", features = ["derive"] } -sp-arithmetic = { version = "2.0.0-rc1", path = "../../primitives/arithmetic" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc1", path = "../../client/consensus/common" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } -sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } +sp-arithmetic = { version = "2.0.0-rc2", path = "../../primitives/arithmetic" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc2", path = "../../client/consensus/common" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } serde_json = "1.0.41" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-inherents = { version = "2.0.0-rc1", path = "../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sc-network-gossip = { version = "0.8.0-rc1", path = "../network-gossip" } -sp-finality-tracker = { version = "2.0.0-rc1", path = "../../primitives/finality-tracker" } -sp-finality-grandpa = { version = "2.0.0-rc1", path = "../../primitives/finality-grandpa" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} -sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-inherents = { version = "2.0.0-rc2", path = "../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-network-gossip = { version = "0.8.0-rc2", path = "../network-gossip" } +sp-finality-tracker = { version = "2.0.0-rc2", path = "../../primitives/finality-tracker" } +sp-finality-grandpa = { version = "2.0.0-rc2", path = "../../primitives/finality-grandpa" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} +sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } pin-project = "0.4.6" [dev-dependencies] finality-grandpa = { version = "0.12.3", features = ["derive-codec", "test-helpers"] } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sc-network-test = { version = "0.8.0-rc1", path = "../network/test" } -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../primitives/consensus/babe" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-network-test = { version = "0.8.0-rc2", path = "../network/test" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../primitives/consensus/babe" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = { version = "0.2", features = ["rt-core"] } tempfile = "3.1.0" -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index dbff14bd16..e1724c6c4e 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "RPC extensions for the GRANDPA finality gadget" repository = "https://github.com/paritytech/substrate/" @@ -8,7 +8,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -sc-finality-grandpa = { version = "0.8.0-rc1", path = "../" } +sc-finality-grandpa = { version = "0.8.0-rc2", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.3" @@ -20,4 +20,4 @@ log = "0.4.8" derive_more = "0.99.2" [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index d4b6b96a27..cd24fa6958 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-informant" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Substrate informant." edition = "2018" @@ -17,8 +17,8 @@ futures = "0.3.4" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } wasm-timer = "0.2" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../service" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../service" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index 1d4312f816..f02869762d 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-keystore" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } hex = "0.4.0" rand = "0.7.2" serde_json = "1.0.41" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index a45f96e8b9..e6dc57dc9c 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Gossiping for the Substrate network protocol" name = "sc-network-gossip" -version = "0.8.0-rc1" +version = "0.8.0-rc2" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -19,12 +19,12 @@ futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["websocket"] } log = "0.4.8" lru = "0.4.3" -sc-network = { version = "0.8.0-rc1", path = "../network" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } wasm-timer = "0.2" [dev-dependencies] async-std = "1.5" quickcheck = "0.9.0" rand = "0.7.2" -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index daa5df0e15..6c6579a858 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate network protocol" name = "sc-network" -version = "0.8.0-rc1" +version = "0.8.0-rc2" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -26,7 +26,7 @@ derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" fnv = "1.0.6" -fork-tree = { version = "2.0.0-rc1", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc2", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" futures_codec = "0.3.3" @@ -39,23 +39,23 @@ lru = "0.4.0" nohash-hasher = "0.2.0" parking_lot = "0.10.0" pin-project = "0.4.6" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc1", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } prost = "0.6.1" rand = "0.7.2" -sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sc-peerset = { version = "2.0.0-rc1", path = "../peerset" } +sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sc-peerset = { version = "2.0.0-rc2", path = "../peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -sp-arithmetic = { version = "2.0.0-rc1", path = "../../primitives/arithmetic" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +sp-arithmetic = { version = "2.0.0-rc2", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } thiserror = "1" unsigned-varint = { version = "0.3.1", features = ["futures", "futures-codec"] } void = "1.0.2" @@ -74,10 +74,10 @@ env_logger = "0.7.0" libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } -sp-test-primitives = { version = "2.0.0-rc1", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +sp-test-primitives = { version = "2.0.0-rc2", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } tempfile = "3.1.0" [features] diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 73a5d729d9..8695d30a68 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Integration tests for Substrate network protocol" name = "sc-network-test" -version = "0.8.0-rc1" +version = "0.8.0-rc2" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-network = { version = "0.8.0-rc1", path = "../" } +sc-network = { version = "0.8.0-rc2", path = "../" } log = "0.4.8" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" libp2p = { version = "0.19.1", default-features = false, features = ["libp2p-websocket"] } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../../primitives/consensus/babe" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } env_logger = "0.7.0" -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } tempfile = "3.1.0" -sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../service" } diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 93d2ea5603..99f4ad66f3 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers" name = "sc-offchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bytes = "0.5" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } fnv = "1.0.6" futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -sp-offchain = { version = "2.0.0-rc1", path = "../../primitives/offchain" } +sp-offchain = { version = "2.0.0-rc2", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } rand = "0.7.2" -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] hyper = "0.13.2" @@ -38,10 +38,10 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" fdlimit = "0.1.4" -sc-client-db = { version = "0.8.0-rc1", default-features = true, path = "../db/" } -sc-transaction-pool = { version = "2.0.0-rc1", path = "../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sc-client-db = { version = "0.8.0-rc2", default-features = true, path = "../db/" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } tokio = "0.2" [features] diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index 668d40cd60..60ec0a39ef 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -3,7 +3,7 @@ description = "Connectivity manager based on reputation" homepage = "http://parity.io" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" name = "sc-peerset" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" repository = "https://github.com/paritytech/substrate/" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" libp2p = { version = "0.19.1", default-features = false } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils"} +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" wasm-timer = "0.2" diff --git a/client/proposer-metrics/Cargo.toml b/client/proposer-metrics/Cargo.toml index 406f98fa71..4e2a807b5d 100644 --- a/client/proposer-metrics/Cargo.toml +++ b/client/proposer-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-proposer-metrics" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,4 +13,4 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index e993291bad..1075c3a11c 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-api" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -21,11 +21,11 @@ jsonrpc-derive = "14.0.3" jsonrpc-pubsub = "14.0.3" log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } -sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc1"} -sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc1"} +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc2"} +sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc2"} serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -sp-rpc = { version = "2.0.0-rc1", path = "../../primitives/rpc" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +sp-rpc = { version = "2.0.0-rc2", path = "../../primitives/rpc" } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 65f4bb1a1e..401f5f4882 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-server" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,7 +17,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.0.3" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index ed67592741..62f9319575 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,38 +12,38 @@ description = "Substrate Client RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-rpc-api = { version = "0.8.0-rc1", path = "../rpc-api" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } +sc-rpc-api = { version = "0.8.0-rc2", path = "../rpc-api" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.0.3" log = "0.4.8" -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.0.3" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } serde_json = "1.0.41" -sp-session = { version = "2.0.0-rc1", path = "../../primitives/session" } -sp-offchain = { version = "2.0.0-rc1", path = "../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sp-rpc = { version = "2.0.0-rc1", path = "../../primitives/rpc" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sp-chain-spec = { version = "2.0.0-rc1", path = "../../primitives/chain-spec" } -sc-executor = { version = "0.8.0-rc1", path = "../executor" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../client/block-builder" } -sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } +sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } +sp-offchain = { version = "2.0.0-rc2", path = "../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-rpc = { version = "2.0.0-rc2", path = "../../primitives/rpc" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-chain-spec = { version = "2.0.0-rc2", path = "../../primitives/chain-spec" } +sc-executor = { version = "0.8.0-rc2", path = "../executor" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../client/block-builder" } +sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.10.0" [dev-dependencies] assert_matches = "1.3.0" futures01 = { package = "futures", version = "0.1.29" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } tokio = "0.1.22" -sc-transaction-pool = { version = "2.0.0-rc1", path = "../transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../transaction-pool" } lazy_static = "1.4.0" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 699da80c46..fc5991bc3f 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -39,38 +39,38 @@ hash-db = "0.15.2" serde = "1.0.101" serde_json = "1.0.41" sysinfo = "0.13.3" -sc-keystore = { version = "2.0.0-rc1", path = "../keystore" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-trie = { version = "2.0.0-rc1", path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-session = { version = "2.0.0-rc1", path = "../../primitives/session" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sc-network = { version = "0.8.0-rc1", path = "../network" } -sc-chain-spec = { version = "2.0.0-rc1", path = "../chain-spec" } -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../db" } +sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-chain-spec = { version = "2.0.0-rc2", path = "../chain-spec" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../db" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor = { version = "0.8.0-rc1", path = "../executor" } -sc-transaction-pool = { version = "2.0.0-rc1", path = "../transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -sc-rpc-server = { version = "2.0.0-rc1", path = "../rpc-servers" } -sc-rpc = { version = "2.0.0-rc1", path = "../rpc" } -sc-block-builder = { version = "0.8.0-rc1", path = "../block-builder" } -sp-block-builder = { version = "2.0.0-rc1", path = "../../primitives/block-builder" } +sc-executor = { version = "0.8.0-rc2", path = "../executor" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +sc-rpc-server = { version = "2.0.0-rc2", path = "../rpc-servers" } +sc-rpc = { version = "2.0.0-rc2", path = "../rpc" } +sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } +sp-block-builder = { version = "2.0.0-rc2", path = "../../primitives/block-builder" } -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } -sc-offchain = { version = "2.0.0-rc1", path = "../offchain" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sc-offchain = { version = "2.0.0-rc2", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc1"} -sc-tracing = { version = "2.0.0-rc1", path = "../tracing" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc2"} +sc-tracing = { version = "2.0.0-rc2", path = "../tracing" } tracing = "0.1.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } @@ -83,7 +83,7 @@ procfs = '0.7.8' [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc1", path = "../../primitives/consensus/babe" } -grandpa = { version = "0.8.0-rc1", package = "sc-finality-grandpa", path = "../finality-grandpa" } -grandpa-primitives = { version = "2.0.0-rc1", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc2", path = "../../primitives/consensus/babe" } +grandpa = { version = "0.8.0-rc2", package = "sc-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { version = "2.0.0-rc2", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index d846638dca..4b55b19269 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,24 +20,24 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } -sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } -sp-trie = { version = "2.0.0-rc1", path = "../../../primitives/trie" } -sp-storage = { version = "2.0.0-rc1", path = "../../../primitives/storage" } -sc-client-db = { version = "0.8.0-rc1", default-features = false, path = "../../db" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } +sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } +sp-storage = { version = "2.0.0-rc2", path = "../../../primitives/storage" } +sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../../db" } futures = { version = "0.3.1", features = ["compat"] } -sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../service" } -sc-network = { version = "0.8.0-rc1", path = "../../network" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -sc-client-api = { version = "2.0.0-rc1", path = "../../api" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../block-builder" } -sc-executor = { version = "0.8.0-rc1", path = "../../executor" } -sp-panic-handler = { version = "2.0.0-rc1", path = "../../../primitives/panic-handler" } +sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-network = { version = "0.8.0-rc2", path = "../../network" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } +sc-executor = { version = "0.8.0-rc2", path = "../../executor" } +sp-panic-handler = { version = "2.0.0-rc2", path = "../../../primitives/panic-handler" } parity-scale-codec = "1.3.0" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index ddcaa1f139..e1b784c222 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-state-db" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = "0.10.0" log = "0.4.8" -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index 0f78e5d5bf..e88a9dc779 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-telemetry" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Telemetry utils" edition = "2018" diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index 1a59106bbe..dfcedddbd1 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-tracing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -20,7 +20,7 @@ serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" -sc-telemetry = { version = "2.0.0-rc1", path = "../telemetry" } +sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } [dev-dependencies] tracing = "0.1.10" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index de3d34f1d4..0b394da357 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,21 +20,21 @@ intervalier = "0.4.0" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parking_lot = "0.10.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc1"} -sc-client-api = { version = "2.0.0-rc1", path = "../api" } -sc-transaction-graph = { version = "2.0.0-rc1", path = "./graph" } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc1", path = "../../primitives/tracing" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc1", path = "../../primitives/utils" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sc-transaction-graph = { version = "2.0.0-rc2", path = "./graph" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc2", path = "../../primitives/tracing" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } wasm-timer = "0.2" [dev-dependencies] assert_matches = "1.3.0" hex = "0.4" -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } -substrate-test-runtime-transaction-pool = { version = "2.0.0-rc1", path = "../../test-utils/runtime/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +substrate-test-runtime-transaction-pool = { version = "2.0.0-rc2", path = "../../test-utils/runtime/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index d7ad5db6a5..2290a29c8f 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-graph" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,18 +18,18 @@ log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0.101", features = ["derive"] } wasm-timer = "0.2" -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc1", path = "../../../primitives/utils" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc2", path = "../../../primitives/utils" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../../test-utils/runtime" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } criterion = "0.3" [[bench]] diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 76fb1ac579..4c4cf46e5c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog]. ## Unreleased +## 2.0.0-rc1 -> 2.0.0-rc2 + + ## 2.0.0-alpha.8 -> 2.0.0-rc1 diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index 9b34e968ee..f40eab532e 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index 7221d2c2ce..bb964bd415 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aura" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,23 +12,23 @@ description = "FRAME AURA consensus pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -sp-consensus-aura = { version = "0.8.0-rc1", path = "../../primitives/consensus/aura", default-features = false } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +sp-consensus-aura = { version = "0.8.0-rc2", path = "../../primitives/consensus/aura", default-features = false } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } lazy_static = "1.4.0" parking_lot = "0.10.0" diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 99a17ec910..3aa36b5cac 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authority-discovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME pallet for authority discovery" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-authority-discovery = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/authority-discovery" } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/authority-discovery" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc1", features = ["historical" ], path = "../session", default-features = false } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc2", features = ["historical" ], path = "../session", default-features = false } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } [features] default = ["std"] diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 32faaa23b1..7bde40887a 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authorship" -version = "2.0.0-rc1" +version = "2.0.0-rc2" description = "Block and Uncle Author tracking for the FRAME" authors = ["Parity Technologies "] edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-authorship = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/authorship" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-authorship = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/authorship" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 6ad153ed5a..060b6ad1ec 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-babe" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,22 +14,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } -sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } +sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/babe" } +sp-consensus-vrf = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/vrf" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 9fc875f907..ae69fb17c2 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../transaction-payment" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../transaction-payment" } [features] default = ["std"] diff --git a/frame/benchmark/Cargo.toml b/frame/benchmark/Cargo.toml index 2d5f32d58e..6ef770b6c1 100644 --- a/frame/benchmark/Cargo.toml +++ b/frame/benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-benchmark" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std"] diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index 078283dfac..24db2adc48 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] linregress = "0.1" paste = "0.1" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api = { version = "2.0.0-rc1", path = "../../primitives/api", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc1", path = "../../primitives/runtime-interface", default-features = false } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime", default-features = false } -sp-std = { version = "2.0.0-rc1", path = "../../primitives/std", default-features = false } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../../primitives/runtime-interface", default-features = false } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "2.0.0-rc2", path = "../../primitives/std", default-features = false } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io", default-features = false } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [features] default = [ "std" ] diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index 5a44cd8c79..d62b5ee580 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-collective" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index b0f3760a3d..656836df37 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ pwasm-utils = { version = "0.12.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-sandbox = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/sandbox" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "common" } -pallet-transaction-payment = { version = "2.0.0-rc1", default-features = false, path = "../transaction-payment" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-sandbox = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/sandbox" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "common" } +pallet-transaction-payment = { version = "2.0.0-rc2", default-features = false, path = "../transaction-payment" } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } -pallet-randomness-collective-flip = { version = "2.0.0-rc1", path = "../randomness-collective-flip" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } +pallet-randomness-collective-flip = { version = "2.0.0-rc2", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index 00fa3917bc..c358a87734 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } [features] default = ["std"] diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index 4bc3c84cb8..8ed233ed79 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc1", path = "../../../primitives/rpc" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -pallet-contracts-primitives = { version = "2.0.0-rc1", path = "../common" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc1", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +pallet-contracts-primitives = { version = "2.0.0-rc2", path = "../common" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc2", path = "./runtime-api" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index 93b945c053..b998befcc8 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Runtime API definition required by Contracts RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/runtime" } -pallet-contracts-primitives = { version = "2.0.0-rc1", default-features = false, path = "../../common" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/runtime" } +pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "../../common" } [features] default = ["std"] diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index 040571c5b3..433c37e4d8 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -pallet-scheduler = { version = "2.0.0-rc1", path = "../scheduler" } -sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } -substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-scheduler = { version = "2.0.0-rc2", path = "../scheduler" } +sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } +substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } hex-literal = "0.2.1" [features] diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index 3a46b710b6..bea1e0dfc4 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections-phragmen" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/phragmen" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/phragmen" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } [features] default = ["std"] diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index af5bc6d558..bd0dc2a1dd 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 6d14dd1d95..03b213605d 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-evm" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } primitive-types = { version = "0.7.0", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.16", default-features = false } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index d6ff25c841..0f57832a53 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example-offchain-worker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -13,13 +13,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } lite-json = { version = "0.1", default-features = false } [features] diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index caeb34f532..f150a6fa2f 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 07df7ce5a0..1484e14588 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-executive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/tracing" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/tracing" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } [dev-dependencies] hex-literal = "0.2.1" -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -pallet-indices = { version = "2.0.0-rc1", path = "../indices" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -pallet-transaction-payment = { version = "2.0.0-rc1", path = "../transaction-payment" } -sp-version = { version = "2.0.0-rc1", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +pallet-indices = { version = "2.0.0-rc2", path = "../indices" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-transaction-payment = { version = "2.0.0-rc2", path = "../transaction-payment" } +sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } [features] default = ["std"] diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index 02c15eebeb..248bf64432 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-finality-tracker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-tracker" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-tracker" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index 4e2f85e890..11576aaeae 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-generic-asset" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Centrality Developers "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 9146b17a9e..78a86f23ff 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-grandpa" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,27 +14,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-finality-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-grandpa" } -sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } -pallet-finality-tracker = { version = "2.0.0-rc1", default-features = false, path = "../finality-tracker" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-finality-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-grandpa" } +sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } +pallet-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../finality-tracker" } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.12.3", features = ["derive-codec"] } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -pallet-offences = { version = "2.0.0-rc1", path = "../offences" } -pallet-staking = { version = "2.0.0-rc1", path = "../staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-offences = { version = "2.0.0-rc2", path = "../offences" } +pallet-staking = { version = "2.0.0-rc2", path = "../staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } [features] default = ["std"] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 5973f12988..d38b6c80f1 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 29dc1af011..34b942c889 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-im-online" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME's I'm online pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } -pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../authorship" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../session" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std", "pallet-session/historical"] diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index 32b5b81c64..d4217ca49c 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-indices" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../primitives/keyring" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../primitives/keyring" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index e881364579..21f55b900b 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-membership" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index 71ae6858ee..4eac66ca5c 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-metadata" -version = "11.0.0-rc1" +version = "11.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 059e81408b..38952e6e94 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-nicks" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index 92770ba47b..260419741f 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ description = "FRAME offences pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index c4564d6c82..f72036361b 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,27 +13,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } -pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../babe" } -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../../balances" } -pallet-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../grandpa" } -pallet-im-online = { version = "2.0.0-rc1", default-features = false, path = "../../im-online" } -pallet-offences = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../../session" } -pallet-staking = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/staking" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } +pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../babe" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../../balances" } +pallet-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../grandpa" } +pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../im-online" } +pallet-offences = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../../session" } +pallet-staking = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/staking" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } [dev-dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } serde = { version = "1.0.101" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index 7653d2256b..a539c295fe 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 482cde4cd2..fe9e904fb3 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-recovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index e150d3b43b..79a1a89269 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scheduler" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -11,16 +11,16 @@ description = "FRAME example pallet" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index e72e1bd1ad..4bee2eec30 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scored-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index b653f2bd98..b79dc78f12 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../timestamp" } -sp-trie = { version = "2.0.0-rc1", optional = true, default-features = false, path = "../../primitives/trie" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } +sp-trie = { version = "2.0.0-rc2", optional = true, default-features = false, path = "../../primitives/trie" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" [features] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index c8fa5d4453..1fe2438195 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ description = "FRAME sessions pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } -pallet-staking = { version = "2.0.0-rc1", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -pallet-session = { version = "2.0.0-rc1", default-features = false, path = "../../session" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } +pallet-staking = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../../session" } [dev-dependencies] serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../../staking/reward-curve" } -sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } -pallet-balances = { version = "2.0.0-rc1", path = "../../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../../staking/reward-curve" } +sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } +pallet-balances = { version = "2.0.0-rc2", path = "../../balances" } [features] default = ["std"] diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index 41162f457c..25f596e9fd 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-society" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index f6fa826a3d..916e5676da 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,29 +15,29 @@ targets = ["x86_64-unknown-linux-gnu"] static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-phragmen = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/phragmen" } -sp-io ={ version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc1", default-features = false, features = ["historical"], path = "../session" } -pallet-authorship = { version = "2.0.0-rc1", default-features = false, path = "../authorship" } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/phragmen" } +sp-io ={ version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc2", default-features = false, features = ["historical"], path = "../session" } +pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } # Optional imports for benchmarking -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../timestamp" } -pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../staking/reward-curve" } -substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } -frame-benchmarking = { version = "2.0.0-rc1", path = "../benchmarking" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../staking/reward-curve" } +substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } +frame-benchmarking = { version = "2.0.0-rc2", path = "../benchmarking" } rand_chacha = { version = "0.2" } parking_lot = "0.10.2" env_logger = "0.7.1" diff --git a/frame/staking/fuzzer/Cargo.lock b/frame/staking/fuzzer/Cargo.lock index b73462e2df..f6cb65aa5c 100644 --- a/frame/staking/fuzzer/Cargo.lock +++ b/frame/staking/fuzzer/Cargo.lock @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index edd3037a7e..f4a31ff11a 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-rc1", path = "..", features = ["runtime-benchmarks"] } -pallet-staking-reward-curve = { version = "2.0.0-rc1", path = "../reward-curve" } -pallet-session = { version = "2.0.0-rc1", path = "../../session" } -pallet-indices = { version = "2.0.0-rc1", path = "../../indices" } -pallet-balances = { version = "2.0.0-rc1", path = "../../balances" } -pallet-timestamp = { version = "2.0.0-rc1", path = "../../timestamp" } -frame-system = { version = "2.0.0-rc1", path = "../../system" } -frame-support = { version = "2.0.0-rc1", path = "../../support" } -sp-std = { version = "2.0.0-rc1", path = "../../../primitives/std" } -sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-phragmen = { version = "2.0.0-rc1", path = "../../../primitives/phragmen" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc2", path = "..", features = ["runtime-benchmarks"] } +pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../reward-curve" } +pallet-session = { version = "2.0.0-rc2", path = "../../session" } +pallet-indices = { version = "2.0.0-rc2", path = "../../indices" } +pallet-balances = { version = "2.0.0-rc2", path = "../../balances" } +pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } +frame-system = { version = "2.0.0-rc2", path = "../../system" } +frame-support = { version = "2.0.0-rc2", path = "../../support" } +sp-std = { version = "2.0.0-rc2", path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-phragmen = { version = "2.0.0-rc2", path = "../../../primitives/phragmen" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } [[bin]] name = "submit_solution" diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index 3e6e4ca738..582f8d79f3 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking-reward-curve" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -21,4 +21,4 @@ proc-macro2 = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index f6df3ec03e..979eeb2b28 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-sudo" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index ba98adb8fc..d9117cf526 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,25 +15,25 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-metadata = { version = "11.0.0-rc1", default-features = false, path = "../metadata" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/tracing" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/arithmetic" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -frame-support-procedural = { version = "2.0.0-rc1", path = "./procedural" } +frame-metadata = { version = "11.0.0-rc2", default-features = false, path = "../metadata" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/tracing" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/arithmetic" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +frame-support-procedural = { version = "2.0.0-rc2", path = "./procedural" } paste = "0.1.6" once_cell = { version = "1", default-features = false, optional = true } -sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" smallvec = "1.4.0" [dev-dependencies] pretty_assertions = "0.6.1" -frame-system = { version = "2.0.0-rc1", path = "../system" } +frame-system = { version = "2.0.0-rc2", path = "../system" } [features] default = ["std"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 90c90f4ca0..0c20ac93e1 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -frame-support-procedural-tools = { version = "2.0.0-rc1", path = "./tools" } +frame-support-procedural-tools = { version = "2.0.0-rc2", path = "./tools" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full"] } diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index 2f6d124063..052a074024 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Proc macro helpers for procedural macros" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support-procedural-tools-derive = { version = "2.0.0-rc1", path = "./derive" } +frame-support-procedural-tools-derive = { version = "2.0.0-rc2", path = "./derive" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full", "visit"] } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index 20d427de47..75cb6f3045 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 8b858cf5b0..6685f65551 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io", default-features = false } -sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../../primitives/state-machine" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/inherents" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io", default-features = false } +sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../../primitives/state-machine" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/inherents" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index b88553729d..0928951929 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io", default-features = false } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" -sp-externalities = { version = "0.8.0-rc1", path = "../../primitives/externalities" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../test-utils/runtime/client" } +sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 748dc31467..14fb5206fe 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-benchmarking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../../benchmarking" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../system" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../support" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ version = "2.0.0-rc1", path = "../../../primitives/io" } +sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index 72e2837037..ef1cc7abac 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Runtime API definition required by System RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [features] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 6146700cd5..cda7904f75 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-timestamp" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,19 +16,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io", optional = true } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/timestamp" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io", optional = true } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index e4af397388..17e05fa40f 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,18 +13,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "./rpc/runtime-api" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "./rpc/runtime-api" } smallvec = "1.4.0" [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index e3e935c3c8..3ca2f4be8e 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,10 +16,10 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc1", path = "../../../primitives/rpc" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc1", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", path = "./runtime-api" } diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index 4466a2e53d..e4be938b3d 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../../support" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../support" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index a78037ebe0..17c716fdcd 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-treasury" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc1", default-features = false, path = "../balances" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io ={ version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index b6c7fffdaa..769e94c1bd 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-utility" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 311fd5ae40..314abd08d0 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc1", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc1", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc1", path = "../balances" } -sp-storage = { version = "2.0.0-rc1", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } hex-literal = "0.2.1" [features] diff --git a/primitives/allocator/Cargo.toml b/primitives/allocator/Cargo.toml index e83d70b4dc..7bf9ffd43f 100644 --- a/primitives/allocator/Cargo.toml +++ b/primitives/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-allocator" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/sp-allocator" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc1", path = "../std", default-features = false } -sp-core = { version = "2.0.0-rc1", path = "../core", default-features = false } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc2", path = "../std", default-features = false } +sp-core = { version = "2.0.0-rc2", path = "../core", default-features = false } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../wasm-interface", default-features = false } log = { version = "0.4.8", optional = true } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index f38da4da0c..980049235c 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api-proc-macro = { version = "2.0.0-rc1", path = "proc-macro" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../version" } -sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } +sp-api-proc-macro = { version = "2.0.0-rc2", path = "proc-macro" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../version" } +sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } hash-db = { version = "0.15.2", optional = true } [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc1", path = "../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc2", path = "../test-primitives" } [features] default = [ "std" ] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index c0441de584..ce53ee9970 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-proc-macro" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 0760472b77..59b1e76ad9 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc1", path = "../" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -sp-version = { version = "2.0.0-rc1", path = "../../version" } -sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../blockchain" } -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } +sp-api = { version = "2.0.0-rc2", path = "../" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sp-version = { version = "2.0.0-rc2", path = "../../version" } +sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../blockchain" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" [dev-dependencies] criterion = "0.3.0" -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -sp-core = { version = "2.0.0-rc1", path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sp-core = { version = "2.0.0-rc2", path = "../../core" } [[bench]] name = "bench" diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index fa13fd947e..2da6b31627 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" description = "Provides facilities for generating application specific crypto wrapper types." @@ -14,11 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } [features] default = [ "std" ] diff --git a/primitives/application-crypto/test/Cargo.toml b/primitives/application-crypto/test/Cargo.toml index 284af732a1..df7fc51698 100644 --- a/primitives/application-crypto/test/Cargo.toml +++ b/primitives/application-crypto/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" description = "Integration tests for application-crypto" @@ -13,8 +13,8 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../test-utils/runtime/client" } -sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../api" } -sp-application-crypto = { version = "2.0.0-rc1", path = "../" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc2", path = "../" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index 50eab59c86..5953d89e9c 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-debug-derive = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/debug-derive" } +sp-debug-derive = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/debug-derive" } [dev-dependencies] rand = "0.7.2" diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index c388d0259f..f870152f54 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-arithmetic = { version = "2.0.0-rc1", path = ".." } +sp-arithmetic = { version = "2.0.0-rc2", path = ".." } honggfuzz = "0.5.49" primitive-types = "0.7.0" num-bigint = "0.2" diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index 5d3db31f8a..24fcb91396 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authority-discovery" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Authority discovery primitives" edition = "2018" @@ -12,11 +12,11 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index f28f5b6efe..5ae5561a59 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authorship" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Authorship primitives" edition = "2018" @@ -12,9 +12,9 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index 565caffe9d..767dfeb87e 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-block-builder" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "The block builder runtime api." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } [features] default = [ "std" ] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index 36d13f0cec..d76d9c7209 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-blockchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,7 +19,7 @@ lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc1", path = "../consensus/common" } -sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } -sp-block-builder = { version = "2.0.0-rc1", path = "../block-builder" } -sp-state-machine = { version = "0.8.0-rc1", path = "../state-machine" } +sp-consensus = { version = "0.8.0-rc2", path = "../consensus/common" } +sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-block-builder = { version = "2.0.0-rc2", path = "../block-builder" } +sp-state-machine = { version = "0.8.0-rc2", path = "../state-machine" } diff --git a/primitives/chain-spec/Cargo.toml b/primitives/chain-spec/Cargo.toml index d530592fec..9b2658abe5 100644 --- a/primitives/chain-spec/Cargo.toml +++ b/primitives/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-chain-spec" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index 9323788300..b270bdb476 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-aura" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,13 +12,13 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../inherents" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../inherents" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 3a92b2f2c6..6cda2695d9 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-babe" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Primitives for BABE consensus" edition = "2018" @@ -12,16 +12,16 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } merlin = { version = "2.0", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } -sp-consensus = { version = "0.8.0-rc1", optional = true, path = "../common" } -sp-consensus-vrf = { version = "0.8.0-rc1", path = "../vrf", default-features = false } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../inherents" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } -sp-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } +sp-consensus = { version = "0.8.0-rc2", optional = true, path = "../common" } +sp-consensus-vrf = { version = "0.8.0-rc2", path = "../vrf", default-features = false } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../inherents" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } +sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index a652569895..f91ed927b9 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,22 +17,22 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" -sp-core = { path= "../../core", version = "2.0.0-rc1"} -sp-inherents = { version = "2.0.0-rc1", path = "../../inherents" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +sp-core = { path= "../../core", version = "2.0.0-rc2"} +sp-inherents = { version = "2.0.0-rc2", path = "../../inherents" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "3.0.1" -sp-std = { version = "2.0.0-rc1", path = "../../std" } -sp-version = { version = "2.0.0-rc1", path = "../../version" } -sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } -sp-utils = { version = "2.0.0-rc1", path = "../../utils" } +sp-std = { version = "2.0.0-rc2", path = "../../std" } +sp-version = { version = "2.0.0-rc2", path = "../../version" } +sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../utils" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc1"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc1", path = "../../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc2", path = "../../test-primitives" } [features] default = [] diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index 8ac24db410..d696b0a975 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-pow" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../api" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index cb4b270744..3e0f3c8c3f 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-vrf" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Primitives for VRF based consensus" edition = "2018" @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { version = "1.0.0", package = "parity-scale-codec", default-features = false } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } -sp-std = { version = "2.0.0-rc1", path = "../../std", default-features = false } -sp-core = { version = "2.0.0-rc1", path = "../../core", default-features = false } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../runtime" } +sp-std = { version = "2.0.0-rc2", path = "../../std", default-features = false } +sp-core = { version = "2.0.0-rc2", path = "../../core", default-features = false } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 85564274b0..1c06163843 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-core" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -33,9 +33,9 @@ num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } -sp-debug-derive = { version = "2.0.0-rc1", path = "../debug-derive" } -sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } -sp-storage = { version = "2.0.0-rc1", default-features = false, path = "../storage" } +sp-debug-derive = { version = "2.0.0-rc2", path = "../debug-derive" } +sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } +sp-storage = { version = "2.0.0-rc2", default-features = false, path = "../storage" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } futures = { version = "0.3.1", optional = true } @@ -50,10 +50,10 @@ twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } merlin = { version = "2.0", default-features = false, optional = true } -sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../runtime-interface" } +sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../runtime-interface" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc1", path = "../serializer" } +sp-serializer = { version = "2.0.0-rc2", path = "../serializer" } pretty_assertions = "0.6.1" hex-literal = "0.2.1" rand = "0.7.2" diff --git a/primitives/database/Cargo.toml b/primitives/database/Cargo.toml index 5754227632..1899ec850d 100644 --- a/primitives/database/Cargo.toml +++ b/primitives/database/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-database" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index a703dcc5f1..92ba01b23c 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-debug-derive" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 66367b7e79..589c8e625c 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-externalities" -version = "0.8.0-rc1" +version = "0.8.0-rc2" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-externalities" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-storage = { version = "2.0.0-rc1", path = "../storage" } -sp-std = { version = "2.0.0-rc1", path = "../std" } +sp-storage = { version = "2.0.0-rc2", path = "../storage" } +sp-std = { version = "2.0.0-rc2", path = "../std" } environmental = { version = "1.1.1" } codec = { package = "parity-scale-codec", version = "1.3.0" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index a4154caac0..83bfca378d 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-grandpa" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index c8e663455d..2f9e377f6b 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-tracker" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } [features] default = ["std"] diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 57434a2a7d..367782ae5b 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-inherents" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = { version = "0.10.0", optional = true } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index ca12371406..6189194ede 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-io" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } hash-db = { version = "0.15.2", default-features = false } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } libsecp256k1 = { version = "0.3.4", optional = true } -sp-state-machine = { version = "0.8.0-rc1", optional = true, path = "../../primitives/state-machine" } -sp-wasm-interface = { version = "2.0.0-rc1", path = "../../primitives/wasm-interface", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../runtime-interface" } -sp-trie = { version = "2.0.0-rc1", optional = true, path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } +sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../../primitives/wasm-interface", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../runtime-interface" } +sp-trie = { version = "2.0.0-rc2", optional = true, path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/keyring/Cargo.toml b/primitives/keyring/Cargo.toml index b096e6d6c1..ead618e3fc 100644 --- a/primitives/keyring/Cargo.toml +++ b/primitives/keyring/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-keyring" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc1", path = "../core" } -sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-core = { version = "2.0.0-rc2", path = "../core" } +sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } lazy_static = "1.4.0" strum = { version = "0.16.0", features = ["derive"] } diff --git a/primitives/offchain/Cargo.toml b/primitives/offchain/Cargo.toml index eb9e319869..2f7246121a 100644 --- a/primitives/offchain/Cargo.toml +++ b/primitives/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers primitives" name = "sp-offchain" -version = "2.0.0-rc1" +version = "2.0.0-rc2" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } [dev-dependencies] -sp-state-machine = { version = "0.8.0-rc1", default-features = false, path = "../state-machine" } +sp-state-machine = { version = "0.8.0-rc2", default-features = false, path = "../state-machine" } [features] default = ["std"] diff --git a/primitives/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml index 886f979311..75042799b1 100644 --- a/primitives/panic-handler/Cargo.toml +++ b/primitives/panic-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-panic-handler" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/Cargo.toml b/primitives/phragmen/Cargo.toml index 021c60325c..d2b8e56dc0 100644 --- a/primitives/phragmen/Cargo.toml +++ b/primitives/phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-phragmen-compact = { version = "2.0.0-rc1", path = "./compact" } -sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-phragmen-compact = { version = "2.0.0-rc2", path = "./compact" } +sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../arithmetic" } [dev-dependencies] -substrate-test-utils = { version = "2.0.0-rc1", path = "../../test-utils" } +substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } rand = "0.7.3" -sp-phragmen = { version = "2.0.0-rc1", path = "." } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } +sp-phragmen = { version = "2.0.0-rc2", path = "." } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [features] default = ["std"] diff --git a/primitives/phragmen/compact/Cargo.toml b/primitives/phragmen/compact/Cargo.toml index c3f8748a9d..8fb9789d99 100644 --- a/primitives/phragmen/compact/Cargo.toml +++ b/primitives/phragmen/compact/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-phragmen-compact" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/phragmen/fuzzer/Cargo.lock b/primitives/phragmen/fuzzer/Cargo.lock index 19f8114f36..a57bfa3920 100644 --- a/primitives/phragmen/fuzzer/Cargo.lock +++ b/primitives/phragmen/fuzzer/Cargo.lock @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" -version = "2.0.0-rc1" +version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/primitives/phragmen/fuzzer/Cargo.toml b/primitives/phragmen/fuzzer/Cargo.toml index 82f33c173d..2846841e1c 100644 --- a/primitives/phragmen/fuzzer/Cargo.toml +++ b/primitives/phragmen/fuzzer/Cargo.toml @@ -14,9 +14,9 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-phragmen = { version = "2.0.0-rc1", path = ".." } -sp-std = { version = "2.0.0-rc1", path = "../../std" } -sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } +sp-phragmen = { version = "2.0.0-rc2", path = ".." } +sp-std = { version = "2.0.0-rc2", path = "../../std" } +sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } honggfuzz = "0.5" rand = { version = "0.7.3", features = ["std", "small_rng"] } diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index 2b476bd872..a625d4ad71 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-rpc" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", features = ["derive"] } -sp-core = { version = "2.0.0-rc1", path = "../core" } +sp-core = { version = "2.0.0-rc2", path = "../core" } [dev-dependencies] serde_json = "1.0.41" diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index 0f78b410e3..a0ff633014 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,20 +13,20 @@ documentation = "https://docs.rs/sp-runtime-interface/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-wasm-interface = { version = "2.0.0-rc1", path = "../wasm-interface", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-tracing = { version = "2.0.0-rc1", default-features = false, path = "../tracing" } -sp-runtime-interface-proc-macro = { version = "2.0.0-rc1", path = "proc-macro" } -sp-externalities = { version = "0.8.0-rc1", optional = true, path = "../externalities" } +sp-wasm-interface = { version = "2.0.0-rc2", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../tracing" } +sp-runtime-interface-proc-macro = { version = "2.0.0-rc2", path = "proc-macro" } +sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] -sp-runtime-interface-test-wasm = { version = "2.0.0-rc1", path = "test-wasm" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } -sp-core = { version = "2.0.0-rc1", path = "../core" } -sp-io = { version = "2.0.0-rc1", path = "../io" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc2", path = "test-wasm" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc2", path = "../core" } +sp-io = { version = "2.0.0-rc2", path = "../io" } rustversion = "1.0.0" trybuild = "1.0.23" diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index 4ea3fce0be..89d8ddf56b 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 99baf624a5..43a1f8baa9 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index ce236ae16c..3f99e157ec 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc1", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test/Cargo.toml b/primitives/runtime-interface/test/Cargo.toml index efd474dc93..b281278b5c 100644 --- a/primitives/runtime-interface/test/Cargo.toml +++ b/primitives/runtime-interface/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc1", path = "../" } -sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } -sp-runtime-interface-test-wasm = { version = "2.0.0-rc1", path = "../test-wasm" } -sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc1", path = "../test-wasm-deprecated" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc1", path = "../../runtime" } -sp-core = { version = "2.0.0-rc1", path = "../../core" } -sp-io = { version = "2.0.0-rc1", path = "../../io" } +sp-runtime-interface = { version = "2.0.0-rc2", path = "../" } +sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc2", path = "../test-wasm" } +sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc2", path = "../test-wasm-deprecated" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-core = { version = "2.0.0-rc2", path = "../../core" } +sp-io = { version = "2.0.0-rc2", path = "../../io" } tracing = "0.1.13" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index 3c5fdde12b..ae30372b65 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,23 +16,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } -sp-arithmetic = { version = "2.0.0-rc1", default-features = false, path = "../arithmetic" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../io" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } +sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../io" } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } impl-trait-for-tuples = "0.1.3" -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } [dev-dependencies] serde_json = "1.0.41" rand = "0.7.2" -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } [features] bench = [] diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index d5e3113511..522ce1ea62 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-sandbox" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,10 +13,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../io" } -sp-wasm-interface = { version = "2.0.0-rc1", default-features = false, path = "../wasm-interface" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../io" } +sp-wasm-interface = { version = "2.0.0-rc2", default-features = false, path = "../wasm-interface" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [dev-dependencies] diff --git a/primitives/serializer/Cargo.toml b/primitives/serializer/Cargo.toml index ad57cdda4b..4fa0f215d3 100644 --- a/primitives/serializer/Cargo.toml +++ b/primitives/serializer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-serializer" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index 656db4ec92..48defdbe64 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-session" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-staking = { version = "2.0.0-rc1", default-features = false, path = "../staking" } -sp-runtime = { version = "2.0.0-rc1", optional = true, path = "../runtime" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../staking" } +sp-runtime = { version = "2.0.0-rc2", optional = true, path = "../runtime" } [features] default = [ "std" ] diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index 75fbb0020c..7f6019958c 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-staking" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index b8ce048b2e..6a2653bb5b 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-state-machine" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Substrate State Machine" edition = "2018" @@ -18,17 +18,17 @@ parking_lot = "0.10.0" hash-db = "0.15.2" trie-db = "0.20.1" trie-root = "0.16.0" -sp-trie = { version = "2.0.0-rc1", path = "../trie" } -sp-core = { version = "2.0.0-rc1", path = "../core" } -sp-panic-handler = { version = "2.0.0-rc1", path = "../panic-handler" } +sp-trie = { version = "2.0.0-rc2", path = "../trie" } +sp-core = { version = "2.0.0-rc2", path = "../core" } +sp-panic-handler = { version = "2.0.0-rc2", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.3.0" } num-traits = "0.2.8" rand = "0.7.2" -sp-externalities = { version = "0.8.0-rc1", path = "../externalities" } +sp-externalities = { version = "0.8.0-rc2", path = "../externalities" } [dev-dependencies] hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } [features] default = [] diff --git a/primitives/std/Cargo.toml b/primitives/std/Cargo.toml index d7ed5615ae..3f08366fa8 100644 --- a/primitives/std/Cargo.toml +++ b/primitives/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-std" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/storage/Cargo.toml b/primitives/storage/Cargo.toml index 94db0a4f4d..d0d45649c4 100644 --- a/primitives/storage/Cargo.toml +++ b/primitives/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-storage" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" description = "Storage related primitives" @@ -13,11 +13,11 @@ documentation = "https://docs.rs/sp-storage/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } ref-cast = "1.0.0" -sp-debug-derive = { version = "2.0.0-rc1", path = "../debug-derive" } +sp-debug-derive = { version = "2.0.0-rc2", path = "../debug-derive" } [features] default = [ "std" ] diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index 707b049533..ec050b7428 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-test-primitives" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } [features] diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 570c878f7d..4e8d2cabcb 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-timestamp" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Substrate core types and inherents for timestamps." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index 13c5d1c25c..213af27572 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-tracing" -version = "2.0.0-rc1" +version = "2.0.0-rc2" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index 312fb71353..dbb21f34b6 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,9 +19,9 @@ derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } -sp-utils = { version = "2.0.0-rc1", default-features = false, path = "../utils" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-utils = { version = "2.0.0-rc2", default-features = false, path = "../utils" } [features] default = [ "std" ] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index 8eacd4a628..57a2cb59ec 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-trie" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] description = "Patricia trie stuff using a parity-scale-codec node format" repository = "https://github.com/paritytech/substrate/" @@ -18,19 +18,19 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.20.1", default-features = false } trie-root = { version = "0.16.0", default-features = false } memory-db = { version = "0.20.0", default-features = false } -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } [dev-dependencies] trie-bench = "0.21.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc1", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } [features] default = ["std"] diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index 6c5488f389..5f4e6c7181 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index 19a773d306..e442639f87 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-version" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index d83a586827..dc00ef5ec0 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-wasm-interface" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" -sp-std = { version = "2.0.0-rc1", path = "../std", default-features = false } +sp-std = { version = "2.0.0-rc2", path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 4f6a46e145..0bb1d3026e 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index ae0dfb3808..a72dced392 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,17 +12,17 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc1", path = "../../client/api" } -sc-client-db = { version = "0.8.0-rc1", features = ["test-helpers"], path = "../../client/db" } -sp-consensus = { version = "0.8.0-rc1", path = "../../primitives/consensus/common" } -sc-executor = { version = "0.8.0-rc1", path = "../../client/executor" } -sc-consensus = { version = "0.8.0-rc1", path = "../../client/consensus/common" } -sc-service = { version = "0.8.0-rc1", default-features = false, features = ["test-helpers"], path = "../../client/service" } +sc-client-api = { version = "2.0.0-rc2", path = "../../client/api" } +sc-client-db = { version = "0.8.0-rc2", features = ["test-helpers"], path = "../../client/db" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sc-executor = { version = "0.8.0-rc2", path = "../../client/executor" } +sc-consensus = { version = "0.8.0-rc2", path = "../../client/consensus/common" } +sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../client/service" } futures = "0.3.4" hash-db = "0.15.2" -sp-keyring = { version = "2.0.0-rc1", path = "../../primitives/keyring" } +sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-core = { version = "2.0.0-rc1", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc1", path = "../../primitives/runtime" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../primitives/blockchain" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 70e98b2466..cb529e1cb7 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,35 +13,35 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/aura" } -sp-consensus-babe = { version = "0.8.0-rc1", default-features = false, path = "../../primitives/consensus/babe" } -sp-block-builder = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/block-builder" } +sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/aura" } +sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/babe" } +sp-block-builder = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-executive = { version = "2.0.0-rc1", default-features = false, path = "../../frame/executive" } -sp-inherents = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc1", optional = true, path = "../../primitives/keyring" } +frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../frame/executive" } +sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.20.0", default-features = false } -sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc1"} -sp-core = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/std" } -sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc1"} -sp-io = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc1", default-features = false, path = "../../frame/support" } -sp-version = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/version" } -sp-session = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/session" } -sp-api = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/runtime" } -pallet-babe = { version = "2.0.0-rc1", default-features = false, path = "../../frame/babe" } -frame-system = { version = "2.0.0-rc1", default-features = false, path = "../../frame/system" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc1", default-features = false, path = "../../frame/system/rpc/runtime-api" } -pallet-timestamp = { version = "2.0.0-rc1", default-features = false, path = "../../frame/timestamp" } -sp-finality-grandpa = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/finality-grandpa" } -sp-trie = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/trie" } -sp-transaction-pool = { version = "2.0.0-rc1", default-features = false, path = "../../primitives/transaction-pool" } +sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc2"} +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc2"} +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../frame/support" } +sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } +sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } +sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../frame/babe" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../frame/system" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../frame/system/rpc/runtime-api" } +pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../frame/timestamp" } +sp-finality-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-grandpa" } +sp-trie = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/trie" } +sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/transaction-pool" } trie-db = { version = "0.20.1", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.8.0-rc1", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } +sc-service = { version = "0.8.0-rc2", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } # 3rd party cfg-if = "0.1.10" @@ -49,10 +49,10 @@ log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.8.0-rc1", path = "../../client/block-builder" } -sc-executor = { version = "0.8.0-rc1", path = "../../client/executor" } -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "./client" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../primitives/state-machine" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../client/block-builder" } +sc-executor = { version = "0.8.0-rc2", path = "../../client/executor" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "./client" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../utils/wasm-builder-runner" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 388a5e159b..51d89ed95d 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-client" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,16 +12,16 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-consensus = { version = "0.8.0-rc1", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc1", path = "../../../client/block-builder" } -substrate-test-client = { version = "2.0.0-rc1", path = "../../client" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -substrate-test-runtime = { version = "2.0.0-rc1", path = "../../runtime" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } +substrate-test-client = { version = "2.0.0-rc2", path = "../../client" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +substrate-test-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-rc1", path = "../../../client/api" } -sc-consensus = { version = "0.8.0-rc1", path = "../../../client/consensus/common" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } +sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } futures = "0.3.4" diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index a240984883..171e864dc5 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../client" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../client" } parking_lot = "0.10.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../primitives/transaction-pool" } -sc-transaction-graph = { version = "2.0.0-rc1", path = "../../../client/transaction-pool/graph" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +sc-transaction-graph = { version = "2.0.0-rc2", path = "../../../client/transaction-pool/graph" } futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.99.2" diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index 6b15cf4346..0850b7b77e 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-browser-utils" -version = "0.8.0-rc1" +version = "0.8.0-rc2" authors = ["Parity Technologies "] description = "Utilities for creating a browser light-client." edition = "2018" @@ -22,11 +22,11 @@ js-sys = "0.3.34" wasm-bindgen = "0.2.57" wasm-bindgen-futures = "0.4.7" kvdb-web = "0.6" -sp-database = { version = "2.0.0-rc1", path = "../../primitives/database" } -sc-informant = { version = "0.8.0-rc1", path = "../../client/informant" } -sc-service = { version = "0.8.0-rc1", path = "../../client/service", default-features = false } -sc-network = { path = "../../client/network", version = "0.8.0-rc1"} -sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc1"} +sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } +sc-informant = { version = "0.8.0-rc2", path = "../../client/informant" } +sc-service = { version = "0.8.0-rc2", path = "../../client/service", default-features = false } +sc-network = { path = "../../client/network", version = "0.8.0-rc2"} +sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc2"} # Imported just for the `no_cc` feature clear_on_drop = { version = "0.2.3", features = ["no_cc"] } diff --git a/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml index 02a5e13c88..8e722d6919 100644 --- a/utils/build-script-utils/Cargo.toml +++ b/utils/build-script-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-build-script-utils" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index 357016cd2a..d07afd2d42 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-tree" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index 7a0be9ec55..d9a8dd67e7 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking-cli" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,15 +12,15 @@ description = "CLI for benchmarking FRAME" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-benchmarking = { version = "2.0.0-rc1", path = "../../../frame/benchmarking" } -sp-core = { version = "2.0.0-rc1", path = "../../../primitives/core" } -sc-service = { version = "0.8.0-rc1", default-features = false, path = "../../../client/service" } -sc-cli = { version = "0.8.0-rc1", path = "../../../client/cli" } -sc-client-db = { version = "0.8.0-rc1", path = "../../../client/db" } -sc-executor = { version = "0.8.0-rc1", path = "../../../client/executor" } -sp-externalities = { version = "0.8.0-rc1", path = "../../../primitives/externalities" } -sp-runtime = { version = "2.0.0-rc1", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc1", path = "../../../primitives/state-machine" } +frame-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/benchmarking" } +sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } +sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } +sc-client-db = { version = "0.8.0-rc2", path = "../../../client/db" } +sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } +sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } structopt = "0.3.8" codec = { version = "1.3.0", package = "parity-scale-codec" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 14cf65742e..006372eb36 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-support" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies ", "Andrew Dirksen "] edition = "2018" license = "Apache-2.0" @@ -17,10 +17,10 @@ jsonrpc-client-transports = { version = "14.0.5", default-features = false, feat jsonrpc-core = "14" codec = { package = "parity-scale-codec", version = "1" } serde = "1" -frame-support = { version = "2.0.0-rc1", path = "../../../../frame/support" } -sp-storage = { version = "2.0.0-rc1", path = "../../../../primitives/storage" } -sc-rpc-api = { version = "0.8.0-rc1", path = "../../../../client/rpc-api" } +frame-support = { version = "2.0.0-rc2", path = "../../../../frame/support" } +sp-storage = { version = "2.0.0-rc2", path = "../../../../primitives/storage" } +sc-rpc-api = { version = "0.8.0-rc2", path = "../../../../client/rpc-api" } [dev-dependencies] -frame-system = { version = "2.0.0-rc1", path = "../../../../frame/system" } +frame-system = { version = "2.0.0-rc2", path = "../../../../frame/system" } tokio = "0.2" diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index ed00809a3b..f757e811fb 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-system" -version = "2.0.0-rc1" +version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "FRAME's system exposed over Substrate RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc1", path = "../../../../client/api" } +sc-client-api = { version = "2.0.0-rc2", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.0.3" @@ -20,14 +20,14 @@ jsonrpc-core-client = "14.0.5" jsonrpc-derive = "14.0.3" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc1", path = "../../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc1", path = "../../../../primitives/api" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc1", path = "../../../../frame/system/rpc/runtime-api" } -sp-core = { version = "2.0.0-rc1", path = "../../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc1", path = "../../../../primitives/blockchain" } -sp-transaction-pool = { version = "2.0.0-rc1", path = "../../../../primitives/transaction-pool" } +sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc2", path = "../../../../primitives/api" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc2", path = "../../../../frame/system/rpc/runtime-api" } +sp-core = { version = "2.0.0-rc2", path = "../../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../../primitives/transaction-pool" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc1", path = "../../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../../test-utils/runtime/client" } env_logger = "0.7.0" -sc-transaction-pool = { version = "2.0.0-rc1", path = "../../../../client/transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../../client/transaction-pool" } diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index 697e186db6..d1f192f7b5 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Endpoint to expose Prometheus metrics" name = "substrate-prometheus-endpoint" -version = "0.8.0-rc1" +version = "0.8.0-rc2" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" -- GitLab From bda3b4092681cc1ab95be4de71fe3a313721852a Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Tue, 26 May 2020 18:03:29 +0200 Subject: [PATCH 061/280] Fix mul_acc. (#6145) --- primitives/arithmetic/src/fixed.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/primitives/arithmetic/src/fixed.rs b/primitives/arithmetic/src/fixed.rs index 5c87891432..bc657c5ede 100644 --- a/primitives/arithmetic/src/fixed.rs +++ b/primitives/arithmetic/src/fixed.rs @@ -75,6 +75,11 @@ pub trait FixedPointNumber: /// Consumes `self` and returns the inner raw value. fn into_inner(self) -> Self::Inner; + /// Returns the negation. + fn negate(self) -> Self { + Self::from_inner(-self.into_inner()) + } + /// Creates self from an integer number `int`. /// /// Returns `Self::max` or `Self::min` if `int` exceeds accuracy. @@ -163,7 +168,11 @@ pub trait FixedPointNumber: /// /// Returns `N::min` or `N::max` if the multiplication or final result does not fit in `N`. fn saturating_mul_acc_int(self, n: N) -> N { - self.saturating_mul_int(n).saturating_add(n) + if self.is_negative() && n > N::zero() { + n.saturating_sub(self.negate().saturating_mul_int(n)) + } else { + self.saturating_mul_int(n).saturating_add(n) + } } /// Saturating absolute value. @@ -1255,7 +1264,8 @@ macro_rules! implement_fixed { let a = $name::saturating_from_rational(-1, 2); assert_eq!(a.saturating_mul_acc_int(42i8), 21i8); - assert_eq!(a.saturating_mul_acc_int(u128::max_value() - 1), u128::max_value() - 1); + assert_eq!(a.saturating_mul_acc_int(42u8), 21u8); + assert_eq!(a.saturating_mul_acc_int(u128::max_value() - 1), u128::max_value() / 2); } #[test] -- GitLab From b3adec2288ff3f34d780c59cb68b5663f245ca96 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 26 May 2020 21:23:32 +0200 Subject: [PATCH 062/280] Don't iterate over peers in generic_proto::behaviour::poll (#6142) * Don't iterate over peers in generic_proto::behaviour::poll * Improve comment * Rework to use DelayIds --- .../src/protocol/generic_proto/behaviour.rs | 83 ++++++++++++++----- 1 file changed, 62 insertions(+), 21 deletions(-) diff --git a/client/network/src/protocol/generic_proto/behaviour.rs b/client/network/src/protocol/generic_proto/behaviour.rs index b3c209eb0c..cf6188726d 100644 --- a/client/network/src/protocol/generic_proto/behaviour.rs +++ b/client/network/src/protocol/generic_proto/behaviour.rs @@ -126,6 +126,18 @@ pub struct GenericProto { /// List of peers in our state. peers: FnvHashMap, + /// The elements in `peers` occasionally contain `Delay` objects that we would normally have + /// to be polled one by one. In order to avoid doing so, as an optimization, every `Delay` is + /// instead put inside of `delays` and reference by a [`DelayId`]. This stream + /// yields `PeerId`s whose `DelayId` is potentially ready. + /// + /// By design, we never remove elements from this list. Elements are removed only when the + /// `Delay` triggers. As such, this stream may produce obsolete elements. + delays: stream::FuturesUnordered + Send>>>, + + /// [`DelayId`] to assign to the next delay. + next_delay_id: DelayId, + /// List of incoming messages we have sent to the peer set manager and that are waiting for an /// answer. incoming: SmallVec<[IncomingPeer; 6]>, @@ -141,6 +153,10 @@ pub struct GenericProto { queue_size_report: Option, } +/// Identifier for a delay firing. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +struct DelayId(u64); + /// State of a peer we're connected to. #[derive(Debug)] enum PeerState { @@ -158,8 +174,8 @@ enum PeerState { /// The peerset requested that we connect to this peer. We are currently not connected. PendingRequest { - /// When to actually start dialing. - timer: futures_timer::Delay, + /// When to actually start dialing. References an entry in `delays`. + timer: DelayId, /// When the `timer` will trigger. timer_deadline: Instant, }, @@ -183,8 +199,8 @@ enum PeerState { DisabledPendingEnable { /// The connections that are currently open for custom protocol traffic. open: SmallVec<[ConnectionId; crate::MAX_CONNECTIONS_PER_PEER]>, - /// When to enable this remote. - timer: futures_timer::Delay, + /// When to enable this remote. References an entry in `delays`. + timer: DelayId, /// When the `timer` will trigger. timer_deadline: Instant, }, @@ -338,6 +354,8 @@ impl GenericProto { notif_protocols: Vec::new(), peerset, peers: FnvHashMap::default(), + delays: Default::default(), + next_delay_id: DelayId(0), incoming: SmallVec::new(), next_incoming_index: sc_peerset::IncomingIndex(0), events: VecDeque::new(), @@ -627,10 +645,20 @@ impl GenericProto { match mem::replace(occ_entry.get_mut(), PeerState::Poisoned) { PeerState::Banned { ref until } if *until > now => { + let peer_id = occ_entry.key().clone(); debug!(target: "sub-libp2p", "PSM => Connect({:?}): Will start to connect at \ - until {:?}", occ_entry.key(), until); + until {:?}", peer_id, until); + + let delay_id = self.next_delay_id; + self.next_delay_id.0 += 1; + let delay = futures_timer::Delay::new(*until - now); + self.delays.push(async move { + delay.await; + (delay_id, peer_id) + }.boxed()); + *occ_entry.into_mut() = PeerState::PendingRequest { - timer: futures_timer::Delay::new(*until - now), + timer: delay_id, timer_deadline: *until, }; }, @@ -649,11 +677,21 @@ impl GenericProto { open, banned_until: Some(ref banned) } if *banned > now => { + let peer_id = occ_entry.key().clone(); debug!(target: "sub-libp2p", "PSM => Connect({:?}): But peer is banned until {:?}", - occ_entry.key(), banned); + peer_id, banned); + + let delay_id = self.next_delay_id; + self.next_delay_id.0 += 1; + let delay = futures_timer::Delay::new(*banned - now); + self.delays.push(async move { + delay.await; + (delay_id, peer_id) + }.boxed()); + *occ_entry.into_mut() = PeerState::DisabledPendingEnable { open, - timer: futures_timer::Delay::new(*banned - now), + timer: delay_id, timer_deadline: *banned, }; }, @@ -1363,34 +1401,37 @@ impl NetworkBehaviour for GenericProto { } } - for (peer_id, peer_state) in self.peers.iter_mut() { - match peer_state { - PeerState::PendingRequest { timer, .. } => { - if let Poll::Pending = Pin::new(timer).poll(cx) { - continue; - } + while let Poll::Ready(Some((delay_id, peer_id))) = + Pin::new(&mut self.delays).poll_next(cx) { + let peer_state = match self.peers.get_mut(&peer_id) { + Some(s) => s, + // We intentionally never remove elements from `delays`, and it may + // thus contain peers which are now gone. This is a normal situation. + None => continue, + }; + match peer_state { + PeerState::PendingRequest { timer, .. } if *timer == delay_id => { debug!(target: "sub-libp2p", "Libp2p <= Dial {:?} now that ban has expired", peer_id); self.events.push_back(NetworkBehaviourAction::DialPeer { - peer_id: peer_id.clone(), + peer_id, condition: DialPeerCondition::Disconnected }); *peer_state = PeerState::Requested; } - PeerState::DisabledPendingEnable { timer, open, .. } => { - if let Poll::Pending = Pin::new(timer).poll(cx) { - continue; - } - + PeerState::DisabledPendingEnable { timer, open, .. } if *timer == delay_id => { debug!(target: "sub-libp2p", "Handler({:?}) <= Enable (ban expired)", peer_id); self.events.push_back(NetworkBehaviourAction::NotifyHandler { - peer_id: peer_id.clone(), + peer_id, handler: NotifyHandler::All, event: NotifsHandlerIn::Enable, }); *peer_state = PeerState::Enabled { open: mem::replace(open, Default::default()) }; } + + // We intentionally never remove elements from `delays`, and it may + // thus contain obsolete entries. This is a normal situation. _ => {}, } } -- GitLab From dee1bfbd0ab45e76d3257c8786830525839afea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 26 May 2020 21:23:57 +0200 Subject: [PATCH 063/280] Fixes `wasm-builder` rerun if changed logic (#6144) There was a bug which related in required files not being tracked of being modified. This pr fixes this bug by making sure we ignore version requirements for path dependencies and git dependencies. This also ensures that we only track `.rs` or `.toml` files. Another improvement is that we only include paths which don't contain a `Cargo.toml` if this `Cargo.toml` does not belongs to the package being processed. This prevents that sub-crates are added to the tracked files, while not being part of the dependencies. --- Cargo.lock | 12 ++-- utils/wasm-builder/Cargo.toml | 4 +- utils/wasm-builder/src/wasm_project.rs | 77 ++++++++++++++++---------- 3 files changed, 55 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3c9672e37..ac74b57a52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,9 +520,9 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" [[package]] name = "cargo_metadata" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" +checksum = "b8de60b887edf6d74370fc8eb177040da4847d971d6234c7b13a6da324ef0caf" dependencies = [ "semver 0.9.0", "serde", @@ -7021,18 +7021,18 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.106" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.106" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" +checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", "quote 1.0.3", diff --git a/utils/wasm-builder/Cargo.toml b/utils/wasm-builder/Cargo.toml index 2b7a632b55..74e5f20524 100644 --- a/utils/wasm-builder/Cargo.toml +++ b/utils/wasm-builder/Cargo.toml @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] build-helper = "0.1.1" -cargo_metadata = "0.9.0" +cargo_metadata = "0.10.0" tempfile = "3.1.0" toml = "0.5.4" -walkdir = "2.2.9" +walkdir = "2.3.1" fs2 = "0.4.3" wasm-gc-api = "0.1.11" atty = "0.2.13" diff --git a/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs index d1c926c904..69dbc7882b 100644 --- a/utils/wasm-builder/src/wasm_project.rs +++ b/utils/wasm-builder/src/wasm_project.rs @@ -26,7 +26,7 @@ use toml::value::Table; use build_helper::rerun_if_changed; -use cargo_metadata::MetadataCommand; +use cargo_metadata::{MetadataCommand, Metadata}; use walkdir::WalkDir; @@ -342,11 +342,7 @@ fn project_enabled_features( /// /// # Returns /// The path to the created project. -fn create_project( - cargo_manifest: &Path, - wasm_workspace: &Path, - crate_metadata: &cargo_metadata::Metadata, -) -> PathBuf { +fn create_project(cargo_manifest: &Path, wasm_workspace: &Path, crate_metadata: &Metadata) -> PathBuf { let crate_name = get_crate_name(cargo_manifest); let crate_path = cargo_manifest.parent().expect("Parent path exists; qed"); let wasm_binary = get_wasm_binary_name(cargo_manifest); @@ -519,22 +515,33 @@ fn generate_rerun_if_changed_instructions( .exec() .expect("`cargo metadata` can not fail!"); - // Start with the dependencies of the crate we want to compile for wasm. - let mut dependencies = metadata.packages + let package = metadata.packages .iter() .find(|p| p.manifest_path == cargo_manifest) - .expect("The crate package is contained in its own metadata; qed") - .dependencies - .iter() - .collect::>(); + .expect("The crate package is contained in its own metadata; qed"); + + // Start with the dependencies of the crate we want to compile for wasm. + let mut dependencies = package.dependencies.iter().collect::>(); // Collect all packages by follow the dependencies of all packages we find. let mut packages = HashSet::new(); + packages.insert(DeduplicatePackage::from(package)); + while let Some(dependency) = dependencies.pop() { + let path_or_git_dep = dependency.source + .as_ref() + .map(|s| s.starts_with("git+")) + .unwrap_or(true); + let package = metadata.packages .iter() .filter(|p| !p.manifest_path.starts_with(wasm_workspace)) - .find(|p| dependency.req.matches(&p.version) && dependency.name == p.name); + .find(|p| { + // Check that the name matches and that the version matches or this is + // a git or path dep. A git or path dependency can only occur once, so we don't + // need to check the version. + (path_or_git_dep || dependency.req.matches(&p.version)) && dependency.name == p.name + }); if let Some(package) = package { if packages.insert(DeduplicatePackage::from(package)) { @@ -544,21 +551,7 @@ fn generate_rerun_if_changed_instructions( } // Make sure that if any file/folder of a dependency change, we need to rerun the `build.rs` - packages.into_iter() - .filter(|p| !p.manifest_path.starts_with(wasm_workspace)) - .for_each(|package| { - let mut manifest_path = package.manifest_path.clone(); - if manifest_path.ends_with("Cargo.toml") { - manifest_path.pop(); - } - - rerun_if_changed(&manifest_path); - - WalkDir::new(manifest_path) - .into_iter() - .filter_map(|p| p.ok()) - .for_each(|p| rerun_if_changed(p.path())); - }); + packages.iter().for_each(package_rerun_if_changed); // Register our env variables println!("cargo:rerun-if-env-changed={}", crate::SKIP_BUILD_ENV); @@ -568,8 +561,32 @@ fn generate_rerun_if_changed_instructions( println!("cargo:rerun-if-env-changed={}", crate::WASM_BUILD_TOOLCHAIN); } -/// Copy the WASM binary to the target directory set in `WASM_TARGET_DIRECTORY` environment variable. -/// If the variable is not set, this is a no-op. +/// Track files and paths related to the given package to rerun `build.rs` on any relevant change. +fn package_rerun_if_changed(package: &DeduplicatePackage) { + let mut manifest_path = package.manifest_path.clone(); + if manifest_path.ends_with("Cargo.toml") { + manifest_path.pop(); + } + + WalkDir::new(&manifest_path) + .into_iter() + .filter_entry(|p| { + // Ignore this entry if it is a directory that contains a `Cargo.toml` that is not the + // `Cargo.toml` related to the current package. This is done to ignore sub-crates of a crate. + // If such a sub-crate is a dependency, it will be processed independently anyway. + p.path() == manifest_path + || !p.path().is_dir() + || !p.path().join("Cargo.toml").exists() + }) + .filter_map(|p| p.ok().map(|p| p.into_path())) + .filter(|p| { + p.is_dir() || p.extension().map(|e| e == "rs" || e == "toml").unwrap_or_default() + }) + .for_each(|p| rerun_if_changed(p)); +} + +/// Copy the WASM binary to the target directory set in `WASM_TARGET_DIRECTORY` environment +/// variable. If the variable is not set, this is a no-op. fn copy_wasm_to_target_directory(cargo_manifest: &Path, wasm_binary: &WasmBinary) { let target_dir = match env::var(crate::WASM_TARGET_DIRECTORY) { Ok(path) => PathBuf::from(path), -- GitLab From 4fd3ee18ff973a8357e701ca590ad5a182bea395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 26 May 2020 21:25:15 +0200 Subject: [PATCH 064/280] CLI: Make `--dev` conflict with `--chain` (#6146) If we are running `--dev` chain, we should forbid the `--chain` argument. The `--dev` chain is always special by only having one authority etc and some other chain spec is probably not setup for this correctly. In the end `--dev` is just a shortcut for `--validator --alice`. --- client/cli/src/commands/run_cmd.rs | 2 +- client/cli/src/params/shared_params.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index f87d5bea6e..23a410d679 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -65,7 +65,7 @@ pub struct RunCmd { pub sentry: Vec, /// Disable GRANDPA voter when running in validator mode, otherwise disable the GRANDPA observer. - #[structopt(long = "no-grandpa")] + #[structopt(long)] pub no_grandpa: bool, /// Experimental: Run in light client mode. diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index 5bf8102466..e9440f38a1 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -23,16 +23,16 @@ use structopt::StructOpt; #[derive(Debug, StructOpt, Clone)] pub struct SharedParams { /// Specify the chain specification (one of dev, local, or staging). - #[structopt(long = "chain", value_name = "CHAIN_SPEC")] + #[structopt(long, value_name = "CHAIN_SPEC")] pub chain: Option, /// Specify the development chain. - #[structopt(long = "dev")] + #[structopt(long, conflicts_with_all = &["chain"])] pub dev: bool, /// Specify custom base path. #[structopt( - long = "base-path", + long, short = "d", value_name = "PATH", parse(from_os_str) @@ -43,7 +43,7 @@ pub struct SharedParams { /// /// Log levels (least to most verbose) are error, warn, info, debug, and trace. /// By default, all targets log `info`. The global log level can be set with -l. - #[structopt(short = "l", long = "log", value_name = "LOG_PATTERN")] + #[structopt(short = "l", long, value_name = "LOG_PATTERN")] pub log: Vec, } -- GitLab From 91f8cedbea8fb6ea7956e1192f40806eaacbe4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 27 May 2020 00:28:41 +0200 Subject: [PATCH 065/280] Make `wasm-builder` check before copy/write files if the content is the same (#6149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make `wasm-builder` check before copy/write files if the content is the same * Update utils/wasm-builder/src/lib.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> --- utils/wasm-builder/src/lib.rs | 11 +++++++++++ utils/wasm-builder/src/wasm_project.rs | 7 +++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/utils/wasm-builder/src/lib.rs b/utils/wasm-builder/src/lib.rs index 9f9e77275a..a4c546c802 100644 --- a/utils/wasm-builder/src/lib.rs +++ b/utils/wasm-builder/src/lib.rs @@ -185,6 +185,17 @@ fn write_file_if_changed(file: PathBuf, content: String) { } } +/// Copy `src` to `dst` if the `dst` does not exist or is different. +fn copy_file_if_changed(src: PathBuf, dst: PathBuf) { + let src_file = fs::read_to_string(&src).ok(); + let dst_file = fs::read_to_string(&dst).ok(); + + if src_file != dst_file { + fs::copy(&src, &dst) + .expect(&format!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display())); + } +} + /// Get a cargo command that compiles with nightly fn get_nightly_cargo() -> CargoCommand { let env_cargo = CargoCommand::new( diff --git a/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs index 69dbc7882b..4e927f4e85 100644 --- a/utils/wasm-builder/src/wasm_project.rs +++ b/utils/wasm-builder/src/wasm_project.rs @@ -302,10 +302,10 @@ fn create_wasm_workspace_project(wasm_workspace: &Path, workspace_root_path: &Pa wasm_workspace_toml.insert("patch".into(), patch.into()); } - fs::write( + write_file_if_changed( wasm_workspace.join("Cargo.toml"), toml::to_string_pretty(&wasm_workspace_toml).expect("Wasm workspace toml is valid; qed"), - ).expect("WASM workspace `Cargo.toml` writing can not fail; qed"); + ); } /// Get a list of enabled features for the project. @@ -382,8 +382,7 @@ fn create_project(cargo_manifest: &Path, wasm_workspace: &Path, crate_metadata: if let Some(crate_lock_file) = find_cargo_lock(cargo_manifest) { // Use the `Cargo.lock` of the main project. - fs::copy(crate_lock_file, wasm_workspace.join("Cargo.lock")) - .expect("Copying the `Cargo.lock` can not fail; qed"); + crate::copy_file_if_changed(crate_lock_file, wasm_workspace.join("Cargo.lock")); } project_folder -- GitLab From 8e3c4aae984c3539fb25f86eb8b1ed6cc7960140 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Wed, 27 May 2020 20:18:53 +1200 Subject: [PATCH 066/280] fix lstrip in biguint (#6151) * add failing test for multiply_by_rational * fix BigUint * fix length * bump version * merge tests --- bin/node/runtime/src/lib.rs | 2 +- primitives/arithmetic/src/biguint.rs | 10 +++++----- primitives/arithmetic/src/rational128.rs | 9 +++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 67e988f496..a3723f049a 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 251, - impl_version: 0, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/primitives/arithmetic/src/biguint.rs b/primitives/arithmetic/src/biguint.rs index a1e5ea2666..41e2c759a5 100644 --- a/primitives/arithmetic/src/biguint.rs +++ b/primitives/arithmetic/src/biguint.rs @@ -151,7 +151,7 @@ impl BigUint { // has the ability to cause this. There is nothing to do if the number already has 1 // limb only. call it a day and return. if self.len().is_zero() { return; } - let index = self.digits.iter().position(|&elem| elem != 0).unwrap_or(0); + let index = self.digits.iter().position(|&elem| elem != 0).unwrap_or(self.len() - 1); if index > 0 { self.digits = self.digits[index..].to_vec() @@ -581,19 +581,19 @@ pub mod tests { fn strip_works() { let mut a = BigUint::from_limbs(&[0, 1, 0]); a.lstrip(); - assert_eq!(a, BigUint { digits: vec![1, 0] }); + assert_eq!(a.digits, vec![1, 0]); let mut a = BigUint::from_limbs(&[0, 0, 1]); a.lstrip(); - assert_eq!(a, BigUint { digits: vec![1] }); + assert_eq!(a.digits, vec![1]); let mut a = BigUint::from_limbs(&[0, 0]); a.lstrip(); - assert_eq!(a, BigUint { digits: vec![0] }); + assert_eq!(a.digits, vec![0]); let mut a = BigUint::from_limbs(&[0, 0, 0]); a.lstrip(); - assert_eq!(a, BigUint { digits: vec![0] }); + assert_eq!(a.digits, vec![0]); } #[test] diff --git a/primitives/arithmetic/src/rational128.rs b/primitives/arithmetic/src/rational128.rs index 9d0d10921d..709af1d3b9 100644 --- a/primitives/arithmetic/src/rational128.rs +++ b/primitives/arithmetic/src/rational128.rs @@ -360,6 +360,15 @@ mod tests { multiply_by_rational(1_000_000_000, MAX128 / 8, MAX128 / 2).unwrap(), 250000000, ); + + assert_eq!( + multiply_by_rational( + 29459999999999999988000u128, + 1000000000000000000u128, + 10000000000000000000u128 + ).unwrap(), + 2945999999999999998800u128 + ); } #[test] -- GitLab From d166fcf2028b223a00d9c329898baf981a574008 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 27 May 2020 14:10:04 +0300 Subject: [PATCH 067/280] remover ancient code (#6157) --- bin/node/cli/src/service.rs | 77 ------------------------------------- 1 file changed, 77 deletions(-) diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index b738b5cf1f..05f168bd8b 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -432,83 +432,6 @@ mod tests { type AccountPublic = ::Signer; - #[cfg(feature = "rhd")] - fn test_sync() { - use sp_core::ed25519::Pair; - - use {service_test, Factory}; - use sp_consensus::{BlockImportParams, BlockOrigin}; - - let alice: Arc = Arc::new(Keyring::Alice.into()); - let bob: Arc = Arc::new(Keyring::Bob.into()); - let validators = vec![alice.public().0.into(), bob.public().0.into()]; - let keys: Vec<&ed25519::Pair> = vec![&*alice, &*bob]; - let dummy_runtime = ::tokio::runtime::Runtime::new().unwrap(); - let block_factory = |service: &::FullService| { - let block_id = BlockId::number(service.client().chain_info().best_number); - let parent_header = service.client().best_header(&block_id) - .expect("db error") - .expect("best block should exist"); - - futures::executor::block_on( - service.transaction_pool().maintain( - ChainEvent::NewBlock { - is_new_best: true, - id: block_id.clone(), - retracted: vec![], - header: parent_header, - }, - ) - ); - - let consensus_net = ConsensusNetwork::new(service.network(), service.client().clone()); - let proposer_factory = consensus::ProposerFactory { - client: service.client().clone(), - transaction_pool: service.transaction_pool().clone(), - network: consensus_net, - force_delay: 0, - handle: dummy_runtime.executor(), - }; - let (proposer, _, _) = proposer_factory.init(&parent_header, &validators, alice.clone()).unwrap(); - let block = proposer.propose().expect("Error making test block"); - BlockImportParams { - origin: BlockOrigin::File, - justification: Vec::new(), - internal_justification: Vec::new(), - finalized: false, - body: Some(block.extrinsics), - storage_changes: None, - header: block.header, - auxiliary: Vec::new(), - } - }; - let extrinsic_factory = - |service: &SyncService<::FullService>| - { - let payload = ( - 0, - Call::Balances(BalancesCall::transfer(RawAddress::Id(bob.public().0.into()), 69.into())), - Era::immortal(), - service.client().genesis_hash() - ); - let signature = alice.sign(&payload.encode()).into(); - let id = alice.public().0.into(); - let xt = UncheckedExtrinsic { - signature: Some((RawAddress::Id(id), signature, payload.0, Era::immortal())), - function: payload.1, - }.encode(); - let v: Vec = Decode::decode(&mut xt.as_slice()).unwrap(); - OpaqueExtrinsic(v) - }; - sc_service_test::sync( - sc_chain_spec::integration_test_config(), - |config| new_full(config), - |mut config| new_light(config), - block_factory, - extrinsic_factory, - ); - } - #[test] // It is "ignored", but the node-cli ignored tests are running on the CI. // This can be run locally with `cargo test --release -p node-cli test_sync -- --ignored`. -- GitLab From 4b09788469bc7dfbf1858bd1d435bee512f6021d Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 27 May 2020 13:11:09 +0200 Subject: [PATCH 068/280] Add subkey inspect-node-key (#6153) --- bin/utils/subkey/src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/utils/subkey/src/main.rs b/bin/utils/subkey/src/main.rs index 898e99f062..4153e769c9 100644 --- a/bin/utils/subkey/src/main.rs +++ b/bin/utils/subkey/src/main.rs @@ -267,6 +267,9 @@ fn get_app<'a, 'b>(usage: &'a str) -> App<'a, 'b> { If the value is a file, the file content is used as URI. \ If not given, you will be prompted for the URI.' "), + SubCommand::with_name("inspect-node-key") + .about("Print the peer ID corresponding to the node key in the given file") + .args_from_usage("[file] 'Name of file to read the secret key from'"), SubCommand::with_name("sign") .about("Sign a message, provided on STDIN, with a given (secret) key") .args_from_usage(" @@ -439,6 +442,17 @@ where ("inspect", Some(matches)) => { C::print_from_uri(&get_uri("uri", &matches)?, password, maybe_network, output); } + ("inspect-node-key", Some(matches)) => { + let file = matches.value_of("file").ok_or(Error::Static("Input file name is required"))?; + + let mut file_content = fs::read(file)?; + let secret = libp2p_ed25519::SecretKey::from_bytes(&mut file_content) + .map_err(|_| Error::Static("Bad node key file"))?; + let keypair = libp2p_ed25519::Keypair::from(secret); + let peer_id = PublicKey::Ed25519(keypair.public()).into_peer_id(); + + println!("{}", peer_id); + } ("sign", Some(matches)) => { let suri = get_uri("suri", &matches)?; let should_decode = matches.is_present("hex"); -- GitLab From 2d39ec2c4aaec1cc0f91fcb91734de8f408dc1b2 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Wed, 27 May 2020 14:40:07 +0200 Subject: [PATCH 069/280] Make Get const friendly + Clean the runtime files a bit. (#6132) * Make Get const friendly * Better doc * Grumble * Better doc * Clean runtime files more --- bin/node-template/runtime/src/lib.rs | 2 +- bin/node/runtime/src/lib.rs | 34 +++++++++------ bin/node/testing/src/genesis.rs | 8 ++-- frame/democracy/src/tests.rs | 2 +- frame/grandpa/src/mock.rs | 2 +- frame/offences/benchmarking/src/mock.rs | 2 +- frame/offences/src/mock.rs | 2 +- frame/scheduler/src/lib.rs | 2 +- frame/support/src/lib.rs | 55 +++++++++++++++++++++++-- frame/system/src/lib.rs | 2 +- primitives/arithmetic/src/per_things.rs | 27 ++++++++---- 11 files changed, 103 insertions(+), 35 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 55fa4cd4aa..68d4eeeb7a 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -128,7 +128,7 @@ parameter_types! { pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); /// Assume 10% of weight for average on_initialize calls. - pub const MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index a3723f049a..229aa3a9be 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -40,7 +40,7 @@ pub use node_primitives::{AccountId, Signature}; use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment}; use sp_api::impl_runtime_apis; use sp_runtime::{ - Permill, Perbill, Perquintill, Percent, ApplyExtrinsicResult, + Permill, Perbill, Perquintill, Percent, PerThing, ApplyExtrinsicResult, impl_opaque_keys, generic, create_runtime_str, ModuleId, }; use sp_runtime::curve::PiecewiseLinear; @@ -65,11 +65,11 @@ use static_assertions::const_assert; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -pub use pallet_timestamp::Call as TimestampCall; +#[cfg(any(feature = "std", test))] pub use pallet_balances::Call as BalancesCall; +#[cfg(any(feature = "std", test))] pub use frame_system::Call as SystemCall; -pub use pallet_contracts::Gas; -pub use frame_support::StorageValue; +#[cfg(any(feature = "std", test))] pub use pallet_staking::StakerStatus; /// Implementations of some helper traits passed into runtime modules as associated types. @@ -126,18 +126,22 @@ impl OnUnbalanced for DealWithFees { } } +const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10); parameter_types! { pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); /// Assume 10% of weight for average on_initialize calls. - pub const MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() - .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); + pub MaximumExtrinsicWeight: Weight = + AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT) + * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; } +const_assert!(AvailableBlockRatio::get().deconstruct() >= AVERAGE_ON_INITIALIZE_WEIGHT.deconstruct()); + impl frame_system::Trait for Runtime { type Origin = Origin; type Call = Call; @@ -183,7 +187,7 @@ impl pallet_utility::Trait for Runtime { } parameter_types! { - pub const MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); } impl pallet_scheduler::Trait for Runtime { @@ -229,10 +233,16 @@ impl pallet_balances::Trait for Runtime { parameter_types! { pub const TransactionByteFee: Balance = 10 * MILLICENTS; - // for a sane configuration, this should always be less than `AvailableBlockRatio`. pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); } +// for a sane configuration, this should always be less than `AvailableBlockRatio`. +const_assert!( + TargetBlockFullness::get().deconstruct() < + (AvailableBlockRatio::get().deconstruct() as ::Inner) + * (::ACCURACY / ::ACCURACY as ::Inner) +); + impl pallet_transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; @@ -399,17 +409,17 @@ impl pallet_collective::Trait for Runtime { type MaxProposals = CouncilMaxProposals; } -const DESIRED_MEMBERS: u32 = 13; parameter_types! { pub const CandidacyBond: Balance = 10 * DOLLARS; pub const VotingBond: Balance = 1 * DOLLARS; pub const TermDuration: BlockNumber = 7 * DAYS; - pub const DesiredMembers: u32 = DESIRED_MEMBERS; + pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 7; pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect"; } + // Make sure that there are no more than `MAX_MEMBERS` members elected via phragmen. -const_assert!(DESIRED_MEMBERS <= pallet_collective::MAX_MEMBERS); +const_assert!(DesiredMembers::get() <= pallet_collective::MAX_MEMBERS); impl pallet_elections_phragmen::Trait for Runtime { type ModuleId = ElectionsPhragmenModuleId; @@ -586,7 +596,7 @@ impl pallet_im_online::Trait for Runtime { } parameter_types! { - pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl pallet_offences::Trait for Runtime { diff --git a/bin/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs index d9c7e24709..2bbae96cf4 100644 --- a/bin/node/testing/src/genesis.rs +++ b/bin/node/testing/src/genesis.rs @@ -23,7 +23,7 @@ use sp_keyring::{Ed25519Keyring, Sr25519Keyring}; use node_runtime::{ GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, SystemConfig, GrandpaConfig, IndicesConfig, ContractsConfig, SocietyConfig, WASM_BINARY, - AccountId, + AccountId, StakerStatus, }; use node_runtime::constants::currency::*; use sp_core::ChangesTrieConfiguration; @@ -87,9 +87,9 @@ pub fn config_endowed( }), pallet_staking: Some(StakingConfig { stakers: vec![ - (dave(), alice(), 111 * DOLLARS, pallet_staking::StakerStatus::Validator), - (eve(), bob(), 100 * DOLLARS, pallet_staking::StakerStatus::Validator), - (ferdie(), charlie(), 100 * DOLLARS, pallet_staking::StakerStatus::Validator) + (dave(), alice(), 111 * DOLLARS, StakerStatus::Validator), + (eve(), bob(), 100 * DOLLARS, StakerStatus::Validator), + (ferdie(), charlie(), 100 * DOLLARS, StakerStatus::Validator) ], validator_count: 3, minimum_validator_count: 0, diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index c567aec0b6..103ac6a84b 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -110,7 +110,7 @@ impl frame_system::Trait for Test { type OnKilledAccount = (); } parameter_types! { - pub const MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); } impl pallet_scheduler::Trait for Test { type Event = Event; diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index e429212cef..08329fbb70 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -232,7 +232,7 @@ impl staking::Trait for Test { } parameter_types! { - pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl offences::Trait for Test { diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 15b46fc194..28263a5292 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -187,7 +187,7 @@ impl pallet_im_online::Trait for Test { } parameter_types! { - pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl pallet_offences::Trait for Test { diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index b3f35e0171..30d2409a00 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -122,7 +122,7 @@ impl frame_system::Trait for Runtime { } parameter_types! { - pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl Trait for Runtime { diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 4fefe12a8e..687fe46d16 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -515,7 +515,7 @@ mod tests { type Event = (); } parameter_types! { - pub const MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); } impl Trait for Test { type Event = (); diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 68d56ee955..471dd72a74 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -84,27 +84,62 @@ pub use sp_runtime::{self, ConsensusEngineId, print, traits::Printable}; #[derive(Debug)] pub enum Never {} -/// Macro for easily creating a new implementation of the `Get` trait. Use similarly to -/// how you would declare a `const`: +/// Macro for easily creating a new implementation of the `Get` trait. If `const` token is used, the +/// rhs of the expression must be `const`-only, and get is implemented as `const`: /// -/// ```no_compile +/// ``` +/// # use frame_support::traits::Get; +/// # use frame_support::parameter_types; +/// // This function cannot be used in a const context. +/// fn non_const_expression() -> u64 { 99 } +/// +/// const FIXED_VALUE: u64 = 10; /// parameter_types! { -/// pub const Argument: u64 = 42; +/// pub const Argument: u64 = 42 + FIXED_VALUE; +/// pub OtherArgument: u64 = non_const_expression(); /// } +/// /// trait Config { /// type Parameter: Get; +/// type OtherParameter: Get; /// } +/// /// struct Runtime; /// impl Config for Runtime { /// type Parameter = Argument; +/// type OtherParameter = OtherArgument; /// } /// ``` +/// +/// Invalid example: +/// +/// ```compile_fail +/// # use frame_support::traits::Get; +/// # use frame_support::parameter_types; +/// // This function cannot be used in a const context. +/// fn non_const_expression() -> u64 { 99 } +/// +/// parameter_types! { +/// pub const Argument: u64 = non_const_expression(); +/// } +/// ``` + #[macro_export] macro_rules! parameter_types { ( $( #[ $attr:meta ] )* $vis:vis const $name:ident: $type:ty = $value:expr; $( $rest:tt )* + ) => ( + $( #[ $attr ] )* + $vis struct $name; + $crate::parameter_types!{IMPL_CONST $name , $type , $value} + $crate::parameter_types!{ $( $rest )* } + ); + ( + $( #[ $attr:meta ] )* + $vis:vis $name:ident: $type:ty = $value:expr; + $( $rest:tt )* ) => ( $( #[ $attr ] )* $vis struct $name; @@ -112,6 +147,18 @@ macro_rules! parameter_types { $crate::parameter_types!{ $( $rest )* } ); () => (); + (IMPL_CONST $name:ident , $type:ty , $value:expr) => { + impl $name { + pub const fn get() -> $type { + $value + } + } + impl> $crate::traits::Get for $name { + fn get() -> I { + I::from($value) + } + } + }; (IMPL $name:ident , $type:ty , $value:expr) => { impl $name { pub fn get() -> $type { diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 4fa826ce89..8360f6c4cb 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -1877,7 +1877,7 @@ pub(crate) mod tests { pub const MaximumExtrinsicWeight: Weight = 768; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const MaximumBlockLength: u32 = 1024; - pub const Version: RuntimeVersion = RuntimeVersion { + pub Version: RuntimeVersion = RuntimeVersion { spec_name: sp_version::create_runtime_str!("test"), impl_name: sp_version::create_runtime_str!("system-test"), authoring_version: 1, diff --git a/primitives/arithmetic/src/per_things.rs b/primitives/arithmetic/src/per_things.rs index b50b35f7af..cf5aa6e4cb 100644 --- a/primitives/arithmetic/src/per_things.rs +++ b/primitives/arithmetic/src/per_things.rs @@ -383,7 +383,6 @@ macro_rules! implement_per_thing { impl $name { /// From an explicitly defined number of parts per maximum of the type. /// - /// This can be called at compile time. // needed only for peru16. Since peru16 is the only type in which $max == // $type::max_value(), rustc is being a smart-a** here by warning that the comparison // is not needed. @@ -399,9 +398,9 @@ macro_rules! implement_per_thing { Self(([x, 100][(x > 100) as usize] as $upper_type * $max as $upper_type / 100) as $type) } - /// See [`PerThing::one`]. - pub fn one() -> Self { - ::one() + /// See [`PerThing::one`] + pub const fn one() -> Self { + Self::from_parts($max) } /// See [`PerThing::is_one`]. @@ -410,8 +409,8 @@ macro_rules! implement_per_thing { } /// See [`PerThing::zero`]. - pub fn zero() -> Self { - ::zero() + pub const fn zero() -> Self { + Self::from_parts(0) } /// See [`PerThing::is_zero`]. @@ -420,8 +419,8 @@ macro_rules! implement_per_thing { } /// See [`PerThing::deconstruct`]. - pub fn deconstruct(self) -> $type { - PerThing::deconstruct(self) + pub const fn deconstruct(self) -> $type { + self.0 } /// See [`PerThing::square`]. @@ -1130,6 +1129,18 @@ macro_rules! implement_per_thing { 1, ); } + + #[test] + #[allow(unused)] + fn const_fns_work() { + const C1: $name = $name::from_percent(50); + const C2: $name = $name::one(); + const C3: $name = $name::zero(); + const C4: $name = $name::from_parts(1); + + // deconstruct is also const, hence it can be called in const rhs. + const C5: bool = C1.deconstruct() == 0; + } } }; } -- GitLab From 993e2e46fc3173acf18c00a00a6807458336675b Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 27 May 2020 15:53:07 +0200 Subject: [PATCH 070/280] Peerset cleanup (#6078) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move methods from Peerset to peers structs * Remove priority_only from peersstate * Refactor PSM * Don't test private fields * Update sc_network * Remove wrong comment * Also fix small stupidity when setting reserved_only * Put back priority_group * Restore priority groups as before * Apply suggestions from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Do the reserved only change * Update client/peerset/src/lib.rs Co-authored-by: Arkadiy Paronyan * Use HashSet::difference Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: Arkadiy Paronyan --- client/peerset/src/lib.rs | 185 +++++++++---- client/peerset/src/peersstate.rs | 461 +++++++++---------------------- client/peerset/tests/fuzz.rs | 4 +- 3 files changed, 277 insertions(+), 373 deletions(-) diff --git a/client/peerset/src/lib.rs b/client/peerset/src/lib.rs index e5e8ec826f..a224965035 100644 --- a/client/peerset/src/lib.rs +++ b/client/peerset/src/lib.rs @@ -182,9 +182,13 @@ pub struct PeersetConfig { /// errors. #[derive(Debug)] pub struct Peerset { + /// Underlying data structure for the nodes's states. data: peersstate::PeersState, /// If true, we only accept reserved nodes. reserved_only: bool, + /// Lists of nodes that don't occupy slots and that we should try to always be connected to. + /// Is kept in sync with the list of reserved nodes in [`Peerset::data`]. + priority_groups: HashMap>, /// Receiver for messages from the `PeersetHandle` and from `tx`. rx: TracingUnboundedReceiver, /// Sending side of `rx`. @@ -209,17 +213,18 @@ impl Peerset { let now = Instant::now(); let mut peerset = Peerset { - data: peersstate::PeersState::new(config.in_peers, config.out_peers, config.reserved_only), + data: peersstate::PeersState::new(config.in_peers, config.out_peers), tx, rx, reserved_only: config.reserved_only, + priority_groups: config.priority_groups.clone().into_iter().collect(), message_queue: VecDeque::new(), created: now, latest_time_update: now, }; - for (group, nodes) in config.priority_groups { - peerset.data.set_priority_group(&group, nodes); + for node in config.priority_groups.into_iter().flat_map(|(_, l)| l) { + peerset.data.add_no_slot_node(node); } for peer_id in config.bootnodes { @@ -235,61 +240,92 @@ impl Peerset { } fn on_add_reserved_peer(&mut self, peer_id: PeerId) { - let mut reserved = self.data.get_priority_group(RESERVED_NODES).unwrap_or_default(); - reserved.insert(peer_id); - self.data.set_priority_group(RESERVED_NODES, reserved); - self.alloc_slots(); + self.on_add_to_priority_group(RESERVED_NODES, peer_id); } fn on_remove_reserved_peer(&mut self, peer_id: PeerId) { - let mut reserved = self.data.get_priority_group(RESERVED_NODES).unwrap_or_default(); - reserved.remove(&peer_id); - self.data.set_priority_group(RESERVED_NODES, reserved); - match self.data.peer(&peer_id) { - peersstate::Peer::Connected(peer) => { - if self.reserved_only { - peer.disconnect(); - self.message_queue.push_back(Message::Drop(peer_id)); - } - } - peersstate::Peer::NotConnected(_) => {}, - peersstate::Peer::Unknown(_) => {}, - } + self.on_remove_from_priority_group(RESERVED_NODES, peer_id); } fn on_set_reserved_only(&mut self, reserved_only: bool) { self.reserved_only = reserved_only; - self.data.set_priority_only(reserved_only); if self.reserved_only { - // Disconnect non-reserved nodes. - let reserved = self.data.get_priority_group(RESERVED_NODES).unwrap_or_default(); + // Disconnect all the nodes that aren't reserved. for peer_id in self.data.connected_peers().cloned().collect::>().into_iter() { + if self.priority_groups.get(RESERVED_NODES).map_or(false, |g| g.contains(&peer_id)) { + continue; + } + let peer = self.data.peer(&peer_id).into_connected() .expect("We are enumerating connected peers, therefore the peer is connected; qed"); - if !reserved.contains(&peer_id) { - peer.disconnect(); - self.message_queue.push_back(Message::Drop(peer_id)); - } + peer.disconnect(); + self.message_queue.push_back(Message::Drop(peer_id)); } + } else { self.alloc_slots(); } } fn on_set_priority_group(&mut self, group_id: &str, peers: HashSet) { - self.data.set_priority_group(group_id, peers); - self.alloc_slots(); + // Determine the difference between the current group and the new list. + let (to_insert, to_remove) = { + let current_group = self.priority_groups.entry(group_id.to_owned()).or_default(); + let to_insert = peers.difference(current_group) + .cloned().collect::>(); + let to_remove = current_group.difference(&peers) + .cloned().collect::>(); + (to_insert, to_remove) + }; + + // Enumerate elements in `peers` not in `current_group`. + for peer_id in &to_insert { + // We don't call `on_add_to_priority_group` here in order to avoid calling + // `alloc_slots` all the time. + self.priority_groups.entry(group_id.to_owned()).or_default().insert(peer_id.clone()); + self.data.add_no_slot_node(peer_id.clone()); + } + + // Enumerate elements in `current_group` not in `peers`. + for peer in to_remove { + self.on_remove_from_priority_group(group_id, peer); + } + + if !to_insert.is_empty() { + self.alloc_slots(); + } } fn on_add_to_priority_group(&mut self, group_id: &str, peer_id: PeerId) { - self.data.add_to_priority_group(group_id, peer_id); + self.priority_groups.entry(group_id.to_owned()).or_default().insert(peer_id.clone()); + self.data.add_no_slot_node(peer_id); self.alloc_slots(); } fn on_remove_from_priority_group(&mut self, group_id: &str, peer_id: PeerId) { - self.data.remove_from_priority_group(group_id, &peer_id); - self.alloc_slots(); + if let Some(priority_group) = self.priority_groups.get_mut(group_id) { + if !priority_group.remove(&peer_id) { + // `PeerId` wasn't in the group in the first place. + return; + } + } else { + // Group doesn't exist, so the `PeerId` can't be in it. + return; + } + + // If that `PeerId` isn't in any other group, then it is no longer no-slot-occupying. + if !self.priority_groups.values().any(|l| l.contains(&peer_id)) { + self.data.remove_no_slot_node(&peer_id); + } + + // Disconnect the peer if necessary. + if group_id != RESERVED_NODES && self.reserved_only { + if let peersstate::Peer::Connected(peer) = self.data.peer(&peer_id) { + peer.disconnect(); + self.message_queue.push_back(Message::Drop(peer_id)); + } + } } fn on_report_peer(&mut self, peer_id: PeerId, change: ReputationChange) { @@ -376,25 +412,82 @@ impl Peerset { fn alloc_slots(&mut self) { self.update_time(); - // Try to grab the next node to attempt to connect to. - while let Some(next) = { - if self.reserved_only { - self.data.priority_not_connected_peer_from_group(RESERVED_NODES) - } else { - self.data.priority_not_connected_peer() - } - } { + // Try to connect to all the reserved nodes that we are not connected to. + loop { + let next = { + let data = &mut self.data; + self.priority_groups + .get(RESERVED_NODES) + .into_iter() + .flatten() + .filter(move |n| { + data.peer(n).into_connected().is_none() + }) + .next() + .cloned() + }; + + let next = match next { + Some(n) => n, + None => break, + }; + + let next = match self.data.peer(&next) { + peersstate::Peer::Unknown(n) => n.discover(), + peersstate::Peer::NotConnected(n) => n, + peersstate::Peer::Connected(_) => { + debug_assert!(false, "State inconsistency: not connected state"); + break; + } + }; + match next.try_outgoing() { Ok(conn) => self.message_queue.push_back(Message::Connect(conn.into_peer_id())), Err(_) => break, // No more slots available. } } + // Nothing more to do if we're in reserved mode. + if self.reserved_only { + return; + } + + // Try to connect to all the nodes in priority groups and that we are not connected to. loop { - if self.reserved_only { - break + let next = { + let data = &mut self.data; + self.priority_groups + .values() + .flatten() + .filter(move |n| { + data.peer(n).into_connected().is_none() + }) + .next() + .cloned() + }; + + let next = match next { + Some(n) => n, + None => break, + }; + + let next = match self.data.peer(&next) { + peersstate::Peer::Unknown(n) => n.discover(), + peersstate::Peer::NotConnected(n) => n, + peersstate::Peer::Connected(_) => { + debug_assert!(false, "State inconsistency: not connected state"); + break; + } + }; + + match next.try_outgoing() { + Ok(conn) => self.message_queue.push_back(Message::Connect(conn.into_peer_id())), + Err(_) => break, // No more slots available. } + } + // Now, we try to connect to non-priority nodes. + loop { // Try to grab the next node to attempt to connect to. let next = match self.data.highest_not_connected_peer() { Some(p) => p, @@ -529,9 +622,9 @@ impl Peerset { self.data.peers().len() } - /// Returns priority group by id. - pub fn get_priority_group(&self, group_id: &str) -> Option> { - self.data.get_priority_group(group_id) + /// Returns the content of a priority group. + pub fn priority_group(&self, group_id: &str) -> Option> { + self.priority_groups.get(group_id).map(|l| l.iter()) } } @@ -583,7 +676,6 @@ mod tests { assert_eq!(message, expected_message); peerset = p; } - assert!(peerset.message_queue.is_empty(), peerset.message_queue); peerset } @@ -713,4 +805,3 @@ mod tests { futures::executor::block_on(fut); } } - diff --git a/client/peerset/src/peersstate.rs b/client/peerset/src/peersstate.rs index 843ec0a360..59879f629e 100644 --- a/client/peerset/src/peersstate.rs +++ b/client/peerset/src/peersstate.rs @@ -14,10 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Contains the state storage behind the peerset. +//! Reputation and slots allocation system behind the peerset. +//! +//! The [`PeersState`] state machine is responsible for managing the reputation and allocating +//! slots. It holds a list of nodes, each associated with a reputation value and whether we are +//! connected or not to this node. Thanks to this list, it knows how many slots are occupied. It +//! also holds a list of nodes which don't occupy slots. +//! +//! > Note: This module is purely dedicated to managing slots and reputations. Features such as +//! > for example connecting to some nodes in priority should be added outside of this +//! > module, rather than inside. use libp2p::PeerId; -use log::{error, warn}; +use log::error; use std::{borrow::Cow, collections::{HashSet, HashMap}}; use wasm_timer::Instant; @@ -37,23 +46,24 @@ pub struct PeersState { /// sort, to make the logic easier. nodes: HashMap, - /// Number of non-priority nodes for which the `ConnectionState` is `In`. + /// Number of slot-occupying nodes for which the `ConnectionState` is `In`. num_in: u32, - /// Number of non-priority nodes for which the `ConnectionState` is `In`. + /// Number of slot-occupying nodes for which the `ConnectionState` is `In`. num_out: u32, - /// Maximum allowed number of non-priority nodes for which the `ConnectionState` is `In`. + /// Maximum allowed number of slot-occupying nodes for which the `ConnectionState` is `In`. max_in: u32, - /// Maximum allowed number of non-priority nodes for which the `ConnectionState` is `Out`. + /// Maximum allowed number of slot-occupying nodes for which the `ConnectionState` is `Out`. max_out: u32, - /// Priority groups. Each group is identified by a string ID and contains a set of peer IDs. - priority_nodes: HashMap>, - - /// Only allow connections to/from peers in a priority group. - priority_only: bool, + /// List of node identities (discovered or not) that don't occupy slots. + /// + /// Note for future readers: this module is purely dedicated to managing slots. If you are + /// considering adding more features, please consider doing so outside of this module rather + /// than inside. + no_slot_nodes: HashSet, } /// State of a single node that we know about. @@ -106,15 +116,14 @@ impl ConnectionState { impl PeersState { /// Builds a new empty `PeersState`. - pub fn new(in_peers: u32, out_peers: u32, priority_only: bool) -> Self { + pub fn new(in_peers: u32, out_peers: u32) -> Self { PeersState { nodes: HashMap::new(), num_in: 0, num_out: 0, max_in: in_peers, max_out: out_peers, - priority_nodes: HashMap::new(), - priority_only, + no_slot_nodes: HashSet::new(), } } @@ -157,34 +166,6 @@ impl PeersState { .map(|(p, _)| p) } - /// Returns the first priority peer that we are not connected to. - /// - /// If multiple nodes are prioritized, which one is returned is unspecified. - pub fn priority_not_connected_peer(&mut self) -> Option { - let id = self.priority_nodes.values() - .flatten() - .find(|&id| self.nodes.get(id).map_or(false, |node| !node.connection_state.is_connected())) - .cloned(); - id.map(move |id| NotConnectedPeer { - state: self, - peer_id: Cow::Owned(id), - }) - } - - /// Returns the first priority peer that we are not connected to. - /// - /// If multiple nodes are prioritized, which one is returned is unspecified. - pub fn priority_not_connected_peer_from_group(&mut self, group_id: &str) -> Option { - let id = self.priority_nodes.get(group_id) - .and_then(|group| group.iter() - .find(|&id| self.nodes.get(id).map_or(false, |node| !node.connection_state.is_connected())) - .cloned()); - id.map(move |id| NotConnectedPeer { - state: self, - peer_id: Cow::Owned(id), - }) - } - /// Returns the peer with the highest reputation and that we are not connected to. /// /// If multiple nodes have the same reputation, which one is returned is unspecified. @@ -212,170 +193,40 @@ impl PeersState { } } - fn disconnect(&mut self, peer_id: &PeerId) { - let is_priority = self.is_priority(peer_id); - if let Some(mut node) = self.nodes.get_mut(peer_id) { - if !is_priority { - match node.connection_state { - ConnectionState::In => self.num_in -= 1, - ConnectionState::Out => self.num_out -= 1, - ConnectionState::NotConnected { .. } => - debug_assert!(false, "State inconsistency: disconnecting a disconnected node") - } - } - node.connection_state = ConnectionState::NotConnected { - last_connected: Instant::now(), - }; - } else { - warn!(target: "peerset", "Attempting to disconnect unknown peer {}", peer_id); - } - } - - /// Sets the peer as connected with an outgoing connection. - fn try_outgoing(&mut self, peer_id: &PeerId) -> bool { - let is_priority = self.is_priority(peer_id); - - // We are only accepting connections from priority nodes. - if !is_priority && self.priority_only { - return false; - } - - // Note that it is possible for num_out to be strictly superior to the max, in case we were - // connected to reserved node then marked them as not reserved. - if self.num_out >= self.max_out && !is_priority { - return false; + /// Add a node to the list of nodes that don't occupy slots. + /// + /// Has no effect if the peer was already in the group. + pub fn add_no_slot_node(&mut self, peer_id: PeerId) { + // Reminder: `HashSet::insert` returns false if the node was already in the set + if !self.no_slot_nodes.insert(peer_id.clone()) { + return; } - if let Some(mut peer) = self.nodes.get_mut(peer_id) { - peer.connection_state = ConnectionState::Out; - if !is_priority { - self.num_out += 1; + if let Some(peer) = self.nodes.get_mut(&peer_id) { + match peer.connection_state { + ConnectionState::In => self.num_in -= 1, + ConnectionState::Out => self.num_out -= 1, + ConnectionState::NotConnected { .. } => {}, } - return true; } - false } - /// Tries to accept the peer as an incoming connection. - /// - /// If there are enough slots available, switches the node to "connected" and returns `true`. If - /// the slots are full, the node stays "not connected" and we return `false`. + /// Removes a node from the list of nodes that don't occupy slots. /// - /// Note that reserved nodes don't count towards the number of slots. - fn try_accept_incoming(&mut self, peer_id: &PeerId) -> bool { - let is_priority = self.is_priority(peer_id); - - // We are only accepting connections from priority nodes. - if !is_priority && self.priority_only { - return false; + /// Has no effect if the peer was not in the group. + pub fn remove_no_slot_node(&mut self, peer_id: &PeerId) { + // Reminder: `HashSet::remove` returns false if the node was already not in the set + if !self.no_slot_nodes.remove(peer_id) { + return; } - // Note that it is possible for num_in to be strictly superior to the max, in case we were - // connected to reserved node then marked them as not reserved. - if self.num_in >= self.max_in && !is_priority { - return false; - } - if let Some(mut peer) = self.nodes.get_mut(peer_id) { - peer.connection_state = ConnectionState::In; - if !is_priority { - self.num_in += 1; + if let Some(peer) = self.nodes.get_mut(peer_id) { + match peer.connection_state { + ConnectionState::In => self.num_in += 1, + ConnectionState::Out => self.num_out += 1, + ConnectionState::NotConnected { .. } => {}, } - return true; } - false - } - - /// Sets priority group - pub fn set_priority_group(&mut self, group_id: &str, peers: HashSet) { - // update slot counters - let all_other_groups: HashSet<_> = self.priority_nodes - .iter() - .filter(|(g, _)| *g != group_id) - .flat_map(|(_, id)| id.clone()) - .collect(); - let existing_group = self.priority_nodes.remove(group_id).unwrap_or_default(); - for id in existing_group { - // update slots for nodes that are no longer priority - if !all_other_groups.contains(&id) { - if let Some(peer) = self.nodes.get_mut(&id) { - match peer.connection_state { - ConnectionState::In => self.num_in += 1, - ConnectionState::Out => self.num_out += 1, - ConnectionState::NotConnected { .. } => {}, - } - } - } - } - - for id in &peers { - // update slots for nodes that become priority - if !all_other_groups.contains(id) { - let peer = self.nodes.entry(id.clone()).or_default(); - match peer.connection_state { - ConnectionState::In => self.num_in -= 1, - ConnectionState::Out => self.num_out -= 1, - ConnectionState::NotConnected { .. } => {}, - } - } - } - self.priority_nodes.insert(group_id.into(), peers); - } - - /// Add a peer to a priority group. - pub fn add_to_priority_group(&mut self, group_id: &str, peer_id: PeerId) { - let mut peers = self.priority_nodes.get(group_id).cloned().unwrap_or_default(); - peers.insert(peer_id); - self.set_priority_group(group_id, peers); - } - - /// Remove a peer from a priority group. - pub fn remove_from_priority_group(&mut self, group_id: &str, peer_id: &PeerId) { - let mut peers = self.priority_nodes.get(group_id).cloned().unwrap_or_default(); - peers.remove(peer_id); - self.set_priority_group(group_id, peers); - } - - /// Get priority group content. - pub fn get_priority_group(&self, group_id: &str) -> Option> { - self.priority_nodes.get(group_id).cloned() - } - - /// Set whether to only allow connections to/from peers in a priority group. - /// Calling this method does not affect any existing connection, e.g. - /// enabling priority only will not disconnect from any non-priority peers - /// we are already connected to, only future incoming/outgoing connection - /// attempts will be affected. - pub fn set_priority_only(&mut self, priority: bool) { - self.priority_only = priority; - } - - /// Check that node is any priority group. - fn is_priority(&self, peer_id: &PeerId) -> bool { - self.priority_nodes.iter().any(|(_, group)| group.contains(peer_id)) - } - - /// Returns the reputation value of the node. - fn reputation(&self, peer_id: &PeerId) -> i32 { - self.nodes.get(peer_id).map_or(0, |p| p.reputation) - } - - /// Sets the reputation of the peer. - fn set_reputation(&mut self, peer_id: &PeerId, value: i32) { - let node = self.nodes - .entry(peer_id.clone()) - .or_default(); - node.reputation = value; - } - - /// Performs an arithmetic addition on the reputation score of that peer. - /// - /// In case of overflow, the value will be capped. - /// If the peer is unknown to us, we insert it and consider that it has a reputation of 0. - fn add_reputation(&mut self, peer_id: &PeerId, modifier: i32) { - let node = self.nodes - .entry(peer_id.clone()) - .or_default(); - node.reputation = node.reputation.saturating_add(modifier); } } @@ -437,7 +288,23 @@ impl<'a> ConnectedPeer<'a> { /// Switches the peer to "not connected". pub fn disconnect(self) -> NotConnectedPeer<'a> { - self.state.disconnect(&self.peer_id); + let is_no_slot_occupy = self.state.no_slot_nodes.contains(&*self.peer_id); + if let Some(mut node) = self.state.nodes.get_mut(&*self.peer_id) { + if !is_no_slot_occupy { + match node.connection_state { + ConnectionState::In => self.state.num_in -= 1, + ConnectionState::Out => self.state.num_out -= 1, + ConnectionState::NotConnected { .. } => + debug_assert!(false, "State inconsistency: disconnecting a disconnected node") + } + } + node.connection_state = ConnectionState::NotConnected { + last_connected: Instant::now(), + }; + } else { + debug_assert!(false, "State inconsistency: disconnecting a disconnected node"); + } + NotConnectedPeer { state: self.state, peer_id: self.peer_id, @@ -446,19 +313,27 @@ impl<'a> ConnectedPeer<'a> { /// Returns the reputation value of the node. pub fn reputation(&self) -> i32 { - self.state.reputation(&self.peer_id) + self.state.nodes.get(&*self.peer_id).map_or(0, |p| p.reputation) } /// Sets the reputation of the peer. pub fn set_reputation(&mut self, value: i32) { - self.state.set_reputation(&self.peer_id, value) + if let Some(node) = self.state.nodes.get_mut(&*self.peer_id) { + node.reputation = value; + } else { + debug_assert!(false, "State inconsistency: set_reputation on an unknown node"); + } } /// Performs an arithmetic addition on the reputation score of that peer. /// /// In case of overflow, the value will be capped. pub fn add_reputation(&mut self, modifier: i32) { - self.state.add_reputation(&self.peer_id, modifier) + if let Some(node) = self.state.nodes.get_mut(&*self.peer_id) { + node.reputation = node.reputation.saturating_add(modifier); + } else { + debug_assert!(false, "State inconsistency: add_reputation on an unknown node"); + } } } @@ -520,16 +395,29 @@ impl<'a> NotConnectedPeer<'a> { /// If there are enough slots available, switches the node to "connected" and returns `Ok`. If /// the slots are full, the node stays "not connected" and we return `Err`. /// - /// Note that priority nodes don't count towards the number of slots. + /// Non-slot-occupying nodes don't count towards the number of slots. pub fn try_outgoing(self) -> Result, NotConnectedPeer<'a>> { - if self.state.try_outgoing(&self.peer_id) { - Ok(ConnectedPeer { - state: self.state, - peer_id: self.peer_id, - }) + let is_no_slot_occupy = self.state.no_slot_nodes.contains(&*self.peer_id); + + // Note that it is possible for num_out to be strictly superior to the max, in case we were + // connected to reserved node then marked them as not reserved. + if self.state.num_out >= self.state.max_out && !is_no_slot_occupy { + return Err(self); + } + + if let Some(mut peer) = self.state.nodes.get_mut(&*self.peer_id) { + peer.connection_state = ConnectionState::Out; + if !is_no_slot_occupy { + self.state.num_out += 1; + } } else { - Err(self) + debug_assert!(false, "State inconsistency: try_outgoing on an unknown node"); } + + Ok(ConnectedPeer { + state: self.state, + peer_id: self.peer_id, + }) } /// Tries to accept the peer as an incoming connection. @@ -537,34 +425,54 @@ impl<'a> NotConnectedPeer<'a> { /// If there are enough slots available, switches the node to "connected" and returns `Ok`. If /// the slots are full, the node stays "not connected" and we return `Err`. /// - /// Note that priority nodes don't count towards the number of slots. + /// Non-slot-occupying nodes don't count towards the number of slots. pub fn try_accept_incoming(self) -> Result, NotConnectedPeer<'a>> { - if self.state.try_accept_incoming(&self.peer_id) { - Ok(ConnectedPeer { - state: self.state, - peer_id: self.peer_id, - }) + let is_no_slot_occupy = self.state.no_slot_nodes.contains(&*self.peer_id); + + // Note that it is possible for num_in to be strictly superior to the max, in case we were + // connected to reserved node then marked them as not reserved. + if self.state.num_in >= self.state.max_in && !is_no_slot_occupy { + return Err(self); + } + + if let Some(mut peer) = self.state.nodes.get_mut(&*self.peer_id) { + peer.connection_state = ConnectionState::In; + if !is_no_slot_occupy { + self.state.num_in += 1; + } } else { - Err(self) + debug_assert!(false, "State inconsistency: try_accept_incoming on an unknown node"); } + + Ok(ConnectedPeer { + state: self.state, + peer_id: self.peer_id, + }) } /// Returns the reputation value of the node. pub fn reputation(&self) -> i32 { - self.state.reputation(&self.peer_id) + self.state.nodes.get(&*self.peer_id).map_or(0, |p| p.reputation) } /// Sets the reputation of the peer. pub fn set_reputation(&mut self, value: i32) { - self.state.set_reputation(&self.peer_id, value) + if let Some(node) = self.state.nodes.get_mut(&*self.peer_id) { + node.reputation = value; + } else { + debug_assert!(false, "State inconsistency: set_reputation on an unknown node"); + } } /// Performs an arithmetic addition on the reputation score of that peer. /// /// In case of overflow, the value will be capped. - /// If the peer is unknown to us, we insert it and consider that it has a reputation of 0. pub fn add_reputation(&mut self, modifier: i32) { - self.state.add_reputation(&self.peer_id, modifier) + if let Some(node) = self.state.nodes.get_mut(&*self.peer_id) { + node.reputation = node.reputation.saturating_add(modifier); + } else { + debug_assert!(false, "State inconsistency: add_reputation on an unknown node"); + } } /// Un-discovers the peer. Removes it from the list. @@ -618,7 +526,7 @@ mod tests { #[test] fn full_slots_in() { - let mut peers_state = PeersState::new(1, 1, false); + let mut peers_state = PeersState::new(1, 1); let id1 = PeerId::random(); let id2 = PeerId::random(); @@ -632,14 +540,14 @@ mod tests { } #[test] - fn priority_node_doesnt_use_slot() { - let mut peers_state = PeersState::new(1, 1, false); + fn no_slot_node_doesnt_use_slot() { + let mut peers_state = PeersState::new(1, 1); let id1 = PeerId::random(); let id2 = PeerId::random(); - peers_state.set_priority_group("test", vec![id1.clone()].into_iter().collect()); - if let Peer::NotConnected(p) = peers_state.peer(&id1) { - assert!(p.try_accept_incoming().is_ok()); + peers_state.add_no_slot_node(id1.clone()); + if let Peer::Unknown(p) = peers_state.peer(&id1) { + assert!(p.discover().try_accept_incoming().is_ok()); } else { panic!() } if let Peer::Unknown(e) = peers_state.peer(&id2) { @@ -649,7 +557,7 @@ mod tests { #[test] fn disconnecting_frees_slot() { - let mut peers_state = PeersState::new(1, 1, false); + let mut peers_state = PeersState::new(1, 1); let id1 = PeerId::random(); let id2 = PeerId::random(); @@ -659,28 +567,9 @@ mod tests { assert!(peers_state.peer(&id2).into_not_connected().unwrap().try_accept_incoming().is_ok()); } - #[test] - fn priority_not_connected_peer() { - let mut peers_state = PeersState::new(25, 25, false); - let id1 = PeerId::random(); - let id2 = PeerId::random(); - - assert!(peers_state.priority_not_connected_peer().is_none()); - peers_state.peer(&id1).into_unknown().unwrap().discover(); - peers_state.peer(&id2).into_unknown().unwrap().discover(); - - assert!(peers_state.priority_not_connected_peer().is_none()); - peers_state.set_priority_group("test", vec![id1.clone()].into_iter().collect()); - assert!(peers_state.priority_not_connected_peer().is_some()); - peers_state.set_priority_group("test", vec![id2.clone(), id2.clone()].into_iter().collect()); - assert!(peers_state.priority_not_connected_peer().is_some()); - peers_state.set_priority_group("test", vec![].into_iter().collect()); - assert!(peers_state.priority_not_connected_peer().is_none()); - } - #[test] fn highest_not_connected_peer() { - let mut peers_state = PeersState::new(25, 25, false); + let mut peers_state = PeersState::new(25, 25); let id1 = PeerId::random(); let id2 = PeerId::random(); @@ -700,87 +589,11 @@ mod tests { } #[test] - fn disconnect_priority_doesnt_panic() { - let mut peers_state = PeersState::new(1, 1, false); + fn disconnect_no_slot_doesnt_panic() { + let mut peers_state = PeersState::new(1, 1); let id = PeerId::random(); - peers_state.set_priority_group("test", vec![id.clone()].into_iter().collect()); - let peer = peers_state.peer(&id).into_not_connected().unwrap().try_outgoing().unwrap(); + peers_state.add_no_slot_node(id.clone()); + let peer = peers_state.peer(&id).into_unknown().unwrap().discover().try_outgoing().unwrap(); peer.disconnect(); } - - #[test] - fn multiple_priority_groups_slot_count() { - let mut peers_state = PeersState::new(1, 1, false); - let id = PeerId::random(); - - if let Peer::Unknown(p) = peers_state.peer(&id) { - assert!(p.discover().try_accept_incoming().is_ok()); - } else { panic!() } - - assert_eq!(peers_state.num_in, 1); - peers_state.set_priority_group("test1", vec![id.clone()].into_iter().collect()); - assert_eq!(peers_state.num_in, 0); - peers_state.set_priority_group("test2", vec![id.clone()].into_iter().collect()); - assert_eq!(peers_state.num_in, 0); - peers_state.set_priority_group("test1", vec![].into_iter().collect()); - assert_eq!(peers_state.num_in, 0); - peers_state.set_priority_group("test2", vec![].into_iter().collect()); - assert_eq!(peers_state.num_in, 1); - } - - #[test] - fn priority_only_mode_ignores_drops_unknown_nodes() { - // test whether connection to/from given peer is allowed - let test_connection = |peers_state: &mut PeersState, id| { - if let Peer::Unknown(p) = peers_state.peer(id) { - p.discover(); - } - - let incoming = if let Peer::NotConnected(p) = peers_state.peer(id) { - p.try_accept_incoming().is_ok() - } else { - panic!() - }; - - if incoming { - peers_state.peer(id).into_connected().map(|p| p.disconnect()); - } - - let outgoing = if let Peer::NotConnected(p) = peers_state.peer(id) { - p.try_outgoing().is_ok() - } else { - panic!() - }; - - if outgoing { - peers_state.peer(id).into_connected().map(|p| p.disconnect()); - } - - incoming || outgoing - }; - - let mut peers_state = PeersState::new(1, 1, true); - let id = PeerId::random(); - - // this is an unknown peer and our peer state is set to only allow - // priority peers so any connection attempt should be denied. - assert!(!test_connection(&mut peers_state, &id)); - - // disabling priority only mode should allow the connection to go - // through. - peers_state.set_priority_only(false); - assert!(test_connection(&mut peers_state, &id)); - - // re-enabling it we should again deny connections from the peer. - peers_state.set_priority_only(true); - assert!(!test_connection(&mut peers_state, &id)); - - // but if we add the peer to a priority group it should be accepted. - peers_state.set_priority_group("TEST_GROUP", vec![id.clone()].into_iter().collect()); - assert!(test_connection(&mut peers_state, &id)); - - // and removing it will cause the connection to once again be denied. - peers_state.remove_from_priority_group("TEST_GROUP", &id); - assert!(!test_connection(&mut peers_state, &id)); - } } diff --git a/client/peerset/tests/fuzz.rs b/client/peerset/tests/fuzz.rs index aa2de56923..6fa29e3d83 100644 --- a/client/peerset/tests/fuzz.rs +++ b/client/peerset/tests/fuzz.rs @@ -46,13 +46,13 @@ fn test_once() { id }).collect(), priority_groups: { - let list = (0 .. Uniform::new_inclusive(0, 2).sample(&mut rng)).map(|_| { + let nodes = (0 .. Uniform::new_inclusive(0, 2).sample(&mut rng)).map(|_| { let id = PeerId::random(); known_nodes.insert(id.clone()); reserved_nodes.insert(id.clone()); id }).collect(); - vec![("reserved".to_owned(), list)] + vec![("foo".to_string(), nodes)] }, reserved_only: Uniform::new_inclusive(0, 10).sample(&mut rng) == 0, in_peers: Uniform::new_inclusive(0, 25).sample(&mut rng), -- GitLab From 0c28a1ea75d04d66525679ebfc906cc68217c67c Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 27 May 2020 18:11:36 +0300 Subject: [PATCH 071/280] Improve logging for transaction pool (#6152) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * improve logging * Update client/transaction-pool/graph/src/validated_pool.rs Co-authored-by: Tomasz Drwięga * address review and make uniform Co-authored-by: Tomasz Drwięga --- client/transaction-pool/graph/src/listener.rs | 15 ++++++++------- .../graph/src/validated_pool.rs | 18 ++++++++++-------- client/transaction-pool/src/revalidation.rs | 14 ++++++++++++-- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/client/transaction-pool/graph/src/listener.rs b/client/transaction-pool/graph/src/listener.rs index cccf542199..2923f2b34a 100644 --- a/client/transaction-pool/graph/src/listener.rs +++ b/client/transaction-pool/graph/src/listener.rs @@ -18,7 +18,7 @@ // along with this program. If not, see . use std::{ - collections::HashMap, hash, + collections::HashMap, hash, fmt::Debug, }; use linked_hash_map::LinkedHashMap; use serde::Serialize; @@ -27,7 +27,7 @@ use log::{debug, trace, warn}; use sp_runtime::traits; /// Extrinsic pool default listener. -pub struct Listener { +pub struct Listener { watchers: HashMap>>, finality_watchers: LinkedHashMap, Vec>, } @@ -35,7 +35,7 @@ pub struct Listener { /// Maximum number of blocks awaiting finality at any time. const MAX_FINALITY_WATCHERS: usize = 512; -impl Default for Listener { +impl Default for Listener { fn default() -> Self { Listener { watchers: Default::default(), @@ -74,7 +74,7 @@ impl Listener { /// New transaction was added to the ready pool or promoted from the future pool. pub fn ready(&mut self, tx: &H, old: Option<&H>) { - trace!(target: "txpool", "[{:?}] Ready (replaced: {:?})", tx, old); + trace!(target: "txpool", "[{:?}] Ready (replaced with {:?})", tx, old); self.fire(tx, |watcher| watcher.ready()); if let Some(old) = old { self.fire(old, |watcher| watcher.usurped(tx.clone())); @@ -89,7 +89,7 @@ impl Listener { /// Transaction was dropped from the pool because of the limit. pub fn dropped(&mut self, tx: &H, by: Option<&H>) { - trace!(target: "txpool", "[{:?}] Dropped (replaced by {:?})", tx, by); + trace!(target: "txpool", "[{:?}] Dropped (replaced with {:?})", tx, by); self.fire(tx, |watcher| match by { Some(t) => watcher.usurped(t.clone()), None => watcher.dropped(), @@ -99,9 +99,9 @@ impl Listener { /// Transaction was removed as invalid. pub fn invalid(&mut self, tx: &H, warn: bool) { if warn { - warn!(target: "txpool", "Extrinsic invalid: {:?}", tx); + warn!(target: "txpool", "[{:?}] Extrinsic invalid", tx); } else { - debug!(target: "txpool", "Extrinsic invalid: {:?}", tx); + debug!(target: "txpool", "[{:?}] Extrinsic invalid", tx); } self.fire(tx, |watcher| watcher.invalid()); } @@ -134,6 +134,7 @@ impl Listener { pub fn finalized(&mut self, block_hash: BlockHash) { if let Some(hashes) = self.finality_watchers.remove(&block_hash) { for hash in hashes { + log::debug!(target: "txpool", "[{:?}] Sent finalization event (block {:?})", hash, block_hash); self.fire(&hash, |s| s.finalized(block_hash)) } } diff --git a/client/transaction-pool/graph/src/validated_pool.rs b/client/transaction-pool/graph/src/validated_pool.rs index 7e8e91efe8..9ab45e3b26 100644 --- a/client/transaction-pool/graph/src/validated_pool.rs +++ b/client/transaction-pool/graph/src/validated_pool.rs @@ -27,7 +27,6 @@ use crate::listener::Listener; use crate::rotator::PoolRotator; use crate::watcher::Watcher; use serde::Serialize; -use log::{debug, warn}; use parking_lot::{Mutex, RwLock}; use sp_runtime::{ @@ -189,11 +188,11 @@ impl ValidatedPool { let ready_limit = &self.options.ready; let future_limit = &self.options.future; - debug!(target: "txpool", "Pool Status: {:?}", status); + log::debug!(target: "txpool", "Pool Status: {:?}", status); if ready_limit.is_exceeded(status.ready, status.ready_bytes) || future_limit.is_exceeded(status.future, status.future_bytes) { - debug!( + log::debug!( target: "txpool", "Enforcing limits ({}/{}kB ready, {}/{}kB future", ready_limit.count, ready_limit.total_bytes / 1024, @@ -209,8 +208,11 @@ impl ValidatedPool { self.rotator.ban(&Instant::now(), removed.iter().map(|x| x.clone())); removed }; + if !removed.is_empty() { + log::debug!(target: "txpool", "Enforcing limits: {} dropped", removed.len()); + } + // run notifications - debug!(target: "txpool", "Enforcing limits: {} dropped", removed.len()); let mut listener = self.listener.write(); for h in &removed { listener.dropped(h, None); @@ -324,7 +326,7 @@ impl ValidatedPool { // we do not want to fail if single transaction import has failed // nor we do want to propagate this error, because it could tx unknown to caller // => let's just notify listeners (and issue debug message) - warn!( + log::warn!( target: "txpool", "[{:?}] Removing invalid transaction from update: {}", hash, @@ -531,14 +533,14 @@ impl ValidatedPool { return vec![]; } - debug!(target: "txpool", "Removing invalid transactions: {:?}", hashes); + log::debug!(target: "txpool", "Removing invalid transactions: {:?}", hashes); // temporarily ban invalid transactions self.rotator.ban(&Instant::now(), hashes.iter().cloned()); let invalid = self.pool.write().remove_subtree(hashes); - debug!(target: "txpool", "Removed invalid transactions: {:?}", invalid); + log::debug!(target: "txpool", "Removed invalid transactions: {:?}", invalid); let mut listener = self.listener.write(); for tx in &invalid { @@ -560,7 +562,7 @@ impl ValidatedPool { /// Notify all watchers that transactions in the block with hash have been finalized pub async fn on_block_finalized(&self, block_hash: BlockHash) -> Result<(), B::Error> { - debug!(target: "txpool", "Attempting to notify watchers of finalization for {}", block_hash); + log::trace!(target: "txpool", "Attempting to notify watchers of finalization for {}", block_hash); self.listener.write().finalized(block_hash); Ok(()) } diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index 33f3a3da47..423ff92ba4 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -178,7 +178,7 @@ impl RevalidationWorker { for ext_hash in transactions { // we don't add something that already scheduled for revalidation if self.members.contains_key(&ext_hash) { - log::debug!( + log::trace!( target: "txpool", "[{:?}] Skipped adding for revalidation: Already there.", ext_hash, @@ -245,6 +245,16 @@ impl RevalidationWorker { Some(worker_payload) => { this.best_block = worker_payload.at; this.push(worker_payload); + + if this.members.len() > 0 { + log::debug!( + target: "txpool", + "Updated revalidation queue at {}. Transactions: {:?}", + this.best_block, + this.members, + ); + } + continue; }, // R.I.P. worker! @@ -326,7 +336,7 @@ where /// revalidation is actually done. pub async fn revalidate_later(&self, at: NumberFor, transactions: Vec>) { if transactions.len() > 0 { - log::debug!(target: "txpool", "Added {} transactions to revalidation queue", transactions.len()); + log::debug!(target: "txpool", "Sent {} transactions to revalidation queue", transactions.len()); } if let Some(ref to_worker) = self.background { -- GitLab From 1972b3a7fef2906ce51cc13ba5b9d72b0c6277be Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Wed, 27 May 2020 19:54:56 +0200 Subject: [PATCH 072/280] Add test for Transaction Payment on zero balance account (#6161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Test zero balance account with pays::no * Update frame/transaction-payment/src/lib.rs Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- frame/transaction-payment/src/lib.rs | 57 ++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index c52d698756..55d448bce3 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -331,7 +331,7 @@ mod tests { use super::*; use codec::Encode; use frame_support::{ - impl_outer_dispatch, impl_outer_origin, parameter_types, + impl_outer_dispatch, impl_outer_origin, impl_outer_event, parameter_types, weights::{ DispatchClass, DispatchInfo, PostDispatchInfo, GetDispatchInfo, Weight, WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, @@ -358,6 +358,13 @@ mod tests { } } + impl_outer_event! { + pub enum Event for Runtime { + system, + pallet_balances, + } + } + #[derive(Clone, PartialEq, Eq, Debug)] pub struct Runtime; @@ -392,7 +399,7 @@ mod tests { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = (); + type Event = Event; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type DbWeight = (); @@ -414,7 +421,7 @@ mod tests { impl pallet_balances::Trait for Runtime { type Balance = u64; - type Event = (); + type Event = Event; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -518,7 +525,7 @@ mod tests { /// create a transaction info struct from weight. Handy to avoid building the whole struct. pub fn info_from_weight(w: Weight) -> DispatchInfo { - // pays: yes -- class: normal + // pays_fee: Pays::Yes -- class: DispatchClass::Normal DispatchInfo { weight: w, ..Default::default() } } @@ -816,6 +823,8 @@ mod tests { .build() .execute_with(|| { + // So events are emitted + System::set_block_number(10); let len = 10; let pre = ChargeTransactionPayment::::from(5 /* tipped */) .pre_dispatch(&2, CALL, &info_from_weight(100), len) @@ -832,6 +841,14 @@ mod tests { .is_ok() ); assert_eq!(Balances::free_balance(2), 0); + // Transfer Event + assert!(System::events().iter().any(|event| { + event.event == Event::pallet_balances(pallet_balances::RawEvent::Transfer(2, 3, 80)) + })); + // Killed Event + assert!(System::events().iter().any(|event| { + event.event == Event::system(system::RawEvent::KilledAccount(2)) + })); }); } @@ -857,4 +874,36 @@ mod tests { assert_eq!(Balances::free_balance(2), 200 - 5 - 10 - 100 - 5); }); } + + #[test] + fn zero_transfer_on_free_transaction() { + ExtBuilder::default() + .balance_factor(10) + .base_weight(5) + .build() + .execute_with(|| + { + // So events are emitted + System::set_block_number(10); + let len = 10; + let dispatch_info = DispatchInfo { + weight: 100, + pays_fee: Pays::No, + class: DispatchClass::Normal, + }; + let user = 69; + let pre = ChargeTransactionPayment::::from(0) + .pre_dispatch(&user, CALL, &dispatch_info, len) + .unwrap(); + assert_eq!(Balances::total_balance(&user), 0); + assert!( + ChargeTransactionPayment:: + ::post_dispatch(pre, &dispatch_info, &default_post_info(), len, &Ok(())) + .is_ok() + ); + assert_eq!(Balances::total_balance(&user), 0); + // No events for such a scenario + assert_eq!(System::events().len(), 0); + }); + } } -- GitLab From d5336db1b010c33f30ad7d1644038900539c264e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 27 May 2020 19:55:13 +0200 Subject: [PATCH 073/280] Add a warning when the user passes a legacy PeerId (#6158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a warning when the user passes a legacy PeerId * Update client/network/src/config.rs Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- client/network/src/config.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/client/network/src/config.rs b/client/network/src/config.rs index 394e8fc01a..6c9bd3adb9 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -272,8 +272,21 @@ pub fn parse_str_addr(addr_str: &str) -> Result<(PeerId, Multiaddr), ParseErr> { /// Splits a Multiaddress into a Multiaddress and PeerId. pub fn parse_addr(mut addr: Multiaddr)-> Result<(PeerId, Multiaddr), ParseErr> { let who = match addr.pop() { - Some(multiaddr::Protocol::P2p(key)) => PeerId::from_multihash(key) - .map_err(|_| ParseErr::InvalidPeerId)?, + Some(multiaddr::Protocol::P2p(key)) => { + if !matches!(key.algorithm(), multiaddr::multihash::Code::Identity) { + // (note: this is the "person bowing" emoji) + log::warn!( + "🙇 You are using the peer ID {}. This peer ID uses a legacy, deprecated \ + representation that will no longer be supported in the future. \ + Please refresh it by performing a RPC query to the appropriate node, \ + by looking at its logs, or by using `subkey inspect-node-key` on its \ + private key.", + bs58::encode(key.as_bytes()).into_string() + ); + } + + PeerId::from_multihash(key).map_err(|_| ParseErr::InvalidPeerId)? + }, _ => return Err(ParseErr::PeerIdMissing), }; -- GitLab From d7058c8c909ccd949f0aea4aa13af49acf019e70 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 27 May 2020 19:55:54 +0200 Subject: [PATCH 074/280] Improve the log messages printed when a listener closes (#6162) * Improve the log messages printed when a listener closes * Oops, didn't finish the expired listen addrs thing --- client/network/src/discovery.rs | 5 +---- client/network/src/service.rs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/client/network/src/discovery.rs b/client/network/src/discovery.rs index dd5e093876..f5c293b251 100644 --- a/client/network/src/discovery.rs +++ b/client/network/src/discovery.rs @@ -62,7 +62,7 @@ use libp2p::swarm::toggle::Toggle; #[cfg(not(target_os = "unknown"))] use libp2p::mdns::{Mdns, MdnsEvent}; use libp2p::multiaddr::Protocol; -use log::{debug, info, trace, warn, error}; +use log::{debug, info, trace, warn}; use std::{cmp, collections::{HashMap, HashSet, VecDeque}, io, time::Duration}; use std::task::{Context, Poll}; use sp_core::hexdisplay::HexDisplay; @@ -488,7 +488,6 @@ impl NetworkBehaviour for DiscoveryBehaviour { } fn inject_expired_listen_addr(&mut self, addr: &Multiaddr) { - info!(target: "sub-libp2p", "No longer listening on {}", addr); for k in self.kademlias.values_mut() { NetworkBehaviour::inject_expired_listen_addr(k, addr) } @@ -507,14 +506,12 @@ impl NetworkBehaviour for DiscoveryBehaviour { } fn inject_listener_error(&mut self, id: ListenerId, err: &(dyn std::error::Error + 'static)) { - error!(target: "sub-libp2p", "Error on libp2p listener {:?}: {}", id, err); for k in self.kademlias.values_mut() { NetworkBehaviour::inject_listener_error(k, id, err) } } fn inject_listener_closed(&mut self, id: ListenerId, reason: Result<(), &io::Error>) { - error!(target: "sub-libp2p", "Libp2p listener {:?} closed", id); for k in self.kademlias.values_mut() { NetworkBehaviour::inject_listener_closed(k, id, reason) } diff --git a/client/network/src/service.rs b/client/network/src/service.rs index d9de0d05c4..6256cdd64d 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -1213,7 +1213,7 @@ impl Future for NetworkWorker { } }, Poll::Ready(SwarmEvent::ExpiredListenAddr(addr)) => { - trace!(target: "sub-libp2p", "Libp2p => ExpiredListenAddr({})", addr); + info!(target: "sub-libp2p", "📪 No longer listening on {}", addr); if let Some(metrics) = this.metrics.as_ref() { metrics.listeners_local_addresses.dec(); } @@ -1281,10 +1281,23 @@ impl Future for NetworkWorker { trace!(target: "sub-libp2p", "Libp2p => UnknownPeerUnreachableAddr({}): {}", address, error), Poll::Ready(SwarmEvent::ListenerClosed { reason, addresses }) => { - warn!(target: "sub-libp2p", "Libp2p => ListenerClosed: {:?}", reason); if let Some(metrics) = this.metrics.as_ref() { metrics.listeners_local_addresses.sub(addresses.len() as u64); } + let addrs = addresses.into_iter().map(|a| a.to_string()) + .collect::>().join(", "); + match reason { + Ok(()) => error!( + target: "sub-libp2p", + "📪 Libp2p listener ({}) closed gracefully", + addrs + ), + Err(e) => error!( + target: "sub-libp2p", + "📪 Libp2p listener ({}) closed: {}", + addrs, e + ), + } }, Poll::Ready(SwarmEvent::ListenerError { error }) => { trace!(target: "sub-libp2p", "Libp2p => ListenerError: {}", error); -- GitLab From ac641cd593d794af606e49aca2efd49f66b1d637 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 28 May 2020 11:41:51 +0200 Subject: [PATCH 075/280] Fix Election when ForceNone V1 (#6166) * Clean * Better doc * Better better doc * Again better doc * Fix indemt * Update frame/staking/src/lib.rs * Update frame/staking/src/lib.rs * Better test Co-authored-by: Gavin Wood --- frame/staking/src/lib.rs | 29 +++++++++---- frame/staking/src/tests.rs | 88 +++++++++++++++++++++++++++++++++++--- 2 files changed, 102 insertions(+), 15 deletions(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 4e9a8918c5..b97469b8e0 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1288,7 +1288,7 @@ decl_module! { // either current session final based on the plan, or we're forcing. (Self::is_current_session_final() || Self::will_era_be_forced()) { - if let Some(next_session_change) = T::NextNewSession::estimate_next_new_session(now){ + if let Some(next_session_change) = T::NextNewSession::estimate_next_new_session(now) { if let Some(remaining) = next_session_change.checked_sub(&now) { if remaining <= T::ElectionLookahead::get() && !remaining.is_zero() { // create snapshot. @@ -2569,16 +2569,19 @@ impl Module { Forcing::ForceAlways => (), Forcing::NotForcing if era_length >= T::SessionsPerEra::get() => (), _ => { - // not forcing, not a new era either. If final, set the flag. - if era_length + 1 >= T::SessionsPerEra::get() { + // Either `ForceNone`, or `NotForcing && era_length < T::SessionsPerEra::get()`. + if era_length + 1 == T::SessionsPerEra::get() { IsCurrentSessionFinal::put(true); + } else if era_length >= T::SessionsPerEra::get() { + // Should only happen when we are ready to trigger an era but we have ForceNone, + // otherwise previous arm would short circuit. + Self::close_election_window(); } return None }, } // new era. - IsCurrentSessionFinal::put(false); Self::new_era(session_index) } else { // Set initial era @@ -2912,6 +2915,17 @@ impl Module { maybe_new_validators } + + /// Remove all the storage items associated with the election. + fn close_election_window() { + // Close window. + >::put(ElectionStatus::Closed); + // Kill snapshots. + Self::kill_stakers_snapshot(); + // Don't track final session. + IsCurrentSessionFinal::put(false); + } + /// Select the new validator set at the end of the era. /// /// Runs [`try_do_phragmen`] and updates the following storage items: @@ -2933,11 +2947,8 @@ impl Module { exposures, compute, }) = Self::try_do_phragmen() { - // We have chosen the new validator set. Submission is no longer allowed. - >::put(ElectionStatus::Closed); - - // kill the snapshots. - Self::kill_stakers_snapshot(); + // Totally close the election round and data. + Self::close_election_window(); // Populate Stakers and write slot stake. let mut total_stake: BalanceOf = Zero::zero(); diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index f43c6383ea..a241161e11 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -2859,7 +2859,7 @@ mod offchain_phragmen { } #[test] - fn offchain_election_flag_is_triggered() { + fn offchain_window_is_triggered() { ExtBuilder::default() .session_per_era(5) .session_length(10) @@ -2919,16 +2919,13 @@ mod offchain_phragmen { } #[test] - fn offchain_election_flag_is_triggered_when_forcing() { + fn offchain_window_is_triggered_when_forcing() { ExtBuilder::default() .session_per_era(5) .session_length(10) .election_lookahead(3) .build() .execute_with(|| { - run_to_block(7); - assert_session_era!(0, 0); - run_to_block(12); ForceEra::put(Forcing::ForceNew); run_to_block(13); @@ -2936,11 +2933,90 @@ mod offchain_phragmen { run_to_block(17); // instead of 47 assert_eq!(Staking::era_election_status(), ElectionStatus::Open(17)); + + run_to_block(20); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + }) + } + + #[test] + fn offchain_window_is_triggered_when_force_always() { + ExtBuilder::default() + .session_per_era(5) + .session_length(10) + .election_lookahead(3) + .build() + .execute_with(|| { + + ForceEra::put(Forcing::ForceAlways); + run_to_block(16); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + + run_to_block(17); // instead of 37 + assert_eq!(Staking::era_election_status(), ElectionStatus::Open(17)); + + run_to_block(20); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + + run_to_block(26); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + + run_to_block(27); // next one again + assert_eq!(Staking::era_election_status(), ElectionStatus::Open(27)); + }) + } + + #[test] + fn offchain_window_closes_when_forcenone() { + ExtBuilder::default() + .session_per_era(5) + .session_length(10) + .election_lookahead(3) + .build() + .execute_with(|| { + ForceEra::put(Forcing::ForceNone); + + run_to_block(36); + assert_session_era!(3, 0); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + + // opens + run_to_block(37); + assert_eq!(Staking::era_election_status(), ElectionStatus::Open(37)); + assert!(Staking::is_current_session_final()); + assert!(Staking::snapshot_validators().is_some()); + + // closes normally + run_to_block(40); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + assert!(!Staking::is_current_session_final()); + assert!(Staking::snapshot_validators().is_none()); + assert_session_era!(4, 0); + + run_to_block(47); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + assert_session_era!(4, 0); + + run_to_block(57); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + assert_session_era!(5, 0); + + run_to_block(67); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + + // Will not open again as scheduled + run_to_block(87); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + assert_session_era!(8, 0); + + run_to_block(90); + assert_eq!(Staking::era_election_status(), ElectionStatus::Closed); + assert_session_era!(9, 0); }) } #[test] - fn election_on_chain_fallback_works() { + fn offchain_window_on_chain_fallback_works() { ExtBuilder::default().build_and_execute(|| { start_session(1); start_session(2); -- GitLab From 49b15615184fad010749d3e34282f70a3845da34 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Thu, 28 May 2020 14:20:33 +0200 Subject: [PATCH 076/280] Update locks on upgrade (#6172) --- frame/vesting/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index 371fdca691..d054b78357 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -53,12 +53,11 @@ use codec::{Encode, Decode}; use sp_runtime::{DispatchResult, RuntimeDebug, traits::{ StaticLookup, Zero, AtLeast32Bit, MaybeSerializeDeserialize, Convert }}; -use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure}; +use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure, IterableStorageMap}; use frame_support::traits::{ Currency, LockableCurrency, VestingSchedule, WithdrawReason, LockIdentifier, ExistenceRequirement, Get }; - use frame_system::{self as system, ensure_signed}; mod benchmarking; @@ -182,6 +181,13 @@ decl_module! { fn deposit_event() = default; + fn on_runtime_upgrade() -> frame_support::dispatch::Weight { + for (a, _) in Vesting::::iter() { + let _ = Self::update_lock(a); + } + 1_000_000_000_000 + } + /// Unlock any vested funds of the sender account. /// /// The dispatch origin for this call must be _Signed_ and the sender must have funds still -- GitLab From d65e6443c8281ff65fa5d39cbd454afa2624390e Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 28 May 2020 14:26:11 +0200 Subject: [PATCH 077/280] offchain storage lock (#6010) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat/offchain/storage: add remove interface method * feat/offchain/storeage: add remote to StorageValueRef * feat/offchain/storage: add storage lock * fix/review: Apply suggestions from code review Co-authored-by: Tomasz Drwięga Co-authored-by: Peter Goodspeed-Niklaus * refactor/offchain/storage/lock: introduce `Lockable` trait part 1 of 2 * chore/offchain/rename: _remove -> clean * feat/offchain/storage/lock: add TimeAndBlock based part 2 of 2 * fix/offchain/storage/lock: block and time expiry must be && not || * chore/offchain/storage: minor fmt doc comments * doc/comment: prefer markdown emphasis over CAPS * doc/comment: rewrap multiline module level docs * doc/comment: rephrase * impl sleep_until and use the actual time for the test env * feat/test: add more tests, ignore some sample impl doctests * fix/review: Apply suggestions from code review Co-authored-by: Nikolay Volf * doc/comment: better description * fix/review: Apply suggestions from code review Co-authored-by: Nikolay Volf * chore/storage: lifetime cleanup * fix/cleanup: trait bounds, cargo-spellcheck + extra explanations * fix/doc: periods +- * fix/review: Apply suggestions from code review Co-authored-by: Tomasz Drwięga * cleanup: remove explicit lifetime bound, copy -> clone * fix/review: make trait Lockable contain only static, try_lock should not return Err(Option), * chore/lifetimes: remove a couple of lifetime bounds which the compiler can figure out * refactor: migrate to an instant based * fix/feedback: fix, reduce, rename, docs update pending * docs/reword: adjust to changed code * fix/offchain/testing: timestamp and sleep_until shall not block * chore/lines: lines must < 100 chars * fix/docs: add missing pub field doc comments * refactor/x: try_lock does not need to return an Option<_> * refactor/simplify: a better way of waiting for a lock to resolve * docs: consistency * fix/line: < 100 * fix/doctest/use: avoid crate:: * fix/doctest: * * fix/review: remove unused trait bound * fix/review: pretty by const fn * fix/review: reduce default timeout to 20s * docs: grammar * fix/review: add with_block_deadline * doc: revamp BlockNumberProvider documentation to be less frame centric * chore: fmt * docs: add missing doc comment Co-authored-by: Bernhard Schuster Co-authored-by: Tomasz Drwięga Co-authored-by: Peter Goodspeed-Niklaus Co-authored-by: Nikolay Volf --- client/db/src/offchain.rs | 8 + client/offchain/src/api.rs | 7 + frame/system/src/lib.rs | 10 + primitives/core/src/offchain/mod.rs | 26 +- primitives/core/src/offchain/storage.rs | 5 + primitives/core/src/offchain/testing.rs | 18 +- primitives/io/src/lib.rs | 10 + primitives/runtime/src/offchain/mod.rs | 1 + primitives/runtime/src/offchain/storage.rs | 8 +- .../runtime/src/offchain/storage_lock.rs | 516 ++++++++++++++++++ 10 files changed, 599 insertions(+), 10 deletions(-) create mode 100644 primitives/runtime/src/offchain/storage_lock.rs diff --git a/client/db/src/offchain.rs b/client/db/src/offchain.rs index 651510d6e8..f6a0925a08 100644 --- a/client/db/src/offchain.rs +++ b/client/db/src/offchain.rs @@ -67,6 +67,14 @@ impl sp_core::offchain::OffchainStorage for LocalStorage { self.db.commit(tx); } + fn remove(&mut self, prefix: &[u8], key: &[u8]) { + let key: Vec = prefix.iter().chain(key).cloned().collect(); + let mut tx = Transaction::new(); + tx.remove(columns::OFFCHAIN, &key); + + self.db.commit(tx); + } + fn get(&self, prefix: &[u8], key: &[u8]) -> Option> { let key: Vec = prefix.iter().chain(key).cloned().collect(); self.db.get(columns::OFFCHAIN, &key) diff --git a/client/offchain/src/api.rs b/client/offchain/src/api.rs index 45a82d230c..a7f4ecbc58 100644 --- a/client/offchain/src/api.rs +++ b/client/offchain/src/api.rs @@ -100,6 +100,13 @@ impl OffchainExt for Api { } } + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { + match kind { + StorageKind::PERSISTENT => self.db.remove(STORAGE_PREFIX, key), + StorageKind::LOCAL => unavailable_yet(LOCAL_DB), + } + } + fn local_storage_compare_and_set( &mut self, kind: StorageKind, diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 8360f6c4cb..2221b0591d 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -114,6 +114,7 @@ use sp_runtime::{ MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded, Dispatchable, DispatchInfoOf, PostDispatchInfoOf, }, + offchain::storage_lock::BlockNumberProvider, }; use sp_core::{ChangesTrieConfiguration, storage::well_known_keys}; @@ -1268,6 +1269,15 @@ impl Happened for CallKillAccount { } } +impl BlockNumberProvider for Module +{ + type BlockNumber = ::BlockNumber; + + fn current_block_number() -> Self::BlockNumber { + Module::::block_number() + } +} + // Implement StoredMap for a simple single-item, kill-account-on-remove system. This works fine for // storing a single item which is required to not be empty/default for the account to exist. // Anything more complex will need more sophisticated logic. diff --git a/primitives/core/src/offchain/mod.rs b/primitives/core/src/offchain/mod.rs index 1d77e10f59..b2ff355213 100644 --- a/primitives/core/src/offchain/mod.rs +++ b/primitives/core/src/offchain/mod.rs @@ -37,6 +37,9 @@ pub trait OffchainStorage: Clone + Send + Sync { /// Persist a value in storage under given key and prefix. fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]); + /// Clear a storage entry under given key and prefix. + fn remove(&mut self, prefix: &[u8], key: &[u8]); + /// Retrieve a value from storage under given key and prefix. fn get(&self, prefix: &[u8], key: &[u8]) -> Option>; @@ -219,7 +222,7 @@ pub struct Duration(u64); impl Duration { /// Create new duration representing given number of milliseconds. - pub fn from_millis(millis: u64) -> Self { + pub const fn from_millis(millis: u64) -> Self { Duration(millis) } @@ -346,9 +349,15 @@ pub trait Externalities: Send { /// Sets a value in the local storage. /// /// Note this storage is not part of the consensus, it's only accessible by - /// offchain worker tasks running on the same machine. It IS persisted between runs. + /// offchain worker tasks running on the same machine. It _is_ persisted between runs. fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8]); + /// Removes a value in the local storage. + /// + /// Note this storage is not part of the consensus, it's only accessible by + /// offchain worker tasks running on the same machine. It _is_ persisted between runs. + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]); + /// Sets a value in the local storage if it matches current value. /// /// Since multiple offchain workers may be running concurrently, to prevent @@ -357,7 +366,7 @@ pub trait Externalities: Send { /// Returns `true` if the value has been set, `false` otherwise. /// /// Note this storage is not part of the consensus, it's only accessible by - /// offchain worker tasks running on the same machine. It IS persisted between runs. + /// offchain worker tasks running on the same machine. It _is_ persisted between runs. fn local_storage_compare_and_set( &mut self, kind: StorageKind, @@ -370,7 +379,7 @@ pub trait Externalities: Send { /// /// If the value does not exist in the storage `None` will be returned. /// Note this storage is not part of the consensus, it's only accessible by - /// offchain worker tasks running on the same machine. It IS persisted between runs. + /// offchain worker tasks running on the same machine. It _is_ persisted between runs. fn local_storage_get(&mut self, kind: StorageKind, key: &[u8]) -> Option>; /// Initiates a http request given HTTP verb and the URL. @@ -513,6 +522,10 @@ impl Externalities for Box { (&mut **self).local_storage_set(kind, key, value) } + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { + (&mut **self).local_storage_clear(kind, key) + } + fn local_storage_compare_and_set( &mut self, kind: StorageKind, @@ -618,6 +631,11 @@ impl Externalities for LimitedExternalities { self.externalities.local_storage_set(kind, key, value) } + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { + self.check(Capability::OffchainWorkerDbWrite, "local_storage_clear"); + self.externalities.local_storage_clear(kind, key) + } + fn local_storage_compare_and_set( &mut self, kind: StorageKind, diff --git a/primitives/core/src/offchain/storage.rs b/primitives/core/src/offchain/storage.rs index 1826015b0d..52a7bbe857 100644 --- a/primitives/core/src/offchain/storage.rs +++ b/primitives/core/src/offchain/storage.rs @@ -51,6 +51,11 @@ impl OffchainStorage for InMemOffchainStorage { self.storage.insert(key, value.to_vec()); } + fn remove(&mut self, prefix: &[u8], key: &[u8]) { + let key: Vec = prefix.iter().chain(key).cloned().collect(); + self.storage.remove(&key); + } + fn get(&self, prefix: &[u8], key: &[u8]) -> Option> { let key: Vec = prefix.iter().chain(key).cloned().collect(); self.storage.get(&key).cloned() diff --git a/primitives/core/src/offchain/testing.rs b/primitives/core/src/offchain/testing.rs index 5e25e433a3..76cf8915f2 100644 --- a/primitives/core/src/offchain/testing.rs +++ b/primitives/core/src/offchain/testing.rs @@ -73,10 +73,10 @@ pub struct OffchainState { pub persistent_storage: InMemOffchainStorage, /// Local storage pub local_storage: InMemOffchainStorage, - /// Current timestamp (unix millis) - pub timestamp: u64, /// A supposedly random seed. pub seed: [u8; 32], + /// A timestamp simulating the current time. + pub timestamp: Timestamp, } impl OffchainState { @@ -160,11 +160,11 @@ impl offchain::Externalities for TestOffchainExt { } fn timestamp(&mut self) -> Timestamp { - Timestamp::from_unix_millis(self.0.read().timestamp) + self.0.read().timestamp } - fn sleep_until(&mut self, _deadline: Timestamp) { - unimplemented!("not needed in tests so far") + fn sleep_until(&mut self, deadline: Timestamp) { + self.0.write().timestamp = deadline; } fn random_seed(&mut self) -> [u8; 32] { @@ -179,6 +179,14 @@ impl offchain::Externalities for TestOffchainExt { }.set(b"", key, value); } + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { + let mut state = self.0.write(); + match kind { + StorageKind::LOCAL => &mut state.local_storage, + StorageKind::PERSISTENT => &mut state.persistent_storage, + }.remove(b"", key); + } + fn local_storage_compare_and_set( &mut self, kind: StorageKind, diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index f28f3e2c95..8d81a84c4c 100644 --- a/primitives/io/src/lib.rs +++ b/primitives/io/src/lib.rs @@ -796,6 +796,16 @@ pub trait Offchain { .local_storage_set(kind, key, value) } + /// Remove a value from the local storage. + /// + /// Note this storage is not part of the consensus, it's only accessible by + /// offchain worker tasks running on the same machine. It IS persisted between runs. + fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { + self.extension::() + .expect("local_storage_clear can be called only in the offchain worker context") + .local_storage_clear(kind, key) + } + /// Sets a value in the local storage if it matches current value. /// /// Since multiple offchain workers may be running concurrently, to prevent diff --git a/primitives/runtime/src/offchain/mod.rs b/primitives/runtime/src/offchain/mod.rs index 427b54468f..fe5844ce30 100644 --- a/primitives/runtime/src/offchain/mod.rs +++ b/primitives/runtime/src/offchain/mod.rs @@ -19,5 +19,6 @@ pub mod http; pub mod storage; +pub mod storage_lock; pub use sp_core::offchain::*; diff --git a/primitives/runtime/src/offchain/storage.rs b/primitives/runtime/src/offchain/storage.rs index f8dcd73fa2..2f62d400c0 100644 --- a/primitives/runtime/src/offchain/storage.rs +++ b/primitives/runtime/src/offchain/storage.rs @@ -50,6 +50,11 @@ impl<'a> StorageValueRef<'a> { }) } + /// Remove the associated value from the storage. + pub fn clear(&mut self) { + sp_io::offchain::local_storage_clear(self.kind, self.key) + } + /// Retrieve & decode the value from storage. /// /// Note that if you want to do some checks based on the value @@ -67,7 +72,8 @@ impl<'a> StorageValueRef<'a> { /// Function `f` should return a new value that we should attempt to write to storage. /// This function returns: /// 1. `Ok(Ok(T))` in case the value has been successfully set. - /// 2. `Ok(Err(T))` in case the value was returned, but it couldn't have been set. + /// 2. `Ok(Err(T))` in case the value was calculated by the passed closure `f`, + /// but it could not be stored. /// 3. `Err(_)` in case `f` returns an error. pub fn mutate(&self, f: F) -> Result, E> where T: codec::Codec, diff --git a/primitives/runtime/src/offchain/storage_lock.rs b/primitives/runtime/src/offchain/storage_lock.rs new file mode 100644 index 0000000000..60bf9f0477 --- /dev/null +++ b/primitives/runtime/src/offchain/storage_lock.rs @@ -0,0 +1,516 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! # Off-chain Storage Lock +//! +//! A storage-based lock with a defined expiry time. +//! +//! The lock is using Local Storage and allows synchronizing access to critical +//! section of your code for concurrently running Off-chain Workers. Usage of +//! `PERSISTENT` variant of the storage persists the lock value across a full node +//! restart or re-orgs. +//! +//! A use case for the lock is to make sure that a particular section of the +//! code is only run by one Off-chain Worker at a time. This may include +//! performing a side-effect (i.e. an HTTP call) or alteration of single or +//! multiple Local Storage entries. +//! +//! One use case would be collective updates of multiple data items or append / +//! remove of i.e. sets, vectors which are stored in the off-chain storage DB. +//! +//! ## Example: +//! +//! ```rust +//! # use codec::{Decode, Encode, Codec}; +//! // in your off-chain worker code +//! use sp_runtime::offchain::{ +//! storage::StorageValueRef, +//! storage_lock::{StorageLock, Time}, +//! }; +//! +//! fn append_to_in_storage_vec<'a, T>(key: &'a [u8], _: T) where T: Codec { +//! // `access::lock` defines the storage entry which is used for +//! // persisting the lock in the underlying database. +//! // The entry name _must_ be unique and can be interpreted as a +//! // unique mutex instance reference tag. +//! let mut lock = StorageLock:: #[weight = (10_000_000, DispatchClass::Operational)] - fn suicide(origin) { + pub fn suicide(origin) { let who = ensure_signed(origin)?; let account = Account::::get(&who); ensure!(account.refcount == 0, Error::::NonZeroRefCount); ensure!(account.data == T::AccountData::default(), Error::::NonDefaultComposite); - Account::::remove(who); + Self::kill_account(&who); } } } @@ -1131,6 +1131,15 @@ impl Module { AllExtrinsicsLen::put(len as u32); } + /// Reset events. Can be used as an alternative to + /// `initialize` for tests that don't need to bother with the other environment entries. + #[cfg(any(feature = "std", feature = "runtime-benchmarks", test))] + pub fn reset_events() { + >::kill(); + EventCount::kill(); + >::remove_all(); + } + /// Return the chain's current runtime version. pub fn runtime_version() -> RuntimeVersion { T::Version::get() } @@ -1222,8 +1231,8 @@ impl Module { "WARNING: Referenced account deleted. This is probably a bug." ); } - Module::::on_killed_account(who.clone()); } + Module::::on_killed_account(who.clone()); } /// Determine whether or not it is possible to update the code. -- GitLab From 15cd6574b07f0f62285fd96b09e7652335945c9b Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Tue, 2 Jun 2020 17:22:56 +0200 Subject: [PATCH 094/280] =?UTF-8?q?Accept=20new=20Phragm=C3=A9n=20solution?= =?UTF-8?q?s=20if=20they=20are=20epsilon=20better=20+=20Better=20pre-inclu?= =?UTF-8?q?sion=20checks.=20(#6173)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * part1: Accept inly epsilon better solutions * Fix pre-dispatch check * Fix build * review grumbles * Epsilon -> Threshold --- bin/node/runtime/src/lib.rs | 7 +- frame/grandpa/src/mock.rs | 1 + frame/offences/benchmarking/src/mock.rs | 1 + frame/session/benchmarking/src/mock.rs | 1 + frame/staking/fuzzer/src/mock.rs | 1 + frame/staking/src/lib.rs | 65 +++++++--- frame/staking/src/mock.rs | 8 +- primitives/arithmetic/src/lib.rs | 79 +++++++++++- primitives/arithmetic/src/per_things.rs | 12 +- primitives/phragmen/fuzzer/src/common.rs | 4 +- primitives/phragmen/fuzzer/src/equalize.rs | 3 +- primitives/phragmen/src/lib.rs | 35 ++++-- primitives/phragmen/src/reduce.rs | 4 +- primitives/phragmen/src/tests.rs | 135 ++++++++++++++++++++- 14 files changed, 310 insertions(+), 46 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 0f09940a4c..94cdf8bed8 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -320,9 +320,11 @@ parameter_types! { pub const BondingDuration: pallet_staking::EraIndex = 24 * 28; pub const SlashDeferDuration: pallet_staking::EraIndex = 24 * 7; // 1/4 the bonding duration. pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4; pub const MaxNominatorRewardedPerValidator: u32 = 64; - pub const MaxIterations: u32 = 5; + pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4; + pub const MaxIterations: u32 = 10; + // 0.05%. The higher the value, the more strict solution acceptance becomes. + pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); } impl pallet_staking::Trait for Runtime { @@ -344,6 +346,7 @@ impl pallet_staking::Trait for Runtime { type ElectionLookahead = ElectionLookahead; type Call = Call; type MaxIterations = MaxIterations; + type MinSolutionScoreBump = MinSolutionScoreBump; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = StakingUnsignedPriority; } diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 08329fbb70..6cd7fddf92 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -229,6 +229,7 @@ impl staking::Trait for Test { type Call = Call; type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = (); + type MinSolutionScoreBump = (); } parameter_types! { diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 28263a5292..c228acdf40 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -176,6 +176,7 @@ impl pallet_staking::Trait for Test { type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = (); type MaxIterations = (); + type MinSolutionScoreBump = (); } impl pallet_im_online::Trait for Test { diff --git a/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index 5c0e40096e..bed6509732 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/frame/session/benchmarking/src/mock.rs @@ -183,6 +183,7 @@ impl pallet_staking::Trait for Test { type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = UnsignedPriority; type MaxIterations = (); + type MinSolutionScoreBump = (); } impl crate::Trait for Test {} diff --git a/frame/staking/fuzzer/src/mock.rs b/frame/staking/fuzzer/src/mock.rs index 0e3b6cb13f..3783415630 100644 --- a/frame/staking/fuzzer/src/mock.rs +++ b/frame/staking/fuzzer/src/mock.rs @@ -185,6 +185,7 @@ impl pallet_staking::Trait for Test { type ElectionLookahead = (); type Call = Call; type MaxIterations = MaxIterations; + type MinSolutionScoreBump = (); type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = (); } diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 535eb4446b..434a5dcf93 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -293,7 +293,10 @@ use frame_support::{ decl_module, decl_event, decl_storage, ensure, decl_error, weights::{Weight, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, storage::IterableStorageMap, - dispatch::{IsSubType, DispatchResult, DispatchResultWithPostInfo, WithPostDispatchInfo}, + dispatch::{ + IsSubType, DispatchResult, DispatchResultWithPostInfo, DispatchErrorWithPostInfo, + WithPostDispatchInfo, + }, traits::{ Currency, LockIdentifier, LockableCurrency, WithdrawReasons, OnUnbalanced, Imbalance, Get, UnixTime, EstimateNextNewSession, EnsureOrigin, @@ -301,7 +304,7 @@ use frame_support::{ }; use pallet_session::historical; use sp_runtime::{ - Perbill, PerU16, PerThing, RuntimeDebug, + Perbill, PerU16, PerThing, RuntimeDebug, DispatchError, curve::PiecewiseLinear, traits::{ Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, AtLeast32Bit, @@ -891,6 +894,9 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// equalize will not be executed at all. type MaxIterations: Get; + /// The threshold of improvement that should be provided for a new solution to be accepted. + type MinSolutionScoreBump: Get; + /// The maximum number of nominator rewarded for each validator. /// /// For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim @@ -2614,7 +2620,7 @@ impl Module { // assume the given score is valid. Is it better than what we have on-chain, if we have any? if let Some(queued_score) = Self::queued_score() { ensure!( - is_score_better(queued_score, score), + is_score_better(score, queued_score, T::MinSolutionScoreBump::get()), Error::::PhragmenWeakSubmission.with_weight(T::DbWeight::get().reads(3)), ) } @@ -3506,7 +3512,6 @@ impl frame_support::unsigned::ValidateUnsigned for Module { _, ) = call { use offchain_election::DEFAULT_LONGEVITY; - use sp_runtime::DispatchError; // discard solution not coming from the local OCW. match source { @@ -3518,17 +3523,13 @@ impl frame_support::unsigned::ValidateUnsigned for Module { } if let Err(error_with_post_info) = Self::pre_dispatch_checks(*score, *era) { - let error = error_with_post_info.error; - let error_number = match error { - DispatchError::Module { error, ..} => error, - _ => 0, - }; + let invalid = to_invalid(error_with_post_info); log!( debug, - "validate unsigned pre dispatch checks failed due to module error #{:?}.", - error, + "validate unsigned pre dispatch checks failed due to error #{:?}.", + invalid, ); - return InvalidTransaction::Custom(error_number).into(); + return invalid .into(); } log!(debug, "validateUnsigned succeeded for a solution at era {}.", era); @@ -3556,13 +3557,28 @@ impl frame_support::unsigned::ValidateUnsigned for Module { } } - fn pre_dispatch(_: &Self::Call) -> Result<(), TransactionValidityError> { - // IMPORTANT NOTE: By default, a sane `pre-dispatch` should always do the same checks as - // `validate_unsigned` and overriding this should be done with care. this module has only - // one unsigned entry point, in which we call into `>::pre_dispatch_checks()` - // which is all the important checks that we do in `validate_unsigned`. Hence, we can safely - // override this to save some time. - Ok(()) + fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { + if let Call::submit_election_solution_unsigned( + _, + _, + score, + era, + _, + ) = call { + // IMPORTANT NOTE: These checks are performed in the dispatch call itself, yet we need + // to duplicate them here to prevent a block producer from putting a previously + // validated, yet no longer valid solution on chain. + // OPTIMISATION NOTE: we could skip this in the `submit_election_solution_unsigned` + // since we already do it here. The signed version needs it though. Yer for now we keep + // this duplicate check here so both signed and unsigned can use a singular + // `check_and_replace_solution`. + Self::pre_dispatch_checks(*score, *era) + .map(|_| ()) + .map_err(to_invalid) + .map_err(Into::into) + } else { + Err(InvalidTransaction::Call.into()) + } } } @@ -3570,3 +3586,14 @@ impl frame_support::unsigned::ValidateUnsigned for Module { fn is_sorted_and_unique(list: &[u32]) -> bool { list.windows(2).all(|w| w[0] < w[1]) } + +/// convert a DispatchErrorWithPostInfo to a custom InvalidTransaction with the inner code being the +/// error number. +fn to_invalid(error_with_post_info: DispatchErrorWithPostInfo) -> InvalidTransaction { + let error = error_with_post_info.error; + let error_number = match error { + DispatchError::Module { error, ..} => error, + _ => 0, + }; + InvalidTransaction::Custom(error_number) +} diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 094ab6375c..183196a7c2 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -286,6 +286,7 @@ parameter_types! { pub const RewardCurve: &'static PiecewiseLinear<'static> = &I_NPOS; pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const UnsignedPriority: u64 = 1 << 20; + pub const MinSolutionScoreBump: Perbill = Perbill::zero(); } thread_local! { @@ -321,6 +322,7 @@ impl Trait for Test { type ElectionLookahead = ElectionLookahead; type Call = Call; type MaxIterations = MaxIterations; + type MinSolutionScoreBump = MinSolutionScoreBump; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = UnsignedPriority; } @@ -853,7 +855,11 @@ pub(crate) fn horrible_phragmen_with_post_processing( let support = build_support_map::(&winners, &staked_assignment).0; let score = evaluate_support(&support); - assert!(sp_phragmen::is_score_better(score, better_score)); + assert!(sp_phragmen::is_score_better::( + better_score, + score, + MinSolutionScoreBump::get(), + )); score }; diff --git a/primitives/arithmetic/src/lib.rs b/primitives/arithmetic/src/lib.rs index c4f95af646..a80fe09238 100644 --- a/primitives/arithmetic/src/lib.rs +++ b/primitives/arithmetic/src/lib.rs @@ -41,12 +41,89 @@ mod fixed; mod rational128; pub use fixed::{FixedPointNumber, Fixed64, Fixed128, FixedPointOperand}; -pub use per_things::{PerThing, Percent, PerU16, Permill, Perbill, Perquintill}; +pub use per_things::{PerThing, InnerOf, Percent, PerU16, Permill, Perbill, Perquintill}; pub use rational128::Rational128; +use sp_std::cmp::Ordering; + +/// Trait for comparing two numbers with an threshold. +/// +/// Returns: +/// - `Ordering::Greater` if `self` is greater than `other + threshold`. +/// - `Ordering::Less` if `self` is less than `other - threshold`. +/// - `Ordering::Equal` otherwise. +pub trait ThresholdOrd { + /// Compare if `self` is `threshold` greater or less than `other`. + fn tcmp(&self, other: &T, epsilon: T) -> Ordering; +} + +impl ThresholdOrd for T +where + T: Ord + PartialOrd + Copy + Clone + traits::Zero + traits::Saturating, +{ + fn tcmp(&self, other: &T, threshold: T) -> Ordering { + // early exit. + if threshold.is_zero() { + return self.cmp(&other) + } + + let upper_bound = other.saturating_add(threshold); + let lower_bound = other.saturating_sub(threshold); + + if upper_bound <= lower_bound { + // defensive only. Can never happen. + self.cmp(&other) + } else { + // upper_bound is guaranteed now to be bigger than lower. + match (self.cmp(&lower_bound), self.cmp(&upper_bound)) { + (Ordering::Greater, Ordering::Greater) => Ordering::Greater, + (Ordering::Less, Ordering::Less) => Ordering::Less, + _ => Ordering::Equal, + } + } + + } +} + #[cfg(test)] mod tests { use super::*; + use sp_std::cmp::Ordering; + + #[test] + fn epsilon_ord_works() { + let b = 115u32; + let e = Perbill::from_percent(10).mul_ceil(b); + + // [115 - 11,5 (103,5), 115 + 11,5 (126,5)] is all equal + assert_eq!(103u32.tcmp(&b, e), Ordering::Equal); + assert_eq!(104u32.tcmp(&b, e), Ordering::Equal); + assert_eq!(115u32.tcmp(&b, e), Ordering::Equal); + assert_eq!(120u32.tcmp(&b, e), Ordering::Equal); + assert_eq!(126u32.tcmp(&b, e), Ordering::Equal); + assert_eq!(127u32.tcmp(&b, e), Ordering::Equal); + + assert_eq!(128u32.tcmp(&b, e), Ordering::Greater); + assert_eq!(102u32.tcmp(&b, e), Ordering::Less); + } + + #[test] + fn epsilon_ord_works_with_small_epc() { + let b = 115u32; + // way less than 1 percent. threshold will be zero. Result should be same as normal ord. + let e = Perbill::from_parts(100) * b; + + // [115 - 11,5 (103,5), 115 + 11,5 (126,5)] is all equal + assert_eq!(103u32.tcmp(&b, e), 103u32.cmp(&b)); + assert_eq!(104u32.tcmp(&b, e), 104u32.cmp(&b)); + assert_eq!(115u32.tcmp(&b, e), 115u32.cmp(&b)); + assert_eq!(120u32.tcmp(&b, e), 120u32.cmp(&b)); + assert_eq!(126u32.tcmp(&b, e), 126u32.cmp(&b)); + assert_eq!(127u32.tcmp(&b, e), 127u32.cmp(&b)); + + assert_eq!(128u32.tcmp(&b, e), 128u32.cmp(&b)); + assert_eq!(102u32.tcmp(&b, e), 102u32.cmp(&b)); + } #[test] fn peru16_rational_does_not_overflow() { diff --git a/primitives/arithmetic/src/per_things.rs b/primitives/arithmetic/src/per_things.rs index cf5aa6e4cb..50b87d5076 100644 --- a/primitives/arithmetic/src/per_things.rs +++ b/primitives/arithmetic/src/per_things.rs @@ -25,6 +25,9 @@ use crate::traits::{ }; use sp_debug_derive::RuntimeDebug; +/// Get the inner type of a `PerThing`. +pub type InnerOf

=

::Inner; + /// Something that implements a fixed point ration with an arbitrary granularity `X`, as _parts per /// `X`_. pub trait PerThing: @@ -312,8 +315,7 @@ macro_rules! implement_per_thing { /// #[doc = $title] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] - #[derive(Encode, Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, - RuntimeDebug, CompactAs)] + #[derive(Encode, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug, CompactAs)] pub struct $name($type); impl PerThing for $name { @@ -566,6 +568,12 @@ macro_rules! implement_per_thing { } } + impl Default for $name { + fn default() -> Self { + ::zero() + } + } + /// Non-overflow multiplication. /// /// This is tailored to be used with a balance type. diff --git a/primitives/phragmen/fuzzer/src/common.rs b/primitives/phragmen/fuzzer/src/common.rs index f1aab214de..89fed14cfa 100644 --- a/primitives/phragmen/fuzzer/src/common.rs +++ b/primitives/phragmen/fuzzer/src/common.rs @@ -19,8 +19,8 @@ /// converts x into the range [a, b] in a pseudo-fair way. pub fn to_range(x: usize, a: usize, b: usize) -> usize { - // does not work correctly if b < 2*a - assert!(b > 2 * a); + // does not work correctly if b < 2 * a + assert!(b >= 2 * a); let collapsed = x % b; if collapsed >= a { collapsed diff --git a/primitives/phragmen/fuzzer/src/equalize.rs b/primitives/phragmen/fuzzer/src/equalize.rs index 8ca417f269..a46e479b5a 100644 --- a/primitives/phragmen/fuzzer/src/equalize.rs +++ b/primitives/phragmen/fuzzer/src/equalize.rs @@ -131,7 +131,7 @@ fn main() { return; } - let enhance = is_score_better(initial_score, final_score); + let enhance = is_score_better(final_score, initial_score, Perbill::zero()); println!( "iter = {} // {:?} -> {:?} [{}]", @@ -140,6 +140,7 @@ fn main() { final_score, enhance, ); + // if more than one iteration has been done, or they must be equal. assert!(enhance || initial_score == final_score || i == 0) }); diff --git a/primitives/phragmen/src/lib.rs b/primitives/phragmen/src/lib.rs index 03bbb279d8..6b2686e543 100644 --- a/primitives/phragmen/src/lib.rs +++ b/primitives/phragmen/src/lib.rs @@ -36,7 +36,7 @@ use sp_std::{prelude::*, collections::btree_map::BTreeMap, fmt::Debug, cmp::Ordering, convert::TryFrom}; use sp_arithmetic::{ - PerThing, Rational128, + PerThing, Rational128, ThresholdOrd, helpers_128bit::multiply_by_rational, traits::{Zero, Saturating, Bounded, SaturatedConversion}, }; @@ -614,23 +614,36 @@ pub fn evaluate_support( [min_support, sum, sum_squared] } -/// Compares two sets of phragmen scores based on desirability and returns true if `that` is -/// better than `this`. +/// Compares two sets of phragmen scores based on desirability and returns true if `this` is +/// better than `that`. /// -/// Evaluation is done in a lexicographic manner. +/// Evaluation is done in a lexicographic manner, and if each element of `this` is `that * epsilon` +/// greater or less than `that`. /// /// Note that the third component should be minimized. -pub fn is_score_better(this: PhragmenScore, that: PhragmenScore) -> bool { - match that +pub fn is_score_better(this: PhragmenScore, that: PhragmenScore, epsilon: P) -> bool + where ExtendedBalance: From> +{ + match this .iter() .enumerate() - .map(|(i, e)| e.cmp(&this[i])) - .collect::>() + .map(|(i, e)| ( + e.ge(&that[i]), + e.tcmp(&that[i], epsilon.mul_ceil(that[i])), + )) + .collect::>() .as_slice() { - [Ordering::Greater, _, _] => true, - [Ordering::Equal, Ordering::Greater, _] => true, - [Ordering::Equal, Ordering::Equal, Ordering::Less] => true, + // epsilon better in the score[0], accept. + [(_, Ordering::Greater), _, _] => true, + + // less than epsilon better in score[0], but more than epsilon better in the second. + [(true, Ordering::Equal), (_, Ordering::Greater), _] => true, + + // less than epsilon better in score[0, 1], but more than epsilon better in the third + [(true, Ordering::Equal), (true, Ordering::Equal), (_, Ordering::Less)] => true, + + // anything else is not a good score. _ => false, } } diff --git a/primitives/phragmen/src/reduce.rs b/primitives/phragmen/src/reduce.rs index 2878aa78c4..d0b4afe73d 100644 --- a/primitives/phragmen/src/reduce.rs +++ b/primitives/phragmen/src/reduce.rs @@ -640,8 +640,8 @@ fn reduce_all(assignments: &mut Vec>) -> u32 num_changed } -/// Reduce the given [`Vec>`]. This removes redundant edges from without changing the -/// overall backing of any of the elected candidates. +/// Reduce the given [`Vec>`]. This removes redundant edges from +/// without changing the overall backing of any of the elected candidates. /// /// Returns the number of edges removed. /// diff --git a/primitives/phragmen/src/tests.rs b/primitives/phragmen/src/tests.rs index 0219c35a8b..a8bc069147 100644 --- a/primitives/phragmen/src/tests.rs +++ b/primitives/phragmen/src/tests.rs @@ -616,28 +616,153 @@ fn assignment_convert_works() { } #[test] -fn score_comparison_is_lexicographical() { +fn score_comparison_is_lexicographical_no_epsilon() { + let epsilon = Perbill::zero(); // only better in the fist parameter, worse in the other two ✅ assert_eq!( - is_score_better([10, 20, 30], [12, 10, 35]), + is_score_better([12, 10, 35], [10, 20, 30], epsilon), true, ); // worse in the first, better in the other two ❌ assert_eq!( - is_score_better([10, 20, 30], [9, 30, 10]), + is_score_better([9, 30, 10], [10, 20, 30], epsilon), false, ); // equal in the first, the second one dictates. assert_eq!( - is_score_better([10, 20, 30], [10, 25, 40]), + is_score_better([10, 25, 40], [10, 20, 30], epsilon), true, ); // equal in the first two, the last one dictates. assert_eq!( - is_score_better([10, 20, 30], [10, 20, 40]), + is_score_better([10, 20, 40], [10, 20, 30], epsilon), + false, + ); +} + +#[test] +fn score_comparison_with_epsilon() { + let epsilon = Perbill::from_percent(1); + + { + // no more than 1 percent (10) better in the first param. + assert_eq!( + is_score_better([1009, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + // now equal, still not better. + assert_eq!( + is_score_better([1010, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + // now it is. + assert_eq!( + is_score_better([1011, 5000, 100000], [1000, 5000, 100000], epsilon), + true, + ); + } + + { + // First score score is epsilon better, but first score is no longer `ge`. Then this is + // still not a good solution. + assert_eq!( + is_score_better([999, 6000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + } + + { + // first score is equal or better, but not epsilon. Then second one is the determinant. + assert_eq!( + is_score_better([1005, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5050, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5051, 100000], [1000, 5000, 100000], epsilon), + true, + ); + } + + { + // first score and second are equal or less than epsilon more, third is determinant. + assert_eq!( + is_score_better([1005, 5025, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5025, 99_000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5025, 98_999], [1000, 5000, 100000], epsilon), + true, + ); + } +} + +#[test] +fn score_comparison_large_value() { + // some random value taken from eras in kusama. + let initial = [12488167277027543u128, 5559266368032409496, 118749283262079244270992278287436446]; + // this claim is 0.04090% better in the third component. It should be accepted as better if + // epsilon is smaller than 5/10_0000 + let claim = [12488167277027543u128, 5559266368032409496, 118700736389524721358337889258988054]; + + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(1u32, 10_000), + ), + true, + ); + + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(2u32, 10_000), + ), + true, + ); + + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(3u32, 10_000), + ), + true, + ); + + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(4u32, 10_000), + ), + true, + ); + + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(5u32, 10_000), + ), false, ); } -- GitLab From 38337226dc215cc61bd5ff19315a33425c6e326d Mon Sep 17 00:00:00 2001 From: Denis Pisarev Date: Tue, 2 Jun 2020 17:23:13 +0200 Subject: [PATCH 095/280] refactor CI (#6176) * fix (ci): hotfix Docker release * test (ci): run full ci [skip ci] * change (ci): check stage; add default variables because they were overriden; test-dep-rules goes k8s * change (ci): move companion job to another stage * change (ci): no good way to avoid artifacts downloads without dependencies * fix (ci): typo * change (ci): all CI images were moved to paritytech registry * fix (ci): return to the prev image, new needs more testing --- .gitlab-ci.yml | 206 ++++++++++++++++++++++++++++--------------------- 1 file changed, 119 insertions(+), 87 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0944ec8cde..bdf614063a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ # # my-example-job: # stage: test # One of the stages listed below this job (required) -# image: parity/tools:latest # Any docker image (required) +# image: paritytech/tools:latest # Any docker image (required) # allow_failure: true # Allow the pipeline to continue if this job fails (default: false) # dependencies: # - build-rust-doc-release # Any jobs that are required to run before this job (optional) @@ -22,6 +22,7 @@ # - ./.maintain/gitlab/my_amazing_script.sh stages: + - check - test - build - post-build-test @@ -29,21 +30,18 @@ stages: - kubernetes - flaming-fir -variables: +variables: &default-vars GIT_STRATEGY: fetch GIT_DEPTH: 100 - SCCACHE_DIR: "/ci-cache/${CI_PROJECT_NAME}/sccache" CARGO_INCREMENTAL: 0 - CI_SERVER_NAME: "GitLab CI" DOCKER_OS: "debian:stretch" ARCH: "x86_64" # FIXME set to release CARGO_UNLEASH_INSTALL_PARAMS: "--version 1.0.0-alpha.10" CARGO_UNLEASH_PKG_DEF: "--skip node node-* pallet-template pallet-example pallet-example-* subkey chain-spec-builder" - CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: "wasm-bindgen-test-runner" - WASM_BINDGEN_TEST_TIMEOUT: 120 - CHROMEDRIVER_ARGS: "--log-level=INFO --whitelisted-ips=127.0.0.1" +default: + cache: {} .collect-artifacts: &collect-artifacts artifacts: @@ -77,7 +75,6 @@ variables: - runner_system_failure - unknown_failure - api_failure - dependencies: [] interruptible: true tags: - linux-docker @@ -92,7 +89,7 @@ variables: #### stage: .pre skip-if-draft: - image: parity/tools:latest + image: paritytech/tools:latest <<: *kubernetes-build stage: .pre only: @@ -100,51 +97,53 @@ skip-if-draft: script: - ./.maintain/gitlab/skip_if_draft.sh -#### stage: test +#### stage: check check-runtime: - stage: test - image: parity/tools:latest + stage: check + image: paritytech/tools:latest <<: *kubernetes-build only: - /^[0-9]+$/ variables: + <<: *default-vars GITLAB_API: "https://gitlab.parity.io/api/v4" GITHUB_API_PROJECT: "parity%2Finfrastructure%2Fgithub-api" script: - ./.maintain/gitlab/check_runtime.sh - interruptible: true allow_failure: true check-signed-tag: - stage: test - image: parity/tools:latest + stage: check + image: paritytech/tools:latest <<: *kubernetes-build only: - /^ci-release-.*$/ - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ script: - ./.maintain/gitlab/check_signed.sh - allow_failure: false check-line-width: - stage: test - image: parity/tools:latest + stage: check + image: paritytech/tools:latest <<: *kubernetes-build only: - /^[0-9]+$/ script: - ./.maintain/gitlab/check_line_width.sh - interruptible: true allow_failure: true -check-polkadot-companion-build: - stage: build - <<: *docker-env +test-dependency-rules: + stage: check + image: paritytech/tools:latest + <<: *kubernetes-build + except: + variables: + - $DEPLOY_TAG script: - - ./.maintain/gitlab/check_polkadot_companion_build.sh - interruptible: true - allow_failure: true + - .maintain/ensure-deps.sh + +#### stage: test cargo-audit: stage: test @@ -193,9 +192,11 @@ test-linux-stable: &test-linux stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" + RUST_BACKTRACE: 1 except: variables: - $DEPLOY_TAG @@ -203,15 +204,6 @@ test-linux-stable: &test-linux - WASM_BUILD_NO_COLOR=1 time cargo test --all --release --verbose --locked - sccache -s -test-dependency-rules: - stage: test - <<: *docker-env - except: - variables: - - $DEPLOY_TAG - script: - - .maintain/ensure-deps.sh - unleash-check: stage: test <<: *docker-env @@ -223,9 +215,11 @@ unleash-check: - cargo unleash check ${CARGO_UNLEASH_PKG_DEF} test-frame-staking: + # into one job stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y @@ -239,9 +233,11 @@ test-frame-staking: - sccache -s test-frame-examples-compile-to-wasm: + # into one job stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y @@ -260,6 +256,7 @@ test-wasmtime: stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y @@ -273,9 +270,11 @@ test-wasmtime: - sccache -s test-runtime-benchmarks: + # into one job stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y @@ -298,7 +297,8 @@ test-linux-stable-int: script: - echo "___Logs will be partly shown at the end in case of failure.___" - echo "___Full log will be saved to the job artifacts only in case of failure.___" - - WASM_BUILD_NO_COLOR=1 RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace + - WASM_BUILD_NO_COLOR=1 + RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace time cargo test -p node-cli --release --verbose --locked -- --ignored &> ${CI_COMMIT_SHORT_SHA}_int_failure.log - sccache -s @@ -334,6 +334,7 @@ test-full-crypto-feature: stage: test <<: *docker-env variables: + <<: *default-vars # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y @@ -350,6 +351,7 @@ test-full-crypto-feature: cargo-check-macos: stage: test + # shell runner on mac ignores the image set in *docker-env <<: *docker-env script: - BUILD_DUMMY_WASM_BINARY=1 time cargo check --release @@ -359,12 +361,36 @@ cargo-check-macos: #### stage: build +check-polkadot-companion-status: + stage: build + image: paritytech/tools:latest + <<: *kubernetes-build + only: + - /^[0-9]+$/ # PRs + script: + - ./.maintain/gitlab/check_polkadot_companion_status.sh + +check-polkadot-companion-build: + stage: build + <<: *docker-env + needs: + - job: test-linux-stable-int + artifacts: false + script: + - ./.maintain/gitlab/check_polkadot_companion_build.sh + allow_failure: true + test-browser-node: stage: build <<: *docker-env needs: - job: check-web-wasm artifacts: false + variables: + <<: *default-vars + CHROMEDRIVER_ARGS: "--log-level=INFO --whitelisted-ips=127.0.0.1" + CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: "wasm-bindgen-test-runner" + WASM_BINDGEN_TEST_TIMEOUT: 120 script: - cargo +nightly test --target wasm32-unknown-unknown -p node-browser-testing -Z features=itarget @@ -373,6 +399,9 @@ build-linux-substrate: &build-binary <<: *collect-artifacts <<: *docker-env <<: *build-only + needs: + - job: test-linux-stable + artifacts: false before_script: - mkdir -p ./artifacts/substrate/ except: @@ -387,7 +416,7 @@ build-linux-substrate: &build-binary else ./artifacts/substrate/substrate --version | sed -n -E 's/^substrate ([0-9.]+.*-[0-9a-f]{7,13})-.*$/\1/p' | - tee ./artifacts/substrate/VERSION; + tee ./artifacts/substrate/VERSION; fi - sha256sum ./artifacts/substrate/substrate | tee ./artifacts/substrate/substrate.sha256 - printf '\n# building node-template\n\n' @@ -398,6 +427,9 @@ build-linux-substrate: &build-binary build-linux-subkey: &build-subkey <<: *build-binary + needs: + - job: cargo-check-subkey + artifacts: false before_script: - mkdir -p ./artifacts/subkey script: @@ -434,23 +466,16 @@ build-rust-doc-release: <<: *build-only script: - rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds - - BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html" time cargo +nightly doc --release --all --verbose + - BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html" + time cargo +nightly doc --release --all --verbose - cp -R ./target/doc ./crate-docs - echo "" > ./crate-docs/index.html - sccache -s -check-polkadot-companion-status: - stage: post-build-test - image: parity/tools:latest - <<: *kubernetes-build - only: - - /^[0-9]+$/ - script: - - ./.maintain/gitlab/check_polkadot_companion_status.sh - +#### stage: post-build-test trigger-contracts-ci: - stage: publish + stage: post-build-test needs: - job: build-linux-substrate artifacts: false @@ -466,12 +491,19 @@ trigger-contracts-ci: #### stage: publish -.publish-docker-release: &publish-docker-release +.build-push-docker-image: &build-push-docker-image <<: *build-only <<: *kubernetes-build image: docker:stable services: - docker:dind + variables: &docker-build-vars + <<: *default-vars + DOCKER_HOST: tcp://localhost:2375 + DOCKER_DRIVER: overlay2 + GIT_STRATEGY: none + DOCKERFILE: $PRODUCT.Dockerfile + CONTAINER_IMAGE: parity/$PRODUCT before_script: - test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" || ( echo "no docker credentials provided"; exit 1 ) @@ -493,18 +525,15 @@ trigger-contracts-ci: publish-docker-substrate: stage: publish - <<: *publish-docker-release + <<: *build-push-docker-image # collect VERSION artifact here to pass it on to kubernetes <<: *collect-artifacts - dependencies: - - build-linux-substrate + needs: + - job: build-linux-substrate + artifacts: true variables: - DOCKER_HOST: tcp://localhost:2375 - DOCKER_DRIVER: overlay2 - GIT_STRATEGY: none + <<: *docker-build-vars PRODUCT: substrate - DOCKERFILE: $PRODUCT.Dockerfile - CONTAINER_IMAGE: parity/$PRODUCT after_script: - docker logout # only VERSION information is needed for the deployment @@ -512,16 +541,13 @@ publish-docker-substrate: publish-docker-subkey: stage: publish - <<: *publish-docker-release - dependencies: - - build-linux-subkey + <<: *build-push-docker-image + needs: + - job: build-linux-subkey + artifacts: true variables: - DOCKER_HOST: tcp://localhost:2375 - DOCKER_DRIVER: overlay2 - GIT_STRATEGY: none + <<: *docker-build-vars PRODUCT: subkey - DOCKERFILE: $PRODUCT.Dockerfile - CONTAINER_IMAGE: parity/$PRODUCT after_script: - docker logout @@ -529,10 +555,12 @@ publish-s3-release: stage: publish <<: *build-only <<: *kubernetes-build - dependencies: - - build-linux-substrate - - build-linux-subkey - image: parity/awscli:latest + needs: + - job: build-linux-substrate + artifacts: true + - job: build-linux-subkey + artifacts: true + image: paritytech/awscli:latest variables: GIT_STRATEGY: none BUCKET: "releases.parity.io" @@ -548,11 +576,11 @@ publish-s3-release: publish-s3-doc: stage: publish - image: parity/awscli:latest + image: paritytech/awscli:latest allow_failure: true - dependencies: - - build-rust-doc-release - cache: {} + needs: + - job: build-rust-doc-release + artifacts: true <<: *build-only <<: *kubernetes-build variables: @@ -572,13 +600,12 @@ publish-s3-doc: publish-draft-release: stage: publish - image: parity/tools:latest + image: paritytech/tools:latest only: - /^ci-release-.*$/ - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ script: - ./.maintain/gitlab/publish_draft_release.sh - interruptible: true allow_failure: true publish-to-crates-io: @@ -590,14 +617,13 @@ publish-to-crates-io: script: - cargo install cargo-unleash ${CARGO_UNLEASH_INSTALL_PARAMS} - cargo unleash em-dragons --no-check ${CARGO_UNLEASH_PKG_DEF} - interruptible: true allow_failure: true .deploy-template: &deploy stage: kubernetes when: manual retry: 1 - image: parity/kubetools:latest + image: paritytech/kubetools:latest <<: *build-only tags: # this is the runner that is used to deploy it @@ -611,18 +637,18 @@ publish-to-crates-io: - echo "Substrate version = ${DEPLOY_TAG}" # or use helm to render the template - helm template - --values ./.maintain/kubernetes/values.yaml - --set image.tag=${DEPLOY_TAG} - --set validator.keys=${VALIDATOR_KEYS} - ./.maintain/kubernetes | kubectl apply -f - --dry-run=false + --values ./.maintain/kubernetes/values.yaml + --set image.tag=${DEPLOY_TAG} + --set validator.keys=${VALIDATOR_KEYS} + ./.maintain/kubernetes | kubectl apply -f - --dry-run=false - echo "# substrate namespace ${KUBE_NAMESPACE}" - kubectl -n ${KUBE_NAMESPACE} get all - echo "# substrate's nodes' external ip addresses:" - kubectl get nodes -l node=substrate - -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range @.status.addresses[?(@.type=="ExternalIP")]}{.address}{"\n"}{end}' + -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range @.status.addresses[?(@.type=="ExternalIP")]}{.address}{"\n"}{end}' - echo "# substrate' nodes" - kubectl -n ${KUBE_NAMESPACE} get pods - -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}' + -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}' - echo "# wait for the rollout to complete" - kubectl -n ${KUBE_NAMESPACE} rollout status statefulset/substrate @@ -630,8 +656,9 @@ publish-to-crates-io: .deploy-cibuild: &deploy-cibuild <<: *deploy - dependencies: - - publish-docker-substrate + needs: + - job: publish-docker-substrate + artifacts: false .deploy-tag: &deploy-tag <<: *deploy @@ -662,14 +689,16 @@ deploy-ue1-tag: name: parity-prod-ue1 .validator-deploy: &validator-deploy - # script will fail if there is no artifacts/substrate/VERSION <<: *build-only stage: flaming-fir - dependencies: - - build-linux-substrate + needs: + # script will fail if there is no artifacts/substrate/VERSION + - job: publish-docker-substrate + artifacts: true image: parity/azure-ansible:v1 allow_failure: true when: manual + interruptible: true tags: - linux-docker @@ -677,14 +706,17 @@ validator 1 4: <<: *validator-deploy script: - ./.maintain/flamingfir-deploy.sh flamingfir-validator1 + validator 2 4: <<: *validator-deploy script: - ./.maintain/flamingfir-deploy.sh flamingfir-validator2 + validator 3 4: <<: *validator-deploy script: - ./.maintain/flamingfir-deploy.sh flamingfir-validator3 + validator 4 4: <<: *validator-deploy script: -- GitLab From 342caad3074076a4fde0472719f6a473df839e42 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 2 Jun 2020 18:15:15 +0200 Subject: [PATCH 096/280] Generalised proxies (#6156) * Initial work * It should work * Fix node * Fix tests * Initial test * Tests * Expunge proxy functionality from democracy and elections * Allow different proxy types * Repotted * Build * Build * Making a start on weights * Undo breaking change * Line widths. * Fix * fix tests * finish benchmarks? * Storage name! * Utility -> Proxy * proxy weight * add proxy weight * remove weights * Update transfer constraint * Again, fix constraints * Fix negation * Update frame/proxy/Cargo.toml Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Remove unneeded event. * Grumbles * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Shawn Tabrizi Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- Cargo.lock | 17 ++ Cargo.toml | 1 + bin/node/runtime/Cargo.toml | 3 + bin/node/runtime/src/lib.rs | 61 ++++- client/network/test/src/block_import.rs | 13 +- frame/balances/src/lib.rs | 9 +- frame/democracy/src/benchmarking.rs | 243 -------------------- frame/democracy/src/lib.rs | 290 +----------------------- frame/democracy/src/tests.rs | 1 - frame/democracy/src/tests/proxying.rs | 105 --------- frame/democracy/src/types.rs | 18 -- frame/elections/src/lib.rs | 23 -- frame/elections/src/tests.rs | 39 ---- frame/proxy/Cargo.toml | 43 ++++ frame/proxy/src/benchmarking.rs | 88 +++++++ frame/proxy/src/lib.rs | 271 ++++++++++++++++++++++ frame/proxy/src/tests.rs | 220 ++++++++++++++++++ frame/support/src/traits.rs | 10 + frame/utility/src/lib.rs | 2 +- frame/utility/src/tests.rs | 5 +- 20 files changed, 724 insertions(+), 738 deletions(-) delete mode 100644 frame/democracy/src/tests/proxying.rs create mode 100644 frame/proxy/Cargo.toml create mode 100644 frame/proxy/src/benchmarking.rs create mode 100644 frame/proxy/src/lib.rs create mode 100644 frame/proxy/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 06b1b42b10..5a13d30be1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3609,6 +3609,7 @@ dependencies = [ "pallet-membership", "pallet-offences", "pallet-offences-benchmarking", + "pallet-proxy", "pallet-randomness-collective-flip", "pallet-recovery", "pallet-scheduler", @@ -4399,6 +4400,22 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-proxy" +version = "2.0.0-rc2" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-rc2" diff --git a/Cargo.toml b/Cargo.toml index 8fbe1cf0d8..8dc57b607f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,6 +86,7 @@ members = [ "frame/metadata", "frame/nicks", "frame/offences", + "frame/proxy", "frame/randomness-collective-flip", "frame/recovery", "frame/scheduler", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 1bf61c046d..b451ac109e 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -61,6 +61,7 @@ pallet-identity = { version = "2.0.0-rc2", default-features = false, path = "../ pallet-membership = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/membership" } pallet-offences = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/offences" } pallet-offences-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-proxy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/proxy" } pallet-randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/randomness-collective-flip" } pallet-recovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/recovery" } pallet-session = { version = "2.0.0-rc2", features = ["historical"], path = "../../../frame/session", default-features = false } @@ -111,6 +112,7 @@ std = [ "node-primitives/std", "sp-offchain/std", "pallet-offences/std", + "pallet-proxy/std", "sp-core/std", "pallet-randomness-collective-flip/std", "sp-std/std", @@ -149,6 +151,7 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-society/runtime-benchmarks", "pallet-staking/runtime-benchmarks", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 94cdf8bed8..7a036ddf5f 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -24,13 +24,14 @@ use sp_std::prelude::*; use frame_support::{ - construct_runtime, parameter_types, debug, + construct_runtime, parameter_types, debug, RuntimeDebug, weights::{ Weight, IdentityFee, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, }, traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier}, }; +use codec::{Encode, Decode}; use sp_core::{ crypto::KeyTypeId, u32_trait::{_1, _2, _3, _4}, @@ -60,7 +61,6 @@ use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use pallet_contracts_rpc_runtime_api::ContractExecResult; use pallet_session::{historical as pallet_session_historical}; use sp_inherents::{InherentData, CheckInherentsResult}; -use codec::Encode; use static_assertions::const_assert; #[cfg(any(feature = "std", test))] @@ -79,6 +79,7 @@ use impls::{CurrencyToVoteHandler, Author, TargetedFeeAdjustment}; /// Constant values used within the runtime. pub mod constants; use constants::{time::*, currency::*}; +use frame_support::traits::InstanceFilter; // Make the WASM binary available. #[cfg(feature = "std")] @@ -168,11 +169,13 @@ impl frame_system::Trait for Runtime { type OnKilledAccount = (); } +const fn deposit(items: u32, bytes: u32) -> Balance { items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS } + parameter_types! { - // One storage item; value is size 4+4+16+32 bytes = 56 bytes. - pub const MultisigDepositBase: Balance = 30 * CENTS; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + pub const MultisigDepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. - pub const MultisigDepositFactor: Balance = 5 * CENTS; + pub const MultisigDepositFactor: Balance = deposit(0, 32); pub const MaxSignatories: u16 = 100; } @@ -186,6 +189,52 @@ impl pallet_utility::Trait for Runtime { type IsCallable = (); } +parameter_types! { + // One storage item; key size 32, value size 8; . + pub const ProxyDepositBase: Balance = deposit(1, 8); + // Additional storage item size of 33 bytes. + pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const MaxProxies: u16 = 32; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + Staking, +} +impl Default for ProxyType { fn default() -> Self { Self::Any } } +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => !matches!(c, + Call::Balances(..) | Call::Utility(..) + | Call::Vesting(pallet_vesting::Call::vested_transfer(..)) + | Call::Indices(pallet_indices::Call::transfer(..)) + ), + ProxyType::Governance => matches!(c, + Call::Democracy(..) | Call::Council(..) | Call::Society(..) + | Call::TechnicalCommittee(..) | Call::Elections(..) | Call::Treasury(..) + ), + ProxyType::Staking => matches!(c, Call::Staking(..)), + } + } +} + +impl pallet_proxy::Trait for Runtime { + type Event = Event; + type Call = Call; + type Currency = Balances; + type IsCallable = (); + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); } @@ -759,6 +808,7 @@ construct_runtime!( Recovery: pallet_recovery::{Module, Call, Storage, Event}, Vesting: pallet_vesting::{Module, Call, Storage, Event, Config}, Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, + Proxy: pallet_proxy::{Module, Call, Storage, Event}, } ); @@ -1009,6 +1059,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, b"identity", Identity); add_benchmark!(params, batches, b"im-online", ImOnline); add_benchmark!(params, batches, b"offences", OffencesBench::); + add_benchmark!(params, batches, b"proxy", Proxy); add_benchmark!(params, batches, b"scheduler", Scheduler); add_benchmark!(params, batches, b"session", SessionBench::); add_benchmark!(params, batches, b"staking", Staking); diff --git a/client/network/test/src/block_import.rs b/client/network/test/src/block_import.rs index 8636cfbc21..46a395700c 100644 --- a/client/network/test/src/block_import.rs +++ b/client/network/test/src/block_import.rs @@ -57,8 +57,9 @@ fn import_single_good_block_works() { match import_single_block( &mut substrate_test_runtime_client::new(), - BlockOrigin::File, block, - &mut PassThroughVerifier(true), + BlockOrigin::File, + block, + &mut PassThroughVerifier(true) ) { Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org)) if *num == number && *aux == expected_aux && *org == Some(peer_id) => {} @@ -70,7 +71,8 @@ fn import_single_good_block_works() { fn import_single_good_known_block_is_ignored() { let (mut client, _hash, number, _, block) = prepare_good_block(); match import_single_block( - &mut client, BlockOrigin::File, + &mut client, + BlockOrigin::File, block, &mut PassThroughVerifier(true) ) { @@ -85,8 +87,9 @@ fn import_single_good_block_without_header_fails() { block.header = None; match import_single_block( &mut substrate_test_runtime_client::new(), - BlockOrigin::File, block, - &mut PassThroughVerifier(true), + BlockOrigin::File, + block, + &mut PassThroughVerifier(true) ) { Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {} _ => panic!() diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 225f7f662e..ea7ec92147 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -1257,12 +1257,9 @@ where ) { if amount.is_zero() || reasons.is_none() { return } let mut new_lock = Some(BalanceLock { id, amount, reasons: reasons.into() }); - let mut locks = Self::locks(who).into_iter().filter_map(|l| - if l.id == id { - new_lock.take() - } else { - Some(l) - }).collect::>(); + let mut locks = Self::locks(who).into_iter() + .filter_map(|l| if l.id == id { new_lock.take() } else { Some(l) }) + .collect::>(); if let Some(lock) = new_lock { locks.push(lock) } diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index 9fa619a994..7839618760 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -97,16 +97,6 @@ fn account_vote(b: BalanceOf) -> AccountVote> { } } -fn open_activate_proxy(u: u32) -> Result<(T::AccountId, T::AccountId), &'static str> { - let caller = funded_account::("caller", u); - let voter = funded_account::("voter", u); - - Democracy::::open_proxy(RawOrigin::Signed(caller.clone()).into(), voter.clone())?; - Democracy::::activate_proxy(RawOrigin::Signed(voter.clone()).into(), caller.clone())?; - - Ok((caller, voter)) -} - benchmarks! { _ { } @@ -215,70 +205,6 @@ benchmarks! { assert_eq!(tally.nays, 1000.into(), "changed vote was not recorded"); } - // Basically copy paste of `vote_new` - proxy_vote_new { - let r in 1 .. MAX_REFERENDUMS; - - let (caller, voter) = open_activate_proxy::(0)?; - let account_vote = account_vote::(100.into()); - - // Populate existing direct votes for the voter, they can vote on their own behalf - for i in 0 .. r { - let ref_idx = add_referendum::(i)?; - Democracy::::vote(RawOrigin::Signed(voter.clone()).into(), ref_idx, account_vote.clone())?; - } - - let referendum_index = add_referendum::(r)?; - - }: proxy_vote(RawOrigin::Signed(caller), referendum_index, account_vote) - verify { - let votes = match VotingOf::::get(&voter) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), (r + 1) as usize, "Vote was not recorded."); - } - - // Basically copy paste of `vote_existing` - proxy_vote_existing { - let r in 1 .. MAX_REFERENDUMS; - - let (caller, voter) = open_activate_proxy::(0)?; - let account_vote = account_vote::(100.into()); - - // We need to create existing direct votes - for i in 0 ..=r { - let ref_idx = add_referendum::(i)?; - Democracy::::vote(RawOrigin::Signed(voter.clone()).into(), ref_idx, account_vote.clone())?; - } - let votes = match VotingOf::::get(&voter) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), (r + 1) as usize, "Votes were not recorded."); - - // Change vote from aye to nay - let nay = Vote { aye: false, conviction: Conviction::Locked1x }; - let new_vote = AccountVote::Standard { vote: nay, balance: 1000.into() }; - let referendum_index = Democracy::::referendum_count() - 1; - - // This tests when a user changes a vote - }: proxy_vote(RawOrigin::Signed(caller.clone()), referendum_index, new_vote) - verify { - let votes = match VotingOf::::get(&voter) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), (r + 1) as usize, "Vote was incorrectly added"); - let referendum_info = Democracy::::referendum_info(referendum_index) - .ok_or("referendum doesn't exist")?; - let tally = match referendum_info { - ReferendumInfo::Ongoing(r) => r.tally, - _ => return Err("referendum not ongoing"), - }; - assert_eq!(tally.nays, 1000.into(), "changed vote was not recorded"); - } - emergency_cancel { let r in 1 .. MAX_REFERENDUMS; let origin = T::CancellationOrigin::successful_origin(); @@ -505,33 +431,6 @@ benchmarks! { } } - activate_proxy { - let u in 1 .. MAX_USERS; - - let caller: T::AccountId = funded_account::("caller", u); - let proxy: T::AccountId = funded_account::("proxy", u); - Democracy::::open_proxy(RawOrigin::Signed(proxy.clone()).into(), caller.clone())?; - }: _(RawOrigin::Signed(caller.clone()), proxy.clone()) - verify { - assert_eq!(Democracy::::proxy(proxy), Some(ProxyState::Active(caller))); - } - - close_proxy { - let u in 1 .. MAX_USERS; - let (caller, _) = open_activate_proxy::(u)?; - }: _(RawOrigin::Signed(caller.clone())) - verify { - assert_eq!(Democracy::::proxy(caller), None); - } - - deactivate_proxy { - let u in 1 .. MAX_USERS; - let (caller, voter) = open_activate_proxy::(u)?; - }: _(RawOrigin::Signed(voter.clone()), caller.clone()) - verify { - assert_eq!(Democracy::::proxy(caller), Some(ProxyState::Open(voter))); - } - delegate { let r in 1 .. MAX_REFERENDUMS; @@ -760,14 +659,6 @@ benchmarks! { assert_eq!(voting.locked_balance(), base_balance); } - open_proxy { - let u in 1 .. MAX_USERS; - - let caller: T::AccountId = funded_account::("caller", u); - let proxy: T::AccountId = funded_account::("proxy", u); - - }: _(RawOrigin::Signed(proxy), caller) - remove_vote { let r in 1 .. MAX_REFERENDUMS; @@ -831,131 +722,6 @@ benchmarks! { assert_eq!(votes.len(), (r - 1) as usize, "Vote was not removed"); } - // This is a copy of delegate benchmark, but with `open_activate_proxy` - proxy_delegate { - let r in 1 .. MAX_REFERENDUMS; - - let initial_balance: BalanceOf = 100.into(); - let delegated_balance: BalanceOf = 1000.into(); - - let (caller, voter) = open_activate_proxy::(0)?; - - // Voter will initially delegate to `old_delegate` - let old_delegate: T::AccountId = funded_account::("old_delegate", r); - Democracy::::delegate( - RawOrigin::Signed(voter.clone()).into(), - old_delegate.clone(), - Conviction::Locked1x, - delegated_balance, - )?; - let (target, balance) = match VotingOf::::get(&voter) { - Voting::Delegating { target, balance, .. } => (target, balance), - _ => return Err("Votes are not direct"), - }; - assert_eq!(target, old_delegate, "delegation target didn't work"); - assert_eq!(balance, delegated_balance, "delegation balance didn't work"); - // Voter will now switch to `new_delegate` - let new_delegate: T::AccountId = funded_account::("new_delegate", r); - let account_vote = account_vote::(initial_balance); - // We need to create existing direct votes for the `new_delegate` - for i in 0..r { - let ref_idx = add_referendum::(i)?; - Democracy::::vote(RawOrigin::Signed(new_delegate.clone()).into(), ref_idx, account_vote.clone())?; - } - let votes = match VotingOf::::get(&new_delegate) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), r as usize, "Votes were not recorded."); - }: _(RawOrigin::Signed(caller.clone()), new_delegate.clone(), Conviction::Locked1x, delegated_balance) - verify { - let (target, balance) = match VotingOf::::get(&voter) { - Voting::Delegating { target, balance, .. } => (target, balance), - _ => return Err("Votes are not direct"), - }; - assert_eq!(target, new_delegate, "delegation target didn't work"); - assert_eq!(balance, delegated_balance, "delegation balance didn't work"); - let delegations = match VotingOf::::get(&new_delegate) { - Voting::Direct { delegations, .. } => delegations, - _ => return Err("Votes are not direct"), - }; - assert_eq!(delegations.capital, delegated_balance, "delegation was not recorded."); - } - - // This is a copy of undelegate benchmark, but with `open_activate_proxy` - proxy_undelegate { - let r in 1 .. MAX_REFERENDUMS; - - let initial_balance: BalanceOf = 100.into(); - let delegated_balance: BalanceOf = 1000.into(); - - let (caller, voter) = open_activate_proxy::(0)?; - // Caller will delegate - let the_delegate: T::AccountId = funded_account::("delegate", r); - Democracy::::delegate( - RawOrigin::Signed(voter.clone()).into(), - the_delegate.clone(), - Conviction::Locked1x, - delegated_balance, - )?; - let (target, balance) = match VotingOf::::get(&voter) { - Voting::Delegating { target, balance, .. } => (target, balance), - _ => return Err("Votes are not direct"), - }; - assert_eq!(target, the_delegate, "delegation target didn't work"); - assert_eq!(balance, delegated_balance, "delegation balance didn't work"); - // We need to create votes direct votes for the `delegate` - let account_vote = account_vote::(initial_balance); - for i in 0..r { - let ref_idx = add_referendum::(i)?; - Democracy::::vote( - RawOrigin::Signed(the_delegate.clone()).into(), - ref_idx, - account_vote.clone() - )?; - } - let votes = match VotingOf::::get(&the_delegate) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), r as usize, "Votes were not recorded."); - }: _(RawOrigin::Signed(caller.clone())) - verify { - // Voting should now be direct - match VotingOf::::get(&voter) { - Voting::Direct { .. } => (), - _ => return Err("undelegation failed"), - } - } - - proxy_remove_vote { - let r in 1 .. MAX_REFERENDUMS; - - let (caller, voter) = open_activate_proxy::(0)?; - let account_vote = account_vote::(100.into()); - - for i in 0 .. r { - let ref_idx = add_referendum::(i)?; - Democracy::::vote(RawOrigin::Signed(voter.clone()).into(), ref_idx, account_vote.clone())?; - } - - let votes = match VotingOf::::get(&voter) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), r as usize, "Votes not created"); - - let referendum_index = r - 1; - - }: _(RawOrigin::Signed(caller.clone()), referendum_index) - verify { - let votes = match VotingOf::::get(&voter) { - Voting::Direct { votes, .. } => votes, - _ => return Err("Votes are not direct"), - }; - assert_eq!(votes.len(), (r - 1) as usize, "Vote was not removed"); - } - enact_proposal_execute { // Num of bytes in encoded proposal let b in 0 .. MAX_BYTES; @@ -1012,8 +778,6 @@ mod tests { assert_ok!(test_benchmark_second::()); assert_ok!(test_benchmark_vote_new::()); assert_ok!(test_benchmark_vote_existing::()); - assert_ok!(test_benchmark_proxy_vote_new::()); - assert_ok!(test_benchmark_proxy_vote_existing::()); assert_ok!(test_benchmark_emergency_cancel::()); assert_ok!(test_benchmark_external_propose::()); assert_ok!(test_benchmark_external_propose_majority::()); @@ -1025,10 +789,6 @@ mod tests { assert_ok!(test_benchmark_on_initialize_external::()); assert_ok!(test_benchmark_on_initialize_public::()); assert_ok!(test_benchmark_on_initialize_no_launch_no_maturing::()); - assert_ok!(test_benchmark_open_proxy::()); - assert_ok!(test_benchmark_activate_proxy::()); - assert_ok!(test_benchmark_close_proxy::()); - assert_ok!(test_benchmark_deactivate_proxy::()); assert_ok!(test_benchmark_delegate::()); assert_ok!(test_benchmark_undelegate::()); assert_ok!(test_benchmark_clear_public_proposals::()); @@ -1039,9 +799,6 @@ mod tests { assert_ok!(test_benchmark_unlock_set::()); assert_ok!(test_benchmark_remove_vote::()); assert_ok!(test_benchmark_remove_other_vote::()); - assert_ok!(test_benchmark_proxy_delegate::()); - assert_ok!(test_benchmark_proxy_undelegate::()); - assert_ok!(test_benchmark_proxy_remove_vote::()); assert_ok!(test_benchmark_enact_proposal_execute::()); assert_ok!(test_benchmark_enact_proposal_slash::()); }); diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 580e80cce0..841281c125 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -52,8 +52,6 @@ //! account or an external origin) suggests that the system adopt. //! - **Referendum:** A proposal that is in the process of being voted on for //! either acceptance or rejection as a change to the system. -//! - **Proxy:** An account that has full voting power on behalf of a separate "Stash" account -//! that holds the funds. //! - **Delegation:** The act of granting your voting power to the decisions of another account for //! up to a certain conviction. //! @@ -93,18 +91,6 @@ //! - `reap_vote` - Remove some account's expired votes. //! - `unlock` - Redetermine the account's balance lock, potentially making tokens available. //! -//! Proxy administration: -//! - `activate_proxy` - Activates a proxy that is already open to the sender. -//! - `close_proxy` - Clears the proxy status, called by the proxy. -//! - `deactivate_proxy` - Deactivates a proxy back to the open status, called by the stash. -//! - `open_proxy` - Opens a proxy account on behalf of the sender. -//! -//! Proxy actions: -//! - `proxy_vote` - Votes in a referendum on behalf of a stash account. -//! - `proxy_unvote` - Cancel a previous vote, done on behalf of the voter by a proxy. -//! - `proxy_delegate` - Delegate voting power, done on behalf of the voter by a proxy. -//! - `proxy_undelegate` - Stop delegating voting power, done on behalf of the voter by a proxy. -//! //! Preimage actions: //! - `note_preimage` - Registers the preimage for an upcoming proposal, requires //! a deposit that is returned once the proposal is enacted. @@ -191,7 +177,7 @@ mod types; pub use vote_threshold::{Approved, VoteThreshold}; pub use vote::{Vote, AccountVote, Voting}; pub use conviction::Conviction; -pub use types::{ReferendumInfo, ReferendumStatus, ProxyState, Tally, UnvoteScope, Delegations}; +pub use types::{ReferendumInfo, ReferendumStatus, Tally, UnvoteScope, Delegations}; #[cfg(test)] mod tests; @@ -376,14 +362,6 @@ decl_storage! { /// TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway. pub VotingOf: map hasher(twox_64_concat) T::AccountId => Voting, T::AccountId, T::BlockNumber>; - /// Who is able to vote for whom. Value is the fund-holding account, key is the - /// vote-transaction-sending account. - /// - /// TWOX-NOTE: OK ― `AccountId` is a secure hash. - // TODO: Refactor proxy into its own pallet. - // https://github.com/paritytech/substrate/issues/5322 - pub Proxy get(fn proxy): map hasher(twox_64_concat) T::AccountId => Option>; - /// Accounts for which there are locks in action which may be removed at some point in the /// future. The value is the block number at which the lock expires and may be removed. /// @@ -467,8 +445,6 @@ decl_error! { ValueLow, /// Proposal does not exist ProposalMissing, - /// Not a proxy - NotProxy, /// Unknown index BadIndex, /// Cannot cancel the same proposal twice @@ -485,10 +461,6 @@ decl_error! { NoProposal, /// Identity may not veto a proposal twice AlreadyVetoed, - /// Already a proxy - AlreadyProxy, - /// Wrong proxy - WrongProxy, /// Not delegated NotDelegated, /// Preimage already noted @@ -511,12 +483,6 @@ decl_error! { NotLocked, /// The lock on the account to be unlocked has not yet expired. NotExpired, - /// A proxy-pairing was attempted to an account that was not open. - NotOpen, - /// A proxy-pairing was attempted to an account that was open to another account. - WrongOpen, - /// A proxy-de-pairing was attempted to an account that was not active. - NotActive, /// The given account did not vote on the referendum. NotVoter, /// The actor has no permission to conduct the action. @@ -575,27 +541,6 @@ mod weight_for { .saturating_add(votes.saturating_mul(8_000_000)) } - /// Calculate the weight for `proxy_delegate`. - /// same as `delegate with additional: - /// - Db reads: `Proxy`, `proxy account` - /// - Db writes: `proxy account` - /// - Base Weight: 68.61 + 8.039 * R µs - pub fn proxy_delegate(votes: Weight) -> Weight { - T::DbWeight::get().reads_writes(votes.saturating_add(5), votes.saturating_add(4)) - .saturating_add(69_000_000) - .saturating_add(votes.saturating_mul(8_000_000)) - } - - /// Calculate the weight for `proxy_undelegate`. - /// same as `undelegate with additional: - /// Db reads: `Proxy` - /// Base Weight: 39 + 7.958 * R µs - pub fn proxy_undelegate(votes: Weight) -> Weight { - T::DbWeight::get().reads_writes(votes.saturating_add(3), votes.saturating_add(2)) - .saturating_add(40_000_000) - .saturating_add(votes.saturating_mul(8_000_000)) - } - /// Calculate the weight for `note_preimage`. /// # /// - Complexity: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). @@ -766,34 +711,6 @@ decl_module! { Self::try_vote(&who, ref_index, vote) } - /// Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact - /// the proposal; otherwise it is a vote to keep the status quo. - /// - /// The dispatch origin of this call must be _Signed_. - /// - /// - `ref_index`: The index of the referendum to proxy vote for. - /// - `vote`: The vote configuration. - /// - /// # - /// - Complexity: `O(R)` where R is the number of referendums the proxy has voted on. - /// weight is charged as if maximum votes. - /// - Db reads: `ReferendumInfoOf`, `VotingOf`, `balances locks`, `Proxy`, `proxy account` - /// - Db writes: `ReferendumInfoOf`, `VotingOf`, `balances locks` - /// ------------ - /// - Base Weight: - /// - Proxy Vote New: 54.35 + .344 * R µs - /// - Proxy Vote Existing: 54.35 + .35 * R µs - /// # - #[weight = 55_000_000 + 350_000 * Weight::from(T::MaxVotes::get()) + T::DbWeight::get().reads_writes(5, 3)] - fn proxy_vote(origin, - #[compact] ref_index: ReferendumIndex, - vote: AccountVote>, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - let voter = Self::proxy(who).and_then(|a| a.as_active()).ok_or(Error::::NotProxy)?; - Self::try_vote(&voter, ref_index, vote) - } - /// Schedule an emergency cancellation of a referendum. Cannot happen twice to the same /// referendum. /// @@ -1028,86 +945,6 @@ decl_module! { }) } - /// Specify a proxy that is already open to us. Called by the stash. - /// - /// NOTE: Used to be called `set_proxy`. - /// - /// The dispatch origin of this call must be _Signed_. - /// - /// - `proxy`: The account that will be activated as proxy. - /// - /// # - /// - Complexity: `O(1)` - /// - Db reads: `Proxy` - /// - Db writes: `Proxy` - /// - Base Weight: 7.972 µs - /// # - #[weight = 8_000_000 + T::DbWeight::get().reads_writes(1, 1)] - fn activate_proxy(origin, proxy: T::AccountId) { - let who = ensure_signed(origin)?; - Proxy::::try_mutate(&proxy, |a| match a.take() { - None => Err(Error::::NotOpen), - Some(ProxyState::Active(_)) => Err(Error::::AlreadyProxy), - Some(ProxyState::Open(x)) if &x == &who => { - *a = Some(ProxyState::Active(who)); - Ok(()) - } - Some(ProxyState::Open(_)) => Err(Error::::WrongOpen), - })?; - } - - /// Clear the proxy. Called by the proxy. - /// - /// NOTE: Used to be called `resign_proxy`. - /// - /// The dispatch origin of this call must be _Signed_. - /// - /// # - /// - Complexity: `O(1)` - /// - Db reads: `Proxy`, `sender account` - /// - Db writes: `Proxy`, `sender account` - /// - Base Weight: 15.41 µs - /// # - #[weight = 16_000_000 + T::DbWeight::get().reads_writes(1, 1)] - fn close_proxy(origin) { - let who = ensure_signed(origin)?; - Proxy::::mutate(&who, |a| { - if a.is_some() { - system::Module::::dec_ref(&who); - } - *a = None; - }); - } - - /// Deactivate the proxy, but leave open to this account. Called by the stash. - /// - /// The proxy must already be active. - /// - /// NOTE: Used to be called `remove_proxy`. - /// - /// The dispatch origin of this call must be _Signed_. - /// - /// - `proxy`: The account that will be deactivated as proxy. - /// - /// # - /// - Complexity: `O(1)` - /// - Db reads: `Proxy` - /// - Db writes: `Proxy` - /// - Base Weight: 8.03 µs - /// # - #[weight = 8_000_000 + T::DbWeight::get().reads_writes(1, 1)] - fn deactivate_proxy(origin, proxy: T::AccountId) { - let who = ensure_signed(origin)?; - Proxy::::try_mutate(&proxy, |a| match a.take() { - None | Some(ProxyState::Open(_)) => Err(Error::::NotActive), - Some(ProxyState::Active(x)) if &x == &who => { - *a = Some(ProxyState::Open(who)); - Ok(()) - } - Some(ProxyState::Active(_)) => Err(Error::::WrongProxy), - })?; - } - /// Delegate the voting power (with some given conviction) of the sending account. /// /// The balance delegated is locked for as long as it's delegated, and thereafter for the @@ -1314,33 +1151,6 @@ decl_module! { Self::update_lock(&target); } - /// Become a proxy. - /// - /// This must be called prior to a later `activate_proxy`. - /// - /// Origin must be a Signed. - /// - /// - `target`: The account whose votes will later be proxied. - /// - /// `close_proxy` must be called before the account can be destroyed. - /// - /// # - /// - Complexity: O(1) - /// - Db reads: `Proxy`, `proxy account` - /// - Db writes: `Proxy`, `proxy account` - /// - Base Weight: 14.86 µs - /// # - #[weight = 15_000_000 + T::DbWeight::get().reads_writes(2, 2)] - fn open_proxy(origin, target: T::AccountId) { - let who = ensure_signed(origin)?; - Proxy::::mutate(&who, |a| { - if a.is_none() { - system::Module::::inc_ref(&who); - } - *a = Some(ProxyState::Open(target)); - }); - } - /// Remove a vote for a referendum. /// /// If: @@ -1407,94 +1217,6 @@ decl_module! { Ok(()) } - /// Delegate the voting power (with some given conviction) of a proxied account. - /// - /// The balance delegated is locked for as long as it's delegated, and thereafter for the - /// time appropriate for the conviction's lock period. - /// - /// The dispatch origin of this call must be _Signed_, and the signing account must have - /// been set as the proxy account for `target`. - /// - /// - `target`: The account whole voting power shall be delegated and whose balance locked. - /// This account must either: - /// - be delegating already; or - /// - have no voting activity (if there is, then it will need to be removed/consolidated - /// through `reap_vote` or `unvote`). - /// - `to`: The account whose voting the `target` account's voting power will follow. - /// - `conviction`: The conviction that will be attached to the delegated votes. When the - /// account is undelegated, the funds will be locked for the corresponding period. - /// - `balance`: The amount of the account's balance to be used in delegating. This must - /// not be more than the account's current balance. - /// - /// Emits `Delegated`. - /// - /// # - /// same as `delegate with additional: - /// - Db reads: `Proxy`, `proxy account` - /// - Db writes: `proxy account` - /// - Base Weight: 68.61 + 8.039 * R µs - /// # - #[weight = weight_for::proxy_delegate::(T::MaxVotes::get().into())] - pub fn proxy_delegate(origin, - to: T::AccountId, - conviction: Conviction, - balance: BalanceOf, - ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - let target = Self::proxy(who).and_then(|a| a.as_active()).ok_or(Error::::NotProxy)?; - let votes = Self::try_delegate(target, to, conviction, balance)?; - - Ok(Some(weight_for::proxy_delegate::(votes.into())).into()) - } - - /// Undelegate the voting power of a proxied account. - /// - /// Tokens may be unlocked following once an amount of time consistent with the lock period - /// of the conviction with which the delegation was issued. - /// - /// The dispatch origin of this call must be _Signed_ and the signing account must be a - /// proxy for some other account which is currently delegating. - /// - /// Emits `Undelegated`. - /// - /// # - /// same as `undelegate with additional: - /// Db reads: `Proxy` - /// Base Weight: 39 + 7.958 * R µs - /// # - #[weight = weight_for::proxy_undelegate::(T::MaxVotes::get().into())] - fn proxy_undelegate(origin) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - let target = Self::proxy(who).and_then(|a| a.as_active()).ok_or(Error::::NotProxy)?; - let votes = Self::try_undelegate(target)?; - - Ok(Some(weight_for::proxy_undelegate::(votes.into())).into()) - } - - /// Remove a proxied vote for a referendum. - /// - /// Exactly equivalent to `remove_vote` except that it operates on the account that the - /// sender is a proxy for. - /// - /// The dispatch origin of this call must be _Signed_ and the signing account must be a - /// proxy for some other account which has a registered vote for the referendum of `index`. - /// - /// - `index`: The index of referendum of the vote to be removed. - /// - /// # - /// - `O(R + log R)` where R is the number of referenda that `target` has voted on. - /// Weight is calculated for the maximum number of vote. - /// - Db reads: `ReferendumInfoOf`, `VotingOf`, `Proxy` - /// - Db writes: `ReferendumInfoOf`, `VotingOf` - /// - Base Weight: 26.35 + .36 * R µs - /// # - #[weight = 26_000_000 + 360_000 * Weight::from(T::MaxVotes::get()) + T::DbWeight::get().reads_writes(2, 3)] - fn proxy_remove_vote(origin, index: ReferendumIndex) -> DispatchResult { - let who = ensure_signed(origin)?; - let target = Self::proxy(who).and_then(|a| a.as_active()).ok_or(Error::::NotProxy)?; - Self::try_remove_vote(&target, index, UnvoteScope::Any) - } - /// Enact a proposal from a referendum. For now we just make the weight be the maximum. #[weight = T::MaximumBlockWeight::get()] fn enact_proposal(origin, proposal_hash: T::Hash, index: ReferendumIndex) -> DispatchResult { @@ -1538,16 +1260,6 @@ impl Module { // Exposed mutables. - #[cfg(feature = "std")] - pub fn force_proxy(stash: T::AccountId, proxy: T::AccountId) { - Proxy::::mutate(&proxy, |o| { - if o.is_none() { - system::Module::::inc_ref(&proxy); - } - *o = Some(ProxyState::Active(stash)) - }) - } - /// Start a referendum. pub fn internal_start_referendum( proposal_hash: T::Hash, diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index 103ac6a84b..36c2b7093b 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -38,7 +38,6 @@ mod external_proposing; mod fast_tracking; mod lock_voting; mod preimage; -mod proxying; mod public_proposals; mod scheduling; mod voting; diff --git a/frame/democracy/src/tests/proxying.rs b/frame/democracy/src/tests/proxying.rs deleted file mode 100644 index 2e39528e75..0000000000 --- a/frame/democracy/src/tests/proxying.rs +++ /dev/null @@ -1,105 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! The tests for functionality concerning proxying. - -use super::*; - -#[test] -fn proxy_should_work() { - new_test_ext().execute_with(|| { - assert_eq!(Democracy::proxy(10), None); - assert!(System::allow_death(&10)); - - assert_noop!(Democracy::activate_proxy(Origin::signed(1), 10), Error::::NotOpen); - - assert_ok!(Democracy::open_proxy(Origin::signed(10), 1)); - assert!(!System::allow_death(&10)); - assert_eq!(Democracy::proxy(10), Some(ProxyState::Open(1))); - - assert_noop!(Democracy::activate_proxy(Origin::signed(2), 10), Error::::WrongOpen); - assert_ok!(Democracy::activate_proxy(Origin::signed(1), 10)); - assert_eq!(Democracy::proxy(10), Some(ProxyState::Active(1))); - - // Can't set when already set. - assert_noop!(Democracy::activate_proxy(Origin::signed(2), 10), Error::::AlreadyProxy); - - // But this works because 11 isn't proxying. - assert_ok!(Democracy::open_proxy(Origin::signed(11), 2)); - assert_ok!(Democracy::activate_proxy(Origin::signed(2), 11)); - assert_eq!(Democracy::proxy(10), Some(ProxyState::Active(1))); - assert_eq!(Democracy::proxy(11), Some(ProxyState::Active(2))); - - // 2 cannot fire 1's proxy: - assert_noop!(Democracy::deactivate_proxy(Origin::signed(2), 10), Error::::WrongProxy); - - // 1 deactivates their proxy: - assert_ok!(Democracy::deactivate_proxy(Origin::signed(1), 10)); - assert_eq!(Democracy::proxy(10), Some(ProxyState::Open(1))); - // but the proxy account cannot be killed until the proxy is closed. - assert!(!System::allow_death(&10)); - - // and then 10 closes it completely: - assert_ok!(Democracy::close_proxy(Origin::signed(10))); - assert_eq!(Democracy::proxy(10), None); - assert!(System::allow_death(&10)); - - // 11 just closes without 2's "permission". - assert_ok!(Democracy::close_proxy(Origin::signed(11))); - assert_eq!(Democracy::proxy(11), None); - assert!(System::allow_death(&11)); - }); -} - -#[test] -fn voting_and_removing_votes_should_work_with_proxy() { - new_test_ext().execute_with(|| { - System::set_block_number(0); - assert_ok!(propose_set_balance_and_note(1, 2, 1)); - - fast_forward_to(2); - let r = 0; - assert_ok!(Democracy::open_proxy(Origin::signed(10), 1)); - assert_ok!(Democracy::activate_proxy(Origin::signed(1), 10)); - - assert_ok!(Democracy::proxy_vote(Origin::signed(10), r, aye(1))); - assert_eq!(tally(r), Tally { ayes: 1, nays: 0, turnout: 10 }); - - assert_ok!(Democracy::proxy_remove_vote(Origin::signed(10), r)); - assert_eq!(tally(r), Tally { ayes: 0, nays: 0, turnout: 0 }); - }); -} - -#[test] -fn delegation_and_undelegation_should_work_with_proxy() { - new_test_ext().execute_with(|| { - System::set_block_number(0); - assert_ok!(propose_set_balance_and_note(1, 2, 1)); - fast_forward_to(2); - let r = 0; - assert_ok!(Democracy::open_proxy(Origin::signed(10), 1)); - assert_ok!(Democracy::activate_proxy(Origin::signed(1), 10)); - assert_ok!(Democracy::vote(Origin::signed(2), r, aye(2))); - - assert_ok!(Democracy::proxy_delegate(Origin::signed(10), 2, Conviction::None, 10)); - assert_eq!(tally(r), Tally { ayes: 3, nays: 0, turnout: 30 }); - - assert_ok!(Democracy::proxy_undelegate(Origin::signed(10))); - assert_eq!(tally(r), Tally { ayes: 2, nays: 0, turnout: 20 }); - }); -} - diff --git a/frame/democracy/src/types.rs b/frame/democracy/src/types.rs index efd52361f5..8ee0838f8a 100644 --- a/frame/democracy/src/types.rs +++ b/frame/democracy/src/types.rs @@ -197,24 +197,6 @@ impl ReferendumInfo { - /// Account is open to becoming a proxy but is not yet assigned. - Open(AccountId), - /// Account is actively being a proxy. - Active(AccountId), -} - -impl ProxyState { - pub (crate) fn as_active(self) -> Option { - match self { - ProxyState::Active(a) => Some(a), - ProxyState::Open(_) => None, - } - } -} - /// Whether an `unvote` operation is able to make actions that are not strictly always in the /// interest of an account. pub enum UnvoteScope { diff --git a/frame/elections/src/lib.rs b/frame/elections/src/lib.rs index 1085831373..171a2dbb8b 100644 --- a/frame/elections/src/lib.rs +++ b/frame/elections/src/lib.rs @@ -274,10 +274,6 @@ decl_storage! { /// of each entry; It may be the direct summed approval stakes, or a weighted version of it. /// Sorted from low to high. pub Leaderboard get(fn leaderboard): Option, T::AccountId)> >; - - /// Who is able to vote for whom. Value is the fund-holding account, key is the - /// vote-transaction-sending account. - pub Proxy get(fn proxy): map hasher(blake2_128_concat) T::AccountId => Option; } } @@ -292,8 +288,6 @@ decl_error! { CannotReapPresenting, /// Cannot reap during grace period. ReapGrace, - /// Not a proxy. - NotProxy, /// Invalid reporter index. InvalidReporterIndex, /// Invalid target index. @@ -430,23 +424,6 @@ decl_module! { Self::do_set_approvals(who, votes, index, hint, value) } - /// Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in - /// those slots are registered. - /// - /// # - /// - Same as `set_approvals` with one additional storage read. - /// # - #[weight = 2_500_000_000] - fn proxy_set_approvals(origin, - votes: Vec, - #[compact] index: VoteIndex, - hint: SetIndex, - #[compact] value: BalanceOf, - ) -> DispatchResult { - let who = Self::proxy(ensure_signed(origin)?).ok_or(Error::::NotProxy)?; - Self::do_set_approvals(who, votes, index, hint, value) - } - /// Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices /// must now be either unregistered or registered to a candidate that registered the slot /// after the voter gave their last approval set. diff --git a/frame/elections/src/tests.rs b/frame/elections/src/tests.rs index 590266f7fe..8a9f58b54a 100644 --- a/frame/elections/src/tests.rs +++ b/frame/elections/src/tests.rs @@ -868,45 +868,6 @@ fn election_voting_should_work() { }); } -#[test] -fn election_proxy_voting_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_ok!(Elections::submit_candidacy(Origin::signed(5), 0)); - - >::insert(11, 1); - >::insert(12, 2); - >::insert(13, 3); - >::insert(14, 4); - assert_ok!( - Elections::proxy_set_approvals(Origin::signed(11), vec![true], 0, 0, 10) - ); - assert_ok!( - Elections::proxy_set_approvals(Origin::signed(14), vec![true], 0, 1, 40) - ); - - assert_eq!(Elections::all_approvals_of(&1), vec![true]); - assert_eq!(Elections::all_approvals_of(&4), vec![true]); - assert_eq!(voter_ids(), vec![1, 4]); - - assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1)); - assert_ok!(Elections::submit_candidacy(Origin::signed(3), 2)); - - assert_ok!( - Elections::proxy_set_approvals(Origin::signed(12), vec![false, true], 0, 2, 20) - ); - assert_ok!( - Elections::proxy_set_approvals(Origin::signed(13), vec![false, true], 0, 3, 30) - ); - - assert_eq!(Elections::all_approvals_of(&1), vec![true]); - assert_eq!(Elections::all_approvals_of(&4), vec![true]); - assert_eq!(Elections::all_approvals_of(&2), vec![false, true]); - assert_eq!(Elections::all_approvals_of(&3), vec![false, true]); - - assert_eq!(voter_ids(), vec![1, 4, 2, 3]); - }); -} - #[test] fn election_simple_tally_should_work() { ExtBuilder::default().build().execute_with(|| { diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml new file mode 100644 index 0000000000..bf76683d6c --- /dev/null +++ b/frame/proxy/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "pallet-proxy" +version = "2.0.0-rc2" +authors = ["Parity Technologies "] +edition = "2018" +license = "Apache-2.0" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/substrate/" +description = "FRAME proxying pallet" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.101", optional = true } +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } + +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } + +[dev-dependencies] +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } + +[features] +default = ["std"] +std = [ + "serde", + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "sp-std/std" +] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-support/runtime-benchmarks", +] diff --git a/frame/proxy/src/benchmarking.rs b/frame/proxy/src/benchmarking.rs new file mode 100644 index 0000000000..5c938c12dc --- /dev/null +++ b/frame/proxy/src/benchmarking.rs @@ -0,0 +1,88 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Benchmarks for Proxy Pallet + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_system::RawOrigin; +use frame_benchmarking::{benchmarks, account}; +use sp_runtime::traits::Bounded; +use crate::Module as Proxy; + +const SEED: u32 = 0; + +fn add_proxies(n: u32) -> Result<(), &'static str> { + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + for i in 0..n { + Proxy::::add_proxy( + RawOrigin::Signed(caller.clone()).into(), + account("target", i, SEED), + T::ProxyType::default() + )?; + } + Ok(()) +} + +benchmarks! { + _ { + let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(p)?; + } + + proxy { + let p in ...; + // In this case the caller is the "target" proxy + let caller: T::AccountId = account("target", p - 1, SEED); + // ... and "real" is the traditional caller. This is not a typo. + let real: T::AccountId = account("caller", 0, SEED); + let call: ::Call = frame_system::Call::::remark(vec![]).into(); + }: _(RawOrigin::Signed(caller), real, Some(T::ProxyType::default()), Box::new(call)) + + add_proxy { + let p in ...; + let caller: T::AccountId = account("caller", 0, SEED); + }: _(RawOrigin::Signed(caller), account("target", T::MaxProxies::get().into(), SEED), T::ProxyType::default()) + + remove_proxy { + let p in ...; + let caller: T::AccountId = account("caller", 0, SEED); + }: _(RawOrigin::Signed(caller), account("target", 0, SEED), T::ProxyType::default()) + + remove_proxies { + let p in ...; + let caller: T::AccountId = account("caller", 0, SEED); + }: _(RawOrigin::Signed(caller)) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::{new_test_ext, Test}; + use frame_support::assert_ok; + + #[test] + fn test_benchmarks() { + new_test_ext().execute_with(|| { + assert_ok!(test_benchmark_proxy::()); + assert_ok!(test_benchmark_add_proxy::()); + assert_ok!(test_benchmark_remove_proxy::()); + assert_ok!(test_benchmark_remove_proxies::()); + }); + } +} diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs new file mode 100644 index 0000000000..94740d7e79 --- /dev/null +++ b/frame/proxy/src/lib.rs @@ -0,0 +1,271 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Proxy Module +//! A module allowing accounts to give permission to other accounts to dispatch types of calls from +//! their signed origin. +//! +//! - [`proxy::Trait`](./trait.Trait.html) +//! - [`Call`](./enum.Call.html) +//! +//! ## Overview +//! +//! ## Interface +//! +//! ### Dispatchable Functions +//! +//! [`Call`]: ./enum.Call.html +//! [`Trait`]: ./trait.Trait.html + +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_std::prelude::*; +use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure}; +use frame_support::{ + traits::{Get, ReservableCurrency, Currency, Filter, InstanceFilter}, + weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, + dispatch::{PostDispatchInfo, IsSubType}, +}; +use frame_system::{self as system, ensure_signed}; +use sp_runtime::{DispatchResult, traits::{Dispatchable, Zero}}; +use sp_runtime::traits::Member; + +mod tests; +mod benchmarking; + +type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; + +/// Configuration trait. +pub trait Trait: frame_system::Trait { + /// The overarching event type. + type Event: From + Into<::Event>; + + /// The overarching call type. + type Call: Parameter + Dispatchable + + GetDispatchInfo + From> + IsSubType, Self>; + + /// The currency mechanism. + type Currency: ReservableCurrency; + + /// Is a given call compatible with the proxying subsystem? + type IsCallable: Filter<::Call>; + + /// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler. + /// The instance filter determines whether a given call may be proxied under this type. + type ProxyType: Parameter + Member + Ord + PartialOrd + InstanceFilter<::Call> + + Default; + + /// The base amount of currency needed to reserve for creating a proxy. + /// + /// This is held for an additional storage item whose value size is + /// `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes. + type ProxyDepositBase: Get>; + + /// The amount of currency needed per proxy added. + /// + /// This is held for adding 32 bytes plus an instance of `ProxyType` more into a pre-existing + /// storage value. + type ProxyDepositFactor: Get>; + + /// The maximum amount of proxies allowed for a single account. + type MaxProxies: Get; +} + +decl_storage! { + trait Store for Module as Proxy { + /// The set of account proxies. Maps the account which has delegated to the accounts + /// which are being delegated to, together with the amount held on deposit. + pub Proxies: map hasher(twox_64_concat) T::AccountId => (Vec<(T::AccountId, T::ProxyType)>, BalanceOf); + } +} + +decl_error! { + pub enum Error for Module { + /// There are too many proxies registered. + TooMany, + /// Proxy registration not found. + NotFound, + /// Sender is not a proxy of the account to be proxied. + NotProxy, + /// A call with a `false` `IsCallable` filter was attempted. + Uncallable, + /// A call which is incompatible with the proxy type's filter was attempted. + Unproxyable, + /// Account is already a proxy. + Duplicate, + /// Call may not be made by proxy because it may escalate its privileges. + NoPermission, + } +} + +decl_event! { + /// Events type. + pub enum Event { + /// A proxy was executed correctly, with the given result. + ProxyExecuted(DispatchResult), + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + /// Deposit one of this module's events by using the default implementation. + fn deposit_event() = default; + + /// Dispatch the given `call` from an account that the sender is authorised for through + /// `add_proxy`. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// Parameters: + /// - `real`: The account that the proxy will make a call on behalf of. + /// - `force_proxy_type`: Specify the exact proxy type to be used and checked for this call. + /// - `call`: The call to be made by the `real` account. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 19.87 + .141 * P µs + /// - DB weight: 1 storage read. + /// - Plus the weight of the `call` + /// # + #[weight = { + let di = call.get_dispatch_info(); + (T::DbWeight::get().reads(1) + .saturating_add(di.weight) + .saturating_add(20 * WEIGHT_PER_MICROS) + .saturating_add((140 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())), + di.class) + }] + fn proxy(origin, + real: T::AccountId, + force_proxy_type: Option, + call: Box<::Call> + ) { + let who = ensure_signed(origin)?; + ensure!(T::IsCallable::filter(&call), Error::::Uncallable); + let (_, proxy_type) = Proxies::::get(&real).0.into_iter() + .find(|x| &x.0 == &who && force_proxy_type.as_ref().map_or(true, |y| &x.1 == y)) + .ok_or(Error::::NotProxy)?; + match call.is_sub_type() { + Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) => + ensure!(&proxy_type == pt, Error::::NoPermission), + _ => (), + } + ensure!(proxy_type.filter(&call), Error::::Unproxyable); + let e = call.dispatch(frame_system::RawOrigin::Signed(real).into()); + Self::deposit_event(Event::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error))); + } + + /// Register a proxy account for the sender that is able to make calls on its behalf. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// Parameters: + /// - `proxy`: The account that the `caller` would like to make a proxy. + /// - `proxy_type`: The permissions allowed for this proxy account. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 17.48 + .176 * P µs + /// - DB weight: 1 storage read and write. + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + .saturating_add(18 * WEIGHT_PER_MICROS) + .saturating_add((200 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + ] + fn add_proxy(origin, proxy: T::AccountId, proxy_type: T::ProxyType) -> DispatchResult { + let who = ensure_signed(origin)?; + Proxies::::try_mutate(&who, |(ref mut proxies, ref mut deposit)| { + ensure!(proxies.len() < T::MaxProxies::get() as usize, Error::::TooMany); + let typed_proxy = (proxy, proxy_type); + let i = proxies.binary_search(&typed_proxy).err().ok_or(Error::::Duplicate)?; + proxies.insert(i, typed_proxy); + let new_deposit = T::ProxyDepositBase::get() + + T::ProxyDepositFactor::get() * (proxies.len() as u32).into(); + if new_deposit > *deposit { + T::Currency::reserve(&who, new_deposit - *deposit)?; + } else if new_deposit < *deposit { + T::Currency::unreserve(&who, *deposit - new_deposit); + } + *deposit = new_deposit; + Ok(()) + }) + } + + /// Unregister a proxy account for the sender. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// Parameters: + /// - `proxy`: The account that the `caller` would like to remove as a proxy. + /// - `proxy_type`: The permissions currently enabled for the removed proxy account. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 14.37 + .164 * P µs + /// - DB weight: 1 storage read and write. + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + .saturating_add(14 * WEIGHT_PER_MICROS) + .saturating_add((160 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + ] + fn remove_proxy(origin, proxy: T::AccountId, proxy_type: T::ProxyType) -> DispatchResult { + let who = ensure_signed(origin)?; + Proxies::::try_mutate_exists(&who, |x| { + let (mut proxies, old_deposit) = x.take().ok_or(Error::::NotFound)?; + let typed_proxy = (proxy, proxy_type); + let i = proxies.binary_search(&typed_proxy).ok().ok_or(Error::::NotFound)?; + proxies.remove(i); + let new_deposit = if proxies.is_empty() { + BalanceOf::::zero() + } else { + T::ProxyDepositBase::get() + T::ProxyDepositFactor::get() * (proxies.len() as u32).into() + }; + if new_deposit > old_deposit { + T::Currency::reserve(&who, new_deposit - old_deposit)?; + } else if new_deposit < old_deposit { + T::Currency::unreserve(&who, old_deposit - new_deposit); + } + if !proxies.is_empty() { + *x = Some((proxies, new_deposit)) + } + Ok(()) + }) + } + + /// Unregister all proxy accounts for the sender. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 13.73 + .129 * P µs + /// - DB weight: 1 storage read and write. + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + .saturating_add(14 * WEIGHT_PER_MICROS) + .saturating_add((130 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + ] + fn remove_proxies(origin) { + let who = ensure_signed(origin)?; + let (_, old_deposit) = Proxies::::take(&who); + T::Currency::unreserve(&who, old_deposit); + } + } +} diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs new file mode 100644 index 0000000000..2d22f2d53c --- /dev/null +++ b/frame/proxy/src/tests.rs @@ -0,0 +1,220 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests for Proxy Pallet + +#![cfg(test)] + +use super::*; + +use frame_support::{ + assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, + weights::Weight, impl_outer_event, RuntimeDebug +}; +use codec::{Encode, Decode}; +use sp_core::H256; +use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; +use crate as proxy; + +impl_outer_origin! { + pub enum Origin for Test where system = frame_system {} +} +impl_outer_event! { + pub enum TestEvent for Test { + system, + pallet_balances, + proxy, + } +} +impl_outer_dispatch! { + pub enum Call for Test where origin: Origin { + frame_system::System, + pallet_balances::Balances, + proxy::Proxy, + } +} + +// For testing the pallet, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of pallets we want to use. +#[derive(Clone, Eq, PartialEq)] +pub struct Test; +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); +} +impl frame_system::Trait for Test { + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Call = Call; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = TestEvent; + type BlockHashCount = BlockHashCount; + type MaximumBlockWeight = MaximumBlockWeight; + type DbWeight = (); + type BlockExecutionWeight = (); + type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; + type MaximumBlockLength = MaximumBlockLength; + type AvailableBlockRatio = AvailableBlockRatio; + type Version = (); + type ModuleToIndex = (); + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); +} +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} +impl pallet_balances::Trait for Test { + type Balance = u64; + type Event = TestEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; +} +parameter_types! { + pub const ProxyDepositBase: u64 = 1; + pub const ProxyDepositFactor: u64 = 1; + pub const MaxProxies: u16 = 3; +} +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] +pub enum ProxyType { + Any, + JustTransfer, +} +impl Default for ProxyType { fn default() -> Self { Self::Any } } +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { + match self { + ProxyType::Any => true, + ProxyType::JustTransfer => match c { + Call::Balances(pallet_balances::Call::transfer(..)) => true, + _ => false, + } + } + } +} +pub struct TestIsCallable; +impl Filter for TestIsCallable { + fn filter(c: &Call) -> bool { + match *c { + Call::Balances(_) => true, + _ => false, + } + } +} +impl Trait for Test { + type Event = TestEvent; + type Call = Call; + type Currency = Balances; + type IsCallable = TestIsCallable; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; +} + +type System = frame_system::Module; +type Balances = pallet_balances::Module; +type Proxy = Module; + +use frame_system::Call as SystemCall; +use pallet_balances::Call as BalancesCall; +use pallet_balances::Error as BalancesError; + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 2)], + }.assimilate_storage(&mut t).unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext +} + +fn last_event() -> TestEvent { + system::Module::::events().pop().map(|e| e.event).expect("Event expected") +} + +fn expect_event>(e: E) { + assert_eq!(last_event(), e.into()); +} + +#[test] +fn add_remove_proxies_works() { + new_test_ext().execute_with(|| { + assert_ok!(Proxy::add_proxy(Origin::signed(1), 2, ProxyType::Any)); + assert_noop!(Proxy::add_proxy(Origin::signed(1), 2, ProxyType::Any), Error::::Duplicate); + assert_eq!(Balances::reserved_balance(1), 2); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 2, ProxyType::JustTransfer)); + assert_eq!(Balances::reserved_balance(1), 3); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 3, ProxyType::Any)); + assert_eq!(Balances::reserved_balance(1), 4); + assert_noop!(Proxy::add_proxy(Origin::signed(1), 4, ProxyType::Any), Error::::TooMany); + assert_noop!(Proxy::remove_proxy(Origin::signed(1), 3, ProxyType::JustTransfer), Error::::NotFound); + assert_ok!(Proxy::remove_proxy(Origin::signed(1), 3, ProxyType::Any)); + assert_eq!(Balances::reserved_balance(1), 3); + assert_ok!(Proxy::remove_proxy(Origin::signed(1), 2, ProxyType::Any)); + assert_eq!(Balances::reserved_balance(1), 2); + assert_ok!(Proxy::remove_proxy(Origin::signed(1), 2, ProxyType::JustTransfer)); + assert_eq!(Balances::reserved_balance(1), 0); + }); +} + +#[test] +fn cannot_add_proxy_without_balance() { + new_test_ext().execute_with(|| { + assert_ok!(Proxy::add_proxy(Origin::signed(5), 3, ProxyType::Any)); + assert_eq!(Balances::reserved_balance(5), 2); + assert_noop!( + Proxy::add_proxy(Origin::signed(5), 4, ProxyType::Any), + BalancesError::::InsufficientBalance + ); + }); +} + +#[test] +fn proxying_works() { + new_test_ext().execute_with(|| { + assert_ok!(Proxy::add_proxy(Origin::signed(1), 2, ProxyType::JustTransfer)); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 3, ProxyType::Any)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); + assert_noop!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()), Error::::NotProxy); + assert_noop!(Proxy::proxy(Origin::signed(2), 1, Some(ProxyType::Any), call.clone()), Error::::NotProxy); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_event(Event::ProxyExecuted(Ok(()))); + assert_eq!(Balances::free_balance(6), 1); + + let call = Box::new(Call::System(SystemCall::remark(vec![]))); + assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + + let call = Box::new(Call::Balances(BalancesCall::transfer_keep_alive(6, 1))); + assert_noop!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()), Error::::Unproxyable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(Event::ProxyExecuted(Ok(()))); + assert_eq!(Balances::free_balance(6), 2); + }); +} diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 05e703a5e8..568401a498 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -43,6 +43,16 @@ impl Filter for () { fn filter(_: &T) -> bool { true } } +/// Simple trait for providing a filter over a reference to some type, given an instance of itself. +pub trait InstanceFilter { + /// Determine if a given value should be allowed through the filter (returns `true`) or not. + fn filter(&self, _: &T) -> bool; +} + +impl InstanceFilter for () { + fn filter(&self, _: &T) -> bool { true } +} + /// An abstraction of a value stored within storage, but possibly as part of a larger composite /// item. pub trait StoredMap { diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index 546af51bdd..ea56bc4599 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -168,7 +168,7 @@ decl_error! { WrongTimepoint, /// A timepoint was given, yet no multisig operation is underway. UnexpectedTimepoint, - /// A call with a `false` IsCallable filter was attempted. + /// A call with a `false` `IsCallable` filter was attempted. Uncallable, } } diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index daf3d6c53a..a74d9b3253 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -99,12 +99,11 @@ parameter_types! { pub const MultisigDepositFactor: u64 = 1; pub const MaxSignatories: u16 = 3; } - pub struct TestIsCallable; impl Filter for TestIsCallable { fn filter(c: &Call) -> bool { match *c { - Call::Balances(pallet_balances::Call::transfer(..)) => true, + Call::Balances(_) => true, _ => false, } } @@ -128,7 +127,7 @@ use pallet_balances::Error as BalancesError; pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { - balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 10)], + balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 2)], }.assimilate_storage(&mut t).unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); -- GitLab From 799f5c148f2c17d982a0fc395eff61d1baf47c34 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 2 Jun 2020 20:07:10 +0300 Subject: [PATCH 097/280] block.tx[0] is not invalid if on_initialize is too heavy (#6217) --- client/basic-authorship/src/basic_authorship.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index fe64097e42..cd241f3884 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -225,7 +225,6 @@ impl Proposer // proceed with transactions let block_timer = time::Instant::now(); - let mut is_first = true; let mut skipped = 0; let mut unqueue_invalid = Vec::new(); let pending_iterator = match executor::block_on(future::select( @@ -261,10 +260,7 @@ impl Proposer } Err(ApplyExtrinsicFailed(Validity(e))) if e.exhausted_resources() => { - if is_first { - debug!("[{:?}] Invalid transaction: FullBlock on empty block", pending_tx_hash); - unqueue_invalid.push(pending_tx_hash); - } else if skipped < MAX_SKIPPED_TRANSACTIONS { + if skipped < MAX_SKIPPED_TRANSACTIONS { skipped += 1; debug!( "Block seems full, but will try {} more transactions before quitting.", @@ -287,8 +283,6 @@ impl Proposer unqueue_invalid.push(pending_tx_hash); } } - - is_first = false; } self.transaction_pool.remove_invalid(&unqueue_invalid); -- GitLab From 82f254e453313cbd39ab2e8fb02eeb35c87fa971 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 3 Jun 2020 12:18:10 +0300 Subject: [PATCH 098/280] fix millis display (#6227) --- client/cli/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index 2ea59129ea..1acd5ee604 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -253,7 +253,7 @@ pub fn init_logger(pattern: &str) { format!("{}", Colour::Blue.bold().paint(x)) }); let millis = (now.tm_nsec as f32 / 1000000.0).floor() as usize; - let timestamp = format!("{}.{}", timestamp, millis); + let timestamp = format!("{}.{:03}", timestamp, millis); format!( "{} {} {} {} {}", Colour::Black.bold().paint(timestamp), -- GitLab From 37d19c809dad336e9326e80d076890b8cd5c0424 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 3 Jun 2020 12:45:57 +0200 Subject: [PATCH 099/280] Make dev profile faster by compiling deps with opt-level=3 (#6228) * Make dev profile faster by compiling deps with opt-level=3 * More comment * More comment refinment * Remove soketto as it doesn't fit criterias * Fix style --- Cargo.toml | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8dc57b607f..a8fda6c6f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -180,6 +180,77 @@ members = [ "utils/wasm-builder", ] +# The list of dependencies below (which can be both direct and indirect dependencies) are crates +# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of +# their debug info might be missing) or to require to be frequently recompiled. We compile these +# dependencies with `opt-level=3` even in "dev" mode in order to make "dev" mode more usable. +# The majority of these crates are cryptographic libraries. +# +# Note that this does **not** affect crates that depend on Substrate. In other words, if you add +# a dependency on Substrate, you have to copy-paste this list in your own `Cargo.toml` (assuming +# that you want the same list). This list is only relevant when running `cargo build` from within +# the Substrate workspace. +# +# If you see an error mentioning "profile package spec ... did not match any packages", it +# probably concerns this list. +# +# This list is ordered alphabetically. +[profile.dev.package] +aes-ctr = { opt-level = 3 } +aes-soft = { opt-level = 3 } +aesni = { opt-level = 3 } +blake2 = { opt-level = 3 } +blake2-rfc = { opt-level = 3 } +blake2b_simd = { opt-level = 3 } +blake2s_simd = { opt-level = 3 } +chacha20-poly1305-aead = { opt-level = 3 } +cranelift-codegen = { opt-level = 3 } +cranelift-wasm = { opt-level = 3 } +crc32fast = { opt-level = 3 } +crossbeam-deque = { opt-level = 3 } +crossbeam-queue = { opt-level = 3 } +crypto-mac = { opt-level = 3 } +ctr = { opt-level = 3 } +cuckoofilter = { opt-level = 3 } +curve25519-dalek = { opt-level = 3 } +ed25519-dalek = { opt-level = 3 } +evm-core = { opt-level = 3 } +evm-runtime = { opt-level = 3 } +flate2 = { opt-level = 3 } +futures-channel = { opt-level = 3 } +hashbrown = { opt-level = 3 } +h2 = { opt-level = 3 } +hash-db = { opt-level = 3 } +hmac = { opt-level = 3 } +httparse = { opt-level = 3 } +integer-sqrt = { opt-level = 3 } +keccak = { opt-level = 3 } +libm = { opt-level = 3 } +librocksdb-sys = { opt-level = 3 } +libsecp256k1 = { opt-level = 3 } +libz-sys = { opt-level = 3 } +mio = { opt-level = 3 } +nalgebra = { opt-level = 3 } +num-bigint = { opt-level = 3 } +parking_lot = { opt-level = 3 } +parking_lot_core = { opt-level = 3 } +percent-encoding = { opt-level = 3 } +primitive-types = { opt-level = 3 } +ring = { opt-level = 3 } +rustls = { opt-level = 3 } +salsa20 = { opt-level = 3 } +salsa20-core = { opt-level = 3 } +sha2 = { opt-level = 3 } +sha3 = { opt-level = 3 } +smallvec = { opt-level = 3 } +snow = { opt-level = 3 } +twox-hash = { opt-level = 3 } +uint = { opt-level = 3 } +wasmi = { opt-level = 3 } +x25519-dalek = { opt-level = 3 } +yamux = { opt-level = 3 } +zeroize = { opt-level = 3 } + [profile.release] # Substrate runtime requires unwinding. panic = "unwind" -- GitLab From 2743ed4b26b786efdcb5d1123a277f21da0c29c0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 3 Jun 2020 15:24:44 +0200 Subject: [PATCH 100/280] Fix libp2p features (#6229) * Fix libp2p features * Remove the opt-level of some now-unused crates --- Cargo.lock | 189 ++++---------------------- Cargo.toml | 3 - bin/utils/subkey/Cargo.toml | 2 +- client/authority-discovery/Cargo.toml | 2 +- client/network-gossip/Cargo.toml | 2 +- client/network/Cargo.toml | 2 +- client/network/test/Cargo.toml | 2 +- client/telemetry/Cargo.toml | 2 +- 8 files changed, 31 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a13d30be1..2e7fbb14cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" dependencies = [ "block-cipher-trait", - "byteorder 1.3.4", + "byteorder", "opaque-debug", ] @@ -300,7 +300,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" dependencies = [ - "byteorder 1.3.4", + "byteorder", "serde", ] @@ -402,7 +402,7 @@ checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ "block-padding", "byte-tools", - "byteorder 1.3.4", + "byteorder", "generic-array", ] @@ -483,12 +483,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" - [[package]] name = "byteorder" version = "1.3.4" @@ -501,7 +495,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ - "byteorder 1.3.4", + "byteorder", "either", "iovec", ] @@ -728,7 +722,7 @@ version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d166b289fd30062ee6de86284750fc3fe5d037c6b864b3326ce153239b0626e1" dependencies = [ - "byteorder 1.3.4", + "byteorder", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", @@ -872,7 +866,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" dependencies = [ - "byteorder 1.3.4", + "byteorder", "cast", "itertools", ] @@ -1011,23 +1005,13 @@ dependencies = [ "stream-cipher", ] -[[package]] -name = "cuckoofilter" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" -dependencies = [ - "byteorder 0.5.3", - "rand 0.3.23", -] - [[package]] name = "curve25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" dependencies = [ - "byteorder 1.3.4", + "byteorder", "digest", "rand_core 0.5.1", "subtle 2.2.2", @@ -1094,7 +1078,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" dependencies = [ - "byteorder 1.3.4", + "byteorder", "quick-error", ] @@ -1360,7 +1344,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" dependencies = [ - "byteorder 1.3.4", + "byteorder", "rand 0.7.3", "rustc-hex", "static_assertions", @@ -1861,7 +1845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81dd6190aad0f05ddbbf3245c54ed14ca4aa6dd32f22312b70d8f168c3e3e633" dependencies = [ "arrayvec 0.5.1", - "byteorder 1.3.4", + "byteorder", "fallible-iterator", "indexmap", "smallvec 1.4.0", @@ -1923,7 +1907,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "fnv", "futures 0.1.29", @@ -2596,22 +2580,16 @@ dependencies = [ "lazy_static", "libp2p-core", "libp2p-core-derive", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", "libp2p-mplex", "libp2p-noise", "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", "libp2p-secio", "libp2p-swarm", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", @@ -2667,17 +2645,6 @@ dependencies = [ "syn 1.0.17", ] -[[package]] -name = "libp2p-deflate" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4acff33f5bfe154bafe14c6c08655d4b1e1736afaca78014111bc1742a2016" -dependencies = [ - "flate2", - "futures 0.3.4", - "libp2p-core", -] - [[package]] name = "libp2p-dns" version = "0.19.0" @@ -2689,48 +2656,6 @@ dependencies = [ "log", ] -[[package]] -name = "libp2p-floodsub" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6dd8cc558e0edde2d4a423d017efd6b36c1b6bf97f4304c83076895c5edaed8" -dependencies = [ - "cuckoofilter", - "fnv", - "futures 0.3.4", - "libp2p-core", - "libp2p-swarm", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec 1.4.0", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1675c23765e37ddbf6bf05fb520be8f7df3f5f4981d68f185bb95f9b047c576a" -dependencies = [ - "base64 0.11.0", - "byteorder 1.3.4", - "bytes 0.5.4", - "fnv", - "futures 0.3.4", - "futures_codec", - "libp2p-core", - "libp2p-swarm", - "log", - "lru", - "prost", - "prost-build", - "rand 0.7.3", - "sha2", - "smallvec 1.4.0", - "unsigned-varint", - "wasm-timer", -] - [[package]] name = "libp2p-identify" version = "0.19.1" @@ -2848,38 +2773,6 @@ dependencies = [ "wasm-timer", ] -[[package]] -name = "libp2p-plaintext" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad28fe7beaa3e516ee8ba2af8c4f6820f269afa60d661831e879f2afea64f4a0" -dependencies = [ - "bytes 0.5.4", - "futures 0.3.4", - "futures_codec", - "libp2p-core", - "log", - "prost", - "prost-build", - "rw-stream-sink", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabaa2194e1ce3c51cd78d734dd4c81dc5c7b150b309cbf9029df044034ac261" -dependencies = [ - "futures 0.3.4", - "log", - "pin-project", - "rand 0.7.3", - "salsa20", - "sha3", -] - [[package]] name = "libp2p-secio" version = "0.19.1" @@ -2941,18 +2834,6 @@ dependencies = [ "socket2", ] -[[package]] -name = "libp2p-uds" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d51726e063e8d73b103331576bb7e8fad187a3f0c227933a10b3542e2ad3f4" -dependencies = [ - "async-std", - "futures 0.3.4", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" version = "0.19.0" @@ -3182,7 +3063,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" dependencies = [ - "byteorder 1.3.4", + "byteorder", "keccak", "rand_core 0.5.1", "zeroize", @@ -3336,7 +3217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29449d242064c48d3057a194b049a2bdcccadda16faa18a91468677b44e8d422" dependencies = [ "bitflags", - "byteorder 1.3.4", + "byteorder", "enum-primitive-derive", "libc", "num-traits 0.2.11", @@ -4759,7 +4640,7 @@ checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477" dependencies = [ "arrayref", "bs58", - "byteorder 1.3.4", + "byteorder", "data-encoding", "parity-multihash", "percent-encoding 2.1.0", @@ -4777,7 +4658,7 @@ checksum = "12ca96399f4a01aa89c59220c4f52ac371940eb4e53e3ce990da796f364bdf69" dependencies = [ "arrayref", "bs58", - "byteorder 1.3.4", + "byteorder", "data-encoding", "multihash", "percent-encoding 2.1.0", @@ -4865,7 +4746,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" dependencies = [ - "byteorder 1.3.4", + "byteorder", ] [[package]] @@ -4952,7 +4833,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "byteorder 1.3.4", + "byteorder", "crypto-mac", ] @@ -5172,7 +5053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe50036aa1b71e553a4a0c48ab7baabf8aa8c7a5a61aae06bf38c2eab7430475" dependencies = [ "bitflags", - "byteorder 1.3.4", + "byteorder", "chrono", "hex", "lazy_static", @@ -5257,7 +5138,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" dependencies = [ - "byteorder 1.3.4", + "byteorder", "log", "parity-wasm 0.41.0", ] @@ -5512,7 +5393,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03b418169fb9c46533f326efd6eed2576699c44ca92d3052a066214a8d828929" dependencies = [ - "byteorder 1.3.4", + "byteorder", "rand_core 0.3.1", ] @@ -5632,7 +5513,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.3.4", + "byteorder", ] [[package]] @@ -5813,26 +5694,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "salsa20" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2324b0e8c3bb9a586a571fdb3136f70e7e2c748de00a78043f86e0cff91f91fe" -dependencies = [ - "byteorder 1.3.4", - "salsa20-core", - "stream-cipher", -] - -[[package]] -name = "salsa20-core" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe6cc1b9f5a5867853ade63099de70f042f7679e408d1ffe52821c9248e6e69" -dependencies = [ - "stream-cipher", -] - [[package]] name = "same-file" version = "1.0.6" @@ -7481,7 +7342,7 @@ version = "2.0.0-rc2" dependencies = [ "base58", "blake2-rfc", - "byteorder 1.3.4", + "byteorder", "criterion 0.2.11", "derive_more", "ed25519-dalek", @@ -9011,7 +8872,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" dependencies = [ "block-cipher-trait", - "byteorder 1.3.4", + "byteorder", "opaque-debug", ] @@ -9036,7 +8897,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" dependencies = [ - "byteorder 1.3.4", + "byteorder", "crunchy", "rustc-hex", "static_assertions", @@ -9541,7 +9402,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94" dependencies = [ - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "httparse", "log", diff --git a/Cargo.toml b/Cargo.toml index a8fda6c6f2..d367302f79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -211,7 +211,6 @@ crossbeam-deque = { opt-level = 3 } crossbeam-queue = { opt-level = 3 } crypto-mac = { opt-level = 3 } ctr = { opt-level = 3 } -cuckoofilter = { opt-level = 3 } curve25519-dalek = { opt-level = 3 } ed25519-dalek = { opt-level = 3 } evm-core = { opt-level = 3 } @@ -238,8 +237,6 @@ percent-encoding = { opt-level = 3 } primitive-types = { opt-level = 3 } ring = { opt-level = 3 } rustls = { opt-level = 3 } -salsa20 = { opt-level = 3 } -salsa20-core = { opt-level = 3 } sha2 = { opt-level = 3 } sha3 = { opt-level = 3 } smallvec = { opt-level = 3 } diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index c955ac3dd1..43bb056404 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -33,7 +33,7 @@ derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" -libp2p = "0.19.1" +libp2p = { version = "0.19.1", default-features = false } serde_json = "1.0" [features] diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index c32fb67c51..5050aedeca 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", default-features = false, version = "1 derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } +libp2p = { version = "0.19.1", default-features = false, features = ["kad"] } log = "0.4.8" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} prost = "0.6.1" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index e6dc57dc9c..c5ae8662f0 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.1", default-features = false, features = ["websocket"] } +libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" lru = "0.4.3" sc-network = { version = "0.8.0-rc2", path = "../network" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 6c6579a858..cf49b65ab2 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -65,7 +65,7 @@ zeroize = "1.0.0" [dependencies.libp2p] version = "0.19.1" default-features = false -features = ["websocket", "kad", "mdns", "ping", "identify", "mplex", "yamux", "noise", "tcp-async-std"] +features = ["identify", "kad", "mdns", "mplex", "noise", "ping", "tcp-async-std", "websocket", "yamux"] [dev-dependencies] async-std = "1.5" diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 8695d30a68..b137a0e370 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" -libp2p = { version = "0.19.1", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.19.1", default-features = false } sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } sc-client-api = { version = "2.0.0-rc2", path = "../../api" } diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index e88a9dc779..ee48aa6183 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" wasm-timer = "0.2.0" -libp2p = { version = "0.19.1", default-features = false, features = ["websocket", "wasm-ext", "tcp-async-std", "dns"] } +libp2p = { version = "0.19.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] } log = "0.4.8" pin-project = "0.4.6" rand = "0.7.2" -- GitLab From b4b6ab998e0cc8ff65f8e84faa709d946f5d2060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 3 Jun 2020 17:48:09 +0200 Subject: [PATCH 101/280] Split tx pool and offchain notification handling (#6231) Instead of having the tx pool and offchain worker being feed from the same import notification stream, this pr splits them to use two different streams. The first advantage of this split is that the tx pool will not be spawned anymore in another task and instead will directly process the notification in the same task. This has the advantage of being faster when the system is being under load, as the tx pool will not be waiting for being scheduled to handle the notification. --- client/service/src/builder.rs | 101 +++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 45 deletions(-) diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index d921606ea6..baf1c2e0cc 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -1025,63 +1025,74 @@ ServiceBuilder< let spawn_handle = task_manager.spawn_handle(); + // Inform the tx pool about imported and finalized blocks. { - // block notifications let txpool = Arc::downgrade(&transaction_pool); + + let mut import_stream = client.import_notification_stream().map(|n| ChainEvent::NewBlock { + id: BlockId::Hash(n.hash), + header: n.header, + retracted: n.retracted, + is_new_best: n.is_new_best, + }).fuse(); + let mut finality_stream = client.finality_notification_stream() + .map(|n| ChainEvent::Finalized:: { hash: n.hash }) + .fuse(); + + let events = async move { + loop { + let evt = futures::select! { + evt = import_stream.next() => evt, + evt = finality_stream.next() => evt, + complete => return, + }; + + let txpool = txpool.upgrade(); + if let Some((txpool, evt)) = txpool.and_then(|tp| evt.map(|evt| (tp, evt))) { + txpool.maintain(evt).await; + } + } + }; + + spawn_handle.spawn( + "txpool-notifications", + events, + ); + } + + // Inform the offchain worker about new imported blocks + { let offchain = offchain_workers.as_ref().map(Arc::downgrade); let notifications_spawn_handle = task_manager.spawn_handle(); let network_state_info: Arc = network.clone(); let is_validator = config.role.is_authority(); - let (import_stream, finality_stream) = ( - client.import_notification_stream().map(|n| ChainEvent::NewBlock { - id: BlockId::Hash(n.hash), - header: n.header, - retracted: n.retracted, - is_new_best: n.is_new_best, - }), - client.finality_notification_stream().map(|n| ChainEvent::Finalized { - hash: n.hash - }) - ); - let events = futures::stream::select(import_stream, finality_stream) - .for_each(move |event| { - // offchain worker is only interested in block import events - if let ChainEvent::NewBlock { ref header, is_new_best, .. } = event { - let offchain = offchain.as_ref().and_then(|o| o.upgrade()); - match offchain { - Some(offchain) if is_new_best => { - notifications_spawn_handle.spawn( - "offchain-on-block", - offchain.on_block_imported( - &header, - network_state_info.clone(), - is_validator, - ), - ); - }, - Some(_) => log::debug!( - target: "sc_offchain", - "Skipping offchain workers for non-canon block: {:?}", - header, - ), - _ => {}, - } - }; - - let txpool = txpool.upgrade(); - if let Some(txpool) = txpool.as_ref() { + let events = client.import_notification_stream().for_each(move |n| { + let offchain = offchain.as_ref().and_then(|o| o.upgrade()); + match offchain { + Some(offchain) if n.is_new_best => { notifications_spawn_handle.spawn( - "txpool-maintain", - txpool.maintain(event), + "offchain-on-block", + offchain.on_block_imported( + &n.header, + network_state_info.clone(), + is_validator, + ), ); - } + }, + Some(_) => log::debug!( + target: "sc_offchain", + "Skipping offchain workers for non-canon block: {:?}", + n.header, + ), + _ => {}, + } - ready(()) - }); + ready(()) + }); spawn_handle.spawn( - "txpool-and-offchain-notif", + "offchain-notifications", events, ); } -- GitLab From 6ec597649b3112e4e809afd1b36888b2872275b9 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Wed, 3 Jun 2020 17:50:29 +0200 Subject: [PATCH 102/280] Add run_full_node, run_light_node and print_node_infos to the API (#6233) * Initial commit Forked at: 2743ed4b26b786efdcb5d1123a277f21da0c29c0 Parent branch: origin/master * Add run_full_node, run_light_node and print_node_infos to the API * Update runner.rs --- client/cli/src/runner.rs | 93 ++++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 19 deletions(-) diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 2d27743163..9286031589 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -18,8 +18,8 @@ use crate::CliConfiguration; use crate::Result; -use crate::SubstrateCli; use crate::Subcommand; +use crate::SubstrateCli; use chrono::prelude::*; use futures::pin_mut; use futures::select; @@ -28,7 +28,8 @@ use log::info; use sc_service::{AbstractService, Configuration, Role, ServiceBuilderCommand, TaskType}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use sp_utils::metrics::{TOKIO_THREADS_ALIVE, TOKIO_THREADS_TOTAL}; -use std::{str::FromStr, fmt::Debug, marker::PhantomData, sync::Arc}; +use sp_version::RuntimeVersion; +use std::{fmt::Debug, marker::PhantomData, str::FromStr, sync::Arc}; #[cfg(target_family = "unix")] async fn main(func: F) -> std::result::Result<(), Box> @@ -81,11 +82,11 @@ where pub fn build_runtime() -> std::result::Result { tokio::runtime::Builder::new() .threaded_scheduler() - .on_thread_start(||{ + .on_thread_start(|| { TOKIO_THREADS_ALIVE.inc(); TOKIO_THREADS_TOTAL.inc(); }) - .on_thread_stop(||{ + .on_thread_stop(|| { TOKIO_THREADS_ALIVE.dec(); }) .enable_all() @@ -140,19 +141,21 @@ impl Runner { }) } - /// A helper function that runs an `AbstractService` with tokio and stops if the process receives - /// the signal `SIGTERM` or `SIGINT`. - pub fn run_node( - self, - new_light: FNL, - new_full: FNF, - runtime_version: sp_version::RuntimeVersion, - ) -> Result<()> where - FNL: FnOnce(Configuration) -> sc_service::error::Result, - FNF: FnOnce(Configuration) -> sc_service::error::Result, - SL: AbstractService + Unpin, - SF: AbstractService + Unpin, - { + /// Log information about the node itself. + /// + /// # Example: + /// + /// ```text + /// 2020-06-03 16:14:21 Substrate Node + /// 2020-06-03 16:14:21 ✌️ version 2.0.0-rc2-f4940588c-x86_64-linux-gnu + /// 2020-06-03 16:14:21 ❤️ by Parity Technologies , 2017-2020 + /// 2020-06-03 16:14:21 📋 Chain specification: Flaming Fir + /// 2020-06-03 16:14:21 🏷 Node name: jolly-rod-7462 + /// 2020-06-03 16:14:21 👤 Role: FULL + /// 2020-06-03 16:14:21 💾 Database: RocksDb at /tmp/c/chains/flamingfir7/db + /// 2020-06-03 16:14:21 ⛓ Native runtime: node-251 (substrate-node-1.tx1.au10) + /// ``` + pub fn print_node_infos(&self, runtime_version: RuntimeVersion) { info!("{}", C::impl_name()); info!("✌️ version {}", C::impl_version()); info!( @@ -169,11 +172,63 @@ impl Runner { self.config.database.path().map_or_else(|| "".to_owned(), |p| p.display().to_string()) ); info!("⛓ Native runtime: {}", runtime_version); + } + /// A helper function that runs an `AbstractService` with tokio and stops if the process + /// receives the signal `SIGTERM` or `SIGINT`. It can run a full or a light node depending on + /// the node's configuration. + pub fn run_node( + self, + new_light: impl FnOnce(Configuration) -> sc_service::error::Result, + new_full: impl FnOnce(Configuration) -> sc_service::error::Result, + runtime_version: RuntimeVersion, + ) -> Result<()> + where + SL: AbstractService + Unpin, + SF: AbstractService + Unpin, + { match self.config.role { - Role::Light => self.run_service_until_exit(new_light), - _ => self.run_service_until_exit(new_full), + Role::Light => self.run_light_node(new_light, runtime_version), + _ => self.run_full_node(new_full, runtime_version), + } + } + + /// A helper function that runs an `AbstractService` with tokio and stops if the process + /// receives the signal `SIGTERM` or `SIGINT`. It can only run a "full" node and will fail if + /// the node's configuration uses a "light" role. + pub fn run_full_node( + self, + new_full: impl FnOnce(Configuration) -> sc_service::error::Result, + runtime_version: RuntimeVersion, + ) -> Result<()> + where + S: AbstractService + Unpin, + { + if matches!(self.config.role, Role::Light) { + return Err("Light node has been requested but this is not implemented".into()); } + + self.print_node_infos(runtime_version); + self.run_service_until_exit(new_full) + } + + /// A helper function that runs an `AbstractService` with tokio and stops if the process + /// receives the signal `SIGTERM` or `SIGINT`. It can only run a "light" node and will fail if + /// the node's configuration uses a "full" role. + pub fn run_light_node( + self, + new_light: impl FnOnce(Configuration) -> sc_service::error::Result, + runtime_version: RuntimeVersion, + ) -> Result<()> + where + S: AbstractService + Unpin, + { + if !matches!(self.config.role, Role::Light) { + return Err("Full node has been requested but this is not implemented".into()); + } + + self.print_node_infos(runtime_version); + self.run_service_until_exit(new_light) } /// A helper function that runs a future with tokio and stops if the process receives the signal -- GitLab From b86eeb2f36e351bac05008ee9d495a5b468a5fdf Mon Sep 17 00:00:00 2001 From: zx9w <40034337+zx9w@users.noreply.github.com> Date: Thu, 4 Jun 2020 10:40:20 +0200 Subject: [PATCH 103/280] The link to getting-started was obsolete. (#6238) * The link to getting-started was obsolete. * link to installation and tutorials Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bb7ebb775..2b62cbaa71 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@ Substrate is a next-generation framework for blockchain innovation 🚀. ## Trying it out -Simply go to [substrate.dev](https://substrate.dev) and follow the [getting started](https://substrate.dev/docs/en/overview/getting-started/) instructions. +Simply go to [substrate.dev](https://substrate.dev) and follow the +[installation](https://substrate.dev/docs/en/knowledgebase/getting-started/) instructions. You can +also try out one of the [tutorials](https://substrate.dev/en/tutorials). ## Contributions & Code of Conduct -- GitLab From f028a509789289a34c468f42b4361c49279893f2 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 4 Jun 2020 04:50:22 -0400 Subject: [PATCH 104/280] Use Subscription Manager from `jsonrpc-pubsub` (#6208) * Bump jsonrpc pubsub, core, http, and ws Right now these are the packages which _need_ to be updated so I can just the latest `jsonrpc-pubsub` code. Once a release it cut upstream the rest of the dependencies should be updated as well. * Use jsonrpc-pubsub's SubscriptionManager This places sc-rpc-api::Subscriptions * Bump jsonrpc-core outside of sc-rpc-* * Update client/rpc tests Right now one of the `author` tests is failing, I need to think a bit about how best to fix it. * Remove Subscriptions manager There's no need for this implementation since we're using the one from `jsonrpc-pubsub` now * Fix author RPC test This test used to check for a numerial subscription ID, whereas now it uses a string based ID which is the default provided by `jsonrpc-pubsub`'s subscription manager. * Remove unused NumericIdProvider * Add missing bracket Removed one too many with that last one, lol * Bump `jsonrpc` to v14.2 There's an exception though. `jsonrpc-derive` cannot be bumped past v14.0.5 just yet since it has a dependency on `quote` pinned to v1.0.1. This means that at the moment it won't build on Substrate since it's using v1.0.3. * Track `jsonrpc-derive` master branch * Bump `quote` version to v1.0.6 * Bump `jsonrpc-derive` to v14.2.1 This includes support for `quote` v1.0.6 --- Cargo.lock | 126 ++++++++++++----------- bin/node/browser-testing/Cargo.toml | 2 +- bin/node/cli/Cargo.toml | 2 +- bin/node/rpc-client/Cargo.toml | 2 +- bin/node/rpc/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/consensus/babe/rpc/Cargo.toml | 6 +- client/consensus/manual-seal/Cargo.toml | 6 +- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/rpc-api/Cargo.toml | 8 +- client/rpc-api/src/lib.rs | 2 - client/rpc-api/src/subscriptions.rs | 121 ---------------------- client/rpc-servers/Cargo.toml | 8 +- client/rpc/Cargo.toml | 4 +- client/rpc/src/author/mod.rs | 9 +- client/rpc/src/author/tests.rs | 35 +++++-- client/rpc/src/chain/chain_full.rs | 8 +- client/rpc/src/chain/chain_light.rs | 8 +- client/rpc/src/chain/mod.rs | 11 +- client/rpc/src/chain/tests.rs | 29 ++++-- client/rpc/src/lib.rs | 2 +- client/rpc/src/state/mod.rs | 8 +- client/rpc/src/state/state_full.rs | 8 +- client/rpc/src/state/state_light.rs | 8 +- client/rpc/src/state/tests.rs | 32 ++++-- client/service/Cargo.toml | 1 + client/service/src/builder.rs | 3 +- frame/contracts/rpc/Cargo.toml | 6 +- frame/transaction-payment/rpc/Cargo.toml | 6 +- utils/frame/rpc/support/Cargo.toml | 4 +- utils/frame/rpc/system/Cargo.toml | 6 +- 31 files changed, 196 insertions(+), 285 deletions(-) delete mode 100644 client/rpc-api/src/subscriptions.rs diff --git a/Cargo.lock b/Cargo.lock index 2e7fbb14cf..a504065878 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,7 +160,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -321,7 +321,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "regex", "rustc-hash", "shlex", @@ -991,7 +991,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1031,7 +1031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1133,7 +1133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ed9afacaea0301eefb738c9deea725e6d53938004597cdc518a8cf9a7aa2f03" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1286,7 +1286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "synstructure", ] @@ -1477,7 +1477,7 @@ version = "2.0.0-rc2" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1488,7 +1488,7 @@ dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1497,7 +1497,7 @@ name = "frame-support-procedural-tools-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1713,7 +1713,7 @@ checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -2234,7 +2234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -2319,9 +2319,9 @@ dependencies = [ [[package]] name = "jsonrpc-client-transports" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2307a7e78cf969759e390a8a2151ea12e783849a45bb00aa871b468ba58ea79e" +checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158" dependencies = [ "failure", "futures 0.1.29", @@ -2336,9 +2336,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25525f6002338fb4debb5167a89a0b47f727a5a48418417545ad3429758b7fec" +checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" dependencies = [ "futures 0.1.29", "log", @@ -2349,30 +2349,30 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f9382e831a6d630c658df103aac3f971da096deb57c136ea2b760d3b4e3f9f" +checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "14.0.5" +version = "14.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" +checksum = "0fadf6945e227246825a583514534d864554e9f23d80b3c77d034b10983db5ef" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] [[package]] name = "jsonrpc-http-server" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52860f0549694aa4abb12766856f56952ab46d3fb9f0815131b2db3d9cc2f29" +checksum = "0da906d682799df05754480dac1b9e70ec92e12c19ebafd2662a5ea1c9fd6522" dependencies = [ "hyper 0.12.35", "jsonrpc-core", @@ -2385,21 +2385,22 @@ dependencies = [ [[package]] name = "jsonrpc-pubsub" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ca5e391d6c6a2261d4adca029f427fe63ea546ad6cef2957c654c08495ec16" +checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986" dependencies = [ "jsonrpc-core", "log", "parking_lot 0.10.2", + "rand 0.7.3", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f06add502b48351e05dd95814835327fb115e4e9f834ca42fd522d3b769d4d2" +checksum = "56cbfb462e7f902e21121d9f0d1c2b77b2c5b642e1a4e8f4ebfa2e15b94402bb" dependencies = [ "bytes 0.4.12", "globset", @@ -2413,9 +2414,9 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017a7dd5083d9ed62c5e1dd3e317975c33c3115dac5447f4480fe05a8c354754" +checksum = "903d3109fe7c4acb932b567e1e607e0f524ed04741b09fb0e61841bc40a022fc" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -2641,7 +2642,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4471,7 +4472,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "sp-runtime", "syn 1.0.17", ] @@ -4704,7 +4705,7 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4823,7 +4824,7 @@ checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4887,7 +4888,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5007,7 +5008,7 @@ checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "version_check", ] @@ -5019,7 +5020,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "syn-mid", "version_check", @@ -5112,7 +5113,7 @@ dependencies = [ "anyhow", "itertools", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5180,9 +5181,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" dependencies = [ "proc-macro2", ] @@ -5480,7 +5481,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5664,7 +5665,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5797,7 +5798,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -6572,6 +6573,7 @@ dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", "hash-db", + "jsonrpc-pubsub", "lazy_static", "log", "netstat2", @@ -6817,7 +6819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -6913,7 +6915,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7033,7 +7035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7135,7 +7137,7 @@ dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7395,7 +7397,7 @@ name = "sp-debug-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7512,7 +7514,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7585,7 +7587,7 @@ dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7879,7 +7881,7 @@ dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7900,7 +7902,7 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8270,7 +8272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "unicode-xid 0.2.0", ] @@ -8281,7 +8283,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8301,7 +8303,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "unicode-xid 0.2.0", ] @@ -8364,7 +8366,7 @@ checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9" dependencies = [ "lazy_static", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "version_check", ] @@ -8394,7 +8396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8600,7 +8602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8778,7 +8780,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -9110,7 +9112,7 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "wasm-bindgen-shared", ] @@ -9133,7 +9135,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "wasm-bindgen-macro-support", ] @@ -9144,7 +9146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -9177,7 +9179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", ] [[package]] @@ -9465,7 +9467,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "synstructure", ] diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 7628582fbb..bbd33782b7 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" libp2p = { version = "0.19.1", default-features = false } -jsonrpc-core = "14.0.5" +jsonrpc-core = "14.2" serde = "1.0.106" serde_json = "1.0.48" wasm-bindgen = { version = "=0.2.62", features = ["serde-serialize"] } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index f2b25068ed..b820cef270 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -38,7 +38,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } serde = { version = "1.0.102", features = ["derive"] } futures = { version = "0.3.1", features = ["compat"] } hex-literal = "0.2.1" -jsonrpc-core = "14.0.3" +jsonrpc-core = "14.2" log = "0.4.8" rand = "0.7.2" structopt = { version = "0.3.8", optional = true } diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index 0b529d116c..c6cd7d4040 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] env_logger = "0.7.0" futures = "0.1.29" hyper = "0.12.35" -jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } +jsonrpc-core-client = { version = "14.2", default-features = false, features = ["http"] } log = "0.4.8" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 00b8be99b1..2eb7e83beb 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -jsonrpc-core = "14.0.3" +jsonrpc-core = "14.2" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } node-runtime = { version = "2.0.0-rc2", path = "../runtime" } sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 43bb056404..c0dd77eb01 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -31,7 +31,7 @@ rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } -jsonrpc-core-client = { version = "14.0.3", features = ["http"] } +jsonrpc-core-client = { version = "14.2", features = ["http"] } hyper = "0.12.35" libp2p = { version = "0.19.1", default-features = false } serde_json = "1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 20f7e48758..0986eea2b1 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-consensus-babe = { version = "0.8.0-rc2", path = "../" } sc-rpc-api = { version = "0.8.0-rc2", path = "../../../rpc-api" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index de2bf68d76..6b77829803 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" futures = "0.3.4" -jsonrpc-core = "14.0.5" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.5" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index e1724c6c4e..3658758960 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -10,9 +10,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] sc-finality-grandpa = { version = "0.8.0-rc2", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.3" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" futures = { version = "0.3.4", features = ["compat"] } serde = { version = "1.0.105", features = ["derive"] } serde_json = "1.0.50" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index 1075c3a11c..db992eed04 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -15,10 +15,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99.2" futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" -jsonrpc-pubsub = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" +jsonrpc-pubsub = "14.2" log = "0.4.8" parking_lot = "0.10.0" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } diff --git a/client/rpc-api/src/lib.rs b/client/rpc-api/src/lib.rs index f742d73b69..cd2608dda9 100644 --- a/client/rpc-api/src/lib.rs +++ b/client/rpc-api/src/lib.rs @@ -23,10 +23,8 @@ mod errors; mod helpers; mod policy; -mod subscriptions; pub use jsonrpc_core::IoHandlerExtension as RpcExtension; -pub use subscriptions::{Subscriptions, TaskExecutor}; pub use helpers::Receiver; pub use policy::DenyUnsafe; diff --git a/client/rpc-api/src/subscriptions.rs b/client/rpc-api/src/subscriptions.rs deleted file mode 100644 index 7feae662ee..0000000000 --- a/client/rpc-api/src/subscriptions.rs +++ /dev/null @@ -1,121 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program 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. - -// This program 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 this program. If not, see . - -use std::collections::HashMap; -use std::sync::{Arc, atomic::{self, AtomicUsize}}; - -use log::{error, warn}; -use jsonrpc_pubsub::{SubscriptionId, typed::{Sink, Subscriber}}; -use parking_lot::Mutex; -use jsonrpc_core::futures::sync::oneshot; -use jsonrpc_core::futures::{Future, future}; - -type Id = u64; - -/// Alias for a an implementation of `futures::future::Executor`. -pub type TaskExecutor = Arc + Send>> + Send + Sync>; - -/// Generate unique ids for subscriptions. -#[derive(Clone, Debug)] -pub struct IdProvider { - next_id: Arc, -} -impl Default for IdProvider { - fn default() -> Self { - IdProvider { - next_id: Arc::new(AtomicUsize::new(1)), - } - } -} - -impl IdProvider { - /// Returns next id for the subscription. - pub fn next_id(&self) -> Id { - self.next_id.fetch_add(1, atomic::Ordering::AcqRel) as u64 - } -} - -/// Subscriptions manager. -/// -/// Takes care of assigning unique subscription ids and -/// driving the sinks into completion. -#[derive(Clone)] -pub struct Subscriptions { - next_id: IdProvider, - active_subscriptions: Arc>>>, - executor: TaskExecutor, -} - -impl Subscriptions { - /// Creates new `Subscriptions` object. - pub fn new(executor: TaskExecutor) -> Self { - Subscriptions { - next_id: Default::default(), - active_subscriptions: Default::default(), - executor, - } - } - - /// Borrows the internal task executor. - /// - /// This can be used to spawn additional tasks on the underlying event loop. - pub fn executor(&self) -> &TaskExecutor { - &self.executor - } - - /// Creates new subscription for given subscriber. - /// - /// Second parameter is a function that converts Subscriber sink into a future. - /// This future will be driven to completion by the underlying event loop - /// or will be cancelled in case #cancel is invoked. - pub fn add(&self, subscriber: Subscriber, into_future: G) -> SubscriptionId where - G: FnOnce(Sink) -> R, - R: future::IntoFuture, - F: future::Future + Send + 'static, - { - let id = self.next_id.next_id(); - let subscription_id: SubscriptionId = id.into(); - if let Ok(sink) = subscriber.assign_id(subscription_id.clone()) { - let (tx, rx) = oneshot::channel(); - let future = into_future(sink) - .into_future() - .select(rx.map_err(|e| warn!("Error timeing out: {:?}", e))) - .then(|_| Ok(())); - - self.active_subscriptions.lock().insert(id, tx); - if self.executor.execute(Box::new(future)).is_err() { - error!("Failed to spawn RPC subscription task"); - } - } - - subscription_id - } - - /// Cancel subscription. - /// - /// Returns true if subscription existed or false otherwise. - pub fn cancel(&self, id: SubscriptionId) -> bool { - if let SubscriptionId::Number(id) = id { - if let Some(tx) = self.active_subscriptions.lock().remove(&id) { - let _ = tx.send(()); - return true; - } - } - false - } -} diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 401f5f4882..9e52ccae58 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -12,13 +12,13 @@ description = "Substrate RPC servers." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpc-core = "14.0.3" -pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } +jsonrpc-core = "14.2" +pubsub = { package = "jsonrpc-pubsub", version = "14.2" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] -http = { package = "jsonrpc-http-server", version = "14.0.3" } -ws = { package = "jsonrpc-ws-server", version = "14.0.3" } +http = { package = "jsonrpc-http-server", version = "14.2" } +ws = { package = "jsonrpc-ws-server", version = "14.2" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 62f9319575..60c4a24cd0 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -17,10 +17,10 @@ sc-client-api = { version = "2.0.0-rc2", path = "../api" } sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-pubsub = "14.0.3" +jsonrpc-pubsub = "14.2" log = "0.4.8" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -rpc = { package = "jsonrpc-core", version = "14.0.3" } +rpc = { package = "jsonrpc-core", version = "14.2" } sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } serde_json = "1.0.41" sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index d59fad354e..974c1b85e1 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -32,8 +32,8 @@ use rpc::futures::{ }; use futures::{StreamExt as _, compat::Compat}; use futures::future::{ready, FutureExt, TryFutureExt}; -use sc_rpc_api::{DenyUnsafe, Subscriptions}; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use sc_rpc_api::DenyUnsafe; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use codec::{Encode, Decode}; use sp_core::{Bytes, traits::BareCryptoStorePtr}; use sp_api::ProvideRuntimeApi; @@ -55,7 +55,7 @@ pub struct Author { /// Transactions pool pool: Arc

, /// Subscriptions manager - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// The key store. keystore: BareCryptoStorePtr, /// Whether to deny unsafe calls @@ -67,7 +67,7 @@ impl Author { pub fn new( client: Arc, pool: Arc

, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, keystore: BareCryptoStorePtr, deny_unsafe: DenyUnsafe, ) -> Self { @@ -81,7 +81,6 @@ impl Author { } } - /// Currently we treat all RPC transactions as externals. /// /// Possibly in the future we could allow opt-in for special treatment diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index 8c1b82028b..f0f92a8e7e 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -81,7 +81,7 @@ impl TestSetup { Author { client: self.client.clone(), pool: self.pool.clone(), - subscriptions: Subscriptions::new(Arc::new(crate::testing::TaskExecutor)), + subscriptions: SubscriptionManager::new(Arc::new(crate::testing::TaskExecutor)), keystore: self.keystore.clone(), deny_unsafe: DenyUnsafe::No, } @@ -133,8 +133,14 @@ fn should_watch_extrinsic() { uxt(AccountKeyring::Alice, 0).encode().into(), ); - // then - assert_eq!(executor::block_on(id_rx.compat()), Ok(Ok(1.into()))); + let id = executor::block_on(id_rx.compat()).unwrap().unwrap(); + assert_matches!(id, SubscriptionId::String(_)); + + let id = match id { + SubscriptionId::String(id) => id, + _ => unreachable!(), + }; + // check notifications let replacement = { let tx = Transfer { @@ -147,15 +153,22 @@ fn should_watch_extrinsic() { }; AuthorApi::submit_extrinsic(&p, replacement.encode().into()).wait().unwrap(); let (res, data) = executor::block_on(data.into_future().compat()).unwrap(); - assert_eq!( - res, - Some(r#"{"jsonrpc":"2.0","method":"test","params":{"result":"ready","subscription":1}}"#.into()) - ); + + let expected = Some(format!( + r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":"ready","subscription":"{}"}}}}"#, + id, + )); + assert_eq!(res, expected); + let h = blake2_256(&replacement.encode()); - assert_eq!( - executor::block_on(data.into_future().compat()).unwrap().0, - Some(format!(r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":1}}}}"#, HexDisplay::from(&h))) - ); + let expected = Some(format!( + r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":"{}"}}}}"#, + HexDisplay::from(&h), + id, + )); + + let res = executor::block_on(data.into_future().compat()).unwrap().0; + assert_eq!(res, expected); } #[test] diff --git a/client/rpc/src/chain/chain_full.rs b/client/rpc/src/chain/chain_full.rs index c1b062754b..816dbba866 100644 --- a/client/rpc/src/chain/chain_full.rs +++ b/client/rpc/src/chain/chain_full.rs @@ -18,8 +18,8 @@ use std::sync::Arc; use rpc::futures::future::result; +use jsonrpc_pubsub::manager::SubscriptionManager; -use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, BlockBackend}; use sp_runtime::{generic::{BlockId, SignedBlock}, traits::{Block as BlockT}}; @@ -32,14 +32,14 @@ pub struct FullChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// phantom member to pin the block type _phantom: PhantomData, } impl FullChain { /// Create new Chain API RPC handler. - pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { Self { client, subscriptions, @@ -56,7 +56,7 @@ impl ChainBackend for FullChain whe &self.client } - fn subscriptions(&self) -> &Subscriptions { + fn subscriptions(&self) -> &SubscriptionManager { &self.subscriptions } diff --git a/client/rpc/src/chain/chain_light.rs b/client/rpc/src/chain/chain_light.rs index 059233089d..8a4afbed71 100644 --- a/client/rpc/src/chain/chain_light.rs +++ b/client/rpc/src/chain/chain_light.rs @@ -19,8 +19,8 @@ use std::sync::Arc; use futures::{future::ready, FutureExt, TryFutureExt}; use rpc::futures::future::{result, Future, Either}; +use jsonrpc_pubsub::manager::SubscriptionManager; -use sc_rpc_api::Subscriptions; use sc_client_api::light::{Fetcher, RemoteBodyRequest, RemoteBlockchain}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -37,7 +37,7 @@ pub struct LightChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// Remote blockchain reference remote_blockchain: Arc>, /// Remote fetcher reference. @@ -48,7 +48,7 @@ impl> LightChain { /// Create new Chain API RPC handler. pub fn new( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { @@ -70,7 +70,7 @@ impl ChainBackend for LightChain &Subscriptions { + fn subscriptions(&self) -> &SubscriptionManager { &self.subscriptions } diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 6d53fbbb06..7b13e7a600 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -32,9 +32,8 @@ use rpc::{ futures::{stream, Future, Sink, Stream}, }; -use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, light::{Fetcher, RemoteBlockchain}}; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use sp_rpc::{number::NumberOrHex, list::ListOrValue}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -57,7 +56,7 @@ trait ChainBackend: Send + Sync + 'static fn client(&self) -> &Arc; /// Get subscriptions reference. - fn subscriptions(&self) -> &Subscriptions; + fn subscriptions(&self) -> &SubscriptionManager; /// Tries to unwrap passed block hash, or uses best block hash otherwise. fn unwrap_or_best(&self, hash: Option) -> Block::Hash { @@ -177,7 +176,7 @@ trait ChainBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, ) -> Chain where Block: BlockT + 'static, @@ -191,7 +190,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Chain @@ -279,7 +278,7 @@ impl ChainApi, Block::Hash, Block::Header, Signe /// Subscribe to new headers. fn subscribe_headers( client: &Arc, - subscriptions: &Subscriptions, + subscriptions: &SubscriptionManager, subscriber: Subscriber, best_block_hash: G, stream: F, diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index e86d1d547f..68d46135e3 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -31,7 +31,7 @@ use crate::testing::TaskExecutor; #[test] fn should_return_header() { let client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.header(Some(client.genesis_hash()).into()).wait(), @@ -63,7 +63,7 @@ fn should_return_header() { #[test] fn should_return_a_block() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; let block_hash = block.hash(); @@ -114,7 +114,7 @@ fn should_return_a_block() { #[test] fn should_return_block_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.block_hash(None.into()), @@ -158,7 +158,7 @@ fn should_return_block_hash() { #[test] fn should_return_finalized_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.finalized_head(), @@ -188,12 +188,15 @@ fn should_notify_about_latest_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_all_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -215,12 +218,15 @@ fn should_notify_about_best_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_new_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -242,12 +248,15 @@ fn should_notify_about_finalized_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_finalized_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index f979b0ab69..53a63b449c 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -24,7 +24,7 @@ mod metadata; -pub use sc_rpc_api::{DenyUnsafe, Subscriptions}; +pub use sc_rpc_api::DenyUnsafe; pub use self::metadata::Metadata; pub use rpc::IoHandlerExtension as RpcExtension; diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index 168dc3e010..921cc7efc6 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -25,10 +25,10 @@ mod state_light; mod tests; use std::sync::Arc; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use rpc::{Result as RpcResult, futures::{Future, future::result}}; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sc_client_api::light::{RemoteBlockchain, Fetcher}; use sp_core::{Bytes, storage::{StorageKey, PrefixedStorageKey, StorageData, StorageChangeSet}}; use sp_version::RuntimeVersion; @@ -170,7 +170,7 @@ pub trait StateBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, ) -> (State, ChildState) where Block: BlockT + 'static, @@ -191,7 +191,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> (State, ChildState) diff --git a/client/rpc/src/state/state_full.rs b/client/rpc/src/state/state_full.rs index 82f87e9acf..f0ae79a033 100644 --- a/client/rpc/src/state/state_full.rs +++ b/client/rpc/src/state/state_full.rs @@ -21,10 +21,10 @@ use std::sync::Arc; use std::ops::Range; use futures::{future, StreamExt as _, TryStreamExt as _}; use log::warn; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use rpc::{Result as RpcResult, futures::{stream, Future, Sink, Stream, future::result}}; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sc_client_api::backend::Backend; use sp_blockchain::{Result as ClientResult, Error as ClientError, HeaderMetadata, CachedHeaderMetadata, HeaderBackend}; use sc_client_api::BlockchainEvents; @@ -60,7 +60,7 @@ struct QueryStorageRange { /// State API backend for full nodes. pub struct FullState { client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, _phantom: PhantomData<(BE, Block)> } @@ -72,7 +72,7 @@ impl FullState Block: BlockT + 'static, { /// Create new state API backend for full nodes. - pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { Self { client, subscriptions, _phantom: PhantomData } } diff --git a/client/rpc/src/state/state_light.rs b/client/rpc/src/state/state_light.rs index af5d4248e3..ec275a2d78 100644 --- a/client/rpc/src/state/state_light.rs +++ b/client/rpc/src/state/state_light.rs @@ -28,7 +28,7 @@ use futures::{ StreamExt as _, TryStreamExt as _, }; use hash_db::Hasher; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use log::warn; use parking_lot::Mutex; use rpc::{ @@ -38,7 +38,7 @@ use rpc::{ futures::stream::Stream, }; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sp_blockchain::{Error as ClientError, HeaderBackend}; use sc_client_api::{ BlockchainEvents, @@ -63,7 +63,7 @@ type StorageMap = HashMap>; #[derive(Clone)] pub struct LightState, Client> { client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, version_subscriptions: SimpleSubscriptions, storage_subscriptions: Arc>>, remote_blockchain: Arc>, @@ -143,7 +143,7 @@ impl + 'static, Client> LightState, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index a610cbbfc8..0cc16ce8d5 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -55,7 +55,7 @@ fn should_return_storage() { .add_extra_child_storage(&child_info, KEY.to_vec(), CHILD_VALUE.to_vec()) .build(); let genesis_hash = client.genesis_hash(); - let (client, child) = new_full(Arc::new(client), Subscriptions::new(Arc::new(TaskExecutor))); + let (client, child) = new_full(Arc::new(client), SubscriptionManager::new(Arc::new(TaskExecutor))); let key = StorageKey(KEY.to_vec()); assert_eq!( @@ -90,7 +90,7 @@ fn should_return_child_storage() { .add_child_storage(&child_info, "key", vec![42_u8]) .build()); let genesis_hash = client.genesis_hash(); - let (_client, child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); + let (_client, child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); let child_key = prefixed_storage_key(); let key = StorageKey(b"key".to_vec()); @@ -125,7 +125,7 @@ fn should_return_child_storage() { fn should_call_contract() { let client = Arc::new(substrate_test_runtime_client::new()); let genesis_hash = client.genesis_hash(); - let (client, _child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); + let (client, _child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( client.call("balanceOf".into(), Bytes(vec![1,2,3]), Some(genesis_hash).into()).wait(), @@ -139,12 +139,15 @@ fn should_notify_about_storage_changes() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_storage(Default::default(), subscriber, None.into()); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -170,7 +173,7 @@ fn should_send_initial_storage_changes_and_notifications() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into())); @@ -179,7 +182,10 @@ fn should_send_initial_storage_changes_and_notifications() { ]).into()); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -205,7 +211,7 @@ fn should_send_initial_storage_changes_and_notifications() { #[test] fn should_query_storage() { fn run_tests(mut client: Arc, has_changes_trie_config: bool) { - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let mut add_block = |nonce| { let mut builder = client.new_block(Default::default()).unwrap(); @@ -422,7 +428,7 @@ fn should_split_ranges() { #[test] fn should_return_runtime_version() { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\ \"specVersion\":2,\"implVersion\":2,\"apis\":[[\"0xdf6acb689907609b\",3],\ @@ -445,12 +451,16 @@ fn should_notify_on_runtime_version_initially() { { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_runtime_version(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); + } // assert initial version sent. diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index fc5991bc3f..c72f8226fe 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -26,6 +26,7 @@ test-helpers = [] derive_more = "0.99.2" futures01 = { package = "futures", version = "0.1.29" } futures = { version = "0.3.4", features = ["compat"] } +jsonrpc-pubsub = "14.2" rand = "0.7.3" parking_lot = "0.10.0" lazy_static = "1.4.0" diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index baf1c2e0cc..d0cdaac5b7 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -36,6 +36,7 @@ use futures::{ Future, FutureExt, StreamExt, future::ready, }; +use jsonrpc_pubsub::manager::SubscriptionManager; use sc_keystore::Store as Keystore; use log::{info, warn, error}; use sc_network::config::{Role, FinalityProofProvider, OnDemand, BoxFinalityProofRequestBuilder}; @@ -1196,7 +1197,7 @@ ServiceBuilder< chain_type: chain_spec.chain_type().clone(), }; - let subscriptions = sc_rpc::Subscriptions::new(Arc::new(task_manager.spawn_handle())); + let subscriptions = SubscriptionManager::new(Arc::new(task_manager.spawn_handle())); let (chain, state, child_state) = if let (Some(remote_backend), Some(on_demand)) = (remote_backend.as_ref(), on_demand.as_ref()) { diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index 8ed233ed79..d521be6d2a 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index 3ca2f4be8e..adecfd0aab 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 006372eb36..a64b23b6a9 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = { version = "0.3.0", features = ["compat"] } -jsonrpc-client-transports = { version = "14.0.5", default-features = false, features = ["http"] } -jsonrpc-core = "14" +jsonrpc-client-transports = { version = "14.2", default-features = false, features = ["http"] } +jsonrpc-core = "14.2" codec = { package = "parity-scale-codec", version = "1" } serde = "1" frame-support = { version = "2.0.0-rc2", path = "../../../../frame/support" } diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index f757e811fb..d4878a4f28 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] sc-client-api = { version = "2.0.0-rc2", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2" +jsonrpc-core-client = "14.2" +jsonrpc-derive = "14.2.1" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } -- GitLab From fb77af0fec125a7355d59edfb20702bcae8d6439 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 4 Jun 2020 13:48:15 +0200 Subject: [PATCH 105/280] Fix peerset not filtering incoming connections in reserved-only (#6249) --- client/peerset/src/lib.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/client/peerset/src/lib.rs b/client/peerset/src/lib.rs index a224965035..6f28dd036a 100644 --- a/client/peerset/src/lib.rs +++ b/client/peerset/src/lib.rs @@ -520,6 +520,13 @@ impl Peerset { trace!(target: "peerset", "Incoming {:?}", peer_id); self.update_time(); + if self.reserved_only { + if !self.priority_groups.get(RESERVED_NODES).map_or(false, |n| n.contains(&peer_id)) { + self.message_queue.push_back(Message::Reject(index)); + return; + } + } + let not_connected = match self.data.peer(&peer_id) { // If we're already connected, don't answer, as the docs mention. peersstate::Peer::Connected(_) => return, @@ -740,6 +747,26 @@ mod tests { ]); } + #[test] + fn test_peerset_reject_incoming_in_reserved_only() { + let incoming = PeerId::random(); + let ii = IncomingIndex(1); + let config = PeersetConfig { + in_peers: 50, + out_peers: 50, + bootnodes: vec![], + reserved_only: true, + priority_groups: vec![], + }; + + let (mut peerset, _) = Peerset::from_config(config); + peerset.incoming(incoming.clone(), ii); + + assert_messages(peerset, vec![ + Message::Reject(ii), + ]); + } + #[test] fn test_peerset_discovered() { let bootnode = PeerId::random(); -- GitLab From fc11ba9ea8d8532798d04258c7246a7d8bb65b3b Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 4 Jun 2020 14:06:44 +0200 Subject: [PATCH 106/280] Fix service tests not calling update_chain (#6232) --- client/network/src/service.rs | 14 ++++++++++++++ client/service/test/src/lib.rs | 1 + 2 files changed, 15 insertions(+) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 6256cdd64d..c4b6d97909 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -713,6 +713,17 @@ impl NetworkService { pub fn num_connected(&self) -> usize { self.num_connected.load(Ordering::Relaxed) } + + /// This function should be called when blocks are added to the chain by something other + /// than the import queue. + /// + /// > **Important**: This function is a hack and can be removed at any time. Do **not** use it. + pub fn update_chain(&self) { + let _ = self + .to_worker + .unbounded_send(ServiceToWorkerMsg::UpdateChain); + } + } impl sp_consensus::SyncOracle @@ -778,6 +789,7 @@ enum ServiceToWorkerMsg { protocol_name: Cow<'static, [u8]>, }, DisconnectPeer(PeerId), + UpdateChain, } /// Main network worker. Must be polled in order for the network to advance. @@ -1106,6 +1118,8 @@ impl Future for NetworkWorker { }, ServiceToWorkerMsg::DisconnectPeer(who) => this.network_service.user_protocol_mut().disconnect_peer(&who), + ServiceToWorkerMsg::UpdateChain => + this.network_service.user_protocol_mut().update_chain(), } } diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 63c7e0795d..2061530825 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -457,6 +457,7 @@ pub fn sync( make_block_and_import(&first_service.get(), first_user_data); } + (network.full_nodes[0].1).0.lock().unwrap().network().update_chain(); network.full_nodes[0].3.clone() }; -- GitLab From bf9e58cd0772a84f3e419b7169ad461f24da8948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 4 Jun 2020 15:39:57 +0100 Subject: [PATCH 107/280] Revert "Use Subscription Manager from `jsonrpc-pubsub` (#6208)" (#6252) This reverts commit f028a509789289a34c468f42b4361c49279893f2. --- Cargo.lock | 126 +++++++++++------------ bin/node/browser-testing/Cargo.toml | 2 +- bin/node/cli/Cargo.toml | 2 +- bin/node/rpc-client/Cargo.toml | 2 +- bin/node/rpc/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/consensus/babe/rpc/Cargo.toml | 6 +- client/consensus/manual-seal/Cargo.toml | 6 +- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/rpc-api/Cargo.toml | 8 +- client/rpc-api/src/lib.rs | 2 + client/rpc-api/src/subscriptions.rs | 121 ++++++++++++++++++++++ client/rpc-servers/Cargo.toml | 8 +- client/rpc/Cargo.toml | 4 +- client/rpc/src/author/mod.rs | 9 +- client/rpc/src/author/tests.rs | 35 ++----- client/rpc/src/chain/chain_full.rs | 8 +- client/rpc/src/chain/chain_light.rs | 8 +- client/rpc/src/chain/mod.rs | 11 +- client/rpc/src/chain/tests.rs | 29 ++---- client/rpc/src/lib.rs | 2 +- client/rpc/src/state/mod.rs | 8 +- client/rpc/src/state/state_full.rs | 8 +- client/rpc/src/state/state_light.rs | 8 +- client/rpc/src/state/tests.rs | 32 ++---- client/service/Cargo.toml | 1 - client/service/src/builder.rs | 3 +- frame/contracts/rpc/Cargo.toml | 6 +- frame/transaction-payment/rpc/Cargo.toml | 6 +- utils/frame/rpc/support/Cargo.toml | 4 +- utils/frame/rpc/system/Cargo.toml | 6 +- 31 files changed, 285 insertions(+), 196 deletions(-) create mode 100644 client/rpc-api/src/subscriptions.rs diff --git a/Cargo.lock b/Cargo.lock index a504065878..2e7fbb14cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,7 +160,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -321,7 +321,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "regex", "rustc-hash", "shlex", @@ -991,7 +991,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" dependencies = [ - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1031,7 +1031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1133,7 +1133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ed9afacaea0301eefb738c9deea725e6d53938004597cdc518a8cf9a7aa2f03" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1286,7 +1286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "synstructure", ] @@ -1477,7 +1477,7 @@ version = "2.0.0-rc2" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1488,7 +1488,7 @@ dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1497,7 +1497,7 @@ name = "frame-support-procedural-tools-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -1713,7 +1713,7 @@ checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -2234,7 +2234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -2319,9 +2319,9 @@ dependencies = [ [[package]] name = "jsonrpc-client-transports" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158" +checksum = "2307a7e78cf969759e390a8a2151ea12e783849a45bb00aa871b468ba58ea79e" dependencies = [ "failure", "futures 0.1.29", @@ -2336,9 +2336,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" +checksum = "25525f6002338fb4debb5167a89a0b47f727a5a48418417545ad3429758b7fec" dependencies = [ "futures 0.1.29", "log", @@ -2349,30 +2349,30 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713" +checksum = "87f9382e831a6d630c658df103aac3f971da096deb57c136ea2b760d3b4e3f9f" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "14.2.1" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fadf6945e227246825a583514534d864554e9f23d80b3c77d034b10983db5ef" +checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] [[package]] name = "jsonrpc-http-server" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da906d682799df05754480dac1b9e70ec92e12c19ebafd2662a5ea1c9fd6522" +checksum = "d52860f0549694aa4abb12766856f56952ab46d3fb9f0815131b2db3d9cc2f29" dependencies = [ "hyper 0.12.35", "jsonrpc-core", @@ -2385,22 +2385,21 @@ dependencies = [ [[package]] name = "jsonrpc-pubsub" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986" +checksum = "c4ca5e391d6c6a2261d4adca029f427fe63ea546ad6cef2957c654c08495ec16" dependencies = [ "jsonrpc-core", "log", "parking_lot 0.10.2", - "rand 0.7.3", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56cbfb462e7f902e21121d9f0d1c2b77b2c5b642e1a4e8f4ebfa2e15b94402bb" +checksum = "1f06add502b48351e05dd95814835327fb115e4e9f834ca42fd522d3b769d4d2" dependencies = [ "bytes 0.4.12", "globset", @@ -2414,9 +2413,9 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "14.2.0" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903d3109fe7c4acb932b567e1e607e0f524ed04741b09fb0e61841bc40a022fc" +checksum = "017a7dd5083d9ed62c5e1dd3e317975c33c3115dac5447f4480fe05a8c354754" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -2642,7 +2641,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" dependencies = [ - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -4472,7 +4471,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "sp-runtime", "syn 1.0.17", ] @@ -4705,7 +4704,7 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -4824,7 +4823,7 @@ checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -4888,7 +4887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -5008,7 +5007,7 @@ checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "version_check", ] @@ -5020,7 +5019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "syn-mid", "version_check", @@ -5113,7 +5112,7 @@ dependencies = [ "anyhow", "itertools", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -5181,9 +5180,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.6" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" dependencies = [ "proc-macro2", ] @@ -5481,7 +5480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -5665,7 +5664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -5798,7 +5797,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -6573,7 +6572,6 @@ dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", "hash-db", - "jsonrpc-pubsub", "lazy_static", "log", "netstat2", @@ -6819,7 +6817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -6915,7 +6913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7035,7 +7033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7137,7 +7135,7 @@ dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7397,7 +7395,7 @@ name = "sp-debug-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7514,7 +7512,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7587,7 +7585,7 @@ dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7881,7 +7879,7 @@ dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -7902,7 +7900,7 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -8272,7 +8270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "unicode-xid 0.2.0", ] @@ -8283,7 +8281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -8303,7 +8301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "unicode-xid 0.2.0", ] @@ -8366,7 +8364,7 @@ checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9" dependencies = [ "lazy_static", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "version_check", ] @@ -8396,7 +8394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -8602,7 +8600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -8780,7 +8778,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", ] @@ -9112,7 +9110,7 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "wasm-bindgen-shared", ] @@ -9135,7 +9133,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.6", + "quote 1.0.3", "wasm-bindgen-macro-support", ] @@ -9146,7 +9144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -9179,7 +9177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", ] [[package]] @@ -9467,7 +9465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.6", + "quote 1.0.3", "syn 1.0.17", "synstructure", ] diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index bbd33782b7..7628582fbb 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" libp2p = { version = "0.19.1", default-features = false } -jsonrpc-core = "14.2" +jsonrpc-core = "14.0.5" serde = "1.0.106" serde_json = "1.0.48" wasm-bindgen = { version = "=0.2.62", features = ["serde-serialize"] } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index b820cef270..f2b25068ed 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -38,7 +38,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } serde = { version = "1.0.102", features = ["derive"] } futures = { version = "0.3.1", features = ["compat"] } hex-literal = "0.2.1" -jsonrpc-core = "14.2" +jsonrpc-core = "14.0.3" log = "0.4.8" rand = "0.7.2" structopt = { version = "0.3.8", optional = true } diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index c6cd7d4040..0b529d116c 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] env_logger = "0.7.0" futures = "0.1.29" hyper = "0.12.35" -jsonrpc-core-client = { version = "14.2", default-features = false, features = ["http"] } +jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } log = "0.4.8" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 2eb7e83beb..00b8be99b1 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -jsonrpc-core = "14.2" +jsonrpc-core = "14.0.3" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } node-runtime = { version = "2.0.0-rc2", path = "../runtime" } sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index c0dd77eb01..43bb056404 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -31,7 +31,7 @@ rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } -jsonrpc-core-client = { version = "14.2", features = ["http"] } +jsonrpc-core-client = { version = "14.0.3", features = ["http"] } hyper = "0.12.35" libp2p = { version = "0.19.1", default-features = false } serde_json = "1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 0986eea2b1..20f7e48758 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-consensus-babe = { version = "0.8.0-rc2", path = "../" } sc-rpc-api = { version = "0.8.0-rc2", path = "../../../rpc-api" } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.3" sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 6b77829803..de2bf68d76 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" futures = "0.3.4" -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.5" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.5" log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index 3658758960..e1724c6c4e 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -10,9 +10,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] sc-finality-grandpa = { version = "0.8.0-rc2", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.3" +jsonrpc-derive = "14.0.3" futures = { version = "0.3.4", features = ["compat"] } serde = { version = "1.0.105", features = ["derive"] } serde_json = "1.0.50" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index db992eed04..1075c3a11c 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -15,10 +15,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99.2" futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" -jsonrpc-pubsub = "14.2" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.3" +jsonrpc-pubsub = "14.0.3" log = "0.4.8" parking_lot = "0.10.0" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } diff --git a/client/rpc-api/src/lib.rs b/client/rpc-api/src/lib.rs index cd2608dda9..f742d73b69 100644 --- a/client/rpc-api/src/lib.rs +++ b/client/rpc-api/src/lib.rs @@ -23,8 +23,10 @@ mod errors; mod helpers; mod policy; +mod subscriptions; pub use jsonrpc_core::IoHandlerExtension as RpcExtension; +pub use subscriptions::{Subscriptions, TaskExecutor}; pub use helpers::Receiver; pub use policy::DenyUnsafe; diff --git a/client/rpc-api/src/subscriptions.rs b/client/rpc-api/src/subscriptions.rs new file mode 100644 index 0000000000..7feae662ee --- /dev/null +++ b/client/rpc-api/src/subscriptions.rs @@ -0,0 +1,121 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +use std::collections::HashMap; +use std::sync::{Arc, atomic::{self, AtomicUsize}}; + +use log::{error, warn}; +use jsonrpc_pubsub::{SubscriptionId, typed::{Sink, Subscriber}}; +use parking_lot::Mutex; +use jsonrpc_core::futures::sync::oneshot; +use jsonrpc_core::futures::{Future, future}; + +type Id = u64; + +/// Alias for a an implementation of `futures::future::Executor`. +pub type TaskExecutor = Arc + Send>> + Send + Sync>; + +/// Generate unique ids for subscriptions. +#[derive(Clone, Debug)] +pub struct IdProvider { + next_id: Arc, +} +impl Default for IdProvider { + fn default() -> Self { + IdProvider { + next_id: Arc::new(AtomicUsize::new(1)), + } + } +} + +impl IdProvider { + /// Returns next id for the subscription. + pub fn next_id(&self) -> Id { + self.next_id.fetch_add(1, atomic::Ordering::AcqRel) as u64 + } +} + +/// Subscriptions manager. +/// +/// Takes care of assigning unique subscription ids and +/// driving the sinks into completion. +#[derive(Clone)] +pub struct Subscriptions { + next_id: IdProvider, + active_subscriptions: Arc>>>, + executor: TaskExecutor, +} + +impl Subscriptions { + /// Creates new `Subscriptions` object. + pub fn new(executor: TaskExecutor) -> Self { + Subscriptions { + next_id: Default::default(), + active_subscriptions: Default::default(), + executor, + } + } + + /// Borrows the internal task executor. + /// + /// This can be used to spawn additional tasks on the underlying event loop. + pub fn executor(&self) -> &TaskExecutor { + &self.executor + } + + /// Creates new subscription for given subscriber. + /// + /// Second parameter is a function that converts Subscriber sink into a future. + /// This future will be driven to completion by the underlying event loop + /// or will be cancelled in case #cancel is invoked. + pub fn add(&self, subscriber: Subscriber, into_future: G) -> SubscriptionId where + G: FnOnce(Sink) -> R, + R: future::IntoFuture, + F: future::Future + Send + 'static, + { + let id = self.next_id.next_id(); + let subscription_id: SubscriptionId = id.into(); + if let Ok(sink) = subscriber.assign_id(subscription_id.clone()) { + let (tx, rx) = oneshot::channel(); + let future = into_future(sink) + .into_future() + .select(rx.map_err(|e| warn!("Error timeing out: {:?}", e))) + .then(|_| Ok(())); + + self.active_subscriptions.lock().insert(id, tx); + if self.executor.execute(Box::new(future)).is_err() { + error!("Failed to spawn RPC subscription task"); + } + } + + subscription_id + } + + /// Cancel subscription. + /// + /// Returns true if subscription existed or false otherwise. + pub fn cancel(&self, id: SubscriptionId) -> bool { + if let SubscriptionId::Number(id) = id { + if let Some(tx) = self.active_subscriptions.lock().remove(&id) { + let _ = tx.send(()); + return true; + } + } + false + } +} diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 9e52ccae58..401f5f4882 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -12,13 +12,13 @@ description = "Substrate RPC servers." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpc-core = "14.2" -pubsub = { package = "jsonrpc-pubsub", version = "14.2" } +jsonrpc-core = "14.0.3" +pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] -http = { package = "jsonrpc-http-server", version = "14.2" } -ws = { package = "jsonrpc-ws-server", version = "14.2" } +http = { package = "jsonrpc-http-server", version = "14.0.3" } +ws = { package = "jsonrpc-ws-server", version = "14.0.3" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 60c4a24cd0..62f9319575 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -17,10 +17,10 @@ sc-client-api = { version = "2.0.0-rc2", path = "../api" } sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-pubsub = "14.2" +jsonrpc-pubsub = "14.0.3" log = "0.4.8" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -rpc = { package = "jsonrpc-core", version = "14.2" } +rpc = { package = "jsonrpc-core", version = "14.0.3" } sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } serde_json = "1.0.41" sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index 974c1b85e1..d59fad354e 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -32,8 +32,8 @@ use rpc::futures::{ }; use futures::{StreamExt as _, compat::Compat}; use futures::future::{ready, FutureExt, TryFutureExt}; -use sc_rpc_api::DenyUnsafe; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; +use sc_rpc_api::{DenyUnsafe, Subscriptions}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use codec::{Encode, Decode}; use sp_core::{Bytes, traits::BareCryptoStorePtr}; use sp_api::ProvideRuntimeApi; @@ -55,7 +55,7 @@ pub struct Author { /// Transactions pool pool: Arc

, /// Subscriptions manager - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, /// The key store. keystore: BareCryptoStorePtr, /// Whether to deny unsafe calls @@ -67,7 +67,7 @@ impl Author { pub fn new( client: Arc, pool: Arc

, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, keystore: BareCryptoStorePtr, deny_unsafe: DenyUnsafe, ) -> Self { @@ -81,6 +81,7 @@ impl Author { } } + /// Currently we treat all RPC transactions as externals. /// /// Possibly in the future we could allow opt-in for special treatment diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index f0f92a8e7e..8c1b82028b 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -81,7 +81,7 @@ impl TestSetup { Author { client: self.client.clone(), pool: self.pool.clone(), - subscriptions: SubscriptionManager::new(Arc::new(crate::testing::TaskExecutor)), + subscriptions: Subscriptions::new(Arc::new(crate::testing::TaskExecutor)), keystore: self.keystore.clone(), deny_unsafe: DenyUnsafe::No, } @@ -133,14 +133,8 @@ fn should_watch_extrinsic() { uxt(AccountKeyring::Alice, 0).encode().into(), ); - let id = executor::block_on(id_rx.compat()).unwrap().unwrap(); - assert_matches!(id, SubscriptionId::String(_)); - - let id = match id { - SubscriptionId::String(id) => id, - _ => unreachable!(), - }; - + // then + assert_eq!(executor::block_on(id_rx.compat()), Ok(Ok(1.into()))); // check notifications let replacement = { let tx = Transfer { @@ -153,22 +147,15 @@ fn should_watch_extrinsic() { }; AuthorApi::submit_extrinsic(&p, replacement.encode().into()).wait().unwrap(); let (res, data) = executor::block_on(data.into_future().compat()).unwrap(); - - let expected = Some(format!( - r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":"ready","subscription":"{}"}}}}"#, - id, - )); - assert_eq!(res, expected); - + assert_eq!( + res, + Some(r#"{"jsonrpc":"2.0","method":"test","params":{"result":"ready","subscription":1}}"#.into()) + ); let h = blake2_256(&replacement.encode()); - let expected = Some(format!( - r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":"{}"}}}}"#, - HexDisplay::from(&h), - id, - )); - - let res = executor::block_on(data.into_future().compat()).unwrap().0; - assert_eq!(res, expected); + assert_eq!( + executor::block_on(data.into_future().compat()).unwrap().0, + Some(format!(r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":1}}}}"#, HexDisplay::from(&h))) + ); } #[test] diff --git a/client/rpc/src/chain/chain_full.rs b/client/rpc/src/chain/chain_full.rs index 816dbba866..c1b062754b 100644 --- a/client/rpc/src/chain/chain_full.rs +++ b/client/rpc/src/chain/chain_full.rs @@ -18,8 +18,8 @@ use std::sync::Arc; use rpc::futures::future::result; -use jsonrpc_pubsub::manager::SubscriptionManager; +use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, BlockBackend}; use sp_runtime::{generic::{BlockId, SignedBlock}, traits::{Block as BlockT}}; @@ -32,14 +32,14 @@ pub struct FullChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, /// phantom member to pin the block type _phantom: PhantomData, } impl FullChain { /// Create new Chain API RPC handler. - pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { + pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { Self { client, subscriptions, @@ -56,7 +56,7 @@ impl ChainBackend for FullChain whe &self.client } - fn subscriptions(&self) -> &SubscriptionManager { + fn subscriptions(&self) -> &Subscriptions { &self.subscriptions } diff --git a/client/rpc/src/chain/chain_light.rs b/client/rpc/src/chain/chain_light.rs index 8a4afbed71..059233089d 100644 --- a/client/rpc/src/chain/chain_light.rs +++ b/client/rpc/src/chain/chain_light.rs @@ -19,8 +19,8 @@ use std::sync::Arc; use futures::{future::ready, FutureExt, TryFutureExt}; use rpc::futures::future::{result, Future, Either}; -use jsonrpc_pubsub::manager::SubscriptionManager; +use sc_rpc_api::Subscriptions; use sc_client_api::light::{Fetcher, RemoteBodyRequest, RemoteBlockchain}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -37,7 +37,7 @@ pub struct LightChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, /// Remote blockchain reference remote_blockchain: Arc>, /// Remote fetcher reference. @@ -48,7 +48,7 @@ impl> LightChain { /// Create new Chain API RPC handler. pub fn new( client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { @@ -70,7 +70,7 @@ impl ChainBackend for LightChain &SubscriptionManager { + fn subscriptions(&self) -> &Subscriptions { &self.subscriptions } diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 7b13e7a600..6d53fbbb06 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -32,8 +32,9 @@ use rpc::{ futures::{stream, Future, Sink, Stream}, }; +use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, light::{Fetcher, RemoteBlockchain}}; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use sp_rpc::{number::NumberOrHex, list::ListOrValue}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -56,7 +57,7 @@ trait ChainBackend: Send + Sync + 'static fn client(&self) -> &Arc; /// Get subscriptions reference. - fn subscriptions(&self) -> &SubscriptionManager; + fn subscriptions(&self) -> &Subscriptions; /// Tries to unwrap passed block hash, or uses best block hash otherwise. fn unwrap_or_best(&self, hash: Option) -> Block::Hash { @@ -176,7 +177,7 @@ trait ChainBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, ) -> Chain where Block: BlockT + 'static, @@ -190,7 +191,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, remote_blockchain: Arc>, fetcher: Arc, ) -> Chain @@ -278,7 +279,7 @@ impl ChainApi, Block::Hash, Block::Header, Signe /// Subscribe to new headers. fn subscribe_headers( client: &Arc, - subscriptions: &SubscriptionManager, + subscriptions: &Subscriptions, subscriber: Subscriber, best_block_hash: G, stream: F, diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index 68d46135e3..e86d1d547f 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -31,7 +31,7 @@ use crate::testing::TaskExecutor; #[test] fn should_return_header() { let client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); assert_matches!( api.header(Some(client.genesis_hash()).into()).wait(), @@ -63,7 +63,7 @@ fn should_return_header() { #[test] fn should_return_a_block() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; let block_hash = block.hash(); @@ -114,7 +114,7 @@ fn should_return_a_block() { #[test] fn should_return_block_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); assert_matches!( api.block_hash(None.into()), @@ -158,7 +158,7 @@ fn should_return_block_hash() { #[test] fn should_return_finalized_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); assert_matches!( api.finalized_head(), @@ -188,15 +188,12 @@ fn should_notify_about_latest_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); api.subscribe_all_heads(Default::default(), subscriber); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -218,15 +215,12 @@ fn should_notify_about_best_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); api.subscribe_new_heads(Default::default(), subscriber); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -248,15 +242,12 @@ fn should_notify_about_finalized_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); api.subscribe_finalized_heads(Default::default(), subscriber); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 53a63b449c..f979b0ab69 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -24,7 +24,7 @@ mod metadata; -pub use sc_rpc_api::DenyUnsafe; +pub use sc_rpc_api::{DenyUnsafe, Subscriptions}; pub use self::metadata::Metadata; pub use rpc::IoHandlerExtension as RpcExtension; diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index 921cc7efc6..168dc3e010 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -25,10 +25,10 @@ mod state_light; mod tests; use std::sync::Arc; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use rpc::{Result as RpcResult, futures::{Future, future::result}}; -use sc_rpc_api::state::ReadProof; +use sc_rpc_api::{Subscriptions, state::ReadProof}; use sc_client_api::light::{RemoteBlockchain, Fetcher}; use sp_core::{Bytes, storage::{StorageKey, PrefixedStorageKey, StorageData, StorageChangeSet}}; use sp_version::RuntimeVersion; @@ -170,7 +170,7 @@ pub trait StateBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, ) -> (State, ChildState) where Block: BlockT + 'static, @@ -191,7 +191,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, remote_blockchain: Arc>, fetcher: Arc, ) -> (State, ChildState) diff --git a/client/rpc/src/state/state_full.rs b/client/rpc/src/state/state_full.rs index f0ae79a033..82f87e9acf 100644 --- a/client/rpc/src/state/state_full.rs +++ b/client/rpc/src/state/state_full.rs @@ -21,10 +21,10 @@ use std::sync::Arc; use std::ops::Range; use futures::{future, StreamExt as _, TryStreamExt as _}; use log::warn; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use rpc::{Result as RpcResult, futures::{stream, Future, Sink, Stream, future::result}}; -use sc_rpc_api::state::ReadProof; +use sc_rpc_api::{Subscriptions, state::ReadProof}; use sc_client_api::backend::Backend; use sp_blockchain::{Result as ClientResult, Error as ClientError, HeaderMetadata, CachedHeaderMetadata, HeaderBackend}; use sc_client_api::BlockchainEvents; @@ -60,7 +60,7 @@ struct QueryStorageRange { /// State API backend for full nodes. pub struct FullState { client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, _phantom: PhantomData<(BE, Block)> } @@ -72,7 +72,7 @@ impl FullState Block: BlockT + 'static, { /// Create new state API backend for full nodes. - pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { + pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { Self { client, subscriptions, _phantom: PhantomData } } diff --git a/client/rpc/src/state/state_light.rs b/client/rpc/src/state/state_light.rs index ec275a2d78..af5d4248e3 100644 --- a/client/rpc/src/state/state_light.rs +++ b/client/rpc/src/state/state_light.rs @@ -28,7 +28,7 @@ use futures::{ StreamExt as _, TryStreamExt as _, }; use hash_db::Hasher; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use log::warn; use parking_lot::Mutex; use rpc::{ @@ -38,7 +38,7 @@ use rpc::{ futures::stream::Stream, }; -use sc_rpc_api::state::ReadProof; +use sc_rpc_api::{Subscriptions, state::ReadProof}; use sp_blockchain::{Error as ClientError, HeaderBackend}; use sc_client_api::{ BlockchainEvents, @@ -63,7 +63,7 @@ type StorageMap = HashMap>; #[derive(Clone)] pub struct LightState, Client> { client: Arc, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, version_subscriptions: SimpleSubscriptions, storage_subscriptions: Arc>>, remote_blockchain: Arc>, @@ -143,7 +143,7 @@ impl + 'static, Client> LightState, - subscriptions: SubscriptionManager, + subscriptions: Subscriptions, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index 0cc16ce8d5..a610cbbfc8 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -55,7 +55,7 @@ fn should_return_storage() { .add_extra_child_storage(&child_info, KEY.to_vec(), CHILD_VALUE.to_vec()) .build(); let genesis_hash = client.genesis_hash(); - let (client, child) = new_full(Arc::new(client), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (client, child) = new_full(Arc::new(client), Subscriptions::new(Arc::new(TaskExecutor))); let key = StorageKey(KEY.to_vec()); assert_eq!( @@ -90,7 +90,7 @@ fn should_return_child_storage() { .add_child_storage(&child_info, "key", vec![42_u8]) .build()); let genesis_hash = client.genesis_hash(); - let (_client, child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); + let (_client, child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); let child_key = prefixed_storage_key(); let key = StorageKey(b"key".to_vec()); @@ -125,7 +125,7 @@ fn should_return_child_storage() { fn should_call_contract() { let client = Arc::new(substrate_test_runtime_client::new()); let genesis_hash = client.genesis_hash(); - let (client, _child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); + let (client, _child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); assert_matches!( client.call("balanceOf".into(), Bytes(vec![1,2,3]), Some(genesis_hash).into()).wait(), @@ -139,15 +139,12 @@ fn should_notify_about_storage_changes() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); api.subscribe_storage(Default::default(), subscriber, None.into()); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -173,7 +170,7 @@ fn should_send_initial_storage_changes_and_notifications() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into())); @@ -182,10 +179,7 @@ fn should_send_initial_storage_changes_and_notifications() { ]).into()); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -211,7 +205,7 @@ fn should_send_initial_storage_changes_and_notifications() { #[test] fn should_query_storage() { fn run_tests(mut client: Arc, has_changes_trie_config: bool) { - let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); let mut add_block = |nonce| { let mut builder = client.new_block(Default::default()).unwrap(); @@ -428,7 +422,7 @@ fn should_split_ranges() { #[test] fn should_return_runtime_version() { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\ \"specVersion\":2,\"implVersion\":2,\"apis\":[[\"0xdf6acb689907609b\",3],\ @@ -451,16 +445,12 @@ fn should_notify_on_runtime_version_initially() { { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); api.subscribe_runtime_version(Default::default(), subscriber); // assert id assigned - assert!(matches!( - executor::block_on(id.compat()), - Ok(Ok(SubscriptionId::String(_))) - )); - + assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); } // assert initial version sent. diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index c72f8226fe..fc5991bc3f 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -26,7 +26,6 @@ test-helpers = [] derive_more = "0.99.2" futures01 = { package = "futures", version = "0.1.29" } futures = { version = "0.3.4", features = ["compat"] } -jsonrpc-pubsub = "14.2" rand = "0.7.3" parking_lot = "0.10.0" lazy_static = "1.4.0" diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index d0cdaac5b7..baf1c2e0cc 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -36,7 +36,6 @@ use futures::{ Future, FutureExt, StreamExt, future::ready, }; -use jsonrpc_pubsub::manager::SubscriptionManager; use sc_keystore::Store as Keystore; use log::{info, warn, error}; use sc_network::config::{Role, FinalityProofProvider, OnDemand, BoxFinalityProofRequestBuilder}; @@ -1197,7 +1196,7 @@ ServiceBuilder< chain_type: chain_spec.chain_type().clone(), }; - let subscriptions = SubscriptionManager::new(Arc::new(task_manager.spawn_handle())); + let subscriptions = sc_rpc::Subscriptions::new(Arc::new(task_manager.spawn_handle())); let (chain, state, child_state) = if let (Some(remote_backend), Some(on_demand)) = (remote_backend.as_ref(), on_demand.as_ref()) { diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index d521be6d2a..8ed233ed79 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.3" sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index adecfd0aab..3ca2f4be8e 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.3" sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index a64b23b6a9..006372eb36 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = { version = "0.3.0", features = ["compat"] } -jsonrpc-client-transports = { version = "14.2", default-features = false, features = ["http"] } -jsonrpc-core = "14.2" +jsonrpc-client-transports = { version = "14.0.5", default-features = false, features = ["http"] } +jsonrpc-core = "14" codec = { package = "parity-scale-codec", version = "1" } serde = "1" frame-support = { version = "2.0.0-rc2", path = "../../../../frame/support" } diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index d4878a4f28..f757e811fb 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] sc-client-api = { version = "2.0.0-rc2", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } -jsonrpc-core = "14.2" -jsonrpc-core-client = "14.2" -jsonrpc-derive = "14.2.1" +jsonrpc-core = "14.0.3" +jsonrpc-core-client = "14.0.5" +jsonrpc-derive = "14.0.3" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } -- GitLab From e0e8501d15c00b94c9417d573a791fe074bd72bf Mon Sep 17 00:00:00 2001 From: Demi Obenour Date: Thu, 4 Jun 2020 16:38:02 +0000 Subject: [PATCH 108/280] impl_opaque_keys should allow doc comments (#6255) --- primitives/runtime/src/traits.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index 7d7e969427..fb46ba1dfa 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -1157,6 +1157,7 @@ macro_rules! impl_opaque_keys { $( #[ $attr:meta ] )* pub struct $name:ident { $( + $( #[ $inner_attr:meta ] )* pub $field:ident: $type:ty, )* } @@ -1171,6 +1172,7 @@ macro_rules! impl_opaque_keys { #[cfg_attr(feature = "std", derive($crate::serde::Serialize, $crate::serde::Deserialize))] pub struct $name { $( + $( #[ $inner_attr ] )* pub $field: <$type as $crate::BoundToRuntimeAppPublic>::Public, )* } -- GitLab From 674524098273d86b18782f0f9c6ee1b1c407b010 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Thu, 4 Jun 2020 23:41:48 +0200 Subject: [PATCH 109/280] Use number of downloaded blocks for test (#6234) --- client/network/src/protocol.rs | 6 +++--- client/network/src/protocol/sync.rs | 16 +++++++--------- client/network/src/service.rs | 6 +++--- client/network/test/src/lib.rs | 6 +++--- client/network/test/src/sync.rs | 4 ++-- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index b3c08320f9..0450818e7a 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -533,9 +533,9 @@ impl Protocol { self.sync.status().queued_blocks } - /// Number of processed blocks. - pub fn num_processed_blocks(&self) -> usize { - self.sync.num_processed_blocks() + /// Number of downloaded blocks. + pub fn num_downloaded_blocks(&self) -> usize { + self.sync.num_downloaded_blocks() } /// Number of active sync requests. diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index e08fcf4e9b..781d410fff 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -189,8 +189,8 @@ pub struct ChainSync { block_announce_validator: Box + Send>, /// Maximum number of peers to ask the same blocks in parallel. max_parallel_downloads: u32, - /// Total number of processed blocks (imported or failed). - processed_blocks: usize, + /// Total number of downloaded blocks. + downloaded_blocks: usize, } /// All the data we have about a Peer that we are trying to sync with @@ -375,7 +375,7 @@ impl ChainSync { pending_requests: Default::default(), block_announce_validator, max_parallel_downloads, - processed_blocks: 0, + downloaded_blocks: 0, } } @@ -415,9 +415,9 @@ impl ChainSync { self.fork_targets.len() } - /// Number of processed blocks. - pub fn num_processed_blocks(&self) -> usize { - self.processed_blocks + /// Number of downloaded blocks. + pub fn num_downloaded_blocks(&self) -> usize { + self.downloaded_blocks } /// Handle a new connected peer. @@ -719,6 +719,7 @@ impl ChainSync { request: Option>, response: BlockResponse ) -> Result, BadPeer> { + self.downloaded_blocks += response.blocks.len(); let mut new_blocks: Vec> = if let Some(peer) = self.peers.get_mut(who) { let mut blocks = response.blocks; @@ -1004,8 +1005,6 @@ impl ChainSync { for (_, hash) in &results { self.queue_blocks.remove(&hash); } - self.processed_blocks += results.len(); - for (result, hash) in results { if has_error { continue; @@ -1274,7 +1273,6 @@ impl ChainSync { /// Restart the sync process. fn restart<'a>(&'a mut self) -> impl Iterator), BadPeer>> + 'a { - self.processed_blocks = 0; self.blocks.clear(); let info = self.client.info(); self.best_queued_hash = info.best_hash; diff --git a/client/network/src/service.rs b/client/network/src/service.rs index c4b6d97909..8263d78c35 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -390,9 +390,9 @@ impl NetworkWorker { self.network_service.user_protocol().num_queued_blocks() } - /// Returns the number of processed blocks. - pub fn num_processed_blocks(&self) -> usize { - self.network_service.user_protocol().num_processed_blocks() + /// Returns the number of downloaded blocks. + pub fn num_downloaded_blocks(&self) -> usize { + self.network_service.user_protocol().num_downloaded_blocks() } /// Number of active sync requests. diff --git a/client/network/test/src/lib.rs b/client/network/test/src/lib.rs index 3ce28c261f..a3e644558b 100644 --- a/client/network/test/src/lib.rs +++ b/client/network/test/src/lib.rs @@ -221,9 +221,9 @@ impl Peer { self.network.num_connected_peers() } - /// Returns the number of processed blocks. - pub fn num_processed_blocks(&self) -> usize { - self.network.num_processed_blocks() + /// Returns the number of downloaded blocks. + pub fn num_downloaded_blocks(&self) -> usize { + self.network.num_downloaded_blocks() } /// Returns true if we have no peer. diff --git a/client/network/test/src/sync.rs b/client/network/test/src/sync.rs index 13d04a8c4e..0269eb3562 100644 --- a/client/network/test/src/sync.rs +++ b/client/network/test/src/sync.rs @@ -673,12 +673,12 @@ fn imports_stale_once() { // check that NEW block is imported from announce message let new_hash = net.peer(0).push_blocks(1, false); import_with_announce(&mut net, new_hash); - assert_eq!(net.peer(1).num_processed_blocks(), 1); + assert_eq!(net.peer(1).num_downloaded_blocks(), 1); // check that KNOWN STALE block is imported from announce message let known_stale_hash = net.peer(0).push_blocks_at(BlockId::Number(0), 1, true); import_with_announce(&mut net, known_stale_hash); - assert_eq!(net.peer(1).num_processed_blocks(), 2); + assert_eq!(net.peer(1).num_downloaded_blocks(), 2); } #[test] -- GitLab From 3451ed181988ebc1c838c041578ff0f6a99d9864 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 4 Jun 2020 23:57:02 +0200 Subject: [PATCH 110/280] Sentry nodes and validator nodes also imply reserved (#6251) --- client/network/src/service.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 8263d78c35..fd58aa631d 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -157,12 +157,14 @@ impl NetworkWorker { Role::Sentry { validators } => { for validator in validators { sentries_and_validators.insert(validator.peer_id.clone()); + reserved_nodes.insert(validator.peer_id.clone()); known_addresses.push((validator.peer_id.clone(), validator.multiaddr.clone())); } } Role::Authority { sentry_nodes } => { for sentry_node in sentry_nodes { sentries_and_validators.insert(sentry_node.peer_id.clone()); + reserved_nodes.insert(sentry_node.peer_id.clone()); known_addresses.push((sentry_node.peer_id.clone(), sentry_node.multiaddr.clone())); } } -- GitLab From 606b4faf2f52ec588235d3cdff6c7364a393a645 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Fri, 5 Jun 2020 13:09:00 +0200 Subject: [PATCH 111/280] Remove pre-simple-payout code from staking (#6253) * Remove some dead code * fix * Kill warnings --- frame/staking/src/lib.rs | 252 ++++------------------------- frame/staking/src/mock.rs | 34 +--- frame/staking/src/tests.rs | 324 ------------------------------------- 3 files changed, 33 insertions(+), 577 deletions(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 434a5dcf93..8eb734d8c8 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -928,19 +928,20 @@ impl Default for Forcing { fn default() -> Self { Forcing::NotForcing } } -// A value placed in storage that represents the current version of the Staking storage. -// This value is used by the `on_runtime_upgrade` logic to determine whether we run -// storage migration logic. This should match directly with the semantic versions of the Rust crate. +// A value placed in storage that represents the current version of the Staking storage. This value +// is used by the `on_runtime_upgrade` logic to determine whether we run storage migration logic. +// This should match directly with the semantic versions of the Rust crate. #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] enum Releases { V1_0_0Ancient, V2_0_0, V3_0_0, + V4_0_0, } impl Default for Releases { fn default() -> Self { - Releases::V3_0_0 + Releases::V4_0_0 } } @@ -1126,10 +1127,7 @@ decl_storage! { /// Storage version of the pallet. /// /// This is set to v3.0.0 for new networks. - StorageVersion build(|_: &GenesisConfig| Releases::V3_0_0): Releases; - - /// The era where we migrated from Lazy Payouts to Simple Payouts - MigrateEra: Option; + StorageVersion build(|_: &GenesisConfig| Releases::V4_0_0): Releases; } add_extra_genesis { config(stakers): @@ -1277,6 +1275,28 @@ decl_module! { fn deposit_event() = default; + fn on_runtime_upgrade() -> Weight { + #[allow(dead_code)] + mod inner { + pub struct Module(sp_std::marker::PhantomData); + frame_support::decl_storage! { + trait Store for Module as Staking { + pub MigrateEra: Option; + } + } + } + + if let Releases::V3_0_0 = StorageVersion::get() { + StorageVersion::put(Releases::V4_0_0); + inner::MigrateEra::kill(); + + T::DbWeight::get().reads_writes(1, 1) + } else { + T::DbWeight::get().reads(1) + } + } + + /// sets `ElectionStatus` to `Open(now)` where `now` is the block number at which the /// election window has opened, if we are at the last session and less blocks than /// `T::ElectionLookahead` is remaining until the next new session schedule. The offchain @@ -1901,69 +1921,6 @@ decl_module! { ::UnappliedSlashes::insert(&era, &unapplied); } - /// **This extrinsic will be removed after `MigrationEra + HistoryDepth` has passed, giving - /// opportunity for users to claim all rewards before moving to Simple Payouts. After this - /// time, you should use `payout_stakers` instead.** - /// - /// Make one nominator's payout for one era. - /// - /// - `who` is the controller account of the nominator to pay out. - /// - `era` may not be lower than one following the most recently paid era. If it is higher, - /// then it indicates an instruction to skip the payout of all previous eras. - /// - `validators` is the list of all validators that `who` had exposure to during `era`, - /// alongside the index of `who` in the clipped exposure of the validator. - /// I.e. each element is a tuple of - /// `(validator, index of `who` in clipped exposure of validator)`. - /// If it is incomplete, then less than the full reward will be paid out. - /// It must not exceed `MAX_NOMINATIONS`. - /// - /// WARNING: once an era is payed for a validator such validator can't claim the payout of - /// previous era. - /// - /// WARNING: Incorrect arguments here can result in loss of payout. Be very careful. - /// - /// # - /// - Number of storage read of `O(validators)`; `validators` is the argument of the call, - /// and is bounded by `MAX_NOMINATIONS`. - /// - Each storage read is `O(N)` size and decode complexity; `N` is the maximum - /// nominations that can be given to a single validator. - /// - Computation complexity: `O(MAX_NOMINATIONS * logN)`; `MAX_NOMINATIONS` is the - /// maximum number of validators that may be nominated by a single nominator, it is - /// bounded only economically (all nominators are required to place a minimum stake). - /// # - #[weight = 500_000_000] - fn payout_nominator(origin, era: EraIndex, validators: Vec<(T::AccountId, u32)>) - -> DispatchResult - { - let ctrl = ensure_signed(origin)?; - Self::do_payout_nominator(ctrl, era, validators) - } - - /// **This extrinsic will be removed after `MigrationEra + HistoryDepth` has passed, giving - /// opportunity for users to claim all rewards before moving to Simple Payouts. After this - /// time, you should use `payout_stakers` instead.** - /// - /// Make one validator's payout for one era. - /// - /// - `who` is the controller account of the validator to pay out. - /// - `era` may not be lower than one following the most recently paid era. If it is higher, - /// then it indicates an instruction to skip the payout of all previous eras. - /// - /// WARNING: once an era is payed for a validator such validator can't claim the payout of - /// previous era. - /// - /// WARNING: Incorrect arguments here can result in loss of payout. Be very careful. - /// - /// # - /// - Time complexity: O(1). - /// - Contains a limited number of reads and writes. - /// # - #[weight = 500_000_000] - fn payout_validator(origin, era: EraIndex) -> DispatchResult { - let ctrl = ensure_signed(origin)?; - Self::do_payout_validator(ctrl, era) - } - /// Pay out all the stakers behind a single validator for a single era. /// /// - `validator_stash` is the stash account of the validator. Their nominators, up to @@ -1982,16 +1939,15 @@ decl_module! { /// N is the Number of payouts for the validator (including the validator) /// Base Weight: 110 + 54.2 * N µs (Median Slopes) /// DB Weight: - /// - Read: EraElectionStatus, CurrentEra, HistoryDepth, MigrateEra, ErasValidatorReward, + /// - Read: EraElectionStatus, CurrentEra, HistoryDepth, ErasValidatorReward, /// ErasStakersClipped, ErasRewardPoints, ErasValidatorPrefs (8 items) /// - Read Each: Bonded, Ledger, Payee, Locks, System Account (5 items) /// - Write Each: System Account, Locks, Ledger (3 items) - // TODO: Remove read on Migrate Era /// # #[weight = 110 * WEIGHT_PER_MICROS + 54 * WEIGHT_PER_MICROS * Weight::from(T::MaxNominatorRewardedPerValidator::get()) - + T::DbWeight::get().reads(8) + + T::DbWeight::get().reads(7) + T::DbWeight::get().reads(5) * Weight::from(T::MaxNominatorRewardedPerValidator::get() + 1) + T::DbWeight::get().writes(3) * Weight::from(T::MaxNominatorRewardedPerValidator::get() + 1) ] @@ -2273,143 +2229,6 @@ impl Module { >::kill(); } - fn do_payout_nominator(ctrl: T::AccountId, era: EraIndex, validators: Vec<(T::AccountId, u32)>) - -> DispatchResult - { - // validators len must not exceed `MAX_NOMINATIONS` to avoid querying more validator - // exposure than necessary. - if validators.len() > MAX_NOMINATIONS { - return Err(Error::::InvalidNumberOfNominations.into()); - } - // If migrate_era is not populated, then you should use `payout_stakers` - let migrate_era = MigrateEra::get().ok_or(Error::::InvalidEraToReward)?; - // This payout mechanism will only work for eras before the migration. - // Subsequent payouts should use `payout_stakers`. - ensure!(era < migrate_era, Error::::InvalidEraToReward); - let current_era = CurrentEra::get().ok_or(Error::::InvalidEraToReward)?; - ensure!(era <= current_era, Error::::InvalidEraToReward); - let history_depth = Self::history_depth(); - ensure!(era >= current_era.saturating_sub(history_depth), Error::::InvalidEraToReward); - - // Note: if era has no reward to be claimed, era may be future. better not to update - // `nominator_ledger.last_reward` in this case. - let era_payout = >::get(&era) - .ok_or_else(|| Error::::InvalidEraToReward)?; - - let mut nominator_ledger = >::get(&ctrl).ok_or_else(|| Error::::NotController)?; - - ensure!( - Self::era_election_status().is_closed() || Self::payee(&nominator_ledger.stash) != RewardDestination::Staked, - Error::::CallNotAllowed, - ); - - nominator_ledger.claimed_rewards.retain(|&x| x >= current_era.saturating_sub(history_depth)); - match nominator_ledger.claimed_rewards.binary_search(&era) { - Ok(_) => Err(Error::::AlreadyClaimed)?, - Err(pos) => nominator_ledger.claimed_rewards.insert(pos, era), - } - - >::insert(&ctrl, &nominator_ledger); - - let mut reward = Perbill::zero(); - let era_reward_points = >::get(&era); - - for (validator, nominator_index) in validators.into_iter() { - let commission = Self::eras_validator_prefs(&era, &validator).commission; - let validator_exposure = >::get(&era, &validator); - - if let Some(nominator_exposure) = validator_exposure.others - .get(nominator_index as usize) - { - if nominator_exposure.who != nominator_ledger.stash { - continue; - } - - let nominator_exposure_part = Perbill::from_rational_approximation( - nominator_exposure.value, - validator_exposure.total, - ); - let validator_point = era_reward_points.individual.get(&validator) - .map(|points| *points) - .unwrap_or_else(|| Zero::zero()); - let validator_point_part = Perbill::from_rational_approximation( - validator_point, - era_reward_points.total, - ); - reward = reward.saturating_add( - validator_point_part - .saturating_mul(Perbill::one().saturating_sub(commission)) - .saturating_mul(nominator_exposure_part) - ); - } - } - - if let Some(imbalance) = Self::make_payout(&nominator_ledger.stash, reward * era_payout) { - Self::deposit_event(RawEvent::Reward(ctrl, imbalance.peek())); - } - - Ok(()) - } - - fn do_payout_validator(ctrl: T::AccountId, era: EraIndex) -> DispatchResult { - // If migrate_era is not populated, then you should use `payout_stakers` - let migrate_era = MigrateEra::get().ok_or(Error::::InvalidEraToReward)?; - // This payout mechanism will only work for eras before the migration. - // Subsequent payouts should use `payout_stakers`. - ensure!(era < migrate_era, Error::::InvalidEraToReward); - let current_era = CurrentEra::get().ok_or(Error::::InvalidEraToReward)?; - ensure!(era <= current_era, Error::::InvalidEraToReward); - let history_depth = Self::history_depth(); - ensure!(era >= current_era.saturating_sub(history_depth), Error::::InvalidEraToReward); - - // Note: if era has no reward to be claimed, era may be future. better not to update - // `ledger.last_reward` in this case. - let era_payout = >::get(&era) - .ok_or_else(|| Error::::InvalidEraToReward)?; - - let mut ledger = >::get(&ctrl).ok_or_else(|| Error::::NotController)?; - - ensure!( - Self::era_election_status().is_closed() || Self::payee(&ledger.stash) != RewardDestination::Staked, - Error::::CallNotAllowed, - ); - - ledger.claimed_rewards.retain(|&x| x >= current_era.saturating_sub(history_depth)); - match ledger.claimed_rewards.binary_search(&era) { - Ok(_) => Err(Error::::AlreadyClaimed)?, - Err(pos) => ledger.claimed_rewards.insert(pos, era), - } - - >::insert(&ctrl, &ledger); - - let era_reward_points = >::get(&era); - let commission = Self::eras_validator_prefs(&era, &ledger.stash).commission; - let exposure = >::get(&era, &ledger.stash); - - let exposure_part = Perbill::from_rational_approximation( - exposure.own, - exposure.total, - ); - let validator_point = era_reward_points.individual.get(&ledger.stash) - .map(|points| *points) - .unwrap_or_else(|| Zero::zero()); - let validator_point_part = Perbill::from_rational_approximation( - validator_point, - era_reward_points.total, - ); - let reward = validator_point_part.saturating_mul( - commission.saturating_add( - Perbill::one().saturating_sub(commission).saturating_mul(exposure_part) - ) - ); - - if let Some(imbalance) = Self::make_payout(&ledger.stash, reward * era_payout) { - Self::deposit_event(RawEvent::Reward(ctrl, imbalance.peek())); - } - - Ok(()) - } - fn do_payout_stakers( validator_stash: T::AccountId, era: EraIndex, @@ -2420,13 +2239,6 @@ impl Module { let history_depth = Self::history_depth(); ensure!(era >= current_era.saturating_sub(history_depth), Error::::InvalidEraToReward); - // If there was no migration, then this function is always valid. - if let Some(migrate_era) = MigrateEra::get() { - // This payout mechanism will only work for eras on and after the migration. - // Payouts before then should use `payout_nominator`/`payout_validator`. - ensure!(migrate_era <= era, Error::::InvalidEraToReward); - } - // Note: if era has no reward to be claimed, era may be future. better not to update // `ledger.claimed_rewards` in this case. let era_payout = >::get(&era) @@ -3148,11 +2960,11 @@ impl Module { /// - after a `withdraw_unbond()` call that frees all of a stash's bonded balance. /// - through `reap_stash()` if the balance has fallen to zero (through slashing). fn kill_stash(stash: &T::AccountId, num_slashing_spans: u32) -> DispatchResult { - let controller = Bonded::::get(stash).ok_or(Error::::NotStash)?; + let controller = >::get(stash).ok_or(Error::::NotStash)?; slashing::clear_stash_metadata::(stash, num_slashing_spans)?; - Bonded::::remove(stash); + >::remove(stash); >::remove(&controller); >::remove(stash); diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 183196a7c2..6c52ccd662 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -17,7 +17,7 @@ //! Test utilities -use std::{collections::{HashSet, HashMap}, cell::RefCell}; +use std::{collections::HashSet, cell::RefCell}; use sp_runtime::Perbill; use sp_runtime::curve::PiecewiseLinear; use sp_runtime::traits::{IdentityLookup, Convert, SaturatedConversion, Zero}; @@ -980,38 +980,6 @@ pub(crate) fn prepare_submission_with( (compact, winners, score) } -/// Make all validator and nominator request their payment -pub(crate) fn make_all_reward_payment_before_migration(era: EraIndex) { - let validators_with_reward = ErasRewardPoints::::get(era).individual.keys() - .cloned() - .collect::>(); - - // reward nominators - let mut nominator_controllers = HashMap::new(); - for validator in Staking::eras_reward_points(era).individual.keys() { - let validator_exposure = Staking::eras_stakers_clipped(era, validator); - for (nom_index, nom) in validator_exposure.others.iter().enumerate() { - if let Some(nom_ctrl) = Staking::bonded(nom.who) { - nominator_controllers.entry(nom_ctrl) - .or_insert(vec![]) - .push((validator.clone(), nom_index as u32)); - } - } - } - for (nominator_controller, validators_with_nom_index) in nominator_controllers { - assert_ok!(Staking::payout_nominator( - Origin::signed(nominator_controller), - era, - validators_with_nom_index, - )); - } - - // reward validators - for validator_controller in validators_with_reward.iter().filter_map(Staking::bonded) { - assert_ok!(Staking::payout_validator(Origin::signed(validator_controller), era)); - } -} - /// Make all validator and nominator request their payment pub(crate) fn make_all_reward_payment(era: EraIndex) { let validators_with_reward = ErasRewardPoints::::get(era).individual.keys() diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index a241161e11..bb5030034b 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -4461,330 +4461,6 @@ fn bond_during_era_correctly_populates_claimed_rewards() { }); } -/* These migration tests below can be removed once migration code is removed */ - -#[test] -fn rewards_should_work_before_migration() { - // should check that before migration: - // * rewards get recorded per session - // * rewards get paid per Era - // * Check that nominators are also rewarded - ExtBuilder::default().nominate(true).build_and_execute(|| { - MigrateEra::put(10); - let init_balance_10 = Balances::total_balance(&10); - let init_balance_11 = Balances::total_balance(&11); - let init_balance_20 = Balances::total_balance(&20); - let init_balance_21 = Balances::total_balance(&21); - let init_balance_100 = Balances::total_balance(&100); - let init_balance_101 = Balances::total_balance(&101); - - // Check state - Payee::::insert(11, RewardDestination::Controller); - Payee::::insert(21, RewardDestination::Controller); - Payee::::insert(101, RewardDestination::Controller); - - >::reward_by_ids(vec![(11, 50)]); - >::reward_by_ids(vec![(11, 50)]); - // This is the second validator of the current elected set. - >::reward_by_ids(vec![(21, 50)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_0 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_0 > 10); // Test is meaningful if reward something - - start_session(1); - - assert_eq!(Balances::total_balance(&10), init_balance_10); - assert_eq!(Balances::total_balance(&11), init_balance_11); - assert_eq!(Balances::total_balance(&20), init_balance_20); - assert_eq!(Balances::total_balance(&21), init_balance_21); - assert_eq!(Balances::total_balance(&100), init_balance_100); - assert_eq!(Balances::total_balance(&101), init_balance_101); - assert_eq_uvec!(Session::validators(), vec![11, 21]); - assert_eq!(Staking::eras_reward_points(Staking::active_era().unwrap().index), EraRewardPoints { - total: 50*3, - individual: vec![(11, 100), (21, 50)].into_iter().collect(), - }); - let part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let part_for_20 = Perbill::from_rational_approximation::(1000, 1375); - let part_for_100_from_10 = Perbill::from_rational_approximation::(125, 1125); - let part_for_100_from_20 = Perbill::from_rational_approximation::(375, 1375); - - start_session(2); - start_session(3); - - assert_eq!(Staking::active_era().unwrap().index, 1); - mock::make_all_reward_payment_before_migration(0); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * total_payout_0*2/3, 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0*1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * total_payout_0 * 2/3 - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - - assert_eq_uvec!(Session::validators(), vec![11, 21]); - >::reward_by_ids(vec![(11, 1)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_1 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_1 > 10); // Test is meaningful if reward something - - mock::start_era(2); - mock::make_all_reward_payment_before_migration(1); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * (total_payout_0 * 2/3 + total_payout_1), 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0 * 1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * (total_payout_0 * 2/3 + total_payout_1) - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - }); -} - -#[test] -fn migrate_era_should_work() { - // should check that before and after migration: - // * rewards get recorded per session - // * rewards get paid per Era - // * Check that nominators are also rewarded - ExtBuilder::default().nominate(true).build_and_execute(|| { - MigrateEra::put(1); - let init_balance_10 = Balances::total_balance(&10); - let init_balance_11 = Balances::total_balance(&11); - let init_balance_20 = Balances::total_balance(&20); - let init_balance_21 = Balances::total_balance(&21); - let init_balance_100 = Balances::total_balance(&100); - let init_balance_101 = Balances::total_balance(&101); - - // Check state - Payee::::insert(11, RewardDestination::Controller); - Payee::::insert(21, RewardDestination::Controller); - Payee::::insert(101, RewardDestination::Controller); - - >::reward_by_ids(vec![(11, 50)]); - >::reward_by_ids(vec![(11, 50)]); - // This is the second validator of the current elected set. - >::reward_by_ids(vec![(21, 50)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_0 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_0 > 10); // Test is meaningful if reward something - - start_session(1); - - assert_eq!(Balances::total_balance(&10), init_balance_10); - assert_eq!(Balances::total_balance(&11), init_balance_11); - assert_eq!(Balances::total_balance(&20), init_balance_20); - assert_eq!(Balances::total_balance(&21), init_balance_21); - assert_eq!(Balances::total_balance(&100), init_balance_100); - assert_eq!(Balances::total_balance(&101), init_balance_101); - assert_eq_uvec!(Session::validators(), vec![11, 21]); - assert_eq!(Staking::eras_reward_points(Staking::active_era().unwrap().index), EraRewardPoints { - total: 50*3, - individual: vec![(11, 100), (21, 50)].into_iter().collect(), - }); - let part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let part_for_20 = Perbill::from_rational_approximation::(1000, 1375); - let part_for_100_from_10 = Perbill::from_rational_approximation::(125, 1125); - let part_for_100_from_20 = Perbill::from_rational_approximation::(375, 1375); - - start_session(2); - start_session(3); - - assert_eq!(Staking::active_era().unwrap().index, 1); - mock::make_all_reward_payment_before_migration(0); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * total_payout_0*2/3, 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0*1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * total_payout_0 * 2/3 - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - - assert_eq_uvec!(Session::validators(), vec![11, 21]); - >::reward_by_ids(vec![(11, 1)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_1 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_1 > 10); // Test is meaningful if reward something - - mock::start_era(2); - mock::make_all_reward_payment(1); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * (total_payout_0 * 2/3 + total_payout_1), 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0 * 1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * (total_payout_0 * 2/3 + total_payout_1) - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - }); -} - -#[test] -#[should_panic] -fn migrate_era_should_handle_error() { - ExtBuilder::default().nominate(true).build_and_execute(|| { - MigrateEra::put(1); - let init_balance_10 = Balances::total_balance(&10); - let init_balance_11 = Balances::total_balance(&11); - let init_balance_20 = Balances::total_balance(&20); - let init_balance_21 = Balances::total_balance(&21); - let init_balance_100 = Balances::total_balance(&100); - let init_balance_101 = Balances::total_balance(&101); - - // Check state - Payee::::insert(11, RewardDestination::Controller); - Payee::::insert(21, RewardDestination::Controller); - Payee::::insert(101, RewardDestination::Controller); - - >::reward_by_ids(vec![(11, 50)]); - >::reward_by_ids(vec![(11, 50)]); - // This is the second validator of the current elected set. - >::reward_by_ids(vec![(21, 50)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_0 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_0 > 10); // Test is meaningful if reward something - - start_session(1); - - assert_eq!(Balances::total_balance(&10), init_balance_10); - assert_eq!(Balances::total_balance(&11), init_balance_11); - assert_eq!(Balances::total_balance(&20), init_balance_20); - assert_eq!(Balances::total_balance(&21), init_balance_21); - assert_eq!(Balances::total_balance(&100), init_balance_100); - assert_eq!(Balances::total_balance(&101), init_balance_101); - assert_eq_uvec!(Session::validators(), vec![11, 21]); - assert_eq!(Staking::eras_reward_points(Staking::active_era().unwrap().index), EraRewardPoints { - total: 50*3, - individual: vec![(11, 100), (21, 50)].into_iter().collect(), - }); - - start_session(2); - start_session(3); - - assert_eq!(Staking::active_era().unwrap().index, 1); - mock::make_all_reward_payment(0); - }); -} - -#[test] -#[should_panic] -fn migrate_era_should_handle_errors_2() { - // should check that before and after migration: - // * rewards get recorded per session - // * rewards get paid per Era - // * Check that nominators are also rewarded - ExtBuilder::default().nominate(true).build_and_execute(|| { - MigrateEra::put(1); - let init_balance_10 = Balances::total_balance(&10); - let init_balance_11 = Balances::total_balance(&11); - let init_balance_20 = Balances::total_balance(&20); - let init_balance_21 = Balances::total_balance(&21); - let init_balance_100 = Balances::total_balance(&100); - let init_balance_101 = Balances::total_balance(&101); - - // Check state - Payee::::insert(11, RewardDestination::Controller); - Payee::::insert(21, RewardDestination::Controller); - Payee::::insert(101, RewardDestination::Controller); - - >::reward_by_ids(vec![(11, 50)]); - >::reward_by_ids(vec![(11, 50)]); - // This is the second validator of the current elected set. - >::reward_by_ids(vec![(21, 50)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_0 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_0 > 10); // Test is meaningful if reward something - - start_session(1); - - assert_eq!(Balances::total_balance(&10), init_balance_10); - assert_eq!(Balances::total_balance(&11), init_balance_11); - assert_eq!(Balances::total_balance(&20), init_balance_20); - assert_eq!(Balances::total_balance(&21), init_balance_21); - assert_eq!(Balances::total_balance(&100), init_balance_100); - assert_eq!(Balances::total_balance(&101), init_balance_101); - assert_eq_uvec!(Session::validators(), vec![11, 21]); - assert_eq!(Staking::eras_reward_points(Staking::active_era().unwrap().index), EraRewardPoints { - total: 50*3, - individual: vec![(11, 100), (21, 50)].into_iter().collect(), - }); - let part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let part_for_20 = Perbill::from_rational_approximation::(1000, 1375); - let part_for_100_from_10 = Perbill::from_rational_approximation::(125, 1125); - let part_for_100_from_20 = Perbill::from_rational_approximation::(375, 1375); - - start_session(2); - start_session(3); - - assert_eq!(Staking::active_era().unwrap().index, 1); - mock::make_all_reward_payment_before_migration(0); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * total_payout_0*2/3, 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0*1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * total_payout_0 * 2/3 - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - - assert_eq_uvec!(Session::validators(), vec![11, 21]); - >::reward_by_ids(vec![(11, 1)]); - - // Compute total payout now for whole duration as other parameter won't change - let total_payout_1 = current_total_payout_for_duration(3 * 1000); - assert!(total_payout_1 > 10); // Test is meaningful if reward something - - mock::start_era(2); - mock::make_all_reward_payment_before_migration(1); - - assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * (total_payout_0 * 2/3 + total_payout_1), 2); - assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2); - assert_eq_error_rate!(Balances::total_balance(&20), init_balance_20 + part_for_20 * total_payout_0 * 1/3, 2); - assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2); - assert_eq_error_rate!( - Balances::total_balance(&100), - init_balance_100 - + part_for_100_from_10 * (total_payout_0 * 2/3 + total_payout_1) - + part_for_100_from_20 * total_payout_0 * 1/3, - 2 - ); - assert_eq_error_rate!(Balances::total_balance(&101), init_balance_101, 2); - }); -} - #[test] fn offences_weight_calculated_correctly() { ExtBuilder::default().nominate(true).build_and_execute(|| { -- GitLab From 252b146b43e3877aefae6afd5c9a9e6093c5d7a9 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Fri, 5 Jun 2020 17:33:13 +0200 Subject: [PATCH 112/280] Rename all the election operations (#6245) * Rename and move sp-phragmen * More renames for equalise * Update main module doc * Fix line width * Line width --- .maintain/rename-crates-for-2.0.sh | 2 +- Cargo.lock | 54 +++---- Cargo.toml | 6 +- bin/node/runtime/src/lib.rs | 4 +- docs/CODEOWNERS | 2 +- frame/elections-phragmen/Cargo.toml | 6 +- frame/elections-phragmen/src/lib.rs | 18 +-- frame/staking/Cargo.toml | 4 +- frame/staking/fuzzer/Cargo.lock | 10 +- frame/staking/fuzzer/Cargo.toml | 2 +- frame/staking/src/benchmarking.rs | 2 +- frame/staking/src/lib.rs | 146 +++++++++--------- frame/staking/src/mock.rs | 26 ++-- frame/staking/src/offchain_election.rs | 38 ++--- frame/staking/src/testing_utils.rs | 10 +- frame/staking/src/tests.rs | 43 +----- primitives/arithmetic/src/rational128.rs | 2 +- .../{phragmen => npos-elections}/Cargo.toml | 8 +- .../benches/phragmen.rs | 24 ++- .../compact/Cargo.toml | 4 +- .../compact/src/assignment.rs | 8 +- .../compact/src/lib.rs | 12 +- .../compact/src/staked.rs | 4 +- .../fuzzer/.gitignore | 0 .../fuzzer/Cargo.lock | 10 +- .../fuzzer/Cargo.toml | 10 +- .../fuzzer/src/balance_solution.rs} | 25 +-- .../fuzzer/src/common.rs | 0 .../fuzzer/src/reduce.rs | 2 +- .../src/helpers.rs | 2 +- .../{phragmen => npos-elections}/src/lib.rs | 65 ++++---- .../{phragmen => npos-elections}/src/mock.rs | 6 +- .../{phragmen => npos-elections}/src/node.rs | 0 .../src/reduce.rs | 0 .../{phragmen => npos-elections}/src/tests.rs | 39 ++--- 35 files changed, 284 insertions(+), 310 deletions(-) rename primitives/{phragmen => npos-elections}/Cargo.toml (81%) rename primitives/{phragmen => npos-elections}/benches/phragmen.rs (92%) rename primitives/{phragmen => npos-elections}/compact/Cargo.toml (85%) rename primitives/{phragmen => npos-elections}/compact/src/assignment.rs (97%) rename primitives/{phragmen => npos-elections}/compact/src/lib.rs (95%) rename primitives/{phragmen => npos-elections}/compact/src/staked.rs (97%) rename primitives/{phragmen => npos-elections}/fuzzer/.gitignore (100%) rename primitives/{phragmen => npos-elections}/fuzzer/Cargo.lock (99%) rename primitives/{phragmen => npos-elections}/fuzzer/Cargo.toml (74%) rename primitives/{phragmen/fuzzer/src/equalize.rs => npos-elections/fuzzer/src/balance_solution.rs} (87%) rename primitives/{phragmen => npos-elections}/fuzzer/src/common.rs (100%) rename primitives/{phragmen => npos-elections}/fuzzer/src/reduce.rs (98%) rename primitives/{phragmen => npos-elections}/src/helpers.rs (98%) rename primitives/{phragmen => npos-elections}/src/lib.rs (92%) rename primitives/{phragmen => npos-elections}/src/mock.rs (98%) rename primitives/{phragmen => npos-elections}/src/node.rs (100%) rename primitives/{phragmen => npos-elections}/src/reduce.rs (100%) rename primitives/{phragmen => npos-elections}/src/tests.rs (95%) diff --git a/.maintain/rename-crates-for-2.0.sh b/.maintain/rename-crates-for-2.0.sh index 5d873d26cd..01d5594484 100755 --- a/.maintain/rename-crates-for-2.0.sh +++ b/.maintain/rename-crates-for-2.0.sh @@ -64,7 +64,7 @@ TO_RENAME=( "substrate-keyring sp-keyring" "substrate-offchain-primitives sp-offchain" "substrate-panic-handler sp-panic-handler" - "substrate-phragmen sp-phragmen" + "substrate-phragmen sp-npos-elections" "substrate-rpc-primitives sp-rpc" "substrate-runtime-interface sp-runtime-interface" "substrate-runtime-interface-proc-macro sp-runtime-interface-proc-macro" diff --git a/Cargo.lock b/Cargo.lock index 2e7fbb14cf..0ad5033f13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4044,7 +4044,7 @@ dependencies = [ "serde", "sp-core", "sp-io", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-std", "substrate-test-utils", @@ -4435,7 +4435,7 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-io", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-staking", "sp-std", @@ -4460,7 +4460,7 @@ dependencies = [ "parity-scale-codec", "sp-core", "sp-io", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-std", ] @@ -7474,40 +7474,22 @@ dependencies = [ ] [[package]] -name = "sp-offchain" -version = "2.0.0-rc2" -dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "sp-panic-handler" -version = "2.0.0-rc2" -dependencies = [ - "backtrace", - "log", -] - -[[package]] -name = "sp-phragmen" +name = "sp-npos-elections" version = "2.0.0-rc2" dependencies = [ "parity-scale-codec", "rand 0.7.3", "serde", "sp-arithmetic", - "sp-phragmen", - "sp-phragmen-compact", + "sp-npos-elections", + "sp-npos-elections-compact", "sp-runtime", "sp-std", "substrate-test-utils", ] [[package]] -name = "sp-phragmen-compact" +name = "sp-npos-elections-compact" version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", @@ -7517,16 +7499,34 @@ dependencies = [ ] [[package]] -name = "sp-phragmen-fuzzer" +name = "sp-npos-elections-fuzzer" version = "2.0.0-alpha.5" dependencies = [ "honggfuzz", "rand 0.7.3", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-std", ] +[[package]] +name = "sp-offchain" +version = "2.0.0-rc2" +dependencies = [ + "sp-api", + "sp-core", + "sp-runtime", + "sp-state-machine", +] + +[[package]] +name = "sp-panic-handler" +version = "2.0.0-rc2" +dependencies = [ + "backtrace", + "log", +] + [[package]] name = "sp-rpc" version = "2.0.0-rc2" diff --git a/Cargo.toml b/Cargo.toml index d367302f79..650124877c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -137,9 +137,9 @@ members = [ "primitives/keyring", "primitives/offchain", "primitives/panic-handler", - "primitives/phragmen", - "primitives/phragmen/fuzzer", - "primitives/phragmen/compact", + "primitives/npos-elections", + "primitives/npos-elections/fuzzer", + "primitives/npos-elections/compact", "primitives/rpc", "primitives/runtime-interface", "primitives/runtime-interface/proc-macro", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 7a036ddf5f..148b4199d1 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -470,7 +470,7 @@ parameter_types! { pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect"; } -// Make sure that there are no more than `MAX_MEMBERS` members elected via phragmen. +// Make sure that there are no more than `MAX_MEMBERS` members elected via elections-phragmen. const_assert!(DesiredMembers::get() <= pallet_collective::MAX_MEMBERS); impl pallet_elections_phragmen::Trait for Runtime { @@ -580,7 +580,7 @@ impl pallet_sudo::Trait for Runtime { parameter_types! { pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); - /// We prioritize im-online heartbeats over phragmen solution submission. + /// We prioritize im-online heartbeats over election solution submission. pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; } diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS index 7559a9ee2b..2e1557b4ea 100644 --- a/docs/CODEOWNERS +++ b/docs/CODEOWNERS @@ -67,7 +67,7 @@ /frame/staking/ @kianenigma /frame/elections/ @kianenigma /frame/elections-phragmen/ @kianenigma -/primitives/phragmen/ @kianenigma +/primitives/npos-elections/ @kianenigma # Fixed point arithmetic /primitives/sp-arithmetic/ @kianenigma diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index bea1e0dfc4..81833abf85 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" -description = "FRAME election pallet for PHRAGMEN" +description = "FRAME pallet based on seq-Phragmén election method." [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/phragmen" } +sp-npos-elections = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/npos-elections" } frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } @@ -35,7 +35,7 @@ std = [ "codec/std", "frame-support/std", "sp-runtime/std", - "sp-phragmen/std", + "sp-npos-elections/std", "frame-system/std", "sp-std/std", ] diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 5d7d2bf503..c155c08caf 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Phragmen Election Module. +//! # Phragmén Election Module. //! //! An election module based on sequential phragmen. //! @@ -100,7 +100,7 @@ use frame_support::{ ContainsLengthBound, } }; -use sp_phragmen::{build_support_map, ExtendedBalance, VoteWeight, PhragmenResult}; +use sp_npos_elections::{build_support_map, ExtendedBalance, VoteWeight, ElectionResult}; use frame_system::{self as system, ensure_signed, ensure_root}; mod benchmarking; @@ -245,7 +245,6 @@ decl_storage! { } decl_error! { - /// Error for the elections-phragmen module. pub enum Error for Module { /// Cannot vote when no candidates or members exist. UnableToVote, @@ -610,7 +609,7 @@ decl_module! { /// the outgoing member is slashed. /// /// If a runner-up is available, then the best runner-up will be removed and replaces the - /// outgoing member. Otherwise, a new phragmen round is started. + /// outgoing member. Otherwise, a new phragmen election is started. /// /// Note that this does not affect the designated block number of the next election. /// @@ -840,13 +839,10 @@ impl Module { /// Run the phragmen election with all required side processes and state updates. /// - /// Calls the appropriate `ChangeMembers` function variant internally. + /// Calls the appropriate [`ChangeMembers`] function variant internally. /// - /// # - /// #### State /// Reads: O(C + V*E) where C = candidates, V voters and E votes per voter exits. /// Writes: O(M + R) with M desired members and R runners_up. - /// # fn do_phragmen() { let desired_seats = Self::desired_members() as usize; let desired_runners_up = Self::desired_runners_up() as usize; @@ -876,14 +872,14 @@ impl Module { let voters_and_votes = Voting::::iter() .map(|(voter, (stake, targets))| { (voter, to_votes(stake), targets) }) .collect::>(); - let maybe_phragmen_result = sp_phragmen::elect::( + let maybe_phragmen_result = sp_npos_elections::seq_phragmen::( num_to_elect, 0, candidates, voters_and_votes.clone(), ); - if let Some(PhragmenResult { winners, assignments }) = maybe_phragmen_result { + if let Some(ElectionResult { winners, assignments }) = maybe_phragmen_result { let old_members_ids = >::take().into_iter() .map(|(m, _)| m) .collect::>(); @@ -907,7 +903,7 @@ impl Module { // exposed candidates, cleaning any previous members, and so on. For now, in favour of // readability and veracity, we keep it simple. - let staked_assignments = sp_phragmen::assignment_ratio_to_staked( + let staked_assignments = sp_npos_elections::assignment_ratio_to_staked( assignments, stake_of, ); diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 916e5676da..70d3e04610 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -16,7 +16,7 @@ static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/phragmen" } +sp-npos-elections = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/npos-elections" } sp-io ={ version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } @@ -49,7 +49,7 @@ std = [ "serde", "codec/std", "sp-std/std", - "sp-phragmen/std", + "sp-npos-elections/std", "sp-io/std", "frame-support/std", "sp-runtime/std", diff --git a/frame/staking/fuzzer/Cargo.lock b/frame/staking/fuzzer/Cargo.lock index f6cb65aa5c..55f76eb6b3 100644 --- a/frame/staking/fuzzer/Cargo.lock +++ b/frame/staking/fuzzer/Cargo.lock @@ -1003,7 +1003,7 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-io", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-staking", "sp-std", @@ -1027,7 +1027,7 @@ dependencies = [ "rand 0.7.3", "sp-core", "sp-io", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-std", ] @@ -1751,18 +1751,18 @@ dependencies = [ ] [[package]] -name = "sp-phragmen" +name = "sp-npos-elections" version = "2.0.0-alpha.5" dependencies = [ "parity-scale-codec", "serde", - "sp-phragmen-compact", + "sp-npos-elections-compact", "sp-runtime", "sp-std", ] [[package]] -name = "sp-phragmen-compact" +name = "sp-npos-elections-compact" version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index f4a31ff11a..e9cb09ade3 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -26,7 +26,7 @@ frame-support = { version = "2.0.0-rc2", path = "../../support" } sp-std = { version = "2.0.0-rc2", path = "../../../primitives/std" } sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-phragmen = { version = "2.0.0-rc2", path = "../../../primitives/phragmen" } +sp-npos-elections = { version = "2.0.0-rc2", path = "../../../primitives/npos-elections" } sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } [[bin]] diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index d3723dce1c..44fc902403 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -565,7 +565,7 @@ benchmarks! { let caller: T::AccountId = account("caller", n, SEED); let era = >::current_era().unwrap_or(0); - // submit a seq-phragmen with all the good stuff on chain + // submit a seq-phragmen with all the good stuff on chain. { let (winners, compact, score, size) = get_seq_phragmen_solution::(true); assert!( diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 8eb734d8c8..2a791bfa7e 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -25,25 +25,25 @@ //! //! ## Overview //! -//! The Staking module is the means by which a set of network maintainers (known as _authorities_ -//! in some contexts and _validators_ in others) are chosen based upon those who voluntarily place -//! funds under deposit. Under deposit, those funds are rewarded under normal operation but are -//! held at pain of _slash_ (expropriation) should the staked maintainer be found not to be -//! discharging its duties properly. +//! The Staking module is the means by which a set of network maintainers (known as _authorities_ in +//! some contexts and _validators_ in others) are chosen based upon those who voluntarily place +//! funds under deposit. Under deposit, those funds are rewarded under normal operation but are held +//! at pain of _slash_ (expropriation) should the staked maintainer be found not to be discharging +//! its duties properly. //! //! ### Terminology //! //! //! - Staking: The process of locking up funds for some time, placing them at risk of slashing -//! (loss) in order to become a rewarded maintainer of the network. +//! (loss) in order to become a rewarded maintainer of the network. //! - Validating: The process of running a node to actively maintain the network, either by -//! producing blocks or guaranteeing finality of the chain. +//! producing blocks or guaranteeing finality of the chain. //! - Nominating: The process of placing staked funds behind one or more validators in order to -//! share in any reward, and punishment, they take. +//! share in any reward, and punishment, they take. //! - Stash account: The account holding an owner's funds used for staking. //! - Controller account: The account that controls an owner's funds for staking. //! - Era: A (whole) number of sessions, which is the period that the validator set (and each -//! validator's active nominator set) is recalculated and where rewards are paid out. +//! validator's active nominator set) is recalculated and where rewards are paid out. //! - Slash: The punishment of a staker by reducing its funds. //! //! ### Goals @@ -106,10 +106,10 @@ //! valid behavior_ while _punishing any misbehavior or lack of availability_. //! //! Rewards must be claimed for each era before it gets too old by `$HISTORY_DEPTH` using the -//! `payout_stakers` call. Any account can call `payout_stakers`, which pays the reward to -//! the validator as well as its nominators. -//! Only the [`Trait::MaxNominatorRewardedPerValidator`] biggest stakers can claim their reward. This -//! is to limit the i/o cost to mutate storage for each nominator's account. +//! `payout_stakers` call. Any account can call `payout_stakers`, which pays the reward to the +//! validator as well as its nominators. Only the [`Trait::MaxNominatorRewardedPerValidator`] +//! biggest stakers can claim their reward. This is to limit the i/o cost to mutate storage for each +//! nominator's account. //! //! Slashing can occur at any point in time, once misbehavior is reported. Once slashing is //! determined, a value is deducted from the balance of the validator and all the nominators who @@ -118,8 +118,8 @@ //! Slashing logic is further described in the documentation of the `slashing` module. //! //! Similar to slashing, rewards are also shared among a validator and its associated nominators. -//! Yet, the reward funds are not always transferred to the stash account and can be configured. -//! See [Reward Calculation](#reward-calculation) for more details. +//! Yet, the reward funds are not always transferred to the stash account and can be configured. See +//! [Reward Calculation](#reward-calculation) for more details. //! //! #### Chilling //! @@ -157,15 +157,15 @@ //! pub trait Trait: staking::Trait {} //! //! decl_module! { -//! pub struct Module for enum Call where origin: T::Origin { -//! /// Reward a validator. -//! #[weight = 0] -//! pub fn reward_myself(origin) -> dispatch::DispatchResult { -//! let reported = ensure_signed(origin)?; -//! >::reward_by_ids(vec![(reported, 10)]); -//! Ok(()) -//! } -//! } +//! pub struct Module for enum Call where origin: T::Origin { +//! /// Reward a validator. +//! #[weight = 0] +//! pub fn reward_myself(origin) -> dispatch::DispatchResult { +//! let reported = ensure_signed(origin)?; +//! >::reward_by_ids(vec![(reported, 10)]); +//! Ok(()) +//! } +//! } //! } //! # fn main() { } //! ``` @@ -208,8 +208,8 @@ //! The validator and its nominator split their reward as following: //! //! The validator can declare an amount, named -//! [`commission`](./struct.ValidatorPrefs.html#structfield.commission), that does not -//! get shared with the nominators at each reward payout through its +//! [`commission`](./struct.ValidatorPrefs.html#structfield.commission), that does not get shared +//! with the nominators at each reward payout through its //! [`ValidatorPrefs`](./struct.ValidatorPrefs.html). This value gets deducted from the total reward //! that is paid to the validator and its nominators. The remaining portion is split among the //! validator and all of the nominators that nominated the validator, proportional to the value @@ -218,8 +218,8 @@ //! [`others`](./struct.Exposure.html#structfield.others) by //! [`total`](./struct.Exposure.html#structfield.total) in [`Exposure`](./struct.Exposure.html)). //! -//! All entities who receive a reward have the option to choose their reward destination -//! through the [`Payee`](./struct.Payee.html) storage item (see +//! All entities who receive a reward have the option to choose their reward destination through the +//! [`Payee`](./struct.Payee.html) storage item (see //! [`set_payee`](enum.Call.html#variant.set_payee)), to be one of the following: //! //! - Controller account, (obviously) not increasing the staked value. @@ -244,9 +244,8 @@ //! //! ### Election Algorithm //! -//! The current election algorithm is implemented based on Phragmén. -//! The reference implementation can be found -//! [here](https://github.com/w3f/consensus/tree/master/NPoS). +//! The current election algorithm is implemented based on Phragmén. The reference implementation +//! can be found [here](https://github.com/w3f/consensus/tree/master/NPoS). //! //! The election algorithm, aside from electing the validators with the most stake value and votes, //! tries to divide the nominator votes among candidates in an equal manner. To further assure this, @@ -256,8 +255,8 @@ //! //! ## GenesisConfig //! -//! The Staking module depends on the [`GenesisConfig`](./struct.GenesisConfig.html). -//! The `GenesisConfig` is optional and allow to set some initial stakers. +//! The Staking module depends on the [`GenesisConfig`](./struct.GenesisConfig.html). The +//! `GenesisConfig` is optional and allow to set some initial stakers. //! //! ## Related Modules //! @@ -325,9 +324,10 @@ use frame_system::{ self as system, ensure_signed, ensure_root, ensure_none, offchain::SendTransactionTypes, }; -use sp_phragmen::{ - ExtendedBalance, Assignment, PhragmenScore, PhragmenResult, build_support_map, evaluate_support, - elect, generate_compact_solution_type, is_score_better, VotingLimit, SupportMap, VoteWeight, +use sp_npos_elections::{ + ExtendedBalance, Assignment, ElectionScore, ElectionResult as PrimitiveElectionResult, + build_support_map, evaluate_support, seq_phragmen, generate_compact_solution_type, + is_score_better, VotingLimit, SupportMap, VoteWeight, }; const DEFAULT_MINIMUM_VALIDATOR_COUNT: u32 = 4; @@ -383,10 +383,10 @@ pub struct ActiveEraInfo { start: Option, } -/// Accuracy used for on-chain phragmen. +/// Accuracy used for on-chain election. pub type ChainAccuracy = Perbill; -/// Accuracy used for off-chain phragmen. This better be small. +/// Accuracy used for off-chain election. This better be small. pub type OffchainAccuracy = PerU16; /// The balance type of this module. @@ -841,8 +841,9 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// Convert a balance into a number used for election calculation. This must fit into a `u64` /// but is allowed to be sensibly lossy. The `u64` is used to communicate with the - /// [`sp_phragmen`] crate which accepts u64 numbers and does operations in 128. Consequently, - /// the backward convert is used convert the u128s from phragmen back to a [`BalanceOf`]. + /// [`sp_npos_elections`] crate which accepts u64 numbers and does operations in 128. + /// Consequently, the backward convert is used convert the u128s from sp-elections back to a + /// [`BalanceOf`]. type CurrencyToVote: Convert, VoteWeight> + Convert>; /// Tokens have been minted and are unused for validator-reward. @@ -864,9 +865,9 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// Number of eras that staked funds must remain bonded for. type BondingDuration: Get; - /// Number of eras that slashes are deferred by, after computation. This - /// should be less than the bonding duration. Set to 0 if slashes should be - /// applied immediately, without opportunity for intervention. + /// Number of eras that slashes are deferred by, after computation. This should be less than the + /// bonding duration. Set to 0 if slashes should be applied immediately, without opportunity for + /// intervention. type SlashDeferDuration: Get; /// The origin which can cancel a deferred slash. Root can always do this. @@ -882,16 +883,19 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// Something that can estimate the next session change, accurately or as a best effort guess. type NextNewSession: EstimateNextNewSession; - /// How many blocks ahead of the era, within the last do we try to run the phragmen offchain? + /// The number of blocks before the end of the era from which election submissions are allowed. /// Setting this to zero will disable the offchain compute and only on-chain seq-phragmen will /// be used. + /// + /// This is bounded by being within the last session. Hence, setting it to a value more than the + /// length of a session will be pointless. type ElectionLookahead: Get; /// The overarching call type. type Call: Dispatchable + From> + IsSubType, Self> + Clone; - /// Maximum number of equalise iterations to run in the offchain submission. If set to 0, - /// equalize will not be executed at all. + /// Maximum number of balancing iterations to run in the offchain submission. If set to 0, + /// balance_solution will not be executed at all. type MaxIterations: Get; /// The threshold of improvement that should be provided for a new solution to be accepted. @@ -951,9 +955,9 @@ decl_storage! { /// /// Information is kept for eras in `[current_era - history_depth; current_era]`. /// - /// Must be more than the number of eras delayed by session otherwise. - /// I.e. active era must always be in history. - /// I.e. `active_era > current_era - history_depth` must be guaranteed. + /// Must be more than the number of eras delayed by session otherwise. I.e. active era must + /// always be in history. I.e. `active_era > current_era - history_depth` must be + /// guaranteed. HistoryDepth get(fn history_depth) config(): u32 = 84; /// The ideal number of staking participants. @@ -1113,7 +1117,7 @@ decl_storage! { pub QueuedElected get(fn queued_elected): Option>>; /// The score of the current [`QueuedElected`]. - pub QueuedScore get(fn queued_score): Option; + pub QueuedScore get(fn queued_score): Option; /// Flag to control the execution of the offchain election. When `Open(_)`, we accept /// solutions to be submitted. @@ -1356,7 +1360,7 @@ decl_module! { log!(debug, "skipping offchain worker in open election window due to [{}]", why); } else { if let Err(e) = compute_offchain_election::() { - log!(error, "💸 Error in phragmen offchain worker: {:?}", e); + log!(error, "💸 Error in election offchain worker: {:?}", e); } else { log!(debug, "Executed offchain worker thread without errors."); } @@ -2067,7 +2071,7 @@ decl_module! { T::Currency::remove_lock(STAKING_ID, &stash); } - /// Submit a phragmen result to the chain. If the solution: + /// Submit an election result to the chain. If the solution: /// /// 1. is valid. /// 2. has a better score than a potentially existing solution on chain. @@ -2080,7 +2084,7 @@ decl_module! { /// 2. `assignments`: the compact version of an assignment vector that encodes the edge /// weights. /// - /// Both of which may be computed using [`phragmen`], or any other algorithm. + /// Both of which may be computed using _phragmen_, or any other algorithm. /// /// Additionally, the submitter must provide: /// @@ -2119,7 +2123,7 @@ decl_module! { origin, winners: Vec, compact: CompactAssignments, - score: PhragmenScore, + score: ElectionScore, era: EraIndex, size: ElectionSize, ) -> DispatchResultWithPostInfo { @@ -2148,7 +2152,7 @@ decl_module! { origin, winners: Vec, compact: CompactAssignments, - score: PhragmenScore, + score: ElectionScore, era: EraIndex, size: ElectionSize, ) -> DispatchResultWithPostInfo { @@ -2413,7 +2417,7 @@ impl Module { /// /// This function does weight refund in case of errors, which is based upon the fact that it is /// called at the very beginning of the call site's function. - pub fn pre_dispatch_checks(score: PhragmenScore, era: EraIndex) -> DispatchResultWithPostInfo { + pub fn pre_dispatch_checks(score: ElectionScore, era: EraIndex) -> DispatchResultWithPostInfo { // discard solutions that are not in-time // check window open ensure!( @@ -2446,7 +2450,7 @@ impl Module { winners: Vec, compact_assignments: CompactAssignments, compute: ElectionCompute, - claimed_score: PhragmenScore, + claimed_score: ElectionScore, era: EraIndex, election_size: ElectionSize, ) -> DispatchResultWithPostInfo { @@ -2576,7 +2580,7 @@ impl Module { } // convert into staked assignments. - let staked_assignments = sp_phragmen::assignment_ratio_to_staked( + let staked_assignments = sp_npos_elections::assignment_ratio_to_staked( assignments, Self::slashable_balance_of_vote_weight, ); @@ -2764,7 +2768,7 @@ impl Module { elected_stashes, exposures, compute, - }) = Self::try_do_phragmen() { + }) = Self::try_do_election() { // Totally close the election round and data. Self::close_election_window(); @@ -2810,12 +2814,12 @@ impl Module { } /// Select a new validator set from the assembled stakers and their role preferences. It tries - /// first to peek into [`QueuedElected`]. Otherwise, it runs a new phragmen. + /// first to peek into [`QueuedElected`]. Otherwise, it runs a new on-chain phragmen election. /// /// If [`QueuedElected`] and [`QueuedScore`] exists, they are both removed. No further storage /// is updated. - fn try_do_phragmen() -> Option>> { - // a phragmen result from either a stored submission or locally executed one. + fn try_do_election() -> Option>> { + // an election result from either a stored submission or locally executed one. let next_result = >::take().or_else(|| Self::do_phragmen_with_post_processing::(ElectionCompute::OnChain) ); @@ -2827,11 +2831,11 @@ impl Module { next_result } - /// Execute phragmen and return the new results. The edge weights are processed into support + /// Execute election and return the new results. The edge weights are processed into support /// values. /// - /// This is basically a wrapper around [`do_phragmen`] which translates `PhragmenResult` into - /// `ElectionResult`. + /// This is basically a wrapper around [`do_phragmen`] which translates + /// `PrimitiveElectionResult` into `ElectionResult`. /// /// No storage item is updated. fn do_phragmen_with_post_processing(compute: ElectionCompute) @@ -2846,7 +2850,7 @@ impl Module { .collect::>(); let assignments = phragmen_result.assignments; - let staked_assignments = sp_phragmen::assignment_ratio_to_staked( + let staked_assignments = sp_npos_elections::assignment_ratio_to_staked( assignments, Self::slashable_balance_of_vote_weight, ); @@ -2877,13 +2881,13 @@ impl Module { } } - /// Execute phragmen and return the new results. No post-processing is applied and the raw edge - /// weights are returned. + /// Execute phragmen election and return the new results. No post-processing is applied and the + /// raw edge weights are returned. /// /// Self votes are added and nominations before the most recent slashing span are reaped. /// /// No storage item is updated. - fn do_phragmen() -> Option> { + fn do_phragmen() -> Option> { let mut all_nominators: Vec<(T::AccountId, VoteWeight, Vec)> = Vec::new(); let mut all_validators = Vec::new(); for (validator, _) in >::iter() { @@ -2912,7 +2916,7 @@ impl Module { (n, s, ns) })); - elect::<_, Accuracy>( + seq_phragmen::<_, Accuracy>( Self::validator_count() as usize, Self::minimum_validator_count().max(1) as usize, all_validators, @@ -2920,7 +2924,7 @@ impl Module { ) } - /// Consume a set of [`Supports`] from [`sp_phragmen`] and collect them into a [`Exposure`] + /// Consume a set of [`Supports`] from [`sp_npos_elections`] and collect them into a [`Exposure`] fn collect_exposure(supports: SupportMap) -> Vec<(T::AccountId, Exposure>)> { let to_balance = |e: ExtendedBalance| >>::convert(e); diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 6c52ccd662..ef3d2c43bc 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -31,8 +31,8 @@ use frame_support::{ weights::{Weight, constants::RocksDbWeight}, }; use sp_io; -use sp_phragmen::{ - build_support_map, evaluate_support, reduce, ExtendedBalance, StakedAssignment, PhragmenScore, +use sp_npos_elections::{ + build_support_map, evaluate_support, reduce, ExtendedBalance, StakedAssignment, ElectionScore, VoteWeight, }; use crate::*; @@ -783,7 +783,7 @@ pub(crate) fn add_slash(who: &AccountId) { // distributed evenly. pub(crate) fn horrible_phragmen_with_post_processing( do_reduce: bool, -) -> (CompactAssignments, Vec, PhragmenScore) { +) -> (CompactAssignments, Vec, ElectionScore) { let mut backing_stake_of: BTreeMap = BTreeMap::new(); // self stake @@ -855,7 +855,7 @@ pub(crate) fn horrible_phragmen_with_post_processing( let support = build_support_map::(&winners, &staked_assignment).0; let score = evaluate_support(&support); - assert!(sp_phragmen::is_score_better::( + assert!(sp_npos_elections::is_score_better::( better_score, score, MinSolutionScoreBump::get(), @@ -879,7 +879,7 @@ pub(crate) fn horrible_phragmen_with_post_processing( // convert back to ratio assignment. This takes less space. let assignments_reduced = - sp_phragmen::assignment_staked_to_ratio::(staked_assignment); + sp_npos_elections::assignment_staked_to_ratio::(staked_assignment); let compact = CompactAssignments::from_assignment(assignments_reduced, nominator_index, validator_index) @@ -897,13 +897,13 @@ pub(crate) fn prepare_submission_with( do_reduce: bool, iterations: usize, tweak: impl FnOnce(&mut Vec>), -) -> (CompactAssignments, Vec, PhragmenScore) { - // run phragmen on the default stuff. - let sp_phragmen::PhragmenResult { +) -> (CompactAssignments, Vec, ElectionScore) { + // run election on the default stuff. + let sp_npos_elections::ElectionResult { winners, assignments, } = Staking::do_phragmen::().unwrap(); - let winners = sp_phragmen::to_without_backing(winners); + let winners = sp_npos_elections::to_without_backing(winners); let stake_of = |who: &AccountId| -> VoteWeight { >::convert( @@ -911,11 +911,11 @@ pub(crate) fn prepare_submission_with( ) }; - let mut staked = sp_phragmen::assignment_ratio_to_staked(assignments, stake_of); + let mut staked = sp_npos_elections::assignment_ratio_to_staked(assignments, stake_of); let (mut support_map, _) = build_support_map::(&winners, &staked); if iterations > 0 { - sp_phragmen::equalize( + sp_npos_elections::balance_solution( &mut staked, &mut support_map, Zero::zero(), @@ -952,11 +952,11 @@ pub(crate) fn prepare_submission_with( ) }; - let assignments_reduced = sp_phragmen::assignment_staked_to_ratio(staked); + let assignments_reduced = sp_npos_elections::assignment_staked_to_ratio(staked); // re-compute score by converting, yet again, into staked type let score = { - let staked = sp_phragmen::assignment_ratio_to_staked( + let staked = sp_npos_elections::assignment_ratio_to_staked( assignments_reduced.clone(), Staking::slashable_balance_of_vote_weight, ); diff --git a/frame/staking/src/offchain_election.rs b/frame/staking/src/offchain_election.rs index ce9b77aef7..23453e0524 100644 --- a/frame/staking/src/offchain_election.rs +++ b/frame/staking/src/offchain_election.rs @@ -23,9 +23,9 @@ use crate::{ ElectionSize, }; use frame_system::offchain::SubmitTransaction; -use sp_phragmen::{ - build_support_map, evaluate_support, reduce, Assignment, ExtendedBalance, PhragmenResult, - PhragmenScore, equalize, +use sp_npos_elections::{ + build_support_map, evaluate_support, reduce, Assignment, ExtendedBalance, ElectionResult, + ElectionScore, balance_solution, }; use sp_runtime::offchain::storage::StorageValueRef; use sp_runtime::{PerThing, RuntimeDebug, traits::{TrailingZeroInput, Zero}}; @@ -35,22 +35,22 @@ use sp_std::{convert::TryInto, prelude::*}; /// Error types related to the offchain election machinery. #[derive(RuntimeDebug)] pub enum OffchainElectionError { - /// Phragmen election returned None. This means less candidate that minimum number of needed + /// election returned None. This means less candidate that minimum number of needed /// validators were present. The chain is in trouble and not much that we can do about it. ElectionFailed, /// Submission to the transaction pool failed. PoolSubmissionFailed, /// The snapshot data is not available. SnapshotUnavailable, - /// Error from phragmen crate. This usually relates to compact operation. - PhragmenError(sp_phragmen::Error), + /// Error from npos-election crate. This usually relates to compact operation. + InternalElectionError(sp_npos_elections::Error), /// One of the computed winners is invalid. InvalidWinner, } -impl From for OffchainElectionError { - fn from(e: sp_phragmen::Error) -> Self { - Self::PhragmenError(e) +impl From for OffchainElectionError { + fn from(e: sp_npos_elections::Error) -> Self { + Self::InternalElectionError(e) } } @@ -107,7 +107,7 @@ pub(crate) fn set_check_offchain_execution_status( /// unsigned transaction, without any signature. pub(crate) fn compute_offchain_election() -> Result<(), OffchainElectionError> { // compute raw solution. Note that we use `OffchainAccuracy`. - let PhragmenResult { + let ElectionResult { winners, assignments, } = >::do_phragmen::() @@ -133,7 +133,7 @@ pub(crate) fn compute_offchain_election() -> Result<(), OffchainElecti } -/// Takes a phragmen result and spits out some data that can be submitted to the chain. +/// Takes an election result and spits out some data that can be submitted to the chain. /// /// This does a lot of stuff; read the inline comments. pub fn prepare_submission( @@ -143,7 +143,7 @@ pub fn prepare_submission( ) -> Result<( Vec, CompactAssignments, - PhragmenScore, + ElectionScore, ElectionSize, ), OffchainElectionError> where ExtendedBalance: From<::Inner>, @@ -169,26 +169,26 @@ pub fn prepare_submission( }; // Clean winners. - let winners = sp_phragmen::to_without_backing(winners); + let winners = sp_npos_elections::to_without_backing(winners); // convert into absolute value and to obtain the reduced version. - let mut staked = sp_phragmen::assignment_ratio_to_staked( + let mut staked = sp_npos_elections::assignment_ratio_to_staked( assignments, >::slashable_balance_of_vote_weight, ); let (mut support_map, _) = build_support_map::(&winners, &staked); - // equalize a random number of times. + // balance a random number of times. let iterations_executed = match T::MaxIterations::get() { 0 => { - // Don't run equalize at all + // Don't run balance_solution at all 0 } iterations @ _ => { let seed = sp_io::offchain::random_seed(); let iterations = ::decode(&mut TrailingZeroInput::new(seed.as_ref())) .expect("input is padded with zeroes; qed") % iterations.saturating_add(1); - equalize( + balance_solution( &mut staked, &mut support_map, Zero::zero(), @@ -203,7 +203,7 @@ pub fn prepare_submission( } // Convert back to ratio assignment. This takes less space. - let low_accuracy_assignment = sp_phragmen::assignment_staked_to_ratio(staked); + let low_accuracy_assignment = sp_npos_elections::assignment_staked_to_ratio(staked); // convert back to staked to compute the score in the receiver's accuracy. This can be done // nicer, for now we do it as such since this code is not time-critical. This ensure that the @@ -214,7 +214,7 @@ pub fn prepare_submission( // assignment set is also all multiples of this value. After reduce, this no longer holds. Hence // converting to ratio thereafter is not trivially reversible. let score = { - let staked = sp_phragmen::assignment_ratio_to_staked( + let staked = sp_npos_elections::assignment_ratio_to_staked( low_accuracy_assignment.clone(), >::slashable_balance_of_vote_weight, ); diff --git a/frame/staking/src/testing_utils.rs b/frame/staking/src/testing_utils.rs index 2a38f47f4e..86d137ac30 100644 --- a/frame/staking/src/testing_utils.rs +++ b/frame/staking/src/testing_utils.rs @@ -24,7 +24,7 @@ use frame_benchmarking::{account}; use frame_system::RawOrigin; use sp_io::hashing::blake2_256; use rand_chacha::{rand_core::{RngCore, SeedableRng}, ChaChaRng}; -use sp_phragmen::*; +use sp_npos_elections::*; const SEED: u32 = 0; @@ -138,7 +138,7 @@ pub fn create_validators_with_nominators_for_era( /// which has a less score than the seq-phragmen. pub fn get_weak_solution( do_reduce: bool, -) -> (Vec, CompactAssignments, PhragmenScore, ElectionSize) { +) -> (Vec, CompactAssignments, ElectionScore, ElectionSize) { let mut backing_stake_of: BTreeMap> = BTreeMap::new(); // self stake @@ -252,8 +252,8 @@ pub fn get_weak_solution( /// worker code. pub fn get_seq_phragmen_solution( do_reduce: bool, -) -> (Vec, CompactAssignments, PhragmenScore, ElectionSize) { - let sp_phragmen::PhragmenResult { +) -> (Vec, CompactAssignments, ElectionScore, ElectionSize) { + let sp_npos_elections::ElectionResult { winners, assignments, } = >::do_phragmen::().unwrap(); @@ -264,7 +264,7 @@ pub fn get_seq_phragmen_solution( /// Returns a solution in which only one winner is elected with just a self vote. pub fn get_single_winner_solution( winner: T::AccountId -) -> Result<(Vec, CompactAssignments, PhragmenScore, ElectionSize), &'static str> { +) -> Result<(Vec, CompactAssignments, ElectionScore, ElectionSize), &'static str> { let snapshot_validators = >::snapshot_validators().unwrap(); let snapshot_nominators = >::snapshot_nominators().unwrap(); diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index bb5030034b..8a7ae011c9 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -406,41 +406,6 @@ fn no_candidate_emergency_condition() { #[test] fn nominating_and_rewards_should_work() { - // PHRAGMEN OUTPUT: running this test with the reference impl gives: - // - // Sequential Phragmén gives - // 10 is elected with stake 2200.0 and score 0.0003333333333333333 - // 20 is elected with stake 1800.0 and score 0.0005555555555555556 - - // 10 has load 0.0003333333333333333 and supported - // 10 with stake 1000.0 - // 20 has load 0.0005555555555555556 and supported - // 20 with stake 1000.0 - // 30 has load 0 and supported - // 30 with stake 0 - // 40 has load 0 and supported - // 40 with stake 0 - // 2 has load 0.0005555555555555556 and supported - // 10 with stake 600.0 20 with stake 400.0 30 with stake 0.0 - // 4 has load 0.0005555555555555556 and supported - // 10 with stake 600.0 20 with stake 400.0 40 with stake 0.0 - - // Sequential Phragmén with post processing gives - // 10 is elected with stake 2000.0 and score 0.0003333333333333333 - // 20 is elected with stake 2000.0 and score 0.0005555555555555556 - - // 10 has load 0.0003333333333333333 and supported - // 10 with stake 1000.0 - // 20 has load 0.0005555555555555556 and supported - // 20 with stake 1000.0 - // 30 has load 0 and supported - // 30 with stake 0 - // 40 has load 0 and supported - // 40 with stake 0 - // 2 has load 0.0005555555555555556 and supported - // 10 with stake 400.0 20 with stake 600.0 30 with stake 0 - // 4 has load 0.0005555555555555556 and supported - // 10 with stake 600.0 20 with stake 400.0 40 with stake 0.0 ExtBuilder::default() .nominate(false) .validator_pool(true) @@ -477,7 +442,7 @@ fn nominating_and_rewards_should_work() { mock::start_era(1); - // 10 and 20 have more votes, they will be chosen by phragmen. + // 10 and 20 have more votes, they will be chosen. assert_eq_uvec!(validator_controllers(), vec![20, 10]); // OLD validators must have already received some rewards. @@ -2765,7 +2730,7 @@ mod offchain_phragmen { OffchainExt, TransactionPoolExt, }; use sp_io::TestExternalities; - use sp_phragmen::StakedAssignment; + use sp_npos_elections::StakedAssignment; use frame_support::traits::OffchainWorker; use std::sync::Arc; use substrate_test_utils::assert_eq_uvec; @@ -2822,7 +2787,7 @@ mod offchain_phragmen { origin: Origin, winners: Vec, compact: CompactAssignments, - score: PhragmenScore, + score: ElectionScore, ) -> DispatchResultWithPostInfo { Staking::submit_election_solution( origin, @@ -3355,7 +3320,7 @@ mod offchain_phragmen { &inner, ), TransactionValidity::Ok(ValidTransaction { - // the proposed slot stake, with equalize. + // the proposed slot stake, with balance_solution. priority: UnsignedPriority::get() + 1250, requires: vec![], provides: vec![("StakingOffchain", active_era()).encode()], diff --git a/primitives/arithmetic/src/rational128.rs b/primitives/arithmetic/src/rational128.rs index 709af1d3b9..947c7bc537 100644 --- a/primitives/arithmetic/src/rational128.rs +++ b/primitives/arithmetic/src/rational128.rs @@ -215,7 +215,7 @@ mod tests { assert_eq!(r(MAX128 - 10, MAX128).to_den(10), Ok(r(10, 10))); assert_eq!(r(MAX128 / 2, MAX128).to_den(10), Ok(r(5, 10))); - // large to perbill. This is very well needed for phragmen. + // large to perbill. This is very well needed for npos-elections. assert_eq!( r(MAX128 / 2, MAX128).to_den(1000_000_000), Ok(r(500_000_000, 1000_000_000)) diff --git a/primitives/phragmen/Cargo.toml b/primitives/npos-elections/Cargo.toml similarity index 81% rename from primitives/phragmen/Cargo.toml rename to primitives/npos-elections/Cargo.toml index d2b8e56dc0..c8de0ac46f 100644 --- a/primitives/phragmen/Cargo.toml +++ b/primitives/npos-elections/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "sp-phragmen" +name = "sp-npos-elections" version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" -description = "Phragmen primitives" +description = "NPoS election algorithm primitives" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-phragmen-compact = { version = "2.0.0-rc2", path = "./compact" } +sp-npos-elections-compact = { version = "2.0.0-rc2", path = "./compact" } sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../arithmetic" } [dev-dependencies] substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } rand = "0.7.3" -sp-phragmen = { version = "2.0.0-rc2", path = "." } +sp-npos-elections = { version = "2.0.0-rc2", path = "." } sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [features] diff --git a/primitives/phragmen/benches/phragmen.rs b/primitives/npos-elections/benches/phragmen.rs similarity index 92% rename from primitives/phragmen/benches/phragmen.rs rename to primitives/npos-elections/benches/phragmen.rs index c01d9f400d..7e46b9dce1 100644 --- a/primitives/phragmen/benches/phragmen.rs +++ b/primitives/npos-elections/benches/phragmen.rs @@ -25,10 +25,15 @@ extern crate test; use test::Bencher; use rand::{self, Rng}; -use sp_phragmen::{PhragmenResult, VoteWeight}; +use sp_npos_elections::{ElectionResult, VoteWeight}; use std::collections::BTreeMap; -use sp_runtime::{Perbill, traits::Zero}; +use sp_runtime::{Perbill, PerThing, traits::Zero}; +use sp_npos_elections::{ + balance_solution, assignment_ratio_to_staked, build_support_map, to_without_backing, VoteWeight, + ExtendedBalance, Assignment, StakedAssignment, IdentifierT, assignment_ratio_to_staked, + seq_phragmen, +}; // default params. Each will be scaled by the benchmarks individually. const VALIDATORS: u64 = 100; @@ -42,13 +47,7 @@ const PREFIX: AccountId = 1000_000; type AccountId = u64; mod bench_closure_and_slice { - use sp_phragmen::{ - VoteWeight, ExtendedBalance, Assignment, StakedAssignment, IdentifierT, - assignment_ratio_to_staked, - }; - use sp_runtime::{Perbill, PerThing}; - use rand::{self, Rng, RngCore}; - use test::Bencher; + use super::*; fn random_assignment() -> Assignment { let mut rng = rand::thread_rng(); @@ -135,7 +134,7 @@ fn do_phragmen( }); b.iter(|| { - let PhragmenResult { winners, assignments } = sp_phragmen::elect::( + let ElectionResult { winners, assignments } = seq_phragmen::( to_elect, Zero::zero(), candidates.clone(), @@ -146,14 +145,13 @@ fn do_phragmen( *stake_of_tree.get(who).unwrap() }; - // Do the benchmarking with equalize. + // Do the benchmarking with balancing. if eq_iters > 0 { - use sp_phragmen::{equalize, assignment_ratio_to_staked, build_support_map, to_without_backing}; let staked = assignment_ratio_to_staked(assignments, &stake_of); let winners = to_without_backing(winners); let mut support = build_support_map(winners.as_ref(), staked.as_ref()).0; - equalize( + balance_solution( staked.into_iter().map(|a| (a.clone(), stake_of(&a.who))).collect(), &mut support, eq_tolerance, diff --git a/primitives/phragmen/compact/Cargo.toml b/primitives/npos-elections/compact/Cargo.toml similarity index 85% rename from primitives/phragmen/compact/Cargo.toml rename to primitives/npos-elections/compact/Cargo.toml index 8fb9789d99..d14405619a 100644 --- a/primitives/phragmen/compact/Cargo.toml +++ b/primitives/npos-elections/compact/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "sp-phragmen-compact" +name = "sp-npos-elections-compact" version = "2.0.0-rc2" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" -description = "Phragmen Compact Solution" +description = "NPoS Compact Solution Type" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/primitives/phragmen/compact/src/assignment.rs b/primitives/npos-elections/compact/src/assignment.rs similarity index 97% rename from primitives/phragmen/compact/src/assignment.rs rename to primitives/npos-elections/compact/src/assignment.rs index a48cbd9379..fb3d4330b0 100644 --- a/primitives/phragmen/compact/src/assignment.rs +++ b/primitives/npos-elections/compact/src/assignment.rs @@ -57,7 +57,13 @@ fn from_impl(count: usize) -> TokenStream2 { let last = quote!(index_of_target(&distribution[#last_index].0).ok_or(_phragmen::Error::CompactInvalidIndex)?); quote!( - #c => compact.#field_name.push((index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, [#inner], #last)), + #c => compact.#field_name.push( + ( + index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, + [#inner], + #last, + ) + ), ) }).collect::(); diff --git a/primitives/phragmen/compact/src/lib.rs b/primitives/npos-elections/compact/src/lib.rs similarity index 95% rename from primitives/phragmen/compact/src/lib.rs rename to primitives/npos-elections/compact/src/lib.rs index 735e0abaa6..022782a7dd 100644 --- a/primitives/phragmen/compact/src/lib.rs +++ b/primitives/npos-elections/compact/src/lib.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Proc macro for phragmen compact assignment. +//! Proc macro for a npos compact assignment. use proc_macro::TokenStream; use proc_macro2::{TokenStream as TokenStream2, Span, Ident}; @@ -29,7 +29,7 @@ mod staked; // prefix used for struct fields in compact. const PREFIX: &'static str = "votes"; -/// Generates a struct to store the phragmen assignments in a compact way. The struct can only store +/// Generates a struct to store the election assignments in a compact way. The struct can only store /// distributions up to the given input count. The given count must be greater than 2. /// /// ```ignore @@ -176,7 +176,7 @@ fn struct_def( }).collect::(); Ok(quote! ( - /// A struct to encode a Phragmen assignment in a compact way. + /// A struct to encode a election assignment in a compact way. #[derive( Default, PartialEq, @@ -224,9 +224,9 @@ fn struct_def( } fn imports() -> Result { - let sp_phragmen_imports = match crate_name("sp-phragmen") { - Ok(sp_phragmen) => { - let ident = syn::Ident::new(&sp_phragmen, Span::call_site()); + let sp_phragmen_imports = match crate_name("sp-npos-elections") { + Ok(sp_npos_elections) => { + let ident = syn::Ident::new(&sp_npos_elections, Span::call_site()); quote!( extern crate #ident as _phragmen; ) } Err(e) => return Err(syn::Error::new(Span::call_site(), &e)), diff --git a/primitives/phragmen/compact/src/staked.rs b/primitives/npos-elections/compact/src/staked.rs similarity index 97% rename from primitives/phragmen/compact/src/staked.rs rename to primitives/npos-elections/compact/src/staked.rs index cb16752195..e2680e18b6 100644 --- a/primitives/phragmen/compact/src/staked.rs +++ b/primitives/npos-elections/compact/src/staked.rs @@ -57,7 +57,9 @@ fn from_impl(count: usize) -> TokenStream2 { let last = quote!(index_of_target(&distribution[#last_index].0).ok_or(_phragmen::Error::CompactInvalidIndex)?); quote!( - #c => compact.#field_name.push((index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, [#inner], #last)), + #c => compact.#field_name.push( + (index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, [#inner], #last) + ), ) }).collect::(); diff --git a/primitives/phragmen/fuzzer/.gitignore b/primitives/npos-elections/fuzzer/.gitignore similarity index 100% rename from primitives/phragmen/fuzzer/.gitignore rename to primitives/npos-elections/fuzzer/.gitignore diff --git a/primitives/phragmen/fuzzer/Cargo.lock b/primitives/npos-elections/fuzzer/Cargo.lock similarity index 99% rename from primitives/phragmen/fuzzer/Cargo.lock rename to primitives/npos-elections/fuzzer/Cargo.lock index a57bfa3920..c1d7ba945f 100644 --- a/primitives/phragmen/fuzzer/Cargo.lock +++ b/primitives/npos-elections/fuzzer/Cargo.lock @@ -1234,19 +1234,19 @@ dependencies = [ ] [[package]] -name = "sp-phragmen" +name = "sp-npos-elections" version = "2.0.0-alpha.3" dependencies = [ "parity-scale-codec", "serde", "sp-core", - "sp-phragmen-compact", + "sp-npos-elections-compact", "sp-runtime", "sp-std", ] [[package]] -name = "sp-phragmen-compact" +name = "sp-npos-elections-compact" version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", @@ -1256,12 +1256,12 @@ dependencies = [ ] [[package]] -name = "sp-phragmen-fuzzer" +name = "sp-npos-elections-fuzzer" version = "2.0.0" dependencies = [ "honggfuzz", "rand 0.7.3", - "sp-phragmen", + "sp-npos-elections", ] [[package]] diff --git a/primitives/phragmen/fuzzer/Cargo.toml b/primitives/npos-elections/fuzzer/Cargo.toml similarity index 74% rename from primitives/phragmen/fuzzer/Cargo.toml rename to primitives/npos-elections/fuzzer/Cargo.toml index 2846841e1c..e9ca6c6fd9 100644 --- a/primitives/phragmen/fuzzer/Cargo.toml +++ b/primitives/npos-elections/fuzzer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sp-phragmen-fuzzer" +name = "sp-npos-elections-fuzzer" version = "2.0.0-alpha.5" authors = ["Parity Technologies "] edition = "2018" @@ -7,14 +7,14 @@ license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" description = "Fuzzer for phragmén implementation." -documentation = "https://docs.rs/sp-phragmen-fuzzer" +documentation = "https://docs.rs/sp-npos-elections-fuzzer" publish = false [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-phragmen = { version = "2.0.0-rc2", path = ".." } +sp-npos-elections = { version = "2.0.0-rc2", path = ".." } sp-std = { version = "2.0.0-rc2", path = "../../std" } sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } honggfuzz = "0.5" @@ -25,5 +25,5 @@ name = "reduce" path = "src/reduce.rs" [[bin]] -name = "equalize" -path = "src/equalize.rs" +name = "balance_solution" +path = "src/balance_solution.rs" diff --git a/primitives/phragmen/fuzzer/src/equalize.rs b/primitives/npos-elections/fuzzer/src/balance_solution.rs similarity index 87% rename from primitives/phragmen/fuzzer/src/equalize.rs rename to primitives/npos-elections/fuzzer/src/balance_solution.rs index a46e479b5a..e1bd3bd0a0 100644 --- a/primitives/phragmen/fuzzer/src/equalize.rs +++ b/primitives/npos-elections/fuzzer/src/balance_solution.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Fuzzing fro the equalize algorithm +//! Fuzzing fro the balance_solution algorithm //! //! It ensures that any solution which gets equalized will lead into a better or equally scored //! one. @@ -23,9 +23,9 @@ mod common; use common::to_range; use honggfuzz::fuzz; -use sp_phragmen::{ - equalize, assignment_ratio_to_staked, build_support_map, to_without_backing, elect, - PhragmenResult, VoteWeight, evaluate_support, is_score_better, +use sp_npos_elections::{ + balance_solution, assignment_ratio_to_staked, build_support_map, to_without_backing, seq_phragmen, + ElectionResult, VoteWeight, evaluate_support, is_score_better, }; use sp_std::collections::btree_map::BTreeMap; use sp_runtime::Perbill; @@ -39,7 +39,7 @@ fn generate_random_phragmen_result( to_elect: usize, edge_per_voter: u64, mut rng: impl RngCore, -) -> (PhragmenResult, BTreeMap) { +) -> (ElectionResult, BTreeMap) { let prefix = 100_000; // Note, it is important that stakes are always bigger than ed and let base_stake: u64 = 1_000_000_000; @@ -73,7 +73,7 @@ fn generate_random_phragmen_result( }); ( - elect::( + seq_phragmen::( to_elect, 0, candidates, @@ -86,7 +86,14 @@ fn generate_random_phragmen_result( fn main() { loop { fuzz!(|data: (usize, usize, usize, usize, usize, u64)| { - let (mut target_count, mut voter_count, mut iterations, mut edge_per_voter, mut to_elect, seed) = data; + let ( + mut target_count, + mut voter_count, + mut iterations, + mut edge_per_voter, + mut to_elect, + seed, + ) = data; let rng = rand::rngs::SmallRng::seed_from_u64(seed); target_count = to_range(target_count, 50, 2000); voter_count = to_range(voter_count, 50, 1000); @@ -95,7 +102,7 @@ fn main() { edge_per_voter = to_range(edge_per_voter, 1, target_count); println!("++ [{} / {} / {} / {}]", voter_count, target_count, to_elect, iterations); - let (PhragmenResult { winners, assignments }, stake_of_tree) = generate_random_phragmen_result( + let (ElectionResult { winners, assignments }, stake_of_tree) = generate_random_phragmen_result( voter_count as u64, target_count as u64, to_elect, @@ -117,7 +124,7 @@ fn main() { return; } - let i = equalize( + let i = balance_solution( &mut staked, &mut support, 10, diff --git a/primitives/phragmen/fuzzer/src/common.rs b/primitives/npos-elections/fuzzer/src/common.rs similarity index 100% rename from primitives/phragmen/fuzzer/src/common.rs rename to primitives/npos-elections/fuzzer/src/common.rs diff --git a/primitives/phragmen/fuzzer/src/reduce.rs b/primitives/npos-elections/fuzzer/src/reduce.rs similarity index 98% rename from primitives/phragmen/fuzzer/src/reduce.rs rename to primitives/npos-elections/fuzzer/src/reduce.rs index 7ac15dd544..d08a440a62 100644 --- a/primitives/phragmen/fuzzer/src/reduce.rs +++ b/primitives/npos-elections/fuzzer/src/reduce.rs @@ -34,7 +34,7 @@ use honggfuzz::fuzz; mod common; use common::to_range; -use sp_phragmen::{StakedAssignment, ExtendedBalance, build_support_map, reduce}; +use sp_npos_elections::{StakedAssignment, ExtendedBalance, build_support_map, reduce}; use rand::{self, Rng, SeedableRng, RngCore}; type Balance = u128; diff --git a/primitives/phragmen/src/helpers.rs b/primitives/npos-elections/src/helpers.rs similarity index 98% rename from primitives/phragmen/src/helpers.rs rename to primitives/npos-elections/src/helpers.rs index 2674bc445d..1c96300c66 100644 --- a/primitives/phragmen/src/helpers.rs +++ b/primitives/npos-elections/src/helpers.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Helper methods for phragmen. +//! Helper methods for npos-elections. use crate::{Assignment, ExtendedBalance, VoteWeight, IdentifierT, StakedAssignment, WithApprovalOf}; use sp_arithmetic::PerThing; diff --git a/primitives/phragmen/src/lib.rs b/primitives/npos-elections/src/lib.rs similarity index 92% rename from primitives/phragmen/src/lib.rs rename to primitives/npos-elections/src/lib.rs index 6b2686e543..72eddf9a1d 100644 --- a/primitives/phragmen/src/lib.rs +++ b/primitives/npos-elections/src/lib.rs @@ -15,22 +15,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Rust implementation of the Phragmén election algorithm. This is used in several pallets to -//! optimally distribute the weight of a set of voters among an elected set of candidates. In the -//! context of staking this is mapped to validators and nominators. +//! A set of election algorithms to be used with a substrate runtime, typically within the staking +//! sub-system. Notable implementation include //! -//! The algorithm has two phases: -//! - Sequential phragmen: performed in [`elect`] function which is first pass of the distribution -//! The results are not optimal but the execution time is less. -//! - Equalize post-processing: tries to further distribute the weight fairly among candidates. -//! Incurs more execution time. +//! - [`seq_phragmen`]: Implements the Phragmén Sequential Method. An un-ranked, relatively fast +//! election method that ensures PJR, but does not provide a constant factor approximation of the +//! maximin problem. +//! - [`balance_solution`]: Implements the star balancing algorithm. This iterative process can +//! increase a solutions score, as described in [`evaluate_support`]. //! -//! The main objective of the assignments done by phragmen is to maximize the minimum backed -//! candidate in the elected set. -//! -//! Reference implementation: https://github.com/w3f/consensus -//! Further details: -//! https://research.web3.foundation/en/latest/polkadot/NPoS/4.%20Sequential%20Phragm%C3%A9n%E2%80%99s%20method/ +//! More information can be found at: https://arxiv.org/abs/2004.12990 #![cfg_attr(not(feature = "std"), no_std)] @@ -67,7 +61,7 @@ pub use codec; pub use sp_arithmetic; // re-export the compact solution type. -pub use sp_phragmen_compact::generate_compact_solution_type; +pub use sp_npos_elections_compact::generate_compact_solution_type; /// A trait to limit the number of votes per voter. The generated compact type will implement this. pub trait VotingLimit { @@ -100,7 +94,7 @@ pub type VoteWeight = u64; pub type ExtendedBalance = u128; /// The score of an assignment. This can be computed from the support map via [`evaluate_support`]. -pub type PhragmenScore = [ExtendedBalance; 3]; +pub type ElectionScore = [ExtendedBalance; 3]; /// A winner, with their respective approval stake. pub type WithApprovalOf = (A, ExtendedBalance); @@ -110,7 +104,7 @@ pub type WithApprovalOf = (A, ExtendedBalance); /// bigger than u64::max_value() is needed. For maximum accuracy we simply use u128; const DEN: u128 = u128::max_value(); -/// A candidate entity for phragmen election. +/// A candidate entity for the election. #[derive(Clone, Default, Debug)] struct Candidate { /// Identifier. @@ -147,9 +141,9 @@ struct Edge { candidate_index: usize, } -/// Final result of the phragmen election. +/// Final result of the election. #[derive(Debug)] -pub struct PhragmenResult { +pub struct ElectionResult { /// Just winners zipped with their approval stake. Note that the approval stake is merely the /// sub of their received stake and could be used for very basic sorting and approval voting. pub winners: Vec>, @@ -298,10 +292,10 @@ impl StakedAssignment { } } -/// A structure to demonstrate the phragmen result from the perspective of the candidate, i.e. how +/// A structure to demonstrate the election result from the perspective of the candidate, i.e. how /// much support each candidate is receiving. /// -/// This complements the [`PhragmenResult`] and is needed to run the equalize post-processing. +/// This complements the [`ElectionResult`] and is needed to run the balancing post-processing. /// /// This, at the current version, resembles the `Exposure` defined in the Staking pallet, yet /// they do not necessarily have to be the same. @@ -332,12 +326,12 @@ pub type SupportMap = BTreeMap>; /// responsibility of the caller to make sure only those candidates who have a sensible economic /// value are passed in. From the perspective of this function, a candidate can easily be among the /// winner with no backing stake. -pub fn elect( +pub fn seq_phragmen( candidate_count: usize, minimum_candidate_count: usize, initial_candidates: Vec, initial_voters: Vec<(AccountId, VoteWeight, Vec)>, -) -> Option> where +) -> Option> where AccountId: Default + Ord + Clone, R: PerThing, { @@ -388,7 +382,6 @@ pub fn elect( // we have already checked that we have more candidates than minimum_candidate_count. - // run phragmen. let to_elect = candidate_count.min(candidates.len()); elected_candidates = Vec::with_capacity(candidate_count); assigned = Vec::with_capacity(candidate_count); @@ -524,13 +517,13 @@ pub fn elect( } } - Some(PhragmenResult { + Some(ElectionResult { winners: elected_candidates, assignments: assigned, }) } -/// Build the support map from the given phragmen result. It maps a flat structure like +/// Build the support map from the given election result. It maps a flat structure like /// /// ```nocompile /// assignments: vec![ @@ -588,7 +581,7 @@ pub fn build_support_map( (supports, errors) } -/// Evaluate a phragmen result, given the support map. The returned tuple contains: +/// Evaluate a support map. The returned tuple contains: /// /// - Minimum support. This value must be **maximized**. /// - Sum of all supports. This value must be **maximized**. @@ -597,7 +590,7 @@ pub fn build_support_map( /// `O(E)` where `E` is the total number of edges. pub fn evaluate_support( support: &SupportMap, -) -> PhragmenScore { +) -> ElectionScore { let mut min_support = ExtendedBalance::max_value(); let mut sum: ExtendedBalance = Zero::zero(); // NOTE: The third element might saturate but fine for now since this will run on-chain and need @@ -614,14 +607,14 @@ pub fn evaluate_support( [min_support, sum, sum_squared] } -/// Compares two sets of phragmen scores based on desirability and returns true if `this` is +/// Compares two sets of election scores based on desirability and returns true if `this` is /// better than `that`. /// /// Evaluation is done in a lexicographic manner, and if each element of `this` is `that * epsilon` /// greater or less than `that`. /// /// Note that the third component should be minimized. -pub fn is_score_better(this: PhragmenScore, that: PhragmenScore, epsilon: P) -> bool +pub fn is_score_better(this: ElectionScore, that: ElectionScore, epsilon: P) -> bool where ExtendedBalance: From> { match this @@ -648,17 +641,17 @@ pub fn is_score_better(this: PhragmenScore, that: PhragmenScore, ep } } -/// Performs equalize post-processing to the output of the election algorithm. This happens in +/// Performs balancing post-processing to the output of the election algorithm. This happens in /// rounds. The number of rounds and the maximum diff-per-round tolerance can be tuned through input /// parameters. /// /// Returns the number of iterations that were preformed. /// -/// - `assignments`: exactly the same is the output of phragmen. +/// - `assignments`: exactly the same as the output of [`seq_phragmen`]. /// - `supports`: mutable reference to s `SupportMap`. This parameter is updated. /// - `tolerance`: maximum difference that can occur before an early quite happens. /// - `iterations`: maximum number of iterations that will be processed. -pub fn equalize( +pub fn balance_solution( assignments: &mut Vec>, supports: &mut SupportMap, tolerance: ExtendedBalance, @@ -672,7 +665,7 @@ pub fn equalize( for assignment in assignments.iter_mut() { let voter_budget = assignment.total(); let StakedAssignment { who, distribution } = assignment; - let diff = do_equalize( + let diff = do_balancing( who, voter_budget, distribution, @@ -689,9 +682,9 @@ pub fn equalize( } } -/// actually perform equalize. same interface is `equalize`. Just called in loops with a check for +/// actually perform balancing. same interface is `balance_solution`. Just called in loops with a check for /// maximum difference. -fn do_equalize( +fn do_balancing( voter: &AccountId, budget: ExtendedBalance, elected_edges: &mut Vec<(AccountId, ExtendedBalance)>, diff --git a/primitives/phragmen/src/mock.rs b/primitives/npos-elections/src/mock.rs similarity index 98% rename from primitives/phragmen/src/mock.rs rename to primitives/npos-elections/src/mock.rs index fb80112515..b9c2396b08 100644 --- a/primitives/phragmen/src/mock.rs +++ b/primitives/npos-elections/src/mock.rs @@ -15,11 +15,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Mock file for phragmen. +//! Mock file for npos-elections. #![cfg(test)] -use crate::{elect, PhragmenResult, Assignment, VoteWeight, ExtendedBalance}; +use crate::{seq_phragmen, ElectionResult, Assignment, VoteWeight, ExtendedBalance}; use sp_arithmetic::{PerThing, traits::{SaturatedConversion, Zero, One}}; use sp_std::collections::btree_map::BTreeMap; use sp_runtime::assert_eq_error_rate; @@ -326,7 +326,7 @@ pub(crate) fn run_and_compare( min_to_elect: usize, ) { // run fixed point code. - let PhragmenResult { winners, assignments } = elect::<_, Output>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Output>( to_elect, min_to_elect, candidates.clone(), diff --git a/primitives/phragmen/src/node.rs b/primitives/npos-elections/src/node.rs similarity index 100% rename from primitives/phragmen/src/node.rs rename to primitives/npos-elections/src/node.rs diff --git a/primitives/phragmen/src/reduce.rs b/primitives/npos-elections/src/reduce.rs similarity index 100% rename from primitives/phragmen/src/reduce.rs rename to primitives/npos-elections/src/reduce.rs diff --git a/primitives/phragmen/src/tests.rs b/primitives/npos-elections/src/tests.rs similarity index 95% rename from primitives/phragmen/src/tests.rs rename to primitives/npos-elections/src/tests.rs index a8bc069147..47d619339b 100644 --- a/primitives/phragmen/src/tests.rs +++ b/primitives/npos-elections/src/tests.rs @@ -15,14 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Tests for phragmen. +//! Tests for npos-elections. #![cfg(test)] use crate::mock::*; use crate::{ - elect, equalize, build_support_map, is_score_better, helpers::*, - Support, StakedAssignment, Assignment, PhragmenResult, ExtendedBalance, + seq_phragmen, balance_solution, build_support_map, is_score_better, helpers::*, + Support, StakedAssignment, Assignment, ElectionResult, ExtendedBalance, }; use substrate_test_utils::assert_eq_uvec; use sp_arithmetic::{Perbill, Permill, Percent, PerU16}; @@ -83,7 +83,7 @@ fn phragmen_poc_works() { ]; let stake_of = create_stake_of(&[(10, 10), (20, 20), (30, 30)]); - let PhragmenResult { winners, assignments } = elect::<_, Perbill>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Perbill>( 2, 2, candidates, @@ -146,7 +146,7 @@ fn phragmen_poc_works() { Support:: { total: 35, voters: vec![(20, 20), (30, 15)] }, ); - equalize( + balance_solution( &mut staked, &mut support_map, 0, @@ -240,11 +240,14 @@ fn phragmen_accuracy_on_large_scale_only_validators() { (5, (u64::max_value() - 2).into()), ]); - let PhragmenResult { winners, assignments } = elect::<_, Perbill>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Perbill>( 2, 2, candidates.clone(), - auto_generate_self_voters(&candidates).iter().map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone())).collect::>(), + auto_generate_self_voters(&candidates) + .iter() + .map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone())) + .collect::>(), ).unwrap(); assert_eq_uvec!(winners, vec![(1, 18446744073709551614u128), (5, 18446744073709551613u128)]); @@ -270,7 +273,7 @@ fn phragmen_accuracy_on_large_scale_validators_and_nominators() { (14, u64::max_value().into()), ]); - let PhragmenResult { winners, assignments } = elect::<_, Perbill>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Perbill>( 2, 2, candidates, @@ -313,7 +316,7 @@ fn phragmen_accuracy_on_small_scale_self_vote() { (30, 1), ]); - let PhragmenResult { winners, assignments: _ } = elect::<_, Perbill>( + let ElectionResult { winners, assignments: _ } = seq_phragmen::<_, Perbill>( 3, 3, candidates, @@ -343,7 +346,7 @@ fn phragmen_accuracy_on_small_scale_no_self_vote() { (3, 1), ]); - let PhragmenResult { winners, assignments: _ } = elect::<_, Perbill>( + let ElectionResult { winners, assignments: _ } = seq_phragmen::<_, Perbill>( 3, 3, candidates, @@ -376,7 +379,7 @@ fn phragmen_large_scale_test() { (50, 990000000000000000), ]); - let PhragmenResult { winners, assignments } = elect::<_, Perbill>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Perbill>( 2, 2, candidates, @@ -402,7 +405,7 @@ fn phragmen_large_scale_test_2() { (50, nom_budget.into()), ]); - let PhragmenResult { winners, assignments } = elect::<_, Perbill>( + let ElectionResult { winners, assignments } = seq_phragmen::<_, Perbill>( 2, 2, candidates, @@ -478,7 +481,7 @@ fn elect_has_no_entry_barrier() { (2, 10), ]); - let PhragmenResult { winners, assignments: _ } = elect::<_, Perbill>( + let ElectionResult { winners, assignments: _ } = seq_phragmen::<_, Perbill>( 3, 3, candidates, @@ -505,7 +508,7 @@ fn minimum_to_elect_is_respected() { (2, 10), ]); - let maybe_result = elect::<_, Perbill>( + let maybe_result = seq_phragmen::<_, Perbill>( 10, 10, candidates, @@ -531,7 +534,7 @@ fn self_votes_should_be_kept() { (1, 8), ]); - let result = elect::<_, Perbill>( + let result = seq_phragmen::<_, Perbill>( 2, 2, candidates, @@ -570,7 +573,7 @@ fn self_votes_should_be_kept() { &Support { total: 24u128, voters: vec![(20u64, 20u128), (1u64, 4u128)] }, ); - equalize( + balance_solution( &mut staked_assignments, &mut supports, 0, @@ -771,8 +774,8 @@ mod compact { use codec::{Decode, Encode}; use crate::{generate_compact_solution_type, VoteWeight}; use super::{AccountId}; - // these need to come from the same dev-dependency `sp-phragmen`, not from the crate. - use sp_phragmen::{Assignment, StakedAssignment, Error as PhragmenError, ExtendedBalance}; + // these need to come from the same dev-dependency `sp-npos-elections`, not from the crate. + use sp_npos_elections::{Assignment, StakedAssignment, Error as PhragmenError, ExtendedBalance}; use sp_std::{convert::{TryInto, TryFrom}, fmt::Debug}; use sp_arithmetic::Percent; -- GitLab From 9ce077465ac46a93ebaced4b47863952b3d63d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 5 Jun 2020 23:12:00 +0200 Subject: [PATCH 113/280] Make transaction pool prune transactions only of canonical blocks (#6123) * Make tx pool aware of retracted fork blocks * Make it compile * Update client/transaction-pool/src/lib.rs Co-authored-by: Nikolay Volf * Fix doc test * Simplify the implementation * Send tree route as arc to prevent heavy clones * Switch to use `ExtrinsicHash` to make it more clear * Fix benchmark Co-authored-by: Nikolay Volf --- Cargo.lock | 1 + bin/node-template/node/src/service.rs | 30 +- bin/node/cli/src/service.rs | 28 +- client/api/src/backend.rs | 6 +- client/api/src/client.rs | 8 +- .../basic-authorship/src/basic_authorship.rs | 21 +- client/basic-authorship/src/lib.rs | 5 +- client/consensus/manual-seal/src/lib.rs | 6 +- .../manual-seal/src/seal_new_block.rs | 2 +- client/finality-grandpa/src/until_imported.rs | 2 +- client/offchain/src/lib.rs | 8 +- client/rpc/src/author/tests.rs | 8 +- client/service/src/builder.rs | 61 ++-- client/service/src/client/client.rs | 10 +- .../transaction-pool/graph/benches/basics.rs | 3 +- client/transaction-pool/graph/src/lib.rs | 6 +- client/transaction-pool/graph/src/listener.rs | 12 +- client/transaction-pool/graph/src/pool.rs | 119 ++++--- .../graph/src/validated_pool.rs | 53 +-- client/transaction-pool/src/api.rs | 66 ++-- client/transaction-pool/src/lib.rs | 131 ++++--- client/transaction-pool/src/revalidation.rs | 18 +- client/transaction-pool/src/testing/pool.rs | 330 ++++++++++++++++-- primitives/blockchain/Cargo.toml | 1 - primitives/blockchain/src/header_metadata.rs | 24 +- primitives/transaction-pool/Cargo.toml | 2 + primitives/transaction-pool/src/pool.rs | 6 +- test-utils/runtime/client/src/lib.rs | 9 +- test-utils/runtime/src/lib.rs | 10 +- .../runtime/transaction-pool/src/lib.rs | 157 ++++++--- utils/frame/rpc/system/src/lib.rs | 8 +- 31 files changed, 800 insertions(+), 351 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ad5033f13..358f22463a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7746,6 +7746,7 @@ dependencies = [ "parity-scale-codec", "serde", "sp-api", + "sp-blockchain", "sp-runtime", "sp-utils", ] diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index 8e57a04137..17606e2923 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -34,14 +34,22 @@ macro_rules! new_full_start { let inherent_data_providers = sp_inherents::InherentDataProviders::new(); let builder = sc_service::ServiceBuilder::new_full::< - node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor + node_template_runtime::opaque::Block, + node_template_runtime::RuntimeApi, + crate::service::Executor >($config)? .with_select_chain(|_config, backend| { Ok(sc_consensus::LongestChain::new(backend.clone())) })? - .with_transaction_pool(|config, client, _fetcher, prometheus_registry| { - let pool_api = sc_transaction_pool::FullChainApi::new(client.clone()); - Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry)) + .with_transaction_pool(|builder| { + let pool_api = sc_transaction_pool::FullChainApi::new( + builder.client().clone(), + ); + Ok(sc_transaction_pool::BasicPool::new( + builder.config().transaction_pool.clone(), + std::sync::Arc::new(pool_api), + builder.prometheus_registry(), + )) })? .with_import_queue(| _config, @@ -199,13 +207,19 @@ pub fn new_light(config: Configuration) -> Result { pub is_new_best: bool, /// Optional storage changes. pub storage_changes: Option<(StorageCollection, ChildStorageCollection)>, - /// Blocks that got retracted because of this one got imported. - pub retracted: Vec, + /// Tree route from old best to new best. + /// + /// If `None`, there was no re-org while importing. + pub tree_route: Option>, } /// Import operation wrapper diff --git a/client/api/src/client.rs b/client/api/src/client.rs index c855cd3a08..aa6763653d 100644 --- a/client/api/src/client.rs +++ b/client/api/src/client.rs @@ -16,7 +16,7 @@ //! A set of APIs supported by the client along with their primitives. -use std::{fmt, collections::HashSet}; +use std::{fmt, collections::HashSet, sync::Arc}; use sp_core::storage::StorageKey; use sp_runtime::{ traits::{Block as BlockT, NumberFor}, @@ -234,8 +234,10 @@ pub struct BlockImportNotification { pub header: Block::Header, /// Is this the new best block. pub is_new_best: bool, - /// List of retracted blocks ordered by block number. - pub retracted: Vec, + /// Tree route from old best to new best. + /// + /// If `None`, there was no re-org while importing. + pub tree_route: Option>>, } /// Summary of a finalized block. diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index cd241f3884..39ebbc89be 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -331,15 +331,14 @@ mod tests { use parking_lot::Mutex; use sp_consensus::{BlockOrigin, Proposer}; use substrate_test_runtime_client::{ - prelude::*, - runtime::{Extrinsic, Transfer}, + prelude::*, TestClientBuilder, runtime::{Extrinsic, Transfer}, TestClientBuilderExt, }; use sp_transaction_pool::{ChainEvent, MaintainedTransactionPool, TransactionSource}; use sc_transaction_pool::{BasicPool, FullChainApi}; use sp_api::Core; - use backend::Backend; use sp_blockchain::HeaderBackend; use sp_runtime::traits::NumberFor; + use sc_client_api::Backend; const SOURCE: TransactionSource = TransactionSource::External; @@ -357,7 +356,7 @@ mod tests { { ChainEvent::NewBlock { id: BlockId::Number(block_number.into()), - retracted: vec![], + tree_route: None, is_new_best: true, header, } @@ -452,8 +451,7 @@ mod tests { #[test] fn proposed_storage_changes_should_match_execute_block_storage_changes() { - let (client, backend) = substrate_test_runtime_client::TestClientBuilder::new() - .build_with_backend(); + let (client, backend) = TestClientBuilder::new().build_with_backend(); let client = Arc::new(client); let txpool = Arc::new( BasicPool::new( @@ -473,7 +471,9 @@ mod tests { futures::executor::block_on( txpool.maintain(chain_event( 0, - client.header(&BlockId::Number(0u64)).expect("header get error").expect("there should be header") + client.header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), )) ); @@ -500,8 +500,11 @@ mod tests { backend.changes_trie_storage(), ).unwrap(); - let storage_changes = api.into_storage_changes(&state, changes_trie_state.as_ref(), genesis_hash) - .unwrap(); + let storage_changes = api.into_storage_changes( + &state, + changes_trie_state.as_ref(), + genesis_hash, + ).unwrap(); assert_eq!( proposal.storage_changes.transaction_storage_root, diff --git a/client/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs index 63020c0e68..4f53c87de3 100644 --- a/client/basic-authorship/src/lib.rs +++ b/client/basic-authorship/src/lib.rs @@ -25,7 +25,10 @@ //! # use sp_consensus::{Environment, Proposer, RecordProof}; //! # use sp_runtime::generic::BlockId; //! # use std::{sync::Arc, time::Duration}; -//! # use substrate_test_runtime_client::{self, runtime::{Extrinsic, Transfer}, AccountKeyring}; +//! # use substrate_test_runtime_client::{ +//! # runtime::{Extrinsic, Transfer}, AccountKeyring, +//! # DefaultTestClientBuilderExt, TestClientBuilderExt, +//! # }; //! # use sc_transaction_pool::{BasicPool, FullChainApi}; //! # let client = Arc::new(substrate_test_runtime_client::new()); //! # let txpool = Arc::new(BasicPool::new(Default::default(), Arc::new(FullChainApi::new(client.clone())), None).0); diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index 26f493d5d2..a5366148a7 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -98,7 +98,7 @@ pub async fn run_manual_seal( inherent_data_providers: InherentDataProviders, ) where - A: txpool::ChainApi::Hash> + 'static, + A: txpool::ChainApi + 'static, B: BlockT + 'static, C: HeaderBackend + Finalizer + 'static, CB: ClientBackend + 'static, @@ -158,7 +158,7 @@ pub async fn run_instant_seal( inherent_data_providers: InherentDataProviders, ) where - A: txpool::ChainApi::Hash> + 'static, + A: txpool::ChainApi + 'static, B: BlockT + 'static, C: HeaderBackend + Finalizer + 'static, CB: ClientBackend + 'static, @@ -417,7 +417,7 @@ mod tests { id: BlockId::Number(1), header: client.header(&BlockId::Number(1)).expect("db error").expect("imported above"), is_new_best: true, - retracted: vec![], + tree_route: None, }).await; let (tx1, rx1) = futures::channel::oneshot::channel(); diff --git a/client/consensus/manual-seal/src/seal_new_block.rs b/client/consensus/manual-seal/src/seal_new_block.rs index a608c978e6..c5aea11ced 100644 --- a/client/consensus/manual-seal/src/seal_new_block.rs +++ b/client/consensus/manual-seal/src/seal_new_block.rs @@ -87,7 +87,7 @@ pub async fn seal_new_block( E: Environment, >::Error: std::fmt::Display, >::Error: std::fmt::Display, - P: txpool::ChainApi::Hash>, + P: txpool::ChainApi, SC: SelectChain, { let future = async { diff --git a/client/finality-grandpa/src/until_imported.rs b/client/finality-grandpa/src/until_imported.rs index 6a39c2637e..3ac94f3b06 100644 --- a/client/finality-grandpa/src/until_imported.rs +++ b/client/finality-grandpa/src/until_imported.rs @@ -585,7 +585,7 @@ mod tests { origin: BlockOrigin::File, header, is_new_best: false, - retracted: vec![], + tree_route: None, }).unwrap(); } } diff --git a/client/offchain/src/lib.rs b/client/offchain/src/lib.rs index 332e9f779a..d6e62501b6 100644 --- a/client/offchain/src/lib.rs +++ b/client/offchain/src/lib.rs @@ -166,7 +166,7 @@ mod tests { use super::*; use std::sync::Arc; use sc_network::{Multiaddr, PeerId}; - use substrate_test_runtime_client::runtime::Block; + use substrate_test_runtime_client::{TestClient, runtime::Block}; use sc_transaction_pool::{BasicPool, FullChainApi}; use sp_transaction_pool::{TransactionPool, InPoolTransaction}; use sc_client_api::ExecutorProvider; @@ -183,7 +183,9 @@ mod tests { } } - struct TestPool(BasicPool, Block>); + struct TestPool( + BasicPool, Block> + ); impl sp_transaction_pool::OffchainSubmitTransaction for TestPool { fn submit_at( @@ -200,8 +202,8 @@ mod tests { #[test] fn should_call_into_runtime_and_produce_extrinsic() { - // given let _ = env_logger::try_init(); + let client = Arc::new(substrate_test_runtime_client::new()); let pool = Arc::new(TestPool(BasicPool::new( Default::default(), diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index 8c1b82028b..d70a2ce2af 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -58,11 +58,9 @@ struct TestSetup { impl Default for TestSetup { fn default() -> Self { let keystore = KeyStore::new(); - let client = Arc::new( - substrate_test_runtime_client::TestClientBuilder::new() - .set_keystore(keystore.clone()) - .build() - ); + let client_builder = substrate_test_runtime_client::TestClientBuilder::new(); + let client = Arc::new(client_builder.set_keystore(keystore.clone()).build()); + let pool = Arc::new(BasicPool::new( Default::default(), Arc::new(FullChainApi::new(client.clone())), diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index baf1c2e0cc..c2af1a129b 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -16,16 +16,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm}; -use crate::{start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle}; -use crate::status_sinks; -use crate::config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig}; -use crate::metrics::MetricsService; +use crate::{ + Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm, + start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle, + status_sinks, metrics::MetricsService, client::{Client, ClientConfig}, + config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig}, +}; use sc_client_api::{ - self, BlockchainEvents, backend::RemoteBackend, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, - ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider, + BlockchainEvents, backend::RemoteBackend, light::RemoteBlockchain, + execution_extensions::ExtensionsFactory, ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, + CloneableSpawn, UsageProvider, }; -use crate::client::{Client, ClientConfig}; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; use sc_chain_spec::get_extension; use sp_consensus::{ @@ -55,7 +56,6 @@ use std::{ use wasm_timer::SystemTime; use sc_telemetry::{telemetry, SUBSTRATE_INFO}; use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent}; -use sp_blockchain; use prometheus_endpoint::Registry; use sc_client_db::{Backend, DatabaseSettings}; use sp_core::traits::CodeExecutor; @@ -452,8 +452,29 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { } impl - ServiceBuilder { + ServiceBuilder< + TBl, + TRtApi, + TCl, + TFchr, + TSc, + TImpQu, + TFprb, + TFpp, + TExPool, + TRpc, + Backend + > +{ + /// Returns a reference to the configuration that was stored in this builder. + pub fn config(&self) -> &Configuration { + &self.config + } + + /// Returns a reference to the optional prometheus registry that was stored in this builder. + pub fn prometheus_registry(&self) -> Option<&Registry> { + self.config.prometheus_config.as_ref().map(|config| &config.registry) + } /// Returns a reference to the client that was stored in this builder. pub fn client(&self) -> &Arc { @@ -698,20 +719,12 @@ impl pub fn with_transaction_pool( self, transaction_pool_builder: impl FnOnce( - sc_transaction_pool::txpool::Options, - Arc, - Option, - Option<&Registry>, - ) -> Result<(UExPool, Option), Error> + &Self, + ) -> Result<(UExPool, Option), Error>, ) -> Result, Error> where TSc: Clone, TFchr: Clone { - let (transaction_pool, background_task) = transaction_pool_builder( - self.config.transaction_pool.clone(), - self.client.clone(), - self.fetcher.clone(), - self.config.prometheus_config.as_ref().map(|config| &config.registry), - )?; + let (transaction_pool, background_task) = transaction_pool_builder(&self)?; if let Some(background_task) = background_task{ self.task_manager.spawn_handle().spawn("txpool-background", background_task); @@ -1032,7 +1045,7 @@ ServiceBuilder< let mut import_stream = client.import_notification_stream().map(|n| ChainEvent::NewBlock { id: BlockId::Hash(n.hash), header: n.header, - retracted: n.retracted, + tree_route: n.tree_route, is_new_best: n.is_new_best, }).fuse(); let mut finality_stream = client.finality_notification_stream() @@ -1349,7 +1362,7 @@ ServiceBuilder< _telemetry_on_connect_sinks: telemetry_connection_sinks.clone(), keystore, marker: PhantomData::, - prometheus_registry: config.prometheus_config.map(|config| config.registry) + prometheus_registry: config.prometheus_config.map(|config| config.registry), }) } } diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 77b3f065f4..fcbaab8851 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -787,15 +787,15 @@ impl Client where NewBlockState::Normal }; - let retracted = if is_new_best { + let tree_route = if is_new_best { let route_from_best = sp_blockchain::tree_route( self.backend.blockchain(), info.best_hash, parent_hash, )?; - route_from_best.retracted().iter().rev().map(|e| e.hash.clone()).collect() + Some(route_from_best) } else { - Vec::default() + None }; trace!( @@ -826,7 +826,7 @@ impl Client where header: import_headers.into_post(), is_new_best, storage_changes, - retracted, + tree_route, }) } @@ -1048,7 +1048,7 @@ impl Client where origin: notify_import.origin, header: notify_import.header, is_new_best: notify_import.is_new_best, - retracted: notify_import.retracted, + tree_route: notify_import.tree_route.map(Arc::new), }; self.import_notification_sinks.lock() diff --git a/client/transaction-pool/graph/benches/basics.rs b/client/transaction-pool/graph/benches/basics.rs index ee92b60d54..bb10086bd4 100644 --- a/client/transaction-pool/graph/benches/basics.rs +++ b/client/transaction-pool/graph/benches/basics.rs @@ -51,7 +51,6 @@ fn to_tag(nonce: u64, from: AccountId) -> Tag { impl ChainApi for TestApi { type Block = Block; - type Hash = H256; type Error = sp_transaction_pool::error::Error; type ValidationFuture = Ready>; type BodyFuture = Ready>>>; @@ -107,7 +106,7 @@ impl ChainApi for TestApi { }) } - fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (Self::Hash, usize) { + fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (H256, usize) { let encoded = uxt.encode(); (blake2_256(&encoded).into(), encoded.len()) } diff --git a/client/transaction-pool/graph/src/lib.rs b/client/transaction-pool/graph/src/lib.rs index 04e5d0d3fb..b4646c6055 100644 --- a/client/transaction-pool/graph/src/lib.rs +++ b/client/transaction-pool/graph/src/lib.rs @@ -38,8 +38,6 @@ pub mod watcher; pub use self::base_pool::Transaction; pub use self::pool::{ - Pool, - Options, ChainApi, EventStream, ExtrinsicFor, - BlockHash, ExHash, NumberFor, TransactionFor, - ValidatedTransaction, + Pool, Options, ChainApi, EventStream, ExtrinsicFor, ExtrinsicHash, + BlockHash, NumberFor, TransactionFor, ValidatedTransaction, }; diff --git a/client/transaction-pool/graph/src/listener.rs b/client/transaction-pool/graph/src/listener.rs index 2923f2b34a..1bc3720fa6 100644 --- a/client/transaction-pool/graph/src/listener.rs +++ b/client/transaction-pool/graph/src/listener.rs @@ -22,14 +22,14 @@ use std::{ }; use linked_hash_map::LinkedHashMap; use serde::Serialize; -use crate::{watcher, ChainApi, BlockHash}; +use crate::{watcher, ChainApi, ExtrinsicHash, BlockHash}; use log::{debug, trace, warn}; use sp_runtime::traits; /// Extrinsic pool default listener. -pub struct Listener { - watchers: HashMap>>, - finality_watchers: LinkedHashMap, Vec>, +pub struct Listener { + watchers: HashMap>>, + finality_watchers: LinkedHashMap, Vec>, } /// Maximum number of blocks awaiting finality at any time. @@ -45,7 +45,7 @@ impl Default for Listener { } impl Listener { - fn fire(&mut self, hash: &H, fun: F) where F: FnOnce(&mut watcher::Sender>) { + fn fire(&mut self, hash: &H, fun: F) where F: FnOnce(&mut watcher::Sender>) { let clean = if let Some(h) = self.watchers.get_mut(hash) { fun(h); h.is_done() @@ -61,7 +61,7 @@ impl Listener { /// Creates a new watcher for given verified extrinsic. /// /// The watcher can be used to subscribe to life-cycle events of that extrinsic. - pub fn create_watcher(&mut self, hash: H) -> watcher::Watcher> { + pub fn create_watcher(&mut self, hash: H) -> watcher::Watcher> { let sender = self.watchers.entry(hash.clone()).or_insert_with(watcher::Sender::default); sender.new_watcher(hash) } diff --git a/client/transaction-pool/graph/src/pool.rs b/client/transaction-pool/graph/src/pool.rs index 4f41e91109..e4d81c38ae 100644 --- a/client/transaction-pool/graph/src/pool.rs +++ b/client/transaction-pool/graph/src/pool.rs @@ -17,19 +17,16 @@ // along with this program. If not, see . use std::{ - hash, collections::HashMap, sync::Arc, }; -use crate::base_pool as base; -use crate::watcher::Watcher; -use serde::Serialize; +use crate::{base_pool as base, watcher::Watcher}; use futures::{Future, FutureExt}; use sp_runtime::{ generic::BlockId, - traits::{self, SaturatedConversion}, + traits::{self, SaturatedConversion, Block as BlockT}, transaction_validity::{ TransactionValidity, TransactionTag as Tag, TransactionValidityError, TransactionSource, }, @@ -44,19 +41,19 @@ pub use crate::validated_pool::ValidatedTransaction; /// Modification notification event stream type; pub type EventStream = TracingUnboundedReceiver; -/// Extrinsic hash type for a pool. -pub type ExHash = ::Hash; /// Block hash type for a pool. pub type BlockHash = <::Block as traits::Block>::Hash; +/// Extrinsic hash type for a pool. +pub type ExtrinsicHash = <::Block as traits::Block>::Hash; /// Extrinsic type for a pool. pub type ExtrinsicFor = <::Block as traits::Block>::Extrinsic; /// Block number type for the ChainApi pub type NumberFor = traits::NumberFor<::Block>; /// A type of transaction stored in the pool -pub type TransactionFor = Arc, ExtrinsicFor>>; +pub type TransactionFor = Arc, ExtrinsicFor>>; /// A type of validated transaction stored in the pool. pub type ValidatedTransactionFor = ValidatedTransaction< - ExHash, + ExtrinsicHash, ExtrinsicFor, ::Error, >; @@ -64,15 +61,15 @@ pub type ValidatedTransactionFor = ValidatedTransaction< /// Concrete extrinsic validation and query logic. pub trait ChainApi: Send + Sync { /// Block type. - type Block: traits::Block; - /// Transaction Hash type - type Hash: hash::Hash + Eq + traits::Member + Serialize; + type Block: BlockT; /// Error type. type Error: From + error::IntoPoolError; /// Validate transaction future. type ValidationFuture: Future> + Send + Unpin; /// Body future (since block body might be remote) - type BodyFuture: Future::Extrinsic>>, Self::Error>> + Unpin + Send + 'static; + type BodyFuture: Future< + Output = Result::Extrinsic>>, Self::Error> + > + Unpin + Send + 'static; /// Verify extrinsic at given block. fn validate_transaction( @@ -83,13 +80,19 @@ pub trait ChainApi: Send + Sync { ) -> Self::ValidationFuture; /// Returns a block number given the block id. - fn block_id_to_number(&self, at: &BlockId) -> Result>, Self::Error>; + fn block_id_to_number( + &self, + at: &BlockId, + ) -> Result>, Self::Error>; /// Returns a block hash given the block id. - fn block_id_to_hash(&self, at: &BlockId) -> Result>, Self::Error>; + fn block_id_to_hash( + &self, + at: &BlockId, + ) -> Result::Hash>, Self::Error>; /// Returns hash and encoding length of the extrinsic. - fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (Self::Hash, usize); + fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (ExtrinsicHash, usize); /// Returns a block body given the block id. fn block_body(&self, at: &BlockId) -> Self::BodyFuture; @@ -130,7 +133,6 @@ pub struct Pool { #[cfg(not(target_os = "unknown"))] impl parity_util_mem::MallocSizeOf for Pool where - B::Hash: parity_util_mem::MallocSizeOf, ExtrinsicFor: parity_util_mem::MallocSizeOf, { fn size_of(&self, ops: &mut parity_util_mem::MallocSizeOfOps) -> usize { @@ -153,7 +155,7 @@ impl Pool { source: TransactionSource, xts: T, force: bool, - ) -> Result, B::Error>>, B::Error> where + ) -> Result, B::Error>>, B::Error> where T: IntoIterator>, { let validated_pool = self.validated_pool.clone(); @@ -172,7 +174,7 @@ impl Pool { at: &BlockId, source: TransactionSource, xt: ExtrinsicFor, - ) -> Result, B::Error> { + ) -> Result, B::Error> { self.submit_at(at, source, std::iter::once(xt), false) .map(|import_result| import_result.and_then(|mut import_result| import_result .pop() @@ -187,7 +189,7 @@ impl Pool { at: &BlockId, source: TransactionSource, xt: ExtrinsicFor, - ) -> Result, BlockHash>, B::Error> { + ) -> Result, ExtrinsicHash>, B::Error> { let block_number = self.resolve_block_number(at)?; let (_, tx) = self.verify_one( at, block_number, source, xt, false @@ -198,7 +200,7 @@ impl Pool { /// Resubmit some transaction that were validated elsewhere. pub fn resubmit( &self, - revalidated_transactions: HashMap, ValidatedTransactionFor>, + revalidated_transactions: HashMap, ValidatedTransactionFor>, ) { let now = Instant::now(); @@ -215,7 +217,11 @@ impl Pool { /// Used to clear the pool from transactions that were part of recently imported block. /// The main difference from the `prune` is that we do not revalidate any transactions /// and ignore unknown passed hashes. - pub fn prune_known(&self, at: &BlockId, hashes: &[ExHash]) -> Result<(), B::Error> { + pub fn prune_known( + &self, + at: &BlockId, + hashes: &[ExtrinsicHash], + ) -> Result<(), B::Error> { // Get details of all extrinsics that are already in the pool let in_pool_tags = self.validated_pool.extrinsics_tags(hashes) .into_iter().filter_map(|x| x).flat_map(|x| x); @@ -299,7 +305,7 @@ impl Pool { &self, at: &BlockId, tags: impl IntoIterator, - known_imported_hashes: impl IntoIterator> + Clone, + known_imported_hashes: impl IntoIterator> + Clone, ) -> Result<(), B::Error> { log::debug!(target: "txpool", "Pruning at {:?}", at); // Prune all transactions that provide given tags @@ -336,7 +342,7 @@ impl Pool { } /// Returns transaction hash - pub fn hash_of(&self, xt: &ExtrinsicFor) -> ExHash { + pub fn hash_of(&self, xt: &ExtrinsicFor) -> ExtrinsicHash { self.validated_pool.api().hash_and_length(xt).0 } @@ -353,7 +359,7 @@ impl Pool { at: &BlockId, xts: impl IntoIterator)>, force: bool, - ) -> Result, ValidatedTransactionFor>, B::Error> { + ) -> Result, ValidatedTransactionFor>, B::Error> { // we need a block number to compute tx validity let block_number = self.resolve_block_number(at)?; let mut result = HashMap::new(); @@ -379,7 +385,7 @@ impl Pool { source: TransactionSource, xt: ExtrinsicFor, force: bool, - ) -> (ExHash, ValidatedTransactionFor) { + ) -> (ExtrinsicHash, ValidatedTransactionFor) { let (hash, bytes) = self.validated_pool.api().hash_and_length(&xt); if !force && self.validated_pool.is_banned(&hash) { return ( @@ -444,9 +450,12 @@ mod tests { use futures::executor::block_on; use super::*; use sp_transaction_pool::TransactionStatus; - use sp_runtime::transaction_validity::{ValidTransaction, InvalidTransaction, TransactionSource}; + use sp_runtime::{ + traits::Hash, + transaction_validity::{ValidTransaction, InvalidTransaction, TransactionSource}, + }; use codec::Encode; - use substrate_test_runtime::{Block, Extrinsic, Transfer, H256, AccountId}; + use substrate_test_runtime::{Block, Extrinsic, Transfer, H256, AccountId, Hashing}; use assert_matches::assert_matches; use wasm_timer::Instant; use crate::base_pool::Limit; @@ -457,14 +466,13 @@ mod tests { #[derive(Clone, Debug, Default)] struct TestApi { delay: Arc>>>, - invalidate: Arc>>, - clear_requirements: Arc>>, - add_requirements: Arc>>, + invalidate: Arc>>, + clear_requirements: Arc>>, + add_requirements: Arc>>, } impl ChainApi for TestApi { type Block = Block; - type Hash = u64; type Error = error::Error; type ValidationFuture = futures::future::Ready>; type BodyFuture = futures::future::Ready>>>; @@ -518,7 +526,10 @@ mod tests { } /// Returns a block number given the block id. - fn block_id_to_number(&self, at: &BlockId) -> Result>, Self::Error> { + fn block_id_to_number( + &self, + at: &BlockId, + ) -> Result>, Self::Error> { Ok(match at { BlockId::Number(num) => Some(*num), BlockId::Hash(_) => None, @@ -526,7 +537,10 @@ mod tests { } /// Returns a block hash given the block id. - fn block_id_to_hash(&self, at: &BlockId) -> Result>, Self::Error> { + fn block_id_to_hash( + &self, + at: &BlockId, + ) -> Result::Hash>, Self::Error> { Ok(match at { BlockId::Number(num) => Some(H256::from_low_u64_be(*num)).into(), BlockId::Hash(_) => None, @@ -534,12 +548,10 @@ mod tests { } /// Hash the extrinsic. - fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (Self::Hash, usize) { - let len = uxt.encode().len(); - ( - (H256::from(uxt.transfer().from.clone()).to_low_u64_be() << 5) + uxt.transfer().nonce, - len - ) + fn hash_and_length(&self, uxt: &ExtrinsicFor) -> (BlockHash, usize) { + let encoded = uxt.encode(); + let len = encoded.len(); + (Hashing::hash(&encoded), len) } fn block_body(&self, _id: &BlockId) -> Self::BodyFuture { @@ -599,19 +611,19 @@ mod tests { #[test] fn should_notify_about_pool_events() { - let stream = { + let (stream, hash0, hash1) = { // given let pool = pool(); let stream = pool.validated_pool().import_notification_stream(); // when - let _hash = block_on(pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Transfer { + let hash0 = block_on(pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Transfer { from: AccountId::from_h256(H256::from_low_u64_be(1)), to: AccountId::from_h256(H256::from_low_u64_be(2)), amount: 5, nonce: 0, }))).unwrap(); - let _hash = block_on(pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Transfer { + let hash1 = block_on(pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Transfer { from: AccountId::from_h256(H256::from_low_u64_be(1)), to: AccountId::from_h256(H256::from_low_u64_be(2)), amount: 5, @@ -627,13 +639,14 @@ mod tests { assert_eq!(pool.validated_pool().status().ready, 2); assert_eq!(pool.validated_pool().status().future, 1); - stream + + (stream, hash0, hash1) }; // then let mut it = futures::executor::block_on_stream(stream); - assert_eq!(it.next(), Some(32)); - assert_eq!(it.next(), Some(33)); + assert_eq!(it.next(), Some(hash0)); + assert_eq!(it.next(), Some(hash1)); assert_eq!(it.next(), None); } @@ -795,7 +808,10 @@ mod tests { // then let mut stream = futures::executor::block_on_stream(watcher.into_stream()); assert_eq!(stream.next(), Some(TransactionStatus::Ready)); - assert_eq!(stream.next(), Some(TransactionStatus::InBlock(H256::from_low_u64_be(2).into()))); + assert_eq!( + stream.next(), + Some(TransactionStatus::InBlock(H256::from_low_u64_be(2).into())), + ); } #[test] @@ -812,14 +828,19 @@ mod tests { assert_eq!(pool.validated_pool().status().future, 0); // when - block_on(pool.prune_tags(&BlockId::Number(2), vec![vec![0u8]], vec![2u64])).unwrap(); + block_on( + pool.prune_tags(&BlockId::Number(2), vec![vec![0u8]], vec![watcher.hash().clone()]), + ).unwrap(); assert_eq!(pool.validated_pool().status().ready, 0); assert_eq!(pool.validated_pool().status().future, 0); // then let mut stream = futures::executor::block_on_stream(watcher.into_stream()); assert_eq!(stream.next(), Some(TransactionStatus::Ready)); - assert_eq!(stream.next(), Some(TransactionStatus::InBlock(H256::from_low_u64_be(2).into()))); + assert_eq!( + stream.next(), + Some(TransactionStatus::InBlock(H256::from_low_u64_be(2).into())), + ); } #[test] diff --git a/client/transaction-pool/graph/src/validated_pool.rs b/client/transaction-pool/graph/src/validated_pool.rs index 9ab45e3b26..d730b892e3 100644 --- a/client/transaction-pool/graph/src/validated_pool.rs +++ b/client/transaction-pool/graph/src/validated_pool.rs @@ -22,7 +22,7 @@ use std::{ sync::Arc, }; -use crate::{base_pool as base, BlockHash}; +use crate::base_pool as base; use crate::listener::Listener; use crate::rotator::PoolRotator; use crate::watcher::Watcher; @@ -39,7 +39,9 @@ use wasm_timer::Instant; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; use crate::base_pool::PruneStatus; -use crate::pool::{EventStream, Options, ChainApi, ExHash, ExtrinsicFor, TransactionFor}; +use crate::pool::{ + EventStream, Options, ChainApi, BlockHash, ExtrinsicHash, ExtrinsicFor, TransactionFor, +}; /// Pre-validated transaction. Validated pool only accepts transactions wrapped in this enum. #[derive(Debug)] @@ -82,7 +84,7 @@ impl ValidatedTransaction { /// A type of validated transaction stored in the pool. pub type ValidatedTransactionFor = ValidatedTransaction< - ExHash, + ExtrinsicHash, ExtrinsicFor, ::Error, >; @@ -91,19 +93,18 @@ pub type ValidatedTransactionFor = ValidatedTransaction< pub struct ValidatedPool { api: Arc, options: Options, - listener: RwLock, B>>, + listener: RwLock, B>>, pool: RwLock, + ExtrinsicHash, ExtrinsicFor, >>, - import_notification_sinks: Mutex>>>, - rotator: PoolRotator>, + import_notification_sinks: Mutex>>>, + rotator: PoolRotator>, } #[cfg(not(target_os = "unknown"))] impl parity_util_mem::MallocSizeOf for ValidatedPool where - B::Hash: parity_util_mem::MallocSizeOf, ExtrinsicFor: parity_util_mem::MallocSizeOf, { fn size_of(&self, ops: &mut parity_util_mem::MallocSizeOfOps) -> usize { @@ -127,17 +128,17 @@ impl ValidatedPool { } /// Bans given set of hashes. - pub fn ban(&self, now: &Instant, hashes: impl IntoIterator>) { + pub fn ban(&self, now: &Instant, hashes: impl IntoIterator>) { self.rotator.ban(now, hashes) } /// Returns true if transaction with given hash is currently banned from the pool. - pub fn is_banned(&self, hash: &ExHash) -> bool { + pub fn is_banned(&self, hash: &ExtrinsicHash) -> bool { self.rotator.is_banned(hash) } /// Imports a bunch of pre-validated transactions to the pool. - pub fn submit(&self, txs: T) -> Vec, B::Error>> where + pub fn submit(&self, txs: T) -> Vec, B::Error>> where T: IntoIterator> { let results = txs.into_iter() @@ -158,7 +159,7 @@ impl ValidatedPool { } /// Submit single pre-validated transaction to the pool. - fn submit_one(&self, tx: ValidatedTransactionFor) -> Result, B::Error> { + fn submit_one(&self, tx: ValidatedTransactionFor) -> Result, B::Error> { match tx { ValidatedTransaction::Valid(tx) => { let imported = self.pool.write().import(tx)?; @@ -183,7 +184,7 @@ impl ValidatedPool { } } - fn enforce_limits(&self) -> HashSet> { + fn enforce_limits(&self) -> HashSet> { let status = self.pool.read().status(); let ready_limit = &self.options.ready; let future_limit = &self.options.future; @@ -228,7 +229,7 @@ impl ValidatedPool { pub fn submit_and_watch( &self, tx: ValidatedTransactionFor, - ) -> Result, BlockHash>, B::Error> { + ) -> Result, ExtrinsicHash>, B::Error> { match tx { ValidatedTransaction::Valid(tx) => { let hash = self.api.hash_and_length(&tx.data).0; @@ -250,7 +251,7 @@ impl ValidatedPool { /// /// Removes and then submits passed transactions and all dependent transactions. /// Transactions that are missing from the pool are not submitted. - pub fn resubmit(&self, mut updated_transactions: HashMap, ValidatedTransactionFor>) { + pub fn resubmit(&self, mut updated_transactions: HashMap, ValidatedTransactionFor>) { #[derive(Debug, Clone, Copy, PartialEq)] enum Status { Future, Ready, Failed, Dropped }; @@ -369,7 +370,7 @@ impl ValidatedPool { } /// For each extrinsic, returns tags that it provides (if known), or None (if it is unknown). - pub fn extrinsics_tags(&self, hashes: &[ExHash]) -> Vec>> { + pub fn extrinsics_tags(&self, hashes: &[ExtrinsicHash]) -> Vec>> { self.pool.read().by_hashes(&hashes) .into_iter() .map(|existing_in_pool| existing_in_pool @@ -378,7 +379,7 @@ impl ValidatedPool { } /// Get ready transaction by hash - pub fn ready_by_hash(&self, hash: &ExHash) -> Option> { + pub fn ready_by_hash(&self, hash: &ExtrinsicHash) -> Option> { self.pool.read().ready_by_hash(hash) } @@ -386,7 +387,7 @@ impl ValidatedPool { pub fn prune_tags( &self, tags: impl IntoIterator, - ) -> Result, ExtrinsicFor>, B::Error> { + ) -> Result, ExtrinsicFor>, B::Error> { // Perform tag-based pruning in the base pool let status = self.pool.write().prune_tags(tags); // Notify event listeners of all transactions @@ -408,8 +409,8 @@ impl ValidatedPool { pub fn resubmit_pruned( &self, at: &BlockId, - known_imported_hashes: impl IntoIterator> + Clone, - pruned_hashes: Vec>, + known_imported_hashes: impl IntoIterator> + Clone, + pruned_hashes: Vec>, pruned_xts: Vec>, ) -> Result<(), B::Error> { debug_assert_eq!(pruned_hashes.len(), pruned_xts.len()); @@ -440,7 +441,7 @@ impl ValidatedPool { pub fn fire_pruned( &self, at: &BlockId, - hashes: impl Iterator>, + hashes: impl Iterator>, ) -> Result<(), B::Error> { let header_hash = self.api.block_id_to_hash(at)? .ok_or_else(|| error::Error::InvalidBlockId(format!("{:?}", at)).into())?; @@ -473,7 +474,7 @@ impl ValidatedPool { .map(|tx| tx.hash.clone()) .collect::>() }; - let futures_to_remove: Vec> = { + let futures_to_remove: Vec> = { let p = self.pool.read(); let mut hashes = Vec::new(); for tx in p.futures() { @@ -494,7 +495,7 @@ impl ValidatedPool { /// Get rotator reference. #[cfg(test)] - pub fn rotator(&self) -> &PoolRotator> { + pub fn rotator(&self) -> &PoolRotator> { &self.rotator } @@ -507,14 +508,14 @@ impl ValidatedPool { /// /// Consumers of this stream should use the `ready` method to actually get the /// pending transactions in the right order. - pub fn import_notification_stream(&self) -> EventStream> { + pub fn import_notification_stream(&self) -> EventStream> { let (sink, stream) = tracing_unbounded("mpsc_import_notifications"); self.import_notification_sinks.lock().push(sink); stream } /// Invoked when extrinsics are broadcasted. - pub fn on_broadcasted(&self, propagated: HashMap, Vec>) { + pub fn on_broadcasted(&self, propagated: HashMap, Vec>) { let mut listener = self.listener.write(); for (hash, peers) in propagated.into_iter() { listener.broadcasted(&hash, peers); @@ -527,7 +528,7 @@ impl ValidatedPool { /// to prevent them from entering the pool right away. /// Note this is not the case for the dependent transactions - those may /// still be valid so we want to be able to re-import them. - pub fn remove_invalid(&self, hashes: &[ExHash]) -> Vec> { + pub fn remove_invalid(&self, hashes: &[ExtrinsicHash]) -> Vec> { // early exit in case there is no invalid transactions. if hashes.is_empty() { return vec![]; diff --git a/client/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs index 725fb6ec4a..79315c2724 100644 --- a/client/transaction-pool/src/api.rs +++ b/client/transaction-pool/src/api.rs @@ -25,9 +25,7 @@ use futures::{ }; use sc_client_api::{ - blockchain::HeaderBackend, - light::{Fetcher, RemoteCallRequest, RemoteBodyRequest}, - BlockBackend, + blockchain::HeaderBackend, light::{Fetcher, RemoteCallRequest, RemoteBodyRequest}, BlockBackend, }; use sp_runtime::{ generic::BlockId, traits::{self, Block as BlockT, BlockIdTo, Header as HeaderT, Hash as HashT}, @@ -45,10 +43,7 @@ pub struct FullChainApi { _marker: PhantomData, } -impl FullChainApi where - Block: BlockT, - Client: ProvideRuntimeApi + BlockIdTo, -{ +impl FullChainApi { /// Create new transaction pool logic. pub fn new(client: Arc) -> Self { FullChainApi { @@ -58,12 +53,13 @@ impl FullChainApi where .name_prefix("txpool-verifier") .create() .expect("Failed to spawn verifier threads, that are critical for node operation."), - _marker: Default::default() + _marker: Default::default(), } } } -impl sc_transaction_graph::ChainApi for FullChainApi where +impl sc_transaction_graph::ChainApi for FullChainApi +where Block: BlockT, Client: ProvideRuntimeApi + BlockBackend + BlockIdTo, Client: Send + Sync + 'static, @@ -71,9 +67,10 @@ impl sc_transaction_graph::ChainApi for FullChainApi: Send, { type Block = Block; - type Hash = Block::Hash; type Error = error::Error; - type ValidationFuture = Pin> + Send>>; + type ValidationFuture = Pin< + Box> + Send> + >; type BodyFuture = Ready::Extrinsic>>>>; fn block_body(&self, id: &BlockId) -> Self::BodyFuture { @@ -136,7 +133,10 @@ impl sc_transaction_graph::ChainApi for FullChainApi) -> (Self::Hash, usize) { + fn hash_and_length( + &self, + ex: &sc_transaction_graph::ExtrinsicFor, + ) -> (sc_transaction_graph::ExtrinsicHash, usize) { ex.using_encoded(|x| { ( as traits::Hash>::hash(x), x.len()) }) @@ -150,11 +150,7 @@ pub struct LightChainApi { _phantom: PhantomData, } -impl LightChainApi where - Block: BlockT, - Client: HeaderBackend, - F: Fetcher, -{ +impl LightChainApi { /// Create new transaction pool logic. pub fn new(client: Arc, fetcher: Arc) -> Self { LightChainApi { @@ -165,16 +161,23 @@ impl LightChainApi where } } -impl sc_transaction_graph::ChainApi for LightChainApi where - Block: BlockT, - Client: HeaderBackend + 'static, - F: Fetcher + 'static, +impl sc_transaction_graph::ChainApi for + LightChainApi where + Block: BlockT, + Client: HeaderBackend + 'static, + F: Fetcher + 'static, { type Block = Block; - type Hash = Block::Hash; type Error = error::Error; - type ValidationFuture = Box> + Send + Unpin>; - type BodyFuture = Pin::Extrinsic>>>> + Send>>; + type ValidationFuture = Box< + dyn Future> + Send + Unpin + >; + type BodyFuture = Pin< + Box< + dyn Future::Extrinsic>>>> + + Send + > + >; fn validate_transaction( &self, @@ -211,15 +214,24 @@ impl sc_transaction_graph::ChainApi for LightChainApi) -> error::Result>> { + fn block_id_to_number( + &self, + at: &BlockId, + ) -> error::Result>> { Ok(self.client.block_number_from_id(at)?) } - fn block_id_to_hash(&self, at: &BlockId) -> error::Result>> { + fn block_id_to_hash( + &self, + at: &BlockId, + ) -> error::Result>> { Ok(self.client.block_hash_from_id(at)?) } - fn hash_and_length(&self, ex: &sc_transaction_graph::ExtrinsicFor) -> (Self::Hash, usize) { + fn hash_and_length( + &self, + ex: &sc_transaction_graph::ExtrinsicFor, + ) -> (sc_transaction_graph::ExtrinsicHash, usize) { ex.using_encoded(|x| { (<::Hashing as HashT>::hash(x), x.len()) }) diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 05d7189a04..326c5e1a75 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -35,7 +35,7 @@ pub use sc_transaction_graph as txpool; pub use crate::api::{FullChainApi, LightChainApi}; use std::{collections::HashMap, sync::Arc, pin::Pin}; -use futures::{prelude::*, future::ready, channel::oneshot}; +use futures::{prelude::*, future::{ready, self}, channel::oneshot}; use parking_lot::Mutex; use sp_runtime::{ @@ -47,14 +47,19 @@ use sp_transaction_pool::{ TransactionStatusStreamFor, MaintainedTransactionPool, PoolFuture, ChainEvent, TransactionSource, }; +use sc_transaction_graph::ChainApi; use wasm_timer::Instant; use prometheus_endpoint::Registry as PrometheusRegistry; use crate::metrics::MetricsLink as PrometheusMetrics; -type BoxedReadyIterator = Box>> + Send>; +type BoxedReadyIterator = Box< + dyn Iterator>> + Send +>; -type ReadyIteratorFor = BoxedReadyIterator, sc_transaction_graph::ExtrinsicFor>; +type ReadyIteratorFor = BoxedReadyIterator< + sc_transaction_graph::ExtrinsicHash, sc_transaction_graph::ExtrinsicFor +>; type PolledIterator = Pin> + Send>>; @@ -62,7 +67,7 @@ type PolledIterator = Pin where Block: BlockT, - PoolApi: sc_transaction_graph::ChainApi, + PoolApi: ChainApi, { pool: Arc>, api: Arc, @@ -116,8 +121,7 @@ impl ReadyPoll { #[cfg(not(target_os = "unknown"))] impl parity_util_mem::MallocSizeOf for BasicPool where - PoolApi: sc_transaction_graph::ChainApi, - PoolApi::Hash: parity_util_mem::MallocSizeOf, + PoolApi: ChainApi, Block: BlockT, { fn size_of(&self, ops: &mut parity_util_mem::MallocSizeOfOps) -> usize { @@ -146,7 +150,7 @@ pub enum RevalidationType { impl BasicPool where Block: BlockT, - PoolApi: sc_transaction_graph::ChainApi + 'static, + PoolApi: ChainApi + 'static, { /// Create new basic transaction pool with provided api. /// @@ -226,11 +230,13 @@ impl BasicPool impl TransactionPool for BasicPool where Block: BlockT, - PoolApi: 'static + sc_transaction_graph::ChainApi, + PoolApi: 'static + ChainApi, { type Block = PoolApi::Block; - type Hash = sc_transaction_graph::ExHash; - type InPoolTransaction = sc_transaction_graph::base_pool::Transaction, TransactionFor>; + type Hash = sc_transaction_graph::ExtrinsicHash; + type InPoolTransaction = sc_transaction_graph::base_pool::Transaction< + TxHash, TransactionFor + >; type Error = PoolApi::Error; fn submit_at( @@ -429,22 +435,51 @@ impl RevalidationStatus { } } +/// Prune the known txs for the given block. +async fn prune_known_txs_for_block>( + block_id: BlockId, + api: &Api, + pool: &sc_transaction_graph::Pool, +) { + // We don't query block if we won't prune anything + if pool.validated_pool().status().is_empty() { + return; + } + + let hashes = api.block_body(&block_id).await + .unwrap_or_else(|e| { + log::warn!("Prune known transactions: error request {:?}!", e); + None + }) + .unwrap_or_default() + .into_iter() + .map(|tx| pool.hash_of(&tx)) + .collect::>(); + + if let Err(e) = pool.prune_known(&block_id, &hashes) { + log::error!("Cannot prune known in the pool {:?}!", e); + } +} + impl MaintainedTransactionPool for BasicPool where Block: BlockT, - PoolApi: 'static + sc_transaction_graph::ChainApi, + PoolApi: 'static + ChainApi, { fn maintain(&self, event: ChainEvent) -> Pin + Send>> { match event { - ChainEvent::NewBlock { id, retracted, .. } => { - let id = id.clone(); + ChainEvent::NewBlock { id, tree_route, is_new_best, .. } => { let pool = self.pool.clone(); let api = self.api.clone(); let block_number = match api.block_id_to_number(&id) { Ok(Some(number)) => number, _ => { - log::trace!(target: "txpool", "Skipping chain event - no number for that block {:?}", id); + log::trace!( + target: "txpool", + "Skipping chain event - no number for that block {:?}", + id, + ); return Box::pin(ready(())); } }; @@ -455,40 +490,40 @@ impl MaintainedTransactionPool for BasicPool Some(20.into()), ); let revalidation_strategy = self.revalidation_strategy.clone(); - let retracted = retracted.clone(); let revalidation_queue = self.revalidation_queue.clone(); let ready_poll = self.ready_poll.clone(); async move { - // We don't query block if we won't prune anything - if !pool.validated_pool().status().is_empty() { - let hashes = api.block_body(&id).await - .unwrap_or_else(|e| { - log::warn!("Prune known transactions: error request {:?}!", e); - None - }) - .unwrap_or_default() - .into_iter() - .map(|tx| pool.hash_of(&tx)) - .collect::>(); - - if let Err(e) = pool.prune_known(&id, &hashes) { - log::error!("Cannot prune known in the pool {:?}!", e); - } + // If there is a tree route, we use this to prune known tx based on the enacted + // blocks and otherwise we only prune known txs if the block is + // the new best block. + if let Some(ref tree_route) = tree_route { + future::join_all( + tree_route + .enacted() + .iter().map(|h| + prune_known_txs_for_block( + BlockId::Hash(h.hash.clone()), + &*api, + &*pool, + ), + ), + ).await; + } else if is_new_best { + prune_known_txs_for_block(id.clone(), &*api, &*pool).await; } - let extra_pool = pool.clone(); - // After #5200 lands, this arguably might be moved to the handler of "all blocks notification". - ready_poll.lock().trigger(block_number, move || Box::new(extra_pool.validated_pool().ready())); - - if next_action.resubmit { + if let (true, Some(tree_route)) = (next_action.resubmit, tree_route) { let mut resubmit_transactions = Vec::new(); - for retracted_hash in retracted { + for retracted in tree_route.retracted() { + let hash = retracted.hash.clone(); + // notify txs awaiting finality that it has been retracted - pool.validated_pool().on_block_retracted(retracted_hash.clone()); + pool.validated_pool().on_block_retracted(hash.clone()); - let block_transactions = api.block_body(&BlockId::hash(retracted_hash.clone())).await + let block_transactions = api.block_body(&BlockId::hash(hash)) + .await .unwrap_or_else(|e| { log::warn!("Failed to fetch block body {:?}!", e); None @@ -499,23 +534,37 @@ impl MaintainedTransactionPool for BasicPool resubmit_transactions.extend(block_transactions); } + if let Err(e) = pool.submit_at( &id, // These transactions are coming from retracted blocks, we should // simply consider them external. TransactionSource::External, resubmit_transactions, - true + true, ).await { log::debug!( target: "txpool", - "[{:?}] Error re-submitting transactions: {:?}", id, e + "[{:?}] Error re-submitting transactions: {:?}", + id, + e, ) } } + let extra_pool = pool.clone(); + // After #5200 lands, this arguably might be moved to the + // handler of "all blocks notification". + ready_poll.lock().trigger( + block_number, + move || Box::new(extra_pool.validated_pool().ready()), + ); + if next_action.revalidate { - let hashes = pool.validated_pool().ready().map(|tx| tx.hash.clone()).collect(); + let hashes = pool.validated_pool() + .ready() + .map(|tx| tx.hash.clone()) + .collect(); revalidation_queue.revalidate_later(block_number, hashes).await; } diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index 423ff92ba4..05a2076c66 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -20,7 +20,7 @@ use std::{sync::Arc, pin::Pin, collections::{HashMap, HashSet, BTreeMap}}; -use sc_transaction_graph::{ChainApi, Pool, ExHash, NumberFor, ValidatedTransaction}; +use sc_transaction_graph::{ChainApi, Pool, ExtrinsicHash, NumberFor, ValidatedTransaction}; use sp_runtime::traits::{Zero, SaturatedConversion}; use sp_runtime::generic::BlockId; use sp_runtime::transaction_validity::TransactionValidityError; @@ -39,7 +39,7 @@ const BACKGROUND_REVALIDATION_BATCH_SIZE: usize = 20; /// Payload from queue to worker. struct WorkerPayload { at: NumberFor, - transactions: Vec>, + transactions: Vec>, } /// Async revalidation worker. @@ -49,8 +49,8 @@ struct RevalidationWorker { api: Arc, pool: Arc>, best_block: NumberFor, - block_ordered: BTreeMap, HashSet>>, - members: HashMap, NumberFor>, + block_ordered: BTreeMap, HashSet>>, + members: HashMap, NumberFor>, } impl Unpin for RevalidationWorker {} @@ -63,7 +63,7 @@ async fn batch_revalidate( pool: Arc>, api: Arc, at: NumberFor, - batch: impl IntoIterator>, + batch: impl IntoIterator>, ) { let mut invalid_hashes = Vec::new(); let mut revalidated = HashMap::new(); @@ -129,7 +129,7 @@ impl RevalidationWorker { } } - fn prepare_batch(&mut self) -> Vec> { + fn prepare_batch(&mut self) -> Vec> { let mut queued_exts = Vec::new(); let mut left = BACKGROUND_REVALIDATION_BATCH_SIZE; @@ -334,7 +334,7 @@ where /// If queue configured with background worker, this will return immediately. /// If queue configured without background worker, this will resolve after /// revalidation is actually done. - pub async fn revalidate_later(&self, at: NumberFor, transactions: Vec>) { + pub async fn revalidate_later(&self, at: NumberFor, transactions: Vec>) { if transactions.len() > 0 { log::debug!(target: "txpool", "Sent {} transactions to revalidation queue", transactions.len()); } @@ -359,9 +359,7 @@ mod tests { use sp_transaction_pool::TransactionSource; use substrate_test_runtime_transaction_pool::{TestApi, uxt}; use futures::executor::block_on; - use substrate_test_runtime_client::{ - AccountKeyring::*, - }; + use substrate_test_runtime_client::AccountKeyring::*; fn setup() -> (Arc, Pool) { let test_api = Arc::new(TestApi::empty()); diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 4f30d5b6c3..dafd829c64 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -25,12 +25,12 @@ use sp_runtime::{ transaction_validity::{ValidTransaction, TransactionSource, InvalidTransaction}, }; use substrate_test_runtime_client::{ - runtime::{Block, Hash, Index, Header, Extrinsic, Transfer}, - AccountKeyring::*, + runtime::{Block, Hash, Index, Header, Extrinsic, Transfer}, AccountKeyring::*, }; use substrate_test_runtime_transaction_pool::{TestApi, uxt}; use futures::{prelude::*, task::Poll}; use codec::Encode; +use std::collections::BTreeSet; fn pool() -> Pool { Pool::new(Default::default(), TestApi::with_alice_nonce(209).into()) @@ -42,7 +42,7 @@ fn maintained_pool() -> ( intervalier::BackSignalControl, ) { let (pool, background_task, notifier) = BasicPool::new_test( - std::sync::Arc::new(TestApi::with_alice_nonce(209)) + Arc::new(TestApi::with_alice_nonce(209)), ); let thread_pool = futures::executor::ThreadPool::new().unwrap(); @@ -112,6 +112,7 @@ fn prune_tags_should_work() { let pending: Vec<_> = pool.validated_pool().ready().map(|a| a.data.transfer().nonce).collect(); assert_eq!(pending, vec![209, 210]); + pool.validated_pool().api().push_block(1, Vec::new()); block_on( pool.prune_tags( &BlockId::number(1), @@ -140,6 +141,37 @@ fn should_ban_invalid_transactions() { block_on(pool.submit_one(&BlockId::number(0), SOURCE, uxt.clone())).unwrap_err(); } +#[test] +fn only_prune_on_new_best() { + let pool = maintained_pool().0; + let uxt = uxt(Alice, 209); + + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, uxt.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(1, vec![uxt.clone()]); + assert_eq!(pool.status().ready, 1); + + let event = ChainEvent::NewBlock { + id: BlockId::Number(1), + is_new_best: false, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 1); + + let header = pool.api.push_block(2, vec![uxt]); + let event = ChainEvent::NewBlock { + id: BlockId::Number(2), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); +} + #[test] fn should_correctly_prune_transactions_providing_more_than_one_tag() { let api = Arc::new(TestApi::with_alice_nonce(209)); @@ -153,6 +185,7 @@ fn should_correctly_prune_transactions_providing_more_than_one_tag() { // remove the transaction that just got imported. api.increment_nonce(Alice.into()); + api.push_block(1, Vec::new()); block_on(pool.prune_tags(&BlockId::number(1), vec![vec![209]], vec![])).expect("1. Pruned"); assert_eq!(pool.validated_pool().status().ready, 0); // it's re-imported to future @@ -160,6 +193,7 @@ fn should_correctly_prune_transactions_providing_more_than_one_tag() { // so now let's insert another transaction that also provides the 155 api.increment_nonce(Alice.into()); + api.push_block(2, Vec::new()); let xt = uxt(Alice, 211); block_on(pool.submit_one(&BlockId::number(2), SOURCE, xt.clone())).expect("2. Imported"); assert_eq!(pool.validated_pool().status().ready, 1); @@ -169,6 +203,7 @@ fn should_correctly_prune_transactions_providing_more_than_one_tag() { // prune it and make sure the pool is empty api.increment_nonce(Alice.into()); + api.push_block(3, Vec::new()); block_on(pool.prune_tags(&BlockId::number(3), vec![vec![155]], vec![])).expect("2. Pruned"); assert_eq!(pool.validated_pool().status().ready, 0); assert_eq!(pool.validated_pool().status().future, 2); @@ -178,21 +213,26 @@ fn block_event(id: u64) -> ChainEvent { ChainEvent::NewBlock { id: BlockId::number(id), is_new_best: true, - retracted: vec![], + tree_route: None, header: header(id), } } -fn block_event_with_retracted(id: u64, retracted: Vec) -> ChainEvent { +fn block_event_with_retracted( + header: Header, + retracted_start: Hash, + api: &TestApi, +) -> ChainEvent { + let tree_route = api.tree_route(retracted_start, header.hash()).expect("Tree route exists"); + ChainEvent::NewBlock { - id: BlockId::number(id), + id: BlockId::hash(header.hash()), is_new_best: true, - retracted: retracted, - header: header(id), + tree_route: Some(Arc::new(tree_route)), + header, } } - #[test] fn should_prune_old_during_maintenance() { let xt = uxt(Alice, 209); @@ -232,17 +272,16 @@ fn should_revalidate_during_maintenance() { #[test] fn should_resubmit_from_retracted_during_maintenance() { let xt = uxt(Alice, 209); - let retracted_hash = Hash::random(); let (pool, _guard, _notifier) = maintained_pool(); block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - pool.api.push_block(1, vec![]); - pool.api.push_fork_block(retracted_hash, vec![xt.clone()]); + let header = pool.api.push_block(1, vec![]); + let fork_header = pool.api.push_block(1, vec![]); - let event = block_event_with_retracted(1, vec![retracted_hash]); + let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api); block_on(pool.maintain(event)); assert_eq!(pool.status().ready, 1); @@ -251,18 +290,17 @@ fn should_resubmit_from_retracted_during_maintenance() { #[test] fn should_not_retain_invalid_hashes_from_retracted() { let xt = uxt(Alice, 209); - let retracted_hash = Hash::random(); let (pool, _guard, mut notifier) = maintained_pool(); block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - pool.api.push_block(1, vec![]); - pool.api.push_fork_block(retracted_hash, vec![xt.clone()]); + let header = pool.api.push_block(1, vec![]); + let fork_header = pool.api.push_block(1, vec![xt.clone()]); pool.api.add_invalid(&xt); - let event = block_event_with_retracted(1, vec![retracted_hash]); + let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api); block_on(pool.maintain(event)); block_on(notifier.next()); @@ -389,15 +427,24 @@ fn should_push_watchers_during_maintaince() { // events for hash2 are: Ready, InBlock assert_eq!( futures::executor::block_on_stream(watcher0).collect::>(), - vec![TransactionStatus::Ready, TransactionStatus::InBlock(header_hash.clone()), TransactionStatus::Finalized(header_hash.clone())], + vec![ + TransactionStatus::Ready, + TransactionStatus::InBlock(header_hash.clone()), + TransactionStatus::Finalized(header_hash.clone())], ); assert_eq!( futures::executor::block_on_stream(watcher1).collect::>(), - vec![TransactionStatus::Ready, TransactionStatus::InBlock(header_hash.clone()), TransactionStatus::Finalized(header_hash.clone())], + vec![ + TransactionStatus::Ready, + TransactionStatus::InBlock(header_hash.clone()), + TransactionStatus::Finalized(header_hash.clone())], ); assert_eq!( futures::executor::block_on_stream(watcher2).collect::>(), - vec![TransactionStatus::Ready, TransactionStatus::InBlock(header_hash.clone()), TransactionStatus::Finalized(header_hash.clone())], + vec![ + TransactionStatus::Ready, + TransactionStatus::InBlock(header_hash.clone()), + TransactionStatus::Finalized(header_hash.clone())], ); } @@ -423,12 +470,12 @@ fn finalization() { ).expect("1. Imported"); pool.api.push_block(2, vec![xt.clone()]); - let header = pool.api.chain().read().header_by_number.get(&2).cloned().unwrap(); + let header = pool.api.chain().read().block_by_number.get(&2).unwrap()[0].header().clone(); let event = ChainEvent::NewBlock { id: BlockId::Hash(header.hash()), is_new_best: true, header: header.clone(), - retracted: vec![] + tree_route: None, }; block_on(pool.maintain(event)); @@ -467,7 +514,6 @@ fn fork_aware_finalization() { let c2; let d2; - // block B1 { let watcher = block_on( @@ -481,7 +527,7 @@ fn fork_aware_finalization() { id: BlockId::Number(2), is_new_best: true, header: header.clone(), - retracted: vec![], + tree_route: None, }; b1 = header.hash(); block_on(pool.maintain(event)); @@ -492,7 +538,7 @@ fn fork_aware_finalization() { // block C2 { - let header = pool.api.push_fork_block_with_parent(b1, vec![from_dave.clone()]); + let header = pool.api.push_block_with_parent(b1, vec![from_dave.clone()]); from_dave_watcher = block_on( pool.submit_and_watch(&BlockId::number(1), SOURCE, from_dave.clone()) ).expect("1. Imported"); @@ -501,7 +547,7 @@ fn fork_aware_finalization() { id: BlockId::Hash(header.hash()), is_new_best: true, header: header.clone(), - retracted: vec![] + tree_route: None, }; c2 = header.hash(); block_on(pool.maintain(event)); @@ -514,13 +560,13 @@ fn fork_aware_finalization() { pool.submit_and_watch(&BlockId::number(1), SOURCE, from_bob.clone()) ).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - let header = pool.api.push_fork_block_with_parent(c2, vec![from_bob.clone()]); + let header = pool.api.push_block_with_parent(c2, vec![from_bob.clone()]); let event = ChainEvent::NewBlock { id: BlockId::Hash(header.hash()), is_new_best: true, header: header.clone(), - retracted: vec![] + tree_route: None, }; d2 = header.hash(); block_on(pool.maintain(event)); @@ -536,14 +582,10 @@ fn fork_aware_finalization() { let header = pool.api.push_block(3, vec![from_charlie.clone()]); canon_watchers.push((watcher, header.hash())); - let event = ChainEvent::NewBlock { - id: BlockId::Number(3), - is_new_best: true, - header: header.clone(), - retracted: vec![c2, d2], - }; + let event = block_event_with_retracted(header.clone(), d2, &*pool.api); block_on(pool.maintain(event)); assert_eq!(pool.status().ready, 2); + let event = ChainEvent::Finalized { hash: header.hash() }; block_on(pool.maintain(event)); } @@ -562,7 +604,7 @@ fn fork_aware_finalization() { id: BlockId::Hash(header.hash()), is_new_best: true, header: header.clone(), - retracted: vec![] + tree_route: None, }; d1 = header.hash(); block_on(pool.maintain(event)); @@ -581,7 +623,7 @@ fn fork_aware_finalization() { id: BlockId::Hash(header.hash()), is_new_best: true, header: header.clone(), - retracted: vec![] + tree_route: None, }; block_on(pool.maintain(event)); assert_eq!(pool.status().ready, 0); @@ -599,7 +641,7 @@ fn fork_aware_finalization() { { - let mut stream= futures::executor::block_on_stream(from_dave_watcher); + let mut stream = futures::executor::block_on_stream(from_dave_watcher); assert_eq!(stream.next(), Some(TransactionStatus::Ready)); assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c2.clone()))); assert_eq!(stream.next(), Some(TransactionStatus::Retracted(c2))); @@ -610,7 +652,7 @@ fn fork_aware_finalization() { } { - let mut stream= futures::executor::block_on_stream(from_bob_watcher); + let mut stream = futures::executor::block_on_stream(from_bob_watcher); assert_eq!(stream.next(), Some(TransactionStatus::Ready)); assert_eq!(stream.next(), Some(TransactionStatus::InBlock(d2.clone()))); assert_eq!(stream.next(), Some(TransactionStatus::Retracted(d2))); @@ -621,6 +663,217 @@ fn fork_aware_finalization() { } } +/// This test ensures that transactions from a fork are re-submitted if +/// the forked block is not part of the retracted blocks. This happens as the +/// retracted block list only contains the route from the old best to the new +/// best, without any further forks. +/// +/// Given the following: +/// +/// -> D0 (old best, tx0) +/// / +/// C - -> D1 (tx1) +/// \ +/// -> D2 (new best) +/// +/// Retracted will contain `D0`, but we need to re-submit `tx0` and `tx1` as both +/// blocks are not part of the canonical chain. +#[test] +fn resubmit_tx_of_fork_that_is_not_part_of_retracted() { + let api = TestApi::empty(); + // starting block A1 (last finalized.) + api.push_block(1, vec![]); + + let (pool, _background, _) = BasicPool::new_test(api.into()); + + let tx0 = uxt(Alice, 1); + let tx1 = uxt(Dave, 2); + pool.api.increment_nonce(Alice.into()); + pool.api.increment_nonce(Dave.into()); + + let d0; + + // Block D0 + { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx0.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(2, vec![tx0.clone()]); + assert_eq!(pool.status().ready, 1); + + let event = ChainEvent::NewBlock { + id: BlockId::Number(2), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + d0 = header.hash(); + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + } + + // Block D1 + { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx1.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(2, vec![tx1.clone()]); + assert_eq!(pool.status().ready, 1); + let event = ChainEvent::NewBlock { + id: BlockId::Hash(header.hash()), + is_new_best: false, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + + // Only transactions from new best should be pruned + assert_eq!(pool.status().ready, 1); + } + + // Block D2 + { + let header = pool.api.push_block(2, vec![]); + let event = block_event_with_retracted(header, d0, &*pool.api); + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 2); + } +} + +#[test] +fn resubmit_from_retracted_fork() { + let api = TestApi::empty(); + // starting block A1 (last finalized.) + api.push_block(1, vec![]); + + let (pool, _background, _) = BasicPool::new_test(api.into()); + + let tx0 = uxt(Alice, 1); + let tx1 = uxt(Dave, 2); + let tx2 = uxt(Bob, 3); + + // Transactions of the fork that will be enacted later + let tx3 = uxt(Eve, 1); + let tx4 = uxt(Ferdie, 2); + let tx5 = uxt(One, 3); + + pool.api.increment_nonce(Alice.into()); + pool.api.increment_nonce(Dave.into()); + pool.api.increment_nonce(Bob.into()); + pool.api.increment_nonce(Eve.into()); + pool.api.increment_nonce(Ferdie.into()); + pool.api.increment_nonce(One.into()); + + // Block D0 + { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx0.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(2, vec![tx0.clone()]); + assert_eq!(pool.status().ready, 1); + + let event = ChainEvent::NewBlock { + id: BlockId::Number(2), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + } + + // Block E0 + { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx1.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(3, vec![tx1.clone()]); + let event = ChainEvent::NewBlock { + id: BlockId::Hash(header.hash()), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + } + + // Block F0 + let f0 = { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx2.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(4, vec![tx2.clone()]); + let event = ChainEvent::NewBlock { + id: BlockId::Hash(header.hash()), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + header.hash() + }; + + // Block D1 + let d1 = { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx3.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block(2, vec![tx3.clone()]); + let event = ChainEvent::NewBlock { + id: BlockId::Hash(header.hash()), + is_new_best: false, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 1); + header.hash() + }; + + // Block E1 + let e1 = { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx4.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block_with_parent(d1.clone(), vec![tx4.clone()]); + let event = ChainEvent::NewBlock { + id: BlockId::Hash(header.hash()), + is_new_best: false, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 2); + header.hash() + }; + + // Block F1 + let f1_header = { + let _ = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, tx5.clone()) + ).expect("1. Imported"); + let header = pool.api.push_block_with_parent(e1.clone(), vec![tx5.clone()]); + // Don't announce the block event to the pool directly, because we will + // re-org to this block. + assert_eq!(pool.status().ready, 3); + header + }; + + let ready = pool.ready().map(|t| t.data.encode()).collect::>(); + let expected_ready = vec![tx3, tx4, tx5].iter().map(Encode::encode).collect::>(); + assert_eq!(expected_ready, ready); + + let event = block_event_with_retracted(f1_header, f0, &*pool.api); + block_on(pool.maintain(event)); + + assert_eq!(pool.status().ready, 3); + let ready = pool.ready().map(|t| t.data.encode()).collect::>(); + let expected_ready = vec![tx0, tx1, tx2].iter().map(Encode::encode).collect::>(); + assert_eq!(expected_ready, ready); +} + #[test] fn ready_set_should_not_resolve_before_block_update() { let (pool, _guard, _notifier) = maintained_pool(); @@ -678,6 +931,7 @@ fn should_not_accept_old_signatures() { use std::convert::TryFrom; let client = Arc::new(substrate_test_runtime_client::new()); + let pool = Arc::new( BasicPool::new_test(Arc::new(FullChainApi::new(client))).0 ); diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index d76d9c7209..689d84d80f 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -12,7 +12,6 @@ documentation = "https://docs.rs/sp-blockchain" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] - [dependencies] log = "0.4.8" lru = "0.4.0" diff --git a/primitives/blockchain/src/header_metadata.rs b/primitives/blockchain/src/header_metadata.rs index a4df04b507..b8d9c5c934 100644 --- a/primitives/blockchain/src/header_metadata.rs +++ b/primitives/blockchain/src/header_metadata.rs @@ -137,7 +137,8 @@ pub fn tree_route>( from = backend.header_metadata(from.parent)?; } - // add the pivot block. and append the reversed to-branch (note that it's reverse order originals) + // add the pivot block. and append the reversed to-branch + // (note that it's reverse order originals) let pivot = from_branch.len(); from_branch.push(HashAndNumber { number: to.number, @@ -182,18 +183,24 @@ pub struct HashAndNumber { /// Tree route from C to E2. Retracted empty. Common is C, enacted [E1, E2] /// C -> E1 -> E2 /// ``` -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct TreeRoute { route: Vec>, pivot: usize, } impl TreeRoute { - /// Get a slice of all retracted blocks in reverse order (towards common ancestor) + /// Get a slice of all retracted blocks in reverse order (towards common ancestor). pub fn retracted(&self) -> &[HashAndNumber] { &self.route[..self.pivot] } + /// Convert into all retracted blocks in reverse order (towards common ancestor). + pub fn into_retracted(mut self) -> Vec> { + self.route.truncate(self.pivot); + self.route + } + /// Get the common ancestor block. This might be one of the two blocks of the /// route. pub fn common_block(&self) -> &HashAndNumber { @@ -213,8 +220,15 @@ pub trait HeaderMetadata { /// Error used in case the header metadata is not found. type Error; - fn header_metadata(&self, hash: Block::Hash) -> Result, Self::Error>; - fn insert_header_metadata(&self, hash: Block::Hash, header_metadata: CachedHeaderMetadata); + fn header_metadata( + &self, + hash: Block::Hash, + ) -> Result, Self::Error>; + fn insert_header_metadata( + &self, + hash: Block::Hash, + header_metadata: CachedHeaderMetadata, + ); fn remove_header_metadata(&self, hash: Block::Hash); } diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index dbb21f34b6..b7673e8da0 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -20,6 +20,7 @@ futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } +sp-blockchain = { version = "2.0.0-rc2", optional = true, path = "../blockchain" } sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } sp-utils = { version = "2.0.0-rc2", default-features = false, path = "../utils" } @@ -32,5 +33,6 @@ std = [ "log", "serde", "sp-api/std", + "sp-blockchain", "sp-runtime/std", ] diff --git a/primitives/transaction-pool/src/pool.rs b/primitives/transaction-pool/src/pool.rs index 762ff06a9e..fa50ef9e41 100644 --- a/primitives/transaction-pool/src/pool.rs +++ b/primitives/transaction-pool/src/pool.rs @@ -255,8 +255,10 @@ pub enum ChainEvent { id: BlockId, /// Header of the just imported block header: B::Header, - /// List of retracted blocks ordered by block number. - retracted: Vec, + /// Tree route from old best to new best that was calculated on import. + /// + /// If `None`, no re-org happened on import. + tree_route: Option>>, }, /// An existing block has been finalized. Finalized { diff --git a/test-utils/runtime/client/src/lib.rs b/test-utils/runtime/client/src/lib.rs index 5b0eafb4a3..f2e049bc0f 100644 --- a/test-utils/runtime/client/src/lib.rs +++ b/test-utils/runtime/client/src/lib.rs @@ -35,12 +35,9 @@ use sp_core::{sr25519, ChangesTrieConfiguration}; use sp_core::storage::{ChildInfo, Storage, StorageChild}; use substrate_test_runtime::genesismap::{GenesisConfig, additional_storage_with_genesis}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HashFor}; -use sc_service::client::{ - light::fetcher::{ - Fetcher, - RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest, - RemoteCallRequest, RemoteChangesRequest, RemoteBodyRequest, - }, +use sc_service::client::light::fetcher::{ + Fetcher, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest, + RemoteCallRequest, RemoteChangesRequest, RemoteBodyRequest, }; /// A prelude to import in tests. diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index eaceef2def..bf6c7450c5 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -208,6 +208,8 @@ pub type AccountSignature = sr25519::Signature; pub type AccountId = ::Signer; /// A simple hash type for all our hashing. pub type Hash = H256; +/// The hashing algorithm used. +pub type Hashing = BlakeTwo256; /// The block number type used in this runtime. pub type BlockNumber = u64; /// Index of a transaction. @@ -219,7 +221,7 @@ pub type Digest = sp_runtime::generic::Digest; /// A test block. pub type Block = sp_runtime::generic::Block; /// A test block's header. -pub type Header = sp_runtime::generic::Header; +pub type Header = sp_runtime::generic::Header; /// Run whatever tests we have. pub fn run_tests(mut input: &[u8]) -> Vec { @@ -404,7 +406,7 @@ impl frame_system::Trait for Runtime { type Index = u64; type BlockNumber = u64; type Hash = H256; - type Hashing = BlakeTwo256; + type Hashing = Hashing; type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; @@ -466,7 +468,7 @@ fn code_using_trie() -> u64 { let mut root = sp_std::default::Default::default(); let _ = { let v = &pairs; - let mut t = TrieDBMut::::new(&mut mdb, &mut root); + let mut t = TrieDBMut::::new(&mut mdb, &mut root); for i in 0..v.len() { let key: &[u8]= &v[i].0; let val: &[u8] = &v[i].1; @@ -477,7 +479,7 @@ fn code_using_trie() -> u64 { t }; - if let Ok(trie) = TrieDB::::new(&mdb, &root) { + if let Ok(trie) = TrieDB::::new(&mdb, &root) { if let Ok(iter) = trie.iter() { let mut iter_pairs = Vec::new(); for pair in iter { diff --git a/test-utils/runtime/transaction-pool/src/lib.rs b/test-utils/runtime/transaction-pool/src/lib.rs index c7778a51da..5140cb8b92 100644 --- a/test-utils/runtime/transaction-pool/src/lib.rs +++ b/test-utils/runtime/transaction-pool/src/lib.rs @@ -23,17 +23,18 @@ use codec::Encode; use parking_lot::RwLock; use sp_runtime::{ generic::{self, BlockId}, - traits::{BlakeTwo256, Hash as HashT}, + traits::{BlakeTwo256, Hash as HashT, Block as _, Header as _}, transaction_validity::{ TransactionValidity, ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionSource, }, }; -use std::collections::{HashSet, HashMap}; +use std::collections::{HashSet, HashMap, BTreeMap}; use substrate_test_runtime_client::{ runtime::{Index, AccountId, Block, BlockNumber, Extrinsic, Hash, Header, Transfer}, AccountKeyring::{self, *}, }; +use sp_blockchain::CachedHeaderMetadata; /// Error type used by [`TestApi`]. #[derive(Debug, derive_more::From, derive_more::Display)] @@ -53,9 +54,8 @@ impl std::error::Error for Error { #[derive(Default)] pub struct ChainState { - pub block_by_number: HashMap>, - pub block_by_hash: HashMap>, - pub header_by_number: HashMap, + pub block_by_number: BTreeMap>, + pub block_by_hash: HashMap, pub nonces: HashMap, pub invalid_hashes: HashSet, } @@ -70,11 +70,7 @@ pub struct TestApi { impl TestApi { /// Test Api with Alice nonce set initially. pub fn with_alice_nonce(nonce: u64) -> Self { - let api = TestApi { - valid_modifier: RwLock::new(Box::new(|_| {})), - chain: Default::default(), - validation_requests: RwLock::new(Default::default()), - }; + let api = Self::empty(); api.chain.write().nonces.insert(Alice.into(), nonce); @@ -89,6 +85,9 @@ impl TestApi { validation_requests: RwLock::new(Default::default()), }; + // Push genesis block + api.push_block(0, Vec::new()); + api } @@ -97,46 +96,61 @@ impl TestApi { *self.valid_modifier.write() = modifier; } - /// Push block as a part of canonical chain under given number. + /// Push block under given number. + /// + /// If multiple blocks exists with the same block number, the first inserted block will be + /// interpreted as part of the canonical chain. pub fn push_block(&self, block_number: BlockNumber, xts: Vec) -> Header { - let mut chain = self.chain.write(); - chain.block_by_number.insert(block_number, xts.clone()); - let header = Header { - number: block_number, - digest: Default::default(), - extrinsics_root: Default::default(), - parent_hash: block_number + let parent_hash = { + let chain = self.chain.read(); + block_number .checked_sub(1) .and_then(|num| { - chain.header_by_number.get(&num) - .cloned().map(|h| h.hash()) - }).unwrap_or_default(), - state_root: Default::default(), + chain.block_by_number + .get(&num) + .map(|blocks| { + blocks[0].header.hash() + }) + }).unwrap_or_default() }; - chain.block_by_hash.insert(header.hash(), xts); - chain.header_by_number.insert(block_number, header.clone()); - header + + self.push_block_with_parent(parent_hash, xts) } - /// Push a block without a number. + /// Push a block using the given `parent`. /// - /// As a part of non-canonical chain. - pub fn push_fork_block(&self, block_hash: Hash, xts: Vec) { + /// Panics if `parent` does not exists. + pub fn push_block_with_parent( + &self, + parent: Hash, + xts: Vec, + ) -> Header { let mut chain = self.chain.write(); - chain.block_by_hash.insert(block_hash, xts); - } - pub fn push_fork_block_with_parent(&self, parent: Hash, xts: Vec) -> Header { - let mut chain = self.chain.write(); - let blocknum = chain.block_by_number.keys().max().expect("block_by_number shouldn't be empty"); + // `Hash::default()` is the genesis parent hash + let block_number = if parent == Hash::default() { + 0 + } else { + *chain.block_by_hash + .get(&parent) + .expect("`parent` exists") + .header() + .number() + 1 + }; + let header = Header { - number: *blocknum, + number: block_number, digest: Default::default(), - extrinsics_root: Default::default(), + extrinsics_root: Hash::random(), parent_hash: parent, state_root: Default::default(), }; - chain.block_by_hash.insert(header.hash(), xts); + + let hash = header.hash(); + let block = Block::new(header.clone(), xts); + chain.block_by_hash.insert(hash, block.clone()); + chain.block_by_number.entry(block_number).or_default().push(block); + header } @@ -170,11 +184,19 @@ impl TestApi { let mut chain = self.chain.write(); chain.nonces.entry(account).and_modify(|n| *n += 1).or_insert(1); } + + /// Calculate a tree route between the two given blocks. + pub fn tree_route( + &self, + from: Hash, + to: Hash, + ) -> Result, Error> { + sp_blockchain::tree_route(self, from, to) + } } impl sc_transaction_graph::ChainApi for TestApi { type Block = Block; - type Hash = Hash; type Error = Error; type ValidationFuture = futures::future::Ready>; type BodyFuture = futures::future::Ready>, Error>>; @@ -218,7 +240,14 @@ impl sc_transaction_graph::ChainApi for TestApi { &self, at: &BlockId, ) -> Result>, Error> { - Ok(Some(number_of(at))) + Ok(match at { + generic::BlockId::Hash(x) => self.chain + .read() + .block_by_hash + .get(x) + .map(|b| *b.header.number()), + generic::BlockId::Number(num) => Some(*num), + }) } fn block_id_to_hash( @@ -227,34 +256,60 @@ impl sc_transaction_graph::ChainApi for TestApi { ) -> Result>, Error> { Ok(match at { generic::BlockId::Hash(x) => Some(x.clone()), - generic::BlockId::Number(num) => { - self.chain.read() - .header_by_number.get(num) - .map(|h| h.hash()) - .or_else(|| Some(Default::default())) - }, + generic::BlockId::Number(num) => self.chain + .read() + .block_by_number + .get(num) + .map(|blocks| blocks[0].header().hash()), }) } fn hash_and_length( &self, ex: &sc_transaction_graph::ExtrinsicFor, - ) -> (Self::Hash, usize) { + ) -> (Hash, usize) { Self::hash_and_length_inner(ex) } fn block_body(&self, id: &BlockId) -> Self::BodyFuture { futures::future::ready(Ok(match id { - BlockId::Number(num) => self.chain.read().block_by_number.get(num).cloned(), - BlockId::Hash(hash) => self.chain.read().block_by_hash.get(hash).cloned(), + BlockId::Number(num) => self.chain + .read() + .block_by_number + .get(num) + .map(|b| b[0].extrinsics().to_vec()), + BlockId::Hash(hash) => self.chain + .read() + .block_by_hash + .get(hash) + .map(|b| b.extrinsics().to_vec()), })) } } -fn number_of(at: &BlockId) -> u64 { - match at { - generic::BlockId::Number(n) => *n as u64, - _ => 0, +impl sp_blockchain::HeaderMetadata for TestApi { + type Error = Error; + + fn header_metadata( + &self, + hash: Hash, + ) -> Result, Self::Error> { + let chain = self.chain.read(); + let block = chain.block_by_hash.get(&hash).expect("Hash exists"); + + Ok(block.header().into()) + } + + fn insert_header_metadata( + &self, + _: Hash, + _: CachedHeaderMetadata, + ) { + unimplemented!("Not implemented for tests") + } + + fn remove_header_metadata(&self, _: Hash) { + unimplemented!("Not implemented for tests") } } diff --git a/utils/frame/rpc/system/src/lib.rs b/utils/frame/rpc/system/src/lib.rs index 415f9541b6..a3ce1466f6 100644 --- a/utils/frame/rpc/system/src/lib.rs +++ b/utils/frame/rpc/system/src/lib.rs @@ -222,16 +222,14 @@ mod tests { use super::*; use futures::executor::block_on; - use substrate_test_runtime_client::{ - runtime::Transfer, - AccountKeyring, - }; + use substrate_test_runtime_client::{runtime::Transfer, AccountKeyring}; use sc_transaction_pool::{BasicPool, FullChainApi}; #[test] fn should_return_next_nonce_for_some_account() { - // given let _ = env_logger::try_init(); + + // given let client = Arc::new(substrate_test_runtime_client::new()); let pool = Arc::new( BasicPool::new( -- GitLab From b74957d5ff01b464fa93db0ac36588ed045811c2 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 6 Jun 2020 10:55:52 +0200 Subject: [PATCH 114/280] Allow "anonymous" proxied accounts (#6236) * Anonymous proxiers * More testing * More testing * Build fix * Build fix * Benchmarks. * fix benchmarking * add weights * fix line width Co-authored-by: Shawn Tabrizi --- bin/node/runtime/src/lib.rs | 2 +- frame/democracy/src/benchmarking.rs | 1 - frame/proxy/Cargo.toml | 5 +- frame/proxy/src/benchmarking.rs | 26 +++++- frame/proxy/src/lib.rs | 134 +++++++++++++++++++++++++--- frame/proxy/src/tests.rs | 64 +++++++++++-- frame/support/src/traits.rs | 15 ++++ 7 files changed, 218 insertions(+), 29 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 148b4199d1..cac93b63e0 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -808,7 +808,7 @@ construct_runtime!( Recovery: pallet_recovery::{Module, Call, Storage, Event}, Vesting: pallet_vesting::{Module, Call, Storage, Event, Config}, Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Proxy: pallet_proxy::{Module, Call, Storage, Event}, + Proxy: pallet_proxy::{Module, Call, Storage, Event}, } ); diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index 7839618760..3957b38f42 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -30,7 +30,6 @@ use sp_runtime::traits::{Bounded, One}; use crate::Module as Democracy; const SEED: u32 = 0; -const MAX_USERS: u32 = 1000; const MAX_REFERENDUMS: u32 = 100; const MAX_PROPOSALS: u32 = 100; const MAX_SECONDERS: u32 = 100; diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index bf76683d6c..ee776951fd 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -17,6 +17,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } @@ -25,7 +26,6 @@ frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = " [dev-dependencies] sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } [features] default = ["std"] @@ -35,7 +35,8 @@ std = [ "sp-runtime/std", "frame-support/std", "frame-system/std", - "sp-std/std" + "sp-std/std", + "sp-io/std" ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/frame/proxy/src/benchmarking.rs b/frame/proxy/src/benchmarking.rs index 5c938c12dc..3cbe517dfd 100644 --- a/frame/proxy/src/benchmarking.rs +++ b/frame/proxy/src/benchmarking.rs @@ -27,8 +27,8 @@ use crate::Module as Proxy; const SEED: u32 = 0; -fn add_proxies(n: u32) -> Result<(), &'static str> { - let caller: T::AccountId = account("caller", 0, SEED); +fn add_proxies(n: u32, maybe_who: Option) -> Result<(), &'static str> { + let caller = maybe_who.unwrap_or_else(|| account("caller", 0, SEED)); T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); for i in 0..n { Proxy::::add_proxy( @@ -42,7 +42,7 @@ fn add_proxies(n: u32) -> Result<(), &'static str> { benchmarks! { _ { - let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(p)?; + let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(p, None)?; } proxy { @@ -68,6 +68,24 @@ benchmarks! { let p in ...; let caller: T::AccountId = account("caller", 0, SEED); }: _(RawOrigin::Signed(caller)) + + anonymous { + let p in ...; + }: _(RawOrigin::Signed(account("caller", 0, SEED)), T::ProxyType::default(), 0) + + kill_anonymous { + let p in 0 .. (T::MaxProxies::get() - 2).into(); + + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + Module::::anonymous(RawOrigin::Signed(account("caller", 0, SEED)).into(), T::ProxyType::default(), 0)?; + let height = system::Module::::block_number(); + let ext_index = system::Module::::extrinsic_index().unwrap_or(0); + let anon = Module::::anonymous_account(&caller, &T::ProxyType::default(), 0, None); + + add_proxies::(p, Some(anon.clone()))?; + + }: _(RawOrigin::Signed(anon), caller, T::ProxyType::default(), 0, height, ext_index) } #[cfg(test)] @@ -83,6 +101,8 @@ mod tests { assert_ok!(test_benchmark_add_proxy::()); assert_ok!(test_benchmark_remove_proxy::()); assert_ok!(test_benchmark_remove_proxies::()); + assert_ok!(test_benchmark_anonymous::()); + assert_ok!(test_benchmark_kill_anonymous::()); }); } } diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index 94740d7e79..0c5b9c494c 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -35,15 +35,17 @@ #![cfg_attr(not(feature = "std"), no_std)] use sp_std::prelude::*; -use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure}; +use codec::{Encode, Decode}; +use sp_io::hashing::blake2_256; +use sp_runtime::{DispatchResult, traits::{Dispatchable, Zero}}; +use sp_runtime::traits::Member; use frame_support::{ + decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, traits::{Get, ReservableCurrency, Currency, Filter, InstanceFilter}, weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, dispatch::{PostDispatchInfo, IsSubType}, }; use frame_system::{self as system, ensure_signed}; -use sp_runtime::{DispatchResult, traits::{Dispatchable, Zero}}; -use sp_runtime::traits::Member; mod tests; mod benchmarking; @@ -53,7 +55,7 @@ type BalanceOf = <::Currency as Currency< + Into<::Event>; + type Event: From> + Into<::Event>; /// The overarching call type. type Call: Parameter + Dispatchable @@ -115,9 +117,15 @@ decl_error! { decl_event! { /// Events type. - pub enum Event { + pub enum Event where + AccountId = ::AccountId, + ProxyType = ::ProxyType + { /// A proxy was executed correctly, with the given result. ProxyExecuted(DispatchResult), + /// Anonymous account (first parameter) has been created by new proxy (second) with given + /// disambiguation index and proxy type. + AnonymousCreated(AccountId, AccountId, ProxyType, u16), } } @@ -164,12 +172,12 @@ decl_module! { .ok_or(Error::::NotProxy)?; match call.is_sub_type() { Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) => - ensure!(&proxy_type == pt, Error::::NoPermission), + ensure!(pt.is_no_more_permissive(&proxy_type), Error::::NoPermission), _ => (), } ensure!(proxy_type.filter(&call), Error::::Unproxyable); let e = call.dispatch(frame_system::RawOrigin::Signed(real).into()); - Self::deposit_event(Event::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error))); + Self::deposit_event(RawEvent::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error))); } /// Register a proxy account for the sender that is able to make calls on its behalf. @@ -186,8 +194,8 @@ decl_module! { /// - DB weight: 1 storage read and write. /// # #[weight = T::DbWeight::get().reads_writes(1, 1) - .saturating_add(18 * WEIGHT_PER_MICROS) - .saturating_add((200 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + .saturating_add(18 * WEIGHT_PER_MICROS) + .saturating_add((200 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) ] fn add_proxy(origin, proxy: T::AccountId, proxy_type: T::ProxyType) -> DispatchResult { let who = ensure_signed(origin)?; @@ -222,8 +230,8 @@ decl_module! { /// - DB weight: 1 storage read and write. /// # #[weight = T::DbWeight::get().reads_writes(1, 1) - .saturating_add(14 * WEIGHT_PER_MICROS) - .saturating_add((160 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + .saturating_add(14 * WEIGHT_PER_MICROS) + .saturating_add((160 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) ] fn remove_proxy(origin, proxy: T::AccountId, proxy_type: T::ProxyType) -> DispatchResult { let who = ensure_signed(origin)?; @@ -253,19 +261,119 @@ decl_module! { /// /// The dispatch origin for this call must be _Signed_. /// + /// WARNING: This may be called on accounts created by `anonymous`, however if done, then + /// the unreserved fees will be inaccessible. **All access to this account will be lost.** + /// /// # /// P is the number of proxies the user has /// - Base weight: 13.73 + .129 * P µs /// - DB weight: 1 storage read and write. /// # #[weight = T::DbWeight::get().reads_writes(1, 1) - .saturating_add(14 * WEIGHT_PER_MICROS) - .saturating_add((130 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + .saturating_add(14 * WEIGHT_PER_MICROS) + .saturating_add((130 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) ] fn remove_proxies(origin) { let who = ensure_signed(origin)?; let (_, old_deposit) = Proxies::::take(&who); T::Currency::unreserve(&who, old_deposit); } + + /// Spawn a fresh new account that is guaranteed to be otherwise inaccessible, and + /// initialize it with a proxy of `proxy_type` for `origin` sender. + /// + /// Requires a `Signed` origin. + /// + /// - `proxy_type`: The type of the proxy that the sender will be registered as over the + /// new account. This will almost always be the most permissive `ProxyType` possible to + /// allow for maximum flexibility. + /// - `index`: A disambiguation index, in case this is called multiple times in the same + /// transaction (e.g. with `utility::batch`). Unless you're using `batch` you probably just + /// want to use `0`. + /// + /// Fails with `Duplicate` if this has already been called in this transaction, from the + /// same sender, with the same parameters. + /// + /// Fails if there are insufficient funds to pay for deposit. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 36.48 + .039 * P µs + /// - DB weight: 1 storage read and write. + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + .saturating_add(36 * WEIGHT_PER_MICROS) + .saturating_add((40 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + ] + fn anonymous(origin, proxy_type: T::ProxyType, index: u16) { + let who = ensure_signed(origin)?; + + let anonymous = Self::anonymous_account(&who, &proxy_type, index, None); + ensure!(!Proxies::::contains_key(&anonymous), Error::::Duplicate); + let deposit = T::ProxyDepositBase::get() + T::ProxyDepositFactor::get(); + T::Currency::reserve(&who, deposit)?; + Proxies::::insert(&anonymous, (vec![(who.clone(), proxy_type.clone())], deposit)); + Self::deposit_event(RawEvent::AnonymousCreated(anonymous, who, proxy_type, index)); + } + + /// Removes a previously spawned anonymous proxy. + /// + /// WARNING: **All access to this account will be lost.** Any funds held in it will be + /// inaccessible. + /// + /// Requires a `Signed` origin, and the sender account must have been created by a call to + /// `anonymous` with corresponding parameters. + /// + /// - `spawner`: The account that originally called `anonymous` to create this account. + /// - `index`: The disambiguation index originally passed to `anonymous`. Probably `0`. + /// - `proxy_type`: The proxy type originally passed to `anonymous`. + /// - `height`: The height of the chain when the call to `anonymous` was processed. + /// - `ext_index`: The extrinsic index in which the call to `anonymous` was processed. + /// + /// Fails with `NoPermission` in case the caller is not a previously created anonymous + /// account whose `anonymous` call has corresponding parameters. + /// + /// # + /// P is the number of proxies the user has + /// - Base weight: 15.65 + .137 * P µs + /// - DB weight: 1 storage read and write. + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + .saturating_add(15 * WEIGHT_PER_MICROS) + .saturating_add((140 * WEIGHT_PER_NANOS).saturating_mul(T::MaxProxies::get().into())) + ] + fn kill_anonymous(origin, + spawner: T::AccountId, + proxy_type: T::ProxyType, + index: u16, + #[compact] height: T::BlockNumber, + #[compact] ext_index: u32, + ) { + let who = ensure_signed(origin)?; + + let when = (height, ext_index); + let proxy = Self::anonymous_account(&spawner, &proxy_type, index, Some(when)); + ensure!(proxy == who, Error::::NoPermission); + + let (_, deposit) = Proxies::::take(&who); + T::Currency::unreserve(&spawner, deposit); + } + } +} + +impl Module { + pub fn anonymous_account( + who: &T::AccountId, + proxy_type: &T::ProxyType, + index: u16, + maybe_when: Option<(T::BlockNumber, u32)>, + ) -> T::AccountId { + let (height, ext_index) = maybe_when.unwrap_or_else(|| ( + system::Module::::block_number(), + system::Module::::extrinsic_index().unwrap_or_default() + )); + let entropy = (b"modlpy/proxy____", who, height, ext_index, proxy_type, index) + .using_encoded(blake2_256); + T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() } } diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index 2d22f2d53c..c331195c26 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use frame_support::{ assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, - weights::Weight, impl_outer_event, RuntimeDebug + weights::Weight, impl_outer_event, RuntimeDebug, dispatch::DispatchError }; use codec::{Encode, Decode}; use sp_core::H256; @@ -37,7 +37,7 @@ impl_outer_event! { pub enum TestEvent for Test { system, pallet_balances, - proxy, + proxy, } } impl_outer_dispatch! { @@ -120,8 +120,10 @@ pub struct TestIsCallable; impl Filter for TestIsCallable { fn filter(c: &Call) -> bool { match *c { - Call::Balances(_) => true, - _ => false, + // Remark is used as a no-op call in the benchmarking + Call::System(SystemCall::remark(_)) => true, + Call::System(_) => false, + _ => true, } } } @@ -143,6 +145,7 @@ type Proxy = Module; use frame_system::Call as SystemCall; use pallet_balances::Call as BalancesCall; use pallet_balances::Error as BalancesError; +use super::Call as ProxyCall; pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); @@ -155,7 +158,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { } fn last_event() -> TestEvent { - system::Module::::events().pop().map(|e| e.event).expect("Event expected") + system::Module::::events().pop().expect("Event expected").event } fn expect_event>(e: E) { @@ -203,18 +206,61 @@ fn proxying_works() { let call = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); assert_noop!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()), Error::::NotProxy); - assert_noop!(Proxy::proxy(Origin::signed(2), 1, Some(ProxyType::Any), call.clone()), Error::::NotProxy); + assert_noop!( + Proxy::proxy(Origin::signed(2), 1, Some(ProxyType::Any), call.clone()), + Error::::NotProxy + ); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); - expect_event(Event::ProxyExecuted(Ok(()))); + expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_eq!(Balances::free_balance(6), 1); - let call = Box::new(Call::System(SystemCall::remark(vec![]))); + let call = Box::new(Call::System(SystemCall::set_code(vec![]))); assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); let call = Box::new(Call::Balances(BalancesCall::transfer_keep_alive(6, 1))); assert_noop!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()), Error::::Unproxyable); assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); - expect_event(Event::ProxyExecuted(Ok(()))); + expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_eq!(Balances::free_balance(6), 2); }); } + +#[test] +fn anonymous_works() { + new_test_ext().execute_with(|| { + assert_ok!(Proxy::anonymous(Origin::signed(1), ProxyType::Any, 0)); + let anon = Proxy::anonymous_account(&1, &ProxyType::Any, 0, None); + expect_event(RawEvent::AnonymousCreated(anon.clone(), 1, ProxyType::Any, 0)); + + // other calls to anonymous allowed as long as they're not exactly the same. + assert_ok!(Proxy::anonymous(Origin::signed(1), ProxyType::JustTransfer, 0)); + assert_ok!(Proxy::anonymous(Origin::signed(1), ProxyType::Any, 1)); + let anon2 = Proxy::anonymous_account(&2, &ProxyType::Any, 0, None); + assert_ok!(Proxy::anonymous(Origin::signed(2), ProxyType::Any, 0)); + assert_noop!(Proxy::anonymous(Origin::signed(1), ProxyType::Any, 0), Error::::Duplicate); + System::set_extrinsic_index(1); + assert_ok!(Proxy::anonymous(Origin::signed(1), ProxyType::Any, 0)); + System::set_extrinsic_index(0); + System::set_block_number(2); + assert_ok!(Proxy::anonymous(Origin::signed(1), ProxyType::Any, 0)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); + assert_ok!(Balances::transfer(Origin::signed(3), anon, 5)); + assert_ok!(Proxy::proxy(Origin::signed(1), anon, None, call)); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + assert_eq!(Balances::free_balance(6), 1); + + let call = Box::new(Call::Proxy(ProxyCall::kill_anonymous(1, ProxyType::Any, 0, 1, 0))); + assert_ok!(Proxy::proxy(Origin::signed(2), anon2, None, call.clone())); + let de = DispatchError::from(Error::::NoPermission).stripped(); + expect_event(RawEvent::ProxyExecuted(Err(de))); + assert_noop!( + Proxy::kill_anonymous(Origin::signed(1), 1, ProxyType::Any, 0, 1, 0), + Error::::NoPermission + ); + assert_eq!(Balances::free_balance(1), 0); + assert_ok!(Proxy::proxy(Origin::signed(1), anon, None, call.clone())); + assert_eq!(Balances::free_balance(1), 2); + assert_noop!(Proxy::proxy(Origin::signed(1), anon, None, call.clone()), Error::::NotProxy); + }); +} diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 568401a498..979f021e03 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -47,10 +47,25 @@ impl Filter for () { pub trait InstanceFilter { /// Determine if a given value should be allowed through the filter (returns `true`) or not. fn filter(&self, _: &T) -> bool; + + /// Determines whether `self` matches at least all items that `o` does. + fn is_no_less_permissive(&self, o: &Self) -> bool { !self.is_less_permissive(o) } + + /// Determines whether `self` matches at most only the items that `o` does. + fn is_no_more_permissive(&self, o: &Self) -> bool { !o.is_less_permissive(&self) } + + /// Determines whether `self` matches all the items that `o` does and others. + fn is_more_permissive(&self, o: &Self) -> bool { o.is_less_permissive(self) } + + /// Determines whether `self` does not match all the items that `_o` does, nor any others. + /// + /// NOTE: This is the only `*permissive` function that needs to be reimplemented. + fn is_less_permissive(&self, _o: &Self) -> bool { true } } impl InstanceFilter for () { fn filter(&self, _: &T) -> bool { true } + fn is_less_permissive(&self, _o: &Self) -> bool { false } } /// An abstraction of a value stored within storage, but possibly as part of a larger composite -- GitLab From 37bbc552f05509658a0b1c98a6e102688ffa6057 Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Sat, 6 Jun 2020 13:04:39 +0200 Subject: [PATCH 115/280] Enable fixed point u128 (#6214) * Add fixed u128. * remove move * Change sat_from_integer impl. * checked_pow is always positive * Revert. * rename fixed file * Rename to FixedI * rename fixed file * Add newline. * Use Multiplier in impls. * Renames negate() to saturating_negate(). * Uncomment test. * Add Signed to macro. * Add some tests for Saturating trait. --- bin/node/executor/tests/basic.rs | 4 +- bin/node/executor/tests/fees.rs | 4 +- bin/node/runtime/src/impls.rs | 69 ++- frame/balances/src/tests.rs | 4 +- frame/transaction-payment/src/lib.rs | 20 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- .../fuzzer/src/{fixed.rs => fixed_point.rs} | 36 +- .../src/{fixed.rs => fixed_point.rs} | 583 ++++++++++-------- primitives/arithmetic/src/lib.rs | 20 +- primitives/arithmetic/src/traits.rs | 10 +- primitives/runtime/src/lib.rs | 4 +- 11 files changed, 420 insertions(+), 338 deletions(-) rename primitives/arithmetic/fuzzer/src/{fixed.rs => fixed_point.rs} (62%) rename primitives/arithmetic/src/{fixed.rs => fixed_point.rs} (74%) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 7799f0913a..2bb444b47c 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -26,7 +26,7 @@ use frame_support::{ }; use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys}; use sp_runtime::{ - ApplyExtrinsicResult, Fixed128, FixedPointNumber, + ApplyExtrinsicResult, FixedI128, FixedPointNumber, traits::Hash as HashT, transaction_validity::InvalidTransaction, }; @@ -53,7 +53,7 @@ use self::common::{*, sign}; pub const BLOATY_CODE: &[u8] = node_runtime::WASM_BINARY_BLOATY; /// Default transfer fee -fn transfer_fee(extrinsic: &E, fee_multiplier: Fixed128) -> Balance { +fn transfer_fee(extrinsic: &E, fee_multiplier: FixedI128) -> Balance { let length_fee = TransactionByteFee::get() * (extrinsic.encode().len() as Balance); let base_weight = ExtrinsicBaseWeight::get(); diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs index a4fc3930da..280408357e 100644 --- a/bin/node/executor/tests/fees.rs +++ b/bin/node/executor/tests/fees.rs @@ -22,7 +22,7 @@ use frame_support::{ weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial}, }; use sp_core::NeverNativeValue; -use sp_runtime::{FixedPointNumber, Fixed128, Perbill}; +use sp_runtime::{FixedPointNumber, FixedI128, Perbill}; use node_runtime::{ CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, TransactionByteFee, @@ -39,7 +39,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() { let mut t = new_test_ext(COMPACT_CODE, false); // initial fee multiplier must be zero - let mut prev_multiplier = Fixed128::from_inner(0); + let mut prev_multiplier = FixedI128::from_inner(0); t.execute_with(|| { assert_eq!(TransactionPayment::next_fee_multiplier(), prev_multiplier); diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index 0047ae5c1b..c8f42f3f26 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -19,8 +19,9 @@ use node_primitives::Balance; use sp_runtime::traits::{Convert, Saturating}; -use sp_runtime::{FixedPointNumber, Fixed128, Perquintill}; +use sp_runtime::{FixedPointNumber, Perquintill}; use frame_support::traits::{OnUnbalanced, Currency, Get}; +use pallet_transaction_payment::Multiplier; use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance}; pub struct Author; @@ -56,8 +57,8 @@ impl Convert for CurrencyToVoteHandler { /// https://research.web3.foundation/en/latest/polkadot/Token%20Economics/#relay-chain-transaction-fees pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData); -impl> Convert for TargetedFeeAdjustment { - fn convert(multiplier: Fixed128) -> Fixed128 { +impl> Convert for TargetedFeeAdjustment { + fn convert(multiplier: Multiplier) -> Multiplier { let max_weight = MaximumBlockWeight::get(); let block_weight = System::block_weight().total().min(max_weight); let target_weight = (T::get() * max_weight) as u128; @@ -67,13 +68,13 @@ impl> Convert for TargetedFeeAdjustment< let positive = block_weight >= target_weight; let diff_abs = block_weight.max(target_weight) - block_weight.min(target_weight); // safe, diff_abs cannot exceed u64. - let diff = Fixed128::saturating_from_rational(diff_abs, max_weight.max(1)); + let diff = Multiplier::saturating_from_rational(diff_abs, max_weight.max(1)); let diff_squared = diff.saturating_mul(diff); // 0.00004 = 4/100_000 = 40_000/10^9 - let v = Fixed128::saturating_from_rational(4, 100_000); + let v = Multiplier::saturating_from_rational(4, 100_000); // 0.00004^2 = 16/10^10 Taking the future /2 into account... 8/10^10 - let v_squared_2 = Fixed128::saturating_from_rational(8, 10_000_000_000u64); + let v_squared_2 = Multiplier::saturating_from_rational(8, 10_000_000_000u64); let first_term = v.saturating_mul(diff); let second_term = v_squared_2.saturating_mul(diff_squared); @@ -92,7 +93,7 @@ impl> Convert for TargetedFeeAdjustment< // multiplier. While at -1, it means that the network is so un-congested that all // transactions have no weight fee. We stop here and only increase if the network // became more busy. - .max(Fixed128::saturating_from_integer(-1)) + .max(Multiplier::saturating_from_integer(-1)) } } } @@ -114,7 +115,7 @@ mod tests { } // poc reference implementation. - fn fee_multiplier_update(block_weight: Weight, previous: Fixed128) -> Fixed128 { + fn fee_multiplier_update(block_weight: Weight, previous: Multiplier) -> Multiplier { // maximum tx weight let m = max() as f64; // block weight always truncated to max weight @@ -127,7 +128,7 @@ mod tests { let s = block_weight; let fm = v * (s/m - ss/m) + v.powi(2) * (s/m - ss/m).powi(2) / 2.0; - let addition_fm = Fixed128::from_inner((fm * Fixed128::accuracy() as f64).round() as i128); + let addition_fm = Multiplier::from_inner((fm * Multiplier::accuracy() as f64).round() as i128); previous.saturating_add(addition_fm) } @@ -142,7 +143,7 @@ mod tests { #[test] fn fee_multiplier_update_poc_works() { - let fm = Fixed128::saturating_from_rational(0, 1); + let fm = Multiplier::saturating_from_rational(0, 1); let test_set = vec![ (0, fm.clone()), (100, fm.clone()), @@ -156,7 +157,7 @@ mod tests { fee_multiplier_update(w, fm), TargetedFeeAdjustment::::convert(fm), // Error is only 1 in 10^18 - Fixed128::from_inner(1), + Multiplier::from_inner(1), ); }) }) @@ -167,12 +168,12 @@ mod tests { // just a few txs per_block. let block_weight = 0; run_with_system_weight(block_weight, || { - let mut fm = Fixed128::default(); + let mut fm = Multiplier::default(); let mut iterations: u64 = 0; loop { let next = TargetedFeeAdjustment::::convert(fm); fm = next; - if fm == Fixed128::saturating_from_integer(-1) { break; } + if fm == Multiplier::saturating_from_integer(-1) { break; } iterations += 1; } println!("iteration {}, new fm = {:?}. Weight fee is now zero", iterations, fm); @@ -200,7 +201,7 @@ mod tests { run_with_system_weight(block_weight, || { // initial value configured on module - let mut fm = Fixed128::default(); + let mut fm = Multiplier::default(); assert_eq!(fm, TransactionPayment::next_fee_multiplier()); let mut iterations: u64 = 0; @@ -233,49 +234,49 @@ mod tests { // and light blocks will have a weight multiplier less than 0. run_with_system_weight(target() / 4, || { // `fee_multiplier_update` is enough as it is the absolute truth value. - let next = TargetedFeeAdjustment::::convert(Fixed128::default()); + let next = TargetedFeeAdjustment::::convert(Multiplier::default()); assert_eq!( next, - fee_multiplier_update(target() / 4 ,Fixed128::default()) + fee_multiplier_update(target() / 4 ,Multiplier::default()) ); // Light block. Fee is reduced a little. - assert!(next < Fixed128::zero()) + assert!(next < Multiplier::zero()) }); run_with_system_weight(target() / 2, || { - let next = TargetedFeeAdjustment::::convert(Fixed128::default()); + let next = TargetedFeeAdjustment::::convert(Multiplier::default()); assert_eq!( next, - fee_multiplier_update(target() / 2 ,Fixed128::default()) + fee_multiplier_update(target() / 2 ,Multiplier::default()) ); // Light block. Fee is reduced a little. - assert!(next < Fixed128::zero()) + assert!(next < Multiplier::zero()) }); run_with_system_weight(target(), || { // ideal. Original fee. No changes. - let next = TargetedFeeAdjustment::::convert(Fixed128::default()); - assert_eq!(next, Fixed128::zero()) + let next = TargetedFeeAdjustment::::convert(Multiplier::default()); + assert_eq!(next, Multiplier::zero()) }); run_with_system_weight(target() * 2, || { // More than ideal. Fee is increased. - let next = TargetedFeeAdjustment::::convert(Fixed128::default()); + let next = TargetedFeeAdjustment::::convert(Multiplier::default()); assert_eq!( next, - fee_multiplier_update(target() * 2 ,Fixed128::default()) + fee_multiplier_update(target() * 2 ,Multiplier::default()) ); // Heavy block. Fee is increased a little. - assert!(next > Fixed128::zero()) + assert!(next > Multiplier::zero()) }); } #[test] fn stateful_weight_mul_grow_to_infinity() { run_with_system_weight(target() * 2, || { - let mut original = Fixed128::default(); - let mut next = Fixed128::default(); + let mut original = Multiplier::default(); + let mut next = Multiplier::default(); (0..1_000).for_each(|_| { next = TargetedFeeAdjustment::::convert(original); @@ -293,7 +294,7 @@ mod tests { #[test] fn stateful_weight_mil_collapse_to_minus_one() { run_with_system_weight(0, || { - let mut original = Fixed128::default(); // 0 + let mut original = Multiplier::default(); // 0 let mut next; // decreases @@ -315,8 +316,8 @@ mod tests { // ... stops going down at -1 assert_eq!( - TargetedFeeAdjustment::::convert(Fixed128::saturating_from_integer(-1)), - Fixed128::saturating_from_integer(-1) + TargetedFeeAdjustment::::convert(Multiplier::saturating_from_integer(-1)), + Multiplier::saturating_from_integer(-1) ); }) } @@ -325,7 +326,7 @@ mod tests { fn weight_to_fee_should_not_overflow_on_large_weights() { let kb = 1024 as Weight; let mb = kb * kb; - let max_fm = Fixed128::saturating_from_integer(i128::max_value()); + let max_fm = Multiplier::saturating_from_integer(i128::max_value()); // check that for all values it can compute, correctly. vec![ @@ -346,9 +347,9 @@ mod tests { Weight::max_value(), ].into_iter().for_each(|i| { run_with_system_weight(i, || { - let next = TargetedFeeAdjustment::::convert(Fixed128::default()); - let truth = fee_multiplier_update(i, Fixed128::default()); - assert_eq_error_rate!(truth, next, Fixed128::from_inner(50_000_000)); + let next = TargetedFeeAdjustment::::convert(Multiplier::default()); + let truth = fee_multiplier_update(i, Multiplier::default()); + assert_eq_error_rate!(truth, next, Multiplier::from_inner(50_000_000)); }); }); diff --git a/frame/balances/src/tests.rs b/frame/balances/src/tests.rs index 9be64fc744..c49a04ae56 100644 --- a/frame/balances/src/tests.rs +++ b/frame/balances/src/tests.rs @@ -37,7 +37,7 @@ macro_rules! decl_tests { ($test:ty, $ext_builder:ty, $existential_deposit:expr) => { use crate::*; - use sp_runtime::{FixedPointNumber, Fixed128, traits::{SignedExtension, BadOrigin}}; + use sp_runtime::{FixedPointNumber, FixedI128, traits::{SignedExtension, BadOrigin}}; use frame_support::{ assert_noop, assert_ok, assert_err, traits::{ @@ -162,7 +162,7 @@ macro_rules! decl_tests { .monied(true) .build() .execute_with(|| { - pallet_transaction_payment::NextFeeMultiplier::put(Fixed128::saturating_from_integer(1)); + pallet_transaction_payment::NextFeeMultiplier::put(FixedI128::saturating_from_integer(1)); Balances::set_lock(ID_1, &1, 10, WithdrawReason::Reserve.into()); assert_noop!( >::transfer(&1, &2, 1, AllowDeath), diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 78c638b484..8355a58c52 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -44,7 +44,7 @@ use frame_support::{ dispatch::DispatchResult, }; use sp_runtime::{ - Fixed128, FixedPointNumber, FixedPointOperand, + FixedI128, FixedPointNumber, FixedPointOperand, transaction_validity::{ TransactionPriority, ValidTransaction, InvalidTransaction, TransactionValidityError, TransactionValidity, @@ -56,7 +56,9 @@ use sp_runtime::{ }; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; -type Multiplier = Fixed128; +/// Fee multiplier. +pub type Multiplier = FixedI128; + type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; type NegativeImbalanceOf = @@ -617,7 +619,7 @@ mod tests { .execute_with(|| { let len = 10; - NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); let pre = ChargeTransactionPayment::::from(5 /* tipped */) .pre_dispatch(&2, CALL, &info_from_weight(100), len) @@ -705,7 +707,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); let len = 10; assert!( @@ -733,7 +735,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); assert_eq!( TransactionPayment::query_info(xt, len), @@ -762,7 +764,7 @@ mod tests { .execute_with(|| { // Next fee multiplier is zero - assert_eq!(NextFeeMultiplier::get(), Fixed128::saturating_from_integer(0)); + assert_eq!(NextFeeMultiplier::get(), Multiplier::saturating_from_integer(0)); // Tip only, no fees works let dispatch_info = DispatchInfo { @@ -802,7 +804,7 @@ mod tests { .execute_with(|| { // Add a next fee multiplier - NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 2)); // = 1/2 = .5 + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); // = 1/2 = .5 // Base fee is unaffected by multiplier let dispatch_info = DispatchInfo { weight: 0, @@ -835,7 +837,7 @@ mod tests { .execute_with(|| { // Add a next fee multiplier - NextFeeMultiplier::put(Fixed128::saturating_from_rational(-1, 2)); // = -1/2 = -.5 + NextFeeMultiplier::put(Multiplier::saturating_from_rational(-1, 2)); // = -1/2 = -.5 // Base fee is unaffected by multiplier let dispatch_info = DispatchInfo { weight: 0, @@ -990,7 +992,7 @@ mod tests { let len = 10; let tip = 5; - NextFeeMultiplier::put(Fixed128::saturating_from_rational(1, 4)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 4)); let pre = ChargeTransactionPayment::::from(tip) .pre_dispatch(&2, CALL, &info, len) diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index f870152f54..9058aaea0b 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -33,5 +33,5 @@ name = "rational128" path = "src/rational128.rs" [[bin]] -name = "fixed" -path = "src/fixed.rs" \ No newline at end of file +name = "fixed_point" +path = "src/fixed_point.rs" diff --git a/primitives/arithmetic/fuzzer/src/fixed.rs b/primitives/arithmetic/fuzzer/src/fixed_point.rs similarity index 62% rename from primitives/arithmetic/fuzzer/src/fixed.rs rename to primitives/arithmetic/fuzzer/src/fixed_point.rs index 115d7dbbdb..9a88197ac3 100644 --- a/primitives/arithmetic/fuzzer/src/fixed.rs +++ b/primitives/arithmetic/fuzzer/src/fixed_point.rs @@ -16,19 +16,19 @@ // limitations under the License. //! # Running -//! Running this fuzzer can be done with `cargo hfuzz run fixed`. `honggfuzz` CLI options can +//! Running this fuzzer can be done with `cargo hfuzz run fixed_point`. `honggfuzz` CLI options can //! be used by setting `HFUZZ_RUN_ARGS`, such as `-n 4` to use 4 threads. //! //! # Debugging a panic //! Once a panic is found, it can be debugged with -//! `cargo hfuzz run-debug fixed hfuzz_workspace/fixed/*.fuzz`. +//! `cargo hfuzz run-debug fixed_point hfuzz_workspace/fixed_point/*.fuzz`. //! //! # More information //! More information about `honggfuzz` can be found //! [here](https://docs.rs/honggfuzz/). use honggfuzz::fuzz; -use sp_arithmetic::{FixedPointNumber, Fixed64, traits::Saturating}; +use sp_arithmetic::{FixedPointNumber, FixedI64, traits::Saturating}; fn main() { loop { @@ -38,21 +38,21 @@ fn main() { // Check `from_rational` and division are consistent. if y != 0 { - let f1 = Fixed64::saturating_from_integer(x) / Fixed64::saturating_from_integer(y); - let f2 = Fixed64::saturating_from_rational(x, y); + let f1 = FixedI64::saturating_from_integer(x) / FixedI64::saturating_from_integer(y); + let f2 = FixedI64::saturating_from_rational(x, y); assert_eq!(f1.into_inner(), f2.into_inner()); } // Check `saturating_mul`. - let a = Fixed64::saturating_from_rational(2, 5); - let b = a.saturating_mul(Fixed64::saturating_from_integer(x)); + let a = FixedI64::saturating_from_rational(2, 5); + let b = a.saturating_mul(FixedI64::saturating_from_integer(x)); let n = b.into_inner() as i128; - let m = 2i128 * x * Fixed64::accuracy() as i128 / 5i128; + let m = 2i128 * x * FixedI64::accuracy() as i128 / 5i128; assert_eq!(n, m); // Check `saturating_mul` and division are inverse. if x != 0 { - assert_eq!(a, b / Fixed64::saturating_from_integer(x)); + assert_eq!(a, b / FixedI64::saturating_from_integer(x)); } // Check `reciprocal`. @@ -60,22 +60,22 @@ fn main() { assert_eq!(a, r); // Check addition. - let a = Fixed64::saturating_from_integer(x); - let b = Fixed64::saturating_from_integer(y); - let c = Fixed64::saturating_from_integer(x.saturating_add(y)); + let a = FixedI64::saturating_from_integer(x); + let b = FixedI64::saturating_from_integer(y); + let c = FixedI64::saturating_from_integer(x.saturating_add(y)); assert_eq!(a.saturating_add(b), c); // Check substraction. - let a = Fixed64::saturating_from_integer(x); - let b = Fixed64::saturating_from_integer(y); - let c = Fixed64::saturating_from_integer(x.saturating_sub(y)); + let a = FixedI64::saturating_from_integer(x); + let b = FixedI64::saturating_from_integer(y); + let c = FixedI64::saturating_from_integer(x.saturating_sub(y)); assert_eq!(a.saturating_sub(b), c); // Check `saturating_mul_acc_int`. - let a = Fixed64::saturating_from_rational(2, 5); + let a = FixedI64::saturating_from_rational(2, 5); let b = a.saturating_mul_acc_int(x); - let xx = Fixed64::saturating_from_integer(x); - let d = a.saturating_mul(xx).saturating_add(xx).into_inner() as i128 / Fixed64::accuracy() as i128; + let xx = FixedI64::saturating_from_integer(x); + let d = a.saturating_mul(xx).saturating_add(xx).into_inner() as i128 / FixedI64::accuracy() as i128; assert_eq!(b, d); }); } diff --git a/primitives/arithmetic/src/fixed.rs b/primitives/arithmetic/src/fixed_point.rs similarity index 74% rename from primitives/arithmetic/src/fixed.rs rename to primitives/arithmetic/src/fixed_point.rs index bc657c5ede..55581ff54c 100644 --- a/primitives/arithmetic/src/fixed.rs +++ b/primitives/arithmetic/src/fixed_point.rs @@ -22,7 +22,7 @@ use crate::{ helpers_128bit::multiply_by_rational, PerThing, traits::{ SaturatedConversion, CheckedSub, CheckedAdd, CheckedMul, CheckedDiv, CheckedNeg, - Bounded, Saturating, UniqueSaturatedInto, Zero, One, Signed + Bounded, Saturating, UniqueSaturatedInto, Zero, One }, }; @@ -59,11 +59,14 @@ pub trait FixedPointNumber: + Add + Sub + Div + Mul { /// The underlying data type used for this fixed point number. - type Inner: Debug + One + CheckedMul + CheckedDiv + CheckedNeg + Signed + FixedPointOperand; + type Inner: Debug + One + CheckedMul + CheckedDiv + FixedPointOperand; /// Precision of this fixed point implementation. It should be a power of `10`. const DIV: Self::Inner; + /// Indicates if this fixed point implementation is signed or not. + const SIGNED: bool; + /// Precision of this fixed point implementation. fn accuracy() -> Self::Inner { Self::DIV @@ -75,16 +78,13 @@ pub trait FixedPointNumber: /// Consumes `self` and returns the inner raw value. fn into_inner(self) -> Self::Inner; - /// Returns the negation. - fn negate(self) -> Self { - Self::from_inner(-self.into_inner()) - } - /// Creates self from an integer number `int`. /// /// Returns `Self::max` or `Self::min` if `int` exceeds accuracy. - fn saturating_from_integer>(int: N) -> Self { - Self::from_inner(int.unique_saturated_into().saturating_mul(Self::DIV)) + fn saturating_from_integer(int: N) -> Self { + let mut n: I129 = int.into(); + n.value = n.value.saturating_mul(Self::DIV.saturated_into()); + Self::from_inner(from_i129(n).unwrap_or(to_bound(int, 0))) } /// Creates `self` from an integer number `int`. @@ -169,7 +169,7 @@ pub trait FixedPointNumber: /// Returns `N::min` or `N::max` if the multiplication or final result does not fit in `N`. fn saturating_mul_acc_int(self, n: N) -> N { if self.is_negative() && n > N::zero() { - n.saturating_sub(self.negate().saturating_mul_int(n)) + n.saturating_sub(Self::zero().saturating_sub(self).saturating_mul_int(n)) } else { self.saturating_mul_int(n).saturating_add(n) } @@ -180,7 +180,7 @@ pub trait FixedPointNumber: /// Returns `Self::max` if `self == Self::min`. fn saturating_abs(self) -> Self { let inner = self.into_inner(); - if inner.is_positive() { + if inner >= Self::Inner::zero() { self } else { Self::from_inner(inner.checked_neg().unwrap_or(Self::Inner::max_value())) @@ -254,7 +254,11 @@ pub trait FixedPointNumber: if self.is_negative() { self.trunc() } else { - self.saturating_add(Self::one()).trunc() + if self.frac() == Self::zero() { + self + } else { + self.saturating_add(Self::one()).trunc() + } } } @@ -277,8 +281,11 @@ pub trait FixedPointNumber: if n < Self::saturating_from_integer(5) { self.trunc() } else { - let extra = Self::saturating_from_integer(self.into_inner().signum()); - (self.saturating_add(extra)).trunc() + if self.is_positive() { + self.saturating_add(Self::one()).trunc() + } else { + self.saturating_sub(Self::one()).trunc() + } } } } @@ -328,6 +335,7 @@ macro_rules! implement_fixed { $name:ident, $test_mod:ident, $inner_type:ty, + $signed:tt, $div:tt, $title:expr $(,)? ) => { @@ -353,6 +361,7 @@ macro_rules! implement_fixed { type Inner = $inner_type; const DIV: Self::Inner = $div; + const SIGNED: bool = $signed; fn from_inner(inner: Self::Inner) -> Self { Self(inner) @@ -400,7 +409,7 @@ macro_rules! implement_fixed { type Output = Self; fn neg(self) -> Self::Output { - Self(-self.0) + Self(::Inner::zero() - self.0) } } @@ -500,7 +509,7 @@ macro_rules! implement_fixed { format!("{}{}", signum_for_zero, int) }; let precision = (Self::accuracy() as f64).log10() as usize; - let fractional = format!("{:0>weight$}", (self.0 % Self::accuracy()).abs(), weight=precision); + let fractional = format!("{:0>weight$}", ((self.0 % Self::accuracy()) as i128).abs(), weight=precision); write!(f, "{}({}.{})", stringify!($name), integral, fractional) } @@ -670,35 +679,38 @@ macro_rules! implement_fixed { #[test] fn op_neg_works() { - let a = $name::saturating_from_integer(5); + let a = $name::zero(); let b = -a; - // Positive. - assert_eq!($name::saturating_from_integer(-5), b); + // Zero. + assert_eq!(a, b); - let a = $name::saturating_from_integer(-5); - let b = -a; + if $name::SIGNED { + let a = $name::saturating_from_integer(5); + let b = -a; - // Negative - assert_eq!($name::saturating_from_integer(5), b); + // Positive. + assert_eq!($name::saturating_from_integer(-5), b); - let a = $name::max_value(); - let b = -a; + let a = $name::saturating_from_integer(-5); + let b = -a; - // Max. - assert_eq!($name::min_value() + $name::from_inner(1), b); + // Negative + assert_eq!($name::saturating_from_integer(5), b); - let a = $name::min_value() + $name::from_inner(1); - let b = -a; + let a = $name::max_value(); + let b = -a; - // Min. - assert_eq!($name::max_value(), b); + // Max. + assert_eq!($name::min_value() + $name::from_inner(1), b); - let a = $name::zero(); - let b = -a; + let a = $name::min_value() + $name::from_inner(1); + let b = -a; - // Zero. - assert_eq!(a, b); + // Min. + assert_eq!($name::max_value(), b); + + } } #[test] @@ -716,10 +728,11 @@ macro_rules! implement_fixed { // Positive case: 6/2 = 3. assert_eq!($name::saturating_from_integer(3), a + b); - let b = $name::saturating_from_rational(1, -2); - - // Negative case: 4/2 = 2. - assert_eq!($name::saturating_from_integer(2), a + b); + if $name::SIGNED { + // Negative case: 4/2 = 2. + let b = $name::saturating_from_rational(1, -2); + assert_eq!($name::saturating_from_integer(2), a + b); + } } #[test] @@ -734,13 +747,8 @@ macro_rules! implement_fixed { let a = $name::saturating_from_rational(5, 2); let b = $name::saturating_from_rational(1, 2); - // Negative case: 4/2 = 2. assert_eq!($name::saturating_from_integer(2), a - b); - - let b = $name::saturating_from_rational(1, -2); - - // Positive case: 6/2 = 3. - assert_eq!($name::saturating_from_integer(3), a - b); + assert_eq!($name::saturating_from_integer(-2), b.saturating_sub(a)); } #[test] @@ -771,9 +779,11 @@ macro_rules! implement_fixed { #[test] fn op_checked_div_overflow_works() { - let a = $name::min_value(); - let b = (-1).into(); - assert!(a.checked_div(&b).is_none()); + if $name::SIGNED { + let a = $name::min_value(); + let b = $name::zero().saturating_sub($name::one()); + assert!(a.checked_div(&b).is_none()); + } } #[test] @@ -782,13 +792,15 @@ macro_rules! implement_fixed { let b = $name::saturating_from_integer(2); assert_eq!($name::saturating_from_integer(21), a / b); - let a = $name::saturating_from_integer(42); - let b = $name::saturating_from_integer(-2); - assert_eq!($name::saturating_from_integer(-21), a / b); + if $name::SIGNED { + let a = $name::saturating_from_integer(42); + let b = $name::saturating_from_integer(-2); + assert_eq!($name::saturating_from_integer(-21), a / b); + } } #[test] - fn from_integer_works() { + fn saturating_from_integer_works() { let inner_max = <$name as FixedPointNumber>::Inner::max_value(); let inner_min = <$name as FixedPointNumber>::Inner::min_value(); let accuracy = $name::accuracy(); @@ -798,7 +810,7 @@ macro_rules! implement_fixed { assert_eq!(a.into_inner(), 42 * accuracy); let a = $name::saturating_from_integer(-42); - assert_eq!(a.into_inner(), -42 * accuracy); + assert_eq!(a.into_inner(), 0.saturating_sub(42 * accuracy)); // Max/min integers that fit. let a = $name::saturating_from_integer(inner_max / accuracy); @@ -811,7 +823,7 @@ macro_rules! implement_fixed { let a = $name::saturating_from_integer(inner_max / accuracy + 1); assert_eq!(a.into_inner(), inner_max); - let a = $name::saturating_from_integer(inner_min / accuracy - 1); + let a = $name::saturating_from_integer((inner_min / accuracy).saturating_sub(1)); assert_eq!(a.into_inner(), inner_min); } @@ -821,30 +833,35 @@ macro_rules! implement_fixed { let inner_min = <$name as FixedPointNumber>::Inner::min_value(); let accuracy = $name::accuracy(); - // Cases where integer fits. + // Case where integer fits. let a = $name::checked_from_integer(42) .expect("42 * accuracy <= inner_max; qed"); assert_eq!(a.into_inner(), 42 * accuracy); - let a = $name::checked_from_integer(-42) - .expect("-42 * accuracy >= inner_min; qed"); - assert_eq!(a.into_inner(), -42 * accuracy); - - // Max/min integers that fit. + // Max integer that fit. let a = $name::checked_from_integer(inner_max / accuracy) .expect("(inner_max / accuracy) * accuracy <= inner_max; qed"); assert_eq!(a.into_inner(), (inner_max / accuracy) * accuracy); - let a = $name::checked_from_integer(inner_min / accuracy) - .expect("(inner_min / accuracy) * accuracy <= inner_min; qed"); - assert_eq!(a.into_inner(), (inner_min / accuracy) * accuracy); - - // Cases where integer doesn't fit, so it returns `None`. + // Case where integer doesn't fit, so it returns `None`. let a = $name::checked_from_integer(inner_max / accuracy + 1); assert_eq!(a, None); - let a = $name::checked_from_integer(inner_min / accuracy - 1); - assert_eq!(a, None); + if $name::SIGNED { + // Case where integer fits. + let a = $name::checked_from_integer(0.saturating_sub(42)) + .expect("-42 * accuracy >= inner_min; qed"); + assert_eq!(a.into_inner(), 0 - 42 * accuracy); + + // Min integer that fit. + let a = $name::checked_from_integer(inner_min / accuracy) + .expect("(inner_min / accuracy) * accuracy <= inner_min; qed"); + assert_eq!(a.into_inner(), (inner_min / accuracy) * accuracy); + + // Case where integer doesn't fit, so it returns `None`. + let a = $name::checked_from_integer(inner_min / accuracy - 1); + assert_eq!(a, None); + } } #[test] @@ -873,21 +890,6 @@ macro_rules! implement_fixed { // Positive case: 2.5 assert_eq!(a.into_inner(), 25 * accuracy / 10); - let a = $name::saturating_from_rational(-5, 2); - - // Negative case: -2.5 - assert_eq!(a.into_inner(), -25 * accuracy / 10); - - let a = $name::saturating_from_rational(5, -2); - - // Other negative case: -2.5 - assert_eq!(a.into_inner(), -25 * accuracy / 10); - - let a = $name::saturating_from_rational(-5, -2); - - // Other positive case: 2.5 - assert_eq!(a.into_inner(), 25 * accuracy / 10); - // Max - 1. let a = $name::saturating_from_rational(inner_max - 1, accuracy); assert_eq!(a.into_inner(), inner_max - 1); @@ -904,26 +906,68 @@ macro_rules! implement_fixed { let a = $name::saturating_from_rational(inner_min, accuracy); assert_eq!(a.into_inner(), inner_min); - // Max + 1, saturates. - let a = $name::saturating_from_rational(inner_max as u128 + 1, accuracy); - assert_eq!(a.into_inner(), inner_max); - - // Min - 1, saturates. - let a = $name::saturating_from_rational(inner_max as u128 + 2, -accuracy); - assert_eq!(a.into_inner(), inner_min); - // Zero. let a = $name::saturating_from_rational(0, 1); assert_eq!(a.into_inner(), 0); - let a = $name::saturating_from_rational(inner_max, -accuracy); - assert_eq!(a.into_inner(), -inner_max); + if $name::SIGNED { + // Negative case: -2.5 + let a = $name::saturating_from_rational(-5, 2); + assert_eq!(a.into_inner(), 0 - 25 * accuracy / 10); - let a = $name::saturating_from_rational(inner_min, -accuracy); - assert_eq!(a.into_inner(), inner_max); + // Other negative case: -2.5 + let a = $name::saturating_from_rational(5, -2); + assert_eq!(a.into_inner(), 0 - 25 * accuracy / 10); - let a = $name::saturating_from_rational(inner_min + 1, -accuracy); - assert_eq!(a.into_inner(), inner_max); + // Other positive case: 2.5 + let a = $name::saturating_from_rational(-5, -2); + assert_eq!(a.into_inner(), 25 * accuracy / 10); + + // Max + 1, saturates. + let a = $name::saturating_from_rational(inner_max as u128 + 1, accuracy); + assert_eq!(a.into_inner(), inner_max); + + // Min - 1, saturates. + let a = $name::saturating_from_rational(inner_max as u128 + 2, 0 - accuracy); + assert_eq!(a.into_inner(), inner_min); + + let a = $name::saturating_from_rational(inner_max, 0 - accuracy); + assert_eq!(a.into_inner(), 0 - inner_max); + + let a = $name::saturating_from_rational(inner_min, 0 - accuracy); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_min + 1, 0 - accuracy); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_min, 0 - 1); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(inner_max, 0 - 1); + assert_eq!(a.into_inner(), inner_min); + + let a = $name::saturating_from_rational(inner_max, 0 - inner_max); + assert_eq!(a.into_inner(), 0 - accuracy); + + let a = $name::saturating_from_rational(0 - inner_max, inner_max); + assert_eq!(a.into_inner(), 0 - accuracy); + + let a = $name::saturating_from_rational(inner_max, 0 - 3 * accuracy); + assert_eq!(a.into_inner(), 0 - inner_max / 3); + + let a = $name::saturating_from_rational(inner_min, 0 - accuracy / 3); + assert_eq!(a.into_inner(), inner_max); + + let a = $name::saturating_from_rational(1, 0 - accuracy); + assert_eq!(a.into_inner(), 0.saturating_sub(1)); + + let a = $name::saturating_from_rational(inner_min, inner_min); + assert_eq!(a.into_inner(), accuracy); + + // Out of accuracy. + let a = $name::saturating_from_rational(1, 0 - accuracy - 1); + assert_eq!(a.into_inner(), 0); + } let a = $name::saturating_from_rational(inner_max - 1, accuracy); assert_eq!(a.into_inner(), inner_max - 1); @@ -937,51 +981,24 @@ macro_rules! implement_fixed { let a = $name::saturating_from_rational(inner_min, 1); assert_eq!(a.into_inner(), inner_min); - let a = $name::saturating_from_rational(inner_min, -1); - assert_eq!(a.into_inner(), inner_max); - - let a = $name::saturating_from_rational(inner_max, -1); - assert_eq!(a.into_inner(), inner_min); - let a = $name::saturating_from_rational(inner_max, inner_max); assert_eq!(a.into_inner(), accuracy); - let a = $name::saturating_from_rational(inner_min, inner_min); - assert_eq!(a.into_inner(), accuracy); - - let a = $name::saturating_from_rational(inner_max, -inner_max); - assert_eq!(a.into_inner(), -accuracy); - - let a = $name::saturating_from_rational(-inner_max, inner_max); - assert_eq!(a.into_inner(), -accuracy); - let a = $name::saturating_from_rational(inner_max, 3 * accuracy); assert_eq!(a.into_inner(), inner_max / 3); - let a = $name::saturating_from_rational(inner_max, -3 * accuracy); - assert_eq!(a.into_inner(), -inner_max / 3); - let a = $name::saturating_from_rational(inner_min, 2 * accuracy); assert_eq!(a.into_inner(), inner_min / 2); - let a = $name::saturating_from_rational(inner_min, accuracy / -3); - assert_eq!(a.into_inner(), inner_max); - let a = $name::saturating_from_rational(inner_min, accuracy / 3); assert_eq!(a.into_inner(), inner_min); let a = $name::saturating_from_rational(1, accuracy); assert_eq!(a.into_inner(), 1); - let a = $name::saturating_from_rational(1, -accuracy); - assert_eq!(a.into_inner(), -1); - // Out of accuracy. let a = $name::saturating_from_rational(1, accuracy + 1); assert_eq!(a.into_inner(), 0); - - let a = $name::saturating_from_rational(1, -accuracy - 1); - assert_eq!(a.into_inner(), 0); } #[test] @@ -1011,39 +1028,41 @@ macro_rules! implement_fixed { assert_eq!(a.into_inner(), inner_min); // Max + 1 => Overflow => None. - let a = $name::checked_from_rational(inner_min, -accuracy); + let a = $name::checked_from_rational(inner_min, 0.saturating_sub(accuracy)); assert_eq!(a, None); - // Min - 1 => Underflow => None. - let a = $name::checked_from_rational(inner_max as u128 + 2, -accuracy); - assert_eq!(a, None); + if $name::SIGNED { + // Min - 1 => Underflow => None. + let a = $name::checked_from_rational(inner_max as u128 + 2, 0.saturating_sub(accuracy)); + assert_eq!(a, None); + + let a = $name::checked_from_rational(inner_max, 0 - 3 * accuracy).unwrap(); + assert_eq!(a.into_inner(), 0 - inner_max / 3); + + let a = $name::checked_from_rational(inner_min, 0 - accuracy / 3); + assert_eq!(a, None); + + let a = $name::checked_from_rational(1, 0 - accuracy).unwrap(); + assert_eq!(a.into_inner(), 0.saturating_sub(1)); + + let a = $name::checked_from_rational(1, 0 - accuracy - 1).unwrap(); + assert_eq!(a.into_inner(), 0); + + let a = $name::checked_from_rational(inner_min, accuracy / 3); + assert_eq!(a, None); + } let a = $name::checked_from_rational(inner_max, 3 * accuracy).unwrap(); assert_eq!(a.into_inner(), inner_max / 3); - let a = $name::checked_from_rational(inner_max, -3 * accuracy).unwrap(); - assert_eq!(a.into_inner(), -inner_max / 3); - let a = $name::checked_from_rational(inner_min, 2 * accuracy).unwrap(); assert_eq!(a.into_inner(), inner_min / 2); - let a = $name::checked_from_rational(inner_min, accuracy / -3); - assert_eq!(a, None); - - let a = $name::checked_from_rational(inner_min, accuracy / 3); - assert_eq!(a, None); - let a = $name::checked_from_rational(1, accuracy).unwrap(); assert_eq!(a.into_inner(), 1); - let a = $name::checked_from_rational(1, -accuracy).unwrap(); - assert_eq!(a.into_inner(), -1); - let a = $name::checked_from_rational(1, accuracy + 1).unwrap(); assert_eq!(a.into_inner(), 0); - - let a = $name::checked_from_rational(1, -accuracy - 1).unwrap(); - assert_eq!(a.into_inner(), 0); } #[test] @@ -1056,24 +1075,26 @@ macro_rules! implement_fixed { // Max + 1 => None. assert_eq!(a.checked_mul_int(i128::max_value() / 2 + 1), None); - // Min - 1. - assert_eq!(a.checked_mul_int((i128::min_value() + 1) / 2), Some(i128::min_value() + 2)); - // Min. - assert_eq!(a.checked_mul_int(i128::min_value() / 2), Some(i128::min_value())); - // Min + 1 => None. - assert_eq!(a.checked_mul_int(i128::min_value() / 2 - 1), None); + if $name::SIGNED { + // Min - 1. + assert_eq!(a.checked_mul_int((i128::min_value() + 1) / 2), Some(i128::min_value() + 2)); + // Min. + assert_eq!(a.checked_mul_int(i128::min_value() / 2), Some(i128::min_value())); + // Min + 1 => None. + assert_eq!(a.checked_mul_int(i128::min_value() / 2 - 1), None); + + let b = $name::saturating_from_rational(1, -2); + assert_eq!(b.checked_mul_int(42i128), Some(-21)); + assert_eq!(b.checked_mul_int(u128::max_value()), None); + assert_eq!(b.checked_mul_int(i128::max_value()), Some(i128::max_value() / -2)); + assert_eq!(b.checked_mul_int(i128::min_value()), Some(i128::min_value() / -2)); + } let a = $name::saturating_from_rational(1, 2); assert_eq!(a.checked_mul_int(42i128), Some(21)); assert_eq!(a.checked_mul_int(i128::max_value()), Some(i128::max_value() / 2)); assert_eq!(a.checked_mul_int(i128::min_value()), Some(i128::min_value() / 2)); - let b = $name::saturating_from_rational(1, -2); - assert_eq!(b.checked_mul_int(42i128), Some(-21)); - assert_eq!(b.checked_mul_int(u128::max_value()), None); - assert_eq!(b.checked_mul_int(i128::max_value()), Some(i128::max_value() / -2)); - assert_eq!(b.checked_mul_int(i128::min_value()), Some(i128::min_value() / -2)); - let c = $name::saturating_from_integer(255); assert_eq!(c.checked_mul_int(2i8), None); assert_eq!(c.checked_mul_int(2i128), Some(510)); @@ -1098,17 +1119,19 @@ macro_rules! implement_fixed { // Min + 1 => saturates to min. assert_eq!(a.saturating_mul_int(i128::min_value() / 2 - 1), i128::min_value()); + if $name::SIGNED { + let b = $name::saturating_from_rational(1, -2); + assert_eq!(b.saturating_mul_int(42i32), -21); + assert_eq!(b.saturating_mul_int(i128::max_value()), i128::max_value() / -2); + assert_eq!(b.saturating_mul_int(i128::min_value()), i128::min_value() / -2); + assert_eq!(b.saturating_mul_int(u128::max_value()), u128::min_value()); + } + let a = $name::saturating_from_rational(1, 2); assert_eq!(a.saturating_mul_int(42i32), 21); assert_eq!(a.saturating_mul_int(i128::max_value()), i128::max_value() / 2); assert_eq!(a.saturating_mul_int(i128::min_value()), i128::min_value() / 2); - let b = $name::saturating_from_rational(1, -2); - assert_eq!(b.saturating_mul_int(42i32), -21); - assert_eq!(b.saturating_mul_int(i128::max_value()), i128::max_value() / -2); - assert_eq!(b.saturating_mul_int(i128::min_value()), i128::min_value() / -2); - assert_eq!(b.saturating_mul_int(u128::max_value()), u128::min_value()); - let c = $name::saturating_from_integer(255); assert_eq!(c.saturating_mul_int(2i8), i8::max_value()); assert_eq!(c.saturating_mul_int(-2i8), i8::min_value()); @@ -1135,34 +1158,36 @@ macro_rules! implement_fixed { let e = $name::from_inner(1); assert_eq!(a.checked_mul(&(c/2.into()+e)), None); - // Min + 1. - let b = $name::from_inner(inner_min + 1) / 2.into(); - let c = $name::from_inner(inner_min + 2); - assert_eq!(a.checked_mul(&b), Some(c)); + if $name::SIGNED { + // Min + 1. + let b = $name::from_inner(inner_min + 1) / 2.into(); + let c = $name::from_inner(inner_min + 2); + assert_eq!(a.checked_mul(&b), Some(c)); - // Min. - let b = $name::from_inner(inner_min) / 2.into(); - let c = $name::from_inner(inner_min); - assert_eq!(a.checked_mul(&b), Some(c)); + // Min. + let b = $name::from_inner(inner_min) / 2.into(); + let c = $name::from_inner(inner_min); + assert_eq!(a.checked_mul(&b), Some(c)); + + // Min - 1 => None. + let b = $name::from_inner(inner_min) / 2.into() - $name::from_inner(1); + assert_eq!(a.checked_mul(&b), None); - // Min - 1 => None. - let b = $name::from_inner(inner_min) / 2.into() - $name::from_inner(1); - assert_eq!(a.checked_mul(&b), None); + let c = $name::saturating_from_integer(255); + let b = $name::saturating_from_rational(1, -2); + + assert_eq!(b.checked_mul(&42.into()), Some(0.saturating_sub(21).into())); + assert_eq!(b.checked_mul(&$name::max_value()), $name::max_value().checked_div(&0.saturating_sub(2).into())); + assert_eq!(b.checked_mul(&$name::min_value()), $name::min_value().checked_div(&0.saturating_sub(2).into())); + assert_eq!(c.checked_mul(&$name::min_value()), None); + } let a = $name::saturating_from_rational(1, 2); - let b = $name::saturating_from_rational(1, -2); let c = $name::saturating_from_integer(255); assert_eq!(a.checked_mul(&42.into()), Some(21.into())); - assert_eq!(b.checked_mul(&42.into()), Some((-21).into())); assert_eq!(c.checked_mul(&2.into()), Some(510.into())); - - assert_eq!(b.checked_mul(&$name::max_value()), $name::max_value().checked_div(&(-2).into())); - assert_eq!(b.checked_mul(&$name::min_value()), $name::min_value().checked_div(&(-2).into())); - assert_eq!(c.checked_mul(&$name::max_value()), None); - assert_eq!(c.checked_mul(&$name::min_value()), None); - assert_eq!(a.checked_mul(&$name::max_value()), $name::max_value().checked_div(&2.into())); assert_eq!(a.checked_mul(&$name::min_value()), $name::min_value().checked_div(&2.into())); } @@ -1188,25 +1213,27 @@ macro_rules! implement_fixed { assert_eq!(a.checked_div_int(inner_max / accuracy), Some(1)); assert_eq!(a.checked_div_int(1i8), None); - assert_eq!(a.checked_div_int(-2), Some(-inner_max / (2 * accuracy))); - assert_eq!(a.checked_div_int(inner_max / -accuracy), Some(-1)); + if b < c { + // Not executed by unsigned inners. + assert_eq!(a.checked_div_int(0.saturating_sub(2)), Some(0.saturating_sub(inner_max / (2 * accuracy)))); + assert_eq!(a.checked_div_int(0.saturating_sub(inner_max / accuracy)), Some(0.saturating_sub(1))); + assert_eq!(b.checked_div_int(i128::min_value()), Some(0)); + assert_eq!(b.checked_div_int(inner_min / accuracy), Some(1)); + assert_eq!(b.checked_div_int(1i8), None); + assert_eq!(b.checked_div_int(0.saturating_sub(2)), Some(0.saturating_sub(inner_min / (2 * accuracy)))); + assert_eq!(b.checked_div_int(0.saturating_sub(inner_min / accuracy)), Some(0.saturating_sub(1))); + assert_eq!(c.checked_div_int(i128::min_value()), Some(0)); + assert_eq!(d.checked_div_int(i32::min_value()), Some(0)); + } - assert_eq!(b.checked_div_int(i128::min_value()), Some(0)); assert_eq!(b.checked_div_int(2), Some(inner_min / (2 * accuracy))); - assert_eq!(b.checked_div_int(inner_min / accuracy), Some(1)); - assert_eq!(b.checked_div_int(1i8), None); - - assert_eq!(b.checked_div_int(-2), Some(-(inner_min / (2 * accuracy)))); - assert_eq!(b.checked_div_int(-(inner_min / accuracy)), Some(-1)); assert_eq!(c.checked_div_int(1), Some(0)); assert_eq!(c.checked_div_int(i128::max_value()), Some(0)); - assert_eq!(c.checked_div_int(i128::min_value()), Some(0)); assert_eq!(c.checked_div_int(1i8), Some(0)); assert_eq!(d.checked_div_int(1), Some(1)); assert_eq!(d.checked_div_int(i32::max_value()), Some(0)); - assert_eq!(d.checked_div_int(i32::min_value()), Some(0)); assert_eq!(d.checked_div_int(1i8), Some(1)); assert_eq!(a.checked_div_int(0), None); @@ -1230,14 +1257,16 @@ macro_rules! implement_fixed { let a = $name::saturating_from_integer(5); assert_eq!(a.saturating_div_int(2), 2); - let a = $name::saturating_from_integer(5); - assert_eq!(a.saturating_div_int(-2), -2); - - let a = $name::min_value(); - assert_eq!(a.saturating_div_int(-1i128), (inner_max / accuracy) as i128); - let a = $name::min_value(); assert_eq!(a.saturating_div_int(1i128), (inner_min / accuracy) as i128); + + if $name::SIGNED { + let a = $name::saturating_from_integer(5); + assert_eq!(a.saturating_div_int(-2), -2); + + let a = $name::min_value(); + assert_eq!(a.saturating_div_int(-1i128), (inner_max / accuracy) as i128); + } } #[test] @@ -1245,10 +1274,13 @@ macro_rules! implement_fixed { let inner_max = <$name as FixedPointNumber>::Inner::max_value(); let inner_min = <$name as FixedPointNumber>::Inner::min_value(); - assert_eq!($name::from_inner(inner_min).saturating_abs(), $name::max_value()); assert_eq!($name::from_inner(inner_max).saturating_abs(), $name::max_value()); assert_eq!($name::zero().saturating_abs(), 0.into()); - assert_eq!($name::saturating_from_rational(-1, 2).saturating_abs(), (1, 2).into()); + + if $name::SIGNED { + assert_eq!($name::from_inner(inner_min).saturating_abs(), $name::max_value()); + assert_eq!($name::saturating_from_rational(-1, 2).saturating_abs(), (1, 2).into()); + } } #[test] @@ -1262,10 +1294,12 @@ macro_rules! implement_fixed { assert_eq!($name::one().saturating_mul_acc_int(u128::max_value() / 2), u128::max_value() - 1); assert_eq!($name::one().saturating_mul_acc_int(u128::min_value()), u128::min_value()); - let a = $name::saturating_from_rational(-1, 2); - assert_eq!(a.saturating_mul_acc_int(42i8), 21i8); - assert_eq!(a.saturating_mul_acc_int(42u8), 21u8); - assert_eq!(a.saturating_mul_acc_int(u128::max_value() - 1), u128::max_value() / 2); + if $name::SIGNED { + let a = $name::saturating_from_rational(-1, 2); + assert_eq!(a.saturating_mul_acc_int(42i8), 21i8); + assert_eq!(a.saturating_mul_acc_int(42u8), 21u8); + assert_eq!(a.saturating_mul_acc_int(u128::max_value() - 1), u128::max_value() / 2); + } } #[test] @@ -1277,15 +1311,18 @@ macro_rules! implement_fixed { assert_eq!($name::saturating_from_integer(2).saturating_pow(50), $name::saturating_from_integer(1125899906842624i64)); - // Saturating. - assert_eq!($name::saturating_from_integer(2).saturating_pow(68), $name::max_value()); - assert_eq!($name::saturating_from_integer(1).saturating_pow(1000), (1).into()); - assert_eq!($name::saturating_from_integer(-1).saturating_pow(1000), (1).into()); - assert_eq!($name::saturating_from_integer(-1).saturating_pow(1001), (-1).into()); assert_eq!($name::saturating_from_integer(1).saturating_pow(usize::max_value()), (1).into()); - assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value()), (-1).into()); - assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value() - 1), (1).into()); + + if $name::SIGNED { + // Saturating. + assert_eq!($name::saturating_from_integer(2).saturating_pow(68), $name::max_value()); + + assert_eq!($name::saturating_from_integer(-1).saturating_pow(1000), (1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(1001), 0.saturating_sub(1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value()), 0.saturating_sub(1).into()); + assert_eq!($name::saturating_from_integer(-1).saturating_pow(usize::max_value() - 1), (1).into()); + } assert_eq!($name::saturating_from_integer(114209).saturating_pow(5), $name::max_value()); @@ -1314,19 +1351,18 @@ macro_rules! implement_fixed { assert_eq!(a.checked_div(&$name::max_value()), Some(1.into())); assert_eq!(a.checked_div(&d), Some(a)); - assert_eq!(a.checked_div(&(-2).into()), Some($name::from_inner(-inner_max / 2))); - assert_eq!(a.checked_div(&-$name::max_value()), Some((-1).into())); + if b < c { + // Not executed by unsigned inners. + assert_eq!(a.checked_div(&0.saturating_sub(2).into()), Some($name::from_inner(0.saturating_sub(inner_max / 2)))); + assert_eq!(a.checked_div(&-$name::max_value()), Some(0.saturating_sub(1).into())); + assert_eq!(b.checked_div(&0.saturating_sub(2).into()), Some($name::from_inner(0.saturating_sub(inner_min / 2)))); + assert_eq!(c.checked_div(&$name::max_value()), Some(0.into())); + assert_eq!(b.checked_div(&b), Some($name::one())); + } - assert_eq!(b.checked_div(&b), Some($name::one())); assert_eq!(b.checked_div(&2.into()), Some($name::from_inner(inner_min / 2))); - - assert_eq!(b.checked_div(&(-2).into()), Some($name::from_inner(inner_min / -2))); - assert_eq!(b.checked_div(&a), Some((-1).into())); - + assert_eq!(b.checked_div(&a), Some(0.saturating_sub(1).into())); assert_eq!(c.checked_div(&1.into()), Some(0.into())); - assert_eq!(c.checked_div(&$name::max_value()), Some(0.into())); - assert_eq!(c.checked_div(&$name::min_value()), Some(0.into())); - assert_eq!(d.checked_div(&1.into()), Some(1.into())); assert_eq!(a.checked_div(&$name::one()), Some(a)); @@ -1345,8 +1381,10 @@ macro_rules! implement_fixed { let n = $name::saturating_from_rational(5, 2).trunc(); assert_eq!(n, $name::saturating_from_integer(2)); - let n = $name::saturating_from_rational(-5, 2).trunc(); - assert_eq!(n, $name::saturating_from_integer(-2)); + if $name::SIGNED { + let n = $name::saturating_from_rational(-5, 2).trunc(); + assert_eq!(n, $name::saturating_from_integer(-2)); + } } #[test] @@ -1357,12 +1395,6 @@ macro_rules! implement_fixed { assert_eq!(n, i + f); - let n = $name::saturating_from_rational(-5, 2); - let i = n.trunc(); - let f = n.frac(); - - assert_eq!(n, i - f); - let n = $name::saturating_from_rational(5, 2) .frac() .saturating_mul(10.into()); @@ -1373,16 +1405,23 @@ macro_rules! implement_fixed { .saturating_mul(10.into()); assert_eq!(n, 5.into()); - // The sign is attached to the integer part unless it is zero. - let n = $name::saturating_from_rational(-5, 2) - .frac() - .saturating_mul(10.into()); - assert_eq!(n, 5.into()); - - let n = $name::saturating_from_rational(-1, 2) - .frac() - .saturating_mul(10.into()); - assert_eq!(n, (-5).into()); + if $name::SIGNED { + let n = $name::saturating_from_rational(-5, 2); + let i = n.trunc(); + let f = n.frac(); + assert_eq!(n, i - f); + + // The sign is attached to the integer part unless it is zero. + let n = $name::saturating_from_rational(-5, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, 5.into()); + + let n = $name::saturating_from_rational(-1, 2) + .frac() + .saturating_mul(10.into()); + assert_eq!(n, 0.saturating_sub(5).into()); + } } #[test] @@ -1391,7 +1430,7 @@ macro_rules! implement_fixed { assert_eq!(n.ceil(), 3.into()); let n = $name::saturating_from_rational(-5, 2); - assert_eq!(n.ceil(), (-2).into()); + assert_eq!(n.ceil(), 0.saturating_sub(2).into()); // On the limits: let n = $name::max_value(); @@ -1407,7 +1446,7 @@ macro_rules! implement_fixed { assert_eq!(n.floor(), 2.into()); let n = $name::saturating_from_rational(-5, 2); - assert_eq!(n.floor(), (-3).into()); + assert_eq!(n.floor(), 0.saturating_sub(3).into()); // On the limits: let n = $name::max_value(); @@ -1429,7 +1468,7 @@ macro_rules! implement_fixed { assert_eq!(n.round(), 3.into()); let n = $name::saturating_from_rational(-5, 2); - assert_eq!(n.round(), (-3).into()); + assert_eq!(n.round(), 0.saturating_sub(3).into()); // Saturating: let n = $name::max_value(); @@ -1448,14 +1487,6 @@ macro_rules! implement_fixed { assert_eq!(n.round(), ($name::max_value() - 1.into()).trunc()); - // floor(min + 1) - 0.33.. - let n = $name::min_value() - .saturating_add(1.into()) - .trunc() - .saturating_sub((1, 3).into()); - - assert_eq!(n.round(), ($name::min_value() + 1.into()).trunc()); - // floor(max - 1) + 0.5 let n = $name::max_value() .saturating_sub(1.into()) @@ -1464,13 +1495,23 @@ macro_rules! implement_fixed { assert_eq!(n.round(), $name::max_value().trunc()); - // floor(min + 1) - 0.5 - let n = $name::min_value() - .saturating_add(1.into()) - .trunc() - .saturating_sub((1, 2).into()); + if $name::SIGNED { + // floor(min + 1) - 0.33.. + let n = $name::min_value() + .saturating_add(1.into()) + .trunc() + .saturating_sub((1, 3).into()); + + assert_eq!(n.round(), ($name::min_value() + 1.into()).trunc()); - assert_eq!(n.round(), $name::min_value().trunc()); + // floor(min + 1) - 0.5 + let n = $name::min_value() + .saturating_add(1.into()) + .trunc() + .saturating_sub((1, 2).into()); + + assert_eq!(n.round(), $name::min_value().trunc()); + } } #[test] @@ -1496,9 +1537,6 @@ macro_rules! implement_fixed { let one = $name::one(); assert_eq!(format!("{:?}", one), format!("{}(1.{:0>weight$})", stringify!($name), 0, weight=precision())); - let neg = -$name::one(); - assert_eq!(format!("{:?}", neg), format!("{}(-1.{:0>weight$})", stringify!($name), 0, weight=precision())); - let frac = $name::saturating_from_rational(1, 2); assert_eq!(format!("{:?}", frac), format!("{}(0.{:0weight$})", stringify!($name), 0, weight=precision())); + + let frac = $name::saturating_from_rational(-314, 100); + assert_eq!(format!("{:?}", frac), format!("{}(-3.{:0 Self { - checked_pow(self, exp).unwrap_or_else(Bounded::max_value) + let neg = self < T::zero() && exp % 2 != 0; + checked_pow(self, exp) + .unwrap_or_else(|| + if neg { + Bounded::min_value() + } else { + Bounded::max_value() + } + ) } } diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 52ae46c662..fe156fe738 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -71,8 +71,8 @@ pub use sp_core::RuntimeDebug; /// Re-export top-level arithmetic stuff. pub use sp_arithmetic::{ - Perquintill, Perbill, Permill, Percent, PerU16, Rational128, Fixed64, Fixed128, - PerThing, traits::SaturatedConversion, FixedPointNumber, FixedPointOperand, + PerThing, traits::SaturatedConversion, Perquintill, Perbill, Permill, Percent, PerU16, + Rational128, FixedI64, FixedI128, FixedU128, FixedPointNumber, FixedPointOperand, }; /// Re-export 128 bit helpers. pub use sp_arithmetic::helpers_128bit; -- GitLab From d68cfd7cd5c64cb0965b49d9868aff02849e077c Mon Sep 17 00:00:00 2001 From: Ashley Date: Sat, 6 Jun 2020 13:06:22 +0200 Subject: [PATCH 116/280] Fix the metered unbounded sender/recievers (#6246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix the metered unbounded sender/recievers * Use a counter instead * Update client/rpc/src/system/tests.rs * Add an is_terminated check * Add FusedStream impl Co-authored-by: Bastian Köcher --- client/rpc/src/system/tests.rs | 5 ++-- client/service/src/client/client.rs | 5 ++-- client/service/src/status_sinks.rs | 4 +-- primitives/utils/src/metrics.rs | 10 ++++---- primitives/utils/src/mpsc.rs | 40 +++++++++++++++++++++-------- 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/client/rpc/src/system/tests.rs b/client/rpc/src/system/tests.rs index 25ebd80953..7fe5cdc752 100644 --- a/client/rpc/src/system/tests.rs +++ b/client/rpc/src/system/tests.rs @@ -22,7 +22,8 @@ use sc_network::{self, PeerId}; use sc_network::config::Role; use substrate_test_runtime_client::runtime::Block; use assert_matches::assert_matches; -use futures::{prelude::*, channel::mpsc}; +use futures::prelude::*; +use sp_utils::mpsc::tracing_unbounded; use std::thread; struct Status { @@ -46,7 +47,7 @@ impl Default for Status { fn api>>(sync: T) -> System { let status = sync.into().unwrap_or_default(); let should_have_peers = !status.is_dev; - let (tx, rx) = mpsc::unbounded(); + let (tx, rx) = tracing_unbounded("rpc_system_tests"); thread::spawn(move || { futures::executor::block_on(rx.for_each(move |request| { match request { diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index fcbaab8851..5040d36774 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -80,7 +80,7 @@ use sc_client_api::{ KeyIterator, CallExecutor, ExecutorProvider, ProofProvider, cht, UsageProvider }; -use sp_utils::mpsc::tracing_unbounded; +use sp_utils::mpsc::{TracingUnboundedSender, tracing_unbounded}; use sp_blockchain::Error; use prometheus_endpoint::Registry; use super::{ @@ -88,7 +88,6 @@ use super::{ light::{call_executor::prove_execution, fetcher::ChangesProof}, block_rules::{BlockRules, LookupResult as BlockLookupResult}, }; -use futures::channel::mpsc; use rand::Rng; #[cfg(feature="test-helpers")] @@ -99,7 +98,7 @@ use { super::call_executor::LocalCallExecutor, }; -type NotificationSinks = Mutex>>; +type NotificationSinks = Mutex>>; /// Substrate Client pub struct Client where Block: BlockT { diff --git a/client/service/src/status_sinks.rs b/client/service/src/status_sinks.rs index 4b1dce52f9..c3de468ab0 100644 --- a/client/service/src/status_sinks.rs +++ b/client/service/src/status_sinks.rs @@ -109,7 +109,7 @@ impl futures::Future for YieldAfter { mod tests { use super::StatusSinks; use futures::prelude::*; - use futures::channel::mpsc; + use sp_utils::mpsc::tracing_unbounded; use std::time::Duration; use std::task::Poll; @@ -120,7 +120,7 @@ mod tests { let mut status_sinks = StatusSinks::new(); - let (tx, rx) = mpsc::unbounded(); + let (tx, rx) = tracing_unbounded("status_sink_test"); status_sinks.push(Duration::from_millis(100), tx); let mut val_order = 5; diff --git a/primitives/utils/src/metrics.rs b/primitives/utils/src/metrics.rs index b991ce016b..a66589b592 100644 --- a/primitives/utils/src/metrics.rs +++ b/primitives/utils/src/metrics.rs @@ -23,8 +23,8 @@ use prometheus::{ core::{ AtomicU64, GenericGauge, GenericCounter }, }; -#[cfg(features = "metered")] -use prometheus::{core::GenericGaugeVec, Opts}; +#[cfg(feature = "metered")] +use prometheus::{core::GenericCounterVec, Opts}; lazy_static! { @@ -37,9 +37,9 @@ lazy_static! { ).expect("Creating of statics doesn't fail. qed"); } -#[cfg(features = "metered")] +#[cfg(feature = "metered")] lazy_static! { - pub static ref UNBOUNDED_CHANNELS_COUNTER : GenericGaugeVec = GenericGaugeVec::new( + pub static ref UNBOUNDED_CHANNELS_COUNTER : GenericCounterVec = GenericCounterVec::new( Opts::new("unbounded_channel_len", "Items in each mpsc::unbounded instance"), &["entity", "action"] // 'name of channel, send|received|dropped ).expect("Creating of statics doesn't fail. qed"); @@ -52,7 +52,7 @@ pub fn register_globals(registry: &Registry) -> Result<(), PrometheusError> { registry.register(Box::new(TOKIO_THREADS_ALIVE.clone()))?; registry.register(Box::new(TOKIO_THREADS_TOTAL.clone()))?; - #[cfg(features = "metered")] + #[cfg(feature = "metered")] registry.register(Box::new(UNBOUNDED_CHANNELS_COUNTER.clone()))?; Ok(()) diff --git a/primitives/utils/src/mpsc.rs b/primitives/utils/src/mpsc.rs index 827195388f..70baa006bd 100644 --- a/primitives/utils/src/mpsc.rs +++ b/primitives/utils/src/mpsc.rs @@ -17,7 +17,7 @@ //! Features to meter unbounded channels -#[cfg(not(features = "metered"))] +#[cfg(not(feature = "metered"))] mod inner { // just aliased, non performance implications use futures::channel::mpsc::{self, UnboundedReceiver, UnboundedSender}; @@ -31,22 +31,29 @@ mod inner { } -#[cfg(features = "metered")] +#[cfg(feature = "metered")] mod inner { //tracing implementation use futures::channel::mpsc::{self, UnboundedReceiver, UnboundedSender, TryRecvError, TrySendError, SendError }; - use futures::{sink::Sink, task::{Poll, Context}, stream::Stream}; + use futures::{sink::Sink, task::{Poll, Context}, stream::{Stream, FusedStream}}; use std::pin::Pin; use crate::metrics::UNBOUNDED_CHANNELS_COUNTER; /// Wrapper Type around `UnboundedSender` that increases the global /// measure when a message is added - #[derive(Debug, Clone)] + #[derive(Debug)] pub struct TracingUnboundedSender(&'static str, UnboundedSender); + // Strangely, deriving `Clone` requires that `T` is also `Clone`. + impl Clone for TracingUnboundedSender { + fn clone(&self) -> Self { + Self(self.0, self.1.clone()) + } + } + /// Wrapper Type around `UnboundedReceiver` that decreases the global /// measure when a message is polled #[derive(Debug)] @@ -88,7 +95,7 @@ mod inner { /// Proxy function to mpsc::UnboundedSender pub fn unbounded_send(&self, msg: T) -> Result<(), TrySendError> { self.1.unbounded_send(msg).map(|s|{ - UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"send"]).incr(); + UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"send"]).inc(); s }) } @@ -104,13 +111,19 @@ mod inner { fn consume(&mut self) { // consume all items, make sure to reflect the updated count let mut count = 0; - while let Ok(Some(..)) = self.try_next() { - count += 1; - } + loop { + if self.1.is_terminated() { + break; + } + match self.try_next() { + Ok(Some(..)) => count += 1, + _ => break + } + } // and discount the messages if count > 0 { - UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"dropped"]).incr_by(count); + UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"dropped"]).inc_by(count); } } @@ -127,7 +140,7 @@ mod inner { pub fn try_next(&mut self) -> Result, TryRecvError> { self.1.try_next().map(|s| { if s.is_some() { - UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"received"]).incr(); + UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, &"received"]).inc(); } s }) @@ -153,7 +166,7 @@ mod inner { match Pin::new(&mut s.1).poll_next(cx) { Poll::Ready(msg) => { if msg.is_some() { - UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[self.0, "received"]).incr(); + UNBOUNDED_CHANNELS_COUNTER.with_label_values(&[s.0, "received"]).inc(); } Poll::Ready(msg) } @@ -164,6 +177,11 @@ mod inner { } } + impl FusedStream for TracingUnboundedReceiver { + fn is_terminated(&self) -> bool { + self.1.is_terminated() + } + } impl Sink for TracingUnboundedSender { type Error = SendError; -- GitLab From 9fe0da54ff01747a84104562e61c7a2aab8da589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 8 Jun 2020 12:38:19 +0200 Subject: [PATCH 117/280] Fix transaction pruning in tx-pool (#6276) The `tree_route` generated by the import notification is only from the old best block to the new best parent. This means, it does not contain the new best block in `enacted()`. We need to prune the transactions of the new best block "manually" to fix this bug. Besides that, this pr also changed the `id` parameter of the `NewBlock` chain event to `hash`. The hash of a block is unique in contrast to the block number. (Block id can either be number or hash) --- Cargo.lock | 2 + bin/node/cli/src/service.rs | 2 +- client/api/src/client.rs | 21 ++- .../basic-authorship/src/basic_authorship.rs | 20 +-- client/consensus/manual-seal/src/lib.rs | 5 +- client/service/src/builder.rs | 11 +- client/service/src/client/client.rs | 2 +- client/transaction-pool/Cargo.toml | 2 + client/transaction-pool/src/lib.rs | 14 +- client/transaction-pool/src/testing/pool.rs | 130 +++++++++++------- primitives/transaction-pool/src/pool.rs | 6 +- 11 files changed, 134 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 358f22463a..e53b05d1cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6745,10 +6745,12 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", + "sc-block-builder", "sc-client-api", "sc-transaction-graph", "sp-api", "sp-blockchain", + "sp-consensus", "sp-core", "sp-keyring", "sp-runtime", diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index b1604aeedb..af4cc5e127 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -490,7 +490,7 @@ mod tests { service.transaction_pool().maintain( ChainEvent::NewBlock { is_new_best: true, - id: parent_id.clone(), + hash: parent_header.hash(), tree_route: None, header: parent_header.clone(), }, diff --git a/client/api/src/client.rs b/client/api/src/client.rs index aa6763653d..42dd5d53b1 100644 --- a/client/api/src/client.rs +++ b/client/api/src/client.rs @@ -234,7 +234,7 @@ pub struct BlockImportNotification { pub header: Block::Header, /// Is this the new best block. pub is_new_best: bool, - /// Tree route from old best to new best. + /// Tree route from old best to new best parent. /// /// If `None`, there was no re-org while importing. pub tree_route: Option>>, @@ -248,3 +248,22 @@ pub struct FinalityNotification { /// Imported block header. pub header: Block::Header, } + +impl From> for sp_transaction_pool::ChainEvent { + fn from(n: BlockImportNotification) -> Self { + Self::NewBlock { + is_new_best: n.is_new_best, + hash: n.hash, + header: n.header, + tree_route: n.tree_route, + } + } +} + +impl From> for sp_transaction_pool::ChainEvent { + fn from(n: FinalityNotification) -> Self { + Self::Finalized { + hash: n.hash, + } + } +} diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index 39ebbc89be..f9321f5b9d 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -351,11 +351,11 @@ mod tests { }.into_signed_tx() } - fn chain_event(block_number: u64, header: B::Header) -> ChainEvent + fn chain_event(header: B::Header) -> ChainEvent where NumberFor: From { ChainEvent::NewBlock { - id: BlockId::Number(block_number.into()), + hash: header.hash(), tree_route: None, is_new_best: true, header, @@ -380,8 +380,9 @@ mod tests { futures::executor::block_on( txpool.maintain(chain_event( - 0, - client.header(&BlockId::Number(0u64)).expect("header get error").expect("there should be header") + client.header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header") )) ); @@ -470,7 +471,6 @@ mod tests { futures::executor::block_on( txpool.maintain(chain_event( - 0, client.header(&BlockId::Number(0u64)) .expect("header get error") .expect("there should be header"), @@ -574,8 +574,9 @@ mod tests { futures::executor::block_on( txpool.maintain(chain_event( - 0, - client.header(&BlockId::Number(0u64)).expect("header get error").expect("there should be header") + client.header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header") )) ); @@ -585,8 +586,9 @@ mod tests { futures::executor::block_on( txpool.maintain(chain_event( - 1, - client.header(&BlockId::Number(1)).expect("header get error").expect("there should be header") + client.header(&BlockId::Number(1)) + .expect("header get error") + .expect("there should be header") )) ); diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index a5366148a7..233a774a54 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -413,9 +413,10 @@ mod tests { assert!(client.header(&BlockId::Number(0)).unwrap().is_some()); assert!(pool.submit_one(&BlockId::Number(1), SOURCE, uxt(Alice, 1)).await.is_ok()); + let header = client.header(&BlockId::Number(1)).expect("db error").expect("imported above"); pool.maintain(sp_transaction_pool::ChainEvent::NewBlock { - id: BlockId::Number(1), - header: client.header(&BlockId::Number(1)).expect("db error").expect("imported above"), + hash: header.hash(), + header, is_new_best: true, tree_route: None, }).await; diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index c2af1a129b..e9fa1ff3e2 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -55,7 +55,7 @@ use std::{ }; use wasm_timer::SystemTime; use sc_telemetry::{telemetry, SUBSTRATE_INFO}; -use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent}; +use sp_transaction_pool::MaintainedTransactionPool; use prometheus_endpoint::Registry; use sc_client_db::{Backend, DatabaseSettings}; use sp_core::traits::CodeExecutor; @@ -1042,14 +1042,9 @@ ServiceBuilder< { let txpool = Arc::downgrade(&transaction_pool); - let mut import_stream = client.import_notification_stream().map(|n| ChainEvent::NewBlock { - id: BlockId::Hash(n.hash), - header: n.header, - tree_route: n.tree_route, - is_new_best: n.is_new_best, - }).fuse(); + let mut import_stream = client.import_notification_stream().map(Into::into).fuse(); let mut finality_stream = client.finality_notification_stream() - .map(|n| ChainEvent::Finalized:: { hash: n.hash }) + .map(Into::into) .fuse(); let events = async move { diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 5040d36774..a3d2489fd0 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -786,7 +786,7 @@ impl Client where NewBlockState::Normal }; - let tree_route = if is_new_best { + let tree_route = if is_new_best && info.best_hash != parent_hash { let route_from_best = sp_blockchain::tree_route( self.backend.blockchain(), info.best_hash, diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index 0b394da357..027f9b7041 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -36,5 +36,7 @@ wasm-timer = "0.2" assert_matches = "1.3.0" hex = "0.4" sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } substrate-test-runtime-transaction-pool = { version = "2.0.0-rc2", path = "../../test-utils/runtime/transaction-pool" } substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 326c5e1a75..b91992a47d 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -468,10 +468,11 @@ impl MaintainedTransactionPool for BasicPool { fn maintain(&self, event: ChainEvent) -> Pin + Send>> { match event { - ChainEvent::NewBlock { id, tree_route, is_new_best, .. } => { + ChainEvent::NewBlock { hash, tree_route, is_new_best, .. } => { let pool = self.pool.clone(); let api = self.api.clone(); + let id = BlockId::hash(hash); let block_number = match api.block_id_to_number(&id) { Ok(Some(number)) => number, _ => { @@ -495,13 +496,13 @@ impl MaintainedTransactionPool for BasicPool async move { // If there is a tree route, we use this to prune known tx based on the enacted - // blocks and otherwise we only prune known txs if the block is - // the new best block. + // blocks. if let Some(ref tree_route) = tree_route { future::join_all( tree_route .enacted() - .iter().map(|h| + .iter() + .map(|h| prune_known_txs_for_block( BlockId::Hash(h.hash.clone()), &*api, @@ -509,7 +510,10 @@ impl MaintainedTransactionPool for BasicPool ), ), ).await; - } else if is_new_best { + } + + // If this is a new best block, we need to prune its transactions from the pool. + if is_new_best { prune_known_txs_for_block(id.clone(), &*api, &*pool).await; } diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index dafd829c64..0f0c000489 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -18,7 +18,7 @@ use crate::*; use sp_transaction_pool::TransactionStatus; -use futures::executor::block_on; +use futures::executor::{block_on, block_on_stream}; use txpool::{self, Pool}; use sp_runtime::{ generic::BlockId, @@ -26,11 +26,15 @@ use sp_runtime::{ }; use substrate_test_runtime_client::{ runtime::{Block, Hash, Index, Header, Extrinsic, Transfer}, AccountKeyring::*, + ClientBlockImportExt, }; use substrate_test_runtime_transaction_pool::{TestApi, uxt}; use futures::{prelude::*, task::Poll}; use codec::Encode; use std::collections::BTreeSet; +use sc_client_api::client::BlockchainEvents; +use sc_block_builder::BlockBuilderProvider; +use sp_consensus::BlockOrigin; fn pool() -> Pool { Pool::new(Default::default(), TestApi::with_alice_nonce(209).into()) @@ -50,16 +54,6 @@ fn maintained_pool() -> ( (pool, thread_pool, notifier) } -fn header(number: u64) -> Header { - Header { - number, - digest: Default::default(), - extrinsics_root: Default::default(), - parent_hash: Default::default(), - state_root: Default::default(), - } -} - const SOURCE: TransactionSource = TransactionSource::External; #[test] @@ -153,7 +147,7 @@ fn only_prune_on_new_best() { assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Number(1), + hash: header.hash(), is_new_best: false, header: header.clone(), tree_route: None, @@ -163,7 +157,7 @@ fn only_prune_on_new_best() { let header = pool.api.push_block(2, vec![uxt]); let event = ChainEvent::NewBlock { - id: BlockId::Number(2), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -209,12 +203,12 @@ fn should_correctly_prune_transactions_providing_more_than_one_tag() { assert_eq!(pool.validated_pool().status().future, 2); } -fn block_event(id: u64) -> ChainEvent { +fn block_event(header: Header) -> ChainEvent { ChainEvent::NewBlock { - id: BlockId::number(id), + hash: header.hash(), is_new_best: true, tree_route: None, - header: header(id), + header, } } @@ -223,10 +217,10 @@ fn block_event_with_retracted( retracted_start: Hash, api: &TestApi, ) -> ChainEvent { - let tree_route = api.tree_route(retracted_start, header.hash()).expect("Tree route exists"); + let tree_route = api.tree_route(retracted_start, header.parent_hash).expect("Tree route exists"); ChainEvent::NewBlock { - id: BlockId::hash(header.hash()), + hash: header.hash(), is_new_best: true, tree_route: Some(Arc::new(tree_route)), header, @@ -242,9 +236,9 @@ fn should_prune_old_during_maintenance() { block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - pool.api.push_block(1, vec![xt.clone()]); + let header = pool.api.push_block(1, vec![xt.clone()]); - block_on(pool.maintain(block_event(1))); + block_on(pool.maintain(block_event(header))); assert_eq!(pool.status().ready, 0); } @@ -259,9 +253,9 @@ fn should_revalidate_during_maintenance() { assert_eq!(pool.status().ready, 2); assert_eq!(pool.api.validation_requests().len(), 2); - pool.api.push_block(1, vec![xt1.clone()]); + let header = pool.api.push_block(1, vec![xt1.clone()]); - block_on(pool.maintain(block_event(1))); + block_on(pool.maintain(block_event(header))); assert_eq!(pool.status().ready, 1); block_on(notifier.next()); @@ -317,17 +311,17 @@ fn should_revalidate_transaction_multiple_times() { block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - pool.api.push_block(1, vec![xt.clone()]); + let header = pool.api.push_block(1, vec![xt.clone()]); - block_on(pool.maintain(block_event(1))); + block_on(pool.maintain(block_event(header))); block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 1); - pool.api.push_block(2, vec![]); + let header = pool.api.push_block(2, vec![]); pool.api.add_invalid(&xt); - block_on(pool.maintain(block_event(2))); + block_on(pool.maintain(block_event(header))); block_on(notifier.next()); assert_eq!(pool.status().ready, 0); @@ -345,15 +339,15 @@ fn should_revalidate_across_many_blocks() { block_on(pool.submit_one(&BlockId::number(1), SOURCE, xt2.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 2); - pool.api.push_block(1, vec![]); - block_on(pool.maintain(block_event(1))); + let header = pool.api.push_block(1, vec![]); + block_on(pool.maintain(block_event(header))); block_on(notifier.next()); block_on(pool.submit_one(&BlockId::number(2), SOURCE, xt3.clone())).expect("1. Imported"); assert_eq!(pool.status().ready, 3); - pool.api.push_block(2, vec![xt1.clone()]); - block_on(pool.maintain(block_event(2))); + let header = pool.api.push_block(2, vec![xt1.clone()]); + block_on(pool.maintain(block_event(header))); block_on(notifier.next()); assert_eq!(pool.status().ready, 2); @@ -398,7 +392,8 @@ fn should_push_watchers_during_maintaince() { pool.api.add_invalid(&tx4); // clear timer events if any - block_on(pool.maintain(block_event(0))); + let header = pool.api.push_block(1, vec![]); + block_on(pool.maintain(block_event(header))); block_on(notifier.next()); // then @@ -415,8 +410,9 @@ fn should_push_watchers_during_maintaince() { ); // when - let header_hash = pool.api.push_block(1, vec![tx0, tx1, tx2]).hash(); - block_on(pool.maintain(block_event(1))); + let header = pool.api.push_block(2, vec![tx0, tx1, tx2]); + let header_hash = header.hash(); + block_on(pool.maintain(block_event(header))); let event = ChainEvent::Finalized { hash: header_hash.clone() }; block_on(pool.maintain(event)); @@ -472,7 +468,7 @@ fn finalization() { let header = pool.api.chain().read().block_by_number.get(&2).unwrap()[0].header().clone(); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -524,7 +520,7 @@ fn fork_aware_finalization() { assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Number(2), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -544,7 +540,7 @@ fn fork_aware_finalization() { ).expect("1. Imported"); assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -563,7 +559,7 @@ fn fork_aware_finalization() { let header = pool.api.push_block_with_parent(c2, vec![from_bob.clone()]); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -601,7 +597,7 @@ fn fork_aware_finalization() { canon_watchers.push((w, header.hash())); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -620,7 +616,7 @@ fn fork_aware_finalization() { let header = pool.api.push_block(5, vec![from_dave, from_bob]); e1 = header.hash(); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -702,7 +698,7 @@ fn resubmit_tx_of_fork_that_is_not_part_of_retracted() { assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Number(2), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -720,7 +716,7 @@ fn resubmit_tx_of_fork_that_is_not_part_of_retracted() { let header = pool.api.push_block(2, vec![tx1.clone()]); assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: false, header: header.clone(), tree_route: None, @@ -773,7 +769,7 @@ fn resubmit_from_retracted_fork() { assert_eq!(pool.status().ready, 1); let event = ChainEvent::NewBlock { - id: BlockId::Number(2), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -789,7 +785,7 @@ fn resubmit_from_retracted_fork() { ).expect("1. Imported"); let header = pool.api.push_block(3, vec![tx1.clone()]); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -805,7 +801,7 @@ fn resubmit_from_retracted_fork() { ).expect("1. Imported"); let header = pool.api.push_block(4, vec![tx2.clone()]); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: true, header: header.clone(), tree_route: None, @@ -822,7 +818,7 @@ fn resubmit_from_retracted_fork() { ).expect("1. Imported"); let header = pool.api.push_block(2, vec![tx3.clone()]); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: false, header: header.clone(), tree_route: None, @@ -839,7 +835,7 @@ fn resubmit_from_retracted_fork() { ).expect("1. Imported"); let header = pool.api.push_block_with_parent(d1.clone(), vec![tx4.clone()]); let event = ChainEvent::NewBlock { - id: BlockId::Hash(header.hash()), + hash: header.hash(), is_new_best: false, header: header.clone(), tree_route: None, @@ -886,12 +882,12 @@ fn ready_set_should_not_resolve_before_block_update() { #[test] fn ready_set_should_resolve_after_block_update() { let (pool, _guard, _notifier) = maintained_pool(); - pool.api.push_block(1, vec![]); + let header = pool.api.push_block(1, vec![]); let xt1 = uxt(Alice, 209); block_on(pool.submit_one(&BlockId::number(1), SOURCE, xt1.clone())).expect("1. Imported"); - block_on(pool.maintain(block_event(1))); + block_on(pool.maintain(block_event(header))); assert!(pool.ready_at(1).now_or_never().is_some()); } @@ -899,7 +895,7 @@ fn ready_set_should_resolve_after_block_update() { #[test] fn ready_set_should_eventually_resolve_when_block_update_arrives() { let (pool, _guard, _notifier) = maintained_pool(); - pool.api.push_block(1, vec![]); + let header = pool.api.push_block(1, vec![]); let xt1 = uxt(Alice, 209); @@ -913,7 +909,7 @@ fn ready_set_should_eventually_resolve_when_block_update_arrives() { panic!("Ready set should not be ready before block update!"); } - block_on(pool.maintain(block_event(1))); + block_on(pool.maintain(block_event(header))); match ready_set_future.poll_unpin(&mut context) { Poll::Pending => { @@ -949,7 +945,11 @@ fn should_not_accept_old_signatures() { "c427eb672e8c441c86d31f1a81b22b43102058e9ce237cabe9897ea5099ffd426cd1c6a1f4f2869c3df57901d36bedcb295657adb3a4355add86ed234eb83108" ).expect("hex invalid")[..]).expect("signature construction failed"); - let xt = Extrinsic::Transfer { transfer, signature: old_singature, exhaust_resources_when_not_first: false }; + let xt = Extrinsic::Transfer { + transfer, + signature: old_singature, + exhaust_resources_when_not_first: false, + }; assert_matches::assert_matches!( block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())), @@ -959,3 +959,31 @@ fn should_not_accept_old_signatures() { "Should be invalid transaction with bad proof", ); } + +#[test] +fn import_notification_to_pool_maintain_works() { + let mut client = Arc::new(substrate_test_runtime_client::new()); + + let pool = Arc::new( + BasicPool::new_test(Arc::new(FullChainApi::new(client.clone()))).0 + ); + + // Prepare the extrisic, push it to the pool and check that it was added. + let xt = uxt(Alice, 0); + block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); + assert_eq!(pool.status().ready, 1); + + let mut import_stream = block_on_stream(client.import_notification_stream()); + + // Build the block with the transaction included + let mut block_builder = client.new_block(Default::default()).unwrap(); + block_builder.push(xt).unwrap(); + let block = block_builder.build().unwrap().block; + client.import(BlockOrigin::Own, block).unwrap(); + + // Get the notification of the block import and maintain the pool with it, + // Now, the pool should not contain any transactions. + let evt = import_stream.next().expect("Importing a block leads to an event"); + block_on(pool.maintain(evt.into())); + assert_eq!(pool.status().ready, 0); +} diff --git a/primitives/transaction-pool/src/pool.rs b/primitives/transaction-pool/src/pool.rs index fa50ef9e41..2824c96f30 100644 --- a/primitives/transaction-pool/src/pool.rs +++ b/primitives/transaction-pool/src/pool.rs @@ -251,11 +251,11 @@ pub enum ChainEvent { NewBlock { /// Is this the new best block. is_new_best: bool, - /// Id of the just imported block. - id: BlockId, + /// Hash of the block. + hash: B::Hash, /// Header of the just imported block header: B::Header, - /// Tree route from old best to new best that was calculated on import. + /// Tree route from old best to new best parent that was calculated on import. /// /// If `None`, no re-org happened on import. tree_route: Option>>, -- GitLab From 39a3372aa18ed592e51688ab2e30fa79a779ad4e Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 8 Jun 2020 13:09:12 +0200 Subject: [PATCH 118/280] Introduce stacked filtering (#6273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce stacked filtering. * Benchmarks * Remove unneeded crates * Fix proxy type's permissiveness checks. * Repot multisig to make utility stateless. * Repot filter stack impl into macro * Fix wasm build * Tests * Final test. * Tests for the macro * Fix test * Line width * Fix * Update frame/multisig/src/benchmarking.rs Co-authored-by: Shawn Tabrizi * Update primitives/std/with_std.rs Co-authored-by: Bastian Köcher * Grumble * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/multisig/src/tests.rs Co-authored-by: Shawn Tabrizi * Update frame/multisig/src/tests.rs Co-authored-by: Shawn Tabrizi * Grumble * Migration * Grumble * Comments * Migration * Fix * Fix * Line width * Allow unused * Update frame/multisig/src/lib.rs Co-authored-by: Alexander Popiak * Fix up grumble. * Remove Utility constraint in NonTransfer Co-authored-by: Shawn Tabrizi Co-authored-by: Bastian Köcher Co-authored-by: Alexander Popiak --- Cargo.lock | 18 + Cargo.toml | 1 + bin/node/runtime/Cargo.toml | 3 + bin/node/runtime/src/constants.rs | 4 + bin/node/runtime/src/lib.rs | 60 +++- frame/balances/src/lib.rs | 2 +- frame/multisig/Cargo.toml | 44 +++ frame/multisig/src/benchmarking.rs | 156 ++++++++ frame/multisig/src/lib.rs | 555 +++++++++++++++++++++++++++++ frame/multisig/src/tests.rs | 408 +++++++++++++++++++++ frame/proxy/Cargo.toml | 1 + frame/proxy/src/lib.rs | 29 +- frame/proxy/src/tests.rs | 98 ++++- frame/support/src/traits.rs | 244 ++++++++++++- frame/utility/src/benchmarking.rs | 112 +----- frame/utility/src/lib.rs | 493 ++----------------------- frame/utility/src/tests.rs | 276 +------------- primitives/std/with_std.rs | 1 + primitives/std/without_std.rs | 1 + 19 files changed, 1623 insertions(+), 883 deletions(-) create mode 100644 frame/multisig/Cargo.toml create mode 100644 frame/multisig/src/benchmarking.rs create mode 100644 frame/multisig/src/lib.rs create mode 100644 frame/multisig/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index e53b05d1cc..2acf7ea6c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3488,6 +3488,7 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-multisig", "pallet-offences", "pallet-offences-benchmarking", "pallet-proxy", @@ -4225,6 +4226,22 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-multisig" +version = "2.0.0-rc2" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-nicks" version = "2.0.0-rc2" @@ -4289,6 +4306,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", + "pallet-utility", "parity-scale-codec", "serde", "sp-core", diff --git a/Cargo.toml b/Cargo.toml index 650124877c..782cdcd23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,6 +84,7 @@ members = [ "frame/indices", "frame/membership", "frame/metadata", + "frame/multisig", "frame/nicks", "frame/offences", "frame/proxy", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index b451ac109e..4f304e6ace 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -59,6 +59,7 @@ pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = ".. pallet-indices = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/indices" } pallet-identity = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/identity" } pallet-membership = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/membership" } +pallet-multisig = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/multisig" } pallet-offences = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/offences" } pallet-offences-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } pallet-proxy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/proxy" } @@ -108,6 +109,7 @@ std = [ "pallet-indices/std", "sp-inherents/std", "pallet-membership/std", + "pallet-multisig/std", "pallet-identity/std", "node-primitives/std", "sp-offchain/std", @@ -151,6 +153,7 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-society/runtime-benchmarks", diff --git a/bin/node/runtime/src/constants.rs b/bin/node/runtime/src/constants.rs index 45f1ab19a4..8e87d61c1e 100644 --- a/bin/node/runtime/src/constants.rs +++ b/bin/node/runtime/src/constants.rs @@ -24,6 +24,10 @@ pub mod currency { pub const MILLICENTS: Balance = 1_000_000_000; pub const CENTS: Balance = 1_000 * MILLICENTS; // assume this is worth about a cent. pub const DOLLARS: Balance = 100 * CENTS; + + pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS + } } /// Time. diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index cac93b63e0..a1cff7df91 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -23,6 +23,7 @@ #![recursion_limit="256"] use sp_std::prelude::*; + use frame_support::{ construct_runtime, parameter_types, debug, RuntimeDebug, weights::{ @@ -31,6 +32,7 @@ use frame_support::{ }, traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier}, }; +use frame_support::traits::{Filter, InstanceFilter}; use codec::{Encode, Decode}; use sp_core::{ crypto::KeyTypeId, @@ -79,7 +81,6 @@ use impls::{CurrencyToVoteHandler, Author, TargetedFeeAdjustment}; /// Constant values used within the runtime. pub mod constants; use constants::{time::*, currency::*}; -use frame_support::traits::InstanceFilter; // Make the WASM binary available. #[cfg(feature = "std")] @@ -111,6 +112,15 @@ pub fn native_version() -> NativeVersion { type NegativeImbalance = >::NegativeImbalance; +pub struct BaseFilter; +impl Filter for BaseFilter { + fn filter(_call: &Call) -> bool { + true + } +} +pub struct IsCallable; +frame_support::impl_filter_stack!(IsCallable, BaseFilter, Call, is_callable); + pub struct DealWithFees; impl OnUnbalanced for DealWithFees { fn on_unbalanceds(mut fees_then_tips: impl Iterator) { @@ -169,24 +179,28 @@ impl frame_system::Trait for Runtime { type OnKilledAccount = (); } -const fn deposit(items: u32, bytes: u32) -> Balance { items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS } +impl pallet_utility::Trait for Runtime { + type Event = Event; + type Call = Call; + type IsCallable = IsCallable; +} parameter_types! { // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - pub const MultisigDepositBase: Balance = deposit(1, 88); + pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. - pub const MultisigDepositFactor: Balance = deposit(0, 32); + pub const DepositFactor: Balance = deposit(0, 32); pub const MaxSignatories: u16 = 100; } -impl pallet_utility::Trait for Runtime { +impl pallet_multisig::Trait for Runtime { type Event = Event; type Call = Call; type Currency = Balances; - type MultisigDepositBase = MultisigDepositBase; - type MultisigDepositFactor = MultisigDepositFactor; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type IsCallable = (); + type IsCallable = IsCallable; } parameter_types! { @@ -211,8 +225,7 @@ impl InstanceFilter for ProxyType { match self { ProxyType::Any => true, ProxyType::NonTransfer => !matches!(c, - Call::Balances(..) | Call::Utility(..) - | Call::Vesting(pallet_vesting::Call::vested_transfer(..)) + Call::Balances(..) | Call::Vesting(pallet_vesting::Call::vested_transfer(..)) | Call::Indices(pallet_indices::Call::transfer(..)) ), ProxyType::Governance => matches!(c, @@ -222,13 +235,22 @@ impl InstanceFilter for ProxyType { ProxyType::Staking => matches!(c, Call::Staking(..)), } } + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } } impl pallet_proxy::Trait for Runtime { type Event = Event; type Call = Call; type Currency = Balances; - type IsCallable = (); + type IsCallable = IsCallable; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; @@ -263,9 +285,9 @@ parameter_types! { impl pallet_indices::Trait for Runtime { type AccountIndex = AccountIndex; - type Event = Event; type Currency = Balances; type Deposit = IndexDeposit; + type Event = Event; } parameter_types! { @@ -341,11 +363,11 @@ impl pallet_session::Trait for Runtime { type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = Babe; + type NextSessionRotation = Babe; type SessionManager = pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type NextSessionRotation = Babe; } impl pallet_session::historical::Trait for Runtime { @@ -474,8 +496,8 @@ parameter_types! { const_assert!(DesiredMembers::get() <= pallet_collective::MAX_MEMBERS); impl pallet_elections_phragmen::Trait for Runtime { - type ModuleId = ElectionsPhragmenModuleId; type Event = Event; + type ModuleId = ElectionsPhragmenModuleId; type Currency = Balances; type ChangeMembers = Council; // NOTE: this implies that council's genesis members cannot be set directly and must come from @@ -530,6 +552,7 @@ parameter_types! { } impl pallet_treasury::Trait for Runtime { + type ModuleId = TreasuryModuleId; type Currency = Balances; type ApproveOrigin = pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>; type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>; @@ -544,7 +567,6 @@ impl pallet_treasury::Trait for Runtime { type ProposalBondMinimum = ProposalBondMinimum; type SpendPeriod = SpendPeriod; type Burn = Burn; - type ModuleId = TreasuryModuleId; } parameter_types! { @@ -635,8 +657,8 @@ impl frame_system::offchain::SigningTypes for Runtime { impl frame_system::offchain::SendTransactionTypes for Runtime where Call: From, { - type OverarchingCall = Call; type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = Call; } impl pallet_im_online::Trait for Runtime { @@ -746,6 +768,7 @@ parameter_types! { impl pallet_society::Trait for Runtime { type Event = Event; + type ModuleId = SocietyModuleId; type Currency = Balances; type Randomness = RandomnessCollectiveFlip; type CandidateDeposit = CandidateDeposit; @@ -758,7 +781,6 @@ impl pallet_society::Trait for Runtime { type FounderSetOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; type SuspensionJudgementOrigin = pallet_society::EnsureFounder; type ChallengePeriod = ChallengePeriod; - type ModuleId = SocietyModuleId; } parameter_types! { @@ -779,7 +801,7 @@ construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic { System: frame_system::{Module, Call, Config, Storage, Event}, - Utility: pallet_utility::{Module, Call, Storage, Event}, + Utility: pallet_utility::{Module, Call, Event}, Babe: pallet_babe::{Module, Call, Storage, Config, Inherent(Timestamp)}, Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, Authorship: pallet_authorship::{Module, Call, Storage, Inherent}, @@ -809,6 +831,7 @@ construct_runtime!( Vesting: pallet_vesting::{Module, Call, Storage, Event, Config}, Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, Proxy: pallet_proxy::{Module, Call, Storage, Event}, + Multisig: pallet_multisig::{Module, Call, Storage, Event}, } ); @@ -1058,6 +1081,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, b"elections", Elections); add_benchmark!(params, batches, b"identity", Identity); add_benchmark!(params, batches, b"im-online", ImOnline); + add_benchmark!(params, batches, b"multisig", Multisig); add_benchmark!(params, batches, b"offences", OffencesBench::); add_benchmark!(params, batches, b"proxy", Proxy); add_benchmark!(params, batches, b"scheduler", Scheduler); diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index ea7ec92147..b6dc4a11f0 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -598,7 +598,7 @@ impl, I: Instance> Module { /// /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that /// the caller will do this. - fn mutate_account( + pub fn mutate_account( who: &T::AccountId, f: impl FnOnce(&mut AccountData) -> R ) -> R { diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml new file mode 100644 index 0000000000..17e75c817e --- /dev/null +++ b/frame/multisig/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "pallet-multisig" +version = "2.0.0-rc2" +authors = ["Parity Technologies "] +edition = "2018" +license = "Apache-2.0" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/substrate/" +description = "FRAME multi-signature dispatch pallet" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.101", optional = true } +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } + +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } + +[dev-dependencies] +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc2", path = "../balances" } + +[features] +default = ["std"] +std = [ + "serde", + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "sp-io/std", + "sp-std/std" +] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-support/runtime-benchmarks", +] diff --git a/frame/multisig/src/benchmarking.rs b/frame/multisig/src/benchmarking.rs new file mode 100644 index 0000000000..0c603be916 --- /dev/null +++ b/frame/multisig/src/benchmarking.rs @@ -0,0 +1,156 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Benchmarks for Multisig Pallet + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_system::RawOrigin; +use frame_benchmarking::{benchmarks, account}; +use sp_runtime::traits::Saturating; + +use crate::Module as Utility; + +const SEED: u32 = 0; + +fn setup_multi(s: u32, z: u32) + -> Result<(Vec, Box<::Call>), &'static str> +{ + let mut signatories: Vec = Vec::new(); + for i in 0 .. s { + let signatory = account("signatory", i, SEED); + // Give them some balance for a possible deposit + let deposit = T::DepositBase::get() + T::DepositFactor::get() * s.into(); + let balance = T::Currency::minimum_balance().saturating_mul(100.into()) + deposit; + T::Currency::make_free_balance_be(&signatory, balance); + signatories.push(signatory); + } + signatories.sort(); + let call: Box<::Call> = Box::new(frame_system::Call::remark(vec![0; z as usize]).into()); + return Ok((signatories, call)) +} + +benchmarks! { + _ { } + + as_multi_create { + // Signatories, need at least 2 total people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call) + + as_multi_approve { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let mut signatories2 = signatories.clone(); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + // before the call, get the timepoint + let timepoint = Utility::::timepoint(); + // Create the multi + Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + let caller2 = signatories2.remove(0); + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) + + as_multi_complete { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let mut signatories2 = signatories.clone(); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + // before the call, get the timepoint + let timepoint = Utility::::timepoint(); + // Create the multi + Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + // Everyone except the first person approves + for i in 1 .. s - 1 { + let mut signatories_loop = signatories2.clone(); + let caller_loop = signatories_loop.remove(i as usize); + let o = RawOrigin::Signed(caller_loop).into(); + Utility::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone())?; + } + let caller2 = signatories2.remove(0); + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) + + approve_as_multi_create { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + let call_hash = call.using_encoded(blake2_256); + // Create the multi + }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash) + + approve_as_multi_approve { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let mut signatories2 = signatories.clone(); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + let call_hash = call.using_encoded(blake2_256); + // before the call, get the timepoint + let timepoint = Utility::::timepoint(); + // Create the multi + Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + let caller2 = signatories2.remove(0); + }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash) + + cancel_as_multi { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + let call_hash = call.using_encoded(blake2_256); + let timepoint = Utility::::timepoint(); + // Create the multi + let o = RawOrigin::Signed(caller.clone()).into(); + Utility::::as_multi(o, s as u16, signatories.clone(), None, call.clone())?; + }: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::{new_test_ext, Test}; + use frame_support::assert_ok; + + #[test] + fn test_benchmarks() { + new_test_ext().execute_with(|| { + assert_ok!(test_benchmark_as_multi_create::()); + assert_ok!(test_benchmark_as_multi_approve::()); + assert_ok!(test_benchmark_as_multi_complete::()); + assert_ok!(test_benchmark_approve_as_multi_create::()); + assert_ok!(test_benchmark_approve_as_multi_approve::()); + assert_ok!(test_benchmark_cancel_as_multi::()); + }); + } +} diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs new file mode 100644 index 0000000000..bde0a06de6 --- /dev/null +++ b/frame/multisig/src/lib.rs @@ -0,0 +1,555 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Multisig Module +//! A module for doing multisig dispatch. +//! +//! - [`multisig::Trait`](./trait.Trait.html) +//! - [`Call`](./enum.Call.html) +//! +//! ## Overview +//! +//! This module contains functionality for multi-signature dispatch, a (potentially) stateful +//! operation, allowing multiple signed +//! origins (accounts) to coordinate and dispatch a call from a well-known origin, derivable +//! deterministically from the set of account IDs and the threshold number of accounts from the +//! set that must approve it. In the case that the threshold is just one then this is a stateless +//! operation. This is useful for multisig wallets where cryptographic threshold signatures are +//! not available or desired. +//! +//! ## Interface +//! +//! ### Dispatchable Functions +//! +//! * `as_multi` - Approve and if possible dispatch a call from a composite origin formed from a +//! number of signed origins. +//! * `approve_as_multi` - Approve a call from a composite origin. +//! * `cancel_as_multi` - Cancel a call from a composite origin. +//! +//! [`Call`]: ./enum.Call.html +//! [`Trait`]: ./trait.Trait.html + +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_std::prelude::*; +use codec::{Encode, Decode}; +use sp_io::hashing::blake2_256; +use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, RuntimeDebug}; +use frame_support::{traits::{Get, ReservableCurrency, Currency, Filter, FilterStack, ClearFilterGuard}, + weights::{Weight, GetDispatchInfo, DispatchClass, Pays}, + dispatch::{DispatchResultWithPostInfo, DispatchErrorWithPostInfo, PostDispatchInfo}, +}; +use frame_system::{self as system, ensure_signed}; +use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; + +mod tests; +mod benchmarking; + +type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; + +/// Configuration trait. +pub trait Trait: frame_system::Trait { + /// The overarching event type. + type Event: From> + Into<::Event>; + + /// The overarching call type. + type Call: Parameter + Dispatchable + + GetDispatchInfo + From>; + + /// The currency mechanism. + type Currency: ReservableCurrency; + + /// The base amount of currency needed to reserve for creating a multisig execution. + /// + /// This is held for an additional storage item whose value size is + /// `4 + sizeof((BlockNumber, Balance, AccountId))` bytes. + type DepositBase: Get>; + + /// The amount of currency needed per unit threshold when creating a multisig execution. + /// + /// This is held for adding 32 bytes more into a pre-existing storage value. + type DepositFactor: Get>; + + /// The maximum amount of signatories allowed in the multisig. + type MaxSignatories: Get; + + /// Is a given call compatible with the proxying subsystem? + type IsCallable: FilterStack<::Call>; +} + +/// A global extrinsic index, formed as the extrinsic index within a block, together with that +/// block's height. This allows a transaction in which a multisig operation of a particular +/// composite was created to be uniquely identified. +#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug)] +pub struct Timepoint { + /// The height of the chain at the point in time. + height: BlockNumber, + /// The index of the extrinsic at the point in time. + index: u32, +} + +/// An open multisig operation. +#[derive(Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug)] +pub struct Multisig { + /// The extrinsic when the multisig operation was opened. + when: Timepoint, + /// The amount held in reserve of the `depositor`, to be returned once the operation ends. + deposit: Balance, + /// The account who opened it (i.e. the first to approve it). + depositor: AccountId, + /// The approvals achieved so far, including the depositor. Always sorted. + approvals: Vec, +} + +decl_storage! { + trait Store for Module as Multisig { + /// The set of open multisig operations. + pub Multisigs: double_map + hasher(twox_64_concat) T::AccountId, hasher(blake2_128_concat) [u8; 32] + => Option, T::AccountId>>; + } +} + +decl_error! { + pub enum Error for Module { + /// Threshold is too low (zero). + ZeroThreshold, + /// Call is already approved by this signatory. + AlreadyApproved, + /// Call doesn't need any (more) approvals. + NoApprovalsNeeded, + /// There are too few signatories in the list. + TooFewSignatories, + /// There are too many signatories in the list. + TooManySignatories, + /// The signatories were provided out of order; they should be ordered. + SignatoriesOutOfOrder, + /// The sender was contained in the other signatories; it shouldn't be. + SenderInSignatories, + /// Multisig operation not found when attempting to cancel. + NotFound, + /// Only the account that originally created the multisig is able to cancel it. + NotOwner, + /// No timepoint was given, yet the multisig operation is already underway. + NoTimepoint, + /// A different timepoint was given to the multisig operation that is underway. + WrongTimepoint, + /// A timepoint was given, yet no multisig operation is underway. + UnexpectedTimepoint, + /// A call with a `false` `IsCallable` filter was attempted. + Uncallable, + } +} + +decl_event! { + /// Events type. + pub enum Event where + AccountId = ::AccountId, + BlockNumber = ::BlockNumber, + CallHash = [u8; 32] + { + /// A new multisig operation has begun. First param is the account that is approving, + /// second is the multisig account, third is hash of the call. + NewMultisig(AccountId, AccountId, CallHash), + /// A multisig operation has been approved by someone. First param is the account that is + /// approving, third is the multisig account, fourth is hash of the call. + MultisigApproval(AccountId, Timepoint, AccountId, CallHash), + /// A multisig operation has been executed. First param is the account that is + /// approving, third is the multisig account, fourth is hash of the call to be executed. + MultisigExecuted(AccountId, Timepoint, AccountId, CallHash, DispatchResult), + /// A multisig operation has been cancelled. First param is the account that is + /// cancelling, third is the multisig account, fourth is hash of the call. + MultisigCancelled(AccountId, Timepoint, AccountId, CallHash), + /// A call with a `false` IsCallable filter was attempted. + Uncallable(u32), + } +} + +mod weight_of { + use super::*; + + /// - Base Weight: + /// - Create: 46.55 + 0.089 * S µs + /// - Approve: 34.03 + .112 * S µs + /// - Complete: 40.36 + .225 * S µs + /// - DB Weight: + /// - Reads: Multisig Storage, [Caller Account] + /// - Writes: Multisig Storage, [Caller Account] + /// - Plus Call Weight + pub fn as_multi(other_sig_len: usize, call_weight: Weight) -> Weight { + call_weight + .saturating_add(45_000_000) + .saturating_add((other_sig_len as Weight).saturating_mul(250_000)) + .saturating_add(T::DbWeight::get().reads_writes(1, 1)) + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + /// Deposit one of this module's events by using the default implementation. + fn deposit_event() = default; + + fn on_runtime_upgrade() -> Weight { + // Utility.Multisigs -> Multisig.Multisigs + use frame_support::migration::{StorageIterator, put_storage_value}; + for (key, value) in StorageIterator::< + Multisig, T::AccountId> + >::new(b"Utility", b"Multisigs").drain() { + put_storage_value(b"Multisig", b"Multisigs", &key, value); + } + 1_000_000_000 + } + + /// Register approval for a dispatch to be made from a deterministic composite account if + /// approved by a total of `threshold - 1` of `other_signatories`. + /// + /// If there are enough, then dispatch the call. Calls must each fulfil the `IsCallable` + /// filter. + /// + /// Payment: `DepositBase` will be reserved if this is the first approval, plus + /// `threshold` times `DepositFactor`. It is returned once this dispatch happens or + /// is cancelled. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `threshold`: The total number of approvals for this dispatch before it is executed. + /// - `other_signatories`: The accounts (other than the sender) who can approve this + /// dispatch. May not be empty. + /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is + /// not the first approval, then it must be `Some`, with the timepoint (block number and + /// transaction index) of the first approval transaction. + /// - `call`: The call to be executed. + /// + /// NOTE: Unless this is the final approval, you will generally want to use + /// `approve_as_multi` instead, since it only requires a hash of the call. + /// + /// Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise + /// on success, result is `Ok` and the result from the interior call, if it was executed, + /// may be found in the deposited `MultisigExecuted` event. + /// + /// # + /// - `O(S + Z + Call)`. + /// - Up to one balance-reserve or unreserve operation. + /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of + /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + /// - One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len. + /// - One encode & hash, both of complexity `O(S)`. + /// - Up to one binary search and insert (`O(logS + S)`). + /// - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. + /// - One event. + /// - The weight of the `call`. + /// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a + /// deposit taken for its lifetime of + /// `DepositBase + threshold * DepositFactor`. + /// ------------------------------- + /// - Base Weight: + /// - Create: 46.55 + 0.089 * S µs + /// - Approve: 34.03 + .112 * S µs + /// - Complete: 40.36 + .225 * S µs + /// - DB Weight: + /// - Reads: Multisig Storage, [Caller Account] + /// - Writes: Multisig Storage, [Caller Account] + /// - Plus Call Weight + /// # + #[weight = ( + weight_of::as_multi::(other_signatories.len(), call.get_dispatch_info().weight), + call.get_dispatch_info().class, + Pays::Yes, + )] + fn as_multi(origin, + threshold: u16, + other_signatories: Vec, + maybe_timepoint: Option>, + call: Box<::Call>, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + // We're now executing as a freshly authenticated new account, so the previous call + // restrictions no longer apply. + let _guard = ClearFilterGuard::::Call>::new(); + ensure!(T::IsCallable::filter(call.as_ref()), Error::::Uncallable); + ensure!(threshold >= 1, Error::::ZeroThreshold); + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); + let other_signatories_len = other_signatories.len(); + ensure!(other_signatories_len < max_sigs, Error::::TooManySignatories); + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + + let id = Self::multi_account_id(&signatories, threshold); + let call_hash = call.using_encoded(blake2_256); + + if let Some(mut m) = >::get(&id, call_hash) { + let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; + ensure!(m.when == timepoint, Error::::WrongTimepoint); + if let Err(pos) = m.approvals.binary_search(&who) { + // we know threshold is greater than zero from the above ensure. + if (m.approvals.len() as u16) < threshold - 1 { + m.approvals.insert(pos, who.clone()); + >::insert(&id, call_hash, m); + Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); + // Call is not made, so the actual weight does not include call + return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) + } + } else { + if (m.approvals.len() as u16) < threshold { + Err(Error::::AlreadyApproved)? + } + } + + let result = call.dispatch(frame_system::RawOrigin::Signed(id.clone()).into()); + let _ = T::Currency::unreserve(&m.depositor, m.deposit); + >::remove(&id, call_hash); + Self::deposit_event(RawEvent::MultisigExecuted( + who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error) + )); + return Ok(None.into()) + } else { + ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); + if threshold > 1 { + let deposit = T::DepositBase::get() + + T::DepositFactor::get() * threshold.into(); + T::Currency::reserve(&who, deposit)?; + >::insert(&id, call_hash, Multisig { + when: Self::timepoint(), + deposit, + depositor: who.clone(), + approvals: vec![who.clone()], + }); + Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); + // Call is not made, so we can return that weight + return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) + } else { + let result = call.dispatch(frame_system::RawOrigin::Signed(id).into()); + match result { + Ok(post_dispatch_info) => { + match post_dispatch_info.actual_weight { + Some(actual_weight) => return Ok(Some(weight_of::as_multi::(other_signatories_len, actual_weight)).into()), + None => return Ok(None.into()), + } + }, + Err(err) => { + match err.post_info.actual_weight { + Some(actual_weight) => { + let weight_used = weight_of::as_multi::(other_signatories_len, actual_weight); + return Err(DispatchErrorWithPostInfo { post_info: Some(weight_used).into(), error: err.error.into() }) + }, + None => { + return Err(err) + } + } + } + } + } + } + } + + /// Register approval for a dispatch to be made from a deterministic composite account if + /// approved by a total of `threshold - 1` of `other_signatories`. + /// + /// Payment: `DepositBase` will be reserved if this is the first approval, plus + /// `threshold` times `DepositFactor`. It is returned once this dispatch happens or + /// is cancelled. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `threshold`: The total number of approvals for this dispatch before it is executed. + /// - `other_signatories`: The accounts (other than the sender) who can approve this + /// dispatch. May not be empty. + /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is + /// not the first approval, then it must be `Some`, with the timepoint (block number and + /// transaction index) of the first approval transaction. + /// - `call_hash`: The hash of the call to be executed. + /// + /// NOTE: If this is the final approval, you will want to use `as_multi` instead. + /// + /// # + /// - `O(S)`. + /// - Up to one balance-reserve or unreserve operation. + /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of + /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + /// - One encode & hash, both of complexity `O(S)`. + /// - Up to one binary search and insert (`O(logS + S)`). + /// - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. + /// - One event. + /// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a + /// deposit taken for its lifetime of + /// `DepositBase + threshold * DepositFactor`. + /// ---------------------------------- + /// - Base Weight: + /// - Create: 44.71 + 0.088 * S + /// - Approve: 31.48 + 0.116 * S + /// - DB Weight: + /// - Read: Multisig Storage, [Caller Account] + /// - Write: Multisig Storage, [Caller Account] + /// # + #[weight = ( + T::DbWeight::get().reads_writes(1, 1) + .saturating_add(45_000_000) + .saturating_add((other_signatories.len() as Weight).saturating_mul(120_000)), + DispatchClass::Normal, + Pays::Yes, + )] + fn approve_as_multi(origin, + threshold: u16, + other_signatories: Vec, + maybe_timepoint: Option>, + call_hash: [u8; 32], + ) -> DispatchResult { + let who = ensure_signed(origin)?; + ensure!(threshold >= 1, Error::::ZeroThreshold); + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); + ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + + let id = Self::multi_account_id(&signatories, threshold); + + if let Some(mut m) = >::get(&id, call_hash) { + let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; + ensure!(m.when == timepoint, Error::::WrongTimepoint); + ensure!(m.approvals.len() < threshold as usize, Error::::NoApprovalsNeeded); + if let Err(pos) = m.approvals.binary_search(&who) { + m.approvals.insert(pos, who.clone()); + >::insert(&id, call_hash, m); + Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); + } else { + Err(Error::::AlreadyApproved)? + } + } else { + if threshold > 1 { + ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); + let deposit = T::DepositBase::get() + + T::DepositFactor::get() * threshold.into(); + T::Currency::reserve(&who, deposit)?; + >::insert(&id, call_hash, Multisig { + when: Self::timepoint(), + deposit, + depositor: who.clone(), + approvals: vec![who.clone()], + }); + Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); + } else { + Err(Error::::NoApprovalsNeeded)? + } + } + Ok(()) + } + + /// Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously + /// for this operation will be unreserved on success. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `threshold`: The total number of approvals for this dispatch before it is executed. + /// - `other_signatories`: The accounts (other than the sender) who can approve this + /// dispatch. May not be empty. + /// - `timepoint`: The timepoint (block number and transaction index) of the first approval + /// transaction for this dispatch. + /// - `call_hash`: The hash of the call to be executed. + /// + /// # + /// - `O(S)`. + /// - Up to one balance-reserve or unreserve operation. + /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of + /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + /// - One encode & hash, both of complexity `O(S)`. + /// - One event. + /// - I/O: 1 read `O(S)`, one remove. + /// - Storage: removes one item. + /// ---------------------------------- + /// - Base Weight: 37.6 + 0.084 * S + /// - DB Weight: + /// - Read: Multisig Storage, [Caller Account] + /// - Write: Multisig Storage, [Caller Account] + /// # + #[weight = ( + T::DbWeight::get().reads_writes(1, 1) + .saturating_add(40_000_000) + .saturating_add((other_signatories.len() as Weight).saturating_mul(100_000)), + DispatchClass::Normal, + Pays::Yes, + )] + fn cancel_as_multi(origin, + threshold: u16, + other_signatories: Vec, + timepoint: Timepoint, + call_hash: [u8; 32], + ) -> DispatchResult { + let who = ensure_signed(origin)?; + ensure!(threshold >= 1, Error::::ZeroThreshold); + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); + ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + + let id = Self::multi_account_id(&signatories, threshold); + + let m = >::get(&id, call_hash) + .ok_or(Error::::NotFound)?; + ensure!(m.when == timepoint, Error::::WrongTimepoint); + ensure!(m.depositor == who, Error::::NotOwner); + + let _ = T::Currency::unreserve(&m.depositor, m.deposit); + >::remove(&id, call_hash); + + Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id, call_hash)); + Ok(()) + } + } +} + +impl Module { + /// Derive a multi-account ID from the sorted list of accounts and the threshold that are + /// required. + /// + /// NOTE: `who` must be sorted. If it is not, then you'll get the wrong answer. + pub fn multi_account_id(who: &[T::AccountId], threshold: u16) -> T::AccountId { + let entropy = (b"modlpy/utilisuba", who, threshold).using_encoded(blake2_256); + T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() + } + + /// The current `Timepoint`. + pub fn timepoint() -> Timepoint { + Timepoint { + height: >::block_number(), + index: >::extrinsic_index().unwrap_or_default(), + } + } + + /// Check that signatories is sorted and doesn't contain sender, then insert sender. + fn ensure_sorted_and_insert(other_signatories: Vec, who: T::AccountId) + -> Result, DispatchError> + { + let mut signatories = other_signatories; + let mut maybe_last = None; + let mut index = 0; + for item in signatories.iter() { + if let Some(last) = maybe_last { + ensure!(last < item, Error::::SignatoriesOutOfOrder); + } + if item <= &who { + ensure!(item != &who, Error::::SenderInSignatories); + index += 1; + } + maybe_last = Some(item); + } + signatories.insert(index, who); + Ok(signatories) + } +} diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs new file mode 100644 index 0000000000..77855c6482 --- /dev/null +++ b/frame/multisig/src/tests.rs @@ -0,0 +1,408 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests for Multisig Pallet + +#![cfg(test)] + +use super::*; + +use frame_support::{ + assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, + weights::Weight, impl_outer_event +}; +use sp_core::H256; +use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; +use crate as multisig; + +impl_outer_origin! { + pub enum Origin for Test where system = frame_system {} +} + +impl_outer_event! { + pub enum TestEvent for Test { + system, + pallet_balances, + multisig, + } +} +impl_outer_dispatch! { + pub enum Call for Test where origin: Origin { + frame_system::System, + pallet_balances::Balances, + multisig::Multisig, + } +} + +// For testing the pallet, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of pallets we want to use. +#[derive(Clone, Eq, PartialEq)] +pub struct Test; +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); +} +impl frame_system::Trait for Test { + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Call = Call; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = TestEvent; + type BlockHashCount = BlockHashCount; + type MaximumBlockWeight = MaximumBlockWeight; + type DbWeight = (); + type BlockExecutionWeight = (); + type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; + type MaximumBlockLength = MaximumBlockLength; + type AvailableBlockRatio = AvailableBlockRatio; + type Version = (); + type ModuleToIndex = (); + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); +} +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} +impl pallet_balances::Trait for Test { + type Balance = u64; + type Event = TestEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; +} +parameter_types! { + pub const DepositBase: u64 = 1; + pub const DepositFactor: u64 = 1; + pub const MaxSignatories: u16 = 3; +} +pub struct TestIsCallable; +impl Filter for TestIsCallable { + fn filter(c: &Call) -> bool { + match *c { + Call::Balances(_) => true, + _ => false, + } + } +} +impl FilterStack for TestIsCallable { + type Stack = (); + fn push(_: impl Fn(&Call) -> bool + 'static) {} + fn pop() {} + fn take() -> Self::Stack { () } + fn restore(_: Self::Stack) {} +} +impl Trait for Test { + type Event = TestEvent; + type Call = Call; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type IsCallable = TestIsCallable; +} +type System = frame_system::Module; +type Balances = pallet_balances::Module; +type Multisig = Module; + +use pallet_balances::Call as BalancesCall; +use pallet_balances::Error as BalancesError; + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 2)], + }.assimilate_storage(&mut t).unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext +} + +fn last_event() -> TestEvent { + system::Module::::events().pop().map(|e| e.event).expect("Event expected") +} + +fn expect_event>(e: E) { + assert_eq!(last_event(), e.into()); +} + +fn now() -> Timepoint { + Multisig::timepoint() +} + +#[test] +fn multisig_deposit_is_taken_and_returned() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + assert_eq!(Balances::free_balance(1), 2); + assert_eq!(Balances::reserved_balance(1), 3); + + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_eq!(Balances::free_balance(1), 5); + assert_eq!(Balances::reserved_balance(1), 0); + }); +} + +#[test] +fn cancel_multisig_returns_deposit() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + assert_eq!(Balances::free_balance(1), 6); + assert_eq!(Balances::reserved_balance(1), 4); + assert_ok!( + Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash.clone()), + ); + assert_eq!(Balances::free_balance(1), 10); + assert_eq!(Balances::reserved_balance(1), 0); + }); +} + +#[test] +fn timepoint_checking_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + + assert_noop!( + Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone()), + Error::::UnexpectedTimepoint, + ); + + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); + + assert_noop!( + Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, call.clone()), + Error::::NoTimepoint, + ); + let later = Timepoint { index: 1, .. now() }; + assert_noop!( + Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(later), call.clone()), + Error::::WrongTimepoint, + ); + }); +} + +#[test] +fn multisig_2_of_3_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); + assert_eq!(Balances::free_balance(6), 0); + + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_eq!(Balances::free_balance(6), 15); + }); +} + +#[test] +fn multisig_3_of_3_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 3); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + assert_eq!(Balances::free_balance(6), 0); + + assert_ok!(Multisig::as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), call)); + assert_eq!(Balances::free_balance(6), 15); + }); +} + +#[test] +fn cancel_multisig_works() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + assert_noop!( + Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()), + Error::::NotOwner, + ); + assert_ok!( + Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash.clone()), + ); + }); +} + +#[test] +fn multisig_2_of_3_as_multi_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + assert_eq!(Balances::free_balance(6), 0); + + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_eq!(Balances::free_balance(6), 15); + }); +} + +#[test] +fn multisig_2_of_3_as_multi_with_many_calls_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call1 = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); + let call2 = Box::new(Call::Balances(BalancesCall::transfer(7, 5))); + + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call1.clone())); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, call2.clone())); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call2)); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call1)); + + assert_eq!(Balances::free_balance(6), 10); + assert_eq!(Balances::free_balance(7), 5); + }); +} + +#[test] +fn multisig_2_of_3_cannot_reissue_same_call() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call.clone())); + assert_eq!(Balances::free_balance(multi), 5); + + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call.clone())); + + let err = DispatchError::from(BalancesError::::InsufficientBalance).stripped(); + expect_event(RawEvent::MultisigExecuted(3, now(), multi, call.using_encoded(blake2_256), Err(err))); + }); +} + +#[test] +fn zero_threshold_fails() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + assert_noop!( + Multisig::as_multi(Origin::signed(1), 0, vec![2], None, call), + Error::::ZeroThreshold, + ); + }); +} + +#[test] +fn too_many_signatories_fails() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + assert_noop!( + Multisig::as_multi(Origin::signed(1), 2, vec![2, 3, 4], None, call.clone()), + Error::::TooManySignatories, + ); + }); +} + +#[test] +fn duplicate_approvals_are_ignored() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash.clone())); + assert_noop!( + Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash.clone()), + Error::::AlreadyApproved, + ); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone())); + assert_noop!( + Multisig::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash.clone()), + Error::::NoApprovalsNeeded, + ); + }); +} + +#[test] +fn multisig_1_of_3_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 1); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let hash = call.using_encoded(blake2_256); + assert_noop!( + Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash.clone()), + Error::::NoApprovalsNeeded, + ); + assert_noop!( + Multisig::as_multi(Origin::signed(4), 1, vec![2, 3], None, call.clone()), + BalancesError::::InsufficientBalance, + ); + assert_ok!(Multisig::as_multi(Origin::signed(1), 1, vec![2, 3], None, call)); + + assert_eq!(Balances::free_balance(6), 15); + }); +} + +#[test] +fn multisig_filters() { + new_test_ext().execute_with(|| { + let call = Box::new(Call::System(frame_system::Call::remark(vec![]))); + assert_noop!( + Multisig::as_multi(Origin::signed(1), 1, vec![], None, call.clone()), + Error::::Uncallable, + ); + }); +} diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index ee776951fd..58641aa21c 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -26,6 +26,7 @@ frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = " [dev-dependencies] sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-utility = { version = "2.0.0-rc2", path = "../utility" } [features] default = ["std"] diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index 0c5b9c494c..60305dfc74 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -40,9 +40,10 @@ use sp_io::hashing::blake2_256; use sp_runtime::{DispatchResult, traits::{Dispatchable, Zero}}; use sp_runtime::traits::Member; use frame_support::{ - decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, - traits::{Get, ReservableCurrency, Currency, Filter, InstanceFilter}, - weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, + decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, traits::{ + Get, ReservableCurrency, Currency, Filter, FilterStack, FilterStackGuard, + ClearFilterGuard, InstanceFilter + }, weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, dispatch::{PostDispatchInfo, IsSubType}, }; use frame_system::{self as system, ensure_signed}; @@ -65,7 +66,7 @@ pub trait Trait: frame_system::Trait { type Currency: ReservableCurrency; /// Is a given call compatible with the proxying subsystem? - type IsCallable: Filter<::Call>; + type IsCallable: FilterStack<::Call>; /// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler. /// The instance filter determines whether a given call may be proxied under this type. @@ -166,16 +167,22 @@ decl_module! { call: Box<::Call> ) { let who = ensure_signed(origin)?; - ensure!(T::IsCallable::filter(&call), Error::::Uncallable); let (_, proxy_type) = Proxies::::get(&real).0.into_iter() .find(|x| &x.0 == &who && force_proxy_type.as_ref().map_or(true, |y| &x.1 == y)) .ok_or(Error::::NotProxy)?; - match call.is_sub_type() { - Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) => - ensure!(pt.is_no_more_permissive(&proxy_type), Error::::NoPermission), - _ => (), - } - ensure!(proxy_type.filter(&call), Error::::Unproxyable); + + // We're now executing as a freshly authenticated new account, so the previous call + // restrictions no longer apply. + let _clear_guard = ClearFilterGuard::::Call>::new(); + let _filter_guard = FilterStackGuard::::Call>::new( + move |c| match c.is_sub_type() { + Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) + if !proxy_type.is_superset(&pt) => false, + _ => proxy_type.filter(&c) + } + ); + ensure!(T::IsCallable::filter(&call), Error::::Uncallable); + let e = call.dispatch(frame_system::RawOrigin::Signed(real).into()); Self::deposit_event(RawEvent::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error))); } diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index c331195c26..93529317f6 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use frame_support::{ assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, - weights::Weight, impl_outer_event, RuntimeDebug, dispatch::DispatchError + impl_filter_stack, weights::Weight, impl_outer_event, RuntimeDebug, dispatch::DispatchError }; use codec::{Encode, Decode}; use sp_core::H256; @@ -38,6 +38,7 @@ impl_outer_event! { system, pallet_balances, proxy, + pallet_utility, } } impl_outer_dispatch! { @@ -45,6 +46,7 @@ impl_outer_dispatch! { frame_system::System, pallet_balances::Balances, proxy::Proxy, + pallet_utility::Utility, } } @@ -94,30 +96,39 @@ impl pallet_balances::Trait for Test { type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; } +impl pallet_utility::Trait for Test { + type Event = TestEvent; + type Call = Call; + type IsCallable = IsCallable; +} parameter_types! { pub const ProxyDepositBase: u64 = 1; pub const ProxyDepositFactor: u64 = 1; - pub const MaxProxies: u16 = 3; + pub const MaxProxies: u16 = 4; } +pub struct IsCallable; +impl_filter_stack!(crate::tests::IsCallable, crate::tests::BaseFilter, crate::tests::Call, is_callable); #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] pub enum ProxyType { Any, JustTransfer, + JustUtility, } impl Default for ProxyType { fn default() -> Self { Self::Any } } impl InstanceFilter for ProxyType { fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, - ProxyType::JustTransfer => match c { - Call::Balances(pallet_balances::Call::transfer(..)) => true, - _ => false, - } + ProxyType::JustTransfer => matches!(c, Call::Balances(pallet_balances::Call::transfer(..))), + ProxyType::JustUtility => matches!(c, Call::Utility(..)), } } + fn is_superset(&self, o: &Self) -> bool { + self == &ProxyType::Any || self == o + } } -pub struct TestIsCallable; -impl Filter for TestIsCallable { +pub struct BaseFilter; +impl Filter for BaseFilter { fn filter(c: &Call) -> bool { match *c { // Remark is used as a no-op call in the benchmarking @@ -131,7 +142,7 @@ impl Trait for Test { type Event = TestEvent; type Call = Call; type Currency = Balances; - type IsCallable = TestIsCallable; + type IsCallable = IsCallable; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; @@ -140,11 +151,15 @@ impl Trait for Test { type System = frame_system::Module; type Balances = pallet_balances::Module; +type Utility = pallet_utility::Module; type Proxy = Module; use frame_system::Call as SystemCall; use pallet_balances::Call as BalancesCall; use pallet_balances::Error as BalancesError; +use pallet_utility::Call as UtilityCall; +use pallet_utility::Error as UtilityError; +use pallet_utility::Event as UtilityEvent; use super::Call as ProxyCall; pub fn new_test_ext() -> sp_io::TestExternalities { @@ -165,6 +180,65 @@ fn expect_event>(e: E) { assert_eq!(last_event(), e.into()); } +fn last_events(n: usize) -> Vec { + system::Module::::events().into_iter().rev().take(n).rev().map(|e| e.event).collect() +} + +fn expect_events(e: Vec) { + assert_eq!(last_events(e.len()), e); +} + +#[test] +fn filtering_works() { + new_test_ext().execute_with(|| { + Balances::mutate_account(&1, |a| a.free = 1000); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 2, ProxyType::Any)); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 3, ProxyType::JustTransfer)); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 4, ProxyType::JustUtility)); + + let call = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + assert_noop!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()), Error::::Uncallable); + + let sub_id = Utility::sub_account_id(1, 0); + Balances::mutate_account(&sub_id, |a| a.free = 1000); + let inner = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); + + let call = Box::new(Call::Utility(UtilityCall::as_sub(0, inner.clone()))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + + let call = Box::new(Call::Utility(UtilityCall::as_limited_sub(0, inner.clone()))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Ok(()))); + assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + let de = DispatchError::from(UtilityError::::Uncallable).stripped(); + expect_event(RawEvent::ProxyExecuted(Err(de))); + + let call = Box::new(Call::Utility(UtilityCall::batch(vec![*inner]))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_events(vec![UtilityEvent::BatchCompleted.into(), RawEvent::ProxyExecuted(Ok(())).into()]); + assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + expect_events(vec![UtilityEvent::Uncallable(0).into(), RawEvent::ProxyExecuted(Ok(())).into()]); + + let inner = Box::new(Call::Proxy(ProxyCall::add_proxy(5, ProxyType::Any))); + let call = Box::new(Call::Utility(UtilityCall::batch(vec![*inner]))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_events(vec![UtilityEvent::BatchCompleted.into(), RawEvent::ProxyExecuted(Ok(())).into()]); + assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + expect_events(vec![UtilityEvent::Uncallable(0).into(), RawEvent::ProxyExecuted(Ok(())).into()]); + }); +} + #[test] fn add_remove_proxies_works() { new_test_ext().execute_with(|| { @@ -175,8 +249,12 @@ fn add_remove_proxies_works() { assert_eq!(Balances::reserved_balance(1), 3); assert_ok!(Proxy::add_proxy(Origin::signed(1), 3, ProxyType::Any)); assert_eq!(Balances::reserved_balance(1), 4); + assert_ok!(Proxy::add_proxy(Origin::signed(1), 4, ProxyType::JustUtility)); + assert_eq!(Balances::reserved_balance(1), 5); assert_noop!(Proxy::add_proxy(Origin::signed(1), 4, ProxyType::Any), Error::::TooMany); assert_noop!(Proxy::remove_proxy(Origin::signed(1), 3, ProxyType::JustTransfer), Error::::NotFound); + assert_ok!(Proxy::remove_proxy(Origin::signed(1), 4, ProxyType::JustUtility)); + assert_eq!(Balances::reserved_balance(1), 4); assert_ok!(Proxy::remove_proxy(Origin::signed(1), 3, ProxyType::Any)); assert_eq!(Balances::reserved_balance(1), 3); assert_ok!(Proxy::remove_proxy(Origin::signed(1), 2, ProxyType::Any)); @@ -218,7 +296,7 @@ fn proxying_works() { assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); let call = Box::new(Call::Balances(BalancesCall::transfer_keep_alive(6, 1))); - assert_noop!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()), Error::::Unproxyable); + assert_noop!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()), Error::::Uncallable); assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_eq!(Balances::free_balance(6), 2); diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 979f021e03..519164027b 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -33,6 +33,10 @@ use crate::storage::StorageMap; use crate::weights::Weight; use impl_trait_for_tuples::impl_for_tuples; +/// Re-expected for the macro. +#[doc(hidden)] +pub use sp_std::{mem::{swap, take}, cell::RefCell, vec::Vec, boxed::Box}; + /// Simple trait for providing a filter over a reference to some type. pub trait Filter { /// Determine if a given value should be allowed through the filter (returns `true`) or not. @@ -43,29 +47,241 @@ impl Filter for () { fn filter(_: &T) -> bool { true } } +/// Trait to add a constraint onto the filter. +pub trait FilterStack: Filter { + /// The type used to archive the stack. + type Stack; + + /// Add a new `constraint` onto the filter. + fn push(constraint: impl Fn(&T) -> bool + 'static); + + /// Removes the most recently pushed, and not-yet-popped, constraint from the filter. + fn pop(); + + /// Clear the filter, returning a value that may be used later to `restore` it. + fn take() -> Self::Stack; + + /// Restore the filter from a previous `take` operation. + fn restore(taken: Self::Stack); +} + +/// Guard type for pushing a constraint to a `FilterStack` and popping when dropped. +pub struct FilterStackGuard, T>(PhantomData<(F, T)>); + +/// Guard type for clearing all pushed constraints from a `FilterStack` and reinstating them when +/// dropped. +pub struct ClearFilterGuard, T>(Option, PhantomData); + +impl, T> FilterStackGuard { + /// Create a new instance, adding a new `constraint` onto the filter `T`, and popping it when + /// this instance is dropped. + pub fn new(constraint: impl Fn(&T) -> bool + 'static) -> Self { + F::push(constraint); + Self(PhantomData) + } +} + +impl, T> Drop for FilterStackGuard { + fn drop(&mut self) { + F::pop(); + } +} + +impl, T> ClearFilterGuard { + /// Create a new instance, adding a new `constraint` onto the filter `T`, and popping it when + /// this instance is dropped. + pub fn new() -> Self { + Self(Some(F::take()), PhantomData) + } +} + +impl, T> Drop for ClearFilterGuard { + fn drop(&mut self) { + if let Some(taken) = self.0.take() { + F::restore(taken); + } + } +} + /// Simple trait for providing a filter over a reference to some type, given an instance of itself. -pub trait InstanceFilter { +pub trait InstanceFilter: Sized + Send + Sync { /// Determine if a given value should be allowed through the filter (returns `true`) or not. fn filter(&self, _: &T) -> bool; - /// Determines whether `self` matches at least all items that `o` does. - fn is_no_less_permissive(&self, o: &Self) -> bool { !self.is_less_permissive(o) } + /// Determines whether `self` matches at least everything that `_o` does. + fn is_superset(&self, _o: &Self) -> bool { false } +} - /// Determines whether `self` matches at most only the items that `o` does. - fn is_no_more_permissive(&self, o: &Self) -> bool { !o.is_less_permissive(&self) } +impl InstanceFilter for () { + fn filter(&self, _: &T) -> bool { true } + fn is_superset(&self, _o: &Self) -> bool { true } +} - /// Determines whether `self` matches all the items that `o` does and others. - fn is_more_permissive(&self, o: &Self) -> bool { o.is_less_permissive(self) } +#[macro_export] +macro_rules! impl_filter_stack { + ($target:ty, $base:ty, $call:ty, $module:ident) => { + #[cfg(feature = "std")] + mod $module { + #[allow(unused_imports)] + use super::*; + use $crate::traits::{swap, take, RefCell, Vec, Box, Filter, FilterStack}; - /// Determines whether `self` does not match all the items that `_o` does, nor any others. - /// - /// NOTE: This is the only `*permissive` function that needs to be reimplemented. - fn is_less_permissive(&self, _o: &Self) -> bool { true } + thread_local! { + static FILTER: RefCell bool + 'static>>> = RefCell::new(Vec::new()); + } + + impl Filter<$call> for $target { + fn filter(call: &$call) -> bool { + <$base>::filter(call) && + FILTER.with(|filter| filter.borrow().iter().all(|f| f(call))) + } + } + + impl FilterStack<$call> for $target { + type Stack = Vec bool + 'static>>; + fn push(f: impl Fn(&$call) -> bool + 'static) { + FILTER.with(|filter| filter.borrow_mut().push(Box::new(f))); + } + fn pop() { + FILTER.with(|filter| filter.borrow_mut().pop()); + } + fn take() -> Self::Stack { + FILTER.with(|filter| take(filter.borrow_mut().as_mut())) + } + fn restore(mut s: Self::Stack) { + FILTER.with(|filter| swap(filter.borrow_mut().as_mut(), &mut s)); + } + } + } + + #[cfg(not(feature = "std"))] + mod $module { + #[allow(unused_imports)] + use super::*; + use $crate::traits::{swap, take, RefCell, Vec, Box, Filter, FilterStack}; + + struct ThisFilter(RefCell bool + 'static>>>); + // NOTE: Safe only in wasm (guarded above) because there's only one thread. + unsafe impl Send for ThisFilter {} + unsafe impl Sync for ThisFilter {} + + static FILTER: ThisFilter = ThisFilter(RefCell::new(Vec::new())); + + impl Filter<$call> for $target { + fn filter(call: &$call) -> bool { + <$base>::filter(call) && FILTER.0.borrow().iter().all(|f| f(call)) + } + } + + impl FilterStack<$call> for $target { + type Stack = Vec bool + 'static>>; + fn push(f: impl Fn(&$call) -> bool + 'static) { + FILTER.0.borrow_mut().push(Box::new(f)); + } + fn pop() { + FILTER.0.borrow_mut().pop(); + } + fn take() -> Self::Stack { + take(FILTER.0.borrow_mut().as_mut()) + } + fn restore(mut s: Self::Stack) { + swap(FILTER.0.borrow_mut().as_mut(), &mut s); + } + } + } + } } -impl InstanceFilter for () { - fn filter(&self, _: &T) -> bool { true } - fn is_less_permissive(&self, _o: &Self) -> bool { false } +#[cfg(test)] +mod test_impl_filter_stack { + use super::*; + + pub struct IsCallable; + pub struct BaseFilter; + impl Filter for BaseFilter { + fn filter(x: &u32) -> bool { x % 2 == 0 } + } + impl_filter_stack!( + crate::traits::test_impl_filter_stack::IsCallable, + crate::traits::test_impl_filter_stack::BaseFilter, + u32, + is_callable + ); + + #[test] + fn impl_filter_stack_should_work() { + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + + IsCallable::push(|x| *x < 42); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + + IsCallable::push(|x| *x % 3 == 0); + assert!(IsCallable::filter(&36)); + assert!(!IsCallable::filter(&40)); + + IsCallable::pop(); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + + let saved = IsCallable::take(); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + + IsCallable::restore(saved); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + + IsCallable::pop(); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + } + + #[test] + fn guards_should_work() { + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + { + let _guard_1 = FilterStackGuard::::new(|x| *x < 42); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + { + let _guard_2 = FilterStackGuard::::new(|x| *x % 3 == 0); + assert!(IsCallable::filter(&36)); + assert!(!IsCallable::filter(&40)); + } + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + { + let _guard_2 = ClearFilterGuard::::new(); + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + } + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(!IsCallable::filter(&42)); + } + assert!(IsCallable::filter(&36)); + assert!(IsCallable::filter(&40)); + assert!(IsCallable::filter(&42)); + assert!(!IsCallable::filter(&43)); + } } /// An abstraction of a value stored within storage, but possibly as part of a larger composite diff --git a/frame/utility/src/benchmarking.rs b/frame/utility/src/benchmarking.rs index 4e77c8e44a..474009d11d 100644 --- a/frame/utility/src/benchmarking.rs +++ b/frame/utility/src/benchmarking.rs @@ -23,26 +23,10 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account}; use sp_runtime::traits::Saturating; - use crate::Module as Utility; const SEED: u32 = 0; -fn setup_multi(s: u32, z: u32) -> Result<(Vec, Box<::Call>), &'static str>{ - let mut signatories: Vec = Vec::new(); - for i in 0 .. s { - let signatory = account("signatory", i, SEED); - // Give them some balance for a possible deposit - let deposit = T::MultisigDepositBase::get() + T::MultisigDepositFactor::get() * s.into(); - let balance = T::Currency::minimum_balance().saturating_mul(100.into()) + deposit; - T::Currency::make_free_balance_be(&signatory, balance); - signatories.push(signatory); - } - signatories.sort(); - let call: Box<::Call> = Box::new(frame_system::Call::remark(vec![0; z as usize]).into()); - return Ok((signatories, call)) -} - benchmarks! { _ { } @@ -62,90 +46,11 @@ benchmarks! { let call = Box::new(frame_system::Call::remark(vec![]).into()); }: _(RawOrigin::Signed(caller), u as u16, call) - as_multi_create { - // Signatories, need at least 2 total people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call) - - as_multi_approve { - // Signatories, need at least 2 people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let mut signatories2 = signatories.clone(); - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - // before the call, get the timepoint - let timepoint = Utility::::timepoint(); - // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; - let caller2 = signatories2.remove(0); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) - - as_multi_complete { - // Signatories, need at least 2 people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let mut signatories2 = signatories.clone(); - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - // before the call, get the timepoint - let timepoint = Utility::::timepoint(); - // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; - // Everyone except the first person approves - for i in 1 .. s - 1 { - let mut signatories_loop = signatories2.clone(); - let caller_loop = signatories_loop.remove(i as usize); - Utility::::as_multi(RawOrigin::Signed(caller_loop).into(), s as u16, signatories_loop, Some(timepoint), call.clone())?; - } - let caller2 = signatories2.remove(0); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) - - approve_as_multi_create { - // Signatories, need at least 2 people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); - // Create the multi - }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash) - - approve_as_multi_approve { - // Signatories, need at least 2 people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let mut signatories2 = signatories.clone(); - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); - // before the call, get the timepoint - let timepoint = Utility::::timepoint(); - // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; - let caller2 = signatories2.remove(0); - }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash) - - cancel_as_multi { - // Signatories, need at least 2 people - let s in 2 .. T::MaxSignatories::get() as u32; - // Transaction Length - let z in 0 .. 10_000; - let (mut signatories, call) = setup_multi::(s, z)?; - let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); - let timepoint = Utility::::timepoint(); - // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller.clone()).into(), s as u16, signatories.clone(), None, call.clone())?; - }: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) + as_limited_sub { + let u in 0 .. 1000; + let caller = account("caller", u, SEED); + let call = Box::new(frame_system::Call::remark(vec![]).into()); + }: _(RawOrigin::Signed(caller), u as u16, call) } #[cfg(test)] @@ -159,12 +64,7 @@ mod tests { new_test_ext().execute_with(|| { assert_ok!(test_benchmark_batch::()); assert_ok!(test_benchmark_as_sub::()); - assert_ok!(test_benchmark_as_multi_create::()); - assert_ok!(test_benchmark_as_multi_approve::()); - assert_ok!(test_benchmark_as_multi_complete::()); - assert_ok!(test_benchmark_approve_as_multi_create::()); - assert_ok!(test_benchmark_approve_as_multi_approve::()); - assert_ok!(test_benchmark_cancel_as_multi::()); + assert_ok!(test_benchmark_as_limited_sub::()); }); } } diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index ea56bc4599..34385b6786 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -16,14 +16,14 @@ // limitations under the License. //! # Utility Module -//! A module with helpers for dispatch management. +//! A stateless module with helpers for dispatch management. //! //! - [`utility::Trait`](./trait.Trait.html) //! - [`Call`](./enum.Call.html) //! //! ## Overview //! -//! This module contains three basic pieces of functionality, two of which are stateless: +//! This module contains two basic pieces of functionality: //! - Batch dispatch: A stateless operation, allowing any origin to execute multiple calls in a //! single dispatch. This can be useful to amalgamate proposals, combining `set_code` with //! corresponding `set_storage`s, for efficient multiple payouts with just a single signature @@ -33,12 +33,6 @@ //! account IDs) and these can be stacked. This can be useful as a key management tool, where you //! need multiple distinct accounts (e.g. as controllers for many staking accounts), but where //! it's perfectly fine to have each of them controlled by the same underlying keypair. -//! - Multisig dispatch (stateful): A potentially stateful operation, allowing multiple signed -//! origins (accounts) to coordinate and dispatch a call from a well-known origin, derivable -//! deterministically from the set of account IDs and the threshold number of accounts from the -//! set that must approve it. In the case that the threshold is just one then this is a stateless -//! operation. This is useful for multisig wallets where cryptographic threshold signatures are -//! not available or desired. //! //! ## Interface //! @@ -50,12 +44,6 @@ //! #### For pseudonymal dispatch //! * `as_sub` - Dispatch a call from a secondary ("sub") signed origin. //! -//! #### For multisig dispatch -//! * `as_multi` - Approve and if possible dispatch a call from a composite origin formed from a -//! number of signed origins. -//! * `approve_as_multi` - Approve a call from a composite origin. -//! * `cancel_as_multi` - Cancel a call from a composite origin. -//! //! [`Call`]: ./enum.Call.html //! [`Trait`]: ./trait.Trait.html @@ -66,10 +54,9 @@ use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_core::TypeId; use sp_io::hashing::blake2_256; -use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, RuntimeDebug}; -use frame_support::{traits::{Get, ReservableCurrency, Currency, Filter}, - weights::{Weight, GetDispatchInfo, DispatchClass, FunctionOf, Pays}, - dispatch::{DispatchResultWithPostInfo, DispatchErrorWithPostInfo, PostDispatchInfo}, +use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure}; +use frame_support::{traits::{Filter, FilterStack, ClearFilterGuard}, + weights::{Weight, GetDispatchInfo, DispatchClass, FunctionOf, Pays}, dispatch::PostDispatchInfo, }; use frame_system::{self as system, ensure_signed, ensure_root}; use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; @@ -77,97 +64,25 @@ use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; mod tests; mod benchmarking; -type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; - /// Configuration trait. pub trait Trait: frame_system::Trait { /// The overarching event type. - type Event: From> + Into<::Event>; + type Event: From + Into<::Event>; /// The overarching call type. type Call: Parameter + Dispatchable + GetDispatchInfo + From>; - /// The currency mechanism. - type Currency: ReservableCurrency; - - /// The base amount of currency needed to reserve for creating a multisig execution. - /// - /// This is held for an additional storage item whose value size is - /// `4 + sizeof((BlockNumber, Balance, AccountId))` bytes. - type MultisigDepositBase: Get>; - - /// The amount of currency needed per unit threshold when creating a multisig execution. - /// - /// This is held for adding 32 bytes more into a pre-existing storage value. - type MultisigDepositFactor: Get>; - - /// The maximum amount of signatories allowed in the multisig. - type MaxSignatories: Get; - /// Is a given call compatible with the proxying subsystem? - type IsCallable: Filter<::Call>; -} - -/// A global extrinsic index, formed as the extrinsic index within a block, together with that -/// block's height. This allows a transaction in which a multisig operation of a particular -/// composite was created to be uniquely identified. -#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug)] -pub struct Timepoint { - /// The height of the chain at the point in time. - height: BlockNumber, - /// The index of the extrinsic at the point in time. - index: u32, -} - -/// An open multisig operation. -#[derive(Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug)] -pub struct Multisig { - /// The extrinsic when the multisig operation was opened. - when: Timepoint, - /// The amount held in reserve of the `depositor`, to be returned once the operation ends. - deposit: Balance, - /// The account who opened it (i.e. the first to approve it). - depositor: AccountId, - /// The approvals achieved so far, including the depositor. Always sorted. - approvals: Vec, + type IsCallable: FilterStack<::Call>; } decl_storage! { - trait Store for Module as Utility { - /// The set of open multisig operations. - pub Multisigs: double_map - hasher(twox_64_concat) T::AccountId, hasher(blake2_128_concat) [u8; 32] - => Option, T::AccountId>>; - } + trait Store for Module as Utility {} } decl_error! { pub enum Error for Module { - /// Threshold is too low (zero). - ZeroThreshold, - /// Call is already approved by this signatory. - AlreadyApproved, - /// Call doesn't need any (more) approvals. - NoApprovalsNeeded, - /// There are too few signatories in the list. - TooFewSignatories, - /// There are too many signatories in the list. - TooManySignatories, - /// The signatories were provided out of order; they should be ordered. - SignatoriesOutOfOrder, - /// The sender was contained in the other signatories; it shouldn't be. - SenderInSignatories, - /// Multisig operation not found when attempting to cancel. - NotFound, - /// Only the account that originally created the multisig is able to cancel it. - NotOwner, - /// No timepoint was given, yet the multisig operation is already underway. - NoTimepoint, - /// A different timepoint was given to the multisig operation that is underway. - WrongTimepoint, - /// A timepoint was given, yet no multisig operation is underway. - UnexpectedTimepoint, /// A call with a `false` `IsCallable` filter was attempted. Uncallable, } @@ -175,28 +90,12 @@ decl_error! { decl_event! { /// Events type. - pub enum Event where - AccountId = ::AccountId, - BlockNumber = ::BlockNumber, - CallHash = [u8; 32] - { + pub enum Event { /// Batch of dispatches did not complete fully. Index of first failing dispatch given, as /// well as the error. BatchInterrupted(u32, DispatchError), /// Batch of dispatches completed fully with no error. BatchCompleted, - /// A new multisig operation has begun. First param is the account that is approving, - /// second is the multisig account, third is hash of the call. - NewMultisig(AccountId, AccountId, CallHash), - /// A multisig operation has been approved by someone. First param is the account that is - /// approving, third is the multisig account, fourth is hash of the call. - MultisigApproval(AccountId, Timepoint, AccountId, CallHash), - /// A multisig operation has been executed. First param is the account that is - /// approving, third is the multisig account, fourth is hash of the call to be executed. - MultisigExecuted(AccountId, Timepoint, AccountId, CallHash, DispatchResult), - /// A multisig operation has been cancelled. First param is the account that is - /// cancelling, third is the multisig account, fourth is hash of the call. - MultisigCancelled(AccountId, Timepoint, AccountId, CallHash), /// A call with a `false` IsCallable filter was attempted. Uncallable(u32), } @@ -210,25 +109,6 @@ impl TypeId for IndexedUtilityModuleId { const TYPE_ID: [u8; 4] = *b"suba"; } -mod weight_of { - use super::*; - - /// - Base Weight: - /// - Create: 46.55 + 0.089 * S µs - /// - Approve: 34.03 + .112 * S µs - /// - Complete: 40.36 + .225 * S µs - /// - DB Weight: - /// - Reads: Multisig Storage, [Caller Account] - /// - Writes: Multisig Storage, [Caller Account] - /// - Plus Call Weight - pub fn as_multi(other_sig_len: usize, call_weight: Weight) -> Weight { - call_weight - .saturating_add(45_000_000) - .saturating_add((other_sig_len as Weight).saturating_mul(250_000)) - .saturating_add(T::DbWeight::get().reads_writes(1, 1)) - } -} - decl_module! { pub struct Module for enum Call where origin: T::Origin { type Error = Error; @@ -278,21 +158,26 @@ decl_module! { let is_root = ensure_root(origin.clone()).is_ok(); for (index, call) in calls.into_iter().enumerate() { if !is_root && !T::IsCallable::filter(&call) { - Self::deposit_event(Event::::Uncallable(index as u32)); + Self::deposit_event(Event::Uncallable(index as u32)); return Ok(()) } let result = call.dispatch(origin.clone()); if let Err(e) = result { - Self::deposit_event(Event::::BatchInterrupted(index as u32, e.error)); + Self::deposit_event(Event::BatchInterrupted(index as u32, e.error)); return Ok(()); } } - Self::deposit_event(Event::::BatchCompleted); + Self::deposit_event(Event::BatchCompleted); } /// Send a call through an indexed pseudonym of the sender. /// - /// Calls must each fulfil the `IsCallable` filter. + /// The call must fulfil only the pre-cleared `IsCallable` filter (i.e. only the level of + /// filtering that remains after calling `take()`). + /// + /// NOTE: If you need to ensure that any account-based filtering is honored (i.e. because + /// you expect `proxy` to have been used prior in the call stack and you want it to apply to + /// any sub-accounts), then use `as_limited_sub` instead. /// /// The dispatch origin for this call must be _Signed_. /// @@ -309,310 +194,42 @@ decl_module! { )] fn as_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; + // We're now executing as a freshly authenticated new account, so the previous call + // restrictions no longer apply. + let _guard = ClearFilterGuard::::Call>::new(); ensure!(T::IsCallable::filter(&call), Error::::Uncallable); let pseudonym = Self::sub_account_id(who, index); call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) .map(|_| ()).map_err(|e| e.error) } - /// Register approval for a dispatch to be made from a deterministic composite account if - /// approved by a total of `threshold - 1` of `other_signatories`. - /// - /// If there are enough, then dispatch the call. Calls must each fulfil the `IsCallable` - /// filter. - /// - /// Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus - /// `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or - /// is cancelled. - /// - /// The dispatch origin for this call must be _Signed_. - /// - /// - `threshold`: The total number of approvals for this dispatch before it is executed. - /// - `other_signatories`: The accounts (other than the sender) who can approve this - /// dispatch. May not be empty. - /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - /// not the first approval, then it must be `Some`, with the timepoint (block number and - /// transaction index) of the first approval transaction. - /// - `call`: The call to be executed. - /// - /// NOTE: Unless this is the final approval, you will generally want to use - /// `approve_as_multi` instead, since it only requires a hash of the call. - /// - /// Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise - /// on success, result is `Ok` and the result from the interior call, if it was executed, - /// may be found in the deposited `MultisigExecuted` event. - /// - /// # - /// - `O(S + Z + Call)`. - /// - Up to one balance-reserve or unreserve operation. - /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of - /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - /// - One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len. - /// - One encode & hash, both of complexity `O(S)`. - /// - Up to one binary search and insert (`O(logS + S)`). - /// - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. - /// - One event. - /// - The weight of the `call`. - /// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a - /// deposit taken for its lifetime of - /// `MultisigDepositBase + threshold * MultisigDepositFactor`. - /// ------------------------------- - /// - Base Weight: - /// - Create: 46.55 + 0.089 * S µs - /// - Approve: 34.03 + .112 * S µs - /// - Complete: 40.36 + .225 * S µs - /// - DB Weight: - /// - Reads: Multisig Storage, [Caller Account] - /// - Writes: Multisig Storage, [Caller Account] - /// - Plus Call Weight - /// # - #[weight = FunctionOf( - |args: (&u16, &Vec, &Option>, &Box<::Call>)| { - weight_of::as_multi::(args.1.len(),args.3.get_dispatch_info().weight) - }, - |args: (&u16, &Vec, &Option>, &Box<::Call>)| { - args.3.get_dispatch_info().class - }, - Pays::Yes, - )] - fn as_multi(origin, - threshold: u16, - other_signatories: Vec, - maybe_timepoint: Option>, - call: Box<::Call>, - ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - ensure!(T::IsCallable::filter(call.as_ref()), Error::::Uncallable); - ensure!(threshold >= 1, Error::::ZeroThreshold); - let max_sigs = T::MaxSignatories::get() as usize; - ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); - let other_signatories_len = other_signatories.len(); - ensure!(other_signatories_len < max_sigs, Error::::TooManySignatories); - let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; - - let id = Self::multi_account_id(&signatories, threshold); - let call_hash = call.using_encoded(blake2_256); - - if let Some(mut m) = >::get(&id, call_hash) { - let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - if let Err(pos) = m.approvals.binary_search(&who) { - // we know threshold is greater than zero from the above ensure. - if (m.approvals.len() as u16) < threshold - 1 { - m.approvals.insert(pos, who.clone()); - >::insert(&id, call_hash, m); - Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); - // Call is not made, so the actual weight does not include call - return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) - } - } else { - if (m.approvals.len() as u16) < threshold { - Err(Error::::AlreadyApproved)? - } - } - - let result = call.dispatch(frame_system::RawOrigin::Signed(id.clone()).into()); - let _ = T::Currency::unreserve(&m.depositor, m.deposit); - >::remove(&id, call_hash); - Self::deposit_event(RawEvent::MultisigExecuted( - who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error) - )); - return Ok(None.into()) - } else { - ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); - if threshold > 1 { - let deposit = T::MultisigDepositBase::get() - + T::MultisigDepositFactor::get() * threshold.into(); - T::Currency::reserve(&who, deposit)?; - >::insert(&id, call_hash, Multisig { - when: Self::timepoint(), - deposit, - depositor: who.clone(), - approvals: vec![who.clone()], - }); - Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); - // Call is not made, so we can return that weight - return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) - } else { - let result = call.dispatch(frame_system::RawOrigin::Signed(id).into()); - match result { - Ok(post_dispatch_info) => { - match post_dispatch_info.actual_weight { - Some(actual_weight) => return Ok(Some(weight_of::as_multi::(other_signatories_len, actual_weight)).into()), - None => return Ok(None.into()), - } - }, - Err(err) => { - match err.post_info.actual_weight { - Some(actual_weight) => { - let weight_used = weight_of::as_multi::(other_signatories_len, actual_weight); - return Err(DispatchErrorWithPostInfo { post_info: Some(weight_used).into(), error: err.error.into() }) - }, - None => { - return Err(err) - } - } - } - } - } - } - } - - /// Register approval for a dispatch to be made from a deterministic composite account if - /// approved by a total of `threshold - 1` of `other_signatories`. - /// - /// Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus - /// `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or - /// is cancelled. - /// - /// The dispatch origin for this call must be _Signed_. - /// - /// - `threshold`: The total number of approvals for this dispatch before it is executed. - /// - `other_signatories`: The accounts (other than the sender) who can approve this - /// dispatch. May not be empty. - /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - /// not the first approval, then it must be `Some`, with the timepoint (block number and - /// transaction index) of the first approval transaction. - /// - `call_hash`: The hash of the call to be executed. + /// Send a call through an indexed pseudonym of the sender. /// - /// NOTE: If this is the final approval, you will want to use `as_multi` instead. + /// Calls must each fulfil the `IsCallable` filter; it is not cleared before. /// - /// # - /// - `O(S)`. - /// - Up to one balance-reserve or unreserve operation. - /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of - /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - /// - One encode & hash, both of complexity `O(S)`. - /// - Up to one binary search and insert (`O(logS + S)`). - /// - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. - /// - One event. - /// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a - /// deposit taken for its lifetime of - /// `MultisigDepositBase + threshold * MultisigDepositFactor`. - /// ---------------------------------- - /// - Base Weight: - /// - Create: 44.71 + 0.088 * S - /// - Approve: 31.48 + 0.116 * S - /// - DB Weight: - /// - Read: Multisig Storage, [Caller Account] - /// - Write: Multisig Storage, [Caller Account] - /// # - #[weight = FunctionOf( - |args: (&u16, &Vec, &Option>, &[u8; 32])| { - T::DbWeight::get().reads_writes(1, 1) - .saturating_add(45_000_000) - .saturating_add((args.1.len() as Weight).saturating_mul(120_000)) - }, - DispatchClass::Normal, - Pays::Yes, - )] - fn approve_as_multi(origin, - threshold: u16, - other_signatories: Vec, - maybe_timepoint: Option>, - call_hash: [u8; 32], - ) -> DispatchResult { - let who = ensure_signed(origin)?; - ensure!(threshold >= 1, Error::::ZeroThreshold); - let max_sigs = T::MaxSignatories::get() as usize; - ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); - ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); - let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; - - let id = Self::multi_account_id(&signatories, threshold); - - if let Some(mut m) = >::get(&id, call_hash) { - let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - ensure!(m.approvals.len() < threshold as usize, Error::::NoApprovalsNeeded); - if let Err(pos) = m.approvals.binary_search(&who) { - m.approvals.insert(pos, who.clone()); - >::insert(&id, call_hash, m); - Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); - } else { - Err(Error::::AlreadyApproved)? - } - } else { - if threshold > 1 { - ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); - let deposit = T::MultisigDepositBase::get() - + T::MultisigDepositFactor::get() * threshold.into(); - T::Currency::reserve(&who, deposit)?; - >::insert(&id, call_hash, Multisig { - when: Self::timepoint(), - deposit, - depositor: who.clone(), - approvals: vec![who.clone()], - }); - Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); - } else { - Err(Error::::NoApprovalsNeeded)? - } - } - Ok(()) - } - - /// Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously - /// for this operation will be unreserved on success. + /// NOTE: If you need to ensure that any account-based filtering is not honored (i.e. + /// because you expect `proxy` to have been used prior in the call stack and you do not want + /// the call restrictions to apply to any sub-accounts), then use `as_sub` instead. /// /// The dispatch origin for this call must be _Signed_. /// - /// - `threshold`: The total number of approvals for this dispatch before it is executed. - /// - `other_signatories`: The accounts (other than the sender) who can approve this - /// dispatch. May not be empty. - /// - `timepoint`: The timepoint (block number and transaction index) of the first approval - /// transaction for this dispatch. - /// - `call_hash`: The hash of the call to be executed. - /// /// # - /// - `O(S)`. - /// - Up to one balance-reserve or unreserve operation. - /// - One passthrough operation, one insert, both `O(S)` where `S` is the number of - /// signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - /// - One encode & hash, both of complexity `O(S)`. - /// - One event. - /// - I/O: 1 read `O(S)`, one remove. - /// - Storage: removes one item. - /// ---------------------------------- - /// - Base Weight: 37.6 + 0.084 * S - /// - DB Weight: - /// - Read: Multisig Storage, [Caller Account] - /// - Write: Multisig Storage, [Caller Account] + /// - Base weight: 2.861 µs + /// - Plus the weight of the `call` /// # #[weight = FunctionOf( - |args: (&u16, &Vec, &Timepoint, &[u8; 32])| { - T::DbWeight::get().reads_writes(1, 1) - .saturating_add(40_000_000) - .saturating_add((args.1.len() as Weight).saturating_mul(100_000)) + |args: (&u16, &Box<::Call>)| { + args.1.get_dispatch_info().weight.saturating_add(3_000_000) }, - DispatchClass::Normal, + |args: (&u16, &Box<::Call>)| args.1.get_dispatch_info().class, Pays::Yes, )] - fn cancel_as_multi(origin, - threshold: u16, - other_signatories: Vec, - timepoint: Timepoint, - call_hash: [u8; 32], - ) -> DispatchResult { + fn as_limited_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; - ensure!(threshold >= 1, Error::::ZeroThreshold); - let max_sigs = T::MaxSignatories::get() as usize; - ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); - ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); - let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; - - let id = Self::multi_account_id(&signatories, threshold); - - let m = >::get(&id, call_hash) - .ok_or(Error::::NotFound)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - ensure!(m.depositor == who, Error::::NotOwner); - - let _ = T::Currency::unreserve(&m.depositor, m.deposit); - >::remove(&id, call_hash); - - Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id, call_hash)); - Ok(()) + ensure!(T::IsCallable::filter(&call), Error::::Uncallable); + let pseudonym = Self::sub_account_id(who, index); + call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) + .map(|_| ()).map_err(|e| e.error) } } } @@ -623,42 +240,4 @@ impl Module { let entropy = (b"modlpy/utilisuba", who, index).using_encoded(blake2_256); T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() } - - /// Derive a multi-account ID from the sorted list of accounts and the threshold that are - /// required. - /// - /// NOTE: `who` must be sorted. If it is not, then you'll get the wrong answer. - pub fn multi_account_id(who: &[T::AccountId], threshold: u16) -> T::AccountId { - let entropy = (b"modlpy/utilisuba", who, threshold).using_encoded(blake2_256); - T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() - } - - /// The current `Timepoint`. - pub fn timepoint() -> Timepoint { - Timepoint { - height: >::block_number(), - index: >::extrinsic_index().unwrap_or_default(), - } - } - - /// Check that signatories is sorted and doesn't contain sender, then insert sender. - fn ensure_sorted_and_insert(other_signatories: Vec, who: T::AccountId) - -> Result, DispatchError> - { - let mut signatories = other_signatories; - let mut maybe_last = None; - let mut index = 0; - for item in signatories.iter() { - if let Some(last) = maybe_last { - ensure!(last < item, Error::::SignatoriesOutOfOrder); - } - if item <= &who { - ensure!(item != &who, Error::::SenderInSignatories); - index += 1; - } - maybe_last = Some(item); - } - signatories.insert(index, who); - Ok(signatories) - } } diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index a74d9b3253..66a663a385 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -32,12 +32,11 @@ use crate as utility; impl_outer_origin! { pub enum Origin for Test where system = frame_system {} } - impl_outer_event! { pub enum TestEvent for Test { system, pallet_balances, - utility, + utility, } } impl_outer_dispatch! { @@ -89,8 +88,8 @@ parameter_types! { } impl pallet_balances::Trait for Test { type Balance = u64; - type Event = TestEvent; type DustRemoval = (); + type Event = TestEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; } @@ -108,13 +107,16 @@ impl Filter for TestIsCallable { } } } +impl FilterStack for TestIsCallable { + type Stack = (); + fn push(_: impl Fn(&Call) -> bool + 'static) {} + fn pop() {} + fn take() -> Self::Stack { () } + fn restore(_: Self::Stack) {} +} impl Trait for Test { type Event = TestEvent; type Call = Call; - type Currency = Balances; - type MultisigDepositBase = MultisigDepositBase; - type MultisigDepositFactor = MultisigDepositFactor; - type MaxSignatories = MaxSignatories; type IsCallable = TestIsCallable; } type System = frame_system::Module; @@ -142,264 +144,6 @@ fn expect_event>(e: E) { assert_eq!(last_event(), e.into()); } -fn now() -> Timepoint { - Utility::timepoint() -} - -#[test] -fn multisig_deposit_is_taken_and_returned() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_eq!(Balances::free_balance(1), 2); - assert_eq!(Balances::reserved_balance(1), 3); - - assert_ok!(Utility::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); - assert_eq!(Balances::free_balance(1), 5); - assert_eq!(Balances::reserved_balance(1), 0); - }); -} - -#[test] -fn cancel_multisig_returns_deposit() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Utility::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); - assert_eq!(Balances::free_balance(1), 6); - assert_eq!(Balances::reserved_balance(1), 4); - assert_ok!( - Utility::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash.clone()), - ); - assert_eq!(Balances::free_balance(1), 10); - assert_eq!(Balances::reserved_balance(1), 0); - }); -} - -#[test] -fn timepoint_checking_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - - assert_noop!( - Utility::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone()), - Error::::UnexpectedTimepoint, - ); - - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); - - assert_noop!( - Utility::as_multi(Origin::signed(2), 2, vec![1, 3], None, call.clone()), - Error::::NoTimepoint, - ); - let later = Timepoint { index: 1, .. now() }; - assert_noop!( - Utility::as_multi(Origin::signed(2), 2, vec![1, 3], Some(later), call.clone()), - Error::::WrongTimepoint, - ); - }); -} - -#[test] -fn multisig_2_of_3_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); - assert_eq!(Balances::free_balance(6), 0); - - assert_ok!(Utility::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); - assert_eq!(Balances::free_balance(6), 15); - }); -} - -#[test] -fn multisig_3_of_3_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 3); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Utility::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); - assert_eq!(Balances::free_balance(6), 0); - - assert_ok!(Utility::as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), call)); - assert_eq!(Balances::free_balance(6), 15); - }); -} - -#[test] -fn cancel_multisig_works() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Utility::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); - assert_noop!( - Utility::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()), - Error::::NotOwner, - ); - assert_ok!( - Utility::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash.clone()), - ); - }); -} - -#[test] -fn multisig_2_of_3_as_multi_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_eq!(Balances::free_balance(6), 0); - - assert_ok!(Utility::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); - assert_eq!(Balances::free_balance(6), 15); - }); -} - -#[test] -fn multisig_2_of_3_as_multi_with_many_calls_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call1 = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); - let call2 = Box::new(Call::Balances(BalancesCall::transfer(7, 5))); - - assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call1.clone())); - assert_ok!(Utility::as_multi(Origin::signed(2), 2, vec![1, 3], None, call2.clone())); - assert_ok!(Utility::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call2)); - assert_ok!(Utility::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call1)); - - assert_eq!(Balances::free_balance(6), 10); - assert_eq!(Balances::free_balance(7), 5); - }); -} - -#[test] -fn multisig_2_of_3_cannot_reissue_same_call() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); - assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_ok!(Utility::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call.clone())); - assert_eq!(Balances::free_balance(multi), 5); - - assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_ok!(Utility::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call.clone())); - - let err = DispatchError::from(BalancesError::::InsufficientBalance).stripped(); - expect_event(RawEvent::MultisigExecuted(3, now(), multi, call.using_encoded(blake2_256), Err(err))); - }); -} - -#[test] -fn zero_threshold_fails() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_noop!( - Utility::as_multi(Origin::signed(1), 0, vec![2], None, call), - Error::::ZeroThreshold, - ); - }); -} - -#[test] -fn too_many_signatories_fails() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_noop!( - Utility::as_multi(Origin::signed(1), 2, vec![2, 3, 4], None, call.clone()), - Error::::TooManySignatories, - ); - }); -} - -#[test] -fn duplicate_approvals_are_ignored() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Utility::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash.clone())); - assert_noop!( - Utility::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash.clone()), - Error::::AlreadyApproved, - ); - assert_ok!(Utility::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone())); - assert_noop!( - Utility::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash.clone()), - Error::::NoApprovalsNeeded, - ); - }); -} - -#[test] -fn multisig_1_of_3_works() { - new_test_ext().execute_with(|| { - let multi = Utility::multi_account_id(&[1, 2, 3][..], 1); - assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); - assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_noop!( - Utility::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash.clone()), - Error::::NoApprovalsNeeded, - ); - assert_noop!( - Utility::as_multi(Origin::signed(4), 1, vec![2, 3], None, call.clone()), - BalancesError::::InsufficientBalance, - ); - assert_ok!(Utility::as_multi(Origin::signed(1), 1, vec![2, 3], None, call)); - - assert_eq!(Balances::free_balance(6), 15); - }); -} - -#[test] -fn multisig_filters() { - new_test_ext().execute_with(|| { - let call = Box::new(Call::System(frame_system::Call::remark(vec![]))); - assert_noop!( - Utility::as_multi(Origin::signed(1), 1, vec![], None, call.clone()), - Error::::Uncallable, - ); - }); -} - #[test] fn as_sub_works() { new_test_ext().execute_with(|| { @@ -469,7 +213,7 @@ fn batch_with_signed_filters() { Call::System(frame_system::Call::remark(vec![])) ]), ); - expect_event(RawEvent::Uncallable(0)); + expect_event(Event::Uncallable(0)); }); } diff --git a/primitives/std/with_std.rs b/primitives/std/with_std.rs index f495fa8fea..e1994e764d 100644 --- a/primitives/std/with_std.rs +++ b/primitives/std/with_std.rs @@ -33,6 +33,7 @@ pub use std::num; pub use std::ops; pub use std::ptr; pub use std::rc; +pub use std::sync; pub use std::result; pub use std::slice; pub use std::str; diff --git a/primitives/std/without_std.rs b/primitives/std/without_std.rs index 452994ca48..09f7a1976c 100755 --- a/primitives/std/without_std.rs +++ b/primitives/std/without_std.rs @@ -19,6 +19,7 @@ pub extern crate alloc; pub use alloc::boxed; pub use alloc::rc; +pub use alloc::sync; pub use alloc::vec; pub use core::any; pub use core::cell; -- GitLab From 4a560614ccc0bbf6ecd4e80784a9e9e9a06191e2 Mon Sep 17 00:00:00 2001 From: Boqin Qin Date: Mon, 8 Jun 2020 19:39:50 +0800 Subject: [PATCH 119/280] client/api: fix possible deadlock when comparing with itself (#6277) --- client/api/src/in_mem.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs index 45c41fbcb7..1de2747eb4 100644 --- a/client/api/src/in_mem.rs +++ b/client/api/src/in_mem.rs @@ -19,6 +19,7 @@ //! In memory client backend use std::collections::HashMap; +use std::ptr; use std::sync::Arc; use parking_lot::RwLock; use sp_core::{ @@ -191,11 +192,19 @@ impl Blockchain { /// Compare this blockchain with another in-mem blockchain pub fn equals_to(&self, other: &Self) -> bool { + // Check ptr equality first to avoid double read locks. + if ptr::eq(self, other) { + return true; + } self.canon_equals_to(other) && self.storage.read().blocks == other.storage.read().blocks } /// Compare canonical chain to other canonical chain. pub fn canon_equals_to(&self, other: &Self) -> bool { + // Check ptr equality first to avoid double read locks. + if ptr::eq(self, other) { + return true; + } let this = self.storage.read(); let other = other.storage.read(); this.hashes == other.hashes -- GitLab From a5bf77ded46c3a8b0c940d6b51bdf4dd19e76339 Mon Sep 17 00:00:00 2001 From: pscott <30843220+pscott@users.noreply.github.com> Date: Mon, 8 Jun 2020 15:43:00 +0200 Subject: [PATCH 120/280] Make all features explicit (#6267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * make all features explicit * Change to -feature suffix to with- prefix * Add newline at the end of the Cargo.toml file * Remove rhd feature * Remove some features from Cargo.toml * Remove test-helpers feature in tx pool * Return db_open_error("with-".. Co-authored-by: Bastian Köcher * Rename subdb feature to with-subdb Co-authored-by: Bastian Köcher * Remove 'strict' feature and cfg_attr * Check for with-subdb feature instead of subdb Co-authored-by: Bastian Köcher --- client/db/Cargo.toml | 3 +++ client/db/src/lib.rs | 10 +++++----- client/db/src/utils.rs | 20 ++++++++++---------- client/executor/runtime-test/src/lib.rs | 1 - client/service/Cargo.toml | 2 +- client/transaction-pool/src/lib.rs | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 2 +- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 32e6f9daa2..18f94b39d7 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -47,3 +47,6 @@ tempfile = "3" [features] default = [] test-helpers = [] +with-kvdb-rocksdb = ["kvdb-rocksdb"] +with-parity-db = ["parity-db"] +with-subdb = [] diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 9fb8f3c8c0..f75693ec9f 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -31,20 +31,20 @@ pub mod light; pub mod offchain; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] pub mod bench; mod children; mod cache; mod changes_tries_storage; mod storage_cache; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] mod upgrade; mod utils; mod stats; -#[cfg(feature = "parity-db")] +#[cfg(feature = "with-parity-db")] mod parity_db; -#[cfg(feature = "subdb")] +#[cfg(feature = "with-subdb")] mod subdb; use std::sync::Arc; @@ -91,7 +91,7 @@ use log::{trace, debug, warn}; pub use sp_database::Database; pub use sc_state_db::PruningMode; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] pub use bench::BenchmarkingState; const MIN_BLOCKS_TO_KEEP_CHANGES_TRIES_FOR: u32 = 32768; diff --git a/client/db/src/utils.rs b/client/db/src/utils.rs index 80b08b3a6e..d66d5abfea 100644 --- a/client/db/src/utils.rs +++ b/client/db/src/utils.rs @@ -36,7 +36,7 @@ use crate::{DatabaseSettings, DatabaseSettingsSrc, Database, DbHash}; /// Number of columns in the db. Must be the same for both full && light dbs. /// Otherwise RocksDb will fail to open database && check its type. -#[cfg(any(feature = "kvdb-rocksdb", feature = "test-helpers", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", feature = "test-helpers", test))] pub const NUM_COLUMNS: u32 = 11; /// Meta column. The set of keys in the column is shared by full && light storages. pub const COLUMN_META: u32 = 0; @@ -219,7 +219,7 @@ pub fn open_database( ); let db: Arc> = match &config.source { - #[cfg(any(feature = "kvdb-rocksdb", test))] + #[cfg(any(feature = "with-kvdb-rocksdb", test))] DatabaseSettingsSrc::RocksDb { path, cache_size } => { // first upgrade database to required version crate::upgrade::upgrade_db::(&path, db_type)?; @@ -255,27 +255,27 @@ pub fn open_database( .map_err(|err| sp_blockchain::Error::Backend(format!("{}", err)))?; sp_database::as_database(db) }, - #[cfg(not(any(feature = "kvdb-rocksdb", test)))] + #[cfg(not(any(feature = "with-kvdb-rocksdb", test)))] DatabaseSettingsSrc::RocksDb { .. } => { - return db_open_error("kvdb-rocksdb"); + return db_open_error("with-kvdb-rocksdb"); }, - #[cfg(feature = "subdb")] + #[cfg(feature = "with-subdb")] DatabaseSettingsSrc::SubDb { path } => { crate::subdb::open(&path, NUM_COLUMNS) .map_err(|e| sp_blockchain::Error::Backend(format!("{:?}", e)))? }, - #[cfg(not(feature = "subdb"))] + #[cfg(not(feature = "with-subdb"))] DatabaseSettingsSrc::SubDb { .. } => { - return db_open_error("subdb"); + return db_open_error("with-subdb"); }, - #[cfg(feature = "parity-db")] + #[cfg(feature = "with-parity-db")] DatabaseSettingsSrc::ParityDb { path } => { crate::parity_db::open(&path) .map_err(|e| sp_blockchain::Error::Backend(format!("{:?}", e)))? }, - #[cfg(not(feature = "parity-db"))] + #[cfg(not(feature = "with-parity-db"))] DatabaseSettingsSrc::ParityDb { .. } => { - return db_open_error("parity-db"); + return db_open_error("with-parity-db"); }, DatabaseSettingsSrc::Custom(db) => db.clone(), }; diff --git a/client/executor/runtime-test/src/lib.rs b/client/executor/runtime-test/src/lib.rs index 15a4177048..dc6bab759e 100644 --- a/client/executor/runtime-test/src/lib.rs +++ b/client/executor/runtime-test/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(feature = "strict", deny(warnings))] // Make the WASM binary available. #[cfg(feature = "std")] diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index fc5991bc3f..acc75d6890 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] default = ["db"] # The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass # a path to a database, an error will be produced at runtime. -db = ["sc-client-db/kvdb-rocksdb", "sc-client-db/parity-db"] +db = ["sc-client-db/with-kvdb-rocksdb", "sc-client-db/with-parity-db"] wasmtime = [ "sc-executor/wasmtime", ] diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index b91992a47d..ad238e6241 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -28,7 +28,7 @@ mod metrics; pub mod error; -#[cfg(any(feature = "test-helpers", test))] +#[cfg(test)] pub mod testing; pub use sc_transaction_graph as txpool; diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index d9a8dd67e7..d7a3ddc587 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -26,4 +26,4 @@ codec = { version = "1.3.0", package = "parity-scale-codec" } [features] default = ["db"] -db = ["sc-client-db/kvdb-rocksdb", "sc-client-db/parity-db"] +db = ["sc-client-db/with-kvdb-rocksdb", "sc-client-db/with-parity-db"] -- GitLab From 3cb05a1ef04a2b5126f8167fc5be63d41c582e42 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Mon, 8 Jun 2020 12:47:09 -0400 Subject: [PATCH 121/280] Use Subscription Manager from `jsonrpc-pubsub`: The Sequel (#6254) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump jsonrpc pubsub, core, http, and ws Right now these are the packages which _need_ to be updated so I can just the latest `jsonrpc-pubsub` code. Once a release it cut upstream the rest of the dependencies should be updated as well. * Use jsonrpc-pubsub's SubscriptionManager This places sc-rpc-api::Subscriptions * Bump jsonrpc-core outside of sc-rpc-* * Update client/rpc tests Right now one of the `author` tests is failing, I need to think a bit about how best to fix it. * Remove Subscriptions manager There's no need for this implementation since we're using the one from `jsonrpc-pubsub` now * Fix author RPC test This test used to check for a numerial subscription ID, whereas now it uses a string based ID which is the default provided by `jsonrpc-pubsub`'s subscription manager. * Remove unused NumericIdProvider * Add missing bracket Removed one too many with that last one, lol * Bump `jsonrpc` to v14.2 There's an exception though. `jsonrpc-derive` cannot be bumped past v14.0.5 just yet since it has a dependency on `quote` pinned to v1.0.1. This means that at the moment it won't build on Substrate since it's using v1.0.3. * Track `jsonrpc-derive` master branch * Bump `quote` version to v1.0.6 * Bump `jsonrpc-derive` to v14.2.1 This includes support for `quote` v1.0.6 * Use exact version for jsonrpc crates Doing this to make sure any updates in jsonrpc don't accidently trickle down to Polkadot. Co-authored-by: André Silva --- Cargo.lock | 126 ++++++++++++----------- bin/node/browser-testing/Cargo.toml | 2 +- bin/node/cli/Cargo.toml | 2 +- bin/node/rpc-client/Cargo.toml | 2 +- bin/node/rpc/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/consensus/babe/rpc/Cargo.toml | 6 +- client/consensus/manual-seal/Cargo.toml | 6 +- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/rpc-api/Cargo.toml | 8 +- client/rpc-api/src/lib.rs | 2 - client/rpc-api/src/subscriptions.rs | 121 ---------------------- client/rpc-servers/Cargo.toml | 8 +- client/rpc/Cargo.toml | 4 +- client/rpc/src/author/mod.rs | 9 +- client/rpc/src/author/tests.rs | 35 +++++-- client/rpc/src/chain/chain_full.rs | 8 +- client/rpc/src/chain/chain_light.rs | 8 +- client/rpc/src/chain/mod.rs | 11 +- client/rpc/src/chain/tests.rs | 29 ++++-- client/rpc/src/lib.rs | 2 +- client/rpc/src/state/mod.rs | 8 +- client/rpc/src/state/state_full.rs | 8 +- client/rpc/src/state/state_light.rs | 8 +- client/rpc/src/state/tests.rs | 32 ++++-- client/service/Cargo.toml | 1 + client/service/src/builder.rs | 3 +- frame/contracts/rpc/Cargo.toml | 6 +- frame/transaction-payment/rpc/Cargo.toml | 6 +- utils/frame/rpc/support/Cargo.toml | 4 +- utils/frame/rpc/system/Cargo.toml | 6 +- 31 files changed, 196 insertions(+), 285 deletions(-) delete mode 100644 client/rpc-api/src/subscriptions.rs diff --git a/Cargo.lock b/Cargo.lock index 2acf7ea6c7..bee8278b46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,7 +160,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -321,7 +321,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "regex", "rustc-hash", "shlex", @@ -991,7 +991,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1031,7 +1031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1133,7 +1133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ed9afacaea0301eefb738c9deea725e6d53938004597cdc518a8cf9a7aa2f03" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1286,7 +1286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "synstructure", ] @@ -1477,7 +1477,7 @@ version = "2.0.0-rc2" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1488,7 +1488,7 @@ dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1497,7 +1497,7 @@ name = "frame-support-procedural-tools-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -1713,7 +1713,7 @@ checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -2234,7 +2234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -2319,9 +2319,9 @@ dependencies = [ [[package]] name = "jsonrpc-client-transports" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2307a7e78cf969759e390a8a2151ea12e783849a45bb00aa871b468ba58ea79e" +checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158" dependencies = [ "failure", "futures 0.1.29", @@ -2336,9 +2336,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25525f6002338fb4debb5167a89a0b47f727a5a48418417545ad3429758b7fec" +checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" dependencies = [ "futures 0.1.29", "log", @@ -2349,30 +2349,30 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f9382e831a6d630c658df103aac3f971da096deb57c136ea2b760d3b4e3f9f" +checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "14.0.5" +version = "14.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" +checksum = "0fadf6945e227246825a583514534d864554e9f23d80b3c77d034b10983db5ef" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] [[package]] name = "jsonrpc-http-server" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52860f0549694aa4abb12766856f56952ab46d3fb9f0815131b2db3d9cc2f29" +checksum = "0da906d682799df05754480dac1b9e70ec92e12c19ebafd2662a5ea1c9fd6522" dependencies = [ "hyper 0.12.35", "jsonrpc-core", @@ -2385,21 +2385,22 @@ dependencies = [ [[package]] name = "jsonrpc-pubsub" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ca5e391d6c6a2261d4adca029f427fe63ea546ad6cef2957c654c08495ec16" +checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986" dependencies = [ "jsonrpc-core", "log", "parking_lot 0.10.2", + "rand 0.7.3", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f06add502b48351e05dd95814835327fb115e4e9f834ca42fd522d3b769d4d2" +checksum = "56cbfb462e7f902e21121d9f0d1c2b77b2c5b642e1a4e8f4ebfa2e15b94402bb" dependencies = [ "bytes 0.4.12", "globset", @@ -2413,9 +2414,9 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "14.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017a7dd5083d9ed62c5e1dd3e317975c33c3115dac5447f4480fe05a8c354754" +checksum = "903d3109fe7c4acb932b567e1e607e0f524ed04741b09fb0e61841bc40a022fc" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -2641,7 +2642,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4489,7 +4490,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "sp-runtime", "syn 1.0.17", ] @@ -4722,7 +4723,7 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4841,7 +4842,7 @@ checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -4905,7 +4906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5025,7 +5026,7 @@ checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "version_check", ] @@ -5037,7 +5038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "syn-mid", "version_check", @@ -5130,7 +5131,7 @@ dependencies = [ "anyhow", "itertools", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5198,9 +5199,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" dependencies = [ "proc-macro2", ] @@ -5498,7 +5499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5682,7 +5683,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -5815,7 +5816,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -6590,6 +6591,7 @@ dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", "hash-db", + "jsonrpc-pubsub", "lazy_static", "log", "netstat2", @@ -6837,7 +6839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -6933,7 +6935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7053,7 +7055,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7155,7 +7157,7 @@ dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7415,7 +7417,7 @@ name = "sp-debug-derive" version = "2.0.0-rc2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7514,7 +7516,7 @@ version = "2.0.0-rc2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7605,7 +7607,7 @@ dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7900,7 +7902,7 @@ dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -7921,7 +7923,7 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8291,7 +8293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "unicode-xid 0.2.0", ] @@ -8302,7 +8304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8322,7 +8324,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "unicode-xid 0.2.0", ] @@ -8385,7 +8387,7 @@ checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9" dependencies = [ "lazy_static", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "version_check", ] @@ -8415,7 +8417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8621,7 +8623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -8799,7 +8801,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", ] @@ -9131,7 +9133,7 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "wasm-bindgen-shared", ] @@ -9154,7 +9156,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.3", + "quote 1.0.6", "wasm-bindgen-macro-support", ] @@ -9165,7 +9167,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -9198,7 +9200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", ] [[package]] @@ -9486,7 +9488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.3", + "quote 1.0.6", "syn 1.0.17", "synstructure", ] diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 7628582fbb..fc16de2ba2 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" libp2p = { version = "0.19.1", default-features = false } -jsonrpc-core = "14.0.5" +jsonrpc-core = "14.2.0" serde = "1.0.106" serde_json = "1.0.48" wasm-bindgen = { version = "=0.2.62", features = ["serde-serialize"] } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index f2b25068ed..66169bc4f8 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -38,7 +38,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } serde = { version = "1.0.102", features = ["derive"] } futures = { version = "0.3.1", features = ["compat"] } hex-literal = "0.2.1" -jsonrpc-core = "14.0.3" +jsonrpc-core = "14.2.0" log = "0.4.8" rand = "0.7.2" structopt = { version = "0.3.8", optional = true } diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index 0b529d116c..c61d68bc70 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] env_logger = "0.7.0" futures = "0.1.29" hyper = "0.12.35" -jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] } +jsonrpc-core-client = { version = "14.2.0", default-features = false, features = ["http"] } log = "0.4.8" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 00b8be99b1..14e8f2cab6 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -jsonrpc-core = "14.0.3" +jsonrpc-core = "14.2.0" node-primitives = { version = "2.0.0-rc2", path = "../primitives" } node-runtime = { version = "2.0.0-rc2", path = "../runtime" } sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 43bb056404..09c5493da6 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -31,7 +31,7 @@ rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } -jsonrpc-core-client = { version = "14.0.3", features = ["http"] } +jsonrpc-core-client = { version = "14.2.0", features = ["http"] } hyper = "0.12.35" libp2p = { version = "0.19.1", default-features = false } serde_json = "1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 20f7e48758..1a6c7fd60b 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-consensus-babe = { version = "0.8.0-rc2", path = "../" } sc-rpc-api = { version = "0.8.0-rc2", path = "../../../rpc-api" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index de2bf68d76..0da9aa4e4b 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" futures = "0.3.4" -jsonrpc-core = "14.0.5" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.5" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index e1724c6c4e..f8a4344192 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -10,9 +10,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] sc-finality-grandpa = { version = "0.8.0-rc2", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.3" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" futures = { version = "0.3.4", features = ["compat"] } serde = { version = "1.0.105", features = ["derive"] } serde_json = "1.0.50" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index 1075c3a11c..ef77566e9e 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -15,10 +15,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99.2" futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" -jsonrpc-pubsub = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" +jsonrpc-pubsub = "14.2.0" log = "0.4.8" parking_lot = "0.10.0" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } diff --git a/client/rpc-api/src/lib.rs b/client/rpc-api/src/lib.rs index f742d73b69..cd2608dda9 100644 --- a/client/rpc-api/src/lib.rs +++ b/client/rpc-api/src/lib.rs @@ -23,10 +23,8 @@ mod errors; mod helpers; mod policy; -mod subscriptions; pub use jsonrpc_core::IoHandlerExtension as RpcExtension; -pub use subscriptions::{Subscriptions, TaskExecutor}; pub use helpers::Receiver; pub use policy::DenyUnsafe; diff --git a/client/rpc-api/src/subscriptions.rs b/client/rpc-api/src/subscriptions.rs deleted file mode 100644 index 7feae662ee..0000000000 --- a/client/rpc-api/src/subscriptions.rs +++ /dev/null @@ -1,121 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program 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. - -// This program 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 this program. If not, see . - -use std::collections::HashMap; -use std::sync::{Arc, atomic::{self, AtomicUsize}}; - -use log::{error, warn}; -use jsonrpc_pubsub::{SubscriptionId, typed::{Sink, Subscriber}}; -use parking_lot::Mutex; -use jsonrpc_core::futures::sync::oneshot; -use jsonrpc_core::futures::{Future, future}; - -type Id = u64; - -/// Alias for a an implementation of `futures::future::Executor`. -pub type TaskExecutor = Arc + Send>> + Send + Sync>; - -/// Generate unique ids for subscriptions. -#[derive(Clone, Debug)] -pub struct IdProvider { - next_id: Arc, -} -impl Default for IdProvider { - fn default() -> Self { - IdProvider { - next_id: Arc::new(AtomicUsize::new(1)), - } - } -} - -impl IdProvider { - /// Returns next id for the subscription. - pub fn next_id(&self) -> Id { - self.next_id.fetch_add(1, atomic::Ordering::AcqRel) as u64 - } -} - -/// Subscriptions manager. -/// -/// Takes care of assigning unique subscription ids and -/// driving the sinks into completion. -#[derive(Clone)] -pub struct Subscriptions { - next_id: IdProvider, - active_subscriptions: Arc>>>, - executor: TaskExecutor, -} - -impl Subscriptions { - /// Creates new `Subscriptions` object. - pub fn new(executor: TaskExecutor) -> Self { - Subscriptions { - next_id: Default::default(), - active_subscriptions: Default::default(), - executor, - } - } - - /// Borrows the internal task executor. - /// - /// This can be used to spawn additional tasks on the underlying event loop. - pub fn executor(&self) -> &TaskExecutor { - &self.executor - } - - /// Creates new subscription for given subscriber. - /// - /// Second parameter is a function that converts Subscriber sink into a future. - /// This future will be driven to completion by the underlying event loop - /// or will be cancelled in case #cancel is invoked. - pub fn add(&self, subscriber: Subscriber, into_future: G) -> SubscriptionId where - G: FnOnce(Sink) -> R, - R: future::IntoFuture, - F: future::Future + Send + 'static, - { - let id = self.next_id.next_id(); - let subscription_id: SubscriptionId = id.into(); - if let Ok(sink) = subscriber.assign_id(subscription_id.clone()) { - let (tx, rx) = oneshot::channel(); - let future = into_future(sink) - .into_future() - .select(rx.map_err(|e| warn!("Error timeing out: {:?}", e))) - .then(|_| Ok(())); - - self.active_subscriptions.lock().insert(id, tx); - if self.executor.execute(Box::new(future)).is_err() { - error!("Failed to spawn RPC subscription task"); - } - } - - subscription_id - } - - /// Cancel subscription. - /// - /// Returns true if subscription existed or false otherwise. - pub fn cancel(&self, id: SubscriptionId) -> bool { - if let SubscriptionId::Number(id) = id { - if let Some(tx) = self.active_subscriptions.lock().remove(&id) { - let _ = tx.send(()); - return true; - } - } - false - } -} diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 401f5f4882..83ef5d7133 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -12,13 +12,13 @@ description = "Substrate RPC servers." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpc-core = "14.0.3" -pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } +jsonrpc-core = "14.2.0" +pubsub = { package = "jsonrpc-pubsub", version = "14.2.0" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] -http = { package = "jsonrpc-http-server", version = "14.0.3" } -ws = { package = "jsonrpc-ws-server", version = "14.0.3" } +http = { package = "jsonrpc-http-server", version = "14.2.0" } +ws = { package = "jsonrpc-ws-server", version = "14.2.0" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 62f9319575..4d564e8601 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -17,10 +17,10 @@ sc-client-api = { version = "2.0.0-rc2", path = "../api" } sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } -jsonrpc-pubsub = "14.0.3" +jsonrpc-pubsub = "14.2.0" log = "0.4.8" sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -rpc = { package = "jsonrpc-core", version = "14.0.3" } +rpc = { package = "jsonrpc-core", version = "14.2.0" } sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } serde_json = "1.0.41" sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index d59fad354e..974c1b85e1 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -32,8 +32,8 @@ use rpc::futures::{ }; use futures::{StreamExt as _, compat::Compat}; use futures::future::{ready, FutureExt, TryFutureExt}; -use sc_rpc_api::{DenyUnsafe, Subscriptions}; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use sc_rpc_api::DenyUnsafe; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use codec::{Encode, Decode}; use sp_core::{Bytes, traits::BareCryptoStorePtr}; use sp_api::ProvideRuntimeApi; @@ -55,7 +55,7 @@ pub struct Author { /// Transactions pool pool: Arc

, /// Subscriptions manager - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// The key store. keystore: BareCryptoStorePtr, /// Whether to deny unsafe calls @@ -67,7 +67,7 @@ impl Author { pub fn new( client: Arc, pool: Arc

, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, keystore: BareCryptoStorePtr, deny_unsafe: DenyUnsafe, ) -> Self { @@ -81,7 +81,6 @@ impl Author { } } - /// Currently we treat all RPC transactions as externals. /// /// Possibly in the future we could allow opt-in for special treatment diff --git a/client/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs index d70a2ce2af..f2f4ddebb2 100644 --- a/client/rpc/src/author/tests.rs +++ b/client/rpc/src/author/tests.rs @@ -79,7 +79,7 @@ impl TestSetup { Author { client: self.client.clone(), pool: self.pool.clone(), - subscriptions: Subscriptions::new(Arc::new(crate::testing::TaskExecutor)), + subscriptions: SubscriptionManager::new(Arc::new(crate::testing::TaskExecutor)), keystore: self.keystore.clone(), deny_unsafe: DenyUnsafe::No, } @@ -131,8 +131,14 @@ fn should_watch_extrinsic() { uxt(AccountKeyring::Alice, 0).encode().into(), ); - // then - assert_eq!(executor::block_on(id_rx.compat()), Ok(Ok(1.into()))); + let id = executor::block_on(id_rx.compat()).unwrap().unwrap(); + assert_matches!(id, SubscriptionId::String(_)); + + let id = match id { + SubscriptionId::String(id) => id, + _ => unreachable!(), + }; + // check notifications let replacement = { let tx = Transfer { @@ -145,15 +151,22 @@ fn should_watch_extrinsic() { }; AuthorApi::submit_extrinsic(&p, replacement.encode().into()).wait().unwrap(); let (res, data) = executor::block_on(data.into_future().compat()).unwrap(); - assert_eq!( - res, - Some(r#"{"jsonrpc":"2.0","method":"test","params":{"result":"ready","subscription":1}}"#.into()) - ); + + let expected = Some(format!( + r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":"ready","subscription":"{}"}}}}"#, + id, + )); + assert_eq!(res, expected); + let h = blake2_256(&replacement.encode()); - assert_eq!( - executor::block_on(data.into_future().compat()).unwrap().0, - Some(format!(r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":1}}}}"#, HexDisplay::from(&h))) - ); + let expected = Some(format!( + r#"{{"jsonrpc":"2.0","method":"test","params":{{"result":{{"usurped":"0x{}"}},"subscription":"{}"}}}}"#, + HexDisplay::from(&h), + id, + )); + + let res = executor::block_on(data.into_future().compat()).unwrap().0; + assert_eq!(res, expected); } #[test] diff --git a/client/rpc/src/chain/chain_full.rs b/client/rpc/src/chain/chain_full.rs index c1b062754b..816dbba866 100644 --- a/client/rpc/src/chain/chain_full.rs +++ b/client/rpc/src/chain/chain_full.rs @@ -18,8 +18,8 @@ use std::sync::Arc; use rpc::futures::future::result; +use jsonrpc_pubsub::manager::SubscriptionManager; -use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, BlockBackend}; use sp_runtime::{generic::{BlockId, SignedBlock}, traits::{Block as BlockT}}; @@ -32,14 +32,14 @@ pub struct FullChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// phantom member to pin the block type _phantom: PhantomData, } impl FullChain { /// Create new Chain API RPC handler. - pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { Self { client, subscriptions, @@ -56,7 +56,7 @@ impl ChainBackend for FullChain whe &self.client } - fn subscriptions(&self) -> &Subscriptions { + fn subscriptions(&self) -> &SubscriptionManager { &self.subscriptions } diff --git a/client/rpc/src/chain/chain_light.rs b/client/rpc/src/chain/chain_light.rs index 059233089d..8a4afbed71 100644 --- a/client/rpc/src/chain/chain_light.rs +++ b/client/rpc/src/chain/chain_light.rs @@ -19,8 +19,8 @@ use std::sync::Arc; use futures::{future::ready, FutureExt, TryFutureExt}; use rpc::futures::future::{result, Future, Either}; +use jsonrpc_pubsub::manager::SubscriptionManager; -use sc_rpc_api::Subscriptions; use sc_client_api::light::{Fetcher, RemoteBodyRequest, RemoteBlockchain}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -37,7 +37,7 @@ pub struct LightChain { /// Substrate client. client: Arc, /// Current subscriptions. - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, /// Remote blockchain reference remote_blockchain: Arc>, /// Remote fetcher reference. @@ -48,7 +48,7 @@ impl> LightChain { /// Create new Chain API RPC handler. pub fn new( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { @@ -70,7 +70,7 @@ impl ChainBackend for LightChain &Subscriptions { + fn subscriptions(&self) -> &SubscriptionManager { &self.subscriptions } diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 6d53fbbb06..7b13e7a600 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -32,9 +32,8 @@ use rpc::{ futures::{stream, Future, Sink, Stream}, }; -use sc_rpc_api::Subscriptions; use sc_client_api::{BlockchainEvents, light::{Fetcher, RemoteBlockchain}}; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use sp_rpc::{number::NumberOrHex, list::ListOrValue}; use sp_runtime::{ generic::{BlockId, SignedBlock}, @@ -57,7 +56,7 @@ trait ChainBackend: Send + Sync + 'static fn client(&self) -> &Arc; /// Get subscriptions reference. - fn subscriptions(&self) -> &Subscriptions; + fn subscriptions(&self) -> &SubscriptionManager; /// Tries to unwrap passed block hash, or uses best block hash otherwise. fn unwrap_or_best(&self, hash: Option) -> Block::Hash { @@ -177,7 +176,7 @@ trait ChainBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, ) -> Chain where Block: BlockT + 'static, @@ -191,7 +190,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Chain @@ -279,7 +278,7 @@ impl ChainApi, Block::Hash, Block::Header, Signe /// Subscribe to new headers. fn subscribe_headers( client: &Arc, - subscriptions: &Subscriptions, + subscriptions: &SubscriptionManager, subscriber: Subscriber, best_block_hash: G, stream: F, diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index e86d1d547f..68d46135e3 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -31,7 +31,7 @@ use crate::testing::TaskExecutor; #[test] fn should_return_header() { let client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.header(Some(client.genesis_hash()).into()).wait(), @@ -63,7 +63,7 @@ fn should_return_header() { #[test] fn should_return_a_block() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; let block_hash = block.hash(); @@ -114,7 +114,7 @@ fn should_return_a_block() { #[test] fn should_return_block_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.block_hash(None.into()), @@ -158,7 +158,7 @@ fn should_return_block_hash() { #[test] fn should_return_finalized_hash() { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( api.finalized_head(), @@ -188,12 +188,15 @@ fn should_notify_about_latest_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_all_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -215,12 +218,15 @@ fn should_notify_about_best_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_new_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); @@ -242,12 +248,15 @@ fn should_notify_about_finalized_block() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let api = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_finalized_heads(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let block = client.new_block(Default::default()).unwrap().build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index f979b0ab69..53a63b449c 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -24,7 +24,7 @@ mod metadata; -pub use sc_rpc_api::{DenyUnsafe, Subscriptions}; +pub use sc_rpc_api::DenyUnsafe; pub use self::metadata::Metadata; pub use rpc::IoHandlerExtension as RpcExtension; diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index 168dc3e010..921cc7efc6 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -25,10 +25,10 @@ mod state_light; mod tests; use std::sync::Arc; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use rpc::{Result as RpcResult, futures::{Future, future::result}}; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sc_client_api::light::{RemoteBlockchain, Fetcher}; use sp_core::{Bytes, storage::{StorageKey, PrefixedStorageKey, StorageData, StorageChangeSet}}; use sp_version::RuntimeVersion; @@ -170,7 +170,7 @@ pub trait StateBackend: Send + Sync + 'static /// Create new state API that works on full node. pub fn new_full( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, ) -> (State, ChildState) where Block: BlockT + 'static, @@ -191,7 +191,7 @@ pub fn new_full( /// Create new state API that works on light node. pub fn new_light>( client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> (State, ChildState) diff --git a/client/rpc/src/state/state_full.rs b/client/rpc/src/state/state_full.rs index 82f87e9acf..f0ae79a033 100644 --- a/client/rpc/src/state/state_full.rs +++ b/client/rpc/src/state/state_full.rs @@ -21,10 +21,10 @@ use std::sync::Arc; use std::ops::Range; use futures::{future, StreamExt as _, TryStreamExt as _}; use log::warn; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use rpc::{Result as RpcResult, futures::{stream, Future, Sink, Stream, future::result}}; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sc_client_api::backend::Backend; use sp_blockchain::{Result as ClientResult, Error as ClientError, HeaderMetadata, CachedHeaderMetadata, HeaderBackend}; use sc_client_api::BlockchainEvents; @@ -60,7 +60,7 @@ struct QueryStorageRange { /// State API backend for full nodes. pub struct FullState { client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, _phantom: PhantomData<(BE, Block)> } @@ -72,7 +72,7 @@ impl FullState Block: BlockT + 'static, { /// Create new state API backend for full nodes. - pub fn new(client: Arc, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc, subscriptions: SubscriptionManager) -> Self { Self { client, subscriptions, _phantom: PhantomData } } diff --git a/client/rpc/src/state/state_light.rs b/client/rpc/src/state/state_light.rs index af5d4248e3..ec275a2d78 100644 --- a/client/rpc/src/state/state_light.rs +++ b/client/rpc/src/state/state_light.rs @@ -28,7 +28,7 @@ use futures::{ StreamExt as _, TryStreamExt as _, }; use hash_db::Hasher; -use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager}; use log::warn; use parking_lot::Mutex; use rpc::{ @@ -38,7 +38,7 @@ use rpc::{ futures::stream::Stream, }; -use sc_rpc_api::{Subscriptions, state::ReadProof}; +use sc_rpc_api::state::ReadProof; use sp_blockchain::{Error as ClientError, HeaderBackend}; use sc_client_api::{ BlockchainEvents, @@ -63,7 +63,7 @@ type StorageMap = HashMap>; #[derive(Clone)] pub struct LightState, Client> { client: Arc, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, version_subscriptions: SimpleSubscriptions, storage_subscriptions: Arc>>, remote_blockchain: Arc>, @@ -143,7 +143,7 @@ impl + 'static, Client> LightState, - subscriptions: Subscriptions, + subscriptions: SubscriptionManager, remote_blockchain: Arc>, fetcher: Arc, ) -> Self { diff --git a/client/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs index a610cbbfc8..0cc16ce8d5 100644 --- a/client/rpc/src/state/tests.rs +++ b/client/rpc/src/state/tests.rs @@ -55,7 +55,7 @@ fn should_return_storage() { .add_extra_child_storage(&child_info, KEY.to_vec(), CHILD_VALUE.to_vec()) .build(); let genesis_hash = client.genesis_hash(); - let (client, child) = new_full(Arc::new(client), Subscriptions::new(Arc::new(TaskExecutor))); + let (client, child) = new_full(Arc::new(client), SubscriptionManager::new(Arc::new(TaskExecutor))); let key = StorageKey(KEY.to_vec()); assert_eq!( @@ -90,7 +90,7 @@ fn should_return_child_storage() { .add_child_storage(&child_info, "key", vec![42_u8]) .build()); let genesis_hash = client.genesis_hash(); - let (_client, child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); + let (_client, child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); let child_key = prefixed_storage_key(); let key = StorageKey(b"key".to_vec()); @@ -125,7 +125,7 @@ fn should_return_child_storage() { fn should_call_contract() { let client = Arc::new(substrate_test_runtime_client::new()); let genesis_hash = client.genesis_hash(); - let (client, _child) = new_full(client, Subscriptions::new(Arc::new(TaskExecutor))); + let (client, _child) = new_full(client, SubscriptionManager::new(Arc::new(TaskExecutor))); assert_matches!( client.call("balanceOf".into(), Bytes(vec![1,2,3]), Some(genesis_hash).into()).wait(), @@ -139,12 +139,15 @@ fn should_notify_about_storage_changes() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_storage(Default::default(), subscriber, None.into()); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -170,7 +173,7 @@ fn should_send_initial_storage_changes_and_notifications() { { let mut client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into())); @@ -179,7 +182,10 @@ fn should_send_initial_storage_changes_and_notifications() { ]).into()); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); let mut builder = client.new_block(Default::default()).unwrap(); builder.push_transfer(runtime::Transfer { @@ -205,7 +211,7 @@ fn should_send_initial_storage_changes_and_notifications() { #[test] fn should_query_storage() { fn run_tests(mut client: Arc, has_changes_trie_config: bool) { - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let mut add_block = |nonce| { let mut builder = client.new_block(Default::default()).unwrap(); @@ -422,7 +428,7 @@ fn should_split_ranges() { #[test] fn should_return_runtime_version() { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\ \"specVersion\":2,\"implVersion\":2,\"apis\":[[\"0xdf6acb689907609b\",3],\ @@ -445,12 +451,16 @@ fn should_notify_on_runtime_version_initially() { { let client = Arc::new(substrate_test_runtime_client::new()); - let (api, _child) = new_full(client.clone(), Subscriptions::new(Arc::new(TaskExecutor))); + let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor))); api.subscribe_runtime_version(Default::default(), subscriber); // assert id assigned - assert_eq!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::Number(1)))); + assert!(matches!( + executor::block_on(id.compat()), + Ok(Ok(SubscriptionId::String(_))) + )); + } // assert initial version sent. diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index acc75d6890..f40999bf1c 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -26,6 +26,7 @@ test-helpers = [] derive_more = "0.99.2" futures01 = { package = "futures", version = "0.1.29" } futures = { version = "0.3.4", features = ["compat"] } +jsonrpc-pubsub = "14.2.0" rand = "0.7.3" parking_lot = "0.10.0" lazy_static = "1.4.0" diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index e9fa1ff3e2..16500baae1 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -37,6 +37,7 @@ use futures::{ Future, FutureExt, StreamExt, future::ready, }; +use jsonrpc_pubsub::manager::SubscriptionManager; use sc_keystore::Store as Keystore; use log::{info, warn, error}; use sc_network::config::{Role, FinalityProofProvider, OnDemand, BoxFinalityProofRequestBuilder}; @@ -1204,7 +1205,7 @@ ServiceBuilder< chain_type: chain_spec.chain_type().clone(), }; - let subscriptions = sc_rpc::Subscriptions::new(Arc::new(task_manager.spawn_handle())); + let subscriptions = SubscriptionManager::new(Arc::new(task_manager.spawn_handle())); let (chain, state, child_state) = if let (Some(remote_backend), Some(on_demand)) = (remote_backend.as_ref(), on_demand.as_ref()) { diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index 8ed233ed79..db6a1a6b3e 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index 3ca2f4be8e..dffb8f0cca 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 006372eb36..e8322aaf1d 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = { version = "0.3.0", features = ["compat"] } -jsonrpc-client-transports = { version = "14.0.5", default-features = false, features = ["http"] } -jsonrpc-core = "14" +jsonrpc-client-transports = { version = "14.2.0", default-features = false, features = ["http"] } +jsonrpc-core = "14.2.0" codec = { package = "parity-scale-codec", version = "1" } serde = "1" frame-support = { version = "2.0.0-rc2", path = "../../../../frame/support" } diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index f757e811fb..5a350d911a 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] sc-client-api = { version = "2.0.0-rc2", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } -jsonrpc-core = "14.0.3" -jsonrpc-core-client = "14.0.5" -jsonrpc-derive = "14.0.3" +jsonrpc-core = "14.2.0" +jsonrpc-core-client = "14.2.0" +jsonrpc-derive = "14.2.1" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } -- GitLab From 669702eea6556defb6cecb1e69fec0e0a27cf9cd Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Mon, 8 Jun 2020 19:11:27 +0200 Subject: [PATCH 122/280] Temporary and Heavy Weights for Society Pallet (#6283) * temporary weights for society * on_initialize weight --- frame/society/src/lib.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/frame/society/src/lib.rs b/frame/society/src/lib.rs index 122ed06b29..684fe50437 100644 --- a/frame/society/src/lib.rs +++ b/frame/society/src/lib.rs @@ -532,7 +532,7 @@ decl_module! { /// /// Total Complexity: O(M + B + C + logM + logB + X) /// # - #[weight = 50_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn bid(origin, value: BalanceOf) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(!>::contains_key(&who), Error::::Suspended); @@ -571,7 +571,7 @@ decl_module! { /// /// Total Complexity: O(B + X) /// # - #[weight = 20_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn unbid(origin, pos: u32) -> DispatchResult { let who = ensure_signed(origin)?; @@ -641,7 +641,7 @@ decl_module! { /// /// Total Complexity: O(M + B + C + logM + logB + X) /// # - #[weight = 50_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn vouch(origin, who: T::AccountId, value: BalanceOf, tip: BalanceOf) -> DispatchResult { let voucher = ensure_signed(origin)?; // Check user is not suspended. @@ -682,7 +682,7 @@ decl_module! { /// /// Total Complexity: O(B) /// # - #[weight = 20_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn unvouch(origin, pos: u32) -> DispatchResult { let voucher = ensure_signed(origin)?; ensure!(Self::vouching(&voucher) == Some(VouchingStatus::Vouching), Error::::NotVouching); @@ -720,7 +720,7 @@ decl_module! { /// /// Total Complexity: O(M + logM + C) /// # - #[weight = 30_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn vote(origin, candidate: ::Source, approve: bool) { let voter = ensure_signed(origin)?; let candidate = T::Lookup::lookup(candidate)?; @@ -751,7 +751,7 @@ decl_module! { /// /// Total Complexity: O(M + logM) /// # - #[weight = 20_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn defender_vote(origin, approve: bool) { let voter = ensure_signed(origin)?; let members = >::get(); @@ -783,7 +783,7 @@ decl_module! { /// /// Total Complexity: O(M + logM + P + X) /// # - #[weight = 30_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] pub fn payout(origin) { let who = ensure_signed(origin)?; @@ -825,7 +825,7 @@ decl_module! { /// /// Total Complexity: O(1) /// # - #[weight = 0] + #[weight = T::MaximumBlockWeight::get() / 10] fn found(origin, founder: T::AccountId, max_members: u32, rules: Vec) { T::FounderSetOrigin::ensure_origin(origin)?; ensure!(!>::exists(), Error::::AlreadyFounded); @@ -852,7 +852,7 @@ decl_module! { /// /// Total Complexity: O(1) /// # - #[weight = 20_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] fn unfound(origin) { let founder = ensure_signed(origin)?; ensure!(Founder::::get() == Some(founder.clone()), Error::::NotFounder); @@ -894,7 +894,7 @@ decl_module! { /// /// Total Complexity: O(M + logM + B) /// # - #[weight = 30_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] fn judge_suspended_member(origin, who: T::AccountId, forgive: bool) { T::SuspensionJudgementOrigin::ensure_origin(origin)?; ensure!(>::contains_key(&who), Error::::NotSuspended); @@ -965,7 +965,7 @@ decl_module! { /// /// Total Complexity: O(M + logM + B + X) /// # - #[weight = 50_000_000] + #[weight = T::MaximumBlockWeight::get() / 10] fn judge_suspended_candidate(origin, who: T::AccountId, judgement: Judgement) { T::SuspensionJudgementOrigin::ensure_origin(origin)?; if let Some((value, kind)) = >::get(&who) { @@ -1025,7 +1025,7 @@ decl_module! { /// /// Total Complexity: O(1) /// # - #[weight = 0] + #[weight = T::MaximumBlockWeight::get() / 10] fn set_max_members(origin, max: u32) { ensure_root(origin)?; ensure!(max > 1, Error::::MaxMembers); @@ -1036,10 +1036,14 @@ decl_module! { fn on_initialize(n: T::BlockNumber) -> Weight { let mut members = vec![]; + let mut weight = 0; + // Run a candidate/membership rotation if (n % T::RotationPeriod::get()).is_zero() { members = >::get(); Self::rotate_period(&mut members); + + weight += T::MaximumBlockWeight::get() / 20; } // Run a challenge rotation @@ -1049,9 +1053,11 @@ decl_module! { members = >::get(); } Self::rotate_challenge(&mut members); + + weight += T::MaximumBlockWeight::get() / 20; } - 0 + weight } } } -- GitLab From f0eef06cd65f72854188fea5e56397b6e7dc3200 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Mon, 8 Jun 2020 19:11:52 +0200 Subject: [PATCH 123/280] Weights for Indices Pallet (#6282) * fix multisig benchmarking * add indices benchmarks * fix compile * Weights for indices --- Cargo.lock | 1 + bin/node/runtime/Cargo.toml | 1 + bin/node/runtime/src/lib.rs | 1 + frame/indices/Cargo.toml | 6 ++ frame/indices/src/benchmarking.rs | 109 +++++++++++++++++++++++++++++ frame/indices/src/lib.rs | 26 +++++-- frame/multisig/src/benchmarking.rs | 20 +++--- frame/multisig/src/tests.rs | 4 +- frame/utility/src/benchmarking.rs | 2 - 9 files changed, 153 insertions(+), 17 deletions(-) create mode 100644 frame/indices/src/benchmarking.rs diff --git a/Cargo.lock b/Cargo.lock index bee8278b46..8f9d7f531c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4201,6 +4201,7 @@ dependencies = [ name = "pallet-indices" version = "2.0.0-rc2" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "pallet-balances", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 4f304e6ace..be01b267fb 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -153,6 +153,7 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index a1cff7df91..5a56ca4a7b 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1081,6 +1081,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, b"elections", Elections); add_benchmark!(params, batches, b"identity", Identity); add_benchmark!(params, batches, b"im-online", ImOnline); + add_benchmark!(params, batches, b"indices", Indices); add_benchmark!(params, batches, b"multisig", Multisig); add_benchmark!(params, batches, b"offences", OffencesBench::); add_benchmark!(params, batches, b"proxy", Proxy); diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index d4217ca49c..3d01d0f15b 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -22,6 +22,8 @@ sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primi frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } + [dev-dependencies] pallet-balances = { version = "2.0.0-rc2", path = "../balances" } @@ -38,3 +40,7 @@ std = [ "sp-runtime/std", "frame-system/std", ] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-support/runtime-benchmarks", +] diff --git a/frame/indices/src/benchmarking.rs b/frame/indices/src/benchmarking.rs new file mode 100644 index 0000000000..843e4e2faa --- /dev/null +++ b/frame/indices/src/benchmarking.rs @@ -0,0 +1,109 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Benchmarks for Indices Pallet + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_system::RawOrigin; +use frame_benchmarking::{benchmarks, account}; +use sp_runtime::traits::Bounded; + +use crate::Module as Indices; + +const SEED: u32 = 0; + +benchmarks! { + _ { } + + claim { + // Index being claimed + let i in 0 .. 1000; + let account_index = T::AccountIndex::from(i); + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + }: _(RawOrigin::Signed(caller.clone()), account_index) + verify { + assert_eq!(Accounts::::get(account_index).unwrap().0, caller); + } + + transfer { + // Index being claimed + let i in 0 .. 1000; + let account_index = T::AccountIndex::from(i); + // Setup accounts + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + let recipient: T::AccountId = account("recipient", i, SEED); + T::Currency::make_free_balance_be(&recipient, BalanceOf::::max_value()); + // Claim the index + Indices::::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?; + }: _(RawOrigin::Signed(caller.clone()), recipient.clone(), account_index) + verify { + assert_eq!(Accounts::::get(account_index).unwrap().0, recipient); + } + + free { + // Index being claimed + let i in 0 .. 1000; + let account_index = T::AccountIndex::from(i); + // Setup accounts + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + // Claim the index + Indices::::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?; + }: _(RawOrigin::Signed(caller.clone()), account_index) + verify { + assert_eq!(Accounts::::get(account_index), None); + } + + force_transfer { + // Index being claimed + let i in 0 .. 1000; + let account_index = T::AccountIndex::from(i); + // Setup accounts + let original: T::AccountId = account("original", 0, SEED); + T::Currency::make_free_balance_be(&original, BalanceOf::::max_value()); + let recipient: T::AccountId = account("recipient", i, SEED); + T::Currency::make_free_balance_be(&recipient, BalanceOf::::max_value()); + // Claim the index + Indices::::claim(RawOrigin::Signed(original).into(), account_index)?; + }: _(RawOrigin::Root, recipient.clone(), account_index) + verify { + assert_eq!(Accounts::::get(account_index).unwrap().0, recipient); + } + + // TODO in another PR: lookup and unlookup trait weights (not critical) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::{new_test_ext, Test}; + use frame_support::assert_ok; + + #[test] + fn test_benchmarks() { + new_test_ext().execute_with(|| { + assert_ok!(test_benchmark_claim::()); + assert_ok!(test_benchmark_transfer::()); + assert_ok!(test_benchmark_free::()); + assert_ok!(test_benchmark_force_transfer::()); + }); + } +} diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 77a73a21ac..ef4e0082f4 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -28,12 +28,14 @@ use sp_runtime::traits::{ use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure}; use frame_support::dispatch::DispatchResult; use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved}; +use frame_support::weights::constants::WEIGHT_PER_MICROS; use frame_system::{ensure_signed, ensure_root}; use self::address::Address as RawAddress; mod mock; pub mod address; mod tests; +mod benchmarking; pub type Address = RawAddress<::AccountId, ::AccountIndex>; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -113,8 +115,11 @@ decl_module! { /// - One storage mutation (codec `O(1)`). /// - One reserve operation. /// - One event. + /// ------------------- + /// - Base Weight: 28.69 µs + /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight = 0] + #[weight = T::DbWeight::get().reads_writes(1, 1) + 30 * WEIGHT_PER_MICROS] fn claim(origin, index: T::AccountIndex) { let who = ensure_signed(origin)?; @@ -141,8 +146,13 @@ decl_module! { /// - One storage mutation (codec `O(1)`). /// - One transfer operation. /// - One event. + /// ------------------- + /// - Base Weight: 33.74 µs + /// - DB Weight: + /// - Reads: Indices Accounts, System Account (recipient) + /// - Writes: Indices Accounts, System Account (recipient) /// # - #[weight = 0] + #[weight = T::DbWeight::get().reads_writes(2, 2) + 35 * WEIGHT_PER_MICROS] fn transfer(origin, new: T::AccountId, index: T::AccountIndex) { let who = ensure_signed(origin)?; ensure!(who != new, Error::::NotTransfer); @@ -172,8 +182,11 @@ decl_module! { /// - One storage mutation (codec `O(1)`). /// - One reserve operation. /// - One event. + /// ------------------- + /// - Base Weight: 25.53 µs + /// - DB Weight: 1 Read/Write (Accounts) /// # - #[weight = 0] + #[weight = T::DbWeight::get().reads_writes(1, 1) + 25 * WEIGHT_PER_MICROS] fn free(origin, index: T::AccountIndex) { let who = ensure_signed(origin)?; @@ -201,8 +214,13 @@ decl_module! { /// - One storage mutation (codec `O(1)`). /// - Up to one reserve operation. /// - One event. + /// ------------------- + /// - Base Weight: 26.83 µs + /// - DB Weight: + /// - Reads: Indices Accounts, System Account (original owner) + /// - Writes: Indices Accounts, System Account (original owner) /// # - #[weight = 0] + #[weight = T::DbWeight::get().reads_writes(2, 2) + 25 * WEIGHT_PER_MICROS] fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex) { ensure_root(origin)?; diff --git a/frame/multisig/src/benchmarking.rs b/frame/multisig/src/benchmarking.rs index 0c603be916..fa2ec52e6b 100644 --- a/frame/multisig/src/benchmarking.rs +++ b/frame/multisig/src/benchmarking.rs @@ -24,7 +24,7 @@ use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account}; use sp_runtime::traits::Saturating; -use crate::Module as Utility; +use crate::Module as Multisig; const SEED: u32 = 0; @@ -66,9 +66,9 @@ benchmarks! { let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; // before the call, get the timepoint - let timepoint = Utility::::timepoint(); + let timepoint = Multisig::::timepoint(); // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; let caller2 = signatories2.remove(0); }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) @@ -81,15 +81,15 @@ benchmarks! { let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; // before the call, get the timepoint - let timepoint = Utility::::timepoint(); + let timepoint = Multisig::::timepoint(); // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; // Everyone except the first person approves for i in 1 .. s - 1 { let mut signatories_loop = signatories2.clone(); let caller_loop = signatories_loop.remove(i as usize); let o = RawOrigin::Signed(caller_loop).into(); - Utility::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone())?; + Multisig::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone())?; } let caller2 = signatories2.remove(0); }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) @@ -115,9 +115,9 @@ benchmarks! { let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; let call_hash = call.using_encoded(blake2_256); // before the call, get the timepoint - let timepoint = Utility::::timepoint(); + let timepoint = Multisig::::timepoint(); // Create the multi - Utility::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; let caller2 = signatories2.remove(0); }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash) @@ -129,10 +129,10 @@ benchmarks! { let (mut signatories, call) = setup_multi::(s, z)?; let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; let call_hash = call.using_encoded(blake2_256); - let timepoint = Utility::::timepoint(); + let timepoint = Multisig::::timepoint(); // Create the multi let o = RawOrigin::Signed(caller.clone()).into(); - Utility::::as_multi(o, s as u16, signatories.clone(), None, call.clone())?; + Multisig::::as_multi(o, s as u16, signatories.clone(), None, call.clone())?; }: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) } diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index 77855c6482..067ef4cf98 100644 --- a/frame/multisig/src/tests.rs +++ b/frame/multisig/src/tests.rs @@ -104,6 +104,8 @@ impl Filter for TestIsCallable { fn filter(c: &Call) -> bool { match *c { Call::Balances(_) => true, + // Needed for benchmarking + Call::System(frame_system::Call::remark(_)) => true, _ => false, } } @@ -399,7 +401,7 @@ fn multisig_1_of_3_works() { #[test] fn multisig_filters() { new_test_ext().execute_with(|| { - let call = Box::new(Call::System(frame_system::Call::remark(vec![]))); + let call = Box::new(Call::System(frame_system::Call::set_code(vec![]))); assert_noop!( Multisig::as_multi(Origin::signed(1), 1, vec![], None, call.clone()), Error::::Uncallable, diff --git a/frame/utility/src/benchmarking.rs b/frame/utility/src/benchmarking.rs index 474009d11d..27696404bf 100644 --- a/frame/utility/src/benchmarking.rs +++ b/frame/utility/src/benchmarking.rs @@ -22,8 +22,6 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account}; -use sp_runtime::traits::Saturating; -use crate::Module as Utility; const SEED: u32 = 0; -- GitLab From f2c8b88d218046c1fdad8f7e1e46bc6070ea186d Mon Sep 17 00:00:00 2001 From: Subsocial <62490051+subsocialdev@users.noreply.github.com> Date: Mon, 8 Jun 2020 22:32:42 +0300 Subject: [PATCH 124/280] Fix typo: eror -> error (#6293) --- client/db/src/parity_db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/db/src/parity_db.rs b/client/db/src/parity_db.rs index ea25aaa9f8..ad1c6c7656 100644 --- a/client/db/src/parity_db.rs +++ b/client/db/src/parity_db.rs @@ -27,7 +27,7 @@ fn handle_err(result: parity_db::Result) -> T { match result { Ok(r) => r, Err(e) => { - panic!("Critical database eror: {:?}", e); + panic!("Critical database error: {:?}", e); } } } -- GitLab From cc5b3a63fe5adb5100436ff43d5260a2ea18d893 Mon Sep 17 00:00:00 2001 From: Subsocial <62490051+subsocialdev@users.noreply.github.com> Date: Mon, 8 Jun 2020 22:35:03 +0300 Subject: [PATCH 125/280] Fix typo: PRORITY -> PRIORITY (#6291) --- frame/support/src/traits.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 519164027b..df47def870 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -1465,12 +1465,12 @@ pub mod schedule { /// The highest priority. We invert the value so that normal sorting will place the highest /// priority at the beginning of the list. - pub const HIGHEST_PRORITY: Priority = 0; + pub const HIGHEST_PRIORITY: Priority = 0; /// Anything of this value or lower will definitely be scheduled on the block that they ask for, even /// if it breaches the `MaximumWeight` limitation. pub const HARD_DEADLINE: Priority = 63; /// The lowest priority. Most stuff should be around here. - pub const LOWEST_PRORITY: Priority = 255; + pub const LOWEST_PRIORITY: Priority = 255; /// A type that can be used as a scheduler. pub trait Anon { -- GitLab From e287915eb37928491adbf4666e764ea0be5ac21a Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 8 Jun 2020 23:29:52 +0200 Subject: [PATCH 126/280] Intent to release rc3 (#6290) --- Cargo.lock | 360 +++++++++--------- bin/node-template/node/Cargo.toml | 40 +- bin/node-template/pallets/template/Cargo.toml | 12 +- bin/node-template/runtime/Cargo.toml | 48 +-- bin/node/bench/Cargo.toml | 20 +- bin/node/browser-testing/Cargo.toml | 6 +- bin/node/cli/Cargo.toml | 118 +++--- bin/node/executor/Cargo.toml | 50 +-- bin/node/inspect/Cargo.toml | 14 +- bin/node/primitives/Cargo.toml | 12 +- bin/node/rpc-client/Cargo.toml | 6 +- bin/node/rpc/Cargo.toml | 40 +- bin/node/runtime/Cargo.toml | 116 +++--- bin/node/testing/Cargo.toml | 68 ++-- bin/utils/chain-spec-builder/Cargo.toml | 10 +- bin/utils/subkey/Cargo.toml | 20 +- client/api/Cargo.toml | 44 +-- client/authority-discovery/Cargo.toml | 24 +- client/basic-authorship/Cargo.toml | 30 +- client/block-builder/Cargo.toml | 20 +- client/chain-spec/Cargo.toml | 14 +- client/chain-spec/derive/Cargo.toml | 2 +- client/cli/Cargo.toml | 32 +- client/cli/src/runner.rs | 2 +- client/consensus/aura/Cargo.toml | 50 +-- client/consensus/babe/Cargo.toml | 58 +-- client/consensus/babe/rpc/Cargo.toml | 30 +- client/consensus/common/Cargo.toml | 10 +- client/consensus/epochs/Cargo.toml | 10 +- client/consensus/manual-seal/Cargo.toml | 26 +- client/consensus/pow/Cargo.toml | 24 +- client/consensus/slots/Cargo.toml | 24 +- client/consensus/uncles/Cargo.toml | 14 +- client/db/Cargo.toml | 28 +- client/executor/Cargo.toml | 36 +- client/executor/common/Cargo.toml | 12 +- client/executor/runtime-test/Cargo.toml | 14 +- client/executor/wasmi/Cargo.toml | 12 +- client/executor/wasmtime/Cargo.toml | 12 +- client/finality-grandpa/Cargo.toml | 54 +-- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/informant/Cargo.toml | 12 +- client/keystore/Cargo.toml | 6 +- client/network-gossip/Cargo.toml | 8 +- client/network/Cargo.toml | 32 +- client/network/test/Cargo.toml | 26 +- client/offchain/Cargo.toml | 26 +- client/peerset/Cargo.toml | 4 +- client/proposer-metrics/Cargo.toml | 4 +- client/rpc-api/Cargo.toml | 14 +- client/rpc-servers/Cargo.toml | 4 +- client/rpc/Cargo.toml | 44 +-- client/service/Cargo.toml | 68 ++-- client/service/test/Cargo.toml | 40 +- client/state-db/Cargo.toml | 6 +- client/telemetry/Cargo.toml | 2 +- client/tracing/Cargo.toml | 4 +- client/transaction-pool/Cargo.toml | 32 +- client/transaction-pool/graph/Cargo.toml | 14 +- docs/CHANGELOG.md | 23 +- frame/assets/Cargo.toml | 14 +- frame/aura/Cargo.toml | 26 +- frame/authority-discovery/Cargo.toml | 22 +- frame/authorship/Cargo.toml | 18 +- frame/babe/Cargo.toml | 30 +- frame/balances/Cargo.toml | 18 +- frame/benchmark/Cargo.toml | 14 +- frame/benchmarking/Cargo.toml | 16 +- frame/collective/Cargo.toml | 18 +- frame/contracts/Cargo.toml | 26 +- frame/contracts/common/Cargo.toml | 6 +- frame/contracts/rpc/Cargo.toml | 16 +- frame/contracts/rpc/runtime-api/Cargo.toml | 10 +- frame/democracy/Cargo.toml | 24 +- frame/elections-phragmen/Cargo.toml | 22 +- frame/elections/Cargo.toml | 16 +- frame/evm/Cargo.toml | 18 +- frame/example-offchain-worker/Cargo.toml | 14 +- frame/example/Cargo.toml | 18 +- frame/executive/Cargo.toml | 26 +- frame/finality-tracker/Cargo.toml | 18 +- frame/generic-asset/Cargo.toml | 14 +- frame/grandpa/Cargo.toml | 38 +- frame/identity/Cargo.toml | 18 +- frame/im-online/Cargo.toml | 24 +- frame/indices/Cargo.toml | 20 +- frame/membership/Cargo.toml | 14 +- frame/metadata/Cargo.toml | 6 +- frame/multisig/Cargo.toml | 20 +- frame/nicks/Cargo.toml | 16 +- frame/offences/Cargo.toml | 18 +- frame/offences/benchmarking/Cargo.toml | 36 +- frame/proxy/Cargo.toml | 22 +- frame/randomness-collective-flip/Cargo.toml | 14 +- frame/recovery/Cargo.toml | 16 +- frame/scheduler/Cargo.toml | 16 +- frame/scored-pool/Cargo.toml | 16 +- frame/session/Cargo.toml | 24 +- frame/session/benchmarking/Cargo.toml | 26 +- frame/society/Cargo.toml | 16 +- frame/staking/Cargo.toml | 38 +- frame/staking/fuzzer/Cargo.lock | 2 +- frame/staking/fuzzer/Cargo.toml | 26 +- frame/staking/reward-curve/Cargo.toml | 4 +- frame/sudo/Cargo.toml | 14 +- frame/support/Cargo.toml | 24 +- frame/support/procedural/Cargo.toml | 4 +- frame/support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 14 +- frame/system/Cargo.toml | 18 +- frame/system/benchmarking/Cargo.toml | 16 +- frame/system/rpc/runtime-api/Cargo.toml | 4 +- frame/timestamp/Cargo.toml | 22 +- frame/transaction-payment/Cargo.toml | 20 +- frame/transaction-payment/rpc/Cargo.toml | 14 +- .../rpc/runtime-api/Cargo.toml | 10 +- frame/treasury/Cargo.toml | 18 +- frame/utility/Cargo.toml | 20 +- frame/vesting/Cargo.toml | 20 +- primitives/allocator/Cargo.toml | 8 +- primitives/api/Cargo.toml | 16 +- primitives/api/proc-macro/Cargo.toml | 2 +- primitives/api/test/Cargo.toml | 22 +- primitives/application-crypto/Cargo.toml | 8 +- primitives/application-crypto/test/Cargo.toml | 12 +- primitives/arithmetic/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- primitives/authority-discovery/Cargo.toml | 10 +- primitives/authorship/Cargo.toml | 8 +- primitives/block-builder/Cargo.toml | 10 +- primitives/blockchain/Cargo.toml | 10 +- primitives/chain-spec/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 14 +- primitives/consensus/babe/Cargo.toml | 18 +- primitives/consensus/common/Cargo.toml | 20 +- primitives/consensus/pow/Cargo.toml | 10 +- primitives/consensus/vrf/Cargo.toml | 8 +- primitives/core/Cargo.toml | 14 +- primitives/database/Cargo.toml | 2 +- primitives/debug-derive/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 6 +- primitives/finality-grandpa/Cargo.toml | 12 +- primitives/finality-tracker/Cargo.toml | 6 +- primitives/inherents/Cargo.toml | 6 +- primitives/io/Cargo.toml | 16 +- primitives/keyring/Cargo.toml | 6 +- primitives/npos-elections/Cargo.toml | 14 +- primitives/npos-elections/compact/Cargo.toml | 2 +- primitives/npos-elections/fuzzer/Cargo.lock | 2 +- primitives/npos-elections/fuzzer/Cargo.toml | 6 +- primitives/offchain/Cargo.toml | 10 +- primitives/panic-handler/Cargo.toml | 2 +- primitives/rpc/Cargo.toml | 4 +- primitives/runtime-interface/Cargo.toml | 20 +- .../runtime-interface/proc-macro/Cargo.toml | 2 +- .../test-wasm-deprecated/Cargo.toml | 10 +- .../runtime-interface/test-wasm/Cargo.toml | 10 +- primitives/runtime-interface/test/Cargo.toml | 18 +- primitives/runtime/Cargo.toml | 16 +- primitives/sandbox/Cargo.toml | 10 +- primitives/serializer/Cargo.toml | 2 +- primitives/session/Cargo.toml | 12 +- primitives/staking/Cargo.toml | 6 +- primitives/state-machine/Cargo.toml | 12 +- primitives/std/Cargo.toml | 2 +- primitives/storage/Cargo.toml | 6 +- primitives/test-primitives/Cargo.toml | 8 +- primitives/timestamp/Cargo.toml | 10 +- primitives/tracing/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 10 +- primitives/trie/Cargo.toml | 8 +- primitives/utils/Cargo.toml | 2 +- primitives/version/Cargo.toml | 6 +- primitives/wasm-interface/Cargo.toml | 4 +- test-utils/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 24 +- test-utils/runtime/Cargo.toml | 60 +-- test-utils/runtime/client/Cargo.toml | 24 +- .../runtime/transaction-pool/Cargo.toml | 12 +- utils/browser/Cargo.toml | 12 +- utils/build-script-utils/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 20 +- utils/frame/rpc/support/Cargo.toml | 10 +- utils/frame/rpc/system/Cargo.toml | 20 +- utils/prometheus/Cargo.toml | 2 +- 187 files changed, 1820 insertions(+), 1799 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f9d7f531c..2e0f788707 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,7 +568,7 @@ dependencies = [ [[package]] name = "chain-spec-builder" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "ansi_term 0.12.1", "node-cli", @@ -1377,14 +1377,14 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -1400,7 +1400,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -1437,7 +1437,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-rc2" +version = "11.0.0-rc3" dependencies = [ "parity-scale-codec", "serde", @@ -1447,7 +1447,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "bitmask", "frame-metadata", @@ -1473,7 +1473,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1483,7 +1483,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -1503,7 +1503,7 @@ dependencies = [ [[package]] name = "frame-support-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "parity-scale-codec", @@ -1520,7 +1520,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.2.11", "frame-support", @@ -1538,7 +1538,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -1553,7 +1553,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -3240,7 +3240,7 @@ dependencies = [ [[package]] name = "node-bench" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "fs_extra", @@ -3270,7 +3270,7 @@ dependencies = [ [[package]] name = "node-browser-testing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -3287,7 +3287,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "assert_cmd", "frame-benchmarking-cli", @@ -3361,7 +3361,7 @@ dependencies = [ [[package]] name = "node-executor" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.3.1", "frame-benchmarking", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "node-inspect" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "log", @@ -3411,7 +3411,7 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-system", "parity-scale-codec", @@ -3424,7 +3424,7 @@ dependencies = [ [[package]] name = "node-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "jsonrpc-core", "node-primitives", @@ -3450,7 +3450,7 @@ dependencies = [ [[package]] name = "node-rpc-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "env_logger 0.7.1", "futures 0.1.29", @@ -3463,7 +3463,7 @@ dependencies = [ [[package]] name = "node-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-executive", @@ -3531,7 +3531,7 @@ dependencies = [ [[package]] name = "node-template" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "log", @@ -3560,7 +3560,7 @@ dependencies = [ [[package]] name = "node-template-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-executive", "frame-support", @@ -3592,7 +3592,7 @@ dependencies = [ [[package]] name = "node-testing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.3.1", "frame-support", @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -3809,7 +3809,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -3831,7 +3831,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "pallet-babe" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -3887,7 +3887,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -3903,7 +3903,7 @@ dependencies = [ [[package]] name = "pallet-benchmark" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -3917,7 +3917,7 @@ dependencies = [ [[package]] name = "pallet-collective" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -3934,7 +3934,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "assert_matches", "frame-support", @@ -3960,7 +3960,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -3969,7 +3969,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3988,7 +3988,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -3999,7 +3999,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4019,7 +4019,7 @@ dependencies = [ [[package]] name = "pallet-elections" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4035,7 +4035,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4054,7 +4054,7 @@ dependencies = [ [[package]] name = "pallet-evm" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "evm", "frame-support", @@ -4074,7 +4074,7 @@ dependencies = [ [[package]] name = "pallet-example" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4090,7 +4090,7 @@ dependencies = [ [[package]] name = "pallet-example-offchain-worker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4105,7 +4105,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4122,7 +4122,7 @@ dependencies = [ [[package]] name = "pallet-generic-asset" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4136,7 +4136,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "finality-grandpa", "frame-support", @@ -4163,7 +4163,7 @@ dependencies = [ [[package]] name = "pallet-identity" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4180,7 +4180,7 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4199,7 +4199,7 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4216,7 +4216,7 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4230,7 +4230,7 @@ dependencies = [ [[package]] name = "pallet-multisig" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4246,7 +4246,7 @@ dependencies = [ [[package]] name = "pallet-nicks" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4277,7 +4277,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4302,7 +4302,7 @@ dependencies = [ [[package]] name = "pallet-proxy" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4319,7 +4319,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4333,7 +4333,7 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "enumflags2", "frame-support", @@ -4349,7 +4349,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4364,7 +4364,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4379,7 +4379,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4400,7 +4400,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4420,7 +4420,7 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "pallet-staking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4487,7 +4487,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4498,7 +4498,7 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4512,7 +4512,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4524,7 +4524,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4542,7 +4542,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -4559,7 +4559,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4576,7 +4576,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "parity-scale-codec", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4605,7 +4605,7 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-benchmarking", "frame-support", @@ -4621,7 +4621,7 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5725,7 +5725,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "bytes 0.5.4", "derive_more", @@ -5755,7 +5755,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -5781,7 +5781,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5798,7 +5798,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5813,7 +5813,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5823,7 +5823,7 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5864,7 +5864,7 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "fnv", @@ -5902,7 +5902,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "blake2-rfc", "env_logger 0.7.1", @@ -5935,7 +5935,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "sc-client-api", "sp-blockchain", @@ -5945,7 +5945,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -5983,7 +5983,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6033,7 +6033,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -6061,7 +6061,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6073,7 +6073,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "derive_more", @@ -6103,7 +6103,7 @@ dependencies = [ [[package]] name = "sc-consensus-pow" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -6124,7 +6124,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -6146,7 +6146,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "log", "sc-client-api", @@ -6159,7 +6159,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "derive_more", @@ -6194,7 +6194,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "log", @@ -6210,7 +6210,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "log", "parity-scale-codec", @@ -6224,7 +6224,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "cranelift-codegen", @@ -6245,7 +6245,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "derive_more", @@ -6289,7 +6289,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "finality-grandpa", @@ -6306,7 +6306,7 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "ansi_term 0.12.1", "futures 0.3.4", @@ -6322,7 +6322,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "hex", @@ -6337,7 +6337,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "async-std", @@ -6397,7 +6397,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "async-std", "futures 0.3.4", @@ -6415,7 +6415,7 @@ dependencies = [ [[package]] name = "sc-network-test" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "env_logger 0.7.1", "futures 0.3.4", @@ -6441,7 +6441,7 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", @@ -6474,7 +6474,7 @@ dependencies = [ [[package]] name = "sc-peerset" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "libp2p", @@ -6487,7 +6487,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6495,7 +6495,7 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "assert_matches", "futures 0.1.29", @@ -6534,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -6557,7 +6557,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6571,7 +6571,7 @@ dependencies = [ [[package]] name = "sc-runtime-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sp-allocator", "sp-core", @@ -6584,7 +6584,7 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "exit-future", @@ -6646,7 +6646,7 @@ dependencies = [ [[package]] name = "sc-service-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "env_logger 0.7.1", "fdlimit", @@ -6681,7 +6681,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "env_logger 0.7.1", "log", @@ -6695,7 +6695,7 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -6716,7 +6716,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "erased-serde", "log", @@ -6731,7 +6731,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "assert_matches", "criterion 0.3.1", @@ -6754,7 +6754,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "assert_matches", "derive_more", @@ -7127,7 +7127,7 @@ dependencies = [ [[package]] name = "sp-allocator" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "log", @@ -7138,7 +7138,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "hash-db", "parity-scale-codec", @@ -7153,7 +7153,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7164,7 +7164,7 @@ dependencies = [ [[package]] name = "sp-api-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.3.1", "parity-scale-codec", @@ -7183,7 +7183,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "serde", @@ -7194,7 +7194,7 @@ dependencies = [ [[package]] name = "sp-application-crypto-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sp-api", "sp-application-crypto", @@ -7205,7 +7205,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.3.1", "integer-sqrt", @@ -7221,7 +7221,7 @@ dependencies = [ [[package]] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "honggfuzz", "num-bigint", @@ -7232,7 +7232,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7243,7 +7243,7 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7253,7 +7253,7 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7264,7 +7264,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "log", @@ -7279,7 +7279,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "serde", "serde_json", @@ -7287,7 +7287,7 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -7310,7 +7310,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7323,7 +7323,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "merlin", "parity-scale-codec", @@ -7339,7 +7339,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7350,7 +7350,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7361,7 +7361,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "base58", "blake2-rfc", @@ -7407,7 +7407,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7415,7 +7415,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -7424,7 +7424,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "environmental", "parity-scale-codec", @@ -7434,7 +7434,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "finality-grandpa", "log", @@ -7449,7 +7449,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7458,7 +7458,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "parity-scale-codec", @@ -7469,7 +7469,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "hash-db", @@ -7488,7 +7488,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "lazy_static", "sp-core", @@ -7498,7 +7498,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "rand 0.7.3", @@ -7513,7 +7513,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7534,7 +7534,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sp-api", "sp-core", @@ -7544,7 +7544,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "backtrace", "log", @@ -7552,7 +7552,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "serde", "serde_json", @@ -7561,7 +7561,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -7583,7 +7583,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7603,7 +7603,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "Inflector", "proc-macro-crate", @@ -7614,7 +7614,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sc-executor", "sp-core", @@ -7629,7 +7629,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sp-core", "sp-io", @@ -7640,7 +7640,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "sp-core", "sp-io", @@ -7651,7 +7651,7 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "assert_matches", "parity-scale-codec", @@ -7665,7 +7665,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "serde", "serde_json", @@ -7673,7 +7673,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7685,7 +7685,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7694,7 +7694,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "hash-db", "hex-literal", @@ -7714,11 +7714,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-rc2" +version = "2.0.0-rc3" [[package]] name = "sp-storage" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7729,7 +7729,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7741,7 +7741,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7754,14 +7754,14 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "tracing", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -7776,7 +7776,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "criterion 0.2.11", "hash-db", @@ -7794,7 +7794,7 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "futures-core", @@ -7804,7 +7804,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7815,7 +7815,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7930,7 +7930,7 @@ dependencies = [ [[package]] name = "subkey" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "clap", "derive_more", @@ -7972,7 +7972,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "chrono", "clear_on_drop", @@ -7998,14 +7998,14 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-support" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "frame-support", "frame-system", @@ -8021,7 +8021,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", @@ -8044,7 +8044,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-rc2" +version = "0.8.0-rc3" dependencies = [ "async-std", "derive_more", @@ -8057,7 +8057,7 @@ dependencies = [ [[package]] name = "substrate-test-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "hash-db", @@ -8077,7 +8077,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "cfg-if", "frame-executive", @@ -8120,7 +8120,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "parity-scale-codec", @@ -8139,7 +8139,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "derive_more", "futures 0.3.4", @@ -8154,7 +8154,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" [[package]] name = "substrate-wasm-builder" diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 79f63f211a..88cdc6d608 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -21,25 +21,25 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } -sc-service = { version = "0.8.0-rc2", path = "../../../client/service" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } -sc-network = { version = "0.8.0-rc2", path = "../../../client/network" } -sc-consensus-aura = { version = "0.8.0-rc2", path = "../../../client/consensus/aura" } -sp-consensus-aura = { version = "0.8.0-rc2", path = "../../../primitives/consensus/aura" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } -sc-finality-grandpa = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa" } -sp-finality-grandpa = { version = "2.0.0-rc2", path = "../../../primitives/finality-grandpa" } -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc2"} +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } +sc-service = { version = "0.8.0-rc3", path = "../../../client/service" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +sc-network = { version = "0.8.0-rc3", path = "../../../client/network" } +sc-consensus-aura = { version = "0.8.0-rc3", path = "../../../client/consensus/aura" } +sp-consensus-aura = { version = "0.8.0-rc3", path = "../../../primitives/consensus/aura" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } +sc-finality-grandpa = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa" } +sp-finality-grandpa = { version = "2.0.0-rc3", path = "../../../primitives/finality-grandpa" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc3"} -node-template-runtime = { version = "2.0.0-rc2", path = "../runtime" } +node-template-runtime = { version = "2.0.0-rc3", path = "../runtime" } [build-dependencies] -substrate-build-script-utils = { version = "2.0.0-rc2", path = "../../../utils/build-script-utils" } +substrate-build-script-utils = { version = "2.0.0-rc3", path = "../../../utils/build-script-utils" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 15e7cfd4ba..8c4f98d85b 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Anonymous'] edition = '2018' name = 'pallet-template' -version = "2.0.0-rc2" +version = "2.0.0-rc3" license = "Unlicense" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" @@ -16,26 +16,26 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = [dependencies.frame-support] default-features = false -version = "2.0.0-rc2" +version = "2.0.0-rc3" path = "../../../../frame/support" [dependencies.frame-system] default-features = false -version = "2.0.0-rc2" +version = "2.0.0-rc3" path = "../../../../frame/system" [dev-dependencies.sp-core] default-features = false -version = "2.0.0-rc2" +version = "2.0.0-rc3" path = "../../../../primitives/core" [dev-dependencies.sp-io] default-features = false -version = "2.0.0-rc2" +version = "2.0.0-rc3" path = "../../../../primitives/io" [dev-dependencies.sp-runtime] default-features = false -version = "2.0.0-rc2" +version = "2.0.0-rc3" path = "../../../../primitives/runtime" diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index d6ee62cb1a..9042edc8fa 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,31 +13,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-rc2", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } -balances = { version = "2.0.0-rc2", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } -grandpa = { version = "2.0.0-rc2", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } -randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } -sudo = { version = "2.0.0-rc2", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } -system = { version = "2.0.0-rc2", default-features = false, package = "frame-system", path = "../../../frame/system" } -timestamp = { version = "2.0.0-rc2", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } -transaction-payment = { version = "2.0.0-rc2", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } -frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/executive" } +aura = { version = "2.0.0-rc3", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } +balances = { version = "2.0.0-rc3", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } +grandpa = { version = "2.0.0-rc3", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } +randomness-collective-flip = { version = "2.0.0-rc3", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } +sudo = { version = "2.0.0-rc3", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } +system = { version = "2.0.0-rc3", default-features = false, package = "frame-system", path = "../../../frame/system" } +timestamp = { version = "2.0.0-rc3", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } +transaction-payment = { version = "2.0.0-rc3", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } +frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/executive" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/api" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc2"} -sp-consensus-aura = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/consensus/aura" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } -sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc2"} -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/io" } -sp-offchain = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/session" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/version" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/api" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc3"} +sp-consensus-aura = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/consensus/aura" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc3"} +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/io" } +sp-offchain = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/session" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/version" } -template = { version = "2.0.0-rc2", default-features = false, path = "../pallets/template", package = "pallet-template" } +template = { version = "2.0.0-rc3", default-features = false, path = "../pallets/template", package = "pallet-template" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 0cb8e006d0..80b02f1bc9 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-bench" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." edition = "2018" @@ -10,21 +10,21 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] log = "0.4.8" -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -node-testing = { version = "2.0.0-rc2", path = "../testing" } -node-runtime = { version = "2.0.0-rc2", path = "../runtime" } -sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api/" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +node-testing = { version = "2.0.0-rc3", path = "../testing" } +node-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api/" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } serde = "1.0.101" serde_json = "1.0.41" structopt = "0.3" derive_more = "0.99.2" kvdb = "0.6" kvdb-rocksdb = "0.8" -sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index fc16de2ba2..9e31d734c3 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-browser-testing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Tests for the in-browser light client." edition = "2018" @@ -17,5 +17,5 @@ wasm-bindgen-futures = "0.4.10" wasm-bindgen-test = "0.3.10" futures = "0.3.4" -node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc2"} -sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc2"} +node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc3"} +sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc3"} diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 66169bc4f8..74edf2f257 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Generic Substrate node implementation in Rust." build = "build.rs" @@ -46,76 +46,76 @@ tracing = "0.1.10" parking_lot = "0.10.0" # primitives -sp-authority-discovery = { version = "2.0.0-rc2", path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } -grandpa-primitives = { version = "2.0.0-rc2", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/timestamp" } -sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/finality-tracker" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +sp-authority-discovery = { version = "2.0.0-rc3", path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } +grandpa-primitives = { version = "2.0.0-rc3", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/timestamp" } +sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/finality-tracker" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } # client dependencies -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -sc-chain-spec = { version = "2.0.0-rc2", path = "../../../client/chain-spec" } -sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } -sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../client/transaction-pool" } -sc-network = { version = "0.8.0-rc2", path = "../../../client/network" } -sc-consensus-babe = { version = "0.8.0-rc2", path = "../../../client/consensus/babe" } -grandpa = { version = "0.8.0-rc2", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } -sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../../../client/db" } -sc-offchain = { version = "2.0.0-rc2", path = "../../../client/offchain" } -sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } -sc-basic-authorship = { version = "0.8.0-rc2", path = "../../../client/basic-authorship" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } -sc-tracing = { version = "2.0.0-rc2", path = "../../../client/tracing" } -sc-telemetry = { version = "2.0.0-rc2", path = "../../../client/telemetry" } -sc-authority-discovery = { version = "0.8.0-rc2", path = "../../../client/authority-discovery" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } +sc-chain-spec = { version = "2.0.0-rc3", path = "../../../client/chain-spec" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../client/transaction-pool" } +sc-network = { version = "0.8.0-rc3", path = "../../../client/network" } +sc-consensus-babe = { version = "0.8.0-rc3", path = "../../../client/consensus/babe" } +grandpa = { version = "0.8.0-rc3", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } +sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../../../client/db" } +sc-offchain = { version = "2.0.0-rc3", path = "../../../client/offchain" } +sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } +sc-basic-authorship = { version = "0.8.0-rc3", path = "../../../client/basic-authorship" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } +sc-tracing = { version = "2.0.0-rc3", path = "../../../client/tracing" } +sc-telemetry = { version = "2.0.0-rc3", path = "../../../client/telemetry" } +sc-authority-discovery = { version = "0.8.0-rc3", path = "../../../client/authority-discovery" } # frame dependencies -pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/timestamp" } -pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } -frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } -pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/im-online" } -pallet-authority-discovery = { version = "2.0.0-rc2", path = "../../../frame/authority-discovery" } -pallet-staking = { version = "2.0.0-rc2", path = "../../../frame/staking" } -pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/timestamp" } +pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } +frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } +pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/im-online" } +pallet-authority-discovery = { version = "2.0.0-rc3", path = "../../../frame/authority-discovery" } +pallet-staking = { version = "2.0.0-rc3", path = "../../../frame/staking" } +pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } # node-specific dependencies -node-runtime = { version = "2.0.0-rc2", path = "../runtime" } -node-rpc = { version = "2.0.0-rc2", path = "../rpc" } -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -node-executor = { version = "2.0.0-rc2", path = "../executor" } +node-runtime = { version = "2.0.0-rc3", path = "../runtime" } +node-rpc = { version = "2.0.0-rc3", path = "../rpc" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +node-executor = { version = "2.0.0-rc3", path = "../executor" } # CLI-specific dependencies -sc-cli = { version = "0.8.0-rc2", optional = true, path = "../../../client/cli" } -frame-benchmarking-cli = { version = "2.0.0-rc2", optional = true, path = "../../../utils/frame/benchmarking-cli" } -node-inspect = { version = "0.8.0-rc2", optional = true, path = "../inspect" } +sc-cli = { version = "0.8.0-rc3", optional = true, path = "../../../client/cli" } +frame-benchmarking-cli = { version = "2.0.0-rc3", optional = true, path = "../../../utils/frame/benchmarking-cli" } +node-inspect = { version = "0.8.0-rc3", optional = true, path = "../inspect" } # WASM-specific dependencies wasm-bindgen = { version = "0.2.57", optional = true } wasm-bindgen-futures = { version = "0.4.7", optional = true } -browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc2"} +browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc3"} [target.'cfg(target_arch="x86_64")'.dependencies] -node-executor = { version = "2.0.0-rc2", path = "../executor", features = [ "wasmtime" ] } -sc-cli = { version = "0.8.0-rc2", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } +node-executor = { version = "2.0.0-rc3", path = "../executor", features = [ "wasmtime" ] } +sc-cli = { version = "0.8.0-rc3", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } [dev-dependencies] -sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } -sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } -sc-consensus-babe = { version = "0.8.0-rc2", features = ["test-helpers"], path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../../client/consensus/epochs" } -sc-service-test = { version = "2.0.0-rc2", path = "../../../client/service/test" } +sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } +sc-consensus-babe = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../../client/consensus/babe" } +sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../../client/consensus/epochs" } +sc-service-test = { version = "2.0.0-rc3", path = "../../../client/service/test" } futures = "0.3.4" tempfile = "3.1.0" assert_cmd = "1.0" @@ -126,12 +126,12 @@ platforms = "0.2.1" [build-dependencies] structopt = { version = "0.3.8", optional = true } -node-inspect = { version = "0.8.0-rc2", optional = true, path = "../inspect" } -frame-benchmarking-cli = { version = "2.0.0-rc2", optional = true, path = "../../../utils/frame/benchmarking-cli" } -substrate-build-script-utils = { version = "2.0.0-rc2", optional = true, path = "../../../utils/build-script-utils" } +node-inspect = { version = "0.8.0-rc3", optional = true, path = "../inspect" } +frame-benchmarking-cli = { version = "2.0.0-rc3", optional = true, path = "../../../utils/frame/benchmarking-cli" } +substrate-build-script-utils = { version = "2.0.0-rc3", optional = true, path = "../../../utils/build-script-utils" } [build-dependencies.sc-cli] -version = "0.8.0-rc2" +version = "0.8.0-rc3" package = "sc-cli" path = "../../../client/cli" optional = true diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 83a16a023f..64799129fc 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-executor" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." edition = "2018" @@ -13,34 +13,34 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -node-runtime = { version = "2.0.0-rc2", path = "../runtime" } -sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } -sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +node-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } trie-root = "0.16.0" -frame-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/benchmarking" } +frame-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/benchmarking" } [dev-dependencies] criterion = "0.3.0" -frame-support = { version = "2.0.0-rc2", path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } -node-testing = { version = "2.0.0-rc2", path = "../testing" } -pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } -pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc2", path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } -pallet-session = { version = "2.0.0-rc2", path = "../../../frame/session" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc2", path = "../../../frame/treasury" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } -substrate-test-client = { version = "2.0.0-rc2", path = "../../../test-utils/client" } +frame-support = { version = "2.0.0-rc3", path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } +node-testing = { version = "2.0.0-rc3", path = "../testing" } +pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } +pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc3", path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } +pallet-session = { version = "2.0.0-rc3", path = "../../../frame/session" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc3", path = "../../../frame/treasury" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } +substrate-test-client = { version = "2.0.0-rc3", path = "../../../test-utils/client" } wabt = "0.9.2" [features] diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index 6006e8c15c..1c2f316b40 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-inspect" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0" } derive_more = "0.99" log = "0.4.8" -sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } structopt = "0.3.8" diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index 55ee2c3829..ec8d58fe27 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system" } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc2", path = "../../../primitives/serializer" } +sp-serializer = { version = "2.0.0-rc3", path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index c61d68bc70..ab4bc7a02d 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,5 +16,5 @@ futures = "0.1.29" hyper = "0.12.35" jsonrpc-core-client = { version = "14.2.0", default-features = false, features = ["http"] } log = "0.4.8" -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 14e8f2cab6..0c6c913b13 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -11,23 +11,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } jsonrpc-core = "14.2.0" -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -node-runtime = { version = "2.0.0-rc2", path = "../runtime" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -pallet-contracts-rpc = { version = "0.8.0-rc2", path = "../../../frame/contracts/rpc/" } -pallet-transaction-payment-rpc = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment/rpc/" } -substrate-frame-rpc-system = { version = "2.0.0-rc2", path = "../../../utils/frame/rpc/system" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } -sc-consensus-babe = { version = "0.8.0-rc2", path = "../../../client/consensus/babe" } -sc-consensus-babe-rpc = { version = "0.8.0-rc2", path = "../../../client/consensus/babe/rpc" } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } -sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } -sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../../client/consensus/epochs" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sc-finality-grandpa = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa" } -sc-finality-grandpa-rpc = { version = "0.8.0-rc2", path = "../../../client/finality-grandpa/rpc" } -sc-rpc-api = { version = "0.8.0-rc2", path = "../../../client/rpc-api" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +node-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +pallet-contracts-rpc = { version = "0.8.0-rc3", path = "../../../frame/contracts/rpc/" } +pallet-transaction-payment-rpc = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment/rpc/" } +substrate-frame-rpc-system = { version = "2.0.0-rc3", path = "../../../utils/frame/rpc/system" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +sc-consensus-babe = { version = "0.8.0-rc3", path = "../../../client/consensus/babe" } +sc-consensus-babe-rpc = { version = "0.8.0-rc3", path = "../../../client/consensus/babe/rpc" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } +sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } +sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../../client/consensus/epochs" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sc-finality-grandpa = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa" } +sc-finality-grandpa-rpc = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa/rpc" } +sc-rpc-api = { version = "0.8.0-rc3", path = "../../../client/rpc-api" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index be01b267fb..ebe3196dd7 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -20,70 +20,70 @@ serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" # primitives -sp-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/consensus/babe" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc2"} -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/inherents" } -node-primitives = { version = "2.0.0-rc2", default-features = false, path = "../primitives" } -sp-offchain = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/offchain" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/staking" } -sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../../primitives/keyring" } -sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/session" } -sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/version" } +sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/consensus/babe" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc3"} +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/inherents" } +node-primitives = { version = "2.0.0-rc3", default-features = false, path = "../primitives" } +sp-offchain = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/offchain" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/staking" } +sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../../primitives/keyring" } +sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/session" } +sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/version" } # frame dependencies -frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/executive" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system" } -frame-system-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system/benchmarking", optional = true } -frame-system-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } -pallet-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/authority-discovery" } -pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/authorship" } -pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/babe" } -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/balances" } -pallet-collective = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/collective" } -pallet-contracts = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/contracts" } -pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/contracts/common/" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc2", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } -pallet-democracy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/democracy" } -pallet-elections-phragmen = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/elections-phragmen" } -pallet-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/finality-tracker" } -pallet-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/indices" } -pallet-identity = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/identity" } -pallet-membership = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/membership" } -pallet-multisig = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/multisig" } -pallet-offences = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/offences" } -pallet-offences-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } -pallet-proxy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/proxy" } -pallet-randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/randomness-collective-flip" } -pallet-recovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/recovery" } -pallet-session = { version = "2.0.0-rc2", features = ["historical"], path = "../../../frame/session", default-features = false } -pallet-session-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/session/benchmarking", default-features = false, optional = true } -pallet-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/staking/reward-curve" } -pallet-scheduler = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/scheduler" } -pallet-society = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/society" } -pallet-sudo = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/sudo" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/timestamp" } -pallet-treasury = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/treasury" } -pallet-utility = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/utility" } -pallet-transaction-payment = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/transaction-payment" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } -pallet-vesting = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/vesting" } +frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/executive" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system" } +frame-system-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system/benchmarking", optional = true } +frame-system-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } +pallet-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/authority-discovery" } +pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/authorship" } +pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/babe" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/balances" } +pallet-collective = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/collective" } +pallet-contracts = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/contracts" } +pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/contracts/common/" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc3", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } +pallet-democracy = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/democracy" } +pallet-elections-phragmen = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/elections-phragmen" } +pallet-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/finality-tracker" } +pallet-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/indices" } +pallet-identity = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/identity" } +pallet-membership = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/membership" } +pallet-multisig = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/multisig" } +pallet-offences = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/offences" } +pallet-offences-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-proxy = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/proxy" } +pallet-randomness-collective-flip = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/randomness-collective-flip" } +pallet-recovery = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/recovery" } +pallet-session = { version = "2.0.0-rc3", features = ["historical"], path = "../../../frame/session", default-features = false } +pallet-session-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/session/benchmarking", default-features = false, optional = true } +pallet-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/staking/reward-curve" } +pallet-scheduler = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/scheduler" } +pallet-society = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/society" } +pallet-sudo = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/sudo" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/timestamp" } +pallet-treasury = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/treasury" } +pallet-utility = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/utility" } +pallet-transaction-payment = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/transaction-payment" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } +pallet-vesting = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/vesting" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index 7fe39763a4..f423c58fe6 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-testing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." edition = "2018" @@ -13,40 +13,40 @@ publish = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } -sc-service = { version = "0.8.0-rc2", features = ["test-helpers", "db"], path = "../../../client/service" } -sc-client-db = { version = "0.8.0-rc2", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api/" } +pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } +sc-service = { version = "0.8.0-rc3", features = ["test-helpers", "db"], path = "../../../client/service" } +sc-client-db = { version = "0.8.0-rc3", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api/" } codec = { package = "parity-scale-codec", version = "1.3.0" } -pallet-contracts = { version = "2.0.0-rc2", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } -pallet-indices = { version = "2.0.0-rc2", path = "../../../frame/indices" } -sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } -node-executor = { version = "2.0.0-rc2", path = "../executor" } -node-primitives = { version = "2.0.0-rc2", path = "../primitives" } -node-runtime = { version = "2.0.0-rc2", path = "../runtime" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } -frame-support = { version = "2.0.0-rc2", path = "../../../frame/support" } -pallet-session = { version = "2.0.0-rc2", path = "../../../frame/session" } -pallet-society = { version = "2.0.0-rc2", path = "../../../frame/society" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -pallet-staking = { version = "2.0.0-rc2", path = "../../../frame/staking" } -sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor", features = ["wasmtime"] } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } -substrate-test-client = { version = "2.0.0-rc2", path = "../../../test-utils/client" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc2", path = "../../../frame/treasury" } +pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } +sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } +node-executor = { version = "2.0.0-rc3", path = "../executor" } +node-primitives = { version = "2.0.0-rc3", path = "../primitives" } +node-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +frame-support = { version = "2.0.0-rc3", path = "../../../frame/support" } +pallet-session = { version = "2.0.0-rc3", path = "../../../frame/session" } +pallet-society = { version = "2.0.0-rc3", path = "../../../frame/society" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc3", path = "../../../frame/staking" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor", features = ["wasmtime"] } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } +substrate-test-client = { version = "2.0.0-rc3", path = "../../../test-utils/client" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc3", path = "../../../frame/treasury" } wabt = "0.9.2" -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/finality-tracker" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/timestamp" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/timestamp" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -54,4 +54,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } diff --git a/bin/utils/chain-spec-builder/Cargo.toml b/bin/utils/chain-spec-builder/Cargo.toml index 7ac1da4606..743a5f25c0 100644 --- a/bin/utils/chain-spec-builder/Cargo.toml +++ b/bin/utils/chain-spec-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-spec-builder" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" -sc-keystore = { version = "2.0.0-rc2", path = "../../../client/keystore" } -sc-chain-spec = { version = "2.0.0-rc2", path = "../../../client/chain-spec" } -node-cli = { version = "2.0.0-rc2", path = "../../node/cli" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } +sc-chain-spec = { version = "2.0.0-rc3", path = "../../../client/chain-spec" } +node-cli = { version = "2.0.0-rc3", path = "../../node/cli" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.8" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 09c5493da6..064470ea7c 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subkey" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,10 +12,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.1.29" -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -node-runtime = { version = "2.0.0-rc2", path = "../../node/runtime" } -node-primitives = { version = "2.0.0-rc2", path = "../../node/primitives" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +node-runtime = { version = "2.0.0-rc3", path = "../../node/runtime" } +node-primitives = { version = "2.0.0-rc3", path = "../../node/primitives" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } rand = "0.7.2" clap = "2.33.0" tiny-bip39 = "0.7" @@ -23,14 +23,14 @@ substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.3.0" } -frame-system = { version = "2.0.0-rc2", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc2", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../../../frame/transaction-payment" } -pallet-grandpa = { version = "2.0.0-rc2", path = "../../../frame/grandpa" } +frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } +pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } -sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" } +sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.2.0", features = ["http"] } hyper = "0.12.35" libp2p = { version = "0.19.1", default-features = false } diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index f46c45a691..7730168136 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,36 +14,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } -sc-executor = { version = "0.8.0-rc2", path = "../executor" } -sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } +sc-executor = { version = "0.8.0-rc3", path = "../executor" } +sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } fnv = { version = "1.0.6" } futures = { version = "0.3.1" } hash-db = { version = "0.15.2", default-features = false } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } hex-literal = { version = "0.2.1" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } kvdb = "0.6.0" log = { version = "0.4.8" } parking_lot = "0.10.0" lazy_static = "1.4.0" -sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } -sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } -sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } +sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } +sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } [dev-dependencies] kvdb-memorydb = "0.6.0" -sp-test-primitives = { version = "2.0.0-rc2", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } +sp-test-primitives = { version = "2.0.0-rc3", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 5050aedeca..8833306f06 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-authority-discovery" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -23,21 +23,21 @@ futures = "0.3.4" futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["kad"] } log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} prost = "0.6.1" rand = "0.7.2" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } -sc-network = { version = "0.8.0-rc2", path = "../network" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } +sc-network = { version = "0.8.0-rc3", path = "../network" } serde_json = "1.0.41" -sp-authority-discovery = { version = "2.0.0-rc2", path = "../../primitives/authority-discovery" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-authority-discovery = { version = "2.0.0-rc3", path = "../../primitives/authority-discovery" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } [dev-dependencies] env_logger = "0.7.0" quickcheck = "0.9.0" -sc-peerset = { version = "2.0.0-rc2", path = "../peerset" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client"} +sc-peerset = { version = "2.0.0-rc3", path = "../peerset" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client"} diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index dad9c54f84..964d1c3798 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-basic-authorship" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,21 +16,21 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc2", path = "../../primitives/inherents" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } -sc-proposer-metrics = { version = "0.8.0-rc2", path = "../proposer-metrics" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc3", path = "../../primitives/inherents" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } +sc-proposer-metrics = { version = "0.8.0-rc3", path = "../proposer-metrics" } tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] } [dev-dependencies] -sc-transaction-pool = { version = "2.0.0-rc2", path = "../../client/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../../client/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } parking_lot = "0.10.0" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index fb5add1d8f..ff142887ff 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-block-builder" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../primitives/block-builder" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } -sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } +sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml index eee78ef676..669e7535dc 100644 --- a/client/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,12 +12,12 @@ description = "Substrate chain configurations." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-chain-spec-derive = { version = "2.0.0-rc2", path = "./derive" } +sc-chain-spec-derive = { version = "2.0.0-rc3", path = "./derive" } impl-trait-for-tuples = "0.1.3" -sc-network = { version = "0.8.0-rc2", path = "../network" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-chain-spec = { version = "2.0.0-rc2", path = "../../primitives/chain-spec" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-chain-spec = { version = "2.0.0-rc3", path = "../../primitives/chain-spec" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index 1f753689ae..6c1153941f 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 8c19da95c4..4bdacfcbd2 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-cli" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Substrate CLI interface." edition = "2018" @@ -25,23 +25,23 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" serde_json = "1.0.41" -sc-informant = { version = "0.8.0-rc2", path = "../informant" } -sp-panic-handler = { version = "2.0.0-rc2", path = "../../primitives/panic-handler" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../service" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } -substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc2"} -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +sc-informant = { version = "0.8.0-rc3", path = "../informant" } +sp-panic-handler = { version = "2.0.0-rc3", path = "../../primitives/panic-handler" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../service" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc3"} +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.8" -sc-tracing = { version = "2.0.0-rc2", path = "../tracing" } +sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } chrono = "0.4.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 9286031589..6c220b5261 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -147,7 +147,7 @@ impl Runner { /// /// ```text /// 2020-06-03 16:14:21 Substrate Node - /// 2020-06-03 16:14:21 ✌️ version 2.0.0-rc2-f4940588c-x86_64-linux-gnu + /// 2020-06-03 16:14:21 ✌️ version 2.0.0-rc3-f4940588c-x86_64-linux-gnu /// 2020-06-03 16:14:21 ❤️ by Parity Technologies , 2017-2020 /// 2020-06-03 16:14:21 📋 Chain specification: Flaming Fir /// 2020-06-03 16:14:21 🏷 Node name: jolly-rod-7462 diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index afd7246266..1cb1c4657b 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-aura" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Aura consensus algorithm for substrate" edition = "2018" @@ -12,37 +12,37 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc2", path = "../../../primitives/consensus/aura" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc3", path = "../../../primitives/consensus/aura" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sc-keystore = { version = "2.0.0-rc2", path = "../../keystore" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sc-keystore = { version = "2.0.0-rc3", path = "../../keystore" } log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } -sp-version = { version = "2.0.0-rc2", path = "../../../primitives/version" } -sc-consensus-slots = { version = "0.8.0-rc2", path = "../slots" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-version = { version = "2.0.0-rc3", path = "../../../primitives/version" } +sc-consensus-slots = { version = "0.8.0-rc3", path = "../slots" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} [dev-dependencies] -sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc2", path = "../../executor" } -sc-network = { version = "0.8.0-rc2", path = "../../network" } -sc-network-test = { version = "0.8.0-rc2", path = "../../network/test" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc3", path = "../../executor" } +sc-network = { version = "0.8.0-rc3", path = "../../network" } +sc-network-test = { version = "0.8.0-rc3", path = "../../network/test" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index ca77b14d0e..86bc5b19f1 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "BABE consensus algorithm for substrate" edition = "2018" @@ -14,31 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" serde = { version = "1.0.104", features = ["derive"] } -sp-version = { version = "2.0.0-rc2", path = "../../../primitives/version" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } -sc-keystore = { version = "2.0.0-rc2", path = "../../keystore" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sc-consensus-epochs = { version = "0.8.0-rc2", path = "../epochs" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-consensus-vrf = { version = "0.8.0-rc2", path = "../../../primitives/consensus/vrf" } -sc-consensus-uncles = { version = "0.8.0-rc2", path = "../uncles" } -sc-consensus-slots = { version = "0.8.0-rc2", path = "../slots" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -fork-tree = { version = "2.0.0-rc2", path = "../../../utils/fork-tree" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} +sp-version = { version = "2.0.0-rc3", path = "../../../primitives/version" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } +sc-keystore = { version = "2.0.0-rc3", path = "../../keystore" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sc-consensus-epochs = { version = "0.8.0-rc3", path = "../epochs" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-consensus-vrf = { version = "0.8.0-rc3", path = "../../../primitives/consensus/vrf" } +sc-consensus-uncles = { version = "0.8.0-rc3", path = "../uncles" } +sc-consensus-slots = { version = "0.8.0-rc3", path = "../slots" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +fork-tree = { version = "2.0.0-rc3", path = "../../../utils/fork-tree" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" @@ -50,13 +50,13 @@ pdqselect = "0.1.0" derive_more = "0.99.2" [dev-dependencies] -sp-keyring = { version = "2.0.0-rc2", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc2", path = "../../executor" } -sc-network = { version = "0.8.0-rc2", path = "../../network" } -sc-network-test = { version = "0.8.0-rc2", path = "../../network/test" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } +sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc3", path = "../../executor" } +sc-network = { version = "0.8.0-rc3", path = "../../network" } +sc-network-test = { version = "0.8.0-rc3", path = "../../network/test" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 1a6c7fd60b..79cff3eb38 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "RPC extensions for the BABE consensus algorithm" edition = "2018" @@ -12,27 +12,27 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-consensus-babe = { version = "0.8.0-rc2", path = "../" } -sc-rpc-api = { version = "0.8.0-rc2", path = "../../../rpc-api" } +sc-consensus-babe = { version = "0.8.0-rc3", path = "../" } +sc-rpc-api = { version = "0.8.0-rc3", path = "../../../rpc-api" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/babe" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.8.0-rc2", path = "../../epochs" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../../primitives/runtime" } +sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../epochs" } futures = { version = "0.3.4", features = ["compat"] } derive_more = "0.99.2" -sp-api = { version = "2.0.0-rc2", path = "../../../../primitives/api" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc2", path = "../../../../primitives/core" } -sc-keystore = { version = "2.0.0-rc2", path = "../../../keystore" } +sp-api = { version = "2.0.0-rc3", path = "../../../../primitives/api" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc3", path = "../../../keystore" } [dev-dependencies] -sc-consensus = { version = "0.8.0-rc2", path = "../../../consensus/common" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../consensus/common" } serde_json = "1.0.50" -sp-application-crypto = { version = "2.0.0-rc2", path = "../../../../primitives/application-crypto" } -sp-keyring = { version = "2.0.0-rc2", path = "../../../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../../test-utils/runtime/client" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../../primitives/application-crypto" } +sp-keyring = { version = "2.0.0-rc3", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index 256237900b..bb1f88a8ce 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,7 +12,7 @@ description = "Collection of common consensus specific imlementations for Substr targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index 969d4f7d2c..c1c47a1a68 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-epochs" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Generic epochs-based utilities for consensus" edition = "2018" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -fork-tree = { version = "2.0.0-rc2", path = "../../../utils/fork-tree" } -sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc2"} -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sc-client-api = { path = "../../api" , version = "2.0.0-rc2"} +fork-tree = { version = "2.0.0-rc3", path = "../../../utils/fork-tree" } +sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc3"} +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sc-client-api = { path = "../../api" , version = "2.0.0-rc3"} diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 0da9aa4e4b..0503fed54a 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-manual-seal" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Manual sealing engine for Substrate" edition = "2018" @@ -22,20 +22,20 @@ parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } assert_matches = "1.3.0" -sc-client-api = { path = "../../../client/api", version = "2.0.0-rc2" } -sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc2" } -sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc2" } -sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc2" } -sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc2" } -sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc2" } -sp-core = { path = "../../../primitives/core", version = "2.0.0-rc2" } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc2" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2" } +sc-client-api = { path = "../../../client/api", version = "2.0.0-rc3" } +sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc3" } +sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc3" } +sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc3" } +sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc3" } +sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc3" } +sp-core = { path = "../../../primitives/core", version = "2.0.0-rc3" } +sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc3" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3" } [dev-dependencies] -sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc2" } -substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc2" } -substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc2" } +sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc3" } +substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc3" } +substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc3" } tokio = { version = "0.2", features = ["rt-core", "macros"] } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index c6eab29781..b48f54a325 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-pow" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "PoW consensus algorithm for substrate" edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../../primitives/block-builder" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } -sp-consensus-pow = { version = "0.8.0-rc2", path = "../../../primitives/consensus/pow" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sp-consensus-pow = { version = "0.8.0-rc3", path = "../../../primitives/consensus/pow" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } log = "0.4.8" futures = { version = "0.3.1", features = ["compat"] } -sp-timestamp = { version = "2.0.0-rc2", path = "../../../primitives/timestamp" } +sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } derive_more = "0.99.2" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index 6cc4a658e3..dae0a924b7 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-slots" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Generic slots-based utilities for consensus" edition = "2018" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../../primitives/application-crypto" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc2", path = "../../telemetry" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" log = "0.4.8" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml index e01e0720b4..0110b3a746 100644 --- a/client/consensus/uncles/Cargo.toml +++ b/client/consensus/uncles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-uncles" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Generic uncle inclusion utilities for consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-authorship = { version = "2.0.0-rc2", path = "../../../primitives/authorship" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc2", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-authorship = { version = "2.0.0-rc3", path = "../../../primitives/authorship" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } log = "0.4.8" diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 18f94b39d7..d9fcdf7f6a 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-db" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -23,22 +23,22 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["st codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } blake2-rfc = "0.2.18" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sc-executor = { version = "0.8.0-rc2", path = "../executor" } -sc-state-db = { version = "0.8.0-rc2", path = "../state-db" } -sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-executor = { version = "0.8.0-rc3", path = "../executor" } +sc-state-db = { version = "0.8.0-rc3", path = "../state-db" } +sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } parity-db = { version = "0.1.2", optional = true } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } [dev-dependencies] -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.9" kvdb-rocksdb = "0.8" diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index 7290538f48..9eee3de1e2 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,22 +15,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } -sp-serializer = { version = "2.0.0-rc2", path = "../../primitives/serializer" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } -sp-panic-handler = { version = "2.0.0-rc2", path = "../../primitives/panic-handler" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } +sp-serializer = { version = "2.0.0-rc3", path = "../../primitives/serializer" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-panic-handler = { version = "2.0.0-rc3", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.41.0" lazy_static = "1.4.0" -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc2", path = "../../primitives/runtime-interface" } -sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } -sc-executor-common = { version = "0.8.0-rc2", path = "common" } -sc-executor-wasmi = { version = "0.8.0-rc2", path = "wasmi" } -sc-executor-wasmtime = { version = "0.8.0-rc2", path = "wasmtime", optional = true } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../../primitives/runtime-interface" } +sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } +sc-executor-common = { version = "0.8.0-rc3", path = "common" } +sc-executor-wasmi = { version = "0.8.0-rc3", path = "wasmi" } +sc-executor-wasmtime = { version = "0.8.0-rc3", path = "wasmtime", optional = true } parking_lot = "0.10.0" log = "0.4.8" libsecp256k1 = "0.3.4" @@ -39,11 +39,11 @@ libsecp256k1 = "0.3.4" assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" -sc-runtime-test = { version = "2.0.0-rc2", path = "runtime-test" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-runtime-test = { version = "2.0.0-rc3", path = "runtime-test" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } test-case = "0.3.3" -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } [features] default = [ "std" ] diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index f5d3c38c61..e9d2586e36 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-common" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,11 +18,11 @@ derive_more = "0.99.2" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } wasmi = "0.6.2" -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } -sp-serializer = { version = "2.0.0-rc2", path = "../../../primitives/serializer" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } +sp-serializer = { version = "2.0.0-rc3", path = "../../../primitives/serializer" } [features] default = [] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index 5700ee2f98..917df5d573 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-runtime-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,12 +13,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/io" } -sp-sandbox = { version = "0.8.0-rc2", default-features = false, path = "../../../primitives/sandbox" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -sp-allocator = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/allocator" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/io" } +sp-sandbox = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/sandbox" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-allocator = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/allocator" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index 0c16758c19..94f28f744b 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmi" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,8 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" wasmi = "0.6.2" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-rc2", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc3", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 2e6d33910c..730bc74932 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmtime" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,11 +16,11 @@ log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor-common = { version = "0.8.0-rc2", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc2", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc2", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc3", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.4" } wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.4" } wasmtime-environ = "0.16" diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index 44c9e0f0f3..2abe609ea5 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -fork-tree = { version = "2.0.0-rc2", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc3", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" @@ -23,37 +23,37 @@ parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" parity-scale-codec = { version = "1.3.0", features = ["derive"] } -sp-arithmetic = { version = "2.0.0-rc2", path = "../../primitives/arithmetic" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc2", path = "../../client/consensus/common" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } -sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } +sp-arithmetic = { version = "2.0.0-rc3", path = "../../primitives/arithmetic" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc3", path = "../../client/consensus/common" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } serde_json = "1.0.41" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-inherents = { version = "2.0.0-rc2", path = "../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sc-network-gossip = { version = "0.8.0-rc2", path = "../network-gossip" } -sp-finality-tracker = { version = "2.0.0-rc2", path = "../../primitives/finality-tracker" } -sp-finality-grandpa = { version = "2.0.0-rc2", path = "../../primitives/finality-grandpa" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} -sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-inherents = { version = "2.0.0-rc3", path = "../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-network-gossip = { version = "0.8.0-rc3", path = "../network-gossip" } +sp-finality-tracker = { version = "2.0.0-rc3", path = "../../primitives/finality-tracker" } +sp-finality-grandpa = { version = "2.0.0-rc3", path = "../../primitives/finality-grandpa" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} +sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } pin-project = "0.4.6" [dev-dependencies] finality-grandpa = { version = "0.12.3", features = ["derive-codec", "test-helpers"] } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sc-network-test = { version = "0.8.0-rc2", path = "../network/test" } -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../primitives/consensus/babe" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-network-test = { version = "0.8.0-rc3", path = "../network/test" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../primitives/consensus/babe" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = { version = "0.2", features = ["rt-core"] } tempfile = "3.1.0" -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index f8a4344192..d364e47b84 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "RPC extensions for the GRANDPA finality gadget" repository = "https://github.com/paritytech/substrate/" @@ -8,7 +8,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -sc-finality-grandpa = { version = "0.8.0-rc2", path = "../" } +sc-finality-grandpa = { version = "0.8.0-rc3", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" @@ -20,4 +20,4 @@ log = "0.4.8" derive_more = "0.99.2" [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index cd24fa6958..0ef6f30805 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-informant" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Substrate informant." edition = "2018" @@ -17,8 +17,8 @@ futures = "0.3.4" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } wasm-timer = "0.2" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../service" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../service" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index f02869762d..7ceffc9061 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-keystore" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } hex = "0.4.0" rand = "0.7.2" serde_json = "1.0.41" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index c5ae8662f0..334a85035f 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Gossiping for the Substrate network protocol" name = "sc-network-gossip" -version = "0.8.0-rc2" +version = "0.8.0-rc3" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -19,12 +19,12 @@ futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" lru = "0.4.3" -sc-network = { version = "0.8.0-rc2", path = "../network" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } wasm-timer = "0.2" [dev-dependencies] async-std = "1.5" quickcheck = "0.9.0" rand = "0.7.2" -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index cf49b65ab2..94a7b2b57d 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate network protocol" name = "sc-network" -version = "0.8.0-rc2" +version = "0.8.0-rc3" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -26,7 +26,7 @@ derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" fnv = "1.0.6" -fork-tree = { version = "2.0.0-rc2", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc3", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" futures_codec = "0.3.3" @@ -39,23 +39,23 @@ lru = "0.4.0" nohash-hasher = "0.2.0" parking_lot = "0.10.0" pin-project = "0.4.6" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc2", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } prost = "0.6.1" rand = "0.7.2" -sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sc-peerset = { version = "2.0.0-rc2", path = "../peerset" } +sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sc-peerset = { version = "2.0.0-rc3", path = "../peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -sp-arithmetic = { version = "2.0.0-rc2", path = "../../primitives/arithmetic" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-arithmetic = { version = "2.0.0-rc3", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } thiserror = "1" unsigned-varint = { version = "0.3.1", features = ["futures", "futures-codec"] } void = "1.0.2" @@ -74,10 +74,10 @@ env_logger = "0.7.0" libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } -sp-test-primitives = { version = "2.0.0-rc2", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +sp-test-primitives = { version = "2.0.0-rc3", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } tempfile = "3.1.0" [features] diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index b137a0e370..27acabbb22 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Integration tests for Substrate network protocol" name = "sc-network-test" -version = "0.8.0-rc2" +version = "0.8.0-rc3" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-network = { version = "0.8.0-rc2", path = "../" } +sc-network = { version = "0.8.0-rc3", path = "../" } log = "0.4.8" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" libp2p = { version = "0.19.1", default-features = false } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../../primitives/consensus/babe" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } env_logger = "0.7.0" -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } tempfile = "3.1.0" -sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../service" } diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 99f4ad66f3..7f1d23f558 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers" name = "sc-offchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bytes = "0.5" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } fnv = "1.0.6" futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -sp-offchain = { version = "2.0.0-rc2", path = "../../primitives/offchain" } +sp-offchain = { version = "2.0.0-rc3", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } rand = "0.7.2" -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] hyper = "0.13.2" @@ -38,10 +38,10 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" fdlimit = "0.1.4" -sc-client-db = { version = "0.8.0-rc2", default-features = true, path = "../db/" } -sc-transaction-pool = { version = "2.0.0-rc2", path = "../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sc-client-db = { version = "0.8.0-rc3", default-features = true, path = "../db/" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } tokio = "0.2" [features] diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index 60ec0a39ef..205260ad72 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -3,7 +3,7 @@ description = "Connectivity manager based on reputation" homepage = "http://parity.io" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" name = "sc-peerset" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" repository = "https://github.com/paritytech/substrate/" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" libp2p = { version = "0.19.1", default-features = false } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils"} +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" wasm-timer = "0.2" diff --git a/client/proposer-metrics/Cargo.toml b/client/proposer-metrics/Cargo.toml index 4e2a807b5d..5c960d1d78 100644 --- a/client/proposer-metrics/Cargo.toml +++ b/client/proposer-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-proposer-metrics" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,4 +13,4 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index ef77566e9e..c7aad9a1b3 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-api" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -21,11 +21,11 @@ jsonrpc-derive = "14.2.1" jsonrpc-pubsub = "14.2.0" log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } -sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc2"} -sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc2"} +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc3"} +sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc3"} serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -sp-rpc = { version = "2.0.0-rc2", path = "../../primitives/rpc" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +sp-rpc = { version = "2.0.0-rc3", path = "../../primitives/rpc" } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 83ef5d7133..9ea70f1794 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-server" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,7 +17,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.2.0" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.2.0" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 4d564e8601..f3557ca6b2 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,38 +12,38 @@ description = "Substrate Client RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-rpc-api = { version = "0.8.0-rc2", path = "../rpc-api" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +sc-rpc-api = { version = "0.8.0-rc3", path = "../rpc-api" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.2.0" log = "0.4.8" -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.2.0" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } serde_json = "1.0.41" -sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } -sp-offchain = { version = "2.0.0-rc2", path = "../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sp-rpc = { version = "2.0.0-rc2", path = "../../primitives/rpc" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sp-chain-spec = { version = "2.0.0-rc2", path = "../../primitives/chain-spec" } -sc-executor = { version = "0.8.0-rc2", path = "../executor" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../client/block-builder" } -sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-session = { version = "2.0.0-rc3", path = "../../primitives/session" } +sp-offchain = { version = "2.0.0-rc3", path = "../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-rpc = { version = "2.0.0-rc3", path = "../../primitives/rpc" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-chain-spec = { version = "2.0.0-rc3", path = "../../primitives/chain-spec" } +sc-executor = { version = "0.8.0-rc3", path = "../executor" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../client/block-builder" } +sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.10.0" [dev-dependencies] assert_matches = "1.3.0" futures01 = { package = "futures", version = "0.1.29" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } tokio = "0.1.22" -sc-transaction-pool = { version = "2.0.0-rc2", path = "../transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../transaction-pool" } lazy_static = "1.4.0" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index f40999bf1c..bd830ec8dd 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -40,38 +40,38 @@ hash-db = "0.15.2" serde = "1.0.101" serde_json = "1.0.41" sysinfo = "0.13.3" -sc-keystore = { version = "2.0.0-rc2", path = "../keystore" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-trie = { version = "2.0.0-rc2", path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-session = { version = "2.0.0-rc2", path = "../../primitives/session" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sc-network = { version = "0.8.0-rc2", path = "../network" } -sc-chain-spec = { version = "2.0.0-rc2", path = "../chain-spec" } -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../db" } +sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-session = { version = "2.0.0-rc3", path = "../../primitives/session" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-chain-spec = { version = "2.0.0-rc3", path = "../chain-spec" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-executor = { version = "0.8.0-rc2", path = "../executor" } -sc-transaction-pool = { version = "2.0.0-rc2", path = "../transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -sc-rpc-server = { version = "2.0.0-rc2", path = "../rpc-servers" } -sc-rpc = { version = "2.0.0-rc2", path = "../rpc" } -sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } -sp-block-builder = { version = "2.0.0-rc2", path = "../../primitives/block-builder" } +sc-executor = { version = "0.8.0-rc3", path = "../executor" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +sc-rpc-server = { version = "2.0.0-rc3", path = "../rpc-servers" } +sc-rpc = { version = "2.0.0-rc3", path = "../rpc" } +sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } -sc-offchain = { version = "2.0.0-rc2", path = "../offchain" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sc-offchain = { version = "2.0.0-rc3", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc2"} -sc-tracing = { version = "2.0.0-rc2", path = "../tracing" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc3"} +sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } tracing = "0.1.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } @@ -84,7 +84,7 @@ procfs = '0.7.8' [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc2", path = "../../primitives/consensus/babe" } -grandpa = { version = "0.8.0-rc2", package = "sc-finality-grandpa", path = "../finality-grandpa" } -grandpa-primitives = { version = "2.0.0-rc2", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc3", path = "../../primitives/consensus/babe" } +grandpa = { version = "0.8.0-rc3", package = "sc-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { version = "2.0.0-rc3", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index 4b55b19269..a887c24a87 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,24 +20,24 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } -sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } -sp-trie = { version = "2.0.0-rc2", path = "../../../primitives/trie" } -sp-storage = { version = "2.0.0-rc2", path = "../../../primitives/storage" } -sc-client-db = { version = "0.8.0-rc2", default-features = false, path = "../../db" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } +sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } +sp-storage = { version = "2.0.0-rc3", path = "../../../primitives/storage" } +sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../../db" } futures = { version = "0.3.1", features = ["compat"] } -sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../service" } -sc-network = { version = "0.8.0-rc2", path = "../../network" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -sc-client-api = { version = "2.0.0-rc2", path = "../../api" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../block-builder" } -sc-executor = { version = "0.8.0-rc2", path = "../../executor" } -sp-panic-handler = { version = "2.0.0-rc2", path = "../../../primitives/panic-handler" } +sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-network = { version = "0.8.0-rc3", path = "../../network" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } +sc-executor = { version = "0.8.0-rc3", path = "../../executor" } +sp-panic-handler = { version = "2.0.0-rc3", path = "../../../primitives/panic-handler" } parity-scale-codec = "1.3.0" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index e1b784c222..5b30a2230a 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-state-db" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = "0.10.0" log = "0.4.8" -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index ee48aa6183..13a1c81d15 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-telemetry" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Telemetry utils" edition = "2018" diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index dfcedddbd1..bc402442b9 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-tracing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -20,7 +20,7 @@ serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" -sc-telemetry = { version = "2.0.0-rc2", path = "../telemetry" } +sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } [dev-dependencies] tracing = "0.1.10" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index 027f9b7041..dce8ce48d2 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,23 +20,23 @@ intervalier = "0.4.0" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parking_lot = "0.10.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc2"} -sc-client-api = { version = "2.0.0-rc2", path = "../api" } -sc-transaction-graph = { version = "2.0.0-rc2", path = "./graph" } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc2", path = "../../primitives/tracing" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} +sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sc-transaction-graph = { version = "2.0.0-rc3", path = "./graph" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc3", path = "../../primitives/tracing" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } wasm-timer = "0.2" [dev-dependencies] assert_matches = "1.3.0" hex = "0.4" -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -substrate-test-runtime-transaction-pool = { version = "2.0.0-rc2", path = "../../test-utils/runtime/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-rc2", path = "../block-builder" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +substrate-test-runtime-transaction-pool = { version = "2.0.0-rc3", path = "../../test-utils/runtime/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index 2290a29c8f..e174b31988 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-graph" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,18 +18,18 @@ log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0.101", features = ["derive"] } wasm-timer = "0.2" -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc2", path = "../../../primitives/utils" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc3", path = "../../../primitives/utils" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../../test-utils/runtime" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } criterion = "0.3" [[bench]] diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4c4cf46e5c..6f55839881 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,9 +6,30 @@ The format is based on [Keep a Changelog]. ## Unreleased -## 2.0.0-rc1 -> 2.0.0-rc2 +## 2.0.0-rc2 -> 2.0.0-rc3 + +Runtime +------- + +* Introduce stacked filtering (#6273) +* Allow "anonymous" proxied accounts (#6236) +* Allow over-weight collective proposals to be closed (#6163) +* Fix Election when ForceNone V1 (#6166) +Client +------ + +* Make transaction pool prune transactions only of canonical blocks (#6123) +* Rename all the election operations (#6245) +* Sentry nodes and validator nodes also imply reserved (#6251) +* Fix peerset not filtering incoming connections in reserved-only (#6249) +* Use Subscription Manager from `jsonrpc-pubsub` (#6208) +* Add a Substrate networking Grafana dashboard template (#6171) +* Add subkey inspect-node-key (#6153) + +## 2.0.0-rc1 -> 2.0.0-rc2 +(nothing of note) ## 2.0.0-alpha.8 -> 2.0.0-rc1 diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index f40eab532e..0039e8898c 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index bb964bd415..f28171ae91 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aura" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,23 +12,23 @@ description = "FRAME AURA consensus pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -sp-consensus-aura = { version = "0.8.0-rc2", path = "../../primitives/consensus/aura", default-features = false } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +sp-consensus-aura = { version = "0.8.0-rc3", path = "../../primitives/consensus/aura", default-features = false } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } lazy_static = "1.4.0" parking_lot = "0.10.0" diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 3aa36b5cac..5cd93d3c31 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authority-discovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME pallet for authority discovery" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-authority-discovery = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/authority-discovery" } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authority-discovery" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc2", features = ["historical" ], path = "../session", default-features = false } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc3", features = ["historical" ], path = "../session", default-features = false } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } [features] default = ["std"] diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 7bde40887a..6f7ae89762 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authorship" -version = "2.0.0-rc2" +version = "2.0.0-rc3" description = "Block and Uncle Author tracking for the FRAME" authors = ["Parity Technologies "] edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-authorship = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/authorship" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-authorship = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authorship" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 060b6ad1ec..dcc6b29376 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-babe" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,22 +14,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } -sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } +sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/babe" } +sp-consensus-vrf = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/vrf" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index ae69fb17c2..d65090b540 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../transaction-payment" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../transaction-payment" } [features] default = ["std"] diff --git a/frame/benchmark/Cargo.toml b/frame/benchmark/Cargo.toml index 6ef770b6c1..2821d52f5b 100644 --- a/frame/benchmark/Cargo.toml +++ b/frame/benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-benchmark" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std"] diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index 24db2adc48..3b383d2a96 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] linregress = "0.1" paste = "0.1" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api = { version = "2.0.0-rc2", path = "../../primitives/api", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc2", path = "../../primitives/runtime-interface", default-features = false } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime", default-features = false } -sp-std = { version = "2.0.0-rc2", path = "../../primitives/std", default-features = false } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-api = { version = "2.0.0-rc3", path = "../../primitives/api", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../../primitives/runtime-interface", default-features = false } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "2.0.0-rc3", path = "../../primitives/std", default-features = false } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io", default-features = false } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [features] default = [ "std" ] diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index d62b5ee580..071fc83b72 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-collective" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 656836df37..6c41875c63 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ pwasm-utils = { version = "0.12.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-sandbox = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/sandbox" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "common" } -pallet-transaction-payment = { version = "2.0.0-rc2", default-features = false, path = "../transaction-payment" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-sandbox = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/sandbox" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "common" } +pallet-transaction-payment = { version = "2.0.0-rc3", default-features = false, path = "../transaction-payment" } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } -pallet-randomness-collective-flip = { version = "2.0.0-rc2", path = "../randomness-collective-flip" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } +pallet-randomness-collective-flip = { version = "2.0.0-rc3", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index c358a87734..4a0581524e 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } [features] default = ["std"] diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index db6a1a6b3e..ccfb2ad511 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc3", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -pallet-contracts-primitives = { version = "2.0.0-rc2", path = "../common" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc2", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +pallet-contracts-primitives = { version = "2.0.0-rc3", path = "../common" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc3", path = "./runtime-api" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index b998befcc8..60d7965342 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Runtime API definition required by Contracts RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/runtime" } -pallet-contracts-primitives = { version = "2.0.0-rc2", default-features = false, path = "../../common" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } +pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "../../common" } [features] default = ["std"] diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index 433c37e4d8..9af038aab3 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-scheduler = { version = "2.0.0-rc2", path = "../scheduler" } -sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } -substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-scheduler = { version = "2.0.0-rc3", path = "../scheduler" } +sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } +substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } hex-literal = "0.2.1" [features] diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index 81833abf85..a33ce0ed29 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections-phragmen" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-npos-elections = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/npos-elections" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } [features] default = ["std"] diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index bd0dc2a1dd..60bb2dcb62 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 03b213605d..c465090743 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-evm" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } primitive-types = { version = "0.7.0", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.16", default-features = false } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index 0f57832a53..d32f206de8 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example-offchain-worker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -13,13 +13,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } lite-json = { version = "0.1", default-features = false } [features] diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index f150a6fa2f..89be881437 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 1484e14588..303cf1c1f7 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-executive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/tracing" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/tracing" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } [dev-dependencies] hex-literal = "0.2.1" -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -pallet-indices = { version = "2.0.0-rc2", path = "../indices" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-transaction-payment = { version = "2.0.0-rc2", path = "../transaction-payment" } -sp-version = { version = "2.0.0-rc2", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +pallet-indices = { version = "2.0.0-rc3", path = "../indices" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-transaction-payment = { version = "2.0.0-rc3", path = "../transaction-payment" } +sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } [features] default = ["std"] diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index 248bf64432..a8e11e83f9 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-finality-tracker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-tracker" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-tracker" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index 11576aaeae..eb62b2986f 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-generic-asset" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Centrality Developers "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 78a86f23ff..99a5dad149 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-grandpa" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,27 +14,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-finality-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-grandpa" } -sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } -pallet-finality-tracker = { version = "2.0.0-rc2", default-features = false, path = "../finality-tracker" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } +sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } +pallet-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../finality-tracker" } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.12.3", features = ["derive-codec"] } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-offences = { version = "2.0.0-rc2", path = "../offences" } -pallet-staking = { version = "2.0.0-rc2", path = "../staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-offences = { version = "2.0.0-rc3", path = "../offences" } +pallet-staking = { version = "2.0.0-rc3", path = "../staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } [features] default = ["std"] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index d38b6c80f1..39eae1b689 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 34b942c889..99979a47c0 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-im-online" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME's I'm online pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } -pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../authorship" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../session" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std", "pallet-session/historical"] diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index 3d01d0f15b..a52ad8e331 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-indices" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../primitives/keyring" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index 21f55b900b..6ea035c3f7 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-membership" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index 4eac66ca5c..459f76b5e8 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-metadata" -version = "11.0.0-rc2" +version = "11.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml index 17e75c817e..00f3e51f38 100644 --- a/frame/multisig/Cargo.toml +++ b/frame/multisig/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-multisig" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 38952e6e94..229c548ead 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-nicks" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index 260419741f..fa36f42e4a 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ description = "FRAME offences pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index f72036361b..366736ac4c 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,27 +13,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } -pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../babe" } -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../../balances" } -pallet-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../grandpa" } -pallet-im-online = { version = "2.0.0-rc2", default-features = false, path = "../../im-online" } -pallet-offences = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../../session" } -pallet-staking = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/staking" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } +pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../babe" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../../balances" } +pallet-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../grandpa" } +pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../im-online" } +pallet-offences = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../../session" } +pallet-staking = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/staking" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } [dev-dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } serde = { version = "1.0.101" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index 58641aa21c..beb924ab27 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-proxy" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-utility = { version = "2.0.0-rc2", path = "../utility" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-utility = { version = "2.0.0-rc3", path = "../utility" } [features] default = ["std"] diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index a539c295fe..fb3775a625 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index fe9e904fb3..88a738b058 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-recovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 79a1a89269..7db67bb3c1 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scheduler" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -11,16 +11,16 @@ description = "FRAME example pallet" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index 4bee2eec30..b5009079d2 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scored-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index b79dc78f12..6955940dc4 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../timestamp" } -sp-trie = { version = "2.0.0-rc2", optional = true, default-features = false, path = "../../primitives/trie" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } +sp-trie = { version = "2.0.0-rc3", optional = true, default-features = false, path = "../../primitives/trie" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" [features] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index 1fe2438195..da969932b1 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ description = "FRAME sessions pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } -pallet-staking = { version = "2.0.0-rc2", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -pallet-session = { version = "2.0.0-rc2", default-features = false, path = "../../session" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } +pallet-staking = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../../session" } [dev-dependencies] serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../../staking/reward-curve" } -sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } -pallet-balances = { version = "2.0.0-rc2", path = "../../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } +sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } +pallet-balances = { version = "2.0.0-rc3", path = "../../balances" } [features] default = ["std"] diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index 25f596e9fd..c9e4f9cb40 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-society" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 70d3e04610..829f39b70b 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,29 +15,29 @@ targets = ["x86_64-unknown-linux-gnu"] static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-npos-elections = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/npos-elections" } -sp-io ={ version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc2", default-features = false, features = ["historical"], path = "../session" } -pallet-authorship = { version = "2.0.0-rc2", default-features = false, path = "../authorship" } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } +sp-io ={ version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc3", default-features = false, features = ["historical"], path = "../session" } +pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } # Optional imports for benchmarking -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../timestamp" } -pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../staking/reward-curve" } -substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } -frame-benchmarking = { version = "2.0.0-rc2", path = "../benchmarking" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../staking/reward-curve" } +substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } +frame-benchmarking = { version = "2.0.0-rc3", path = "../benchmarking" } rand_chacha = { version = "0.2" } parking_lot = "0.10.2" env_logger = "0.7.1" diff --git a/frame/staking/fuzzer/Cargo.lock b/frame/staking/fuzzer/Cargo.lock index 55f76eb6b3..e451e12d10 100644 --- a/frame/staking/fuzzer/Cargo.lock +++ b/frame/staking/fuzzer/Cargo.lock @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index e9cb09ade3..6362ebf414 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-rc2", path = "..", features = ["runtime-benchmarks"] } -pallet-staking-reward-curve = { version = "2.0.0-rc2", path = "../reward-curve" } -pallet-session = { version = "2.0.0-rc2", path = "../../session" } -pallet-indices = { version = "2.0.0-rc2", path = "../../indices" } -pallet-balances = { version = "2.0.0-rc2", path = "../../balances" } -pallet-timestamp = { version = "2.0.0-rc2", path = "../../timestamp" } -frame-system = { version = "2.0.0-rc2", path = "../../system" } -frame-support = { version = "2.0.0-rc2", path = "../../support" } -sp-std = { version = "2.0.0-rc2", path = "../../../primitives/std" } -sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-npos-elections = { version = "2.0.0-rc2", path = "../../../primitives/npos-elections" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc3", path = "..", features = ["runtime-benchmarks"] } +pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../reward-curve" } +pallet-session = { version = "2.0.0-rc3", path = "../../session" } +pallet-indices = { version = "2.0.0-rc3", path = "../../indices" } +pallet-balances = { version = "2.0.0-rc3", path = "../../balances" } +pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } +frame-system = { version = "2.0.0-rc3", path = "../../system" } +frame-support = { version = "2.0.0-rc3", path = "../../support" } +sp-std = { version = "2.0.0-rc3", path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-npos-elections = { version = "2.0.0-rc3", path = "../../../primitives/npos-elections" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } [[bin]] name = "submit_solution" diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index 582f8d79f3..db4241b182 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking-reward-curve" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -21,4 +21,4 @@ proc-macro2 = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index 979eeb2b28..5aef45f8c2 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-sudo" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index d9117cf526..dd9354d019 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,25 +15,25 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-metadata = { version = "11.0.0-rc2", default-features = false, path = "../metadata" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/tracing" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/arithmetic" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -frame-support-procedural = { version = "2.0.0-rc2", path = "./procedural" } +frame-metadata = { version = "11.0.0-rc3", default-features = false, path = "../metadata" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/tracing" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/arithmetic" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +frame-support-procedural = { version = "2.0.0-rc3", path = "./procedural" } paste = "0.1.6" once_cell = { version = "1", default-features = false, optional = true } -sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" smallvec = "1.4.0" [dev-dependencies] pretty_assertions = "0.6.1" -frame-system = { version = "2.0.0-rc2", path = "../system" } +frame-system = { version = "2.0.0-rc3", path = "../system" } [features] default = ["std"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 0c20ac93e1..4e09aec190 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -frame-support-procedural-tools = { version = "2.0.0-rc2", path = "./tools" } +frame-support-procedural-tools = { version = "2.0.0-rc3", path = "./tools" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full"] } diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index 052a074024..0f9faa899e 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Proc macro helpers for procedural macros" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support-procedural-tools-derive = { version = "2.0.0-rc2", path = "./derive" } +frame-support-procedural-tools-derive = { version = "2.0.0-rc3", path = "./derive" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full", "visit"] } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index 75cb6f3045..191c27796b 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 6685f65551..65933929a5 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io", default-features = false } -sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../../primitives/state-machine" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/inherents" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io", default-features = false } +sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../../primitives/state-machine" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/inherents" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 0928951929..ca1b5d6a12 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io", default-features = false } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" -sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../test-utils/runtime/client" } +sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 14fb5206fe..71896f8a39 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-benchmarking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../../benchmarking" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../system" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../support" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ version = "2.0.0-rc2", path = "../../../primitives/io" } +sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index ef1cc7abac..4f599d6d47 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Runtime API definition required by System RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [features] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index cda7904f75..804f17a23a 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-timestamp" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,19 +16,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io", optional = true } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/timestamp" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io", optional = true } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index 17e05fa40f..e1abb00cbf 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,18 +13,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "./rpc/runtime-api" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "./rpc/runtime-api" } smallvec = "1.4.0" [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index dffb8f0cca..2f1e0f06d7 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,10 +16,10 @@ codec = { package = "parity-scale-codec", version = "1.3.0" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc2", path = "../../../primitives/rpc" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc3", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc2", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", path = "./runtime-api" } diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index e4be938b3d..8ffa6fb6ee 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../../support" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../support" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 17c716fdcd..4c0aae3713 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-treasury" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc2", default-features = false, path = "../balances" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io ={ version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index 769e94c1bd..65eae9d4cc 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-utility" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 314abd08d0..885768e365 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc2", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc2", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc2", path = "../balances" } -sp-storage = { version = "2.0.0-rc2", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } hex-literal = "0.2.1" [features] diff --git a/primitives/allocator/Cargo.toml b/primitives/allocator/Cargo.toml index 7bf9ffd43f..872695758a 100644 --- a/primitives/allocator/Cargo.toml +++ b/primitives/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-allocator" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/sp-allocator" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc2", path = "../std", default-features = false } -sp-core = { version = "2.0.0-rc2", path = "../core", default-features = false } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc3", path = "../std", default-features = false } +sp-core = { version = "2.0.0-rc3", path = "../core", default-features = false } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../wasm-interface", default-features = false } log = { version = "0.4.8", optional = true } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index 980049235c..6e46586975 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-api-proc-macro = { version = "2.0.0-rc2", path = "proc-macro" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../version" } -sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } +sp-api-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../version" } +sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } hash-db = { version = "0.15.2", optional = true } [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc2", path = "../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc3", path = "../test-primitives" } [features] default = [ "std" ] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index ce53ee9970..8f5e851fa6 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-proc-macro" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 59b1e76ad9..79bd37c826 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc2", path = "../" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -sp-version = { version = "2.0.0-rc2", path = "../../version" } -sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../blockchain" } -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } +sp-api = { version = "2.0.0-rc3", path = "../" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sp-version = { version = "2.0.0-rc3", path = "../../version" } +sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../blockchain" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" [dev-dependencies] criterion = "0.3.0" -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -sp-core = { version = "2.0.0-rc2", path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sp-core = { version = "2.0.0-rc3", path = "../../core" } [[bench]] name = "bench" diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index 2da6b31627..ebc716cd72 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" description = "Provides facilities for generating application specific crypto wrapper types." @@ -14,11 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } [features] default = [ "std" ] diff --git a/primitives/application-crypto/test/Cargo.toml b/primitives/application-crypto/test/Cargo.toml index df7fc51698..55148f7af2 100644 --- a/primitives/application-crypto/test/Cargo.toml +++ b/primitives/application-crypto/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" description = "Integration tests for application-crypto" @@ -13,8 +13,8 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../test-utils/runtime/client" } -sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../api" } -sp-application-crypto = { version = "2.0.0-rc2", path = "../" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index 5953d89e9c..0912d6a69e 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-debug-derive = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/debug-derive" } +sp-debug-derive = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/debug-derive" } [dev-dependencies] rand = "0.7.2" diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index 9058aaea0b..a37ab876ef 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-arithmetic = { version = "2.0.0-rc2", path = ".." } +sp-arithmetic = { version = "2.0.0-rc3", path = ".." } honggfuzz = "0.5.49" primitive-types = "0.7.0" num-bigint = "0.2" diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index 24fcb91396..4201cd342b 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authority-discovery" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Authority discovery primitives" edition = "2018" @@ -12,11 +12,11 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index 5ae5561a59..4ca6f06207 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authorship" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Authorship primitives" edition = "2018" @@ -12,9 +12,9 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index 767dfeb87e..968107e69a 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-block-builder" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "The block builder runtime api." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } [features] default = [ "std" ] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index 689d84d80f..bf1e5d8354 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-blockchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -18,7 +18,7 @@ lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc2", path = "../consensus/common" } -sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } -sp-block-builder = { version = "2.0.0-rc2", path = "../block-builder" } -sp-state-machine = { version = "0.8.0-rc2", path = "../state-machine" } +sp-consensus = { version = "0.8.0-rc3", path = "../consensus/common" } +sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-block-builder = { version = "2.0.0-rc3", path = "../block-builder" } +sp-state-machine = { version = "0.8.0-rc3", path = "../state-machine" } diff --git a/primitives/chain-spec/Cargo.toml b/primitives/chain-spec/Cargo.toml index 9b2658abe5..2ad9199d86 100644 --- a/primitives/chain-spec/Cargo.toml +++ b/primitives/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-chain-spec" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index b270bdb476..9dddc47fe2 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-aura" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,13 +12,13 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../inherents" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../inherents" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 6cda2695d9..4884e9a9f4 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-babe" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Primitives for BABE consensus" edition = "2018" @@ -12,16 +12,16 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } merlin = { version = "2.0", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } -sp-consensus = { version = "0.8.0-rc2", optional = true, path = "../common" } -sp-consensus-vrf = { version = "0.8.0-rc2", path = "../vrf", default-features = false } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../inherents" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } -sp-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } +sp-consensus = { version = "0.8.0-rc3", optional = true, path = "../common" } +sp-consensus-vrf = { version = "0.8.0-rc3", path = "../vrf", default-features = false } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../inherents" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } +sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index f91ed927b9..3f256d3f73 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,22 +17,22 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" -sp-core = { path= "../../core", version = "2.0.0-rc2"} -sp-inherents = { version = "2.0.0-rc2", path = "../../inherents" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +sp-core = { path= "../../core", version = "2.0.0-rc3"} +sp-inherents = { version = "2.0.0-rc3", path = "../../inherents" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "3.0.1" -sp-std = { version = "2.0.0-rc2", path = "../../std" } -sp-version = { version = "2.0.0-rc2", path = "../../version" } -sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } -sp-utils = { version = "2.0.0-rc2", path = "../../utils" } +sp-std = { version = "2.0.0-rc3", path = "../../std" } +sp-version = { version = "2.0.0-rc3", path = "../../version" } +sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-utils = { version = "2.0.0-rc3", path = "../../utils" } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc2"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc2", path = "../../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc3", path = "../../test-primitives" } [features] default = [] diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index d696b0a975..f8b254ff6e 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-pow" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../api" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index 3e0f3c8c3f..96006fc14c 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-vrf" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Primitives for VRF based consensus" edition = "2018" @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { version = "1.0.0", package = "parity-scale-codec", default-features = false } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } -sp-std = { version = "2.0.0-rc2", path = "../../std", default-features = false } -sp-core = { version = "2.0.0-rc2", path = "../../core", default-features = false } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../runtime" } +sp-std = { version = "2.0.0-rc3", path = "../../std", default-features = false } +sp-core = { version = "2.0.0-rc3", path = "../../core", default-features = false } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 1c06163843..e1a281da6b 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-core" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -33,9 +33,9 @@ num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } -sp-debug-derive = { version = "2.0.0-rc2", path = "../debug-derive" } -sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } -sp-storage = { version = "2.0.0-rc2", default-features = false, path = "../storage" } +sp-debug-derive = { version = "2.0.0-rc3", path = "../debug-derive" } +sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } +sp-storage = { version = "2.0.0-rc3", default-features = false, path = "../storage" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } futures = { version = "0.3.1", optional = true } @@ -50,10 +50,10 @@ twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } merlin = { version = "2.0", default-features = false, optional = true } -sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../runtime-interface" } +sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../runtime-interface" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc2", path = "../serializer" } +sp-serializer = { version = "2.0.0-rc3", path = "../serializer" } pretty_assertions = "0.6.1" hex-literal = "0.2.1" rand = "0.7.2" diff --git a/primitives/database/Cargo.toml b/primitives/database/Cargo.toml index 1899ec850d..0b85975fed 100644 --- a/primitives/database/Cargo.toml +++ b/primitives/database/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-database" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index 92ba01b23c..bf58ddfd8f 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-debug-derive" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 589c8e625c..faa95fd9a1 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-externalities" -version = "0.8.0-rc2" +version = "0.8.0-rc3" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-externalities" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-storage = { version = "2.0.0-rc2", path = "../storage" } -sp-std = { version = "2.0.0-rc2", path = "../std" } +sp-storage = { version = "2.0.0-rc3", path = "../storage" } +sp-std = { version = "2.0.0-rc3", path = "../std" } environmental = { version = "1.1.1" } codec = { package = "parity-scale-codec", version = "1.3.0" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index 83bfca378d..254c27e8dd 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-grandpa" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index 2f9e377f6b..779507ea81 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-tracker" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } [features] default = ["std"] diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 367782ae5b..2e3820d392 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-inherents" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = { version = "0.10.0", optional = true } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index 6189194ede..353532b1b4 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-io" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } hash-db = { version = "0.15.2", default-features = false } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } libsecp256k1 = { version = "0.3.4", optional = true } -sp-state-machine = { version = "0.8.0-rc2", optional = true, path = "../../primitives/state-machine" } -sp-wasm-interface = { version = "2.0.0-rc2", path = "../../primitives/wasm-interface", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../runtime-interface" } -sp-trie = { version = "2.0.0-rc2", optional = true, path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } +sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../../primitives/wasm-interface", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../runtime-interface" } +sp-trie = { version = "2.0.0-rc3", optional = true, path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/keyring/Cargo.toml b/primitives/keyring/Cargo.toml index ead618e3fc..f94d3b14d9 100644 --- a/primitives/keyring/Cargo.toml +++ b/primitives/keyring/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-keyring" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc2", path = "../core" } -sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-core = { version = "2.0.0-rc3", path = "../core" } +sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } lazy_static = "1.4.0" strum = { version = "0.16.0", features = ["derive"] } diff --git a/primitives/npos-elections/Cargo.toml b/primitives/npos-elections/Cargo.toml index c8de0ac46f..3e425f2adc 100644 --- a/primitives/npos-elections/Cargo.toml +++ b/primitives/npos-elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-npos-elections" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-npos-elections-compact = { version = "2.0.0-rc2", path = "./compact" } -sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-npos-elections-compact = { version = "2.0.0-rc3", path = "./compact" } +sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../arithmetic" } [dev-dependencies] -substrate-test-utils = { version = "2.0.0-rc2", path = "../../test-utils" } +substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } rand = "0.7.3" -sp-npos-elections = { version = "2.0.0-rc2", path = "." } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-npos-elections = { version = "2.0.0-rc3", path = "." } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } [features] default = ["std"] diff --git a/primitives/npos-elections/compact/Cargo.toml b/primitives/npos-elections/compact/Cargo.toml index d14405619a..9b4333e385 100644 --- a/primitives/npos-elections/compact/Cargo.toml +++ b/primitives/npos-elections/compact/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-npos-elections-compact" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/npos-elections/fuzzer/Cargo.lock b/primitives/npos-elections/fuzzer/Cargo.lock index c1d7ba945f..cd172421ae 100644 --- a/primitives/npos-elections/fuzzer/Cargo.lock +++ b/primitives/npos-elections/fuzzer/Cargo.lock @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" -version = "2.0.0-rc2" +version = "2.0.0-rc3" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/primitives/npos-elections/fuzzer/Cargo.toml b/primitives/npos-elections/fuzzer/Cargo.toml index e9ca6c6fd9..02be731592 100644 --- a/primitives/npos-elections/fuzzer/Cargo.toml +++ b/primitives/npos-elections/fuzzer/Cargo.toml @@ -14,9 +14,9 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-npos-elections = { version = "2.0.0-rc2", path = ".." } -sp-std = { version = "2.0.0-rc2", path = "../../std" } -sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } +sp-npos-elections = { version = "2.0.0-rc3", path = ".." } +sp-std = { version = "2.0.0-rc3", path = "../../std" } +sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } honggfuzz = "0.5" rand = { version = "0.7.3", features = ["std", "small_rng"] } diff --git a/primitives/offchain/Cargo.toml b/primitives/offchain/Cargo.toml index 2f7246121a..e44a8e8551 100644 --- a/primitives/offchain/Cargo.toml +++ b/primitives/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers primitives" name = "sp-offchain" -version = "2.0.0-rc2" +version = "2.0.0-rc3" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } [dev-dependencies] -sp-state-machine = { version = "0.8.0-rc2", default-features = false, path = "../state-machine" } +sp-state-machine = { version = "0.8.0-rc3", default-features = false, path = "../state-machine" } [features] default = ["std"] diff --git a/primitives/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml index 75042799b1..acdf7b7462 100644 --- a/primitives/panic-handler/Cargo.toml +++ b/primitives/panic-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-panic-handler" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index a625d4ad71..332649d266 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-rpc" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", features = ["derive"] } -sp-core = { version = "2.0.0-rc2", path = "../core" } +sp-core = { version = "2.0.0-rc3", path = "../core" } [dev-dependencies] serde_json = "1.0.41" diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index a0ff633014..3a3d625b5f 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,20 +13,20 @@ documentation = "https://docs.rs/sp-runtime-interface/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-wasm-interface = { version = "2.0.0-rc2", path = "../wasm-interface", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-tracing = { version = "2.0.0-rc2", default-features = false, path = "../tracing" } -sp-runtime-interface-proc-macro = { version = "2.0.0-rc2", path = "proc-macro" } -sp-externalities = { version = "0.8.0-rc2", optional = true, path = "../externalities" } +sp-wasm-interface = { version = "2.0.0-rc3", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../tracing" } +sp-runtime-interface-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } +sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] -sp-runtime-interface-test-wasm = { version = "2.0.0-rc2", path = "test-wasm" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } -sp-core = { version = "2.0.0-rc2", path = "../core" } -sp-io = { version = "2.0.0-rc2", path = "../io" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc3", path = "test-wasm" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc3", path = "../core" } +sp-io = { version = "2.0.0-rc3", path = "../io" } rustversion = "1.0.0" trybuild = "1.0.23" diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index 89d8ddf56b..67809c1ba2 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 43a1f8baa9..8668282943 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index 3f99e157ec..304cc1e82e 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc2", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test/Cargo.toml b/primitives/runtime-interface/test/Cargo.toml index b281278b5c..a68a9b3c92 100644 --- a/primitives/runtime-interface/test/Cargo.toml +++ b/primitives/runtime-interface/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc2", path = "../" } -sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } -sp-runtime-interface-test-wasm = { version = "2.0.0-rc2", path = "../test-wasm" } -sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc2", path = "../test-wasm-deprecated" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc2", path = "../../runtime" } -sp-core = { version = "2.0.0-rc2", path = "../../core" } -sp-io = { version = "2.0.0-rc2", path = "../../io" } +sp-runtime-interface = { version = "2.0.0-rc3", path = "../" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc3", path = "../test-wasm" } +sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc3", path = "../test-wasm-deprecated" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-core = { version = "2.0.0-rc3", path = "../../core" } +sp-io = { version = "2.0.0-rc3", path = "../../io" } tracing = "0.1.13" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index ae30372b65..a81c2515c8 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,23 +16,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } -sp-arithmetic = { version = "2.0.0-rc2", default-features = false, path = "../arithmetic" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } +sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../io" } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } impl-trait-for-tuples = "0.1.3" -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } [dev-dependencies] serde_json = "1.0.41" rand = "0.7.2" -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } [features] bench = [] diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index 522ce1ea62..1a2175aebd 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-sandbox" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,10 +13,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../io" } -sp-wasm-interface = { version = "2.0.0-rc2", default-features = false, path = "../wasm-interface" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../io" } +sp-wasm-interface = { version = "2.0.0-rc3", default-features = false, path = "../wasm-interface" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } [dev-dependencies] diff --git a/primitives/serializer/Cargo.toml b/primitives/serializer/Cargo.toml index 4fa0f215d3..d46de697fa 100644 --- a/primitives/serializer/Cargo.toml +++ b/primitives/serializer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-serializer" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index 48defdbe64..b3dd297ceb 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-session" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-staking = { version = "2.0.0-rc2", default-features = false, path = "../staking" } -sp-runtime = { version = "2.0.0-rc2", optional = true, path = "../runtime" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../staking" } +sp-runtime = { version = "2.0.0-rc3", optional = true, path = "../runtime" } [features] default = [ "std" ] diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index 7f6019958c..ce44d8a0f7 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-staking" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index 6a2653bb5b..22dc73fc7e 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-state-machine" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Substrate State Machine" edition = "2018" @@ -18,17 +18,17 @@ parking_lot = "0.10.0" hash-db = "0.15.2" trie-db = "0.20.1" trie-root = "0.16.0" -sp-trie = { version = "2.0.0-rc2", path = "../trie" } -sp-core = { version = "2.0.0-rc2", path = "../core" } -sp-panic-handler = { version = "2.0.0-rc2", path = "../panic-handler" } +sp-trie = { version = "2.0.0-rc3", path = "../trie" } +sp-core = { version = "2.0.0-rc3", path = "../core" } +sp-panic-handler = { version = "2.0.0-rc3", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.3.0" } num-traits = "0.2.8" rand = "0.7.2" -sp-externalities = { version = "0.8.0-rc2", path = "../externalities" } +sp-externalities = { version = "0.8.0-rc3", path = "../externalities" } [dev-dependencies] hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } [features] default = [] diff --git a/primitives/std/Cargo.toml b/primitives/std/Cargo.toml index 3f08366fa8..d3a242db4f 100644 --- a/primitives/std/Cargo.toml +++ b/primitives/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-std" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/storage/Cargo.toml b/primitives/storage/Cargo.toml index d0d45649c4..9d61cb8a4a 100644 --- a/primitives/storage/Cargo.toml +++ b/primitives/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-storage" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" description = "Storage related primitives" @@ -13,11 +13,11 @@ documentation = "https://docs.rs/sp-storage/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } ref-cast = "1.0.0" -sp-debug-derive = { version = "2.0.0-rc2", path = "../debug-derive" } +sp-debug-derive = { version = "2.0.0-rc3", path = "../debug-derive" } [features] default = [ "std" ] diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index ec050b7428..87cb398579 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-test-primitives" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } [features] diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 4e8d2cabcb..59c090eb46 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-timestamp" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Substrate core types and inherents for timestamps." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index 213af27572..f0560adb06 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-tracing" -version = "2.0.0-rc2" +version = "2.0.0-rc3" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index b7673e8da0..94daf519db 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,10 +19,10 @@ derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../api" } -sp-blockchain = { version = "2.0.0-rc2", optional = true, path = "../blockchain" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } -sp-utils = { version = "2.0.0-rc2", default-features = false, path = "../utils" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } +sp-blockchain = { version = "2.0.0-rc3", optional = true, path = "../blockchain" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-utils = { version = "2.0.0-rc3", default-features = false, path = "../utils" } [features] default = [ "std" ] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index 57a2cb59ec..c436092c09 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-trie" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] description = "Patricia trie stuff using a parity-scale-codec node format" repository = "https://github.com/paritytech/substrate/" @@ -18,19 +18,19 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.20.1", default-features = false } trie-root = { version = "0.16.0", default-features = false } memory-db = { version = "0.20.0", default-features = false } -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } [dev-dependencies] trie-bench = "0.21.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc2", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } [features] default = ["std"] diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index 5f4e6c7181..c5b74f98a9 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index e442639f87..eb8c845075 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-version" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index dc00ef5ec0..39684a0381 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-wasm-interface" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" -sp-std = { version = "2.0.0-rc2", path = "../std", default-features = false } +sp-std = { version = "2.0.0-rc3", path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } [features] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 0bb1d3026e..3d6914540a 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index a72dced392..a6924e4f27 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,17 +12,17 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc2", path = "../../client/api" } -sc-client-db = { version = "0.8.0-rc2", features = ["test-helpers"], path = "../../client/db" } -sp-consensus = { version = "0.8.0-rc2", path = "../../primitives/consensus/common" } -sc-executor = { version = "0.8.0-rc2", path = "../../client/executor" } -sc-consensus = { version = "0.8.0-rc2", path = "../../client/consensus/common" } -sc-service = { version = "0.8.0-rc2", default-features = false, features = ["test-helpers"], path = "../../client/service" } +sc-client-api = { version = "2.0.0-rc3", path = "../../client/api" } +sc-client-db = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../client/db" } +sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" } +sc-consensus = { version = "0.8.0-rc3", path = "../../client/consensus/common" } +sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../client/service" } futures = "0.3.4" hash-db = "0.15.2" -sp-keyring = { version = "2.0.0-rc2", path = "../../primitives/keyring" } +sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index cb529e1cb7..a4e4bd1f16 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,35 +13,35 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/aura" } -sp-consensus-babe = { version = "0.8.0-rc2", default-features = false, path = "../../primitives/consensus/babe" } -sp-block-builder = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/block-builder" } +sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/aura" } +sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/babe" } +sp-block-builder = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-executive = { version = "2.0.0-rc2", default-features = false, path = "../../frame/executive" } -sp-inherents = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc2", optional = true, path = "../../primitives/keyring" } +frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../frame/executive" } +sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.20.0", default-features = false } -sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc2"} -sp-core = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/std" } -sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc2"} -sp-io = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc2", default-features = false, path = "../../frame/support" } -sp-version = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/version" } -sp-session = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/session" } -sp-api = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/runtime" } -pallet-babe = { version = "2.0.0-rc2", default-features = false, path = "../../frame/babe" } -frame-system = { version = "2.0.0-rc2", default-features = false, path = "../../frame/system" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc2", default-features = false, path = "../../frame/system/rpc/runtime-api" } -pallet-timestamp = { version = "2.0.0-rc2", default-features = false, path = "../../frame/timestamp" } -sp-finality-grandpa = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/finality-grandpa" } -sp-trie = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/trie" } -sp-transaction-pool = { version = "2.0.0-rc2", default-features = false, path = "../../primitives/transaction-pool" } +sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc3"} +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc3"} +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../frame/support" } +sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } +sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } +sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../frame/babe" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../frame/system" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../frame/system/rpc/runtime-api" } +pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../frame/timestamp" } +sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } +sp-trie = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/trie" } +sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/transaction-pool" } trie-db = { version = "0.20.1", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.8.0-rc2", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } +sc-service = { version = "0.8.0-rc3", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } # 3rd party cfg-if = "0.1.10" @@ -49,10 +49,10 @@ log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.8.0-rc2", path = "../../client/block-builder" } -sc-executor = { version = "0.8.0-rc2", path = "../../client/executor" } -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "./client" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../client/block-builder" } +sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "./client" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../utils/wasm-builder-runner" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 51d89ed95d..d59a5f1fda 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-client" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,16 +12,16 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-consensus = { version = "0.8.0-rc2", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc2", path = "../../../client/block-builder" } -substrate-test-client = { version = "2.0.0-rc2", path = "../../client" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -substrate-test-runtime = { version = "2.0.0-rc2", path = "../../runtime" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } +substrate-test-client = { version = "2.0.0-rc3", path = "../../client" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +substrate-test-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } codec = { package = "parity-scale-codec", version = "1.3.0" } -sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" } -sc-consensus = { version = "0.8.0-rc2", path = "../../../client/consensus/common" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } +sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } futures = "0.3.4" diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index 171e864dc5..0dc14f4edf 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../client" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../client" } parking_lot = "0.10.0" codec = { package = "parity-scale-codec", version = "1.3.0" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../primitives/transaction-pool" } -sc-transaction-graph = { version = "2.0.0-rc2", path = "../../../client/transaction-pool/graph" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +sc-transaction-graph = { version = "2.0.0-rc3", path = "../../../client/transaction-pool/graph" } futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.99.2" diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index 0850b7b77e..ee4634f0d1 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-browser-utils" -version = "0.8.0-rc2" +version = "0.8.0-rc3" authors = ["Parity Technologies "] description = "Utilities for creating a browser light-client." edition = "2018" @@ -22,11 +22,11 @@ js-sys = "0.3.34" wasm-bindgen = "0.2.57" wasm-bindgen-futures = "0.4.7" kvdb-web = "0.6" -sp-database = { version = "2.0.0-rc2", path = "../../primitives/database" } -sc-informant = { version = "0.8.0-rc2", path = "../../client/informant" } -sc-service = { version = "0.8.0-rc2", path = "../../client/service", default-features = false } -sc-network = { path = "../../client/network", version = "0.8.0-rc2"} -sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc2"} +sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } +sc-informant = { version = "0.8.0-rc3", path = "../../client/informant" } +sc-service = { version = "0.8.0-rc3", path = "../../client/service", default-features = false } +sc-network = { path = "../../client/network", version = "0.8.0-rc3"} +sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc3"} # Imported just for the `no_cc` feature clear_on_drop = { version = "0.2.3", features = ["no_cc"] } diff --git a/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml index 8e722d6919..a1f31f83e8 100644 --- a/utils/build-script-utils/Cargo.toml +++ b/utils/build-script-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-build-script-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index d07afd2d42..de3f19f0a1 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-tree" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index d7a3ddc587..d53c4c2fe0 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking-cli" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,15 +12,15 @@ description = "CLI for benchmarking FRAME" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/benchmarking" } -sp-core = { version = "2.0.0-rc2", path = "../../../primitives/core" } -sc-service = { version = "0.8.0-rc2", default-features = false, path = "../../../client/service" } -sc-cli = { version = "0.8.0-rc2", path = "../../../client/cli" } -sc-client-db = { version = "0.8.0-rc2", path = "../../../client/db" } -sc-executor = { version = "0.8.0-rc2", path = "../../../client/executor" } -sp-externalities = { version = "0.8.0-rc2", path = "../../../primitives/externalities" } -sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc2", path = "../../../primitives/state-machine" } +frame-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/benchmarking" } +sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sc-client-db = { version = "0.8.0-rc3", path = "../../../client/db" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } +sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } structopt = "0.3.8" codec = { version = "1.3.0", package = "parity-scale-codec" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index e8322aaf1d..092c2c402d 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-support" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies ", "Andrew Dirksen "] edition = "2018" license = "Apache-2.0" @@ -17,10 +17,10 @@ jsonrpc-client-transports = { version = "14.2.0", default-features = false, feat jsonrpc-core = "14.2.0" codec = { package = "parity-scale-codec", version = "1" } serde = "1" -frame-support = { version = "2.0.0-rc2", path = "../../../../frame/support" } -sp-storage = { version = "2.0.0-rc2", path = "../../../../primitives/storage" } -sc-rpc-api = { version = "0.8.0-rc2", path = "../../../../client/rpc-api" } +frame-support = { version = "2.0.0-rc3", path = "../../../../frame/support" } +sp-storage = { version = "2.0.0-rc3", path = "../../../../primitives/storage" } +sc-rpc-api = { version = "0.8.0-rc3", path = "../../../../client/rpc-api" } [dev-dependencies] -frame-system = { version = "2.0.0-rc2", path = "../../../../frame/system" } +frame-system = { version = "2.0.0-rc3", path = "../../../../frame/system" } tokio = "0.2" diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 5a350d911a..11afd3b841 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-system" -version = "2.0.0-rc2" +version = "2.0.0-rc3" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "FRAME's system exposed over Substrate RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc2", path = "../../../../client/api" } +sc-client-api = { version = "2.0.0-rc3", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.0" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.2.0" @@ -20,14 +20,14 @@ jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc2", path = "../../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc2", path = "../../../../primitives/api" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc2", path = "../../../../frame/system/rpc/runtime-api" } -sp-core = { version = "2.0.0-rc2", path = "../../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc2", path = "../../../../primitives/blockchain" } -sp-transaction-pool = { version = "2.0.0-rc2", path = "../../../../primitives/transaction-pool" } +sp-runtime = { version = "2.0.0-rc3", path = "../../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc3", path = "../../../../primitives/api" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc3", path = "../../../../frame/system/rpc/runtime-api" } +sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc3", path = "../../../../primitives/blockchain" } +sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../../primitives/transaction-pool" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc2", path = "../../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } env_logger = "0.7.0" -sc-transaction-pool = { version = "2.0.0-rc2", path = "../../../../client/transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../../client/transaction-pool" } diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index edb0d2eef6..c8dd98656b 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Endpoint to expose Prometheus metrics" name = "substrate-prometheus-endpoint" -version = "0.8.0-rc2" +version = "0.8.0-rc3" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" -- GitLab From 85cd5569fd52b7de2c9628c470d947d60c843bc8 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 9 Jun 2020 00:58:08 +0300 Subject: [PATCH 127/280] Fix transaction pool & network issues (#6288) * fix & tweaks * address review * line width --- client/network/src/protocol.rs | 4 ++- client/transaction-pool/src/lib.rs | 38 ++++++++++++++++----- client/transaction-pool/src/testing/pool.rs | 19 +++++++++++ 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 0450818e7a..83f459d344 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -78,7 +78,9 @@ const PROPAGATE_TIMEOUT: time::Duration = time::Duration::from_millis(2900); /// Maximim number of known block hashes to keep for a peer. const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead /// Maximim number of known extrinsic hashes to keep for a peer. -const MAX_KNOWN_EXTRINSICS: usize = 4096; // ~128kb per peer + overhead +/// +/// This should be approx. 2 blocks full of transactions for the network to function properly. +const MAX_KNOWN_EXTRINSICS: usize = 10240; // ~300kb per peer + overhead. /// Maximim number of transaction validation request we keep at any moment. const MAX_PENDING_TRANSACTIONS: usize = 8192; diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index ad238e6241..863f9f3578 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -34,8 +34,8 @@ pub mod testing; pub use sc_transaction_graph as txpool; pub use crate::api::{FullChainApi, LightChainApi}; -use std::{collections::HashMap, sync::Arc, pin::Pin}; -use futures::{prelude::*, future::{ready, self}, channel::oneshot}; +use std::{collections::{HashMap, HashSet}, sync::Arc, pin::Pin}; +use futures::{prelude::*, future::{self, ready}, channel::oneshot}; use parking_lot::Mutex; use sp_runtime::{ @@ -47,7 +47,7 @@ use sp_transaction_pool::{ TransactionStatusStreamFor, MaintainedTransactionPool, PoolFuture, ChainEvent, TransactionSource, }; -use sc_transaction_graph::ChainApi; +use sc_transaction_graph::{ChainApi, ExtrinsicHash}; use wasm_timer::Instant; use prometheus_endpoint::Registry as PrometheusRegistry; @@ -440,10 +440,10 @@ async fn prune_known_txs_for_block>( block_id: BlockId, api: &Api, pool: &sc_transaction_graph::Pool, -) { +) -> Vec> { // We don't query block if we won't prune anything if pool.validated_pool().status().is_empty() { - return; + return Vec::new(); } let hashes = api.block_body(&block_id).await @@ -459,6 +459,8 @@ async fn prune_known_txs_for_block>( if let Err(e) = pool.prune_known(&block_id, &hashes) { log::error!("Cannot prune known in the pool {:?}!", e); } + + hashes } impl MaintainedTransactionPool for BasicPool @@ -495,6 +497,10 @@ impl MaintainedTransactionPool for BasicPool let ready_poll = self.ready_poll.clone(); async move { + // We keep track of everything we prune so that later we won't add + // tranactions with those hashes from the retracted blocks. + let mut pruned_log = HashSet::>::new(); + // If there is a tree route, we use this to prune known tx based on the enacted // blocks. if let Some(ref tree_route) = tree_route { @@ -509,12 +515,14 @@ impl MaintainedTransactionPool for BasicPool &*pool, ), ), - ).await; + ).await.into_iter().for_each(|enacted_log|{ + pruned_log.extend(enacted_log); + }) } // If this is a new best block, we need to prune its transactions from the pool. if is_new_best { - prune_known_txs_for_block(id.clone(), &*api, &*pool).await; + pruned_log.extend(prune_known_txs_for_block(id.clone(), &*api, &*pool).await); } if let (true, Some(tree_route)) = (next_action.resubmit, tree_route) { @@ -536,7 +544,21 @@ impl MaintainedTransactionPool for BasicPool .into_iter() .filter(|tx| tx.is_signed().unwrap_or(true)); - resubmit_transactions.extend(block_transactions); + resubmit_transactions.extend( + block_transactions.into_iter().filter(|tx| { + let tx_hash = pool.hash_of(&tx); + let contains = pruned_log.contains(&tx_hash); + if !contains { + log::debug!( + target: "txpool", + "[{:?}]: Resubmitting from retracted block {:?}", + tx_hash, + hash, + ); + } + !contains + }) + ); } if let Err(e) = pool.submit_at( diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 0f0c000489..85d8066e03 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -281,6 +281,25 @@ fn should_resubmit_from_retracted_during_maintenance() { assert_eq!(pool.status().ready, 1); } + +#[test] +fn should_not_resubmit_from_retracted_during_maintenance_if_tx_is_also_in_enacted() { + let xt = uxt(Alice, 209); + + let (pool, _guard, _notifier) = maintained_pool(); + + block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt.clone())).expect("1. Imported"); + assert_eq!(pool.status().ready, 1); + + let header = pool.api.push_block(1, vec![xt.clone()]); + let fork_header = pool.api.push_block(1, vec![xt]); + + let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api); + + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); +} + #[test] fn should_not_retain_invalid_hashes_from_retracted() { let xt = uxt(Alice, 209); -- GitLab From 863611ed00324093919557dfdec02c76506ce7d6 Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Tue, 9 Jun 2020 09:39:30 +0200 Subject: [PATCH 128/280] Use `sign_with` for signing grandpa's outgoing message (#6178) * Use sign_with and stop using `Pair` * PR feedback * Remove clone * Transfer ownership of public to sign_message * Use Option * Simplify code * Fix error message * Pass keystore as ref * Pass keystore properly * Fix tests --- Cargo.lock | 1 + bin/node-template/node/src/service.rs | 2 +- bin/node/cli/src/service.rs | 4 +- client/finality-grandpa/Cargo.toml | 1 + .../finality-grandpa/src/communication/mod.rs | 36 +++++++++---- client/finality-grandpa/src/environment.rs | 20 ++++---- client/finality-grandpa/src/import.rs | 1 + client/finality-grandpa/src/lib.rs | 51 +++++++++++-------- client/finality-grandpa/src/observer.rs | 8 +-- client/finality-grandpa/src/tests.rs | 9 ++-- primitives/finality-grandpa/src/lib.rs | 23 ++++++--- 11 files changed, 95 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e0f788707..2b94666563 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6269,6 +6269,7 @@ dependencies = [ "sc-telemetry", "serde_json", "sp-api", + "sp-application-crypto", "sp-arithmetic", "sp-blockchain", "sp-consensus", diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index 17606e2923..b9bc68ce3a 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -148,7 +148,7 @@ pub fn new_full(config: Configuration) -> Result> NetworkBridge { /// network all within the current set. pub(crate) fn round_communication( &self, + keystore: Option, round: Round, set_id: SetId, voters: Arc>, - local_key: Option, + local_key: Option, has_voted: HasVoted, ) -> ( impl Stream> + Unpin, @@ -287,10 +288,9 @@ impl> NetworkBridge { &*voters, ); - let locals = local_key.and_then(|pair| { - let id = pair.public(); + let local_id = local_key.and_then(|id| { if voters.contains(&id) { - Some((pair, id)) + Some(id) } else { None } @@ -350,10 +350,11 @@ impl> NetworkBridge { let (tx, out_rx) = mpsc::channel(0); let outgoing = OutgoingMessages:: { + keystore: keystore.clone(), round: round.0, set_id: set_id.0, network: self.gossip_engine.clone(), - locals, + local_id, sender: tx, has_voted, }; @@ -628,10 +629,11 @@ pub struct SetId(pub SetIdNumber); pub(crate) struct OutgoingMessages { round: RoundNumber, set_id: SetIdNumber, - locals: Option<(AuthorityPair, AuthorityId)>, + local_id: Option, sender: mpsc::Sender>, network: Arc>>, has_voted: HasVoted, + keystore: Option, } impl Unpin for OutgoingMessages {} @@ -665,14 +667,26 @@ impl Sink> for OutgoingMessages } // when locals exist, sign messages on import - if let Some((ref pair, _)) = self.locals { + if let Some(ref public) = self.local_id { + let keystore = match &self.keystore { + Some(keystore) => keystore.clone(), + None => { + return Err(Error::Signing("Cannot sign without a keystore".to_string())) + } + }; + let target_hash = *(msg.target().0); let signed = sp_finality_grandpa::sign_message( + keystore, msg, - pair, + public.clone(), self.round, self.set_id, - ); + ).ok_or( + Error::Signing(format!( + "Failed to sign GRANDPA vote for round {} targetting {:?}", self.round, target_hash + )) + )?; let message = GossipMessage::Vote(VoteMessage:: { message: signed.clone(), diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs index afcc3891ac..6db854bacc 100644 --- a/client/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -35,7 +35,6 @@ use finality_grandpa::{ voter, voter_set::VoterSet, }; use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as ClientError}; -use sp_core::Pair; use sp_runtime::generic::BlockId; use sp_runtime::traits::{ Block as BlockT, Header as HeaderT, NumberFor, One, Zero, @@ -704,11 +703,11 @@ where let prevote_timer = Delay::new(self.config.gossip_duration * 2); let precommit_timer = Delay::new(self.config.gossip_duration * 4); - let local_key = crate::is_voter(&self.voters, &self.config.keystore); + let local_key = crate::is_voter(&self.voters, self.config.keystore.as_ref()); let has_voted = match self.voter_set_state.has_voted(round) { HasVoted::Yes(id, vote) => { - if local_key.as_ref().map(|k| k.public() == id).unwrap_or(false) { + if local_key.as_ref().map(|k| k == &id).unwrap_or(false) { HasVoted::Yes(id, vote) } else { HasVoted::No @@ -718,6 +717,7 @@ where }; let (incoming, outgoing) = self.network.round_communication( + self.config.keystore.clone(), crate::communication::Round(round), crate::communication::SetId(self.set_id), self.voters.clone(), @@ -740,7 +740,7 @@ where let outgoing = Box::pin(outgoing.sink_err_into()); voter::RoundData { - voter_id: local_key.map(|pair| pair.public()), + voter_id: local_key, prevote_timer: Box::pin(prevote_timer.map(Ok)), precommit_timer: Box::pin(precommit_timer.map(Ok)), incoming, @@ -749,10 +749,10 @@ where } fn proposed(&self, round: RoundNumber, propose: PrimaryPropose) -> Result<(), Self::Error> { - let local_id = crate::is_voter(&self.voters, &self.config.keystore); + let local_id = crate::is_voter(&self.voters, self.config.keystore.as_ref()); let local_id = match local_id { - Some(id) => id.public(), + Some(id) => id, None => return Ok(()), }; @@ -788,10 +788,10 @@ where } fn prevoted(&self, round: RoundNumber, prevote: Prevote) -> Result<(), Self::Error> { - let local_id = crate::is_voter(&self.voters, &self.config.keystore); + let local_id = crate::is_voter(&self.voters, self.config.keystore.as_ref()); let local_id = match local_id { - Some(id) => id.public(), + Some(id) => id, None => return Ok(()), }; @@ -829,10 +829,10 @@ where } fn precommitted(&self, round: RoundNumber, precommit: Precommit) -> Result<(), Self::Error> { - let local_id = crate::is_voter(&self.voters, &self.config.keystore); + let local_id = crate::is_voter(&self.voters, self.config.keystore.as_ref()); let local_id = match local_id { - Some(id) => id.public(), + Some(id) => id, None => return Ok(()), }; diff --git a/client/finality-grandpa/src/import.rs b/client/finality-grandpa/src/import.rs index 7e3799b1e2..b37ab7907a 100644 --- a/client/finality-grandpa/src/import.rs +++ b/client/finality-grandpa/src/import.rs @@ -669,6 +669,7 @@ where Error::Blockchain(error) => ConsensusError::ClientImport(error), Error::Client(error) => ConsensusError::ClientImport(error.to_string()), Error::Safety(error) => ConsensusError::ClientImport(error), + Error::Signing(error) => ConsensusError::ClientImport(error), Error::Timer(error) => ConsensusError::ClientImport(error.to_string()), }); }, diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index 7b20d082a0..481544b5c6 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -56,8 +56,10 @@ #![warn(missing_docs)] -use futures::prelude::*; -use futures::StreamExt; +use futures::{ + prelude::*, + StreamExt, +}; use log::{debug, info}; use sc_client_api::{ backend::{AuxStore, Backend}, @@ -70,10 +72,13 @@ use sp_api::ProvideRuntimeApi; use sp_blockchain::{HeaderBackend, Error as ClientError, HeaderMetadata}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{NumberFor, Block as BlockT, DigestFor, Zero}; -use sc_keystore::KeyStorePtr; use sp_inherents::InherentDataProviders; use sp_consensus::{SelectChain, BlockImport}; -use sp_core::Pair; +use sp_core::{ + crypto::Public, + traits::BareCryptoStorePtr, +}; +use sp_application_crypto::AppKey; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver}; use sc_telemetry::{telemetry, CONSENSUS_INFO, CONSENSUS_DEBUG}; use parking_lot::RwLock; @@ -131,10 +136,10 @@ use aux_schema::PersistentData; use environment::{Environment, VoterSetState}; use until_imported::UntilGlobalMessageBlocksImported; use communication::{NetworkBridge, Network as NetworkT}; -use sp_finality_grandpa::{AuthorityList, AuthorityPair, AuthoritySignature, SetId}; +use sp_finality_grandpa::{AuthorityList, AuthoritySignature, SetId}; // Re-export these two because it's just so damn convenient. -pub use sp_finality_grandpa::{AuthorityId, GrandpaApi, ScheduledChange}; +pub use sp_finality_grandpa::{AuthorityId, AuthorityPair, GrandpaApi, ScheduledChange}; use std::marker::PhantomData; #[cfg(test)] @@ -264,7 +269,7 @@ pub struct Config { /// Some local identifier of the voter. pub name: Option, /// The keystore that manages the keys of this node. - pub keystore: Option, + pub keystore: Option, } impl Config { @@ -284,6 +289,8 @@ pub enum Error { Blockchain(String), /// Could not complete a round on disk. Client(ClientError), + /// Could not sign outgoing message + Signing(String), /// An invariant has been violated (e.g. not finalizing pending change blocks in-order) Safety(String), /// A timer failed to fire. @@ -586,7 +593,7 @@ fn global_communication( voters: &Arc>, client: Arc, network: &NetworkBridge, - keystore: &Option, + keystore: &Option, metrics: Option, ) -> ( impl Stream< @@ -602,7 +609,7 @@ fn global_communication( N: NetworkT, NumberFor: BlockNumberOps, { - let is_voter = is_voter(voters, keystore).is_some(); + let is_voter = is_voter(voters, keystore.as_ref()).is_some(); // verification stream let (global_in, global_out) = network.global_communication( @@ -729,7 +736,7 @@ pub fn run_grandpa_voter( .for_each(move |_| { let curr = authorities.current_authorities(); let mut auths = curr.iter().map(|(p, _)| p); - let maybe_authority_id = authority_id(&mut auths, &conf.keystore) + let maybe_authority_id = authority_id(&mut auths, conf.keystore.as_ref()) .unwrap_or_default(); telemetry!(CONSENSUS_INFO; "afg.authority_set"; @@ -865,8 +872,7 @@ where fn rebuild_voter(&mut self) { debug!(target: "afg", "{}: Starting new voter with set ID {}", self.env.config.name(), self.env.set_id); - let authority_id = is_voter(&self.env.voters, &self.env.config.keystore) - .map(|ap| ap.public()) + let authority_id = is_voter(&self.env.voters, self.env.config.keystore.as_ref()) .unwrap_or_default(); telemetry!(CONSENSUS_DEBUG; "afg.starting_new_voter"; @@ -1089,12 +1095,16 @@ pub fn setup_disabled_grandpa( /// Returns the key pair of the node that is being used in the current voter set or `None`. fn is_voter( voters: &Arc>, - keystore: &Option, -) -> Option { + keystore: Option<&BareCryptoStorePtr>, +) -> Option { match keystore { Some(keystore) => voters .iter() - .find_map(|(p, _)| keystore.read().key_pair::(&p).ok()), + .find(|(p, _)| { + keystore.read() + .has_keys(&[(p.to_raw_vec(), AuthorityId::ID)]) + }) + .map(|(p, _)| p.clone()), None => None, } } @@ -1102,19 +1112,16 @@ fn is_voter( /// Returns the authority id of this node, if available. fn authority_id<'a, I>( authorities: &mut I, - keystore: &Option, + keystore: Option<&BareCryptoStorePtr>, ) -> Option where I: Iterator, { match keystore { Some(keystore) => { authorities - .find_map(|p| { - keystore.read().key_pair::(&p) - .ok() - .map(|ap| ap.public()) - }) - } + .find(|p| keystore.read().has_keys(&[(p.to_raw_vec(), AuthorityId::ID)])) + .cloned() + }, None => None, } } diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index cd678b3bb4..f7179d70e7 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -26,7 +26,7 @@ use finality_grandpa::{ BlockNumberOps, Error as GrandpaError, voter, voter_set::VoterSet }; use log::{debug, info, warn}; - +use sp_core::traits::BareCryptoStorePtr; use sp_consensus::SelectChain; use sc_client_api::backend::Backend; use sp_utils::mpsc::TracingUnboundedReceiver; @@ -211,7 +211,7 @@ struct ObserverWork> { client: Arc, network: NetworkBridge, persistent_data: PersistentData, - keystore: Option, + keystore: Option, voter_commands_rx: TracingUnboundedReceiver>>, _phantom: PhantomData, } @@ -228,7 +228,7 @@ where client: Arc, network: NetworkBridge, persistent_data: PersistentData, - keystore: Option, + keystore: Option, voter_commands_rx: TracingUnboundedReceiver>>, ) -> Self { @@ -239,7 +239,7 @@ where client, network, persistent_data, - keystore, + keystore: keystore.clone(), voter_commands_rx, _phantom: PhantomData, }; diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index 25e6253652..ffd8f1c8c6 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -282,7 +282,7 @@ fn make_ids(keys: &[Ed25519Keyring]) -> AuthorityList { keys.iter().map(|key| key.clone().public().into()).map(|id| (id, 1)).collect() } -fn create_keystore(authority: Ed25519Keyring) -> (KeyStorePtr, tempfile::TempDir) { +fn create_keystore(authority: Ed25519Keyring) -> (BareCryptoStorePtr, tempfile::TempDir) { let keystore_path = tempfile::tempdir().expect("Creates keystore path"); let keystore = sc_keystore::Store::open(keystore_path.path(), None).expect("Creates keystore"); keystore.write().insert_ephemeral_from_seed::(&authority.to_seed()) @@ -1050,7 +1050,7 @@ fn voter_persists_its_votes() { voter_rx: TracingUnboundedReceiver<()>, net: Arc>, client: PeersClient, - keystore: KeyStorePtr, + keystore: BareCryptoStorePtr, } impl Future for ResettableVoter { @@ -1136,7 +1136,7 @@ fn voter_persists_its_votes() { let config = Config { gossip_duration: TEST_GOSSIP_DURATION, justification_period: 32, - keystore: Some(keystore), + keystore: Some(keystore.clone()), name: Some(format!("peer#{}", 1)), is_authority: true, observer_enabled: true, @@ -1160,10 +1160,11 @@ fn voter_persists_its_votes() { ); let (round_rx, round_tx) = network.round_communication( + Some(keystore), communication::Round(1), communication::SetId(0), Arc::new(VoterSet::new(voters).unwrap()), - Some(peers[1].pair().into()), + Some(peers[1].public().into()), HasVoted::No, ); diff --git a/primitives/finality-grandpa/src/lib.rs b/primitives/finality-grandpa/src/lib.rs index 2e81c8cecb..889468a352 100644 --- a/primitives/finality-grandpa/src/lib.rs +++ b/primitives/finality-grandpa/src/lib.rs @@ -29,6 +29,9 @@ use codec::{Encode, Decode, Input, Codec}; use sp_runtime::{ConsensusEngineId, RuntimeDebug, traits::NumberFor}; use sp_std::borrow::Cow; use sp_std::vec::Vec; +#[cfg(feature = "std")] +use sp_core::traits::BareCryptoStorePtr; +use sp_std::convert::TryInto; #[cfg(feature = "std")] use log::debug; @@ -370,25 +373,31 @@ where /// Localizes the message to the given set and round and signs the payload. #[cfg(feature = "std")] pub fn sign_message( + keystore: BareCryptoStorePtr, message: grandpa::Message, - pair: &AuthorityPair, + public: AuthorityId, round: RoundNumber, set_id: SetId, -) -> grandpa::SignedMessage +) -> Option> where H: Encode, N: Encode, { - use sp_core::Pair; + use sp_core::crypto::Public; + use sp_application_crypto::AppKey; let encoded = localized_payload(round, set_id, &message); - let signature = pair.sign(&encoded[..]); + let signature = keystore.read() + .sign_with(AuthorityId::ID, &public.to_public_crypto_pair(), &encoded[..]) + .ok()? + .try_into() + .ok()?; - grandpa::SignedMessage { + Some(grandpa::SignedMessage { message, signature, - id: pair.public(), - } + id: public, + }) } /// WASM function call to check for pending changes. -- GitLab From a8bf2601825ca7a5e2ce76f49b4117d930fc71fe Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 9 Jun 2020 12:09:41 +0300 Subject: [PATCH 129/280] Revalidation tweak & logging for transaction pool (#6258) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updates and logging * fix length * Update client/transaction-pool/src/lib.rs * rename * Update client/transaction-pool/src/lib.rs Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- .../basic-authorship/src/basic_authorship.rs | 3 ++- client/transaction-pool/src/lib.rs | 3 +++ client/transaction-pool/src/revalidation.rs | 23 ++++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index f9321f5b9d..383d0ea6fc 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -234,7 +234,8 @@ impl Proposer Either::Left((iterator, _)) => iterator, Either::Right(_) => { log::warn!( - "Timeout fired waiting for transaction pool to be ready. Proceeding to block production anyway.", + "Timeout fired waiting for transaction pool at block #{}. Proceeding with production.", + self.parent_number, ); self.transaction_pool.ready() } diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 863f9f3578..ee2fd4a199 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -331,6 +331,7 @@ impl TransactionPool for BasicPool fn ready_at(&self, at: NumberFor) -> PolledIterator { if self.ready_poll.lock().updated_at() >= at { + log::trace!(target: "txpool", "Transaction pool already processed block #{}", at); let iterator: ReadyIteratorFor = Box::new(self.pool.validated_pool().ready()); return Box::pin(futures::future::ready(iterator)); } @@ -456,6 +457,8 @@ async fn prune_known_txs_for_block>( .map(|tx| pool.hash_of(&tx)) .collect::>(); + log::trace!(target: "txpool", "Pruning transactions: {:?}", hashes); + if let Err(e) = pool.prune_known(&block_id, &hashes) { log::error!("Cannot prune known in the pool {:?}!", e); } diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index 05a2076c66..b47920b7c9 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -34,7 +34,7 @@ const BACKGROUND_REVALIDATION_INTERVAL: Duration = Duration::from_millis(200); #[cfg(test)] pub const BACKGROUND_REVALIDATION_INTERVAL: Duration = Duration::from_millis(1); -const BACKGROUND_REVALIDATION_BATCH_SIZE: usize = 20; +const MIN_BACKGROUND_REVALIDATION_BATCH_SIZE: usize = 20; /// Payload from queue to worker. struct WorkerPayload { @@ -68,13 +68,20 @@ async fn batch_revalidate( let mut invalid_hashes = Vec::new(); let mut revalidated = HashMap::new(); - for ext_hash in batch { - let ext = match pool.validated_pool().ready_by_hash(&ext_hash) { - Some(ext) => ext, - None => continue, - }; + let validation_results = futures::future::join_all( + batch.into_iter().filter_map(|ext_hash| { + pool.validated_pool().ready_by_hash(&ext_hash).map(|ext| { + let api = api.clone(); + async move { + api.validate_transaction(&BlockId::Number(at), ext.source, ext.data.clone()) + .map(|validation_result| (validation_result, ext_hash.clone(), ext)).await + } + }) + }) + ).await; - match api.validate_transaction(&BlockId::Number(at), ext.source, ext.data.clone()).await { + for (validation_result, ext_hash, ext) in validation_results { + match validation_result { Ok(Err(TransactionValidityError::Invalid(err))) => { log::debug!(target: "txpool", "[{:?}]: Revalidation: invalid {:?}", ext_hash, err); invalid_hashes.push(ext_hash); @@ -131,7 +138,7 @@ impl RevalidationWorker { fn prepare_batch(&mut self) -> Vec> { let mut queued_exts = Vec::new(); - let mut left = BACKGROUND_REVALIDATION_BATCH_SIZE; + let mut left = std::cmp::max(MIN_BACKGROUND_REVALIDATION_BATCH_SIZE, self.members.len() / 4); // Take maximum of count transaction by order // which they got into the pool -- GitLab From feb334d87773331c23ef6560a55f43fcb5ef62a8 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 9 Jun 2020 12:25:56 +0200 Subject: [PATCH 130/280] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b62cbaa71..5764722373 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,9 @@ The security policy and procedures can be found in [`docs/SECURITY.md`](docs/SEC ## License -Substrate Client (`/client/*` / `sc-*`) is licensed under [GPL v3.0 with a classpath linking exception](LICENSE-GPL3), primitives (`sp-*`), FRAME (`frame-*`) and pallets (`pallets-*`), binaries (`/bin`) and all other utilities are licensed under [Apache 2.0](LICENSE-APACHE2). +- Substrate Primitives (`sp-*`), Frame (`frame-*`) and the pallets (`pallets-*`), binaries (`/bin`) and all other utilities are licensed under [Apache 2.0](LICENSE-APACHE2). +- Substrate Client (`/client/*` / `sc-*`) is licensed under [GPL v3.0 with a classpath linking exception](LICENSE-GPL3). + +The reason for the split-licensing is to ensure that for the vast majority of teams using Substrate to create feature-chains, then all changes can be made entirely in Apache2-licensed code, allowing teams full freedom over what and how they release and giving licensing clarity to commercial teams. + +In the interests of the community, we require any deeper improvements made to Substrate's core logic (e.g. Substrate's internal consensus, crypto or database code) to be contributed back so everyone can benefit. -- GitLab From 1853b9a5c4f311ff1b419f9fdc555b415606a939 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Tue, 9 Jun 2020 14:29:01 +0200 Subject: [PATCH 131/280] Allow adding a prefix to the informant (#6174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * Add a Service Configuration's field + adapt informant + provide means to CLI * CLEANUP Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * fix tests * fixed bad path to object * Change OutputFormat enum to struct * Add informant_prefix to builder and service * Revert "Change OutputFormat enum to struct" This reverts commit cd86c583c92668426c35cc174401155bf2880c1f. * Revert "fix tests" This reverts commit a3c306ebe94720f350c5bc74b9c5fcde2565d340. * Revert "Add a Service Configuration's field + adapt informant + provide means to CLI" This reverts commit 9c2e7267423305705916c30d605893524113c8e3. * Implementation using the ServiceBuilder * reduce line length * fix line width again * WIP Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * WIP Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * WIP Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * use struct instead of enum * WIP Forked at: 49b15615184fad010749d3e34282f70a3845da34 Parent branch: origin/master * Update client/service/src/lib.rs Co-authored-by: Bastian Köcher * improve doc * Update client/service/src/builder.rs Co-authored-by: Bastian Köcher * Update client/service/src/builder.rs Co-authored-by: Bastian Köcher * change code * Update client/informant/src/lib.rs Co-authored-by: Bastian Köcher * enable_color * reorg log * remove macro * Removed builder for informant prefix * fix doc * Update client/informant/src/lib.rs Co-authored-by: Bastian Köcher * Update client/informant/src/lib.rs Co-authored-by: Bastian Köcher * Update client/informant/src/lib.rs Co-authored-by: Bastian Köcher * Update client/informant/src/lib.rs Co-authored-by: Bastian Köcher * Update client/service/src/builder.rs Co-authored-by: Bastian Köcher * Update client/service/src/builder.rs Co-authored-by: Bastian Köcher * Update client/service/src/builder.rs Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- Cargo.lock | 4 +- client/cli/src/runner.rs | 3 -- client/informant/Cargo.toml | 3 +- client/informant/src/display.rs | 40 ++++++++++------ client/informant/src/lib.rs | 81 ++++++++++++++++++++++++--------- client/network/src/lib.rs | 20 ++++++++ client/service/Cargo.toml | 2 +- client/service/src/builder.rs | 58 +++++++++++++++++++++++ client/service/src/lib.rs | 23 +--------- utils/browser/src/lib.rs | 5 -- 10 files changed, 171 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b94666563..283f7c77a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6315,9 +6315,10 @@ dependencies = [ "parity-util-mem", "sc-client-api", "sc-network", - "sc-service", "sp-blockchain", "sp-runtime", + "sp-transaction-pool", + "sp-utils", "wasm-timer", ] @@ -6610,6 +6611,7 @@ dependencies = [ "sc-client-db", "sc-executor", "sc-finality-grandpa", + "sc-informant", "sc-keystore", "sc-network", "sc-offchain", diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 6c220b5261..409772d7ca 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -266,9 +266,6 @@ impl Runner { { let service = service_builder(self.config)?; - let informant_future = sc_informant::build(&service, sc_informant::OutputFormat::Coloured); - let _informant_handle = self.tokio_runtime.spawn(informant_future); - // we eagerly drop the service so that the internal exit future is fired, // but we need to keep holding a reference to the global telemetry guard // and drop the runtime first. diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index 0ef6f30805..7cd678b26c 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -19,6 +19,7 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["pr wasm-timer = "0.2" sc-client-api = { version = "2.0.0-rc3", path = "../api" } sc-network = { version = "0.8.0-rc3", path = "../network" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../service" } sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } +sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } diff --git a/client/informant/src/display.rs b/client/informant/src/display.rs index 42f4989983..4491eb61d6 100644 --- a/client/informant/src/display.rs +++ b/client/informant/src/display.rs @@ -14,15 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . +use crate::OutputFormat; use ansi_term::Colour; -use sc_client_api::ClientInfo; use log::info; -use sc_network::SyncState; -use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Zero, Saturating}; -use sc_service::NetworkStatus; -use std::{convert::{TryFrom, TryInto}, fmt}; +use sc_client_api::ClientInfo; +use sc_network::{NetworkStatus, SyncState}; +use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Saturating, Zero}; +use std::{ + convert::{TryFrom, TryInto}, + fmt, +}; use wasm_timer::Instant; -use crate::OutputFormat; /// State of the informant display system. /// @@ -67,16 +69,22 @@ impl InformantDisplay { self.last_update = Instant::now(); self.last_number = Some(best_number); - let (status, target) = match (net_status.sync_state, net_status.best_seen_block) { - (SyncState::Idle, _) => ("💤 Idle".into(), "".into()), - (SyncState::Downloading, None) => (format!("⚙️ Preparing{}", speed), "".into()), - (SyncState::Downloading, Some(n)) => (format!("⚙️ Syncing{}", speed), format!(", target=#{}", n)), + let (level, status, target) = match (net_status.sync_state, net_status.best_seen_block) { + (SyncState::Idle, _) => ("💤", "Idle".into(), "".into()), + (SyncState::Downloading, None) => ("⚙️ ", format!("Preparing{}", speed), "".into()), + (SyncState::Downloading, Some(n)) => ( + "⚙️ ", + format!("Syncing{}", speed), + format!(", target=#{}", n), + ), }; - if self.format == OutputFormat::Coloured { + if self.format.enable_color { info!( target: "substrate", - "{}{} ({} peers), best: #{} ({}), finalized #{} ({}), {} {}", + "{} {}{}{} ({} peers), best: #{} ({}), finalized #{} ({}), {} {}", + level, + self.format.prefix, Colour::White.bold().paint(&status), target, Colour::White.bold().paint(format!("{}", num_connected_peers)), @@ -86,11 +94,13 @@ impl InformantDisplay { info.chain.finalized_hash, Colour::Green.paint(format!("⬇ {}", TransferRateFormat(net_status.average_download_per_sec))), Colour::Red.paint(format!("⬆ {}", TransferRateFormat(net_status.average_upload_per_sec))), - ); + ) } else { info!( target: "substrate", - "{}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}", + "{} {}{}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}", + level, + self.format.prefix, status, target, num_connected_peers, @@ -100,7 +110,7 @@ impl InformantDisplay { info.chain.finalized_hash, TransferRateFormat(net_status.average_download_per_sec), TransferRateFormat(net_status.average_upload_per_sec), - ); + ) } } } diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 6eea9c1d04..1fe1304ff5 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -19,33 +19,66 @@ //! Console informant. Prints sync progress and block events. Runs on the calling thread. use ansi_term::Colour; -use sc_client_api::{BlockchainEvents, UsageProvider}; use futures::prelude::*; -use log::{info, warn, trace}; -use sp_runtime::traits::Header; -use sc_service::AbstractService; +use log::{info, trace, warn}; +use parity_util_mem::MallocSizeOf; +use sc_client_api::{BlockchainEvents, UsageProvider}; +use sc_network::{network_state::NetworkState, NetworkStatus}; +use sp_blockchain::HeaderMetadata; +use sp_runtime::traits::{Block as BlockT, Header}; +use sp_transaction_pool::TransactionPool; +use sp_utils::mpsc::TracingUnboundedReceiver; +use std::fmt::Display; +use std::sync::Arc; use std::time::Duration; mod display; /// The format to print telemetry output in. -#[derive(PartialEq)] -pub enum OutputFormat { - Coloured, - Plain, +#[derive(Clone)] +pub struct OutputFormat { + /// Enable color output in logs. + pub enable_color: bool, + /// Add a prefix before every log line + pub prefix: String, } -/// Creates an informant in the form of a `Future` that must be polled regularly. -pub fn build(service: &impl AbstractService, format: OutputFormat) -> impl futures::Future { - let client = service.client(); - let pool = service.transaction_pool(); - - let mut display = display::InformantDisplay::new(format); - - let display_notifications = service - .network_status(Duration::from_millis(5000)) +/// Marker trait for a type that implements `TransactionPool` and `MallocSizeOf` on `not(target_os = "unknown")`. +#[cfg(target_os = "unknown")] +pub trait TransactionPoolAndMaybeMallogSizeOf: TransactionPool {} + +/// Marker trait for a type that implements `TransactionPool` and `MallocSizeOf` on `not(target_os = "unknown")`. +#[cfg(not(target_os = "unknown"))] +pub trait TransactionPoolAndMaybeMallogSizeOf: TransactionPool + MallocSizeOf {} + +#[cfg(target_os = "unknown")] +impl TransactionPoolAndMaybeMallogSizeOf for T {} + +#[cfg(not(target_os = "unknown"))] +impl TransactionPoolAndMaybeMallogSizeOf for T {} + +/// Builds the informant and returns a `Future` that drives the informant. +pub fn build( + client: Arc, + network_status_stream_builder: impl FnOnce( + Duration, + ) -> TracingUnboundedReceiver<( + NetworkStatus, + NetworkState, + )>, + pool: Arc, + format: OutputFormat, +) -> impl futures::Future +where + C: UsageProvider + HeaderMetadata + BlockchainEvents, + >::Error: Display, +{ + let mut display = display::InformantDisplay::new(format.clone()); + + let client_1 = client.clone(); + let display_notifications = network_status_stream_builder(Duration::from_millis(5000)) .for_each(move |(net_status, _)| { - let info = client.usage_info(); + let info = client_1.usage_info(); if let Some(ref usage) = info.usage { trace!(target: "usage", "Usage statistics: {}", usage); } else { @@ -64,7 +97,6 @@ pub fn build(service: &impl AbstractService, format: OutputFormat) -> impl futur future::ready(()) }); - let client = service.client(); let mut last_best = { let info = client.usage_info(); Some((info.chain.best_number, info.chain.best_hash)) @@ -82,7 +114,8 @@ pub fn build(service: &impl AbstractService, format: OutputFormat) -> impl futur match maybe_ancestor { Ok(ref ancestor) if ancestor.hash != *last_hash => info!( - "♻️ Reorg on #{},{} to #{},{}, common ancestor #{},{}", + "♻️ {}Reorg on #{},{} to #{},{}, common ancestor #{},{}", + format.prefix, Colour::Red.bold().paint(format!("{}", last_num)), last_hash, Colour::Green.bold().paint(format!("{}", n.header.number())), n.hash, Colour::White.bold().paint(format!("{}", ancestor.number)), ancestor.hash, @@ -97,7 +130,13 @@ pub fn build(service: &impl AbstractService, format: OutputFormat) -> impl futur last_best = Some((n.header.number().clone(), n.hash.clone())); } - info!(target: "substrate", "✨ Imported #{} ({})", Colour::White.bold().paint(format!("{}", n.header.number())), n.hash); + info!( + target: "substrate", + "✨ {}Imported #{} ({})", + format.prefix, + Colour::White.bold().paint(format!("{}", n.header.number())), + n.hash, + ); future::ready(()) }); diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 0105f32ac3..73e0b525a1 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -269,6 +269,7 @@ pub use libp2p::{Multiaddr, PeerId}; pub use libp2p::multiaddr; pub use sc_peerset::ReputationChange; +use sp_runtime::traits::{Block as BlockT, NumberFor}; /// The maximum allowed number of established connections per peer. /// @@ -293,3 +294,22 @@ pub trait NetworkStateInfo { /// Returns the local Peer ID. fn local_peer_id(&self) -> PeerId; } + +/// Overview status of the network. +#[derive(Clone)] +pub struct NetworkStatus { + /// Current global sync state. + pub sync_state: SyncState, + /// Target sync block number. + pub best_seen_block: Option>, + /// Number of peers participating in syncing. + pub num_sync_peers: u32, + /// Total number of connected peers + pub num_connected_peers: usize, + /// Total number of active peers. + pub num_active_peers: usize, + /// Downloaded bytes per second averaged over the past few seconds. + pub average_download_per_sec: u64, + /// Uploaded bytes per second averaged over the past few seconds. + pub average_upload_per_sec: u64, +} diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index bd830ec8dd..74cd71a698 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -66,7 +66,7 @@ sc-rpc-server = { version = "2.0.0-rc3", path = "../rpc-servers" } sc-rpc = { version = "2.0.0-rc3", path = "../rpc" } sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } - +sc-informant = { version = "0.8.0-rc2", path = "../informant" } sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } sc-offchain = { version = "2.0.0-rc3", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 16500baae1..aa680c3bce 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -101,6 +101,7 @@ pub struct ServiceBuilder>>, marker: PhantomData<(TBl, TRtApi)>, block_announce_validator_builder: Option) -> Box + Send> + Send>>, + informant_prefix: String, } /// A utility trait for building an RPC extension given a `DenyUnsafe` instance. @@ -364,6 +365,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { rpc_extensions_builder: Box::new(|_| ()), remote_backend: None, block_announce_validator_builder: None, + informant_prefix: Default::default(), marker: PhantomData, }) } @@ -447,6 +449,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { rpc_extensions_builder: Box::new(|_| ()), remote_backend: Some(remote_blockchain), block_announce_validator_builder: None, + informant_prefix: Default::default(), marker: PhantomData, }) } @@ -541,6 +544,7 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -586,6 +590,7 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -624,6 +629,7 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -690,6 +696,7 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -746,6 +753,7 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -783,6 +791,7 @@ impl rpc_extensions_builder: Box::new(rpc_extensions_builder), remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, + informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -828,9 +837,43 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: Some(Box::new(block_announce_validator_builder)), + informant_prefix: self.informant_prefix, marker: self.marker, }) } + + /// Defines the informant's prefix for the logs. An empty string by default. + /// + /// By default substrate will show logs without a prefix. Example: + /// + /// ```text + /// 2020-05-28 15:11:06 ✨ Imported #2 (0xc21c…2ca8) + /// 2020-05-28 15:11:07 💤 Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 + /// ``` + /// + /// But you can define a prefix by using this function. Example: + /// + /// ```rust,ignore + /// service.with_informant_prefix("[Prefix] ".to_string()); + /// ``` + /// + /// This will output: + /// + /// ```text + /// 2020-05-28 15:11:06 ✨ [Prefix] Imported #2 (0xc21c…2ca8) + /// 2020-05-28 15:11:07 💤 [Prefix] Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 + /// ``` + pub fn with_informant_prefix( + self, + informant_prefix: String, + ) -> Result, Error> + where TSc: Clone, TFchr: Clone { + Ok(ServiceBuilder { + informant_prefix: informant_prefix, + ..self + }) + } } /// Implemented on `ServiceBuilder`. Allows running block commands, such as import/export/validate @@ -947,6 +990,7 @@ ServiceBuilder< rpc_extensions_builder, remote_backend, block_announce_validator_builder, + informant_prefix, } = self; sp_session::generate_initial_session_keys( @@ -1342,6 +1386,20 @@ ServiceBuilder< } } + // Spawn informant task + let network_status_sinks_1 = network_status_sinks.clone(); + let informant_future = sc_informant::build( + client.clone(), + move |interval| { + let (sink, stream) = tracing_unbounded("mpsc_network_status"); + network_status_sinks_1.lock().push(interval, sink); + stream + }, + transaction_pool.clone(), + sc_informant::OutputFormat { enable_color: true, prefix: informant_prefix }, + ); + spawn_handle.spawn("informant", informant_future); + Ok(Service { client, task_manager, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 4f2be23f87..67ac7bdb4f 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -52,11 +52,11 @@ use futures::{ sink::SinkExt, task::{Spawn, FutureObj, SpawnError}, }; -use sc_network::{NetworkService, network_state::NetworkState, PeerId}; +use sc_network::{NetworkService, NetworkStatus, network_state::NetworkState, PeerId}; use log::{log, warn, debug, error, Level}; use codec::{Encode, Decode}; use sp_runtime::generic::BlockId; -use sp_runtime::traits::{NumberFor, Block as BlockT}; +use sp_runtime::traits::Block as BlockT; use parity_util_mem::MallocSizeOf; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; @@ -487,25 +487,6 @@ fn build_network_future< }) } -/// Overview status of the network. -#[derive(Clone)] -pub struct NetworkStatus { - /// Current global sync state. - pub sync_state: sc_network::SyncState, - /// Target sync block number. - pub best_seen_block: Option>, - /// Number of peers participating in syncing. - pub num_sync_peers: u32, - /// Total number of connected peers - pub num_connected_peers: usize, - /// Total number of active peers. - pub num_active_peers: usize, - /// Downloaded bytes per second averaged over the past few seconds. - pub average_download_per_sec: u64, - /// Uploaded bytes per second averaged over the past few seconds. - pub average_upload_per_sec: u64, -} - #[cfg(not(target_os = "unknown"))] // Wrapper for HTTP and WS servers that makes sure they are properly shut down. mod waiting { diff --git a/utils/browser/src/lib.rs b/utils/browser/src/lib.rs index 408ba24cfe..19f7ad6326 100644 --- a/utils/browser/src/lib.rs +++ b/utils/browser/src/lib.rs @@ -116,11 +116,6 @@ struct RpcMessage { /// Create a Client object that connects to a service. pub fn start_client(mut service: impl AbstractService) -> Client { - // Spawn informant - wasm_bindgen_futures::spawn_local( - sc_informant::build(&service, sc_informant::OutputFormat::Plain).map(drop) - ); - // We dispatch a background task responsible for processing the service. // // The main action performed by the code below consists in polling the service with -- GitLab From 65fe00b7bd4d32398e3db7cbcdbbefedbac53df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 9 Jun 2020 14:39:50 +0200 Subject: [PATCH 132/280] Transaction pool added missed comment (#6308) --- client/transaction-pool/src/revalidation.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index b47920b7c9..cb49560662 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -71,11 +71,8 @@ async fn batch_revalidate( let validation_results = futures::future::join_all( batch.into_iter().filter_map(|ext_hash| { pool.validated_pool().ready_by_hash(&ext_hash).map(|ext| { - let api = api.clone(); - async move { - api.validate_transaction(&BlockId::Number(at), ext.source, ext.data.clone()) - .map(|validation_result| (validation_result, ext_hash.clone(), ext)).await - } + api.validate_transaction(&BlockId::Number(at), ext.source, ext.data.clone()) + .map(move |validation_result| (validation_result, ext_hash, ext)) }) }) ).await; -- GitLab From a3a51605b9aa6e695eabc1d53aab5a9f76a9ecae Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 9 Jun 2020 16:30:34 +0200 Subject: [PATCH 133/280] Add a test for lots of nodes connecting at the same time (#6247) * Add a test for lots of nodes connecting at the same time * Do small change --- client/network/src/service/tests.rs | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index 8eaa984492..8e79ae0e17 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -272,3 +272,73 @@ fn notifications_state_consistent() { } }); } + +#[test] +fn lots_of_incoming_peers_works() { + let listen_addr = config::build_multiaddr![Memory(rand::random::())]; + + let (main_node, _) = build_test_full_node(config::NetworkConfiguration { + notifications_protocols: vec![(ENGINE_ID, From::from(&b"/foo"[..]))], + listen_addresses: vec![listen_addr.clone()], + in_peers: u32::max_value(), + transport: config::TransportConfig::MemoryOnly, + .. config::NetworkConfiguration::new_local() + }); + + let main_node_peer_id = main_node.local_peer_id().clone(); + + // We spawn background tasks and push them in this `Vec`. They will all be waited upon before + // this test ends. + let mut background_tasks_to_wait = Vec::new(); + + for _ in 0..256 { + let main_node_peer_id = main_node_peer_id.clone(); + + let (_dialing_node, event_stream) = build_test_full_node(config::NetworkConfiguration { + notifications_protocols: vec![(ENGINE_ID, From::from(&b"/foo"[..]))], + listen_addresses: vec![], + reserved_nodes: vec![config::MultiaddrWithPeerId { + multiaddr: listen_addr.clone(), + peer_id: main_node_peer_id.clone(), + }], + transport: config::TransportConfig::MemoryOnly, + .. config::NetworkConfiguration::new_local() + }); + + background_tasks_to_wait.push(async_std::task::spawn(async move { + // Create a dummy timer that will "never" fire, and that will be overwritten when we + // actually need the timer. Using an Option would be technically cleaner, but it would + // make the code below way more complicated. + let mut timer = futures_timer::Delay::new(Duration::from_secs(3600 * 24 * 7)).fuse(); + + let mut event_stream = event_stream.fuse(); + loop { + futures::select! { + _ = timer => { + // Test succeeds when timer fires. + return; + } + ev = event_stream.next() => { + match ev.unwrap() { + Event::NotificationStreamOpened { remote, .. } => { + assert_eq!(remote, main_node_peer_id); + // Test succeeds after 5 seconds. This timer is here in order to + // detect a potential problem after opening. + timer = futures_timer::Delay::new(Duration::from_secs(5)).fuse(); + } + Event::NotificationStreamClosed { .. } => { + // Test failed. + panic!(); + } + _ => {} + } + } + } + } + })); + } + + futures::executor::block_on(async move { + future::join_all(background_tasks_to_wait).await + }); +} -- GitLab From 4b1d86201b07ca6ebc2bfc2fd39262c2f24102b3 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 9 Jun 2020 16:31:18 +0200 Subject: [PATCH 134/280] Introduce frozen indices. (#6307) * Introduce frozen indices. * Fix. * Bump runtime * Benchmark for freeze * Fix * fix benchmarks * update freeze weights * remove copy pasta Co-authored-by: Shawn Tabrizi --- bin/node/runtime/src/lib.rs | 4 +- frame/indices/src/benchmarking.rs | 17 +++++++- frame/indices/src/lib.rs | 70 ++++++++++++++++++++++++++----- frame/indices/src/tests.rs | 18 +++++++- 4 files changed, 94 insertions(+), 15 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 5a56ca4a7b..f92189e3c9 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -95,8 +95,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 251, - impl_version: 2, + spec_version: 252, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/indices/src/benchmarking.rs b/frame/indices/src/benchmarking.rs index 843e4e2faa..a6b543bb43 100644 --- a/frame/indices/src/benchmarking.rs +++ b/frame/indices/src/benchmarking.rs @@ -83,11 +83,25 @@ benchmarks! { T::Currency::make_free_balance_be(&recipient, BalanceOf::::max_value()); // Claim the index Indices::::claim(RawOrigin::Signed(original).into(), account_index)?; - }: _(RawOrigin::Root, recipient.clone(), account_index) + }: _(RawOrigin::Root, recipient.clone(), account_index, false) verify { assert_eq!(Accounts::::get(account_index).unwrap().0, recipient); } + freeze { + // Index being claimed + let i in 0 .. 1000; + let account_index = T::AccountIndex::from(i); + // Setup accounts + let caller: T::AccountId = account("caller", 0, SEED); + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + // Claim the index + Indices::::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?; + }: _(RawOrigin::Signed(caller.clone()), account_index) + verify { + assert_eq!(Accounts::::get(account_index).unwrap().2, true); + } + // TODO in another PR: lookup and unlookup trait weights (not critical) } @@ -104,6 +118,7 @@ mod tests { assert_ok!(test_benchmark_transfer::()); assert_ok!(test_benchmark_free::()); assert_ok!(test_benchmark_force_transfer::()); + assert_ok!(test_benchmark_freeze::()); }); } } diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index ef4e0082f4..048a5b9936 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -26,7 +26,7 @@ use sp_runtime::traits::{ StaticLookup, Member, LookupError, Zero, Saturating, AtLeast32Bit }; use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure}; -use frame_support::dispatch::DispatchResult; +use frame_support::dispatch::{DispatchResult, Weight}; use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved}; use frame_support::weights::constants::WEIGHT_PER_MICROS; use frame_system::{ensure_signed, ensure_root}; @@ -62,9 +62,9 @@ decl_storage! { pub Accounts build(|config: &GenesisConfig| config.indices.iter() .cloned() - .map(|(a, b)| (a, (b, Zero::zero()))) + .map(|(a, b)| (a, (b, Zero::zero(), false))) .collect::>() - ): map hasher(blake2_128_concat) T::AccountIndex => Option<(T::AccountId, BalanceOf)>; + ): map hasher(blake2_128_concat) T::AccountIndex => Option<(T::AccountId, BalanceOf, bool)>; } add_extra_genesis { config(indices): Vec<(T::AccountIndex, T::AccountId)>; @@ -80,6 +80,8 @@ decl_event!( IndexAssigned(AccountId, AccountIndex), /// A account index has been freed up (unassigned). IndexFreed(AccountIndex), + /// A account index has been frozen to its current account ID. + IndexFrozen(AccountIndex, AccountId), } ); @@ -93,6 +95,8 @@ decl_error! { InUse, /// The source and destination accounts are identical. NotTransfer, + /// The index is permanent and may not be freed/changed. + Permanent, } } @@ -100,6 +104,16 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin, system = frame_system { fn deposit_event() = default; + fn on_runtime_upgrade() -> Weight { + use frame_support::migration::{StorageIterator, put_storage_value}; + for (key, value) in StorageIterator::< + (T::AccountId, BalanceOf) + >::new(b"Indices", b"Accounts").drain() { + put_storage_value(b"Indices", b"Accounts", &key, (value.0, value.1, false)); + } + 1_000_000_000 + } + /// Assign an previously unassigned index. /// /// Payment: `Deposit` is reserved from the sender account. @@ -125,7 +139,7 @@ decl_module! { Accounts::::try_mutate(index, |maybe_value| { ensure!(maybe_value.is_none(), Error::::InUse); - *maybe_value = Some((who.clone(), T::Deposit::get())); + *maybe_value = Some((who.clone(), T::Deposit::get(), false)); T::Currency::reserve(&who, T::Deposit::get()) })?; Self::deposit_event(RawEvent::IndexAssigned(who, index)); @@ -158,10 +172,11 @@ decl_module! { ensure!(who != new, Error::::NotTransfer); Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { - let (account, amount) = maybe_value.take().ok_or(Error::::NotAssigned)?; + let (account, amount, perm) = maybe_value.take().ok_or(Error::::NotAssigned)?; + ensure!(!perm, Error::::Permanent); ensure!(&account == &who, Error::::NotOwner); let lost = T::Currency::repatriate_reserved(&who, &new, amount, Reserved)?; - *maybe_value = Some((new.clone(), amount.saturating_sub(lost))); + *maybe_value = Some((new.clone(), amount.saturating_sub(lost), false)); Ok(()) })?; Self::deposit_event(RawEvent::IndexAssigned(new, index)); @@ -191,7 +206,8 @@ decl_module! { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { - let (account, amount) = maybe_value.take().ok_or(Error::::NotAssigned)?; + let (account, amount, perm) = maybe_value.take().ok_or(Error::::NotAssigned)?; + ensure!(!perm, Error::::Permanent); ensure!(&account == &who, Error::::NotOwner); T::Currency::unreserve(&who, amount); Ok(()) @@ -206,6 +222,7 @@ decl_module! { /// /// - `index`: the index to be (re-)assigned. /// - `new`: the new owner of the index. This function is a no-op if it is equal to sender. + /// - `freeze`: if set to `true`, will freeze the index so it cannot be transferred. /// /// Emits `IndexAssigned` if successful. /// @@ -221,17 +238,50 @@ decl_module! { /// - Writes: Indices Accounts, System Account (original owner) /// # #[weight = T::DbWeight::get().reads_writes(2, 2) + 25 * WEIGHT_PER_MICROS] - fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex) { + fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex, freeze: bool) { ensure_root(origin)?; Accounts::::mutate(index, |maybe_value| { - if let Some((account, amount)) = maybe_value.take() { + if let Some((account, amount, _)) = maybe_value.take() { T::Currency::unreserve(&account, amount); } - *maybe_value = Some((new.clone(), Zero::zero())); + *maybe_value = Some((new.clone(), Zero::zero(), freeze)); }); Self::deposit_event(RawEvent::IndexAssigned(new, index)); } + + /// Freeze an index so it will always point to the sender account. This consumes the deposit. + /// + /// The dispatch origin for this call must be _Signed_ and the signing account must have a + /// non-frozen account `index`. + /// + /// - `index`: the index to be frozen in place. + /// + /// Emits `IndexFrozen` if successful. + /// + /// # + /// - `O(1)`. + /// - One storage mutation (codec `O(1)`). + /// - Up to one slash operation. + /// - One event. + /// ------------------- + /// - Base Weight: 30.86 µs + /// - DB Weight: 1 Read/Write (Accounts) + /// # + #[weight = T::DbWeight::get().reads_writes(1, 1) + 30 * WEIGHT_PER_MICROS] + fn freeze(origin, index: T::AccountIndex) { + let who = ensure_signed(origin)?; + + Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { + let (account, amount, perm) = maybe_value.take().ok_or(Error::::NotAssigned)?; + ensure!(!perm, Error::::Permanent); + ensure!(&account == &who, Error::::NotOwner); + T::Currency::slash_reserved(&who, amount); + *maybe_value = Some((account, Zero::zero(), true)); + Ok(()) + })?; + Self::deposit_event(RawEvent::IndexFrozen(index, who)); + } } } diff --git a/frame/indices/src/tests.rs b/frame/indices/src/tests.rs index 7f416afbd3..c5fc2b4735 100644 --- a/frame/indices/src/tests.rs +++ b/frame/indices/src/tests.rs @@ -48,6 +48,20 @@ fn freeing_should_work() { }); } +#[test] +fn freezing_should_work() { + new_test_ext().execute_with(|| { + assert_ok!(Indices::claim(Some(1).into(), 0)); + assert_noop!(Indices::freeze(Some(1).into(), 1), Error::::NotAssigned); + assert_noop!(Indices::freeze(Some(2).into(), 0), Error::::NotOwner); + assert_ok!(Indices::freeze(Some(1).into(), 0)); + assert_noop!(Indices::freeze(Some(1).into(), 0), Error::::Permanent); + + assert_noop!(Indices::free(Some(1).into(), 0), Error::::Permanent); + assert_noop!(Indices::transfer(Some(1).into(), 2, 0), Error::::Permanent); + }); +} + #[test] fn indexing_lookup_should_work() { new_test_ext().execute_with(|| { @@ -87,7 +101,7 @@ fn transfer_index_on_accounts_should_work() { fn force_transfer_index_on_preowned_should_work() { new_test_ext().execute_with(|| { assert_ok!(Indices::claim(Some(1).into(), 0)); - assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0)); + assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0, false)); assert_eq!(Balances::reserved_balance(1), 0); assert_eq!(Balances::reserved_balance(3), 0); assert_eq!(Indices::lookup_index(0), Some(3)); @@ -97,7 +111,7 @@ fn force_transfer_index_on_preowned_should_work() { #[test] fn force_transfer_index_on_free_should_work() { new_test_ext().execute_with(|| { - assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0)); + assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0, false)); assert_eq!(Balances::reserved_balance(3), 0); assert_eq!(Indices::lookup_index(0), Some(3)); }); -- GitLab From 6c01b10291935143284f4396a0986ba1285464b8 Mon Sep 17 00:00:00 2001 From: Seun Lanlege Date: Tue, 9 Jun 2020 15:35:35 +0100 Subject: [PATCH 135/280] new crate sc-light (#6235) * sc-light * remove unused deps * fix line width * move more fns to sc_light --- Cargo.lock | 22 +++++++ Cargo.toml | 1 + client/light/Cargo.toml | 27 +++++++++ .../src/client/light => light/src}/backend.rs | 0 .../client/light => light/src}/blockchain.rs | 5 +- .../light => light/src}/call_executor.rs | 0 .../src/client/light => light/src}/fetcher.rs | 4 +- client/light/src/lib.rs | 57 +++++++++++++++++++ client/service/Cargo.toml | 1 + client/service/src/builder.rs | 25 ++++---- client/service/src/client/client.rs | 5 +- .../src/client/{light/mod.rs => light.rs} | 44 +++----------- client/service/test/Cargo.toml | 1 + client/service/test/src/client/light.rs | 2 +- test-utils/client/Cargo.toml | 1 + test-utils/client/src/lib.rs | 2 +- test-utils/runtime/client/Cargo.toml | 1 + test-utils/runtime/client/src/lib.rs | 10 ++-- 18 files changed, 145 insertions(+), 63 deletions(-) create mode 100644 client/light/Cargo.toml rename client/{service/src/client/light => light/src}/backend.rs (100%) rename client/{service/src/client/light => light/src}/blockchain.rs (97%) rename client/{service/src/client/light => light/src}/call_executor.rs (100%) rename client/{service/src/client/light => light/src}/fetcher.rs (99%) create mode 100644 client/light/src/lib.rs rename client/service/src/client/{light/mod.rs => light.rs} (63%) diff --git a/Cargo.lock b/Cargo.lock index 283f7c77a3..525c2fe030 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6337,6 +6337,24 @@ dependencies = [ "tempfile", ] +[[package]] +name = "sc-light" +version = "2.0.0-rc3" +dependencies = [ + "hash-db", + "lazy_static", + "parity-scale-codec", + "parking_lot 0.10.2", + "sc-client-api", + "sc-executor", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-externalities", + "sp-runtime", + "sp-state-machine", +] + [[package]] name = "sc-network" version = "0.8.0-rc3" @@ -6613,6 +6631,7 @@ dependencies = [ "sc-finality-grandpa", "sc-informant", "sc-keystore", + "sc-light", "sc-network", "sc-offchain", "sc-rpc", @@ -6663,6 +6682,7 @@ dependencies = [ "sc-client-api", "sc-client-db", "sc-executor", + "sc-light", "sc-network", "sc-service", "sp-api", @@ -8069,6 +8089,7 @@ dependencies = [ "sc-client-db", "sc-consensus", "sc-executor", + "sc-light", "sc-service", "sp-blockchain", "sp-consensus", @@ -8130,6 +8151,7 @@ dependencies = [ "sc-block-builder", "sc-client-api", "sc-consensus", + "sc-light", "sc-service", "sp-api", "sp-blockchain", diff --git a/Cargo.toml b/Cargo.toml index 782cdcd23a..d3004fcadc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ members = [ "client/executor/runtime-test", "client/finality-grandpa", "client/informant", + "client/light", "client/tracing", "client/keystore", "client/network", diff --git a/client/light/Cargo.toml b/client/light/Cargo.toml new file mode 100644 index 0000000000..1ef35f72ac --- /dev/null +++ b/client/light/Cargo.toml @@ -0,0 +1,27 @@ +[package] +description = "components for a light client" +name = "sc-light" +version = "2.0.0-rc3" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +authors = ["Parity Technologies "] +edition = "2018" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/substrate/" +documentation = "https://docs.rs/sc-light" + +[dependencies] +parking_lot = "0.10.0" +lazy_static = "1.4.0" +hash-db = "0.15.2" +sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" } +sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" } +sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } +sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } +sc-client-api = { version = "2.0.0-rc2", path = "../api" } +sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } +codec = { package = "parity-scale-codec", version = "1.3.0" } +sc-executor = { version = "0.8.0-rc2", path = "../executor" } + +[features] +default = [] diff --git a/client/service/src/client/light/backend.rs b/client/light/src/backend.rs similarity index 100% rename from client/service/src/client/light/backend.rs rename to client/light/src/backend.rs diff --git a/client/service/src/client/light/blockchain.rs b/client/light/src/blockchain.rs similarity index 97% rename from client/service/src/client/light/blockchain.rs rename to client/light/src/blockchain.rs index c7b20de594..9d557db887 100644 --- a/client/service/src/client/light/blockchain.rs +++ b/client/light/src/blockchain.rs @@ -25,8 +25,7 @@ use sp_runtime::{Justification, generic::BlockId}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero}; use sp_blockchain::{ - HeaderMetadata, CachedHeaderMetadata, - Error as ClientError, Result as ClientResult, + HeaderMetadata, CachedHeaderMetadata, Error as ClientError, Result as ClientResult, }; pub use sc_client_api::{ backend::{ @@ -42,7 +41,7 @@ pub use sc_client_api::{ }, cht, }; -use super::fetcher::RemoteHeaderRequest; +use crate::fetcher::RemoteHeaderRequest; /// Light client blockchain. pub struct Blockchain { diff --git a/client/service/src/client/light/call_executor.rs b/client/light/src/call_executor.rs similarity index 100% rename from client/service/src/client/light/call_executor.rs rename to client/light/src/call_executor.rs diff --git a/client/service/src/client/light/fetcher.rs b/client/light/src/fetcher.rs similarity index 99% rename from client/service/src/client/light/fetcher.rs rename to client/light/src/fetcher.rs index 5422554967..88d20cafc9 100644 --- a/client/service/src/client/light/fetcher.rs +++ b/client/light/src/fetcher.rs @@ -46,8 +46,8 @@ pub use sc_client_api::{ }, cht, }; -use super::blockchain::{Blockchain}; -use super::call_executor::check_execution_proof; +use crate::blockchain::Blockchain; +use crate::call_executor::check_execution_proof; /// Remote data checker. pub struct LightDataChecker> { diff --git a/client/light/src/lib.rs b/client/light/src/lib.rs new file mode 100644 index 0000000000..deea642bd3 --- /dev/null +++ b/client/light/src/lib.rs @@ -0,0 +1,57 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +//! Light client components. + +use sp_runtime::traits::{Block as BlockT, HashFor}; +use sc_client_api::CloneableSpawn; +use std::sync::Arc; +use sp_core::traits::CodeExecutor; + +pub mod backend; +pub mod blockchain; +pub mod call_executor; +pub mod fetcher; + +pub use {backend::*, blockchain::*, call_executor::*, fetcher::*}; + +/// Create an instance of fetch data checker. +pub fn new_fetch_checker>( + blockchain: Arc>, + executor: E, + spawn_handle: Box, +) -> LightDataChecker, B, S> + where + E: CodeExecutor, +{ + LightDataChecker::new(blockchain, executor, spawn_handle) +} + +/// Create an instance of light client blockchain backend. +pub fn new_light_blockchain>(storage: S) -> Arc> { + Arc::new(Blockchain::new(storage)) +} + +/// Create an instance of light client backend. +pub fn new_light_backend(blockchain: Arc>) -> Arc>> + where + B: BlockT, + S: BlockchainStorage, +{ + Arc::new(Backend::new(blockchain)) +} diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 74cd71a698..f3687a2b8a 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -55,6 +55,7 @@ sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/applic sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } sc-network = { version = "0.8.0-rc3", path = "../network" } sc-chain-spec = { version = "2.0.0-rc3", path = "../chain-spec" } +sc-light = { version = "2.0.0-rc3", path = "../light" } sc-client-api = { version = "2.0.0-rc3", path = "../api" } sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index aa680c3bce..6e88042e36 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -19,13 +19,14 @@ use crate::{ Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm, start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle, - status_sinks, metrics::MetricsService, client::{Client, ClientConfig}, + status_sinks, metrics::MetricsService, + client::{light, Client, ClientConfig}, config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig}, }; use sc_client_api::{ - BlockchainEvents, backend::RemoteBackend, light::RemoteBlockchain, - execution_extensions::ExtensionsFactory, ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, - CloneableSpawn, UsageProvider, + self, BlockchainEvents, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, + ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider, + backend::RemoteBackend, }; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; use sc_chain_spec::get_extension; @@ -179,19 +180,19 @@ pub type TLightClient = Client< >; /// Light client backend type. -pub type TLightBackend = crate::client::light::backend::Backend< +pub type TLightBackend = sc_light::Backend< sc_client_db::light::LightStorage, HashFor, >; /// Light call executor type. -pub type TLightCallExecutor = crate::client::light::call_executor::GenesisCallExecutor< - crate::client::light::backend::Backend< +pub type TLightCallExecutor = sc_light::GenesisCallExecutor< + sc_light::Backend< sc_client_db::light::LightStorage, HashFor >, crate::client::LocalCallExecutor< - crate::client::light::backend::Backend< + sc_light::Backend< sc_client_db::light::LightStorage, HashFor >, @@ -415,18 +416,18 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { }; sc_client_db::light::LightStorage::new(db_settings)? }; - let light_blockchain = crate::client::light::new_light_blockchain(db_storage); + let light_blockchain = sc_light::new_light_blockchain(db_storage); let fetch_checker = Arc::new( - crate::client::light::new_fetch_checker::<_, TBl, _>( + sc_light::new_fetch_checker::<_, TBl, _>( light_blockchain.clone(), executor.clone(), Box::new(task_manager.spawn_handle()), ), ); let fetcher = Arc::new(sc_network::config::OnDemand::new(fetch_checker)); - let backend = crate::client::light::new_light_backend(light_blockchain); + let backend = sc_light::new_light_backend(light_blockchain); let remote_blockchain = backend.remote_blockchain(); - let client = Arc::new(crate::client::light::new_light( + let client = Arc::new(light::new_light( backend.clone(), config.chain_spec.as_storage_builder(), executor, diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index a3d2489fd0..99ad8b689e 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -84,10 +84,9 @@ use sp_utils::mpsc::{TracingUnboundedSender, tracing_unbounded}; use sp_blockchain::Error; use prometheus_endpoint::Registry; use super::{ - genesis, - light::{call_executor::prove_execution, fetcher::ChangesProof}, - block_rules::{BlockRules, LookupResult as BlockLookupResult}, + genesis, block_rules::{BlockRules, LookupResult as BlockLookupResult}, }; +use sc_light::{call_executor::prove_execution, fetcher::ChangesProof}; use rand::Rng; #[cfg(feature="test-helpers")] diff --git a/client/service/src/client/light/mod.rs b/client/service/src/client/light.rs similarity index 63% rename from client/service/src/client/light/mod.rs rename to client/service/src/client/light.rs index a3456f96a3..8b9b65fc2f 100644 --- a/client/service/src/client/light/mod.rs +++ b/client/service/src/client/light.rs @@ -16,12 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Light client components. - -pub mod backend; -pub mod blockchain; -pub mod call_executor; -pub mod fetcher; +//! Light client utilities. use std::sync::Arc; @@ -37,24 +32,8 @@ use super::client::{Client,ClientConfig}; use sc_client_api::{ light::Storage as BlockchainStorage, CloneableSpawn, }; -use self::backend::Backend; -use self::blockchain::Blockchain; -use self::call_executor::GenesisCallExecutor; -use self::fetcher::LightDataChecker; - -/// Create an instance of light client blockchain backend. -pub fn new_light_blockchain>(storage: S) -> Arc> { - Arc::new(Blockchain::new(storage)) -} +use sc_light::{Backend, GenesisCallExecutor}; -/// Create an instance of light client backend. -pub fn new_light_backend(blockchain: Arc>) -> Arc>> - where - B: BlockT, - S: BlockchainStorage, -{ - Arc::new(Backend::new(blockchain)) -} /// Create an instance of light client. pub fn new_light( @@ -79,7 +58,12 @@ pub fn new_light( S: BlockchainStorage + 'static, E: CodeExecutor + RuntimeInfo + Clone + 'static, { - let local_executor = LocalCallExecutor::new(backend.clone(), code_executor, spawn_handle.clone(), ClientConfig::default()); + let local_executor = LocalCallExecutor::new( + backend.clone(), + code_executor, + spawn_handle.clone(), + ClientConfig::default() + ); let executor = GenesisCallExecutor::new(backend.clone(), local_executor); Client::new( backend, @@ -92,15 +76,3 @@ pub fn new_light( ClientConfig::default(), ) } - -/// Create an instance of fetch data checker. -pub fn new_fetch_checker>( - blockchain: Arc>, - executor: E, - spawn_handle: Box, -) -> LightDataChecker, B, S> - where - E: CodeExecutor, -{ - LightDataChecker::new(blockchain, executor, spawn_handle) -} diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index a887c24a87..5835dc14c9 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -20,6 +20,7 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" +sc-light = { version = "2.0.0-rc3", path = "../../light" } sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } diff --git a/client/service/test/src/client/light.rs b/client/service/test/src/client/light.rs index ec319e4832..994d846c6a 100644 --- a/client/service/test/src/client/light.rs +++ b/client/service/test/src/client/light.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use sc_service::client::light::{ +use sc_light::{ call_executor::{ GenesisCallExecutor, check_execution_proof, diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index a6924e4f27..331c7e2801 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-client-api = { version = "2.0.0-rc3", path = "../../client/api" } +sc-light = { version = "2.0.0-rc3", path = "../../client/light" } sc-client-db = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../client/db" } sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" } diff --git a/test-utils/client/src/lib.rs b/test-utils/client/src/lib.rs index ffd93970f4..2ab9e4066d 100644 --- a/test-utils/client/src/lib.rs +++ b/test-utils/client/src/lib.rs @@ -46,7 +46,7 @@ use sp_runtime::traits::{Block as BlockT, BlakeTwo256}; use sc_service::client::{LocalCallExecutor, ClientConfig}; /// Test client light database backend. -pub type LightBackend = client::light::backend::Backend< +pub type LightBackend = sc_light::Backend< sc_client_db::light::LightStorage, BlakeTwo256, >; diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index d59a5f1fda..1b41b63b99 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -12,6 +12,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] +sc-light = { version = "2.0.0-rc3", path = "../../../client/light" } sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } substrate-test-client = { version = "2.0.0-rc3", path = "../../client" } diff --git a/test-utils/runtime/client/src/lib.rs b/test-utils/runtime/client/src/lib.rs index f2e049bc0f..4e9034fb4d 100644 --- a/test-utils/runtime/client/src/lib.rs +++ b/test-utils/runtime/client/src/lib.rs @@ -35,9 +35,9 @@ use sp_core::{sr25519, ChangesTrieConfiguration}; use sp_core::storage::{ChildInfo, Storage, StorageChild}; use substrate_test_runtime::genesismap::{GenesisConfig, additional_storage_with_genesis}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HashFor}; -use sc_service::client::light::fetcher::{ - Fetcher, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest, +use sc_client_api::light::{ RemoteCallRequest, RemoteChangesRequest, RemoteBodyRequest, + Fetcher, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest, }; /// A prelude to import in tests. @@ -75,10 +75,10 @@ pub type Executor = client::LocalCallExecutor< pub type LightBackend = substrate_test_client::LightBackend; /// Test client light executor. -pub type LightExecutor = client::light::call_executor::GenesisCallExecutor< +pub type LightExecutor = sc_light::GenesisCallExecutor< LightBackend, client::LocalCallExecutor< - client::light::backend::Backend< + sc_light::Backend< sc_client_db::light::LightStorage, HashFor >, @@ -347,7 +347,7 @@ pub fn new_light() -> ( ) { let storage = sc_client_db::light::LightStorage::new_test(); - let blockchain = Arc::new(client::light::blockchain::Blockchain::new(storage)); + let blockchain = Arc::new(sc_light::Blockchain::new(storage)); let backend = Arc::new(LightBackend::new(blockchain.clone())); let executor = new_native_executor(); let local_call_executor = client::LocalCallExecutor::new(backend.clone(), executor, sp_core::tasks::executor(), Default::default()); -- GitLab From 9c39e2c646371b674783d3ba2ab17e81c4411a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 9 Jun 2020 18:19:25 +0200 Subject: [PATCH 136/280] Fix ui tests for latest rust stable (#6310) --- .../tests/ui/mock_only_one_error_type.stderr | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/primitives/api/test/tests/ui/mock_only_one_error_type.stderr b/primitives/api/test/tests/ui/mock_only_one_error_type.stderr index b190c2134f..281f0024ee 100644 --- a/primitives/api/test/tests/ui/mock_only_one_error_type.stderr +++ b/primitives/api/test/tests/ui/mock_only_one_error_type.stderr @@ -5,21 +5,26 @@ error: Error type can not change between runtime apis | ^^^^ error[E0277]: the trait bound `u32: std::convert::From` is not satisfied - --> $DIR/mock_only_one_error_type.rs:15:1 - | -15 | / sp_api::mock_impl_runtime_apis! { -16 | | impl Api for MockApi { -17 | | type Error = u32; -18 | | -... | -26 | | } -27 | | } - | |_^ the trait `std::convert::From` is not implemented for `u32` - | - = help: the following implementations were found: - > - > - > - > - and 18 others - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/mock_only_one_error_type.rs:15:1 + | +15 | / sp_api::mock_impl_runtime_apis! { +16 | | impl Api for MockApi { +17 | | type Error = u32; +18 | | +... | +26 | | } +27 | | } + | |_^ the trait `std::convert::From` is not implemented for `u32` + | + ::: $WORKSPACE/primitives/api/src/lib.rs:347:35 + | +347 | type Error: std::fmt::Debug + From; + | ------------ required by this bound in `sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ApiErrorExt` + | + = help: the following implementations were found: + > + > + > + > + and 18 others + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -- GitLab From b1038c86544040ae856366b2042f0a1ab07539f2 Mon Sep 17 00:00:00 2001 From: David Craven Date: Wed, 10 Jun 2020 08:36:37 +0200 Subject: [PATCH 137/280] Expose light client. (#6313) --- bin/node-template/node/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bin/node-template/node/src/lib.rs diff --git a/bin/node-template/node/src/lib.rs b/bin/node-template/node/src/lib.rs new file mode 100644 index 0000000000..38e43372ca --- /dev/null +++ b/bin/node-template/node/src/lib.rs @@ -0,0 +1,2 @@ +pub mod chain_spec; +pub mod service; -- GitLab From 571cfc15c3e8349520939cc3ab58ca2df14ebc77 Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Wed, 10 Jun 2020 11:10:02 +0200 Subject: [PATCH 138/280] Fix nits in rpc error display. (#6302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve rpc error display. * Apply review suggestion. * Apply review suggestion. * Update client/rpc-api/src/author/error.rs * Fix custom. Co-authored-by: Bastian Köcher --- client/rpc-api/src/author/error.rs | 13 +++++++++++-- client/transaction-pool/src/api.rs | 4 ++-- primitives/runtime/src/transaction_validity.rs | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/client/rpc-api/src/author/error.rs b/client/rpc-api/src/author/error.rs index e6ee36cdce..69c036be95 100644 --- a/client/rpc-api/src/author/error.rs +++ b/client/rpc-api/src/author/error.rs @@ -20,6 +20,7 @@ use crate::errors; use jsonrpc_core as rpc; +use sp_runtime::transaction_validity::InvalidTransaction; /// Author RPC Result type. pub type Result = std::result::Result; @@ -114,10 +115,18 @@ impl From for rpc::Error { message: format!("Verification Error: {}", e).into(), data: Some(format!("{:?}", e).into()), }, - Error::Pool(PoolError::InvalidTransaction(e)) => rpc::Error { + Error::Pool(PoolError::InvalidTransaction(InvalidTransaction::Custom(e))) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_INVALID_TX), message: "Invalid Transaction".into(), - data: serde_json::to_value(e).ok(), + data: Some(format!("Custom error: {}", e).into()), + }, + Error::Pool(PoolError::InvalidTransaction(e)) => { + let msg: &str = e.into(); + rpc::Error { + code: rpc::ErrorCode::ServerError(POOL_INVALID_TX), + message: "Invalid Transaction".into(), + data: Some(msg.into()), + } }, Error::Pool(PoolError::UnknownTransaction(e)) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_UNKNOWN_VALIDITY), diff --git a/client/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs index 79315c2724..c7665022a5 100644 --- a/client/transaction-pool/src/api.rs +++ b/client/transaction-pool/src/api.rs @@ -64,7 +64,7 @@ where Client: ProvideRuntimeApi + BlockBackend + BlockIdTo, Client: Send + Sync + 'static, Client::Api: TaggedTransactionQueue, - sp_api::ApiErrorFor: Send, + sp_api::ApiErrorFor: Send + std::fmt::Display, { type Block = Block; type Error = error::Error; @@ -105,7 +105,7 @@ where #[allow(deprecated)] // old validate_transaction runtime_api.validate_transaction_before_version_2(&at, uxt) }; - let res = res.map_err(|e| Error::RuntimeApi(format!("{:?}", e))); + let res = res.map_err(|e| Error::RuntimeApi(e.to_string())); if let Err(e) = tx.send(res) { log::warn!("Unable to send a validate transaction result: {:?}", e); } diff --git a/primitives/runtime/src/transaction_validity.rs b/primitives/runtime/src/transaction_validity.rs index fc2465a068..1aad9e75ae 100644 --- a/primitives/runtime/src/transaction_validity.rs +++ b/primitives/runtime/src/transaction_validity.rs @@ -104,7 +104,7 @@ impl From for &'static str { InvalidTransaction::BadMandatory => "A call was labelled as mandatory, but resulted in an Error.", InvalidTransaction::MandatoryDispatch => - "Tranaction dispatch is mandatory; transactions may not have mandatory dispatches.", + "Transaction dispatch is mandatory; transactions may not have mandatory dispatches.", InvalidTransaction::Custom(_) => "InvalidTransaction custom error", } } -- GitLab From e2a6c3e58c4d13b1f08bfd93b0373cb59b44aa61 Mon Sep 17 00:00:00 2001 From: Shaopeng Wang Date: Wed, 10 Jun 2020 21:11:26 +1200 Subject: [PATCH 139/280] "OR gate" for EnsureOrigin (#6237) * 'OR gate' for EnsureOrigin. * Formatting. * More formatting. * Add docstring; Update 'Success' type. * Bump runtime impl_version. * Fix successful_origin. * Add either into std feature list. * Update docs. --- Cargo.lock | 1 + bin/node/runtime/src/lib.rs | 40 +++++++++++++++++++++++++---------- frame/identity/src/lib.rs | 12 ++++------- frame/membership/src/lib.rs | 26 ++++++----------------- frame/nicks/src/lib.rs | 10 +++------ frame/scored-pool/src/lib.rs | 8 ++----- frame/staking/src/lib.rs | 4 +--- frame/system/src/lib.rs | 39 ++++++++++++++++++++++++++++++++-- frame/treasury/src/lib.rs | 10 +++------ primitives/runtime/Cargo.toml | 2 ++ primitives/runtime/src/lib.rs | 2 ++ 11 files changed, 91 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 525c2fe030..9d2d6caa62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7586,6 +7586,7 @@ dependencies = [ name = "sp-runtime" version = "2.0.0-rc3" dependencies = [ + "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index f92189e3c9..d64f641ea9 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -32,6 +32,7 @@ use frame_support::{ }, traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier}, }; +use frame_system::{EnsureRoot, EnsureOneOf}; use frame_support::traits::{Filter, InstanceFilter}; use codec::{Encode, Decode}; use sp_core::{ @@ -96,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 252, - impl_version: 0, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; @@ -410,7 +411,11 @@ impl pallet_staking::Trait for Runtime { type BondingDuration = BondingDuration; type SlashDeferDuration = SlashDeferDuration; /// A super-majority of the council can cancel the slash. - type SlashCancelOrigin = pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>; + type SlashCancelOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective> + >; type SessionInterface = Self; type RewardCurve = RewardCurve; type NextNewSession = Session; @@ -528,13 +533,18 @@ impl pallet_collective::Trait for Runtime { type MaxProposals = TechnicalMaxProposals; } +type EnsureRootOrHalfCouncil = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective> +>; impl pallet_membership::Trait for Runtime { type Event = Event; - type AddOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; - type RemoveOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; - type SwapOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; - type ResetOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; - type PrimeOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; + type AddOrigin = EnsureRootOrHalfCouncil; + type RemoveOrigin = EnsureRootOrHalfCouncil; + type SwapOrigin = EnsureRootOrHalfCouncil; + type ResetOrigin = EnsureRootOrHalfCouncil; + type PrimeOrigin = EnsureRootOrHalfCouncil; type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; } @@ -554,8 +564,16 @@ parameter_types! { impl pallet_treasury::Trait for Runtime { type ModuleId = TreasuryModuleId; type Currency = Balances; - type ApproveOrigin = pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>; - type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>; + type ApproveOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective> + >; + type RejectOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective> + >; type Tippers = Elections; type TipCountdown = TipCountdown; type TipFindersFee = TipFindersFee; @@ -734,8 +752,8 @@ impl pallet_identity::Trait for Runtime { type MaxAdditionalFields = MaxAdditionalFields; type MaxRegistrars = MaxRegistrars; type Slashed = Treasury; - type ForceOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; - type RegistrarOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; + type ForceOrigin = EnsureRootOrHalfCouncil; + type RegistrarOrigin = EnsureRootOrHalfCouncil; } parameter_types! { diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index 2b58437685..eddf89997f 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -78,7 +78,7 @@ use frame_support::{ traits::{Currency, ReservableCurrency, OnUnbalanced, Get, BalanceStatus, EnsureOrigin}, weights::Weight, }; -use frame_system::{self as system, ensure_signed, ensure_root}; +use frame_system::{self as system, ensure_signed}; mod benchmarking; @@ -635,9 +635,7 @@ decl_module! { /// # #[weight = weight_for::add_registrar::(T::MaxRegistrars::get().into()) ] fn add_registrar(origin, account: T::AccountId) -> DispatchResultWithPostInfo { - T::RegistrarOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::RegistrarOrigin::ensure_origin(origin)?; let (i, registrar_count) = >::try_mutate( |registrars| -> Result<(RegistrarIndex, usize), DispatchError> { @@ -1108,9 +1106,7 @@ decl_module! { T::MaxAdditionalFields::get().into(), // X )] fn kill_identity(origin, target: ::Source) -> DispatchResultWithPostInfo { - T::ForceOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ForceOrigin::ensure_origin(origin)?; // Figure out who we're meant to be clearing. let target = T::Lookup::lookup(target)?; @@ -1435,7 +1431,7 @@ mod tests { new_test_ext().execute_with(|| { assert_ok!(Identity::set_identity(Origin::signed(10), ten())); assert_ok!(Identity::set_subs(Origin::signed(10), vec![(20, Data::Raw(vec![40; 1]))])); - assert_ok!(Identity::kill_identity(Origin::ROOT, 10)); + assert_ok!(Identity::kill_identity(Origin::signed(2), 10)); assert_eq!(Balances::free_balance(10), 80); assert!(Identity::super_of(20).is_none()); }); diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 669964c70c..cfcc17238a 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -28,7 +28,7 @@ use frame_support::{ decl_module, decl_storage, decl_event, decl_error, traits::{ChangeMembers, InitializeMembers, EnsureOrigin}, }; -use frame_system::{self as system, ensure_root, ensure_signed}; +use frame_system::{self as system, ensure_signed}; pub trait Trait: frame_system::Trait { /// The overarching event type. @@ -120,9 +120,7 @@ decl_module! { /// May only be called from `AddOrigin` or root. #[weight = 50_000_000] pub fn add_member(origin, who: T::AccountId) { - T::AddOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::AddOrigin::ensure_origin(origin)?; let mut members = >::get(); let location = members.binary_search(&who).err().ok_or(Error::::AlreadyMember)?; @@ -139,9 +137,7 @@ decl_module! { /// May only be called from `RemoveOrigin` or root. #[weight = 50_000_000] pub fn remove_member(origin, who: T::AccountId) { - T::RemoveOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::RemoveOrigin::ensure_origin(origin)?; let mut members = >::get(); let location = members.binary_search(&who).ok().ok_or(Error::::NotMember)?; @@ -161,9 +157,7 @@ decl_module! { /// Prime membership is *not* passed from `remove` to `add`, if extant. #[weight = 50_000_000] pub fn swap_member(origin, remove: T::AccountId, add: T::AccountId) { - T::SwapOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::SwapOrigin::ensure_origin(origin)?; if remove == add { return Ok(()) } @@ -190,9 +184,7 @@ decl_module! { /// May only be called from `ResetOrigin` or root. #[weight = 50_000_000] pub fn reset_members(origin, members: Vec) { - T::ResetOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ResetOrigin::ensure_origin(origin)?; let mut members = members; members.sort(); @@ -241,9 +233,7 @@ decl_module! { /// Set the prime member. Must be a current member. #[weight = 50_000_000] pub fn set_prime(origin, who: T::AccountId) { - T::PrimeOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::PrimeOrigin::ensure_origin(origin)?; Self::members().binary_search(&who).ok().ok_or(Error::::NotMember)?; Prime::::put(&who); T::MembershipChanged::set_prime(Some(who)); @@ -252,9 +242,7 @@ decl_module! { /// Remove the prime member if it exists. #[weight = 50_000_000] pub fn clear_prime(origin) { - T::PrimeOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::PrimeOrigin::ensure_origin(origin)?; Prime::::kill(); T::MembershipChanged::set_prime(None); } diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 11b23443d6..35416aa8eb 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -47,7 +47,7 @@ use frame_support::{ decl_module, decl_event, decl_storage, ensure, decl_error, traits::{Currency, EnsureOrigin, ReservableCurrency, OnUnbalanced, Get}, }; -use frame_system::{self as system, ensure_signed, ensure_root}; +use frame_system::{self as system, ensure_signed}; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; type NegativeImbalanceOf = <::Currency as Currency<::AccountId>>::NegativeImbalance; @@ -197,9 +197,7 @@ decl_module! { /// # #[weight = 70_000_000] fn kill_name(origin, target: ::Source) { - T::ForceOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ForceOrigin::ensure_origin(origin)?; // Figure out who we're meant to be clearing. let target = T::Lookup::lookup(target)?; @@ -225,9 +223,7 @@ decl_module! { /// # #[weight = 70_000_000] fn force_name(origin, target: ::Source, name: Vec) { - T::ForceOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ForceOrigin::ensure_origin(origin)?; let target = T::Lookup::lookup(target)?; let deposit = >::get(&target).map(|x| x.1).unwrap_or_else(Zero::zero); diff --git a/frame/scored-pool/src/lib.rs b/frame/scored-pool/src/lib.rs index ba56298493..5131a663e0 100644 --- a/frame/scored-pool/src/lib.rs +++ b/frame/scored-pool/src/lib.rs @@ -318,9 +318,7 @@ decl_module! { dest: ::Source, index: u32 ) { - T::KickOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::KickOrigin::ensure_origin(origin)?; let who = T::Lookup::lookup(dest)?; @@ -344,9 +342,7 @@ decl_module! { index: u32, score: T::Score ) { - T::ScoreOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ScoreOrigin::ensure_origin(origin)?; let who = T::Lookup::lookup(dest)?; diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 2a791bfa7e..bd4fb21cb5 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1906,9 +1906,7 @@ decl_module! { .saturating_add((35 * WEIGHT_PER_MICROS).saturating_mul(slash_indices.len() as Weight)) ] fn cancel_deferred_slash(origin, era: EraIndex, slash_indices: Vec) { - T::SlashCancelOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::SlashCancelOrigin::ensure_origin(origin)?; ensure!(!slash_indices.is_empty(), Error::::EmptyTargets); ensure!(is_sorted_and_unique(&slash_indices), Error::::NotSortedAndUnique); diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 74e71b8cc5..d702ad779a 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -102,7 +102,7 @@ use sp_std::marker::PhantomData; use sp_std::fmt::Debug; use sp_version::RuntimeVersion; use sp_runtime::{ - RuntimeDebug, Perbill, DispatchError, DispatchResult, + RuntimeDebug, Perbill, DispatchError, DispatchResult, Either, generic::{self, Era}, transaction_validity::{ ValidTransaction, TransactionPriority, TransactionLongevity, TransactionValidityError, @@ -847,6 +847,30 @@ impl EnsureOrigin for EnsureNever { } } +/// The "OR gate" implementation of `EnsureOrigin`. +/// +/// Origin check will pass if `L` or `R` origin check passes. `L` is tested first. +pub struct EnsureOneOf(sp_std::marker::PhantomData<(AccountId, L, R)>); +impl< + AccountId, + O: Into, O>> + From>, + L: EnsureOrigin, + R: EnsureOrigin, +> EnsureOrigin for EnsureOneOf { + type Success = Either; + fn try_origin(o: O) -> Result { + L::try_origin(o).map_or_else( + |o| R::try_origin(o).map(|o| Either::Right(o)), + |o| Ok(Either::Left(o)), + ) + } + + #[cfg(feature = "runtime-benchmarks")] + fn successful_origin() -> O { + L::successful_origin() + } +} + /// Ensure that the origin `o` represents a signed extrinsic (i.e. transaction). /// Returns `Ok` with the account that signed the extrinsic or an `Err` otherwise. pub fn ensure_signed(o: OuterOrigin) -> Result @@ -1879,7 +1903,7 @@ pub(crate) mod tests { use sp_core::H256; use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError}; use frame_support::{ - impl_outer_origin, parameter_types, assert_ok, assert_noop, + impl_outer_origin, parameter_types, assert_ok, assert_noop, assert_err, weights::WithPostDispatchInfo, }; @@ -2701,4 +2725,15 @@ pub(crate) mod tests { assert!(System::events().len() == 1); }); } + + #[test] + fn ensure_one_of_works() { + fn ensure_root_or_signed(o: RawOrigin) -> Result, Origin> { + EnsureOneOf::, EnsureSigned>::try_origin(o.into()) + } + + assert_ok!(ensure_root_or_signed(RawOrigin::Root), Either::Left(())); + assert_ok!(ensure_root_or_signed(RawOrigin::Signed(0)), Either::Right(0)); + assert_err!(ensure_root_or_signed(RawOrigin::None), Origin::from(RawOrigin::None)); + } } diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index d1fed8fa28..861a652e52 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -102,7 +102,7 @@ use sp_runtime::{Permill, ModuleId, Percent, RuntimeDebug, traits::{ use frame_support::weights::{Weight, DispatchClass}; use frame_support::traits::{Contains, ContainsLengthBound, EnsureOrigin}; use codec::{Encode, Decode}; -use frame_system::{self as system, ensure_signed, ensure_root}; +use frame_system::{self as system, ensure_signed}; mod tests; mod benchmarking; @@ -362,9 +362,7 @@ decl_module! { /// # #[weight = (130_000_000 + T::DbWeight::get().reads_writes(2, 2), DispatchClass::Operational)] fn reject_proposal(origin, #[compact] proposal_id: ProposalIndex) { - T::RejectOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::RejectOrigin::ensure_origin(origin)?; let proposal = >::take(&proposal_id).ok_or(Error::::InvalidProposalIndex)?; let value = proposal.bond; @@ -384,9 +382,7 @@ decl_module! { /// # #[weight = (34_000_000 + T::DbWeight::get().reads_writes(2, 1), DispatchClass::Operational)] fn approve_proposal(origin, #[compact] proposal_id: ProposalIndex) { - T::ApproveOrigin::try_origin(origin) - .map(|_| ()) - .or_else(ensure_root)?; + T::ApproveOrigin::ensure_origin(origin)?; ensure!(>::contains_key(proposal_id), Error::::InvalidProposalIndex); Approvals::mutate(|v| v.push(proposal_id)); diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index a81c2515c8..c38faa15a8 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -28,6 +28,7 @@ impl-trait-for-tuples = "0.1.3" sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } +either = { version = "1.5", default-features = false } [dev-dependencies] serde_json = "1.0.41" @@ -51,4 +52,5 @@ std = [ "sp-inherents/std", "parity-util-mem/std", "hash256-std-hasher/std", + "either/use_std", ] diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index fe156fe738..a8a518fd7b 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -81,6 +81,8 @@ pub use sp_arithmetic::biguint; pub use random_number_generator::RandomNumberGenerator; +pub use either::Either; + /// An abstraction over justification for a block's validity under a consensus algorithm. /// /// Essentially a finality proof. The exact formulation will vary between consensus -- GitLab From 69034ef28347bc2a632d09f1dc4c7bc32541634f Mon Sep 17 00:00:00 2001 From: Denis Pisarev Date: Wed, 10 Jun 2020 13:12:21 +0200 Subject: [PATCH 140/280] New CI image (#6223) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix (ci): hotfix Docker release * change (ci): moving to the tested CI image with a proper name * change (ci): rename substrate-ci-linux * Reduce the lots_of_incoming_peers_works test load (#6314) * change (ci): moving to the tested CI image with a proper name * change (ci): rename substrate-ci-linux * Reduce the lots_of_incoming_peers_works test load (#6314) Co-authored-by: Bastian Köcher Co-authored-by: Pierre Krieger --- .gitlab-ci.yml | 2 +- client/network/src/service/tests.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bdf614063a..bd4fc65e85 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,7 +58,7 @@ default: name: parity-build .docker-env: &docker-env - image: parity/rust-builder:latest + image: paritytech/ci-linux:production before_script: - rustup show - cargo --version diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index 8e79ae0e17..b2a91af5bd 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -291,7 +291,7 @@ fn lots_of_incoming_peers_works() { // this test ends. let mut background_tasks_to_wait = Vec::new(); - for _ in 0..256 { + for _ in 0..32 { let main_node_peer_id = main_node_peer_id.clone(); let (_dialing_node, event_stream) = build_test_full_node(config::NetworkConfiguration { -- GitLab From a684e831b2a12e696240168a3fcc9c6affcf146b Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Wed, 10 Jun 2020 13:13:25 +0200 Subject: [PATCH 141/280] Add a feature to create automatically a random temporary directory for base path & remove `Clone` (#6221) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit Forked at: 342caad3074076a4fde0472719f6a473df839e42 Parent branch: origin/master * Add a feature to create automatically a temporary directory for base path * doc fix and todos * use parking_lot instead * use refcell instead since we stay in the main thread * remove Clone derives * add test * solving dependency issue * clarifying doc * conflict argument with base-path * WIP Forked at: 342caad3074076a4fde0472719f6a473df839e42 Parent branch: origin/master * revert dep deletion * fixing test and making base_path optional * hold basepath while the service is running * fixes * Update client/cli/src/params/shared_params.rs Co-authored-by: Bastian Köcher * Update client/service/Cargo.toml Co-authored-by: Bastian Köcher * Update client/cli/src/commands/mod.rs Co-authored-by: Bastian Köcher * Update client/service/src/config.rs Co-authored-by: Bastian Köcher * WIP Forked at: 342caad3074076a4fde0472719f6a473df839e42 Parent branch: origin/master * improve doc Co-authored-by: Bastian Köcher --- Cargo.lock | 3 +- bin/node/cli/src/cli.rs | 4 +- bin/node/cli/tests/temp_base_path_works.rs | 72 +++++++++++++++++++ bin/node/inspect/src/cli.rs | 4 +- client/cli/Cargo.toml | 1 - client/cli/src/commands/build_spec_cmd.rs | 2 +- client/cli/src/commands/check_block_cmd.rs | 2 +- client/cli/src/commands/export_blocks_cmd.rs | 2 +- client/cli/src/commands/export_state_cmd.rs | 4 +- client/cli/src/commands/import_blocks_cmd.rs | 2 +- client/cli/src/commands/mod.rs | 7 +- client/cli/src/commands/purge_chain_cmd.rs | 2 +- client/cli/src/commands/revert_cmd.rs | 2 +- client/cli/src/commands/run_cmd.rs | 24 ++++++- client/cli/src/config.rs | 23 +++--- client/cli/src/params/database_params.rs | 2 +- client/cli/src/params/import_params.rs | 4 +- client/cli/src/params/keystore_params.rs | 2 +- client/cli/src/params/mod.rs | 4 +- client/cli/src/params/network_params.rs | 2 +- client/cli/src/params/node_key_params.rs | 2 +- .../cli/src/params/offchain_worker_params.rs | 2 +- client/cli/src/params/pruning_params.rs | 2 +- client/cli/src/params/shared_params.rs | 14 ++-- .../cli/src/params/transaction_pool_params.rs | 2 +- client/cli/src/runner.rs | 4 ++ client/service/Cargo.toml | 3 + client/service/src/builder.rs | 1 + client/service/src/config.rs | 62 +++++++++++++++- client/service/src/lib.rs | 24 +++++-- client/service/test/src/lib.rs | 3 +- utils/browser/src/lib.rs | 1 + utils/frame/benchmarking-cli/src/lib.rs | 2 +- 33 files changed, 227 insertions(+), 63 deletions(-) create mode 100644 bin/node/cli/tests/temp_base_path_works.rs diff --git a/Cargo.lock b/Cargo.lock index 9d2d6caa62..83c98c65c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5829,7 +5829,6 @@ dependencies = [ "atty", "chrono", "derive_more", - "directories", "env_logger 0.7.1", "fdlimit", "futures 0.3.4", @@ -6607,6 +6606,7 @@ name = "sc-service" version = "0.8.0-rc3" dependencies = [ "derive_more", + "directories", "exit-future", "futures 0.1.29", "futures 0.3.4", @@ -6662,6 +6662,7 @@ dependencies = [ "substrate-prometheus-endpoint", "substrate-test-runtime-client", "sysinfo", + "tempfile", "tracing", "wasm-timer", ] diff --git a/bin/node/cli/src/cli.rs b/bin/node/cli/src/cli.rs index 0156faf47e..29e916fe01 100644 --- a/bin/node/cli/src/cli.rs +++ b/bin/node/cli/src/cli.rs @@ -20,7 +20,7 @@ use sc_cli::RunCmd; use structopt::StructOpt; /// An overarching CLI command definition. -#[derive(Clone, Debug, StructOpt)] +#[derive(Debug, StructOpt)] pub struct Cli { /// Possible subcommand with parameters. #[structopt(subcommand)] @@ -31,7 +31,7 @@ pub struct Cli { } /// Possible subcommands of the main binary. -#[derive(Clone, Debug, StructOpt)] +#[derive(Debug, StructOpt)] pub enum Subcommand { /// A set of base subcommands handled by `sc_cli`. #[structopt(flatten)] diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs new file mode 100644 index 0000000000..9351568d87 --- /dev/null +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -0,0 +1,72 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +#![cfg(unix)] + +use assert_cmd::cargo::cargo_bin; +use nix::sys::signal::{kill, Signal::SIGINT}; +use nix::unistd::Pid; +use regex::Regex; +use std::convert::TryInto; +use std::io::Read; +use std::path::PathBuf; +use std::process::{Command, Stdio}; +use std::thread; +use std::time::Duration; + +pub mod common; + +#[test] +fn temp_base_path_works() { + let mut cmd = Command::new(cargo_bin("substrate")); + + let mut cmd = cmd + .args(&["--dev", "--tmp"]) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .unwrap(); + + // Let it produce some blocks. + thread::sleep(Duration::from_secs(30)); + assert!( + cmd.try_wait().unwrap().is_none(), + "the process should still be running" + ); + + // Stop the process + kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); + assert!(common::wait_for(&mut cmd, 40) + .map(|x| x.success()) + .unwrap_or_default()); + + // Ensure the database has been deleted + let mut stderr = String::new(); + cmd.stderr.unwrap().read_to_string(&mut stderr).unwrap(); + let re = Regex::new(r"Database: .+ at (\S+)").unwrap(); + let db_path = PathBuf::from( + re.captures(stderr.as_str()) + .unwrap() + .get(1) + .unwrap() + .as_str() + .to_string(), + ); + + assert!(!db_path.exists()); +} diff --git a/bin/node/inspect/src/cli.rs b/bin/node/inspect/src/cli.rs index 4475d31755..d66644bab5 100644 --- a/bin/node/inspect/src/cli.rs +++ b/bin/node/inspect/src/cli.rs @@ -23,7 +23,7 @@ use sc_cli::{ImportParams, SharedParams}; use structopt::StructOpt; /// The `inspect` command used to print decoded chain data. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct InspectCmd { #[allow(missing_docs)] #[structopt(flatten)] @@ -39,7 +39,7 @@ pub struct InspectCmd { } /// A possible inspect sub-commands. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub enum InspectSubCmd { /// Decode block with native version of runtime and print out the details. Block { diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 4bdacfcbd2..7ffc27749b 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -20,7 +20,6 @@ regex = "1.3.1" time = "0.1.42" ansi_term = "0.12.1" lazy_static = "1.4.0" -directories = "2.0.2" tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs index d2e2ef3a54..23626359ff 100644 --- a/client/cli/src/commands/build_spec_cmd.rs +++ b/client/cli/src/commands/build_spec_cmd.rs @@ -27,7 +27,7 @@ use structopt::StructOpt; use std::io::Write; /// The `build-spec` command used to build a specification. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct BuildSpecCmd { /// Force raw genesis storage output. #[structopt(long = "raw")] diff --git a/client/cli/src/commands/check_block_cmd.rs b/client/cli/src/commands/check_block_cmd.rs index d1241f010d..c000ea7fb1 100644 --- a/client/cli/src/commands/check_block_cmd.rs +++ b/client/cli/src/commands/check_block_cmd.rs @@ -25,7 +25,7 @@ use std::{fmt::Debug, str::FromStr}; use structopt::StructOpt; /// The `check-block` command used to validate blocks. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct CheckBlockCmd { /// Block hash or number #[structopt(value_name = "HASH or NUMBER")] diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs index 2fdc408250..7c523c0555 100644 --- a/client/cli/src/commands/export_blocks_cmd.rs +++ b/client/cli/src/commands/export_blocks_cmd.rs @@ -31,7 +31,7 @@ use std::path::PathBuf; use structopt::StructOpt; /// The `export-blocks` command used to export blocks. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct ExportBlocksCmd { /// Output file name or stdout if unspecified. #[structopt(parse(from_os_str))] diff --git a/client/cli/src/commands/export_state_cmd.rs b/client/cli/src/commands/export_state_cmd.rs index 33111e7737..23a43a178a 100644 --- a/client/cli/src/commands/export_state_cmd.rs +++ b/client/cli/src/commands/export_state_cmd.rs @@ -27,7 +27,7 @@ use structopt::StructOpt; /// The `export-state` command used to export the state of a given block into /// a chain spec. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct ExportStateCmd { /// Block hash or number. #[structopt(value_name = "HASH or NUMBER")] @@ -59,7 +59,7 @@ impl ExportStateCmd { { info!("Exporting raw state..."); let mut input_spec = config.chain_spec.cloned_box(); - let block_id = self.input.clone().map(|b| b.parse()).transpose()?; + let block_id = self.input.as_ref().map(|b| b.parse()).transpose()?; let raw_state = builder(config)?.export_raw_state(block_id)?; input_spec.set_storage(raw_state); diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs index a74f4d524c..8e178c4b97 100644 --- a/client/cli/src/commands/import_blocks_cmd.rs +++ b/client/cli/src/commands/import_blocks_cmd.rs @@ -29,7 +29,7 @@ use std::path::PathBuf; use structopt::StructOpt; /// The `import-blocks` command used to import blocks. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct ImportBlocksCmd { /// Input file or stdin if unspecified. #[structopt(parse(from_os_str))] diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs index 62757890ef..a4d5c8ca7f 100644 --- a/client/cli/src/commands/mod.rs +++ b/client/cli/src/commands/mod.rs @@ -27,11 +27,11 @@ mod run_cmd; pub use self::build_spec_cmd::BuildSpecCmd; pub use self::check_block_cmd::CheckBlockCmd; pub use self::export_blocks_cmd::ExportBlocksCmd; +pub use self::export_state_cmd::ExportStateCmd; pub use self::import_blocks_cmd::ImportBlocksCmd; pub use self::purge_chain_cmd::PurgeChainCmd; pub use self::revert_cmd::RevertCmd; pub use self::run_cmd::RunCmd; -pub use self::export_state_cmd::ExportStateCmd; use std::fmt::Debug; use structopt::StructOpt; @@ -40,7 +40,7 @@ use structopt::StructOpt; /// The core commands are split into multiple subcommands and `Run` is the default subcommand. From /// the CLI user perspective, it is not visible that `Run` is a subcommand. So, all parameters of /// `Run` are exported as main executable parameters. -#[derive(Debug, Clone, StructOpt)] +#[derive(Debug, StructOpt)] pub enum Subcommand { /// Build a spec.json file, outputs to stdout. BuildSpec(BuildSpecCmd), @@ -162,7 +162,7 @@ macro_rules! substrate_cli_subcommands { } } - fn base_path(&self) -> $crate::Result<::std::option::Option<::std::path::PathBuf>> { + fn base_path(&self) -> $crate::Result<::std::option::Option> { match self { $($enum::$variant(cmd) => cmd.base_path()),* } @@ -409,4 +409,3 @@ macro_rules! substrate_cli_subcommands { substrate_cli_subcommands!( Subcommand => BuildSpec, ExportBlocks, ImportBlocks, CheckBlock, Revert, PurgeChain, ExportState ); - diff --git a/client/cli/src/commands/purge_chain_cmd.rs b/client/cli/src/commands/purge_chain_cmd.rs index 9d364a45f7..053f427309 100644 --- a/client/cli/src/commands/purge_chain_cmd.rs +++ b/client/cli/src/commands/purge_chain_cmd.rs @@ -26,7 +26,7 @@ use std::io::{self, Write}; use structopt::StructOpt; /// The `purge-chain` command used to remove the whole chain. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct PurgeChainCmd { /// Skip interactive prompt by answering yes automatically. #[structopt(short = "y")] diff --git a/client/cli/src/commands/revert_cmd.rs b/client/cli/src/commands/revert_cmd.rs index 6117eaf488..1b5489df70 100644 --- a/client/cli/src/commands/revert_cmd.rs +++ b/client/cli/src/commands/revert_cmd.rs @@ -25,7 +25,7 @@ use std::fmt::Debug; use structopt::StructOpt; /// The `revert` command used revert the chain to a previous state. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct RevertCmd { /// Number of blocks to revert. #[structopt(default_value = "256")] diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index 23a410d679..82d40e6a73 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -21,13 +21,13 @@ use crate::error::{Error, Result}; use crate::params::ImportParams; use crate::params::KeystoreParams; use crate::params::NetworkParams; +use crate::params::OffchainWorkerParams; use crate::params::SharedParams; use crate::params::TransactionPoolParams; -use crate::params::OffchainWorkerParams; use crate::CliConfiguration; use regex::Regex; use sc_service::{ - config::{MultiaddrWithPeerId, PrometheusConfig, TransactionPoolOptions}, + config::{BasePath, MultiaddrWithPeerId, PrometheusConfig, TransactionPoolOptions}, ChainSpec, Role, }; use sc_telemetry::TelemetryEndpoints; @@ -35,7 +35,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use structopt::StructOpt; /// The `run` command used to run a node. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct RunCmd { /// Enable validator mode. /// @@ -250,6 +250,16 @@ pub struct RunCmd { conflicts_with_all = &[ "sentry", "public-addr" ] )] pub sentry_nodes: Vec, + + /// Run a temporary node. + /// + /// A temporary directory will be created to store the configuration and will be deleted + /// at the end of the process. + /// + /// Note: the directory is random per process execution. This directory is used as base path + /// which includes: database, node key and keystore. + #[structopt(long, conflicts_with = "base-path")] + pub tmp: bool, } impl RunCmd { @@ -446,6 +456,14 @@ impl CliConfiguration for RunCmd { fn max_runtime_instances(&self) -> Result> { Ok(self.max_runtime_instances.map(|x| x.min(256))) } + + fn base_path(&self) -> Result> { + Ok(if self.tmp { + Some(BasePath::new_temp_dir()?) + } else { + self.shared_params().base_path() + }) + } } /// Check whether a node name is considered as valid. diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index a1ee1b0cc1..1374e75daf 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -27,9 +27,9 @@ use crate::{ use names::{Generator, Name}; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_service::config::{ - Configuration, DatabaseConfig, ExtTransport, KeystoreConfig, NetworkConfiguration, - NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods, - TaskType, TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod, + BasePath, Configuration, DatabaseConfig, ExtTransport, KeystoreConfig, NetworkConfiguration, + NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods, TaskType, + TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod, }; use sc_service::{ChainSpec, TracingReceiver}; use std::future::Future; @@ -87,7 +87,7 @@ pub trait CliConfiguration: Sized { /// Get the base path of the configuration (if any) /// /// By default this is retrieved from `SharedParams`. - fn base_path(&self) -> Result> { + fn base_path(&self) -> Result> { Ok(self.shared_params().base_path()) } @@ -402,14 +402,12 @@ pub trait CliConfiguration: Sized { let is_dev = self.is_dev()?; let chain_id = self.chain_id(is_dev)?; let chain_spec = cli.load_spec(chain_id.as_str())?; - let config_dir = self + let base_path = self .base_path()? - .unwrap_or_else(|| { - directories::ProjectDirs::from("", "", C::executable_name()) - .expect("app directories exist on all supported platforms; qed") - .data_local_dir() - .into() - }) + .unwrap_or_else(|| BasePath::from_project("", "", C::executable_name())); + let config_dir = base_path + .path() + .to_path_buf() .join("chains") .join(chain_spec.id()); let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH); @@ -464,6 +462,7 @@ pub trait CliConfiguration: Sized { max_runtime_instances, announce_block: self.announce_block()?, role, + base_path: Some(base_path), }) } @@ -507,5 +506,5 @@ pub fn generate_node_name() -> String { if count < NODE_NAME_MAX_LENGTH { return node_name; } - }; + } } diff --git a/client/cli/src/params/database_params.rs b/client/cli/src/params/database_params.rs index 3ff8eb01d0..24b23f6076 100644 --- a/client/cli/src/params/database_params.rs +++ b/client/cli/src/params/database_params.rs @@ -20,7 +20,7 @@ use crate::arg_enums::Database; use structopt::StructOpt; /// Parameters for block import. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct DatabaseParams { /// Select database backend to use. #[structopt( diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs index fb683df6d3..101189bec4 100644 --- a/client/cli/src/params/import_params.rs +++ b/client/cli/src/params/import_params.rs @@ -27,7 +27,7 @@ use sc_client_api::execution_extensions::ExecutionStrategies; use structopt::StructOpt; /// Parameters for block import. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct ImportParams { #[allow(missing_docs)] #[structopt(flatten)] @@ -130,7 +130,7 @@ impl ImportParams { } /// Execution strategies parameters. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct ExecutionStrategiesParams { /// The means of execution used when calling into the runtime while syncing blocks. #[structopt( diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs index 2fd610377d..840cc51dff 100644 --- a/client/cli/src/params/keystore_params.rs +++ b/client/cli/src/params/keystore_params.rs @@ -26,7 +26,7 @@ use structopt::StructOpt; const DEFAULT_KEYSTORE_CONFIG_PATH: &'static str = "keystore"; /// Parameters of the keystore -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct KeystoreParams { /// Specify custom keystore path. #[structopt(long = "keystore-path", value_name = "PATH", parse(from_os_str))] diff --git a/client/cli/src/params/mod.rs b/client/cli/src/params/mod.rs index 3a66e5f055..f648337ed0 100644 --- a/client/cli/src/params/mod.rs +++ b/client/cli/src/params/mod.rs @@ -39,7 +39,7 @@ pub use crate::params::shared_params::*; pub use crate::params::transaction_pool_params::*; /// Wrapper type of `String` that holds an unsigned integer of arbitrary size, formatted as a decimal. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct BlockNumber(String); impl FromStr for BlockNumber { @@ -72,7 +72,7 @@ impl BlockNumber { } /// Wrapper type that is either a `Hash` or the number of a `Block`. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct BlockNumberOrHash(String); impl FromStr for BlockNumberOrHash { diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index c1639ad2b4..2e0a6f1973 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -26,7 +26,7 @@ use std::path::PathBuf; use structopt::StructOpt; /// Parameters used to create the network configuration. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct NetworkParams { /// Specify a list of bootnodes. #[structopt(long = "bootnodes", value_name = "ADDR")] diff --git a/client/cli/src/params/node_key_params.rs b/client/cli/src/params/node_key_params.rs index 7d19971ad6..689cc6c681 100644 --- a/client/cli/src/params/node_key_params.rs +++ b/client/cli/src/params/node_key_params.rs @@ -31,7 +31,7 @@ const NODE_KEY_ED25519_FILE: &str = "secret_ed25519"; /// Parameters used to create the `NodeKeyConfig`, which determines the keypair /// used for libp2p networking. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct NodeKeyParams { /// The secret key to use for libp2p networking. /// diff --git a/client/cli/src/params/offchain_worker_params.rs b/client/cli/src/params/offchain_worker_params.rs index ca99ab506e..f8d48edc47 100644 --- a/client/cli/src/params/offchain_worker_params.rs +++ b/client/cli/src/params/offchain_worker_params.rs @@ -32,7 +32,7 @@ use crate::OffchainWorkerEnabled; /// Offchain worker related parameters. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct OffchainWorkerParams { /// Should execute offchain workers on every block. /// diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index 3617935906..7db808e6d8 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -21,7 +21,7 @@ use sc_service::{PruningMode, Role}; use structopt::StructOpt; /// Parameters to define the pruning mode -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct PruningParams { /// Specify the state pruning mode, a number of blocks to keep or 'archive'. /// diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index e9440f38a1..ad9ab04070 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -16,11 +16,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use sc_service::config::BasePath; use std::path::PathBuf; use structopt::StructOpt; /// Shared parameters used by all `CoreParams`. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct SharedParams { /// Specify the chain specification (one of dev, local, or staging). #[structopt(long, value_name = "CHAIN_SPEC")] @@ -31,12 +32,7 @@ pub struct SharedParams { pub dev: bool, /// Specify custom base path. - #[structopt( - long, - short = "d", - value_name = "PATH", - parse(from_os_str) - )] + #[structopt(long, short = "d", value_name = "PATH", parse(from_os_str))] pub base_path: Option, /// Sets a custom logging filter. Syntax is =, e.g. -lsync=debug. @@ -49,8 +45,8 @@ pub struct SharedParams { impl SharedParams { /// Specify custom base path. - pub fn base_path(&self) -> Option { - self.base_path.clone() + pub fn base_path(&self) -> Option { + self.base_path.clone().map(Into::into) } /// Specify the development chain. diff --git a/client/cli/src/params/transaction_pool_params.rs b/client/cli/src/params/transaction_pool_params.rs index 2283c0f39f..3ad2784269 100644 --- a/client/cli/src/params/transaction_pool_params.rs +++ b/client/cli/src/params/transaction_pool_params.rs @@ -20,7 +20,7 @@ use sc_service::config::TransactionPoolOptions; use structopt::StructOpt; /// Parameters used to create the pool configuration. -#[derive(Debug, StructOpt, Clone)] +#[derive(Debug, StructOpt)] pub struct TransactionPoolParams { /// Maximum number of transactions in the transaction pool. #[structopt(long = "pool-limit", value_name = "COUNT", default_value = "8192")] diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 409772d7ca..b068af0166 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -271,6 +271,10 @@ impl Runner { // and drop the runtime first. let _telemetry = service.telemetry(); + // we hold a reference to the base path so if the base path is a temporary directory it will + // not be deleted before the tokio runtime finish to clean up + let _base_path = service.base_path(); + { let f = service.fuse(); self.tokio_runtime diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index f3687a2b8a..71e8e74c4c 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -83,6 +83,9 @@ netstat2 = "0.8.1" [target.'cfg(target_os = "linux")'.dependencies] procfs = '0.7.8' +[target.'cfg(not(target_os = "unknown"))'.dependencies] +tempfile = "3.1.0" +directories = "2.0.2" [dev-dependencies] substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 6e88042e36..c6cf8bf5df 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -1418,6 +1418,7 @@ ServiceBuilder< keystore, marker: PhantomData::, prometheus_registry: config.prometheus_config.map(|config| config.registry), + _base_path: config.base_path.map(Arc::new), }) } } diff --git a/client/service/src/config.rs b/client/service/src/config.rs index cc9c742ed6..2d4dc9dc2e 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -24,12 +24,14 @@ pub use sc_network::config::{ExtTransport, MultiaddrWithPeerId, NetworkConfigura pub use sc_executor::WasmExecutionMethod; use sc_client_api::execution_extensions::ExecutionStrategies; -use std::{future::Future, path::{PathBuf, Path}, pin::Pin, net::SocketAddr, sync::Arc}; +use std::{io, future::Future, path::{PathBuf, Path}, pin::Pin, net::SocketAddr, sync::Arc}; pub use sc_transaction_pool::txpool::Options as TransactionPoolOptions; use sc_chain_spec::ChainSpec; use sp_core::crypto::Protected; pub use sc_telemetry::TelemetryEndpoints; use prometheus_endpoint::Registry; +#[cfg(not(target_os = "unknown"))] +use tempfile::TempDir; /// Service configuration. pub struct Configuration { @@ -102,6 +104,8 @@ pub struct Configuration { pub max_runtime_instances: usize, /// Announce block automatically after they have been imported pub announce_block: bool, + /// Base path of the configuration + pub base_path: Option, } /// Type for tasks spawned by the executor. @@ -191,3 +195,59 @@ impl Default for RpcMethods { RpcMethods::Auto } } + +/// The base path that is used for everything that needs to be write on disk to run a node. +pub enum BasePath { + /// A temporary directory is used as base path and will be deleted when dropped. + #[cfg(not(target_os = "unknown"))] + Temporary(TempDir), + /// A path on the disk. + Permanenent(PathBuf), +} + +impl BasePath { + /// Create a `BasePath` instance using a temporary directory prefixed with "substrate" and use + /// it as base path. + /// + /// Note: the temporary directory will be created automatically and deleted when the `BasePath` + /// instance is dropped. + #[cfg(not(target_os = "unknown"))] + pub fn new_temp_dir() -> io::Result { + Ok(BasePath::Temporary( + tempfile::Builder::new().prefix("substrate").tempdir()?, + )) + } + + /// Create a `BasePath` instance based on an existing path on disk. + /// + /// Note: this function will not ensure that the directory exist nor create the directory. It + /// will also not delete the directory when the instance is dropped. + pub fn new>(path: P) -> BasePath { + BasePath::Permanenent(path.as_ref().to_path_buf()) + } + + /// Create a base path from values describing the project. + #[cfg(not(target_os = "unknown"))] + pub fn from_project(qualifier: &str, organization: &str, application: &str) -> BasePath { + BasePath::new( + directories::ProjectDirs::from(qualifier, organization, application) + .expect("app directories exist on all supported platforms; qed") + .data_local_dir(), + ) + } + + /// Retrieve the base path. + pub fn path(&self) -> &Path { + match self { + #[cfg(not(target_os = "unknown"))] + BasePath::Temporary(temp_dir) => temp_dir.path(), + BasePath::Permanenent(path) => path.as_path(), + } + } +} + +impl std::convert::From for BasePath { + fn from(path: PathBuf) -> Self { + BasePath::new(path) + } +} diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 67ac7bdb4f..fc0567e268 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -66,7 +66,7 @@ pub use self::builder::{ ServiceBuilder, ServiceBuilderCommand, TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor, RpcExtensionBuilder, }; -pub use config::{Configuration, DatabaseConfig, PruningMode, Role, RpcMethods, TaskType}; +pub use config::{BasePath, Configuration, DatabaseConfig, PruningMode, Role, RpcMethods, TaskType}; pub use sc_chain_spec::{ ChainSpec, GenericChainSpec, Properties, RuntimeGenesis, Extension as ChainSpecExtension, NoExtension, ChainType, @@ -110,14 +110,14 @@ pub struct Service { task_manager: TaskManager, select_chain: Option, network: Arc, - /// Sinks to propagate network status updates. - /// For each element, every time the `Interval` fires we push an element on the sender. + // Sinks to propagate network status updates. + // For each element, every time the `Interval` fires we push an element on the sender. network_status_sinks: Arc>>, transaction_pool: Arc, - /// Send a signal when a spawned essential task has concluded. The next time - /// the service future is polled it should complete with an error. + // Send a signal when a spawned essential task has concluded. The next time + // the service future is polled it should complete with an error. essential_failed_tx: TracingUnboundedSender<()>, - /// A receiver for spawned essential-tasks concluding. + // A receiver for spawned essential-tasks concluding. essential_failed_rx: TracingUnboundedReceiver<()>, rpc_handlers: sc_rpc_server::RpcHandler, _rpc: Box, @@ -127,6 +127,9 @@ pub struct Service { keystore: sc_keystore::KeyStorePtr, marker: PhantomData, prometheus_registry: Option, + // The base path is kept here because it can be a temporary directory which will be deleted + // when dropped + _base_path: Option>, } impl Unpin for Service {} @@ -210,6 +213,9 @@ pub trait AbstractService: Future> + Send + Unpin + S /// Get the prometheus metrics registry, if available. fn prometheus_registry(&self) -> Option; + + /// Get a clone of the base_path + fn base_path(&self) -> Option>; } impl AbstractService for @@ -244,7 +250,7 @@ where } fn telemetry(&self) -> Option { - self._telemetry.as_ref().map(|t| t.clone()) + self._telemetry.clone() } fn keystore(&self) -> sc_keystore::KeyStorePtr { @@ -310,6 +316,10 @@ where fn prometheus_registry(&self) -> Option { self.prometheus_registry.clone() } + + fn base_path(&self) -> Option> { + self._base_path.clone() + } } impl Future for diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 2061530825..613b0d71ce 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -34,7 +34,7 @@ use sc_service::{ GenericChainSpec, ChainSpecExtension, Configuration, - config::{DatabaseConfig, KeystoreConfig}, + config::{BasePath, DatabaseConfig, KeystoreConfig}, RuntimeGenesis, Role, Error, @@ -210,6 +210,7 @@ fn node_config Date: Wed, 10 Jun 2020 16:03:58 +0200 Subject: [PATCH 142/280] Add a [prefix]_process_start_time_seconds metric (#6315) --- client/service/src/metrics.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index f3463ffdbe..4a47d41216 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::convert::TryFrom; +use std::{convert::TryFrom, time::SystemTime}; use crate::NetworkStatus; use prometheus_endpoint::{register, Gauge, U64, F64, Registry, PrometheusError, Opts, GaugeVec}; @@ -79,6 +79,13 @@ impl PrometheusMetrics { register_globals(registry)?; + let start_time_since_epoch = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) + .unwrap_or_default(); + register(Gauge::::new( + "process_start_time_seconds", + "Number of seconds between the UNIX epoch and the moment the process started", + )?, registry)?.set(start_time_since_epoch.as_secs()); + Ok(Self { // system #[cfg(all(any(unix, windows), not(target_os = "android")))] -- GitLab From 8aeda516a75198fab6af5dba61fc7685c543057c Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Wed, 10 Jun 2020 17:08:15 +0200 Subject: [PATCH 143/280] Make NumberOrHex a common primitive. (#6321) * Make NumberOrHex a common primitive. * Update primitives/rpc/src/number.rs Co-authored-by: Nikolay Volf Co-authored-by: Nikolay Volf --- client/rpc-api/src/chain/mod.rs | 2 +- client/rpc/src/chain/mod.rs | 34 ++++++++---- client/rpc/src/chain/tests.rs | 2 +- frame/contracts/rpc/src/lib.rs | 28 ++++++++-- primitives/rpc/src/number.rs | 97 +++++++++++++++++++-------------- 5 files changed, 103 insertions(+), 60 deletions(-) diff --git a/client/rpc-api/src/chain/mod.rs b/client/rpc-api/src/chain/mod.rs index a7b26f3024..753ac5617a 100644 --- a/client/rpc-api/src/chain/mod.rs +++ b/client/rpc-api/src/chain/mod.rs @@ -49,7 +49,7 @@ pub trait ChainApi { #[rpc(name = "chain_getBlockHash", alias("chain_getHead"))] fn block_hash( &self, - hash: Option>>, + hash: Option>, ) -> Result>>; /// Get hash of the last finalized block in the canon chain. diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 7b13e7a600..8b6bf19d23 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -75,17 +75,27 @@ trait ChainBackend: Send + Sync + 'static /// Get hash of the n-th block in the canon chain. /// /// By default returns latest block hash. - fn block_hash( - &self, - number: Option>>, - ) -> Result> { - Ok(match number { - None => Some(self.client().info().best_hash), - Some(num_or_hex) => self.client() - .header(BlockId::number(num_or_hex.to_number()?)) - .map_err(client_err)? - .map(|h| h.hash()), - }) + fn block_hash(&self, number: Option) -> Result> { + match number { + None => Ok(Some(self.client().info().best_hash)), + Some(num_or_hex) => { + use std::convert::TryInto; + + // FIXME <2329>: Database seems to limit the block number to u32 for no reason + let block_num: u32 = num_or_hex.try_into().map_err(|_| { + Error::from(format!( + "`{:?}` > u32::max_value(), the max block number is u32.", + num_or_hex + )) + })?; + let block_num = >::from(block_num); + Ok(self + .client() + .header(BlockId::number(block_num)) + .map_err(client_err)? + .map(|h| h.hash())) + } + } } /// Get hash of the last finalized block in the canon chain. @@ -233,7 +243,7 @@ impl ChainApi, Block::Hash, Block::Header, Signe fn block_hash( &self, - number: Option>>> + number: Option>, ) -> Result>> { match number { None => self.backend.block_hash(None).map(ListOrValue::Value), diff --git a/client/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs index 68d46135e3..b36fc4eab1 100644 --- a/client/rpc/src/chain/tests.rs +++ b/client/rpc/src/chain/tests.rs @@ -149,7 +149,7 @@ fn should_return_block_hash() { ); assert_matches!( - api.block_hash(Some(vec![0u64.into(), 1.into(), 2.into()].into())), + api.block_hash(Some(vec![0u64.into(), 1u64.into(), 2u64.into()].into())), Ok(ListOrValue::List(list)) if list == &[client.genesis_hash().into(), block.hash().into(), None] ); } diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 89f43f42c3..18496c13af 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -32,6 +32,7 @@ use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, Header as HeaderT}, }; +use std::convert::TryInto; pub use self::gen_client::Client as ContractsClient; pub use pallet_contracts_rpc_runtime_api::{ @@ -80,7 +81,7 @@ pub struct CallRequest { origin: AccountId, dest: AccountId, value: Balance, - gas_limit: number::NumberOrHex, + gas_limit: number::NumberOrHex, input_data: Bytes, } @@ -203,9 +204,11 @@ where gas_limit, input_data, } = call_request; - let gas_limit = gas_limit.to_number().map_err(|e| Error { + + // Make sure that gas_limit fits into 64 bits. + let gas_limit: u64 = gas_limit.try_into().map_err(|_| Error { code: ErrorCode::InvalidParams, - message: e, + message: format!("{:?} doesn't fit in 64 bit unsigned value", gas_limit), data: None, })?; @@ -282,15 +285,30 @@ fn runtime_error_into_rpc_err(err: impl std::fmt::Debug) -> Error { #[cfg(test)] mod tests { use super::*; + use sp_core::U256; + + #[test] + fn call_request_should_serialize_deserialize_properly() { + type Req = CallRequest; + let req: Req = serde_json::from_str(r#" + { + "origin": "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL", + "dest": "5DRakbLVnjVrW6niwLfHGW24EeCEvDAFGEXrtaYS5M4ynoom", + "value": 0, + "gasLimit": 1000000000000, + "inputData": "0x8c97db39" + } + "#).unwrap(); + assert_eq!(req.gas_limit.into_u256(), U256::from(0xe8d4a51000u64)); + } #[test] - fn should_serialize_deserialize_properly() { + fn result_should_serialize_deserialize_properly() { fn test(expected: &str) { let res: RpcContractExecResult = serde_json::from_str(expected).unwrap(); let actual = serde_json::to_string(&res).unwrap(); assert_eq!(actual, expected); } - test(r#"{"success":{"status":5,"data":"0x1234"}}"#); test(r#"{"error":null}"#); } diff --git a/primitives/rpc/src/number.rs b/primitives/rpc/src/number.rs index 63aa643fb6..3d7e747535 100644 --- a/primitives/rpc/src/number.rs +++ b/primitives/rpc/src/number.rs @@ -15,65 +15,79 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Chain RPC Block number type. +//! A number type that can be serialized both as a number or a string that encodes a number in a +//! string. -use serde::{Serialize, Deserialize}; use std::{convert::TryFrom, fmt::Debug}; +use serde::{Serialize, Deserialize}; use sp_core::U256; -/// RPC Block number type +/// A number type that can be serialized both as a number or a string that encodes a number in a +/// string. +/// +/// We allow two representations of the block number as input. Either we deserialize to the type +/// that is specified in the block type or we attempt to parse given hex value. /// -/// We allow two representations of the block number as input. -/// Either we deserialize to the type that is specified in the block type -/// or we attempt to parse given hex value. -/// We do that for consistency with the returned type, default generic header -/// serializes block number as hex to avoid overflows in JavaScript. -#[derive(Serialize, Deserialize, Debug, PartialEq)] +/// The primary motivation for having this type is to avoid overflows when using big integers in +/// JavaScript (which we consider as an important RPC API consumer). +#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq)] #[serde(untagged)] -pub enum NumberOrHex { - /// The original header number type of block. - Number(Number), - /// Hex representation of the block number. +pub enum NumberOrHex { + /// The number represented directly. + Number(u64), + /// Hex representation of the number. Hex(U256), } -impl + From + Debug + PartialOrd> NumberOrHex { - /// Attempts to convert into concrete block number. - /// - /// Fails in case hex number is too big. - pub fn to_number(self) -> Result { - let num = match self { - NumberOrHex::Number(n) => n, - NumberOrHex::Hex(h) => { - let l = h.low_u64(); - if U256::from(l) != h { - return Err(format!("`{}` does not fit into u64 type; unsupported for now.", h)) - } else { - Number::try_from(l) - .map_err(|_| format!("`{}` does not fit into block number type.", h))? - } - }, - }; - // FIXME <2329>: Database seems to limit the block number to u32 for no reason - if num > Number::from(u32::max_value()) { - return Err(format!("`{:?}` > u32::max_value(), the max block number is u32.", num)) +impl NumberOrHex { + /// Converts this number into an U256. + pub fn into_u256(self) -> U256 { + match self { + NumberOrHex::Number(n) => n.into(), + NumberOrHex::Hex(h) => h, } - Ok(num) } } -impl From for NumberOrHex { +impl From for NumberOrHex { fn from(n: u64) -> Self { NumberOrHex::Number(n) } } -impl From for NumberOrHex { +impl From for NumberOrHex { fn from(n: U256) -> Self { NumberOrHex::Hex(n) } } +/// An error type that signals an out-of-range conversion attempt. +pub struct TryFromIntError(pub(crate) ()); + +impl TryFrom for u32 { + type Error = TryFromIntError; + fn try_from(num_or_hex: NumberOrHex) -> Result { + let num_or_hex = num_or_hex.into_u256(); + if num_or_hex > U256::from(u32::max_value()) { + return Err(TryFromIntError(())); + } else { + Ok(num_or_hex.as_u32()) + } + } +} + +impl TryFrom for u64 { + type Error = TryFromIntError; + fn try_from(num_or_hex: NumberOrHex) -> Result { + let num_or_hex = num_or_hex.into_u256(); + if num_or_hex > U256::from(u64::max_value()) { + return Err(TryFromIntError(())); + } else { + Ok(num_or_hex.as_u64()) + } + } +} + #[cfg(test)] mod tests { use super::*; @@ -81,10 +95,11 @@ mod tests { #[test] fn should_serialize_and_deserialize() { - assert_deser(r#""0x1234""#, NumberOrHex::::Hex(0x1234.into())); - assert_deser(r#""0x0""#, NumberOrHex::::Hex(0.into())); - assert_deser(r#"5"#, NumberOrHex::Number(5_u64)); - assert_deser(r#"10000"#, NumberOrHex::Number(10000_u32)); - assert_deser(r#"0"#, NumberOrHex::Number(0_u16)); + assert_deser(r#""0x1234""#, NumberOrHex::Hex(0x1234.into())); + assert_deser(r#""0x0""#, NumberOrHex::Hex(0.into())); + assert_deser(r#"5"#, NumberOrHex::Number(5)); + assert_deser(r#"10000"#, NumberOrHex::Number(10000)); + assert_deser(r#"0"#, NumberOrHex::Number(0)); + assert_deser(r#"1000000000000"#, NumberOrHex::Number(1000000000000)); } } -- GitLab From 70cfeffe4ef63fc650a7039c0a754dd4ca9db100 Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Wed, 10 Jun 2020 18:50:37 +0200 Subject: [PATCH 144/280] Avoid self-lookups in Authority Discovery (#6317) * Ensure authority discovery avoids self-lookups. Thereby additionally guard the `NetworkService` against adding the local peer to the PSM or registering a "known address" for the local peer. * Clarify comments. * See if returning errors is ok. --- client/authority-discovery/src/lib.rs | 23 ++++++++++++++++++----- client/network/src/service.rs | 27 ++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs index bc76c14331..de98e6a4a3 100644 --- a/client/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -294,13 +294,26 @@ where .authorities(&id) .map_err(Error::CallingRuntime)?; + let local_keys = match &self.role { + Role::Authority(key_store) => { + key_store.read() + .sr25519_public_keys(key_types::AUTHORITY_DISCOVERY) + .into_iter() + .collect::>() + }, + Role::Sentry => HashSet::new(), + }; + for authority_id in authorities.iter() { - if let Some(metrics) = &self.metrics { - metrics.request.inc(); - } + // Make sure we don't look up our own keys. + if !local_keys.contains(authority_id.as_ref()) { + if let Some(metrics) = &self.metrics { + metrics.request.inc(); + } - self.network - .get_value(&hash_authority_id(authority_id.as_ref())); + self.network + .get_value(&hash_authority_id(authority_id.as_ref())); + } } Ok(()) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index fd58aa631d..2297fe6a52 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -672,8 +672,15 @@ impl NetworkService { /// Adds a `PeerId` and its address as reserved. The string should encode the address /// and peer ID of the remote node. + /// + /// Returns an `Err` if the given string is not a valid multiaddress + /// or contains an invalid peer ID (which includes the local peer ID). pub fn add_reserved_peer(&self, peer: String) -> Result<(), String> { let (peer_id, addr) = parse_str_addr(&peer).map_err(|e| format!("{:?}", e))?; + // Make sure the local peer ID is never added to the PSM. + if peer_id == self.local_peer_id { + return Err("Local peer ID cannot be added as a reserved peer.".to_string()) + } self.peerset.add_reserved_peer(peer_id.clone()); let _ = self .to_worker @@ -694,12 +701,26 @@ impl NetworkService { } /// Modify a peerset priority group. + /// + /// Returns an `Err` if one of the given addresses contains an invalid + /// peer ID (which includes the local peer ID). pub fn set_priority_group(&self, group_id: String, peers: HashSet) -> Result<(), String> { - let peers = peers.into_iter().map(|p| { - parse_addr(p).map_err(|e| format!("{:?}", e)) - }).collect::, String>>()?; + let peers = peers.into_iter() + .map(|p| match parse_addr(p) { + Err(e) => Err(format!("{:?}", e)), + Ok((peer, addr)) => + // Make sure the local peer ID is never added to the PSM + // or added as a "known address", even if given. + if peer == self.local_peer_id { + Err("Local peer ID in priority group.".to_string()) + } else { + Ok((peer, addr)) + } + }) + .collect::, String>>()?; let peer_ids = peers.iter().map(|(peer_id, _addr)| peer_id.clone()).collect(); + self.peerset.set_priority_group(group_id, peer_ids); for (peer_id, addr) in peers.into_iter() { -- GitLab From 606c56d2e2f69f68f3947551224be6a3515dff60 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Thu, 11 Jun 2020 00:25:52 +0300 Subject: [PATCH 145/280] Fix quadratic iterations in transaction pool ready set (#6256) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor ready set size calc * Update client/transaction-pool/graph/src/ready.rs Co-authored-by: Bastian Köcher * remove pub * update to new variat * rename Co-authored-by: Bastian Köcher --- client/transaction-pool/graph/src/lib.rs | 1 + client/transaction-pool/graph/src/ready.rs | 22 +- .../transaction-pool/graph/src/tracked_map.rs | 189 ++++++++++++++++++ 3 files changed, 205 insertions(+), 7 deletions(-) create mode 100644 client/transaction-pool/graph/src/tracked_map.rs diff --git a/client/transaction-pool/graph/src/lib.rs b/client/transaction-pool/graph/src/lib.rs index b4646c6055..bf220ce229 100644 --- a/client/transaction-pool/graph/src/lib.rs +++ b/client/transaction-pool/graph/src/lib.rs @@ -32,6 +32,7 @@ mod pool; mod ready; mod rotator; mod validated_pool; +mod tracked_map; pub mod base_pool; pub mod watcher; diff --git a/client/transaction-pool/graph/src/ready.rs b/client/transaction-pool/graph/src/ready.rs index b5807ffce4..47289f26f0 100644 --- a/client/transaction-pool/graph/src/ready.rs +++ b/client/transaction-pool/graph/src/ready.rs @@ -25,15 +25,17 @@ use std::{ use serde::Serialize; use log::trace; -use parking_lot::RwLock; use sp_runtime::traits::Member; use sp_runtime::transaction_validity::{ TransactionTag as Tag, }; use sp_transaction_pool::error; -use crate::future::WaitingTransaction; -use crate::base_pool::Transaction; +use crate::{ + base_pool::Transaction, + future::WaitingTransaction, + tracked_map::{self, ReadOnlyTrackedMap, TrackedMap}, +}; /// An in-pool transaction reference. /// @@ -113,11 +115,17 @@ pub struct ReadyTransactions { /// tags that are provided by Ready transactions provided_tags: HashMap, /// Transactions that are ready (i.e. don't have any requirements external to the pool) - ready: Arc>>>, + ready: TrackedMap>, /// Best transactions that are ready to be included to the block without any other previous transaction. best: BTreeSet>, } +impl tracked_map::Size for ReadyTx { + fn size(&self) -> usize { + self.transaction.transaction.bytes + } +} + impl Default for ReadyTransactions { fn default() -> Self { ReadyTransactions { @@ -468,18 +476,18 @@ impl ReadyTransactions { /// Returns number of transactions in this queue. pub fn len(&self) -> usize { - self.ready.read().len() + self.ready.len() } /// Returns sum of encoding lengths of all transactions in this queue. pub fn bytes(&self) -> usize { - self.ready.read().values().fold(0, |acc, tx| acc + tx.transaction.transaction.bytes) + self.ready.bytes() } } /// Iterator of ready transactions ordered by priority. pub struct BestIterator { - all: Arc>>>, + all: ReadOnlyTrackedMap>, awaiting: HashMap)>, best: BTreeSet>, } diff --git a/client/transaction-pool/graph/src/tracked_map.rs b/client/transaction-pool/graph/src/tracked_map.rs new file mode 100644 index 0000000000..c799eb0b96 --- /dev/null +++ b/client/transaction-pool/graph/src/tracked_map.rs @@ -0,0 +1,189 @@ +// This file is part of Substrate. + +// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +use std::{ + collections::HashMap, + sync::{Arc, atomic::{AtomicIsize, Ordering as AtomicOrdering}}, +}; +use parking_lot::{RwLock, RwLockWriteGuard, RwLockReadGuard}; + +/// Something that can report it's size. +pub trait Size { + fn size(&self) -> usize; +} + +/// Map with size tracking. +/// +/// Size reported might be slightly off and only approximately true. +#[derive(Debug, parity_util_mem::MallocSizeOf)] +pub struct TrackedMap { + index: Arc>>, + bytes: AtomicIsize, + length: AtomicIsize, +} + +impl Default for TrackedMap { + fn default() -> Self { + Self { + index: Arc::new(HashMap::default().into()), + bytes: 0.into(), + length: 0.into(), + } + } +} + +impl TrackedMap { + /// Current tracked length of the content. + pub fn len(&self) -> usize { + std::cmp::max(self.length.load(AtomicOrdering::Relaxed), 0) as usize + } + + /// Current sum of content length. + pub fn bytes(&self) -> usize { + std::cmp::max(self.bytes.load(AtomicOrdering::Relaxed), 0) as usize + } + + /// Read-only clone of the interior. + pub fn clone(&self) -> ReadOnlyTrackedMap { + ReadOnlyTrackedMap(self.index.clone()) + } + + /// Lock map for read. + pub fn read<'a>(&'a self) -> TrackedMapReadAccess<'a, K, V> { + TrackedMapReadAccess { + inner_guard: self.index.read(), + } + } + + /// Lock map for write. + pub fn write<'a>(&'a self) -> TrackedMapWriteAccess<'a, K, V> { + TrackedMapWriteAccess { + inner_guard: self.index.write(), + bytes: &self.bytes, + length: &self.length, + } + } +} + +/// Read-only access to map. +/// +/// The only thing can be done is .read(). +pub struct ReadOnlyTrackedMap(Arc>>); + +impl ReadOnlyTrackedMap +where + K: Eq + std::hash::Hash +{ + /// Lock map for read. + pub fn read<'a>(&'a self) -> TrackedMapReadAccess<'a, K, V> { + TrackedMapReadAccess { + inner_guard: self.0.read(), + } + } +} + +pub struct TrackedMapReadAccess<'a, K, V> { + inner_guard: RwLockReadGuard<'a, HashMap>, +} + +impl<'a, K, V> TrackedMapReadAccess<'a, K, V> +where + K: Eq + std::hash::Hash +{ + /// Returns true if map contains key. + pub fn contains_key(&self, key: &K) -> bool { + self.inner_guard.contains_key(key) + } + + /// Returns reference to the contained value by key, if exists. + pub fn get(&self, key: &K) -> Option<&V> { + self.inner_guard.get(key) + } + + /// Returns iterator over all values. + pub fn values(&self) -> std::collections::hash_map::Values { + self.inner_guard.values() + } +} + +pub struct TrackedMapWriteAccess<'a, K, V> { + bytes: &'a AtomicIsize, + length: &'a AtomicIsize, + inner_guard: RwLockWriteGuard<'a, HashMap>, +} + +impl<'a, K, V> TrackedMapWriteAccess<'a, K, V> +where + K: Eq + std::hash::Hash, V: Size +{ + /// Insert value and return previous (if any). + pub fn insert(&mut self, key: K, val: V) -> Option { + let new_bytes = val.size(); + self.bytes.fetch_add(new_bytes as isize, AtomicOrdering::Relaxed); + self.length.fetch_add(1, AtomicOrdering::Relaxed); + self.inner_guard.insert(key, val).and_then(|old_val| { + self.bytes.fetch_sub(old_val.size() as isize, AtomicOrdering::Relaxed); + self.length.fetch_sub(1, AtomicOrdering::Relaxed); + Some(old_val) + }) + } + + /// Remove value by key. + pub fn remove(&mut self, key: &K) -> Option { + let val = self.inner_guard.remove(key); + if let Some(size) = val.as_ref().map(Size::size) { + self.bytes.fetch_sub(size as isize, AtomicOrdering::Relaxed); + self.length.fetch_sub(1, AtomicOrdering::Relaxed); + } + val + } + + /// Returns mutable reference to the contained value by key, if exists. + pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { + self.inner_guard.get_mut(key) + } +} + +#[cfg(test)] +mod tests { + + use super::*; + + impl Size for i32 { + fn size(&self) -> usize { *self as usize / 10 } + } + + #[test] + fn basic() { + let map = TrackedMap::default(); + map.write().insert(5, 10); + map.write().insert(6, 20); + + assert_eq!(map.bytes(), 3); + assert_eq!(map.len(), 2); + + map.write().insert(6, 30); + + assert_eq!(map.bytes(), 4); + assert_eq!(map.len(), 2); + + map.write().remove(&6); + assert_eq!(map.bytes(), 1); + assert_eq!(map.len(), 1); + } +} \ No newline at end of file -- GitLab From 164fb3b6a0c1cbc775839508c643aca5eade8dad Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Thu, 11 Jun 2020 11:55:55 +0200 Subject: [PATCH 146/280] Find the alive incoming entry on disconnect. (#6320) When a peer in `Incoming` state disconnects, the "alive" entry in the `incoming` list for that peer must be updated (set to `false`). Currently the entry that is updated may be an earlier entry for the same peer that is already no longer alive. This can happen if a peer repeatedly connects (incoming) and disconnects between invocations to `poll()` of the behaviour. --- client/network/src/protocol/generic_proto/behaviour.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/network/src/protocol/generic_proto/behaviour.rs b/client/network/src/protocol/generic_proto/behaviour.rs index cf6188726d..be2451c3f4 100644 --- a/client/network/src/protocol/generic_proto/behaviour.rs +++ b/client/network/src/protocol/generic_proto/behaviour.rs @@ -1086,7 +1086,9 @@ impl NetworkBehaviour for GenericProto { // In the incoming state, we don't report "Dropped". Instead we will just ignore the // corresponding Accept/Reject. Some(PeerState::Incoming { }) => { - if let Some(state) = self.incoming.iter_mut().find(|i| i.peer_id == *peer_id) { + if let Some(state) = self.incoming.iter_mut() + .find(|i| i.alive && i.peer_id == *peer_id) + { debug!(target: "sub-libp2p", "Libp2p => Disconnected({}): Was in incoming mode with id {:?}.", peer_id, state.incoming_id); -- GitLab From 99708c0bc2493a94c774e502a6febd4738e311bb Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Thu, 11 Jun 2020 12:16:17 +0200 Subject: [PATCH 147/280] Impl Debug and Display for Ss58AddressFormat when compiled with std (#6327) * Initial commit Forked at: 606c56d2e2f69f68f3947551224be6a3515dff60 Parent branch: origin/master * Impl Debug and Display for Ss58AddressFormat when compiled with std Fixes #6289 * Use write! instead of writeln! --- primitives/core/src/crypto.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index 73134dcbfa..b92eb8eab0 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -357,12 +357,20 @@ macro_rules! ss58_address_format { ( $( $identifier:tt => ($number:expr, $name:expr, $desc:tt) )* ) => ( /// A known address (sub)format/network ID for SS58. #[derive(Copy, Clone, PartialEq, Eq)] + #[cfg_attr(feature = "std", derive(Debug))] pub enum Ss58AddressFormat { $(#[doc = $desc] $identifier),*, /// Use a manually provided numeric value. Custom(u8), } + #[cfg(feature = "std")] + impl std::fmt::Display for Ss58AddressFormat { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{:?}", self) + } + } + static ALL_SS58_ADDRESS_FORMATS: [Ss58AddressFormat; 0 $(+ { let _ = $number; 1})*] = [ $(Ss58AddressFormat::$identifier),*, ]; -- GitLab From 0a169d4a6974a457412d8f48f89b56a23e6dcfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 11 Jun 2020 11:16:31 +0100 Subject: [PATCH 148/280] transaction-pool: expose blocking api for tx submission (#6325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * transaction-pool: expose blocking api for tx submission * service: separate ServiceBuilder::build for full and light * service: add ServiceBuilder::build_common * transaction-pool: extend docs Co-authored-by: Tomasz Drwięga Co-authored-by: Tomasz Drwięga --- bin/node-template/node/src/service.rs | 4 +- bin/node/cli/src/service.rs | 4 +- client/service/src/builder.rs | 87 ++++++++++++++++++++++-- client/transaction-pool/src/api.rs | 88 ++++++++++++++++++------- client/transaction-pool/src/lib.rs | 53 +++++++++++++++ primitives/transaction-pool/src/pool.rs | 37 +++++++++-- 6 files changed, 232 insertions(+), 41 deletions(-) diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index b9bc68ce3a..e8578ab5b5 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -111,7 +111,7 @@ pub fn new_full(config: Configuration) -> Result>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) })? - .build()?; + .build_full()?; if role.is_authority() { let proposer = sc_basic_authorship::ProposerFactory::new( @@ -264,5 +264,5 @@ pub fn new_light(config: Configuration) -> Result>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) })? - .build() + .build_light() } diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index dfeca726b8..e087186d54 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -179,7 +179,7 @@ macro_rules! new_full { let provider = client as Arc>; Ok(Arc::new(grandpa::FinalityProofProvider::new(backend, provider)) as _) })? - .build()?; + .build_full()?; let (block_import, grandpa_link, babe_link) = import_setup.take() .expect("Link Half and Block Import are present for Full Services or setup failed before. qed"); @@ -405,7 +405,7 @@ pub fn new_light(config: Configuration) Ok(node_rpc::create_light(light_deps)) })? - .build()?; + .build_light()?; Ok(service) } diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index c6cf8bf5df..813fe50cce 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -57,7 +57,7 @@ use std::{ }; use wasm_timer::SystemTime; use sc_telemetry::{telemetry, SUBSTRATE_INFO}; -use sp_transaction_pool::MaintainedTransactionPool; +use sp_transaction_pool::{LocalTransactionPool, MaintainedTransactionPool}; use prometheus_endpoint::Registry; use sc_client_db::{Backend, DatabaseSettings}; use sp_core::traits::CodeExecutor; @@ -959,8 +959,7 @@ ServiceBuilder< Ok(self) } - /// Builds the service. - pub fn build(self) -> Result Result, TSc, @@ -1016,10 +1015,6 @@ ServiceBuilder< "best" => ?chain_info.best_hash ); - // make transaction pool available for off-chain runtime calls. - client.execution_extensions() - .register_transaction_pool(Arc::downgrade(&transaction_pool) as _); - let transaction_pool_adapter = Arc::new(TransactionPoolAdapter { imports_external_transactions: !matches!(config.role, Role::Light), pool: transaction_pool.clone(), @@ -1421,4 +1416,82 @@ ServiceBuilder< _base_path: config.base_path.map(Arc::new), }) } + + /// Builds the light service. + pub fn build_light(self) -> Result, + TSc, + NetworkStatus, + NetworkService::Hash>, + TExPool, + sc_offchain::OffchainWorkers< + Client, + TBackend::OffchainStorage, + TBl + >, + >, Error> + where TExec: CallExecutor, + { + self.build_common() + } +} + +impl +ServiceBuilder< + TBl, + TRtApi, + Client, + Arc>, + TSc, + TImpQu, + BoxFinalityProofRequestBuilder, + Arc>, + TExPool, + TRpc, + TBackend, +> where + Client: ProvideRuntimeApi, + as ProvideRuntimeApi>::Api: + sp_api::Metadata + + sc_offchain::OffchainWorkerApi + + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_session::SessionKeys + + sp_api::ApiErrorExt + + sp_api::ApiExt, + TBl: BlockT, + TRtApi: 'static + Send + Sync, + TBackend: 'static + sc_client_api::backend::Backend + Send, + TExec: 'static + CallExecutor + Send + Sync + Clone, + TSc: Clone, + TImpQu: 'static + ImportQueue, + TExPool: MaintainedTransactionPool::Hash> + + LocalTransactionPool::Hash> + + MallocSizeOfWasm + + 'static, + TRpc: sc_rpc::RpcExtension, +{ + + /// Builds the full service. + pub fn build_full(self) -> Result, + TSc, + NetworkStatus, + NetworkService::Hash>, + TExPool, + sc_offchain::OffchainWorkers< + Client, + TBackend::OffchainStorage, + TBl + >, + >, Error> + where TExec: CallExecutor, + { + // make transaction pool available for off-chain runtime calls. + self.client.execution_extensions() + .register_transaction_pool(Arc::downgrade(&self.transaction_pool) as _); + + self.build_common() + } } diff --git a/client/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs index c7665022a5..10ac4aa469 100644 --- a/client/transaction-pool/src/api.rs +++ b/client/transaction-pool/src/api.rs @@ -87,29 +87,15 @@ where let client = self.client.clone(); let at = at.clone(); - self.pool.spawn_ok(futures_diagnose::diagnose("validate-transaction", async move { - sp_tracing::enter_span!("validate_transaction"); - let runtime_api = client.runtime_api(); - let has_v2 = sp_tracing::tracing_span! { "check_version"; - runtime_api - .has_api_with::, _>( - &at, |v| v >= 2, - ) - .unwrap_or_default() - }; - - sp_tracing::enter_span!("runtime::validate_transaction"); - let res = if has_v2 { - runtime_api.validate_transaction(&at, source, uxt) - } else { - #[allow(deprecated)] // old validate_transaction - runtime_api.validate_transaction_before_version_2(&at, uxt) - }; - let res = res.map_err(|e| Error::RuntimeApi(e.to_string())); - if let Err(e) = tx.send(res) { - log::warn!("Unable to send a validate transaction result: {:?}", e); - } - })); + self.pool.spawn_ok(futures_diagnose::diagnose( + "validate-transaction", + async move { + let res = validate_transaction_blocking(&*client, &at, source, uxt); + if let Err(e) = tx.send(res) { + log::warn!("Unable to send a validate transaction result: {:?}", e); + } + }, + )); Box::pin(async move { match rx.await { @@ -143,6 +129,62 @@ where } } +/// Helper function to validate a transaction using a full chain API. +/// This method will call into the runtime to perform the validation. +fn validate_transaction_blocking( + client: &Client, + at: &BlockId, + source: TransactionSource, + uxt: sc_transaction_graph::ExtrinsicFor>, +) -> error::Result +where + Block: BlockT, + Client: ProvideRuntimeApi + BlockBackend + BlockIdTo, + Client: Send + Sync + 'static, + Client::Api: TaggedTransactionQueue, + sp_api::ApiErrorFor: Send + std::fmt::Display, +{ + sp_tracing::enter_span!("validate_transaction"); + let runtime_api = client.runtime_api(); + let has_v2 = sp_tracing::tracing_span! { "check_version"; + runtime_api + .has_api_with::, _>(&at, |v| v >= 2) + .unwrap_or_default() + }; + + sp_tracing::enter_span!("runtime::validate_transaction"); + let res = if has_v2 { + runtime_api.validate_transaction(&at, source, uxt) + } else { + #[allow(deprecated)] // old validate_transaction + runtime_api.validate_transaction_before_version_2(&at, uxt) + }; + + res.map_err(|e| Error::RuntimeApi(e.to_string())) +} + +impl FullChainApi +where + Block: BlockT, + Client: ProvideRuntimeApi + BlockBackend + BlockIdTo, + Client: Send + Sync + 'static, + Client::Api: TaggedTransactionQueue, + sp_api::ApiErrorFor: Send + std::fmt::Display, +{ + /// Validates a transaction by calling into the runtime, same as + /// `validate_transaction` but blocks the current thread when performing + /// validation. Only implemented for `FullChainApi` since we can call into + /// the runtime locally. + pub fn validate_transaction_blocking( + &self, + at: &BlockId, + source: TransactionSource, + uxt: sc_transaction_graph::ExtrinsicFor, + ) -> error::Result { + validate_transaction_blocking(&*self.client, at, source, uxt) + } +} + /// The transaction pool logic for light client. pub struct LightChainApi { client: Arc, diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index ee2fd4a199..eaddcbe83a 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -352,6 +352,59 @@ impl TransactionPool for BasicPool } } +impl sp_transaction_pool::LocalTransactionPool + for BasicPool, Block> +where + Block: BlockT, + Client: sp_api::ProvideRuntimeApi + + sc_client_api::BlockBackend + + sp_runtime::traits::BlockIdTo, + Client: Send + Sync + 'static, + Client::Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue, + sp_api::ApiErrorFor: Send + std::fmt::Display, +{ + type Block = Block; + type Hash = sc_transaction_graph::ExtrinsicHash>; + type Error = as ChainApi>::Error; + + fn submit_local( + &self, + at: &BlockId, + xt: sp_transaction_pool::LocalTransactionFor, + ) -> Result { + use sc_transaction_graph::ValidatedTransaction; + use sp_runtime::traits::SaturatedConversion; + use sp_runtime::transaction_validity::TransactionValidityError; + + let validity = self + .api + .validate_transaction_blocking(at, TransactionSource::Local, xt.clone())? + .map_err(|e| { + Self::Error::Pool(match e { + TransactionValidityError::Invalid(i) => i.into(), + TransactionValidityError::Unknown(u) => u.into(), + }) + })?; + + let (hash, bytes) = self.pool.validated_pool().api().hash_and_length(&xt); + let block_number = self + .api + .block_id_to_number(at)? + .ok_or_else(|| error::Error::BlockIdConversion(format!("{:?}", at)))?; + + let validated = ValidatedTransaction::valid_at( + block_number.saturated_into::(), + hash.clone(), + TransactionSource::Local, + xt, + bytes, + validity, + ); + + self.pool.validated_pool().submit(vec![validated]).remove(0) + } +} + #[cfg_attr(test, derive(Debug))] enum RevalidationStatus { /// The revalidation has never been completed. diff --git a/primitives/transaction-pool/src/pool.rs b/primitives/transaction-pool/src/pool.rs index 2824c96f30..b00c283ac7 100644 --- a/primitives/transaction-pool/src/pool.rs +++ b/primitives/transaction-pool/src/pool.rs @@ -141,6 +141,8 @@ pub type BlockHash

= <

::Block as BlockT>::Hash; pub type TransactionFor

= <

::Block as BlockT>::Extrinsic; /// Type of transactions event stream for a pool. pub type TransactionStatusStreamFor

= TransactionStatusStream, BlockHash

>; +/// Transaction type for a local pool. +pub type LocalTransactionFor

= <

::Block as BlockT>::Extrinsic; /// Typical future type used in transaction pool api. pub type PoolFuture = std::pin::Pin> + Send>>; @@ -273,6 +275,28 @@ pub trait MaintainedTransactionPool: TransactionPool { fn maintain(&self, event: ChainEvent) -> Pin + Send>>; } +/// Transaction pool interface for submitting local transactions that exposes a +/// blocking interface for submission. +pub trait LocalTransactionPool: Send + Sync { + /// Block type. + type Block: BlockT; + /// Transaction hash type. + type Hash: Hash + Eq + Member + Serialize; + /// Error type. + type Error: From + crate::error::IntoPoolError; + + /// Submits the given local unverified transaction to the pool blocking the + /// current thread for any necessary pre-verification. + /// NOTE: It MUST NOT be used for transactions that originate from the + /// network or RPC, since the validation is performed with + /// `TransactionSource::Local`. + fn submit_local( + &self, + at: &BlockId, + xt: LocalTransactionFor, + ) -> Result; +} + /// An abstraction for transaction pool. /// /// This trait is used by offchain calls to be able to submit transactions. @@ -291,7 +315,7 @@ pub trait OffchainSubmitTransaction: Send + Sync { ) -> Result<(), ()>; } -impl OffchainSubmitTransaction for TPool { +impl OffchainSubmitTransaction for TPool { fn submit_at( &self, at: &BlockId, @@ -303,15 +327,14 @@ impl OffchainSubmitTransaction for TPool { extrinsic ); - let result = futures::executor::block_on(self.submit_one( - &at, TransactionSource::Local, extrinsic, - )); + let result = self.submit_local(&at, extrinsic); - result.map(|_| ()) - .map_err(|e| log::warn!( + result.map(|_| ()).map_err(|e| { + log::warn!( target: "txpool", "(offchain call) Error submitting a transaction to the pool: {:?}", e - )) + ) + }) } } -- GitLab From f8935061c86b42f1018988166156ba792b0aa1a0 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Thu, 11 Jun 2020 13:50:32 +0300 Subject: [PATCH 149/280] Pruned and resubmitted metrics in transaction pool (#6322) * pruned and resubmitted metrics * update counter once --- client/transaction-pool/src/lib.rs | 15 +++++++++++++++ client/transaction-pool/src/metrics.rs | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index eaddcbe83a..d720dc523d 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -551,6 +551,7 @@ impl MaintainedTransactionPool for BasicPool let revalidation_strategy = self.revalidation_strategy.clone(); let revalidation_queue = self.revalidation_queue.clone(); let ready_poll = self.ready_poll.clone(); + let metrics = self.metrics.clone(); async move { // We keep track of everything we prune so that later we won't add @@ -581,6 +582,10 @@ impl MaintainedTransactionPool for BasicPool pruned_log.extend(prune_known_txs_for_block(id.clone(), &*api, &*pool).await); } + metrics.report( + |metrics| metrics.block_transactions_pruned.inc_by(pruned_log.len() as u64) + ); + if let (true, Some(tree_route)) = (next_action.resubmit, tree_route) { let mut resubmit_transactions = Vec::new(); @@ -600,10 +605,16 @@ impl MaintainedTransactionPool for BasicPool .into_iter() .filter(|tx| tx.is_signed().unwrap_or(true)); + let mut resubmitted_to_report = 0; + resubmit_transactions.extend( block_transactions.into_iter().filter(|tx| { let tx_hash = pool.hash_of(&tx); let contains = pruned_log.contains(&tx_hash); + + // need to count all transactions, not just filtered, here + resubmitted_to_report += 1; + if !contains { log::debug!( target: "txpool", @@ -615,6 +626,10 @@ impl MaintainedTransactionPool for BasicPool !contains }) ); + + metrics.report( + |metrics| metrics.block_transactions_resubmitted.inc_by(resubmitted_to_report) + ); } if let Err(e) = pool.submit_at( diff --git a/client/transaction-pool/src/metrics.rs b/client/transaction-pool/src/metrics.rs index e377b2fe82..d5a10dfd6f 100644 --- a/client/transaction-pool/src/metrics.rs +++ b/client/transaction-pool/src/metrics.rs @@ -48,6 +48,8 @@ pub struct Metrics { pub validations_scheduled: Counter, pub validations_finished: Counter, pub validations_invalid: Counter, + pub block_transactions_pruned: Counter, + pub block_transactions_resubmitted: Counter, } impl Metrics { @@ -74,6 +76,20 @@ impl Metrics { )?, registry, )?, + block_transactions_pruned: register( + Counter::new( + "sub_txpool_block_transactions_pruned", + "Total number of transactions that was requested to be pruned by block events", + )?, + registry, + )?, + block_transactions_resubmitted: register( + Counter::new( + "sub_txpool_block_transactions_resubmitted", + "Total number of transactions that was requested to be resubmitted by block events", + )?, + registry, + )?, }) } } -- GitLab From 4bd0785c18ee06d07eff2d528bca24f9e8622610 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 11 Jun 2020 20:44:24 +0200 Subject: [PATCH 150/280] Enable wasmtime on node-template (#6336) * Enable wasmtime on node-template * Apply suggestions from code review syntax Co-authored-by: Nikolay Volf Co-authored-by: Nikolay Volf --- bin/node-template/node/Cargo.toml | 6 +++--- bin/node-template/pallets/template/Cargo.toml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 88cdc6d608..52fc1b4f8d 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -21,10 +21,10 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli", features = ["wasmtime"] } sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } -sc-service = { version = "0.8.0-rc3", path = "../../../client/service" } +sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor", features = ["wasmtime"] } +sc-service = { version = "0.8.0-rc3", path = "../../../client/service", features = ["wasmtime"] } sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../client/transaction-pool" } sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 8c4f98d85b..6b99b6f807 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -23,6 +23,7 @@ path = "../../../../frame/support" default-features = false version = "2.0.0-rc3" path = "../../../../frame/system" + [dev-dependencies.sp-core] default-features = false version = "2.0.0-rc3" -- GitLab From 75113aae02ee3cc265aaaa13cdf5a79c7ff98105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 12 Jun 2020 00:46:30 +0200 Subject: [PATCH 151/280] Adds support for storage parameter types (#6296) * Adds support for storage parameter types This pr adds a new parameter types type, the storage parameter types. This parameter type supports loading the value from the storage or returning the given default value. * Use twox_128 * Update docs * Update frame/support/src/lib.rs Co-authored-by: Alexander Popiak Co-authored-by: Alexander Popiak --- frame/support/src/lib.rs | 119 ++++++++++++++++++++++++++++++------ frame/support/src/traits.rs | 6 +- 2 files changed, 105 insertions(+), 20 deletions(-) diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 471dd72a74..316e356759 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -44,7 +44,7 @@ pub use paste; #[doc(hidden)] pub use sp_state_machine::BasicExternalities; #[doc(hidden)] -pub use sp_io::storage::root as storage_root; +pub use sp_io::{storage::root as storage_root, self}; #[doc(hidden)] pub use sp_runtime::RuntimeDebug; @@ -84,8 +84,24 @@ pub use sp_runtime::{self, ConsensusEngineId, print, traits::Printable}; #[derive(Debug)] pub enum Never {} -/// Macro for easily creating a new implementation of the `Get` trait. If `const` token is used, the -/// rhs of the expression must be `const`-only, and get is implemented as `const`: +/// Create new implementations of the [`Get`](crate::traits::Get) trait. +/// +/// The so-called parameter type can be created in three different ways: +/// +/// - Using `const` to create a parameter type that provides a `const` getter. +/// It is required that the `value` is const. +/// +/// - Declare the parameter type without `const` to have more freedom when creating the value. +/// +/// - Using `storage` to create a storage parameter type. This type is special as it tries to +/// load the value from the storage under a fixed key. If the value could not be found in the +/// storage, the given default value will be returned. It is required that the value implements +/// [`Encode`](codec::Encode) and [`Decode`](codec::Decode). The key for looking up the value +/// in the storage is built using the following formular: +/// +/// `twox_128(":" ++ NAME ++ ":")` where `NAME` is the name that is passed as type name. +/// +/// # Examples /// /// ``` /// # use frame_support::traits::Get; @@ -95,23 +111,27 @@ pub enum Never {} /// /// const FIXED_VALUE: u64 = 10; /// parameter_types! { -/// pub const Argument: u64 = 42 + FIXED_VALUE; -/// pub OtherArgument: u64 = non_const_expression(); +/// pub const Argument: u64 = 42 + FIXED_VALUE; +/// /// Visibility of the type is optional +/// OtherArgument: u64 = non_const_expression(); +/// pub storage StorageArgument: u64 = 5; /// } /// /// trait Config { -/// type Parameter: Get; -/// type OtherParameter: Get; +/// type Parameter: Get; +/// type OtherParameter: Get; +/// type StorageParameter: Get; /// } /// /// struct Runtime; /// impl Config for Runtime { -/// type Parameter = Argument; -/// type OtherParameter = OtherArgument; +/// type Parameter = Argument; +/// type OtherParameter = OtherArgument; +/// type StorageParameter = StorageArgument; /// } /// ``` /// -/// Invalid example: +/// # Invalid example: /// /// ```compile_fail /// # use frame_support::traits::Get; @@ -120,7 +140,7 @@ pub enum Never {} /// fn non_const_expression() -> u64 { 99 } /// /// parameter_types! { -/// pub const Argument: u64 = non_const_expression(); +/// pub const Argument: u64 = non_const_expression(); /// } /// ``` @@ -133,8 +153,8 @@ macro_rules! parameter_types { ) => ( $( #[ $attr ] )* $vis struct $name; - $crate::parameter_types!{IMPL_CONST $name , $type , $value} - $crate::parameter_types!{ $( $rest )* } + $crate::parameter_types!(IMPL_CONST $name , $type , $value); + $crate::parameter_types!( $( $rest )* ); ); ( $( #[ $attr:meta ] )* @@ -143,33 +163,79 @@ macro_rules! parameter_types { ) => ( $( #[ $attr ] )* $vis struct $name; - $crate::parameter_types!{IMPL $name , $type , $value} - $crate::parameter_types!{ $( $rest )* } + $crate::parameter_types!(IMPL $name, $type, $value); + $crate::parameter_types!( $( $rest )* ); + ); + ( + $( #[ $attr:meta ] )* + $vis:vis storage $name:ident: $type:ty = $value:expr; + $( $rest:tt )* + ) => ( + $( #[ $attr ] )* + $vis struct $name; + $crate::parameter_types!(IMPL_STORAGE $name, $type, $value); + $crate::parameter_types!( $( $rest )* ); ); () => (); - (IMPL_CONST $name:ident , $type:ty , $value:expr) => { + (IMPL_CONST $name:ident, $type:ty, $value:expr) => { impl $name { + /// Returns the value of this parameter type. pub const fn get() -> $type { $value } } + impl> $crate::traits::Get for $name { fn get() -> I { I::from($value) } } }; - (IMPL $name:ident , $type:ty , $value:expr) => { + (IMPL $name:ident, $type:ty, $value:expr) => { impl $name { + /// Returns the value of this parameter type. pub fn get() -> $type { $value } } + impl> $crate::traits::Get for $name { fn get() -> I { I::from($value) } } + }; + (IMPL_STORAGE $name:ident, $type:ty, $value:expr) => { + impl $name { + /// Returns the key for this parameter type. + pub fn key() -> [u8; 16] { + $crate::sp_io::hashing::twox_128( + concat!(":", stringify!($name), ":").as_bytes() + ) + } + + /// Set the value of this parameter type in the storage. + /// + /// This needs to be executed in an externalities provided + /// environment. + pub fn set(value: &$type) { + $crate::storage::unhashed::put(&Self::key(), value); + } + + /// Returns the value of this parameter type. + /// + /// This needs to be executed in an externalities provided + /// environment. + pub fn get() -> $type { + $crate::storage::unhashed::get(&Self::key()).unwrap_or_else(|| $value) + } + } + + impl> $crate::traits::Get for $name { + fn get() -> I { + I::from(Self::get()) + } + } } } @@ -316,6 +382,7 @@ mod tests { StorageEntryModifier, DefaultByteGetter, StorageHasher, }; use sp_std::marker::PhantomData; + use sp_io::TestExternalities; pub trait Trait { type BlockNumber: Codec + EncodeLike + Default; @@ -361,7 +428,7 @@ mod tests { type Origin = u32; } - fn new_test_ext() -> sp_io::TestExternalities { + fn new_test_ext() -> TestExternalities { GenesisConfig::default().build_storage().unwrap().into() } @@ -696,4 +763,20 @@ mod tests { let metadata = Module::::storage_metadata(); pretty_assertions::assert_eq!(EXPECTED_METADATA, metadata); } + + parameter_types! { + storage StorageParameter: u64 = 10; + } + + #[test] + fn check_storage_parameter_type_works() { + TestExternalities::default().execute_with(|| { + assert_eq!(sp_io::hashing::twox_128(b":StorageParameter:"), StorageParameter::key()); + + assert_eq!(10, StorageParameter::get()); + + StorageParameter::set(&300); + assert_eq!(300, StorageParameter::get()); + }) + } } diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index df47def870..fae0ad2fcb 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -450,9 +450,11 @@ impl Len for T where ::IntoIter: Ex } } -/// A trait for querying a single fixed value from a type. +/// A trait for querying a single value from a type. +/// +/// It is not required that the value is constant. pub trait Get { - /// Return a constant value. + /// Return the current value. fn get() -> T; } -- GitLab From 883c89a80bfa66d70f454488bad4c741e5602648 Mon Sep 17 00:00:00 2001 From: Dan Forbes Date: Fri, 12 Jun 2020 04:43:42 -0700 Subject: [PATCH 152/280] Basic documentation for Scheduler pallet (#6338) Closes #5912 --- frame/scheduler/src/lib.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 687fe46d16..580b3b060e 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -16,31 +16,29 @@ // limitations under the License. //! # Scheduler +//! A module for scheduling dispatches. //! -//! \# Scheduler +//! - [`scheduler::Trait`](./trait.Trait.html) +//! - [`Call`](./enum.Call.html) +//! - [`Module`](./struct.Module.html) //! -//! - \[`scheduler::Trait`](./trait.Trait.html) -//! - \[`Call`](./enum.Call.html) -//! - \[`Module`](./struct.Module.html) +//! ## Overview //! -//! \## Overview +//! This module exposes capabilities for scheduling dispatches to occur at a +//! specified block number or at a specified period. These scheduled dispatches +//! may be named or anonymous and may be canceled. //! -//! // Short description of pallet's purpose. -//! // Links to Traits that should be implemented. -//! // What this pallet is for. -//! // What functionality the pallet provides. -//! // When to use the pallet (use case examples). -//! // How it is used. -//! // Inputs it uses and the source of each input. -//! // Outputs it produces. +//! ## Interface //! -//! \## Terminology +//! ### Dispatchable Functions //! -//! \## Goals -//! -//! \## Interface -//! -//! \### Dispatchable Functions +//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a +//! specified block and with a specified priority. +//! * `cancel` - cancel a scheduled dispatch, specified by block number and +//! index. +//! * `schedule_named` - augments the `schedule` interface with an additional +//! `Vec` parameter that can be used for identification. +//! * `cancel_named` - the named complement to the cancel function. // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -- GitLab From 6b45e245b584cfb6871b80cb54d4831c6204adf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 12 Jun 2020 13:47:14 +0200 Subject: [PATCH 153/280] Fix check-line-width CI script (#6326) * Compare lines to the hash that the PR branched off from * Use git merge-base to determine common ancestor * Fixup --- .maintain/gitlab/check_line_width.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.maintain/gitlab/check_line_width.sh b/.maintain/gitlab/check_line_width.sh index 85092260b6..611d3ae268 100755 --- a/.maintain/gitlab/check_line_width.sh +++ b/.maintain/gitlab/check_line_width.sh @@ -10,14 +10,15 @@ BASE_BRANCH_NAME="master" LINE_WIDTH="120" GOOD_LINE_WIDTH="100" BASE_BRANCH="${BASE_ORIGIN}/${BASE_BRANCH_NAME}" +git fetch ${BASE_ORIGIN} ${BASE_BRANCH_NAME} --depth 100 +BASE_HASH=$(git merge-base ${BASE_BRANCH} HEAD) -git fetch ${BASE_ORIGIN} ${BASE_BRANCH_NAME} --depth 1 -git diff --name-only ${BASE_BRANCH} -- \*.rs | ( while read file +git diff --name-only ${BASE_HASH} -- \*.rs | ( while read file do if [ ! -f ${file} ]; then echo "Skipping removed file." - elif git diff ${BASE_BRANCH} -- ${file} | grep -q "^+.\{$(( $LINE_WIDTH + 1 ))\}" + elif git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $LINE_WIDTH + 1 ))\}" then if [ -z "${FAIL}" ] then @@ -29,11 +30,11 @@ do FAIL="true" fi echo "| file: ${file}" - git diff ${BASE_BRANCH} -- ${file} \ + git diff ${BASE_HASH} -- ${file} \ | grep -n "^+.\{$(( $LINE_WIDTH + 1))\}" echo "|" else - if git diff ${BASE_BRANCH} -- ${file} | grep -q "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}" + if git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}" then if [ -z "${FAIL}" ] then @@ -44,7 +45,7 @@ do echo "|" fi echo "| file: ${file}" - git diff ${BASE_BRANCH} -- ${file} | grep -n "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}" + git diff ${BASE_HASH} -- ${file} | grep -n "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}" echo "|" fi fi -- GitLab From 0dc6634741ec8db1624af758f5b72690ed9bdf4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Fri, 12 Jun 2020 13:22:21 +0100 Subject: [PATCH 154/280] client: use appropriate ExecutionContext for initial sync / regular import (#6180) * client: use appropriate ExecutionContext for sync/import * client: remove dead code * client: ExecutionContext: distinguish between own and foreign imports * client: fix cli parameter doc * Revert "client: ExecutionContext: distinguish between own and foreign imports" This reverts commit 0fac11520704c364a82432c5b927e987ba043cdb. * primitives: add docs for ExecutionContext * cli: execution strategy docs * cli: use different execution context for importing block on validator * cli: remove defaults from execution context flags --- client/cli/src/arg_enums.rs | 2 ++ client/cli/src/commands/mod.rs | 4 +-- client/cli/src/config.rs | 14 +++++--- client/cli/src/params/import_params.rs | 48 ++++++++++++++------------ client/service/src/client/client.rs | 18 +++++----- primitives/core/src/lib.rs | 11 ++++-- 6 files changed, 58 insertions(+), 39 deletions(-) diff --git a/client/cli/src/arg_enums.rs b/client/cli/src/arg_enums.rs index 4dfd384d95..db13fff761 100644 --- a/client/cli/src/arg_enums.rs +++ b/client/cli/src/arg_enums.rs @@ -178,6 +178,8 @@ arg_enum! { pub const DEFAULT_EXECUTION_SYNCING: ExecutionStrategy = ExecutionStrategy::NativeElseWasm; /// Default value for the `--execution-import-block` parameter. pub const DEFAULT_EXECUTION_IMPORT_BLOCK: ExecutionStrategy = ExecutionStrategy::NativeElseWasm; +/// Default value for the `--execution-import-block` parameter when the node is a validator. +pub const DEFAULT_EXECUTION_IMPORT_BLOCK_VALIDATOR: ExecutionStrategy = ExecutionStrategy::Wasm; /// Default value for the `--execution-block-construction` parameter. pub const DEFAULT_EXECUTION_BLOCK_CONSTRUCTION: ExecutionStrategy = ExecutionStrategy::Wasm; /// Default value for the `--execution-offchain-worker` parameter. diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs index a4d5c8ca7f..6931a8715c 100644 --- a/client/cli/src/commands/mod.rs +++ b/client/cli/src/commands/mod.rs @@ -278,10 +278,10 @@ macro_rules! substrate_cli_subcommands { } } - fn execution_strategies(&self, is_dev: bool) + fn execution_strategies(&self, is_dev: bool, is_validator: bool) -> $crate::Result<::sc_client_api::execution_extensions::ExecutionStrategies> { match self { - $($enum::$variant(cmd) => cmd.execution_strategies(is_dev)),* + $($enum::$variant(cmd) => cmd.execution_strategies(is_dev, is_validator)),* } } diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index 1374e75daf..d121546c19 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -246,9 +246,14 @@ pub trait CliConfiguration: Sized { /// /// By default this is retrieved from `ImportParams` if it is available. Otherwise its /// `ExecutionStrategies::default()`. - fn execution_strategies(&self, is_dev: bool) -> Result { - Ok(self.import_params() - .map(|x| x.execution_strategies(is_dev)) + fn execution_strategies( + &self, + is_dev: bool, + is_validator: bool, + ) -> Result { + Ok(self + .import_params() + .map(|x| x.execution_strategies(is_dev, is_validator)) .unwrap_or(Default::default())) } @@ -417,6 +422,7 @@ pub trait CliConfiguration: Sized { let node_key = self.node_key(&net_config_dir)?; let role = self.role(is_dev)?; let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8); + let is_validator = role.is_network_authority(); let unsafe_pruning = self .import_params() @@ -442,7 +448,7 @@ pub trait CliConfiguration: Sized { state_cache_child_ratio: self.state_cache_child_ratio()?, pruning: self.pruning(unsafe_pruning, &role)?, wasm_method: self.wasm_method()?, - execution_strategies: self.execution_strategies(is_dev)?, + execution_strategies: self.execution_strategies(is_dev, is_validator)?, rpc_http: self.rpc_http()?, rpc_ws: self.rpc_ws()?, rpc_methods: self.rpc_methods()?, diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs index 101189bec4..c2fb34f90e 100644 --- a/client/cli/src/params/import_params.rs +++ b/client/cli/src/params/import_params.rs @@ -17,8 +17,8 @@ // along with this program. If not, see . use crate::arg_enums::{ - ExecutionStrategy, TracingReceiver, WasmExecutionMethod, - DEFAULT_EXECUTION_BLOCK_CONSTRUCTION, DEFAULT_EXECUTION_IMPORT_BLOCK, + ExecutionStrategy, TracingReceiver, WasmExecutionMethod, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION, + DEFAULT_EXECUTION_IMPORT_BLOCK, DEFAULT_EXECUTION_IMPORT_BLOCK_VALIDATOR, DEFAULT_EXECUTION_OFFCHAIN_WORKER, DEFAULT_EXECUTION_OTHER, DEFAULT_EXECUTION_SYNCING, }; use crate::params::DatabaseParams; @@ -104,22 +104,27 @@ impl ImportParams { } /// Get execution strategies for the parameters - pub fn execution_strategies( - &self, - is_dev: bool, - ) -> ExecutionStrategies { + pub fn execution_strategies(&self, is_dev: bool, is_validator: bool) -> ExecutionStrategies { let exec = &self.execution_strategies; - let exec_all_or = |strat: ExecutionStrategy, default: ExecutionStrategy| { - exec.execution.unwrap_or(if strat == default && is_dev { + let exec_all_or = |strat: Option, default: ExecutionStrategy| { + let default = if is_dev { ExecutionStrategy::Native } else { - strat - }).into() + default + }; + + exec.execution.unwrap_or(strat.unwrap_or(default)).into() + }; + + let default_execution_import_block = if is_validator { + DEFAULT_EXECUTION_IMPORT_BLOCK_VALIDATOR + } else { + DEFAULT_EXECUTION_IMPORT_BLOCK }; ExecutionStrategies { syncing: exec_all_or(exec.execution_syncing, DEFAULT_EXECUTION_SYNCING), - importing: exec_all_or(exec.execution_import_block, DEFAULT_EXECUTION_IMPORT_BLOCK), + importing: exec_all_or(exec.execution_import_block, default_execution_import_block), block_construction: exec_all_or(exec.execution_block_construction, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION), offchain_worker: @@ -132,25 +137,25 @@ impl ImportParams { /// Execution strategies parameters. #[derive(Debug, StructOpt)] pub struct ExecutionStrategiesParams { - /// The means of execution used when calling into the runtime while syncing blocks. + /// The means of execution used when calling into the runtime for importing blocks as + /// part of an initial sync. #[structopt( long = "execution-syncing", value_name = "STRATEGY", possible_values = &ExecutionStrategy::variants(), case_insensitive = true, - default_value = DEFAULT_EXECUTION_SYNCING.as_str(), )] - pub execution_syncing: ExecutionStrategy, + pub execution_syncing: Option, - /// The means of execution used when calling into the runtime while importing blocks. + /// The means of execution used when calling into the runtime for general block import + /// (including locally authored blocks). #[structopt( long = "execution-import-block", value_name = "STRATEGY", possible_values = &ExecutionStrategy::variants(), case_insensitive = true, - default_value = DEFAULT_EXECUTION_IMPORT_BLOCK.as_str(), )] - pub execution_import_block: ExecutionStrategy, + pub execution_import_block: Option, /// The means of execution used when calling into the runtime while constructing blocks. #[structopt( @@ -158,9 +163,8 @@ pub struct ExecutionStrategiesParams { value_name = "STRATEGY", possible_values = &ExecutionStrategy::variants(), case_insensitive = true, - default_value = DEFAULT_EXECUTION_BLOCK_CONSTRUCTION.as_str(), )] - pub execution_block_construction: ExecutionStrategy, + pub execution_block_construction: Option, /// The means of execution used when calling into the runtime while using an off-chain worker. #[structopt( @@ -168,9 +172,8 @@ pub struct ExecutionStrategiesParams { value_name = "STRATEGY", possible_values = &ExecutionStrategy::variants(), case_insensitive = true, - default_value = DEFAULT_EXECUTION_OFFCHAIN_WORKER.as_str(), )] - pub execution_offchain_worker: ExecutionStrategy, + pub execution_offchain_worker: Option, /// The means of execution used when calling into the runtime while not syncing, importing or constructing blocks. #[structopt( @@ -178,9 +181,8 @@ pub struct ExecutionStrategiesParams { value_name = "STRATEGY", possible_values = &ExecutionStrategy::variants(), case_insensitive = true, - default_value = DEFAULT_EXECUTION_OTHER.as_str(), )] - pub execution_other: ExecutionStrategy, + pub execution_other: Option, /// The execution strategy that should be used by all execution contexts. #[structopt( diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 99ad8b689e..922f34b656 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -28,8 +28,9 @@ use parking_lot::{Mutex, RwLock}; use codec::{Encode, Decode}; use hash_db::Prefix; use sp_core::{ - ChangesTrieConfiguration, convert_hash, NativeOrEncoded, - storage::{StorageKey, PrefixedStorageKey, StorageData, well_known_keys, ChildInfo}, + convert_hash, + storage::{well_known_keys, ChildInfo, PrefixedStorageKey, StorageData, StorageKey}, + ChangesTrieConfiguration, ExecutionContext, NativeOrEncoded, }; use sc_telemetry::{telemetry, SUBSTRATE_INFO}; use sp_runtime::{ @@ -752,11 +753,6 @@ impl Client where ) = storage_changes.into_inner(); if self.config.offchain_indexing_api { - // if let Some(mut offchain_storage) = self.backend.offchain_storage() { - // offchain_sc.iter().for_each(|(k,v)| { - // offchain_storage.set(b"block-import-info", k,v) - // }); - // } operation.op.update_offchain_storage(offchain_sc)?; } @@ -863,9 +859,15 @@ impl Client where // block. (true, ref mut storage_changes @ None, Some(ref body)) => { let runtime_api = self.runtime_api(); + let execution_context = if import_block.origin == BlockOrigin::NetworkInitialSync { + ExecutionContext::Syncing + } else { + ExecutionContext::Importing + }; - runtime_api.execute_block( + runtime_api.execute_block_with_context( &at, + execution_context, Block::new(import_block.header.clone(), body.clone()), )?; diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 56dbbc7b78..5fbbf3ca6d 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -93,9 +93,16 @@ pub use sp_std; /// Context for executing a call into the runtime. pub enum ExecutionContext { - /// Context for general importing (including own blocks). + /// Context used for general block import (including locally authored blocks). Importing, - /// Context used when syncing the blockchain. + /// Context used for importing blocks as part of an initial sync of the blockchain. + /// + /// We distinguish between major sync and import so that validators who are running + /// their initial sync (or catching up after some time offline) can use the faster + /// native runtime (since we can reasonably assume the network as a whole has already + /// come to a broad conensus on the block and it probably hasn't been crafted + /// specifically to attack this node), but when importing blocks at the head of the + /// chain in normal operation they can use the safer Wasm version. Syncing, /// Context used for block construction. BlockConstruction, -- GitLab From 384be7e26e0e8222288bf3071ea523126bbba8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 12 Jun 2020 15:21:27 +0200 Subject: [PATCH 155/280] Fix transaction pool event sending (#6341) This pr fixes a bug with the transaction pool not sending certain events like finalized and also fixes the order of events. The problem with the finalized event was that we did not extracted pruned extrinsics if there were not ready transactions in the pool. However this is wrong, if we have a re-org, a tx is clearly not ready anymore and we still need to send a pruned event for it because it is in a new block included. This also lead to sending "ready" events and tx being re-validated. The listener also only send the "finalized" event if it has seen a block as being included, which did not happen before with the old code. The second fix of the pr is the order of events. If we prune and retract the same transaction in the same block, we first need to send the "retract" event and after that the "pruned" event, because finalization takes longer and this would lead to the UI showing "retract" while it actually is included. --- client/transaction-pool/src/lib.rs | 18 +++---- client/transaction-pool/src/testing/pool.rs | 60 +++++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index d720dc523d..08c7508b50 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -495,11 +495,6 @@ async fn prune_known_txs_for_block>( api: &Api, pool: &sc_transaction_graph::Pool, ) -> Vec> { - // We don't query block if we won't prune anything - if pool.validated_pool().status().is_empty() { - return Vec::new(); - } - let hashes = api.block_body(&block_id).await .unwrap_or_else(|e| { log::warn!("Prune known transactions: error request {:?}!", e); @@ -559,8 +554,16 @@ impl MaintainedTransactionPool for BasicPool let mut pruned_log = HashSet::>::new(); // If there is a tree route, we use this to prune known tx based on the enacted - // blocks. + // blocks. Before pruning enacted transactions, we inform the listeners about + // retracted blocks and their transactions. This order is important, because + // if we enact and retract the same transaction at the same time, we want to + // send first the retract and than the prune event. if let Some(ref tree_route) = tree_route { + for retracted in tree_route.retracted() { + // notify txs awaiting finality that it has been retracted + pool.validated_pool().on_block_retracted(retracted.hash.clone()); + } + future::join_all( tree_route .enacted() @@ -592,9 +595,6 @@ impl MaintainedTransactionPool for BasicPool for retracted in tree_route.retracted() { let hash = retracted.hash.clone(); - // notify txs awaiting finality that it has been retracted - pool.validated_pool().on_block_retracted(hash.clone()); - let block_transactions = api.block_body(&BlockId::hash(hash)) .await .unwrap_or_else(|e| { diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 85d8066e03..61aba5efe3 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -678,6 +678,66 @@ fn fork_aware_finalization() { } } +/// Tests that when pruning and retracing a tx by the same event, we generate +/// the correct events in the correct order. +#[test] +fn prune_and_retract_tx_at_same_time() { + let api = TestApi::empty(); + // starting block A1 (last finalized.) + api.push_block(1, vec![]); + + let (pool, _background, _) = BasicPool::new_test(api.into()); + + let from_alice = uxt(Alice, 1); + pool.api.increment_nonce(Alice.into()); + + let watcher = block_on( + pool.submit_and_watch(&BlockId::number(1), SOURCE, from_alice.clone()) + ).expect("1. Imported"); + + // Block B1 + let b1 = { + let header = pool.api.push_block(2, vec![from_alice.clone()]); + assert_eq!(pool.status().ready, 1); + + let event = ChainEvent::NewBlock { + hash: header.hash(), + is_new_best: true, + header: header.clone(), + tree_route: None, + }; + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + header.hash() + }; + + // Block B2 + let b2 = { + let header = pool.api.push_block(2, vec![from_alice.clone()]); + assert_eq!(pool.status().ready, 0); + + let event = block_event_with_retracted(header.clone(), b1, &*pool.api); + block_on(pool.maintain(event)); + assert_eq!(pool.status().ready, 0); + + let event = ChainEvent::Finalized { hash: header.hash() }; + block_on(pool.maintain(event)); + + header.hash() + }; + + { + let mut stream = futures::executor::block_on_stream(watcher); + assert_eq!(stream.next(), Some(TransactionStatus::Ready)); + assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1.clone()))); + assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1))); + assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2.clone()))); + assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2))); + assert_eq!(stream.next(), None); + } +} + + /// This test ensures that transactions from a fork are re-submitted if /// the forked block is not part of the retracted blocks. This happens as the /// retracted block list only contains the route from the old best to the new -- GitLab From afdf5ef01da479d3c662a041bc1ebcc7d1615043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 12 Jun 2020 15:21:39 +0200 Subject: [PATCH 156/280] Deprecate FunctionOf and remove its users (#6340) * Deprecate FunctionOf and remove users * Remove unused import --- frame/contracts/src/lib.rs | 20 ++++--------------- frame/evm/src/lib.rs | 23 ++++------------------ frame/recovery/src/lib.rs | 8 ++------ frame/scheduler/src/lib.rs | 8 ++------ frame/sudo/src/lib.rs | 24 ++++------------------- frame/sudo/src/mock.rs | 14 +++----------- frame/support/src/weights.rs | 11 +++++++++-- frame/system/src/lib.rs | 37 ++++++++++++------------------------ frame/utility/src/lib.rs | 35 +++++++++++++--------------------- 9 files changed, 53 insertions(+), 127 deletions(-) diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 8f90f557ca..245c95a4fa 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -117,7 +117,7 @@ use frame_support::{ parameter_types, IsSubType, storage::child::{self, ChildInfo}, }; use frame_support::traits::{OnUnbalanced, Currency, Get, Time, Randomness}; -use frame_support::weights::{FunctionOf, DispatchClass, Weight, GetDispatchInfo, Pays}; +use frame_support::weights::GetDispatchInfo; use frame_system::{self as system, ensure_signed, RawOrigin, ensure_root}; use pallet_contracts_primitives::{RentProjection, ContractAccessError}; @@ -481,11 +481,7 @@ decl_module! { /// Stores the given binary Wasm code into the chain's storage and returns its `codehash`. /// You can instantiate contracts only with stored code. - #[weight = FunctionOf( - |args: (&Vec,)| Module::::calc_code_put_costs(args.0), - DispatchClass::Normal, - Pays::Yes - )] + #[weight = Module::::calc_code_put_costs(&code)] pub fn put_code( origin, code: Vec @@ -506,11 +502,7 @@ decl_module! { /// * If the account is a regular account, any value will be transferred. /// * If no account exists and the call value is not less than `existential_deposit`, /// a regular account will be created and any value will be transferred. - #[weight = FunctionOf( - |args: (&::Source, &BalanceOf, &Weight, &Vec)| *args.2, - DispatchClass::Normal, - Pays::Yes - )] + #[weight = *gas_limit] pub fn call( origin, dest: ::Source, @@ -538,11 +530,7 @@ decl_module! { /// after the execution is saved as the `code` of the account. That code will be invoked /// upon any call received by this account. /// - The contract is initialized. - #[weight = FunctionOf( - |args: (&BalanceOf, &Weight, &CodeHash, &Vec)| *args.1, - DispatchClass::Normal, - Pays::Yes - )] + #[weight = *gas_limit] pub fn instantiate( origin, #[compact] endowment: BalanceOf, diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index c5df79fdb8..3600b866b2 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -30,7 +30,7 @@ use codec::{Encode, Decode}; #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use frame_support::{ensure, decl_module, decl_storage, decl_event, decl_error}; -use frame_support::weights::{Weight, DispatchClass, FunctionOf, Pays}; +use frame_support::weights::Weight; use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement, Get}; use frame_system::{self as system, ensure_signed}; use sp_runtime::ModuleId; @@ -273,12 +273,7 @@ decl_module! { } /// Issue an EVM call operation. This is similar to a message call transaction in Ethereum. - #[weight = FunctionOf( - |(_, _, _, gas_limit, gas_price, _): (&H160, &Vec, &U256, &u32, &U256, &Option)| - (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight)] fn call( origin, target: H160, @@ -306,12 +301,7 @@ decl_module! { /// Issue an EVM create operation. This is similar to a contract creation transaction in /// Ethereum. - #[weight = FunctionOf( - |(_, _, gas_limit, gas_price, _): (&Vec, &U256, &u32, &U256, &Option)| - (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight)] fn create( origin, init: Vec, @@ -339,12 +329,7 @@ decl_module! { } /// Issue an EVM create2 operation. - #[weight = FunctionOf( - |(_, _, _, gas_limit, gas_price, _): (&Vec, &H256, &U256, &u32, &U256, &Option)| - (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight)] fn create2( origin, init: Vec, diff --git a/frame/recovery/src/lib.rs b/frame/recovery/src/lib.rs index cd3ba76b37..470803d22e 100644 --- a/frame/recovery/src/lib.rs +++ b/frame/recovery/src/lib.rs @@ -160,7 +160,7 @@ use codec::{Encode, Decode}; use frame_support::{ decl_module, decl_event, decl_storage, decl_error, ensure, - Parameter, RuntimeDebug, weights::{GetDispatchInfo, FunctionOf, Pays}, + Parameter, RuntimeDebug, weights::GetDispatchInfo, traits::{Currency, ReservableCurrency, Get, BalanceStatus}, dispatch::PostDispatchInfo, }; @@ -336,11 +336,7 @@ decl_module! { /// - The weight of the `call` + 10,000. /// - One storage lookup to check account is recovered by `who`. O(1) /// # - #[weight = FunctionOf( - |args: (&T::AccountId, &Box<::Call>)| args.1.get_dispatch_info().weight + 10_000, - |args: (&T::AccountId, &Box<::Call>)| args.1.get_dispatch_info().class, - Pays::Yes, - )] + #[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)] fn as_recovered(origin, account: T::AccountId, call: Box<::Call> diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 580b3b060e..cd3aba45ed 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -400,7 +400,7 @@ mod tests { use frame_support::{ impl_outer_event, impl_outer_origin, impl_outer_dispatch, parameter_types, assert_ok, traits::{OnInitialize, OnFinalize}, - weights::{DispatchClass, FunctionOf, Pays, constants::RocksDbWeight}, + weights::constants::RocksDbWeight, }; use sp_core::H256; // The testing primitives are very useful for avoiding having to work with signatures @@ -439,11 +439,7 @@ mod tests { pub struct Module for enum Call where origin: ::Origin { fn deposit_event() = default; - #[weight = FunctionOf( - |args: (&u32, &Weight)| *args.1, - |_: (&u32, &Weight)| DispatchClass::Normal, - Pays::Yes, - )] + #[weight = *weight] fn log(origin, i: u32, weight: Weight) { ensure_root(origin)?; Self::deposit_event(Event::Logged(i, weight)); diff --git a/frame/sudo/src/lib.rs b/frame/sudo/src/lib.rs index 3d5d1b2582..55c2c97d12 100644 --- a/frame/sudo/src/lib.rs +++ b/frame/sudo/src/lib.rs @@ -93,7 +93,7 @@ use sp_runtime::{DispatchResult, traits::{StaticLookup, Dispatchable}}; use frame_support::{ Parameter, decl_module, decl_event, decl_storage, decl_error, ensure, }; -use frame_support::weights::{Weight, GetDispatchInfo, FunctionOf, Pays}; +use frame_support::weights::{Weight, GetDispatchInfo}; use frame_system::{self as system, ensure_signed}; #[cfg(test)] @@ -126,11 +126,7 @@ decl_module! { /// - One DB write (event). /// - Weight of derivative `call` execution + 10,000. /// # - #[weight = FunctionOf( - |args: (&Box<::Call>,)| args.0.get_dispatch_info().weight + 10_000, - |args: (&Box<::Call>,)| args.0.get_dispatch_info().class, - Pays::Yes, - )] + #[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)] fn sudo(origin, call: Box<::Call>) { // This is a public call, so we ensure that the origin is some signed account. let sender = ensure_signed(origin)?; @@ -150,11 +146,7 @@ decl_module! { /// - O(1). /// - The weight of this call is defined by the caller. /// # - #[weight = FunctionOf( - |(_, &weight): (&Box<::Call>,&Weight,)| weight, - |(call, _): (&Box<::Call>,&Weight,)| call.get_dispatch_info().class, - Pays::Yes, - )] + #[weight = (*_weight, call.get_dispatch_info().class)] fn sudo_unchecked_weight(origin, call: Box<::Call>, _weight: Weight) { // This is a public call, so we ensure that the origin is some signed account. let sender = ensure_signed(origin)?; @@ -195,15 +187,7 @@ decl_module! { /// - One DB write (event). /// - Weight of derivative `call` execution + 10,000. /// # - #[weight = FunctionOf( - |args: (&::Source, &Box<::Call>,)| { - args.1.get_dispatch_info().weight + 10_000 - }, - |args: (&::Source, &Box<::Call>,)| { - args.1.get_dispatch_info().class - }, - Pays::Yes, - )] + #[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)] fn sudo_as(origin, who: ::Source, call: Box<::Call>) { // This is a public call, so we ensure that the origin is some signed account. let sender = ensure_signed(origin)?; diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index a270787da6..54b9100d61 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -20,7 +20,7 @@ use super::*; use frame_support::{ impl_outer_origin, impl_outer_dispatch, impl_outer_event, parameter_types, - weights::{Weight, DispatchClass} + weights::Weight, }; use sp_core::H256; // The testing primitives are very useful for avoiding having to work with signatures @@ -56,11 +56,7 @@ pub mod logger { pub struct Module for enum Call where origin: ::Origin { fn deposit_event() = default; - #[weight = FunctionOf( - |args: (&i32, &Weight)| *args.1, - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = *weight] fn privileged_i32_log(origin, i: i32, weight: Weight){ // Ensure that the `origin` is `Root`. ensure_root(origin)?; @@ -68,11 +64,7 @@ pub mod logger { Self::deposit_event(RawEvent::AppendI32(i, weight)); } - #[weight = FunctionOf( - |args: (&i32, &Weight)| *args.1, - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = *weight] fn non_privileged_log(origin, i: i32, weight: Weight){ // Ensure that the `origin` is some signed account. let sender = ensure_signed(origin)?; diff --git a/frame/support/src/weights.rs b/frame/support/src/weights.rs index dd80f8d8a8..810bd2fcb6 100644 --- a/frame/support/src/weights.rs +++ b/frame/support/src/weights.rs @@ -425,9 +425,11 @@ impl PaysFee for (Weight, Pays) { /// with the same argument list as the dispatched, wrapped in a tuple. /// - `PF`: a `Pays` variant for whether this dispatch pays fee or not or a closure that /// returns a `Pays` variant with the same argument list as the dispatched, wrapped in a tuple. +#[deprecated = "Function arguments are available directly inside the annotation now."] pub struct FunctionOf(pub WD, pub CD, pub PF); // `WeighData` as a raw value +#[allow(deprecated)] impl WeighData for FunctionOf { fn weigh_data(&self, _: Args) -> Weight { self.0 @@ -435,6 +437,7 @@ impl WeighData for FunctionOf { } // `WeighData` as a closure +#[allow(deprecated)] impl WeighData for FunctionOf where WD : Fn(Args) -> Weight { @@ -444,6 +447,7 @@ impl WeighData for FunctionOf where } // `ClassifyDispatch` as a raw value +#[allow(deprecated)] impl ClassifyDispatch for FunctionOf { fn classify_dispatch(&self, _: Args) -> DispatchClass { self.1 @@ -451,6 +455,7 @@ impl ClassifyDispatch for FunctionOf } // `ClassifyDispatch` as a raw value +#[allow(deprecated)] impl ClassifyDispatch for FunctionOf where CD : Fn(Args) -> DispatchClass { @@ -460,6 +465,7 @@ impl ClassifyDispatch for FunctionOf where } // `PaysFee` as a raw value +#[allow(deprecated)] impl PaysFee for FunctionOf { fn pays_fee(&self, _: Args) -> Pays { self.2 @@ -467,6 +473,7 @@ impl PaysFee for FunctionOf { } // `PaysFee` as a closure +#[allow(deprecated)] impl PaysFee for FunctionOf where PF : Fn(Args) -> Pays { @@ -663,10 +670,10 @@ mod tests { fn f03(_origin) { unimplemented!(); } // weight = a x 10 + b - #[weight = FunctionOf(|args: (&u32, &u32)| (args.0 * 10 + args.1) as Weight, DispatchClass::Normal, Pays::Yes)] + #[weight = ((_a * 10 + _eb * 1) as Weight, DispatchClass::Normal, Pays::Yes)] fn f11(_origin, _a: u32, _eb: u32) { unimplemented!(); } - #[weight = FunctionOf(|_: (&u32, &u32)| 0, DispatchClass::Operational, Pays::Yes)] + #[weight = (0, DispatchClass::Operational, Pays::Yes)] fn f12(_origin, _a: u32, _eb: u32) { unimplemented!(); } #[weight = T::DbWeight::get().reads(3) + T::DbWeight::get().writes(2) + 10_000] diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index d702ad779a..1943256651 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -127,7 +127,7 @@ use frame_support::{ }, weights::{ Weight, RuntimeDbWeight, DispatchInfo, PostDispatchInfo, DispatchClass, - FunctionOf, Pays, extract_actual_weight, + extract_actual_weight, }, dispatch::DispatchResultWithPostInfo, }; @@ -566,11 +566,7 @@ decl_module! { /// A dispatch that will fill the block weight up to the given ratio. // TODO: This should only be available for testing, rather than in general usage, but // that's not possible at present (since it's within the decl_module macro). - #[weight = FunctionOf( - |(ratio,): (&Perbill,)| *ratio * T::MaximumBlockWeight::get(), - DispatchClass::Operational, - Pays::Yes, - )] + #[weight = (*_ratio * T::MaximumBlockWeight::get(), DispatchClass::Operational)] fn fill_block(origin, _ratio: Perbill) { ensure_root(origin)?; } @@ -669,13 +665,10 @@ decl_module! { /// - Base Weight: 0.568 * i µs /// - Writes: Number of items /// # - #[weight = FunctionOf( - |(items,): (&Vec,)| { - T::DbWeight::get().writes(items.len() as Weight) - .saturating_add((items.len() as Weight).saturating_mul(600_000)) - }, + #[weight = ( + T::DbWeight::get().writes(items.len() as Weight) + .saturating_add((items.len() as Weight).saturating_mul(600_000)), DispatchClass::Operational, - Pays::Yes, )] fn set_storage(origin, items: Vec) { ensure_root(origin)?; @@ -692,13 +685,10 @@ decl_module! { /// - Base Weight: .378 * i µs /// - Writes: Number of items /// # - #[weight = FunctionOf( - |(keys,): (&Vec,)| { - T::DbWeight::get().writes(keys.len() as Weight) - .saturating_add((keys.len() as Weight).saturating_mul(400_000)) - }, + #[weight = ( + T::DbWeight::get().writes(keys.len() as Weight) + .saturating_add((keys.len() as Weight).saturating_mul(400_000)), DispatchClass::Operational, - Pays::Yes, )] fn kill_storage(origin, keys: Vec) { ensure_root(origin)?; @@ -718,13 +708,10 @@ decl_module! { /// - Base Weight: 0.834 * P µs /// - Writes: Number of subkeys + 1 /// # - #[weight = FunctionOf( - |(_, &subkeys): (&Key, &u32)| { - T::DbWeight::get().writes(Weight::from(subkeys) + 1) - .saturating_add((Weight::from(subkeys) + 1).saturating_mul(850_000)) - }, + #[weight = ( + T::DbWeight::get().writes(Weight::from(*_subkeys) + 1) + .saturating_add((Weight::from(*_subkeys) + 1).saturating_mul(850_000)), DispatchClass::Operational, - Pays::Yes, )] fn kill_prefix(origin, prefix: Key, _subkeys: u32) { ensure_root(origin)?; @@ -1904,7 +1891,7 @@ pub(crate) mod tests { use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError}; use frame_support::{ impl_outer_origin, parameter_types, assert_ok, assert_noop, assert_err, - weights::WithPostDispatchInfo, + weights::{WithPostDispatchInfo, Pays}, }; impl_outer_origin! { diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index 34385b6786..add1049b26 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -56,7 +56,7 @@ use sp_core::TypeId; use sp_io::hashing::blake2_256; use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure}; use frame_support::{traits::{Filter, FilterStack, ClearFilterGuard}, - weights::{Weight, GetDispatchInfo, DispatchClass, FunctionOf, Pays}, dispatch::PostDispatchInfo, + weights::{Weight, GetDispatchInfo, DispatchClass}, dispatch::PostDispatchInfo, }; use frame_system::{self as system, ensure_signed, ensure_root}; use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; @@ -136,14 +136,12 @@ decl_module! { /// `BatchInterrupted` event is deposited, along with the number of successful calls made /// and the error of the failed call. If all were successful, then the `BatchCompleted` /// event is deposited. - #[weight = FunctionOf( - |args: (&Vec<::Call>,)| { - args.0.iter() - .map(|call| call.get_dispatch_info().weight) - .fold(15_000_000, |a: Weight, n| a.saturating_add(n).saturating_add(1_000_000)) - }, - |args: (&Vec<::Call>,)| { - let all_operational = args.0.iter() + #[weight = ( + calls.iter() + .map(|call| call.get_dispatch_info().weight) + .fold(15_000_000, |a: Weight, n| a.saturating_add(n).saturating_add(1_000_000)), + { + let all_operational = calls.iter() .map(|call| call.get_dispatch_info().class) .all(|class| class == DispatchClass::Operational); if all_operational { @@ -152,7 +150,6 @@ decl_module! { DispatchClass::Normal } }, - Pays::Yes, )] fn batch(origin, calls: Vec<::Call>) { let is_root = ensure_root(origin.clone()).is_ok(); @@ -185,12 +182,9 @@ decl_module! { /// - Base weight: 2.861 µs /// - Plus the weight of the `call` /// # - #[weight = FunctionOf( - |args: (&u16, &Box<::Call>)| { - args.1.get_dispatch_info().weight.saturating_add(3_000_000) - }, - |args: (&u16, &Box<::Call>)| args.1.get_dispatch_info().class, - Pays::Yes, + #[weight = ( + call.get_dispatch_info().weight.saturating_add(3_000_000), + call.get_dispatch_info().class, )] fn as_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; @@ -217,12 +211,9 @@ decl_module! { /// - Base weight: 2.861 µs /// - Plus the weight of the `call` /// # - #[weight = FunctionOf( - |args: (&u16, &Box<::Call>)| { - args.1.get_dispatch_info().weight.saturating_add(3_000_000) - }, - |args: (&u16, &Box<::Call>)| args.1.get_dispatch_info().class, - Pays::Yes, + #[weight = ( + call.get_dispatch_info().weight.saturating_add(3_000_000), + call.get_dispatch_info().class, )] fn as_limited_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; -- GitLab From d735e4d0b5378c227f81a5127a1d4544de112fd8 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Fri, 12 Jun 2020 15:24:46 +0200 Subject: [PATCH 157/280] Add events for balance reserve and unreserve functions (#6330) * almost works * add clone to BalanceStatus * reserve event * fix staking tests * fix balances tests * Update frame/balances/src/tests.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * restore tests and move event emission * move repatriate reserved event outside of mutate_account * clean up events in tests Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- frame/balances/src/lib.rs | 32 ++++++++++++++++++++------- frame/balances/src/tests.rs | 44 ++++++++++++++++++++++++++++++++++++- frame/staking/src/tests.rs | 6 ++--- frame/support/src/traits.rs | 1 + 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index b6dc4a11f0..48b2d425f1 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -230,6 +230,13 @@ decl_event!( BalanceSet(AccountId, Balance, Balance), /// Some amount was deposited (e.g. for transaction fees). Deposit(AccountId, Balance), + /// Some balance was reserved (moved from free to reserved). + Reserved(AccountId, Balance), + /// Some balance was unreserved (moved from reserved to free). + Unreserved(AccountId, Balance), + /// Some balance was moved from the reserve of the first account to the second account. + /// Final argument indicates the destination balance type. + ReserveRepatriated(AccountId, AccountId, Balance, Status), } ); @@ -1150,8 +1157,11 @@ impl, I: Instance> ReservableCurrency for Module Self::try_mutate_account(who, |account, _| -> DispatchResult { account.free = account.free.checked_sub(&value).ok_or(Error::::InsufficientBalance)?; account.reserved = account.reserved.checked_add(&value).ok_or(Error::::Overflow)?; - Self::ensure_can_withdraw(who, value, WithdrawReason::Reserve.into(), account.free) - }) + Self::ensure_can_withdraw(&who, value.clone(), WithdrawReason::Reserve.into(), account.free) + })?; + + Self::deposit_event(RawEvent::Reserved(who.clone(), value)); + Ok(()) } /// Unreserve some funds, returning any amount that was unable to be unreserved. @@ -1160,14 +1170,17 @@ impl, I: Instance> ReservableCurrency for Module fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance { if value.is_zero() { return Zero::zero() } - Self::mutate_account(who, |account| { + let actual = Self::mutate_account(who, |account| { let actual = cmp::min(account.reserved, value); account.reserved -= actual; // defensive only: this can never fail since total issuance which is at least free+reserved // fits into the same data type. account.free = account.free.saturating_add(actual); - value - actual - }) + actual + }); + + Self::deposit_event(RawEvent::Unreserved(who.clone(), actual.clone())); + value - actual } /// Slash from reserved balance, returning the negative imbalance created, @@ -1208,7 +1221,7 @@ impl, I: Instance> ReservableCurrency for Module }; } - Self::try_mutate_account(beneficiary, |to_account, is_new| -> Result { + let actual = Self::try_mutate_account(beneficiary, |to_account, is_new|-> Result { ensure!(!is_new, Error::::DeadAccount); Self::try_mutate_account(slashed, |from_account, _| -> Result { let actual = cmp::min(from_account.reserved, value); @@ -1217,9 +1230,12 @@ impl, I: Instance> ReservableCurrency for Module Status::Reserved => to_account.reserved = to_account.reserved.checked_add(&actual).ok_or(Error::::Overflow)?, } from_account.reserved -= actual; - Ok(value - actual) + Ok(actual) }) - }) + })?; + + Self::deposit_event(RawEvent::ReserveRepatriated(slashed.clone(), beneficiary.clone(), actual, status)); + Ok(value - actual) } } diff --git a/frame/balances/src/tests.rs b/frame/balances/src/tests.rs index c49a04ae56..2724291f14 100644 --- a/frame/balances/src/tests.rs +++ b/frame/balances/src/tests.rs @@ -69,6 +69,10 @@ macro_rules! decl_tests { evt } + fn last_event() -> Event { + system::Module::::events().pop().expect("Event expected").event + } + #[test] fn basic_locking_should_work() { <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { @@ -170,7 +174,7 @@ macro_rules! decl_tests { ); assert_noop!( >::reserve(&1, 1), - Error::<$test, _>::LiquidityRestrictions + Error::<$test, _>::LiquidityRestrictions, ); assert!( as SignedExtension>::pre_dispatch( ChargeTransactionPayment::from(1), @@ -485,6 +489,10 @@ macro_rules! decl_tests { let _ = Balances::deposit_creating(&2, 1); assert_ok!(Balances::reserve(&1, 110)); assert_ok!(Balances::repatriate_reserved(&1, &2, 41, Status::Free), 0); + assert_eq!( + last_event(), + Event::balances(RawEvent::ReserveRepatriated(1, 2, 41, Status::Free)), + ); assert_eq!(Balances::reserved_balance(1), 69); assert_eq!(Balances::free_balance(1), 0); assert_eq!(Balances::reserved_balance(2), 0); @@ -683,6 +691,40 @@ macro_rules! decl_tests { }); } + #[test] + fn emit_events_with_reserve_and_unreserve() { + <$ext_builder>::default() + .build() + .execute_with(|| { + let _ = Balances::deposit_creating(&1, 100); + + System::set_block_number(2); + let _ = Balances::reserve(&1, 10); + + assert_eq!( + last_event(), + Event::balances(RawEvent::Reserved(1, 10)), + ); + + System::set_block_number(3); + let _ = Balances::unreserve(&1, 5); + + assert_eq!( + last_event(), + Event::balances(RawEvent::Unreserved(1, 5)), + ); + + System::set_block_number(4); + let _ = Balances::unreserve(&1, 6); + + // should only unreserve 5 + assert_eq!( + last_event(), + Event::balances(RawEvent::Unreserved(1, 5)), + ); + }); + } + #[test] fn emit_events_with_existential_deposit() { <$ext_builder>::default() diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 8a7ae011c9..078f5e0a79 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -337,7 +337,7 @@ fn staking_should_work() { claimed_rewards: vec![0], }) ); - // e.g. it cannot spend more than 500 that it has free from the total 2000 + // e.g. it cannot reserve more than 500 that it has free from the total 2000 assert_noop!( Balances::reserve(&3, 501), BalancesError::::LiquidityRestrictions @@ -783,10 +783,10 @@ fn cannot_reserve_staked_balance() { assert_eq!(Balances::free_balance(11), 1000); // Confirm account 11 (via controller 10) is totally staked assert_eq!(Staking::eras_stakers(Staking::active_era().unwrap().index, 11).own, 1000); - // Confirm account 11 cannot transfer as a result + // Confirm account 11 cannot reserve as a result assert_noop!( Balances::reserve(&11, 1), - BalancesError::::LiquidityRestrictions + BalancesError::::LiquidityRestrictions, ); // Give account 11 extra free balance diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index fae0ad2fcb..67eff71daf 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -1008,6 +1008,7 @@ pub trait Currency { } /// Status of funds. +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug)] pub enum BalanceStatus { /// Funds are free, as corresponding to `free` item in Balances. Free, -- GitLab From 1a31f4319ef4938dc121e7b7e4e9ca73bd875249 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Sat, 13 Jun 2020 18:55:44 +0200 Subject: [PATCH 158/280] Update contributing guide with new label policy (#6333) * mention C and M labels in contributing guide * update PR template with more specific instructions * update PR template with updated label rules and contributing guide link * update contibuting guide --- docs/CONTRIBUTING.adoc | 35 ++++++++++++++++++++++++++++------- docs/PULL_REQUEST_TEMPLATE.md | 13 ++++++++++--- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/docs/CONTRIBUTING.adoc b/docs/CONTRIBUTING.adoc index b573aef50d..3dca7432c0 100644 --- a/docs/CONTRIBUTING.adoc +++ b/docs/CONTRIBUTING.adoc @@ -19,17 +19,30 @@ There are a few basic ground-rules for contributors (including the maintainer(s) == Merge Process -Merging pull requests once CI is successful: +*In General* -. A PR needs to be reviewed and approved by project maintainers unless: - - it does not alter any logic (e.g. comments, dependencies, docs), then it may be tagged https://github.com/paritytech/substrate/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author once CI is complete. - - it is an urgent fix with no large change to logic, then it may be merged after a non-author contributor has approved the review once CI is complete. +A PR needs to be reviewed and approved by project maintainers unless: +- it does not alter any logic (e.g. comments, dependencies, docs), then it may be tagged https://github.com/paritytech/substrate/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author once CI is complete. +- it is an urgent fix with no large change to logic, then it may be merged after a non-author contributor has approved the review once CI is complete. + +*Labels TLDR:* + +- `A-*` Pull request status. ONE REQUIRED. +- `B-*` Changelog and/or Runtime-upgrade post composition markers. ONE REQUIRED. (used by automation) +- `C-*` Release notes release-priority markers. EXACTLY ONE REQUIRED. (used by automation) +- `D-*` More general tags on the PR denoting various implications and requirements. + +*Process:* + +. Please tag each PR with exactly one `A`, `B` and `C` label at the minimum. . Once a PR is ready for review please add the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`A0-pleasereview`] label. Generally PRs should sit with this label for 48 hours in order to garner feedback. It may be merged before if all relevant parties had a look at it. . If the first review is not an approval, swap `A0-pleasereview` to any label `[A3, A7]` to indicate that the PR has received some feedback, but needs further work. For example. https://github.com/paritytech/substrate/labels/A3-inprogress[`A3-inprogress`] is a general indicator that the PR is work in progress and https://github.com/paritytech/substrate/labels/A4-gotissues[`A4-gotissues`] means that it has significant problems that need fixing. Once the work is done, change the label back to `A0-pleasereview`. You might end up swapping a few times back and forth to climb up the A label group. Once a PR is https://github.com/paritytech/substrate/labels/A8-mergeoncegreen[`A8-mergeoncegreen`], it is ready to merge. . PRs must be tagged with respect to _release notes_ with https://github.com/paritytech/substrate/labels/B0-silent[`B0-silent`] and `B1-..`. The former indicates that no changes should be mentioned in any release notes. The latter indicates that the changes should be reported in the corresponding release note -. PRs that break the external API must be tagged with https://github.com/paritytech/substrate/labels/B2-breaksapi[`B2-breaksapi`], when it changes the FRAME or consensus of running system with https://github.com/paritytech/substrate/labels/B3-breaksconsensus[`B3-breaksconsensus`] -. No PR should be merged until all reviews' comments are addressed. +. PRs that break the external API must be tagged with https://github.com/paritytech/substrate/labels/B2-breaksapi[`B2-breaksapi`], when it changes the FRAME or consensus of running system with https://github.com/paritytech/substrate/labels/B3-breaksconsensus[`B3-breaksconsensus`]. +. PRs should be labeled with their release importance via the `C1-C9`. +. PRs should be categorized into projects. +. No PR should be merged until all reviews' comments are addressed and CI is successful. *Reviewing pull requests*: @@ -49,7 +62,7 @@ When reviewing a pull request, the end-goal is to suggest useful changes to the === Updating Polkadot as well -**All pull requests will be checked agains either Polkadot master, or your provided Polkadot companion PR**. That is, If your PR changes the external APIs or interfaces used by Polkadot. If you tagged the PR with `breaksapi` or `breaksconsensus` this is most certainly the case, in all other cases check for it by running step 1 below. +**All pull requests will be checked against either Polkadot master, or your provided Polkadot companion PR**. That is, If your PR changes the external APIs or interfaces used by Polkadot. If you tagged the PR with `breaksapi` or `breaksconsensus` this is most certainly the case, in all other cases check for it by running step 1 below. To create a Polkadot companion PR: @@ -69,6 +82,14 @@ As there might be multiple pending PRs that might conflict with one another, a) We use https://github.com/paritytech/substrate/labels[labels] to manage PRs and issues and communicate state of a PR. Please familiarize yourself with them. Furthermore we are organizing issues in https://github.com/paritytech/substrate/milestones[milestones]. Best way to get started is to a pick a ticket from the current milestone tagged https://github.com/paritytech/substrate/issues?q=is%3Aissue+is%3Aopen+label%3AQ2-easy[`easy`] or https://github.com/paritytech/substrate/issues?q=is%3Aissue+is%3Aopen+label%3AQ3-medium[`medium`] and get going or https://github.com/paritytech/substrate/issues?q=is%3Aissue+is%3Aopen+label%3AX1-mentor[`mentor`] and get in contact with the mentor offering their support on that larger task. +== Issues +Please label issues with the following labels: + +. `I-*` Issue severity and type. EXACTLY ONE REQUIRED. +. `P-*` Issue priority. AT MOST ONE ALLOWED. +. `Q-*` Issue difficulty. AT MOST ONE ALLOWED. +. `Z-*` More general tags on the issue, denoting context and resolution. + == Releases Declaring formal releases remains the prerogative of the project maintainer(s). diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index fa2c15e6c0..8ca6ba9b01 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -6,17 +6,24 @@ Before you submitting, please check that: - What does it do? - What important points reviewers should know? - Is there something left for follow-up PRs? -- [ ] You labeled the PR with appropriate labels if you have permissions to do so. +- [ ] You labeled the PR appropriately if you have permissions to do so: + - [ ] `A*` for PR status (**one required**) + - [ ] `B*` for changelog (**one required**) + - [ ] `C*` for release notes (**exactly one required**) + - [ ] `D*` for various implications/requirements + - [ ] Github's project assignment - [ ] You mentioned a related issue if this PR related to it, e.g. `Fixes #228` or `Related #1337`. - [ ] You asked any particular reviewers to review. If you aren't sure, start with GH suggestions. -- [ ] Your PR adheres [the style guide](https://wiki.parity.io/Substrate-Style-Guide) - - In particular, mind the maximal line length. +- [ ] Your PR adheres to [the style guide](https://wiki.parity.io/Substrate-Style-Guide) + - In particular, mind the maximal line length of 100 (120 in exceptional circumstances). - There is no commented code checked in unless necessary. - Any panickers have a proof or removed. - [ ] You bumped the runtime version if there are breaking changes in the **runtime**. - [ ] You updated any rustdocs which may have changed - [ ] Has the PR altered the external API or interfaces used by Polkadot? Do you have the corresponding Polkadot PR ready? +Refer to [the contributing guide](https://github.com/paritytech/substrate/blob/master/docs/CONTRIBUTING.adoc) for details. + After you've read this notice feel free to remove it. Thank you! -- GitLab From 740115371b096af4ca2c3b2c860d95ba801cffcb Mon Sep 17 00:00:00 2001 From: Tore19 <289649077@qq.com> Date: Mon, 15 Jun 2020 02:56:40 +0800 Subject: [PATCH 159/280] adding a ss58 format for Stafi Network (#6347) --- primitives/core/src/crypto.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index b92eb8eab0..9b84bd84ca 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -470,6 +470,8 @@ ss58_address_format!( (16, "kulupu", "Kulupu mainnet, standard account (*25519).") DarwiniaAccount => (18, "darwinia", "Darwinia Chain mainnet, standard account (*25519).") + StafiAccount => + (20, "stafi", "Stafi mainnet, standard account (*25519).") RobonomicsAccount => (32, "robonomics", "Any Robonomics network standard account (*25519).") CentrifugeAccount => -- GitLab From f837c3901cd2474ba05c46b54babbd32bb522bf7 Mon Sep 17 00:00:00 2001 From: wangjj9219 <183318287@qq.com> Date: Mon, 15 Jun 2020 23:05:17 +0800 Subject: [PATCH 160/280] add extend_lock for StorageLock (#6323) * add extend_lock for StorageLock * changes * changes --- .../runtime/src/offchain/storage_lock.rs | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/primitives/runtime/src/offchain/storage_lock.rs b/primitives/runtime/src/offchain/storage_lock.rs index f8defa4224..4718d2e3dd 100644 --- a/primitives/runtime/src/offchain/storage_lock.rs +++ b/primitives/runtime/src/offchain/storage_lock.rs @@ -264,6 +264,24 @@ impl<'a, L: Lockable> StorageLock<'a, L> { } } + /// Extend active lock's deadline + fn extend_active_lock(&mut self) -> Result<::Deadline, ()> { + let res = self.value_ref.mutate(|s: Option>| -> Result<::Deadline, ()> { + match s { + // lock is present and is still active, extend the lock. + Some(Some(deadline)) if !::has_expired(&deadline) => + Ok(self.lockable.deadline()), + // other cases + _ => Err(()), + } + }); + match res { + Ok(Ok(deadline)) => Ok(deadline), + Ok(Err(_)) => Err(()), + Err(e) => Err(e), + } + } + /// Internal lock helper to avoid lifetime conflicts. fn try_lock_inner( &mut self, @@ -337,6 +355,19 @@ impl<'a, 'b, L: Lockable> StorageLockGuard<'a, 'b, L> { pub fn forget(mut self) { let _ = self.lock.take(); } + + /// Extend the lock by guard deadline if it already exists. + /// + /// i.e. large sets of items for which it is hard to calculate a + /// meaning full conservative deadline which does not block for a + /// very long time on node termination. + pub fn extend_lock(&mut self) -> Result<::Deadline, ()> { + if let Some(ref mut lock) = self.lock { + lock.extend_active_lock() + } else { + Err(()) + } + } } impl<'a, 'b, L: Lockable> Drop for StorageLockGuard<'a, 'b, L> { @@ -512,4 +543,51 @@ mod tests { let opt = state.read().persistent_storage.get(b"", b"lock_3"); assert!(opt.is_some()); } + + #[test] + fn extend_active_lock() { + let (offchain, state) = testing::TestOffchainExt::new(); + let mut t = TestExternalities::default(); + t.register_extension(OffchainExt::new(offchain)); + + t.execute_with(|| { + let lock_expiration = Duration::from_millis(300); + + let mut lock = StorageLock::<'_, Time>::with_deadline(b"lock_4", lock_expiration); + let mut guard = lock.lock(); + + // sleep_until < lock_expiration + offchain::sleep_until(offchain::timestamp().add(Duration::from_millis(200))); + + // the lock is still active, extend it successfully + assert_eq!(guard.extend_lock().is_ok(), true); + + // sleep_until < deadline + offchain::sleep_until(offchain::timestamp().add(Duration::from_millis(200))); + + // the lock is still active, try_lock will fail + let mut lock = StorageLock::<'_, Time>::with_deadline(b"lock_4", lock_expiration); + let res = lock.try_lock(); + assert_eq!(res.is_ok(), false); + + // sleep again untill sleep_until > deadline + offchain::sleep_until(offchain::timestamp().add(Duration::from_millis(200))); + + // the lock has expired, failed to extend it + assert_eq!(guard.extend_lock().is_ok(), false); + guard.forget(); + + // try_lock will succeed + let mut lock = StorageLock::<'_, Time>::with_deadline(b"lock_4", lock_expiration); + let res = lock.try_lock(); + assert!(res.is_ok()); + let guard = res.unwrap(); + + guard.forget(); + }); + + // lock must have been cleared at this point + let opt = state.read().persistent_storage.get(b"", b"lock_4"); + assert_eq!(opt.unwrap(), vec![132_u8, 3u8, 0, 0, 0, 0, 0, 0]); // 132 + 256 * 3 = 900 + } } -- GitLab From 0db70ea9beb99d551013ca552e7eff6437c3deb8 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Mon, 15 Jun 2020 17:05:41 +0200 Subject: [PATCH 161/280] Introduce in-origin filtering (#6318) * impl filter in origin * remove IsCallable usage. Breaking: utility::batch(root, calls) no longer bypass BasicCallFilter * rename BasicCallFilter -> BaseCallFilter * refactor code * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * remove forgotten temporar comment * better add suggestion in another PR * refactor: use Clone instead of mem::replace * fix tests * fix tests * fix tests * fix benchmarks * Make root bypass filter in utility::batch * fix unused imports Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- .../pallets/template/src/mock.rs | 1 + bin/node-template/runtime/src/lib.rs | 2 + bin/node/runtime/src/lib.rs | 15 +- frame/assets/src/lib.rs | 1 + frame/aura/src/mock.rs | 1 + frame/authority-discovery/src/lib.rs | 1 + frame/authorship/src/lib.rs | 1 + frame/babe/src/mock.rs | 1 + frame/balances/src/lib.rs | 1 + frame/balances/src/tests_composite.rs | 1 + frame/balances/src/tests_local.rs | 1 + frame/benchmarking/src/lib.rs | 11 +- frame/benchmarking/src/tests.rs | 1 + frame/collective/src/lib.rs | 13 +- frame/contracts/src/tests.rs | 13 +- frame/democracy/src/benchmarking.rs | 18 +- frame/democracy/src/tests.rs | 1 + frame/democracy/src/tests/cancellation.rs | 6 +- frame/elections-phragmen/src/lib.rs | 18 +- frame/elections/src/mock.rs | 3 +- frame/elections/src/tests.rs | 4 +- frame/example-offchain-worker/src/tests.rs | 1 + frame/example/src/lib.rs | 32 ++-- frame/executive/src/lib.rs | 1 + frame/finality-tracker/src/lib.rs | 6 +- frame/generic-asset/src/lib.rs | 1 + frame/generic-asset/src/mock.rs | 1 + frame/generic-asset/src/tests.rs | 2 +- frame/grandpa/src/mock.rs | 1 + frame/grandpa/src/tests.rs | 6 +- frame/identity/src/lib.rs | 1 + frame/im-online/src/benchmarking.rs | 5 +- frame/im-online/src/mock.rs | 1 + frame/im-online/src/tests.rs | 2 +- frame/indices/src/mock.rs | 1 + frame/indices/src/tests.rs | 4 +- frame/membership/src/lib.rs | 1 + frame/multisig/src/lib.rs | 16 +- frame/multisig/src/tests.rs | 19 +-- frame/nicks/src/lib.rs | 1 + frame/offences/benchmarking/src/mock.rs | 1 + frame/offences/src/mock.rs | 1 + frame/proxy/src/lib.rs | 30 ++-- frame/proxy/src/tests.rs | 42 +++-- frame/randomness-collective-flip/src/lib.rs | 1 + frame/recovery/src/mock.rs | 1 + frame/recovery/src/tests.rs | 2 +- frame/scheduler/src/lib.rs | 11 +- frame/scored-pool/src/mock.rs | 1 + frame/session/benchmarking/src/mock.rs | 1 + frame/session/src/mock.rs | 1 + frame/society/src/mock.rs | 1 + frame/society/src/tests.rs | 2 +- frame/staking/fuzzer/src/mock.rs | 1 + frame/staking/fuzzer/src/submit_solution.rs | 8 +- frame/staking/src/benchmarking.rs | 10 +- frame/staking/src/mock.rs | 1 + frame/staking/src/tests.rs | 32 ++-- frame/sudo/src/mock.rs | 1 + frame/support/src/dispatch.rs | 82 +++++---- frame/support/src/lib.rs | 4 +- frame/support/src/metadata.rs | 4 + frame/support/src/origin.rs | 161 ++++++++++++++++-- frame/support/src/traits.rs | 57 +++++++ frame/support/test/tests/decl_error.rs | 2 + frame/support/test/tests/instance.rs | 2 + frame/support/test/tests/issue2219.rs | 2 + frame/support/test/tests/system.rs | 2 + frame/system/benches/bench.rs | 1 + frame/system/benchmarking/src/mock.rs | 1 + frame/system/src/lib.rs | 23 ++- frame/timestamp/src/lib.rs | 9 +- frame/transaction-payment/src/lib.rs | 1 + frame/treasury/src/tests.rs | 31 ++-- frame/utility/src/lib.rs | 58 +++---- frame/utility/src/tests.rs | 28 ++- frame/vesting/src/lib.rs | 1 + primitives/runtime/src/traits.rs | 2 +- test-utils/runtime/src/lib.rs | 3 +- 79 files changed, 536 insertions(+), 302 deletions(-) diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs index 4eed0e1e75..0d9ae7cff7 100644 --- a/bin/node-template/pallets/template/src/mock.rs +++ b/bin/node-template/pallets/template/src/mock.rs @@ -24,6 +24,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } impl system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = (); type Index = u64; diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 68d4eeeb7a..c58c478d92 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -135,6 +135,8 @@ parameter_types! { } impl system::Trait for Runtime { + /// The basic call filter to use in dispatchable. + type BaseCallFilter = (); /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index d64f641ea9..d776d72e2b 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -33,7 +33,7 @@ use frame_support::{ traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier}, }; use frame_system::{EnsureRoot, EnsureOneOf}; -use frame_support::traits::{Filter, InstanceFilter}; +use frame_support::traits::InstanceFilter; use codec::{Encode, Decode}; use sp_core::{ crypto::KeyTypeId, @@ -113,15 +113,6 @@ pub fn native_version() -> NativeVersion { type NegativeImbalance = >::NegativeImbalance; -pub struct BaseFilter; -impl Filter for BaseFilter { - fn filter(_call: &Call) -> bool { - true - } -} -pub struct IsCallable; -frame_support::impl_filter_stack!(IsCallable, BaseFilter, Call, is_callable); - pub struct DealWithFees; impl OnUnbalanced for DealWithFees { fn on_unbalanceds(mut fees_then_tips: impl Iterator) { @@ -155,6 +146,7 @@ parameter_types! { const_assert!(AvailableBlockRatio::get().deconstruct() >= AVERAGE_ON_INITIALIZE_WEIGHT.deconstruct()); impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Call = Call; type Index = Index; @@ -183,7 +175,6 @@ impl frame_system::Trait for Runtime { impl pallet_utility::Trait for Runtime { type Event = Event; type Call = Call; - type IsCallable = IsCallable; } parameter_types! { @@ -201,7 +192,6 @@ impl pallet_multisig::Trait for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type IsCallable = IsCallable; } parameter_types! { @@ -251,7 +241,6 @@ impl pallet_proxy::Trait for Runtime { type Event = Event; type Call = Call; type Currency = Balances; - type IsCallable = IsCallable; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 2c67a320c1..d428f435b6 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -304,6 +304,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type Call = (); diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index 84d895cd06..db2c86492f 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -46,6 +46,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index 1b7915ce3a..f6008c9719 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -143,6 +143,7 @@ mod tests { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = BlockNumber; diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index b9b30bf411..3023f8a2d3 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -418,6 +418,7 @@ mod tests { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index de00928171..b977ea9044 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -57,6 +57,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 48b2d425f1..e882bdf349 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -848,6 +848,7 @@ impl, I: Instance> PartialEq for ElevatedTrait { } impl, I: Instance> Eq for ElevatedTrait {} impl, I: Instance> frame_system::Trait for ElevatedTrait { + type BaseCallFilter = T::BaseCallFilter; type Origin = T::Origin; type Call = T::Call; type Index = T::Index; diff --git a/frame/balances/src/tests_composite.rs b/frame/balances/src/tests_composite.rs index 42036e624e..81cb3449a8 100644 --- a/frame/balances/src/tests_composite.rs +++ b/frame/balances/src/tests_composite.rs @@ -67,6 +67,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/balances/src/tests_local.rs b/frame/balances/src/tests_local.rs index 30143a6c7e..54ab22af33 100644 --- a/frame/balances/src/tests_local.rs +++ b/frame/balances/src/tests_local.rs @@ -67,6 +67,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index ae9ef90764..47e83cffbc 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -29,7 +29,8 @@ pub use utils::*; pub use analysis::Analysis; #[doc(hidden)] pub use sp_io::storage::root as storage_root; -pub use sp_runtime::traits::{Dispatchable, Zero}; +pub use sp_runtime::traits::Zero; +pub use frame_support; pub use paste; /// Construct pallet benchmarks for weighing dispatchables. @@ -242,7 +243,9 @@ macro_rules! benchmarks_iter { { $( $common )* } ( $( $names )* ) $name { $( $code )* }: { - as $crate::Dispatchable>::dispatch(Call::::$dispatch($($arg),*), $origin.into())?; + < + Call as $crate::frame_support::traits::UnfilteredDispatchable + >::dispatch_bypass_filter(Call::::$dispatch($($arg),*), $origin.into())?; } verify $postcode $( $rest )* @@ -262,7 +265,9 @@ macro_rules! benchmarks_iter { { $( $common )* } ( $( $names )* ) $name { $( $code )* }: { - as $crate::Dispatchable>::dispatch(Call::::$dispatch($($arg),*), $origin.into())?; + < + Call as $crate::frame_support::traits::UnfilteredDispatchable + >::dispatch_bypass_filter(Call::::$dispatch($($arg),*), $origin.into())?; } verify $postcode $( $rest )* diff --git a/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index dc9d160b5e..85e8bf5a5c 100644 --- a/frame/benchmarking/src/tests.rs +++ b/frame/benchmarking/src/tests.rs @@ -67,6 +67,7 @@ pub trait Trait { pub struct Test; impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 3192ef0fc1..4551f4917a 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -1015,10 +1015,11 @@ mod tests { pub const MaxProposals: u32 = 100; } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; - type Call = (); + type Call = Call; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; @@ -1167,7 +1168,7 @@ mod tests { let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; let hash = BlakeTwo256::hash_of(&proposal); - assert_ok!(Collective::set_members(Origin::ROOT, vec![1, 2, 3], Some(3), MAX_MEMBERS)); + assert_ok!(Collective::set_members(Origin::root(), vec![1, 2, 3], Some(3), MAX_MEMBERS)); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); @@ -1192,7 +1193,7 @@ mod tests { let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; let hash = BlakeTwo256::hash_of(&proposal); - assert_ok!(Collective::set_members(Origin::ROOT, vec![1, 2, 3], Some(1), MAX_MEMBERS)); + assert_ok!(Collective::set_members(Origin::root(), vec![1, 2, 3], Some(1), MAX_MEMBERS)); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); @@ -1260,7 +1261,7 @@ mod tests { Collective::voting(&hash), Some(Votes { index: 0, threshold: 3, ayes: vec![1, 2], nays: vec![], end }) ); - assert_ok!(Collective::set_members(Origin::ROOT, vec![2, 3, 4], None, MAX_MEMBERS)); + assert_ok!(Collective::set_members(Origin::root(), vec![2, 3, 4], None, MAX_MEMBERS)); assert_eq!( Collective::voting(&hash), Some(Votes { index: 0, threshold: 3, ayes: vec![2], nays: vec![], end }) @@ -1275,7 +1276,7 @@ mod tests { Collective::voting(&hash), Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![3], end }) ); - assert_ok!(Collective::set_members(Origin::ROOT, vec![2, 4], None, MAX_MEMBERS)); + assert_ok!(Collective::set_members(Origin::root(), vec![2, 4], None, MAX_MEMBERS)); assert_eq!( Collective::voting(&hash), Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![], end }) @@ -1618,7 +1619,7 @@ mod tests { // Proposal would normally succeed assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); // But Root can disapprove and remove it anyway - assert_ok!(Collective::disapprove_proposal(Origin::ROOT, hash.clone())); + assert_ok!(Collective::disapprove_proposal(Origin::root(), hash.clone())); let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::collective_Instance1(RawEvent::Proposed(1, 0, hash.clone(), 2))), diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 307b311889..a98fdf2d25 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -82,11 +82,12 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; type Hash = H256; - type Call = (); + type Call = Call; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; @@ -936,7 +937,7 @@ fn call_contract_removals() { #[test] fn inherent_claim_surcharge_contract_removals() { - removals(|| Contracts::claim_surcharge(Origin::NONE, BOB, Some(ALICE)).is_ok()); + removals(|| Contracts::claim_surcharge(Origin::none(), BOB, Some(ALICE)).is_ok()); } #[test] @@ -947,10 +948,10 @@ fn signed_claim_surcharge_contract_removals() { #[test] fn claim_surcharge_malus() { // Test surcharge malus for inherent - claim_surcharge(4, || Contracts::claim_surcharge(Origin::NONE, BOB, Some(ALICE)).is_ok(), true); - claim_surcharge(3, || Contracts::claim_surcharge(Origin::NONE, BOB, Some(ALICE)).is_ok(), true); - claim_surcharge(2, || Contracts::claim_surcharge(Origin::NONE, BOB, Some(ALICE)).is_ok(), true); - claim_surcharge(1, || Contracts::claim_surcharge(Origin::NONE, BOB, Some(ALICE)).is_ok(), false); + claim_surcharge(4, || Contracts::claim_surcharge(Origin::none(), BOB, Some(ALICE)).is_ok(), true); + claim_surcharge(3, || Contracts::claim_surcharge(Origin::none(), BOB, Some(ALICE)).is_ok(), true); + claim_surcharge(2, || Contracts::claim_surcharge(Origin::none(), BOB, Some(ALICE)).is_ok(), true); + claim_surcharge(1, || Contracts::claim_surcharge(Origin::none(), BOB, Some(ALICE)).is_ok(), false); // Test surcharge malus for signed claim_surcharge(4, || Contracts::claim_surcharge(Origin::signed(ALICE), BOB, None).is_ok(), true); diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index 3957b38f42..d0bd732448 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -22,7 +22,7 @@ use super::*; use frame_benchmarking::{benchmarks, account}; use frame_support::{ IterableStorageMap, - traits::{Currency, Get, EnsureOrigin, OnInitialize}, + traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable}, }; use frame_system::{RawOrigin, Module as System, self, EventRecord}; use sp_runtime::traits::{Bounded, One}; @@ -212,14 +212,14 @@ benchmarks! { for i in 0 .. r { let ref_idx = add_referendum::(i)?; let call = Call::::emergency_cancel(ref_idx); - call.dispatch(origin.clone())?; + call.dispatch_bypass_filter(origin.clone())?; } // Lets now measure one more let referendum_index = add_referendum::(r)?; let call = Call::::emergency_cancel(referendum_index); assert!(Democracy::::referendum_status(referendum_index).is_ok()); - }: { call.dispatch(origin)? } + }: { call.dispatch_bypass_filter(origin)? } verify { // Referendum has been canceled assert!(Democracy::::referendum_status(referendum_index).is_err()); @@ -239,7 +239,7 @@ benchmarks! { ); let call = Call::::external_propose(proposal_hash); - }: { call.dispatch(origin)? } + }: { call.dispatch_bypass_filter(origin)? } verify { // External proposal created ensure!(>::exists(), "External proposal didn't work"); @@ -251,7 +251,7 @@ benchmarks! { let origin = T::ExternalMajorityOrigin::successful_origin(); let proposal_hash = T::Hashing::hash_of(&p); let call = Call::::external_propose_majority(proposal_hash); - }: { call.dispatch(origin)? } + }: { call.dispatch_bypass_filter(origin)? } verify { // External proposal created ensure!(>::exists(), "External proposal didn't work"); @@ -263,7 +263,7 @@ benchmarks! { let origin = T::ExternalDefaultOrigin::successful_origin(); let proposal_hash = T::Hashing::hash_of(&p); let call = Call::::external_propose_default(proposal_hash); - }: { call.dispatch(origin)? } + }: { call.dispatch_bypass_filter(origin)? } verify { // External proposal created ensure!(>::exists(), "External proposal didn't work"); @@ -282,7 +282,7 @@ benchmarks! { let delay = 0; let call = Call::::fast_track(proposal_hash, voting_period.into(), delay.into()); - }: { call.dispatch(origin_fast_track)? } + }: { call.dispatch_bypass_filter(origin_fast_track)? } verify { assert_eq!(Democracy::::referendum_count(), 1, "referendum not created") } @@ -306,7 +306,7 @@ benchmarks! { let call = Call::::veto_external(proposal_hash); let origin = T::VetoOrigin::successful_origin(); ensure!(NextExternal::::get().is_some(), "no external proposal"); - }: { call.dispatch(origin)? } + }: { call.dispatch_bypass_filter(origin)? } verify { assert!(NextExternal::::get().is_none()); let (_, new_vetoers) = >::get(&proposal_hash).ok_or("no blacklist")?; @@ -347,7 +347,7 @@ benchmarks! { let origin = T::ExternalMajorityOrigin::successful_origin(); let proposal_hash = T::Hashing::hash_of(&r); let call = Call::::external_propose_majority(proposal_hash); - call.dispatch(origin)?; + call.dispatch_bypass_filter(origin)?; // External proposal created ensure!(>::exists(), "External proposal didn't work"); diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index 36c2b7093b..85bb1ffcfb 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -84,6 +84,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/democracy/src/tests/cancellation.rs b/frame/democracy/src/tests/cancellation.rs index e75fd28109..4221865a3e 100644 --- a/frame/democracy/src/tests/cancellation.rs +++ b/frame/democracy/src/tests/cancellation.rs @@ -29,7 +29,7 @@ fn cancel_referendum_should_work() { 0 ); assert_ok!(Democracy::vote(Origin::signed(1), r, aye(1))); - assert_ok!(Democracy::cancel_referendum(Origin::ROOT, r.into())); + assert_ok!(Democracy::cancel_referendum(Origin::root(), r.into())); next_block(); next_block(); @@ -53,8 +53,8 @@ fn cancel_queued_should_work() { assert!(pallet_scheduler::Agenda::::get(6)[0].is_some()); - assert_noop!(Democracy::cancel_queued(Origin::ROOT, 1), Error::::ProposalMissing); - assert_ok!(Democracy::cancel_queued(Origin::ROOT, 0)); + assert_noop!(Democracy::cancel_queued(Origin::root(), 1), Error::::ProposalMissing); + assert_ok!(Democracy::cancel_queued(Origin::root(), 0)); assert!(pallet_scheduler::Agenda::::get(6)[0].is_none()); }); } diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index c155c08caf..9436a15d5c 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -1070,10 +1070,11 @@ mod tests { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; - type Call = (); + type Call = Call; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; @@ -1376,11 +1377,8 @@ mod tests { // historical note: helper function was created in a period of time in which the API of vote // call was changing. Currently it is a wrapper for the original call and does not do much. // Nonetheless, totally harmless. - if let Origin::system(frame_system::RawOrigin::Signed(_account)) = origin { - Elections::vote(origin, votes, stake) - } else { - panic!("vote origin must be signed"); - } + ensure_signed(origin.clone()).expect("vote origin must be signed"); + Elections::vote(origin, votes, stake) } fn votes_of(who: &u64) -> Vec { @@ -2358,7 +2356,7 @@ mod tests { assert_ok!(submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(3), vec![3], 30)); - assert_ok!(Elections::remove_member(Origin::ROOT, 4, false)); + assert_ok!(Elections::remove_member(Origin::root(), 4, false)); assert_eq!(balances(&4), (35, 2)); // slashed assert_eq!(Elections::election_rounds(), 2); // new election round @@ -2381,7 +2379,7 @@ mod tests { // no replacement yet. assert_err_with_weight!( - Elections::remove_member(Origin::ROOT, 4, true), + Elections::remove_member(Origin::root(), 4, true), Error::::InvalidReplacement, Some(6000000), ); @@ -2403,7 +2401,7 @@ mod tests { // there is a replacement! and this one needs a weight refund. assert_err_with_weight!( - Elections::remove_member(Origin::ROOT, 4, false), + Elections::remove_member(Origin::root(), 4, false), Error::::InvalidReplacement, Some(6000000) // only thing that matters for now is that it is NOT the full block. ); @@ -2562,7 +2560,7 @@ mod tests { Elections::end_block(System::block_number()); assert_eq!(Elections::members_ids(), vec![2, 4]); - assert_ok!(Elections::remove_member(Origin::ROOT, 2, true)); + assert_ok!(Elections::remove_member(Origin::root(), 2, true)); assert_eq!(Elections::members_ids(), vec![4, 5]); }); } diff --git a/frame/elections/src/mock.rs b/frame/elections/src/mock.rs index 9971dac572..b0be542ab7 100644 --- a/frame/elections/src/mock.rs +++ b/frame/elections/src/mock.rs @@ -39,8 +39,9 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; diff --git a/frame/elections/src/tests.rs b/frame/elections/src/tests.rs index 8a9f58b54a..247b627252 100644 --- a/frame/elections/src/tests.rs +++ b/frame/elections/src/tests.rs @@ -671,7 +671,7 @@ fn retracting_active_voter_should_slash_reporter() { assert_ok!(Elections::end_block(System::block_number())); System::set_block_number(8); - assert_ok!(Elections::set_desired_seats(Origin::ROOT, 3)); + assert_ok!(Elections::set_desired_seats(Origin::root(), 3)); assert_ok!(Elections::end_block(System::block_number())); System::set_block_number(10); @@ -1245,7 +1245,7 @@ fn election_second_tally_should_use_runners_up() { System::set_block_number(8); assert_ok!(Elections::set_approvals(Origin::signed(6), vec![false, false, true, false], 1, 0, 60)); - assert_ok!(Elections::set_desired_seats(Origin::ROOT, 3)); + assert_ok!(Elections::set_desired_seats(Origin::root(), 3)); assert_ok!(Elections::end_block(System::block_number())); System::set_block_number(10); diff --git a/frame/example-offchain-worker/src/tests.rs b/frame/example-offchain-worker/src/tests.rs index 30c9c22593..ef910b95ff 100644 --- a/frame/example-offchain-worker/src/tests.rs +++ b/frame/example-offchain-worker/src/tests.rs @@ -54,6 +54,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = (); type Index = u64; diff --git a/frame/example/src/lib.rs b/frame/example/src/lib.rs index 6b3d6b5e5f..c8799cb62c 100644 --- a/frame/example/src/lib.rs +++ b/frame/example/src/lib.rs @@ -256,7 +256,7 @@ use sp_std::marker::PhantomData; use frame_support::{ - dispatch::DispatchResult, decl_module, decl_storage, decl_event, + dispatch::{DispatchResult, IsSubType}, decl_module, decl_storage, decl_event, weights::{DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee, Pays}, }; use sp_std::prelude::*; @@ -609,14 +609,13 @@ impl sp_std::fmt::Debug for WatchDummy { } } -impl SignedExtension for WatchDummy { +impl SignedExtension for WatchDummy +where + ::Call: IsSubType, T>, +{ const IDENTIFIER: &'static str = "WatchDummy"; type AccountId = T::AccountId; - // Note that this could also be assigned to the top-level call enum. It is passed into the - // Balances Pallet directly and since `Trait: pallet_balances::Trait`, you could also use `T::Call`. - // In that case, you would have had access to all call variants and could match on variants from - // other pallets. - type Call = Call; + type Call = ::Call; type AdditionalSigned = (); type Pre = (); @@ -635,8 +634,8 @@ impl SignedExtension for WatchDummy { } // check for `set_dummy` - match call { - Call::set_dummy(..) => { + match call.is_sub_type() { + Some(Call::set_dummy(..)) => { sp_runtime::print("set_dummy was received."); let mut valid_tx = ValidTransaction::default(); @@ -711,8 +710,8 @@ mod tests { use super::*; use frame_support::{ - assert_ok, impl_outer_origin, parameter_types, weights::{DispatchInfo, GetDispatchInfo}, - traits::{OnInitialize, OnFinalize} + assert_ok, impl_outer_origin, parameter_types, impl_outer_dispatch, + weights::{DispatchInfo, GetDispatchInfo}, traits::{OnInitialize, OnFinalize} }; use sp_core::H256; // The testing primitives are very useful for avoiding having to work with signatures @@ -727,6 +726,12 @@ mod tests { pub enum Origin for Test where system = frame_system {} } + impl_outer_dispatch! { + pub enum OuterCall for Test where origin: Origin { + self::Example, + } + } + // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of pallets we want to use. @@ -739,11 +744,12 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; type Hash = H256; - type Call = (); + type Call = OuterCall; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; @@ -827,7 +833,7 @@ mod tests { #[test] fn signed_ext_watch_dummy_works() { new_test_ext().execute_with(|| { - let call = >::set_dummy(10); + let call = >::set_dummy(10).into(); let info = DispatchInfo::default(); assert_eq!( diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index 04e095fec4..c6371d914a 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -545,6 +545,7 @@ mod tests { }; } impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type Call = Call; diff --git a/frame/finality-tracker/src/lib.rs b/frame/finality-tracker/src/lib.rs index a9cf9c2b70..e5ed9574e5 100644 --- a/frame/finality-tracker/src/lib.rs +++ b/frame/finality-tracker/src/lib.rs @@ -252,6 +252,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -337,10 +338,7 @@ mod tests { &Default::default(), Default::default(), ); - assert_ok!(FinalityTracker::dispatch( - Call::final_hint(i-1), - Origin::NONE, - )); + assert_ok!(FinalityTracker::final_hint(Origin::none(), i - 1)); FinalityTracker::on_finalize(i); let hdr = System::finalize(); parent_hash = hdr.hash(); diff --git a/frame/generic-asset/src/lib.rs b/frame/generic-asset/src/lib.rs index f94c83b5ed..403d9f8444 100644 --- a/frame/generic-asset/src/lib.rs +++ b/frame/generic-asset/src/lib.rs @@ -1120,6 +1120,7 @@ impl PartialEq for ElevatedTrait { } impl Eq for ElevatedTrait {} impl frame_system::Trait for ElevatedTrait { + type BaseCallFilter = T::BaseCallFilter; type Origin = T::Origin; type Call = T::Call; type Index = T::Index; diff --git a/frame/generic-asset/src/mock.rs b/frame/generic-asset/src/mock.rs index 04fd565091..a928c9d67b 100644 --- a/frame/generic-asset/src/mock.rs +++ b/frame/generic-asset/src/mock.rs @@ -46,6 +46,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/generic-asset/src/tests.rs b/frame/generic-asset/src/tests.rs index d5c0a877df..a094f69ba1 100644 --- a/frame/generic-asset/src/tests.rs +++ b/frame/generic-asset/src/tests.rs @@ -598,7 +598,7 @@ fn create_reserved_should_create_a_default_account_with_the_balance_given() { let created_asset_id = 9; let created_account_id = 0; - assert_ok!(GenericAsset::create_reserved(Origin::ROOT, created_asset_id, options)); + assert_ok!(GenericAsset::create_reserved(Origin::root(), created_asset_id, options)); // Tests for side effects. assert_eq!(>::get(created_asset_id), expected_total_issuance); diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 6cd7fddf92..0f3122c860 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -94,6 +94,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/grandpa/src/tests.rs b/frame/grandpa/src/tests.rs index e15021733f..2337e00e8d 100644 --- a/frame/grandpa/src/tests.rs +++ b/frame/grandpa/src/tests.rs @@ -25,7 +25,7 @@ use codec::{Decode, Encode}; use fg_primitives::ScheduledChange; use frame_support::{ assert_err, assert_ok, - traits::{Currency, OnFinalize}, + traits::{Currency, OnFinalize, UnfilteredDispatchable}, }; use frame_system::{EventRecord, Phase}; use sp_core::H256; @@ -376,7 +376,7 @@ fn report_equivocation_current_set_works() { // report the equivocation and the tx should be dispatched successfully let inner = report_equivocation(equivocation_proof, key_owner_proof).unwrap(); - assert_ok!(Grandpa::dispatch(inner, Origin::signed(1))); + assert_ok!(inner.dispatch_bypass_filter(Origin::signed(1))); start_era(2); @@ -457,7 +457,7 @@ fn report_equivocation_old_set_works() { // report the equivocation using the key ownership proof generated on // the old set, the tx should be dispatched successfully let inner = report_equivocation(equivocation_proof, key_owner_proof).unwrap(); - assert_ok!(Grandpa::dispatch(inner, Origin::signed(1))); + assert_ok!(inner.dispatch_bypass_filter(Origin::signed(1))); start_era(3); diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index eddf89997f..d657e3d793 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -1174,6 +1174,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/im-online/src/benchmarking.rs b/frame/im-online/src/benchmarking.rs index 63457168b3..92d9b9d5a5 100644 --- a/frame/im-online/src/benchmarking.rs +++ b/frame/im-online/src/benchmarking.rs @@ -24,8 +24,9 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::benchmarks; use sp_core::offchain::{OpaquePeerId, OpaqueMultiaddr}; -use sp_runtime::traits::{ValidateUnsigned, Zero, Dispatchable}; +use sp_runtime::traits::{ValidateUnsigned, Zero}; use sp_runtime::transaction_validity::TransactionSource; +use frame_support::traits::UnfilteredDispatchable; use crate::Module as ImOnline; @@ -85,7 +86,7 @@ benchmarks! { let call = Call::heartbeat(input_heartbeat, signature); }: { ImOnline::::validate_unsigned(TransactionSource::InBlock, &call)?; - call.dispatch(RawOrigin::None.into())?; + call.dispatch_bypass_filter(RawOrigin::None.into())?; } } diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 01e84102b1..d313646b28 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -104,6 +104,7 @@ parameter_types! { } impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/im-online/src/tests.rs b/frame/im-online/src/tests.rs index 7619781b68..835d8440e6 100644 --- a/frame/im-online/src/tests.rs +++ b/frame/im-online/src/tests.rs @@ -135,7 +135,7 @@ fn heartbeat( e @ _ => <&'static str>::from(e), })?; ImOnline::heartbeat( - Origin::system(frame_system::RawOrigin::None), + Origin::none(), heartbeat, signature, ) diff --git a/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index 90ac1ae81b..da30c129c3 100644 --- a/frame/indices/src/mock.rs +++ b/frame/indices/src/mock.rs @@ -50,6 +50,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = (); type Index = u64; diff --git a/frame/indices/src/tests.rs b/frame/indices/src/tests.rs index c5fc2b4735..e288871d55 100644 --- a/frame/indices/src/tests.rs +++ b/frame/indices/src/tests.rs @@ -101,7 +101,7 @@ fn transfer_index_on_accounts_should_work() { fn force_transfer_index_on_preowned_should_work() { new_test_ext().execute_with(|| { assert_ok!(Indices::claim(Some(1).into(), 0)); - assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0, false)); + assert_ok!(Indices::force_transfer(Origin::root(), 3, 0, false)); assert_eq!(Balances::reserved_balance(1), 0); assert_eq!(Balances::reserved_balance(3), 0); assert_eq!(Indices::lookup_index(0), Some(3)); @@ -111,7 +111,7 @@ fn force_transfer_index_on_preowned_should_work() { #[test] fn force_transfer_index_on_free_should_work() { new_test_ext().execute_with(|| { - assert_ok!(Indices::force_transfer(Origin::ROOT, 3, 0, false)); + assert_ok!(Indices::force_transfer(Origin::root(), 3, 0, false)); assert_eq!(Balances::reserved_balance(3), 0); assert_eq!(Indices::lookup_index(0), Some(3)); }); diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index cfcc17238a..62b1217c83 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -291,6 +291,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs index bde0a06de6..672e6bed20 100644 --- a/frame/multisig/src/lib.rs +++ b/frame/multisig/src/lib.rs @@ -50,7 +50,7 @@ use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_io::hashing::blake2_256; use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, RuntimeDebug}; -use frame_support::{traits::{Get, ReservableCurrency, Currency, Filter, FilterStack, ClearFilterGuard}, +use frame_support::{traits::{Get, ReservableCurrency, Currency}, weights::{Weight, GetDispatchInfo, DispatchClass, Pays}, dispatch::{DispatchResultWithPostInfo, DispatchErrorWithPostInfo, PostDispatchInfo}, }; @@ -87,9 +87,6 @@ pub trait Trait: frame_system::Trait { /// The maximum amount of signatories allowed in the multisig. type MaxSignatories: Get; - - /// Is a given call compatible with the proxying subsystem? - type IsCallable: FilterStack<::Call>; } /// A global extrinsic index, formed as the extrinsic index within a block, together with that @@ -151,8 +148,6 @@ decl_error! { WrongTimepoint, /// A timepoint was given, yet no multisig operation is underway. UnexpectedTimepoint, - /// A call with a `false` `IsCallable` filter was attempted. - Uncallable, } } @@ -175,8 +170,6 @@ decl_event! { /// A multisig operation has been cancelled. First param is the account that is /// cancelling, third is the multisig account, fourth is hash of the call. MultisigCancelled(AccountId, Timepoint, AccountId, CallHash), - /// A call with a `false` IsCallable filter was attempted. - Uncallable(u32), } } @@ -220,8 +213,7 @@ decl_module! { /// Register approval for a dispatch to be made from a deterministic composite account if /// approved by a total of `threshold - 1` of `other_signatories`. /// - /// If there are enough, then dispatch the call. Calls must each fulfil the `IsCallable` - /// filter. + /// If there are enough, then dispatch the call. /// /// Payment: `DepositBase` will be reserved if this is the first approval, plus /// `threshold` times `DepositFactor`. It is returned once this dispatch happens or @@ -280,10 +272,6 @@ decl_module! { call: Box<::Call>, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - // We're now executing as a freshly authenticated new account, so the previous call - // restrictions no longer apply. - let _guard = ClearFilterGuard::::Call>::new(); - ensure!(T::IsCallable::filter(call.as_ref()), Error::::Uncallable); ensure!(threshold >= 1, Error::::ZeroThreshold); let max_sigs = T::MaxSignatories::get() as usize; ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index 067ef4cf98..4b1395476d 100644 --- a/frame/multisig/src/tests.rs +++ b/frame/multisig/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use frame_support::{ assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, - weights::Weight, impl_outer_event + weights::Weight, impl_outer_event, traits::Filter, }; use sp_core::H256; use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; @@ -60,6 +60,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = TestBaseCallFilter; type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -99,8 +100,8 @@ parameter_types! { pub const DepositFactor: u64 = 1; pub const MaxSignatories: u16 = 3; } -pub struct TestIsCallable; -impl Filter for TestIsCallable { +pub struct TestBaseCallFilter; +impl Filter for TestBaseCallFilter { fn filter(c: &Call) -> bool { match *c { Call::Balances(_) => true, @@ -110,13 +111,6 @@ impl Filter for TestIsCallable { } } } -impl FilterStack for TestIsCallable { - type Stack = (); - fn push(_: impl Fn(&Call) -> bool + 'static) {} - fn pop() {} - fn take() -> Self::Stack { () } - fn restore(_: Self::Stack) {} -} impl Trait for Test { type Event = TestEvent; type Call = Call; @@ -124,7 +118,6 @@ impl Trait for Test { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type IsCallable = TestIsCallable; } type System = frame_system::Module; type Balances = pallet_balances::Module; @@ -403,8 +396,8 @@ fn multisig_filters() { new_test_ext().execute_with(|| { let call = Box::new(Call::System(frame_system::Call::set_code(vec![]))); assert_noop!( - Multisig::as_multi(Origin::signed(1), 1, vec![], None, call.clone()), - Error::::Uncallable, + Multisig::as_multi(Origin::signed(1), 1, vec![2], None, call.clone()), + DispatchError::BadOrigin, ); }); } diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 35416aa8eb..8a130da2ae 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -266,6 +266,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index c228acdf40..90ad7eeb3c 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -42,6 +42,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = AccountIndex; type BlockNumber = BlockNumber; diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 30d2409a00..6c89072a0f 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -96,6 +96,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index 60305dfc74..14c7ced151 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -41,8 +41,8 @@ use sp_runtime::{DispatchResult, traits::{Dispatchable, Zero}}; use sp_runtime::traits::Member; use frame_support::{ decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, traits::{ - Get, ReservableCurrency, Currency, Filter, FilterStack, FilterStackGuard, - ClearFilterGuard, InstanceFilter + Get, ReservableCurrency, Currency, InstanceFilter, + OriginTrait, IsType, }, weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}}, dispatch::{PostDispatchInfo, IsSubType}, }; @@ -60,14 +60,12 @@ pub trait Trait: frame_system::Trait { /// The overarching call type. type Call: Parameter + Dispatchable - + GetDispatchInfo + From> + IsSubType, Self>; + + GetDispatchInfo + From> + IsSubType, Self> + + IsType<::Call>; /// The currency mechanism. type Currency: ReservableCurrency; - /// Is a given call compatible with the proxying subsystem? - type IsCallable: FilterStack<::Call>; - /// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler. /// The instance filter determines whether a given call may be proxied under this type. type ProxyType: Parameter + Member + Ord + PartialOrd + InstanceFilter<::Call> @@ -105,8 +103,6 @@ decl_error! { NotFound, /// Sender is not a proxy of the account to be proxied. NotProxy, - /// A call with a `false` `IsCallable` filter was attempted. - Uncallable, /// A call which is incompatible with the proxy type's filter was attempted. Unproxyable, /// Account is already a proxy. @@ -171,19 +167,17 @@ decl_module! { .find(|x| &x.0 == &who && force_proxy_type.as_ref().map_or(true, |y| &x.1 == y)) .ok_or(Error::::NotProxy)?; - // We're now executing as a freshly authenticated new account, so the previous call - // restrictions no longer apply. - let _clear_guard = ClearFilterGuard::::Call>::new(); - let _filter_guard = FilterStackGuard::::Call>::new( - move |c| match c.is_sub_type() { + // This is a freshly authenticated new account, the origin restrictions doesn't apply. + let mut origin: T::Origin = frame_system::RawOrigin::Signed(real).into(); + origin.add_filter(move |c: &::Call| { + let c = ::Call::from_ref(c); + match c.is_sub_type() { Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) if !proxy_type.is_superset(&pt) => false, - _ => proxy_type.filter(&c) + _ => proxy_type.filter(c) } - ); - ensure!(T::IsCallable::filter(&call), Error::::Uncallable); - - let e = call.dispatch(frame_system::RawOrigin::Signed(real).into()); + }); + let e = call.dispatch(origin); Self::deposit_event(RawEvent::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error))); } diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index 93529317f6..be99e9424a 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use frame_support::{ assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, - impl_filter_stack, weights::Weight, impl_outer_event, RuntimeDebug, dispatch::DispatchError + weights::Weight, impl_outer_event, RuntimeDebug, dispatch::DispatchError, traits::Filter, }; use codec::{Encode, Decode}; use sp_core::H256; @@ -62,6 +62,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = BaseFilter; type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -99,15 +100,12 @@ impl pallet_balances::Trait for Test { impl pallet_utility::Trait for Test { type Event = TestEvent; type Call = Call; - type IsCallable = IsCallable; } parameter_types! { pub const ProxyDepositBase: u64 = 1; pub const ProxyDepositFactor: u64 = 1; pub const MaxProxies: u16 = 4; } -pub struct IsCallable; -impl_filter_stack!(crate::tests::IsCallable, crate::tests::BaseFilter, crate::tests::Call, is_callable); #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] pub enum ProxyType { Any, @@ -142,7 +140,6 @@ impl Trait for Test { type Event = TestEvent; type Call = Call; type Currency = Balances; - type IsCallable = IsCallable; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; @@ -158,7 +155,6 @@ use frame_system::Call as SystemCall; use pallet_balances::Call as BalancesCall; use pallet_balances::Error as BalancesError; use pallet_utility::Call as UtilityCall; -use pallet_utility::Error as UtilityError; use pallet_utility::Event as UtilityEvent; use super::Call as ProxyCall; @@ -201,7 +197,8 @@ fn filtering_works() { expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); - assert_noop!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); let sub_id = Utility::sub_account_id(1, 0); Balances::mutate_account(&sub_id, |a| a.free = 1000); @@ -210,32 +207,41 @@ fn filtering_works() { let call = Box::new(Call::Utility(UtilityCall::as_sub(0, inner.clone()))); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); - assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); let call = Box::new(Call::Utility(UtilityCall::as_limited_sub(0, inner.clone()))); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); - assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); - let de = DispatchError::from(UtilityError::::Uncallable).stripped(); - expect_event(RawEvent::ProxyExecuted(Err(de))); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); let call = Box::new(Call::Utility(UtilityCall::batch(vec![*inner]))); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); expect_events(vec![UtilityEvent::BatchCompleted.into(), RawEvent::ProxyExecuted(Ok(())).into()]); - assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); - expect_events(vec![UtilityEvent::Uncallable(0).into(), RawEvent::ProxyExecuted(Ok(())).into()]); + expect_events(vec![ + UtilityEvent::BatchInterrupted(0, DispatchError::BadOrigin).into(), + RawEvent::ProxyExecuted(Ok(())).into(), + ]); let inner = Box::new(Call::Proxy(ProxyCall::add_proxy(5, ProxyType::Any))); let call = Box::new(Call::Utility(UtilityCall::batch(vec![*inner]))); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); expect_events(vec![UtilityEvent::BatchCompleted.into(), RawEvent::ProxyExecuted(Ok(())).into()]); - assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); - expect_events(vec![UtilityEvent::Uncallable(0).into(), RawEvent::ProxyExecuted(Ok(())).into()]); + expect_events(vec![ + UtilityEvent::BatchInterrupted(0, DispatchError::BadOrigin).into(), + RawEvent::ProxyExecuted(Ok(())).into(), + ]); }); } @@ -293,10 +299,12 @@ fn proxying_works() { assert_eq!(Balances::free_balance(6), 1); let call = Box::new(Call::System(SystemCall::set_code(vec![]))); - assert_noop!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); let call = Box::new(Call::Balances(BalancesCall::transfer_keep_alive(6, 1))); - assert_noop!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()), Error::::Uncallable); + assert_ok!(Call::Proxy(super::Call::proxy(1, None, call.clone())).dispatch(Origin::signed(2))); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_eq!(Balances::free_balance(6), 2); diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 4a851c926f..0cf44de679 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -158,6 +158,7 @@ mod tests { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index aae9b2b75c..101778f3ea 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -64,6 +64,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = Call; type Index = u64; diff --git a/frame/recovery/src/tests.rs b/frame/recovery/src/tests.rs index 5192bdaca8..8e9484f0fb 100644 --- a/frame/recovery/src/tests.rs +++ b/frame/recovery/src/tests.rs @@ -46,7 +46,7 @@ fn set_recovered_works() { // Not accessible by a normal user assert_noop!(Recovery::set_recovered(Origin::signed(1), 5, 1), BadOrigin); // Root can set a recovered account though - assert_ok!(Recovery::set_recovered(Origin::ROOT, 5, 1)); + assert_ok!(Recovery::set_recovered(Origin::root(), 5, 1)); // Account 1 should now be able to make a call through account 5 let call = Box::new(Call::Balances(BalancesCall::transfer(1, 100))); assert_ok!(Recovery::as_recovered(Origin::signed(1), 5, call)); diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index cd3aba45ed..00189c6b5d 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -481,8 +481,9 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -702,14 +703,14 @@ mod tests { new_test_ext().execute_with(|| { let call = Box::new(Call::Logger(logger::Call::log(69, 1000))); let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000))); - assert_ok!(Scheduler::schedule_named(Origin::ROOT, 1u32.encode(), 4, None, 127, call)); - assert_ok!(Scheduler::schedule(Origin::ROOT, 4, None, 127, call2)); + assert_ok!(Scheduler::schedule_named(Origin::root(), 1u32.encode(), 4, None, 127, call)); + assert_ok!(Scheduler::schedule(Origin::root(), 4, None, 127, call2)); run_to_block(3); // Scheduled calls are in the agenda. assert_eq!(Agenda::::get(4).len(), 2); assert!(logger::log().is_empty()); - assert_ok!(Scheduler::cancel_named(Origin::ROOT, 1u32.encode())); - assert_ok!(Scheduler::cancel(Origin::ROOT, 4, 1)); + assert_ok!(Scheduler::cancel_named(Origin::root(), 1u32.encode())); + assert_ok!(Scheduler::cancel(Origin::root(), 4, 1)); // Scheduled calls are made NONE, so should not effect state run_to_block(100); assert!(logger::log().is_empty()); diff --git a/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index 1b61bb1884..87a56ca27d 100644 --- a/frame/scored-pool/src/mock.rs +++ b/frame/scored-pool/src/mock.rs @@ -55,6 +55,7 @@ ord_parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index bed6509732..ee04f1a046 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/frame/session/benchmarking/src/mock.rs @@ -58,6 +58,7 @@ impl Convert for CurrencyToVoteHandler { pub struct Test; impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = AccountIndex; type BlockNumber = BlockNumber; diff --git a/frame/session/src/mock.rs b/frame/session/src/mock.rs index e7a9896064..51ca3bc790 100644 --- a/frame/session/src/mock.rs +++ b/frame/session/src/mock.rs @@ -173,6 +173,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/society/src/mock.rs b/frame/society/src/mock.rs index 7ddd25ee6a..89a0691b93 100644 --- a/frame/society/src/mock.rs +++ b/frame/society/src/mock.rs @@ -65,6 +65,7 @@ ord_parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/society/src/tests.rs b/frame/society/src/tests.rs index 8f18ecba46..0374c7bcd7 100644 --- a/frame/society/src/tests.rs +++ b/frame/society/src/tests.rs @@ -813,7 +813,7 @@ fn max_limits_work() { // No candidates because full assert_eq!(Society::candidates().len(), 0); // Increase member limit - assert_ok!(Society::set_max_members(Origin::ROOT, 200)); + assert_ok!(Society::set_max_members(Origin::root(), 200)); // Rotate period run_to_block(16); // Candidates are back! diff --git a/frame/staking/fuzzer/src/mock.rs b/frame/staking/fuzzer/src/mock.rs index 3783415630..d1e471fadb 100644 --- a/frame/staking/fuzzer/src/mock.rs +++ b/frame/staking/fuzzer/src/mock.rs @@ -57,6 +57,7 @@ impl Convert for CurrencyToVoteHandler { pub struct Test; impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type DbWeight = (); type BlockExecutionWeight = (); diff --git a/frame/staking/fuzzer/src/submit_solution.rs b/frame/staking/fuzzer/src/submit_solution.rs index fafd686c9d..7094c7ed88 100644 --- a/frame/staking/fuzzer/src/submit_solution.rs +++ b/frame/staking/fuzzer/src/submit_solution.rs @@ -23,9 +23,9 @@ use honggfuzz::fuzz; use mock::Test; use pallet_staking::testing_utils::*; -use frame_support::{assert_ok, storage::StorageValue}; +use frame_support::{assert_ok, storage::StorageValue, traits::UnfilteredDispatchable}; use frame_system::RawOrigin; -use sp_runtime::{traits::Dispatchable, DispatchError}; +use sp_runtime::DispatchError; use sp_core::offchain::{testing::TestOffchainExt, OffchainExt}; use pallet_staking::{EraElectionStatus, ElectionStatus, Module as Staking, Call as StakingCall}; @@ -159,7 +159,7 @@ fn main() { match mode { Mode::WeakerSubmission => { assert_eq!( - call.dispatch(origin.clone().into()).unwrap_err().error, + call.dispatch_bypass_filter(origin.clone().into()).unwrap_err().error, DispatchError::Module { index: 0, error: 16, @@ -170,7 +170,7 @@ fn main() { // NOTE: so exhaustive pattern doesn't work here.. maybe some rust issue? // or due to `#[repr(u32)]`? Mode::InitialSubmission | Mode::StrongerSubmission => { - assert_ok!(call.dispatch(origin.into())); + assert_ok!(call.dispatch_bypass_filter(origin.into())); } }; }) diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index 44fc902403..1dfa621033 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -21,7 +21,7 @@ use super::*; use crate::Module as Staking; use testing_utils::*; -use sp_runtime::{traits::{Dispatchable, One}}; +use sp_runtime::traits::One; use frame_system::RawOrigin; pub use frame_benchmarking::{benchmarks, account}; const SEED: u32 = 0; @@ -379,12 +379,12 @@ benchmarks! { let current_era = CurrentEra::get().unwrap(); let mut points_total = 0; let mut points_individual = Vec::new(); - let mut payout_calls = Vec::new(); + let mut payout_calls_arg = Vec::new(); for validator in new_validators.iter() { points_total += 10; points_individual.push((validator.clone(), 10)); - payout_calls.push(Call::::payout_stakers(validator.clone(), current_era)) + payout_calls_arg.push((validator.clone(), current_era)); } // Give Era Points @@ -401,8 +401,8 @@ benchmarks! { let caller: T::AccountId = account("caller", 0, SEED); }: { - for call in payout_calls { - call.dispatch(RawOrigin::Signed(caller.clone()).into())?; + for arg in payout_calls_arg { + >::payout_stakers(RawOrigin::Signed(caller.clone()).into(), arg.0, arg.1)?; } } diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index ef3d2c43bc..3860dba90f 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -200,6 +200,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = AccountIndex; type BlockNumber = BlockNumber; diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 078f5e0a79..eeac2c5c90 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -47,7 +47,7 @@ fn force_unstake_works() { // Force unstake needs correct number of slashing spans (for weight calculation) assert_noop!(Staking::force_unstake(Origin::signed(11), 11, 0), BadOrigin); // We now force them to unstake - assert_ok!(Staking::force_unstake(Origin::ROOT, 11, 2)); + assert_ok!(Staking::force_unstake(Origin::root(), 11, 2)); // No longer bonded. assert_eq!(Staking::bonded(&11), None); // Transfer works. @@ -1477,7 +1477,7 @@ fn on_free_balance_zero_stash_removes_validator() { assert_eq!(Balances::total_balance(&11), 0); // Reap the stash - assert_ok!(Staking::reap_stash(Origin::NONE, 11, 0)); + assert_ok!(Staking::reap_stash(Origin::none(), 11, 0)); // Check storage items do not exist assert!(!>::contains_key(&10)); @@ -1533,7 +1533,7 @@ fn on_free_balance_zero_stash_removes_nominator() { assert_eq!(Balances::total_balance(&11), 0); // Reap the stash - assert_ok!(Staking::reap_stash(Origin::NONE, 11, 0)); + assert_ok!(Staking::reap_stash(Origin::none(), 11, 0)); // Check storage items do not exist assert!(!>::contains_key(&10)); @@ -1928,7 +1928,7 @@ fn offence_forces_new_era() { #[test] fn offence_ensures_new_era_without_clobbering() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(Staking::force_new_era_always(Origin::ROOT)); + assert_ok!(Staking::force_new_era_always(Origin::root())); assert_eq!(Staking::force_era(), Forcing::ForceAlways); on_offence_now( @@ -2302,8 +2302,8 @@ fn garbage_collection_after_slashing() { assert_eq!(slashing_spans.iter().count(), 2); // reap_stash respects num_slashing_spans so that weight is accurate - assert_noop!(Staking::reap_stash(Origin::NONE, 11, 0), Error::::IncorrectSlashingSpans); - assert_ok!(Staking::reap_stash(Origin::NONE, 11, 2)); + assert_noop!(Staking::reap_stash(Origin::none(), 11, 0), Error::::IncorrectSlashingSpans); + assert_ok!(Staking::reap_stash(Origin::none(), 11, 2)); assert!(::SlashingSpans::get(&11).is_none()); assert_eq!(::SpanSlash::get(&(11, 0)).amount_slashed(), &0); @@ -2591,11 +2591,11 @@ fn remove_deferred() { // fails if empty assert_noop!( - Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![]), + Staking::cancel_deferred_slash(Origin::root(), 1, vec![]), Error::::EmptyTargets ); - assert_ok!(Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![0])); + assert_ok!(Staking::cancel_deferred_slash(Origin::root(), 1, vec![0])); assert_eq!(Balances::free_balance(11), 1000); assert_eq!(Balances::free_balance(101), 2000); @@ -2692,21 +2692,21 @@ fn remove_multi_deferred() { // fails if list is not sorted assert_noop!( - Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![2, 0, 4]), + Staking::cancel_deferred_slash(Origin::root(), 1, vec![2, 0, 4]), Error::::NotSortedAndUnique ); // fails if list is not unique assert_noop!( - Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![0, 2, 2]), + Staking::cancel_deferred_slash(Origin::root(), 1, vec![0, 2, 2]), Error::::NotSortedAndUnique ); // fails if bad index assert_noop!( - Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![1, 2, 3, 4, 5]), + Staking::cancel_deferred_slash(Origin::root(), 1, vec![1, 2, 3, 4, 5]), Error::::InvalidSlashIndex ); - assert_ok!(Staking::cancel_deferred_slash(Origin::ROOT, 1, vec![0, 2, 4])); + assert_ok!(Staking::cancel_deferred_slash(Origin::root(), 1, vec![0, 2, 4])); let slashes = ::UnappliedSlashes::get(&1); assert_eq!(slashes.len(), 2); @@ -4243,16 +4243,16 @@ fn test_max_nominator_rewarded_per_validator_and_cant_steal_someone_else_reward( fn set_history_depth_works() { ExtBuilder::default().build_and_execute(|| { mock::start_era(10); - Staking::set_history_depth(Origin::ROOT, 20, 0).unwrap(); + Staking::set_history_depth(Origin::root(), 20, 0).unwrap(); assert!(::ErasTotalStake::contains_key(10 - 4)); assert!(::ErasTotalStake::contains_key(10 - 5)); - Staking::set_history_depth(Origin::ROOT, 4, 0).unwrap(); + Staking::set_history_depth(Origin::root(), 4, 0).unwrap(); assert!(::ErasTotalStake::contains_key(10 - 4)); assert!(!::ErasTotalStake::contains_key(10 - 5)); - Staking::set_history_depth(Origin::ROOT, 3, 0).unwrap(); + Staking::set_history_depth(Origin::root(), 3, 0).unwrap(); assert!(!::ErasTotalStake::contains_key(10 - 4)); assert!(!::ErasTotalStake::contains_key(10 - 5)); - Staking::set_history_depth(Origin::ROOT, 8, 0).unwrap(); + Staking::set_history_depth(Origin::root(), 8, 0).unwrap(); assert!(!::ErasTotalStake::contains_key(10 - 4)); assert!(!::ErasTotalStake::contains_key(10 - 5)); }); diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 54b9100d61..73c3609d3f 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -113,6 +113,7 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = Call; type Index = u64; diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index dd4b6d0b86..70a552ce3a 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -29,7 +29,7 @@ pub use crate::weights::{ PaysFee, PostDispatchInfo, WithPostDispatchInfo, }; pub use sp_runtime::{traits::Dispatchable, DispatchError}; -pub use crate::traits::{CallMetadata, GetCallMetadata, GetCallName}; +pub use crate::traits::{CallMetadata, GetCallMetadata, GetCallName, UnfilteredDispatchable}; /// The return typ of a `Dispatchable` in frame. When returned explicitly from /// a dispatchable function it allows overriding the default `PostDispatchInfo` @@ -47,10 +47,9 @@ pub type DispatchResult = Result<(), sp_runtime::DispatchError>; pub type DispatchErrorWithPostInfo = sp_runtime::DispatchErrorWithPostInfo; -/// Serializable version of Dispatchable. -/// This value can be used as a "function" in an extrinsic. +/// Serializable version of pallet dispatchable. pub trait Callable { - type Call: Dispatchable + Codec + Clone + PartialEq + Eq; + type Call: UnfilteredDispatchable + Codec + Clone + PartialEq + Eq; } // dirty hack to work around serde_derive issue @@ -1005,6 +1004,7 @@ macro_rules! decl_module { impl<$trait_instance: $trait_name$(, $instance: $instantiable)?> $module<$trait_instance $(, $instance)?> where $( $other_where_bounds )* { + /// Deposits an event using `frame_system::Module::deposit_event`. $vis fn deposit_event( event: impl Into<< $trait_instance as $trait_name $(<$instance>)? >::Event> ) { @@ -1402,6 +1402,8 @@ macro_rules! decl_module { $error_type; $from; $(#[doc = $doc_attr])* + /// + /// NOTE: Calling this function will bypass origin filters. $fn_vis fn $fn_name ( $from $(, $param_name : $param )* ) $( -> $result )* { $( $impl )* } @@ -1546,14 +1548,11 @@ macro_rules! decl_module { } } - impl<$trait_instance: $trait_name $(, $instance: $instantiable)?> $crate::dispatch::Dispatchable + impl<$trait_instance: $trait_name $(, $instance: $instantiable)?> $crate::traits::UnfilteredDispatchable for $call_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )* { - type Trait = $trait_instance; type Origin = $origin_type; - type Info = $crate::weights::DispatchInfo; - type PostInfo = $crate::weights::PostDispatchInfo; - fn dispatch(self, _origin: Self::Origin) -> $crate::dispatch::DispatchResultWithPostInfo { + fn dispatch_bypass_filter(self, _origin: Self::Origin) -> $crate::dispatch::DispatchResultWithPostInfo { match self { $( $call_type::$fn_name( $( $param_name ),* ) => { @@ -1574,17 +1573,6 @@ macro_rules! decl_module { type Call = $call_type<$trait_instance $(, $instance)?>; } - impl<$trait_instance: $trait_name $(, $instance: $instantiable)?> $mod_type<$trait_instance $(, $instance)?> - where $( $other_where_bounds )* - { - #[doc(hidden)] - pub fn dispatch>( - d: D, - origin: D::Origin - ) -> $crate::dispatch::DispatchResultWithPostInfo { - d.dispatch(origin) - } - } $crate::__dispatch_impl_metadata! { $mod_type<$trait_instance: $trait_name $(, $instance: $instantiable)?> { $( $other_where_bounds )* } @@ -1684,6 +1672,20 @@ macro_rules! impl_outer_dispatch { fn dispatch( self, origin: $origin, + ) -> $crate::dispatch::DispatchResultWithPostInfo { + if !::filter_call(&origin, &self) { + return $crate::sp_std::result::Result::Err($crate::dispatch::DispatchError::BadOrigin.into()) + } + + $crate::traits::UnfilteredDispatchable::dispatch_bypass_filter(self, origin) + } + } + + impl $crate::traits::UnfilteredDispatchable for $call_type { + type Origin = $origin; + fn dispatch_bypass_filter( + self, + origin: $origin, ) -> $crate::dispatch::DispatchResultWithPostInfo { $crate::impl_outer_dispatch! { @DISPATCH_MATCH @@ -1696,6 +1698,7 @@ macro_rules! impl_outer_dispatch { } } } + $( impl $crate::dispatch::IsSubType<$camelcase, $runtime> for $call_type { #[allow(unreachable_patterns)] @@ -1731,7 +1734,8 @@ macro_rules! impl_outer_dispatch { $origin { $( $generated )* - $call_type::$name(call) => call.dispatch($origin), + $call_type::$name(call) => + $crate::traits::UnfilteredDispatchable::dispatch_bypass_filter(call, $origin), } $index + 1; $( $rest ),* @@ -2050,21 +2054,34 @@ mod tests { }; pub trait Trait: system::Trait + Sized where Self::AccountId: From { - type Origin; type BlockNumber: Into; - type Call: From>; } pub mod system { - use super::*; - pub trait Trait { type AccountId; + type Call; + type BaseCallFilter; + type Origin: crate::traits::OriginTrait; } - pub fn ensure_root(_: R) -> DispatchResult { - Ok(()) + #[derive(Clone, PartialEq, Eq, Debug)] + pub enum RawOrigin { + Root, + Signed(AccountId), + None, } + + impl From> for RawOrigin { + fn from(s: Option) -> RawOrigin { + match s { + Some(who) => RawOrigin::Signed(who), + None => RawOrigin::None, + } + } + } + + pub type Origin = RawOrigin<::AccountId>; } decl_module! { @@ -2169,21 +2186,26 @@ mod tests { pub struct TraitImpl {} impl Trait for TraitImpl { - type Origin = u32; type BlockNumber = u32; - type Call = OuterCall; } type Test = Module; + impl_outer_origin!{ + pub enum OuterOrigin for TraitImpl where system = system {} + } + impl_outer_dispatch! { - pub enum OuterCall for TraitImpl where origin: u32 { + pub enum OuterCall for TraitImpl where origin: OuterOrigin { self::Test, } } impl system::Trait for TraitImpl { + type Origin = OuterOrigin; type AccountId = u32; + type Call = OuterCall; + type BaseCallFilter = (); } #[test] diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 316e356759..196bddbdf5 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -51,14 +51,14 @@ pub use sp_runtime::RuntimeDebug; #[macro_use] pub mod debug; #[macro_use] +mod origin; +#[macro_use] pub mod dispatch; pub mod storage; mod hash; #[macro_use] pub mod event; #[macro_use] -mod origin; -#[macro_use] pub mod metadata; #[macro_use] pub mod inherent; diff --git a/frame/support/src/metadata.rs b/frame/support/src/metadata.rs index 7248d6bc4d..d6ec9a7373 100644 --- a/frame/support/src/metadata.rs +++ b/frame/support/src/metadata.rs @@ -290,6 +290,7 @@ mod tests { use super::*; pub trait Trait: 'static { + type BaseCallFilter; const ASSOCIATED_CONST: u64 = 500; type Origin: Into, Self::Origin>> + From>; @@ -297,6 +298,7 @@ mod tests { type BlockNumber: From + Encode; type SomeValue: Get; type ModuleToIndex: crate::traits::ModuleToIndex; + type Call; } decl_module! { @@ -436,11 +438,13 @@ mod tests { } impl system::Trait for TestRuntime { + type BaseCallFilter = (); type Origin = Origin; type AccountId = u32; type BlockNumber = u32; type SomeValue = SystemValue; type ModuleToIndex = (); + type Call = Call; } impl_runtime_metadata!( diff --git a/frame/support/src/origin.rs b/frame/support/src/origin.rs index f96ec07af0..038c8540f6 100644 --- a/frame/support/src/origin.rs +++ b/frame/support/src/origin.rs @@ -45,19 +45,23 @@ macro_rules! impl_outer_origin { $( $rest_with_system:tt )* } ) => { - $crate::impl_outer_origin!( - $( #[$attr] )*; - $name; - $runtime; - $system; - Modules { $( $rest_with_system )* }; - ); + $crate::paste::item! { + $crate::impl_outer_origin!( + $( #[$attr] )*; + $name; + [< $name Caller >]; + $runtime; + $system; + Modules { $( $rest_with_system )* }; + ); + } }; // Generic + Instance ( $(#[$attr:meta])*; $name:ident; + $caller_name:ident; $runtime:ident; $system:ident; Modules { @@ -69,6 +73,7 @@ macro_rules! impl_outer_origin { $crate::impl_outer_origin!( $( #[$attr] )*; $name; + $caller_name; $runtime; $system; Modules { $( $( $rest_module )* )? }; @@ -80,6 +85,7 @@ macro_rules! impl_outer_origin { ( $(#[$attr:meta])*; $name:ident; + $caller_name:ident; $runtime:ident; $system:ident; Modules { @@ -91,6 +97,7 @@ macro_rules! impl_outer_origin { $crate::impl_outer_origin!( $( #[$attr] )*; $name; + $caller_name; $runtime; $system; Modules { $( $rest_module )* }; @@ -102,6 +109,7 @@ macro_rules! impl_outer_origin { ( $(#[$attr:meta])*; $name:ident; + $caller_name:ident; $runtime:ident; $system:ident; Modules { @@ -113,6 +121,7 @@ macro_rules! impl_outer_origin { $crate::impl_outer_origin!( $( #[$attr] )*; $name; + $caller_name; $runtime; $system; Modules { $( $( $rest_module )* )? }; @@ -124,6 +133,7 @@ macro_rules! impl_outer_origin { ( $(#[$attr:meta])*; $name:ident; + $caller_name:ident; $runtime:ident; $system:ident; Modules { @@ -135,6 +145,7 @@ macro_rules! impl_outer_origin { $crate::impl_outer_origin!( $( #[$attr] )*; $name; + $caller_name; $runtime; $system; Modules { $( $( $rest_module )* )? }; @@ -146,16 +157,78 @@ macro_rules! impl_outer_origin { ( $(#[$attr:meta])*; $name:ident; + $caller_name:ident; $runtime:ident; $system:ident; Modules { }; $( $module:ident $( < $generic:ident > )? $( { $generic_instance:ident } )? ,)* ) => { + // WARNING: All instance must hold the filter `frame_system::Trait::BaseCallFilter`. + // One can use `OriginTrait::reset_filter` to do so. + #[derive(Clone)] + pub struct $name { + caller: $caller_name, + filter: $crate::sp_std::rc::Rc::Call) -> bool>>, + } + + #[cfg(not(feature = "std"))] + impl $crate::sp_std::fmt::Debug for $name { + fn fmt( + &self, + fmt: &mut $crate::sp_std::fmt::Formatter + ) -> $crate::sp_std::result::Result<(), $crate::sp_std::fmt::Error> { + fmt.write_str("") + } + } + + #[cfg(feature = "std")] + impl $crate::sp_std::fmt::Debug for $name { + fn fmt( + &self, + fmt: &mut $crate::sp_std::fmt::Formatter + ) -> $crate::sp_std::result::Result<(), $crate::sp_std::fmt::Error> { + fmt.debug_struct(stringify!($name)) + .field("caller", &self.caller) + .field("filter", &"[function ptr]") + .finish() + } + } + + impl $crate::traits::OriginTrait for $name { + type Call = <$runtime as $system::Trait>::Call; + type PalletsOrigin = $caller_name; + + fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static) { + let f = self.filter.clone(); + + self.filter = $crate::sp_std::rc::Rc::new(Box::new(move |call| { + f(call) && filter(call) + })); + } + + fn reset_filter(&mut self) { + let filter = < + <$runtime as $system::Trait>::BaseCallFilter + as $crate::traits::Filter<<$runtime as $system::Trait>::Call> + >::filter; + + self.filter = $crate::sp_std::rc::Rc::new(Box::new(filter)); + } + + fn set_caller_from(&mut self, other: impl Into) { + self.caller = other.into().caller + } + + fn filter_call(&self, call: &Self::Call) -> bool { + (self.filter)(call) + } + } + $crate::paste::item! { #[derive(Clone, PartialEq, Eq, $crate::RuntimeDebug)] $(#[$attr])* #[allow(non_camel_case_types)] - pub enum $name { + pub enum $caller_name { system($system::Origin<$runtime>), $( [< $module $( _ $generic_instance )? >] @@ -168,20 +241,30 @@ macro_rules! impl_outer_origin { #[allow(dead_code)] impl $name { - pub const NONE: Self = $name::system($system::RawOrigin::None); - pub const ROOT: Self = $name::system($system::RawOrigin::Root); + pub fn none() -> Self { + $system::RawOrigin::None.into() + } + pub fn root() -> Self { + $system::RawOrigin::Root.into() + } pub fn signed(by: <$runtime as $system::Trait>::AccountId) -> Self { - $name::system($system::RawOrigin::Signed(by)) + $system::RawOrigin::Signed(by).into() } } + impl From<$system::Origin<$runtime>> for $name { fn from(x: $system::Origin<$runtime>) -> Self { - $name::system(x) + let mut o = $name { + caller: $caller_name::system(x), + filter: $crate::sp_std::rc::Rc::new(Box::new(|_| true)), + }; + $crate::traits::OriginTrait::reset_filter(&mut o); + o } } impl Into<$crate::sp_std::result::Result<$system::Origin<$runtime>, $name>> for $name { fn into(self) -> $crate::sp_std::result::Result<$system::Origin<$runtime>, Self> { - if let $name::system(l) = self { + if let $caller_name::system(l) = self.caller { Ok(l) } else { Err(self) @@ -197,7 +280,12 @@ macro_rules! impl_outer_origin { $crate::paste::item! { impl From<$module::Origin < $( $generic )? $(, $module::$generic_instance )? > > for $name { fn from(x: $module::Origin < $( $generic )? $(, $module::$generic_instance )? >) -> Self { - $name::[< $module $( _ $generic_instance )? >](x) + let mut o = $name { + caller: $caller_name::[< $module $( _ $generic_instance )? >](x), + filter: $crate::sp_std::rc::Rc::new(Box::new(|_| true)), + }; + $crate::traits::OriginTrait::reset_filter(&mut o); + o } } impl Into< @@ -210,7 +298,7 @@ macro_rules! impl_outer_origin { $module::Origin < $( $generic )? $(, $module::$generic_instance )? >, Self, > { - if let $name::[< $module $( _ $generic_instance )? >](l) = self { + if let $caller_name::[< $module $( _ $generic_instance )? >](l) = self.caller { Ok(l) } else { Err(self) @@ -224,9 +312,12 @@ macro_rules! impl_outer_origin { #[cfg(test)] mod tests { + use crate::traits::{Filter, OriginTrait}; mod system { pub trait Trait { type AccountId; + type Call; + type BaseCallFilter; } #[derive(Clone, PartialEq, Eq, Debug)] @@ -263,8 +354,17 @@ mod tests { #[derive(Clone, PartialEq, Eq, Debug)] pub struct TestRuntime; + pub struct BaseCallFilter; + impl Filter for BaseCallFilter { + fn filter(c: &u32) -> bool { + *c % 2 == 0 + } + } + impl system::Trait for TestRuntime { type AccountId = u32; + type Call = u32; + type BaseCallFilter = BaseCallFilter; } impl_outer_origin!( @@ -298,4 +398,35 @@ mod tests { impl_outer_origin!( pub enum OriginEmpty for TestRuntime where system = system {} ); + + #[test] + fn test_default_filter() { + assert_eq!(OriginWithSystem::root().filter_call(&0), true); + assert_eq!(OriginWithSystem::root().filter_call(&1), false); + assert_eq!(OriginWithSystem::none().filter_call(&0), true); + assert_eq!(OriginWithSystem::none().filter_call(&1), false); + assert_eq!(OriginWithSystem::signed(0).filter_call(&0), true); + assert_eq!(OriginWithSystem::signed(0).filter_call(&1), false); + assert_eq!(OriginWithSystem::from(Some(0)).filter_call(&0), true); + assert_eq!(OriginWithSystem::from(Some(0)).filter_call(&1), false); + assert_eq!(OriginWithSystem::from(None).filter_call(&0), true); + assert_eq!(OriginWithSystem::from(None).filter_call(&1), false); + assert_eq!(OriginWithSystem::from(origin_without_generic::Origin).filter_call(&0), true); + assert_eq!(OriginWithSystem::from(origin_without_generic::Origin).filter_call(&1), false); + + let mut origin = OriginWithSystem::from(Some(0)); + + origin.add_filter(|c| *c % 2 == 1); + assert_eq!(origin.filter_call(&0), false); + assert_eq!(origin.filter_call(&1), false); + + origin.set_caller_from(OriginWithSystem::root()); + assert!(matches!(origin.caller, OriginWithSystemCaller::system(system::RawOrigin::Root))); + assert_eq!(origin.filter_call(&0), false); + assert_eq!(origin.filter_call(&1), false); + + origin.reset_filter(); + assert_eq!(origin.filter_call(&0), true); + assert_eq!(origin.filter_call(&1), false); + } } diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 67eff71daf..833160b61c 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -1550,6 +1550,63 @@ pub trait EnsureOrigin { fn successful_origin() -> OuterOrigin; } +/// Type that can be dispatched with an origin but without checking the origin filter. +/// +/// Implemented for pallet dispatchable type by `decl_module` and for runtime dispatchable by +/// `construct_runtime` and `impl_outer_dispatch`. +pub trait UnfilteredDispatchable { + /// The origin type of the runtime, (i.e. `frame_system::Trait::Origin`). + type Origin; + + /// Dispatch this call but do not check the filter in origin. + fn dispatch_bypass_filter(self, origin: Self::Origin) -> crate::dispatch::DispatchResultWithPostInfo; +} + +/// Methods available on `frame_system::Trait::Origin`. +pub trait OriginTrait: Sized { + /// Runtime call type, as in `frame_system::Trait::Call` + type Call; + + /// The caller origin, overarching type of all pallets origins. + type PalletsOrigin; + + /// Add a filter to the origin. + fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static); + + /// Reset origin filters to default one, i.e `frame_system::Trait::BaseCallFilter`. + fn reset_filter(&mut self); + + /// Replace the caller with caller from the other origin + fn set_caller_from(&mut self, other: impl Into); + + /// Filter the call, if false then call is filtered out. + fn filter_call(&self, call: &Self::Call) -> bool; +} + +/// Trait to be used when types are exactly same. +/// +/// This allow to convert back and forth from type, a reference and a mutable reference. +pub trait IsType: Into + From { + /// Cast reference. + fn from_ref(t: &T) -> &Self; + + /// Cast reference. + fn into_ref(&self) -> &T; + + /// Cast mutable reference. + fn from_mut(t: &mut T) -> &mut Self; + + /// Cast mutable reference. + fn into_mut(&mut self) -> &mut T; +} + +impl IsType for T { + fn from_ref(t: &T) -> &Self { t } + fn into_ref(&self) -> &T { self } + fn from_mut(t: &mut T) -> &mut Self { t } + fn into_mut(&mut self) -> &mut T { self } +} + #[cfg(test)] mod tests { use super::*; diff --git a/frame/support/test/tests/decl_error.rs b/frame/support/test/tests/decl_error.rs index 9536d4e819..937e27873b 100644 --- a/frame/support/test/tests/decl_error.rs +++ b/frame/support/test/tests/decl_error.rs @@ -89,12 +89,14 @@ pub type BlockNumber = u64; pub type Index = u64; impl system::Trait for Runtime { + type BaseCallFilter = (); type Hash = H256; type Origin = Origin; type BlockNumber = BlockNumber; type AccountId = AccountId; type Event = Event; type ModuleToIndex = ModuleToIndex; + type Call = Call; } frame_support::construct_runtime!( diff --git a/frame/support/test/tests/instance.rs b/frame/support/test/tests/instance.rs index 45e280902a..920554346f 100644 --- a/frame/support/test/tests/instance.rs +++ b/frame/support/test/tests/instance.rs @@ -233,12 +233,14 @@ pub type BlockNumber = u64; pub type Index = u64; impl system::Trait for Runtime { + type BaseCallFilter= (); type Hash = H256; type Origin = Origin; type BlockNumber = BlockNumber; type AccountId = AccountId; type Event = Event; type ModuleToIndex = (); + type Call = Call; } frame_support::construct_runtime!( diff --git a/frame/support/test/tests/issue2219.rs b/frame/support/test/tests/issue2219.rs index cd357ba266..7166f202c7 100644 --- a/frame/support/test/tests/issue2219.rs +++ b/frame/support/test/tests/issue2219.rs @@ -158,12 +158,14 @@ pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; impl system::Trait for Runtime { + type BaseCallFilter = (); type Hash = H256; type Origin = Origin; type BlockNumber = BlockNumber; type AccountId = AccountId; type Event = Event; type ModuleToIndex = (); + type Call = Call; } impl module::Trait for Runtime {} diff --git a/frame/support/test/tests/system.rs b/frame/support/test/tests/system.rs index 821224d0a2..c3c47d2065 100644 --- a/frame/support/test/tests/system.rs +++ b/frame/support/test/tests/system.rs @@ -21,9 +21,11 @@ pub trait Trait: 'static + Eq + Clone { type Origin: Into, Self::Origin>> + From>; + type BaseCallFilter: frame_support::traits::Filter; type BlockNumber: Decode + Encode + EncodeLike + Clone + Default; type Hash; type AccountId: Encode + EncodeLike + Decode; + type Call; type Event: From>; type ModuleToIndex: frame_support::traits::ModuleToIndex; } diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index 95b9b88c70..56fd4b8c35 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -61,6 +61,7 @@ frame_support::parameter_types! { #[derive(Clone, Eq, PartialEq)] pub struct Runtime; impl system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/system/benchmarking/src/mock.rs b/frame/system/benchmarking/src/mock.rs index 1e904302e3..9e41ff2016 100644 --- a/frame/system/benchmarking/src/mock.rs +++ b/frame/system/benchmarking/src/mock.rs @@ -51,6 +51,7 @@ impl Dispatchable for Call { pub struct Test; impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = AccountIndex; type BlockNumber = BlockNumber; diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 1943256651..b38b8c8a4a 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -123,7 +123,7 @@ use frame_support::{ storage, traits::{ Contains, Get, ModuleToIndex, OnNewAccount, OnKilledAccount, IsDeadAccount, Happened, - StoredMap, EnsureOrigin, + StoredMap, EnsureOrigin, OriginTrait, Filter, }, weights::{ Weight, RuntimeDbWeight, DispatchInfo, PostDispatchInfo, DispatchClass, @@ -149,11 +149,15 @@ pub fn extrinsics_data_root(xts: Vec>) -> H::Output { } pub trait Trait: 'static + Eq + Clone { - /// The aggregated `Origin` type used by dispatchable calls. + /// The basic call filter to use in Origin. + type BaseCallFilter: Filter; + + /// The `Origin` type used by dispatchable calls. type Origin: Into, Self::Origin>> + From> - + Clone; + + Clone + + OriginTrait; /// The aggregated `Call` type. type Call: Dispatchable + Debug; @@ -1890,7 +1894,7 @@ pub(crate) mod tests { use sp_core::H256; use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError}; use frame_support::{ - impl_outer_origin, parameter_types, assert_ok, assert_noop, assert_err, + impl_outer_origin, parameter_types, assert_ok, assert_noop, weights::{WithPostDispatchInfo, Pays}, }; @@ -1937,7 +1941,7 @@ pub(crate) mod tests { pub struct Call; impl Dispatchable for Call { - type Origin = (); + type Origin = Origin; type Trait = (); type Info = DispatchInfo; type PostInfo = PostDispatchInfo; @@ -1948,6 +1952,7 @@ pub(crate) mod tests { } impl Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Call = Call; type Index = u64; @@ -1997,7 +2002,7 @@ pub(crate) mod tests { fn origin_works() { let o = Origin::from(RawOrigin::::Signed(1u64)); let x: Result, Origin> = o.into(); - assert_eq!(x, Ok(RawOrigin::::Signed(1u64))); + assert_eq!(x.unwrap(), RawOrigin::::Signed(1u64)); } #[test] @@ -2719,8 +2724,8 @@ pub(crate) mod tests { EnsureOneOf::, EnsureSigned>::try_origin(o.into()) } - assert_ok!(ensure_root_or_signed(RawOrigin::Root), Either::Left(())); - assert_ok!(ensure_root_or_signed(RawOrigin::Signed(0)), Either::Right(0)); - assert_err!(ensure_root_or_signed(RawOrigin::None), Origin::from(RawOrigin::None)); + assert_eq!(ensure_root_or_signed(RawOrigin::Root).unwrap(), Either::Left(())); + assert_eq!(ensure_root_or_signed(RawOrigin::Signed(0)).unwrap(), Either::Right(0)); + assert!(ensure_root_or_signed(RawOrigin::None).is_err()) } } diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index 6d38919f31..63456100a5 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -314,6 +314,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -352,7 +353,7 @@ mod tests { fn timestamp_works() { new_test_ext().execute_with(|| { Timestamp::set_timestamp(42); - assert_ok!(Timestamp::dispatch(Call::set(69), Origin::NONE)); + assert_ok!(Timestamp::set(Origin::none(), 69)); assert_eq!(Timestamp::now(), 69); }); } @@ -362,8 +363,8 @@ mod tests { fn double_timestamp_should_fail() { new_test_ext().execute_with(|| { Timestamp::set_timestamp(42); - assert_ok!(Timestamp::dispatch(Call::set(69), Origin::NONE)); - let _ = Timestamp::dispatch(Call::set(70), Origin::NONE); + assert_ok!(Timestamp::set(Origin::none(), 69)); + let _ = Timestamp::set(Origin::none(), 70); }); } @@ -372,7 +373,7 @@ mod tests { fn block_period_minimum_enforced() { new_test_ext().execute_with(|| { Timestamp::set_timestamp(42); - let _ = Timestamp::dispatch(Call::set(46), Origin::NONE); + let _ = Timestamp::set(Origin::none(), 46); }); } } diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 8355a58c52..740fec099d 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -428,6 +428,7 @@ mod tests { } impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 0b68c51a10..027e52c1bf 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -60,6 +60,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -271,7 +272,7 @@ fn close_tip_works() { assert_noop!(Treasury::close_tip(Origin::signed(0), h.into()), Error::::Premature); System::set_block_number(2); - assert_noop!(Treasury::close_tip(Origin::NONE, h.into()), BadOrigin); + assert_noop!(Treasury::close_tip(Origin::none(), h.into()), BadOrigin); assert_ok!(Treasury::close_tip(Origin::signed(0), h.into())); assert_eq!(Balances::free_balance(3), 10); @@ -381,7 +382,7 @@ fn accepted_spend_proposal_ignored_outside_spend_period() { Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 0)); >::on_initialize(1); assert_eq!(Balances::free_balance(3), 0); @@ -408,7 +409,7 @@ fn rejected_spend_proposal_ignored_on_spend_period() { Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3)); - assert_ok!(Treasury::reject_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::reject_proposal(Origin::root(), 0)); >::on_initialize(2); assert_eq!(Balances::free_balance(3), 0); @@ -422,22 +423,22 @@ fn reject_already_rejected_spend_proposal_fails() { Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3)); - assert_ok!(Treasury::reject_proposal(Origin::ROOT, 0)); - assert_noop!(Treasury::reject_proposal(Origin::ROOT, 0), Error::::InvalidProposalIndex); + assert_ok!(Treasury::reject_proposal(Origin::root(), 0)); + assert_noop!(Treasury::reject_proposal(Origin::root(), 0), Error::::InvalidProposalIndex); }); } #[test] fn reject_non_existent_spend_proposal_fails() { new_test_ext().execute_with(|| { - assert_noop!(Treasury::reject_proposal(Origin::ROOT, 0), Error::::InvalidProposalIndex); + assert_noop!(Treasury::reject_proposal(Origin::root(), 0), Error::::InvalidProposalIndex); }); } #[test] fn accept_non_existent_spend_proposal_fails() { new_test_ext().execute_with(|| { - assert_noop!(Treasury::approve_proposal(Origin::ROOT, 0), Error::::InvalidProposalIndex); + assert_noop!(Treasury::approve_proposal(Origin::root(), 0), Error::::InvalidProposalIndex); }); } @@ -447,8 +448,8 @@ fn accept_already_rejected_spend_proposal_fails() { Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3)); - assert_ok!(Treasury::reject_proposal(Origin::ROOT, 0)); - assert_noop!(Treasury::approve_proposal(Origin::ROOT, 0), Error::::InvalidProposalIndex); + assert_ok!(Treasury::reject_proposal(Origin::root(), 0)); + assert_noop!(Treasury::approve_proposal(Origin::root(), 0), Error::::InvalidProposalIndex); }); } @@ -459,7 +460,7 @@ fn accepted_spend_proposal_enacted_on_spend_period() { assert_eq!(Treasury::pot(), 100); assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 0)); >::on_initialize(2); assert_eq!(Balances::free_balance(3), 100); @@ -474,7 +475,7 @@ fn pot_underflow_should_not_diminish() { assert_eq!(Treasury::pot(), 100); assert_ok!(Treasury::propose_spend(Origin::signed(0), 150, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 0)); >::on_initialize(2); assert_eq!(Treasury::pot(), 100); // Pot hasn't changed @@ -496,13 +497,13 @@ fn treasury_account_doesnt_get_deleted() { let treasury_balance = Balances::free_balance(&Treasury::account_id()); assert_ok!(Treasury::propose_spend(Origin::signed(0), treasury_balance, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 0)); >::on_initialize(2); assert_eq!(Treasury::pot(), 100); // Pot hasn't changed assert_ok!(Treasury::propose_spend(Origin::signed(0), Treasury::pot(), 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 1)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 1)); >::on_initialize(4); assert_eq!(Treasury::pot(), 0); // Pot is emptied @@ -526,9 +527,9 @@ fn inexistent_account_works() { assert_eq!(Treasury::pot(), 0); // Pot is empty assert_ok!(Treasury::propose_spend(Origin::signed(0), 99, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 0)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 0)); assert_ok!(Treasury::propose_spend(Origin::signed(0), 1, 3)); - assert_ok!(Treasury::approve_proposal(Origin::ROOT, 1)); + assert_ok!(Treasury::approve_proposal(Origin::root(), 1)); >::on_initialize(2); assert_eq!(Treasury::pot(), 0); // Pot hasn't changed assert_eq!(Balances::free_balance(3), 0); // Balance of `3` hasn't changed diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index add1049b26..3759a2afcd 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -54,8 +54,9 @@ use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_core::TypeId; use sp_io::hashing::blake2_256; -use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure}; -use frame_support::{traits::{Filter, FilterStack, ClearFilterGuard}, +use frame_support::{decl_module, decl_event, decl_storage, Parameter}; +use frame_support::{ + traits::{OriginTrait, UnfilteredDispatchable}, weights::{Weight, GetDispatchInfo, DispatchClass}, dispatch::PostDispatchInfo, }; use frame_system::{self as system, ensure_signed, ensure_root}; @@ -71,23 +72,14 @@ pub trait Trait: frame_system::Trait { /// The overarching call type. type Call: Parameter + Dispatchable - + GetDispatchInfo + From>; - - /// Is a given call compatible with the proxying subsystem? - type IsCallable: FilterStack<::Call>; + + GetDispatchInfo + From> + + UnfilteredDispatchable; } decl_storage! { trait Store for Module as Utility {} } -decl_error! { - pub enum Error for Module { - /// A call with a `false` `IsCallable` filter was attempted. - Uncallable, - } -} - decl_event! { /// Events type. pub enum Event { @@ -96,8 +88,6 @@ decl_event! { BatchInterrupted(u32, DispatchError), /// Batch of dispatches completed fully with no error. BatchCompleted, - /// A call with a `false` IsCallable filter was attempted. - Uncallable(u32), } } @@ -111,20 +101,18 @@ impl TypeId for IndexedUtilityModuleId { decl_module! { pub struct Module for enum Call where origin: T::Origin { - type Error = Error; - /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; /// Send a batch of dispatch calls. /// - /// This will execute until the first one fails and then stop. Calls must fulfil the - /// `IsCallable` filter unless the origin is `Root`. - /// /// May be called from any origin. /// /// - `calls`: The calls to be dispatched from the same origin. /// + /// If origin is root then call are dispatch without checking origin filter. (This includes + /// bypassing `frame_system::Trait::BaseCallFilter`). + /// /// # /// - Base weight: 14.39 + .987 * c µs /// - Plus the sum of the weights of the `calls`. @@ -154,11 +142,11 @@ decl_module! { fn batch(origin, calls: Vec<::Call>) { let is_root = ensure_root(origin.clone()).is_ok(); for (index, call) in calls.into_iter().enumerate() { - if !is_root && !T::IsCallable::filter(&call) { - Self::deposit_event(Event::Uncallable(index as u32)); - return Ok(()) - } - let result = call.dispatch(origin.clone()); + let result = if is_root { + call.dispatch_bypass_filter(origin.clone()) + } else { + call.dispatch(origin.clone()) + }; if let Err(e) = result { Self::deposit_event(Event::BatchInterrupted(index as u32, e.error)); return Ok(()); @@ -169,9 +157,6 @@ decl_module! { /// Send a call through an indexed pseudonym of the sender. /// - /// The call must fulfil only the pre-cleared `IsCallable` filter (i.e. only the level of - /// filtering that remains after calling `take()`). - /// /// NOTE: If you need to ensure that any account-based filtering is honored (i.e. because /// you expect `proxy` to have been used prior in the call stack and you want it to apply to /// any sub-accounts), then use `as_limited_sub` instead. @@ -188,10 +173,8 @@ decl_module! { )] fn as_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { let who = ensure_signed(origin)?; - // We're now executing as a freshly authenticated new account, so the previous call - // restrictions no longer apply. - let _guard = ClearFilterGuard::::Call>::new(); - ensure!(T::IsCallable::filter(&call), Error::::Uncallable); + + // This is a freshly authenticated new account, the origin restrictions doesn't apply. let pseudonym = Self::sub_account_id(who, index); call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) .map(|_| ()).map_err(|e| e.error) @@ -199,7 +182,8 @@ decl_module! { /// Send a call through an indexed pseudonym of the sender. /// - /// Calls must each fulfil the `IsCallable` filter; it is not cleared before. + /// Filter from origin are passed along. The call will be dispatched with an origin which + /// use the same filter as the origin of this call. /// /// NOTE: If you need to ensure that any account-based filtering is not honored (i.e. /// because you expect `proxy` to have been used prior in the call stack and you do not want @@ -216,11 +200,11 @@ decl_module! { call.get_dispatch_info().class, )] fn as_limited_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { - let who = ensure_signed(origin)?; - ensure!(T::IsCallable::filter(&call), Error::::Uncallable); + let mut origin = origin; + let who = ensure_signed(origin.clone())?; let pseudonym = Self::sub_account_id(who, index); - call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) - .map(|_| ()).map_err(|e| e.error) + origin.set_caller_from(frame_system::RawOrigin::Signed(pseudonym)); + call.dispatch(origin).map(|_| ()).map_err(|e| e.error) } } } diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index 66a663a385..e0f8426d28 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use frame_support::{ assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, - weights::Weight, impl_outer_event + weights::Weight, impl_outer_event, dispatch::DispatchError, traits::Filter, storage, }; use sp_core::H256; use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; @@ -59,6 +59,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = TestBaseCallFilter; type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -98,8 +99,8 @@ parameter_types! { pub const MultisigDepositFactor: u64 = 1; pub const MaxSignatories: u16 = 3; } -pub struct TestIsCallable; -impl Filter for TestIsCallable { +pub struct TestBaseCallFilter; +impl Filter for TestBaseCallFilter { fn filter(c: &Call) -> bool { match *c { Call::Balances(_) => true, @@ -107,17 +108,9 @@ impl Filter for TestIsCallable { } } } -impl FilterStack for TestIsCallable { - type Stack = (); - fn push(_: impl Fn(&Call) -> bool + 'static) {} - fn pop() {} - fn take() -> Self::Stack { () } - fn restore(_: Self::Stack) {} -} impl Trait for Test { type Event = TestEvent; type Call = Call; - type IsCallable = TestIsCallable; } type System = frame_system::Module; type Balances = pallet_balances::Module; @@ -171,21 +164,26 @@ fn as_sub_filters() { Origin::signed(1), 1, Box::new(Call::System(frame_system::Call::remark(vec![]))), - ), Error::::Uncallable); + ), DispatchError::BadOrigin); }); } #[test] fn batch_with_root_works() { new_test_ext().execute_with(|| { + let k = b"a".to_vec(); + let call = Call::System(frame_system::Call::set_storage(vec![(k.clone(), k.clone())])); + assert!(!TestBaseCallFilter::filter(&call)); assert_eq!(Balances::free_balance(1), 10); assert_eq!(Balances::free_balance(2), 10); - assert_ok!(Utility::batch(Origin::ROOT, vec![ + assert_ok!(Utility::batch(Origin::root(), vec![ + Call::Balances(BalancesCall::force_transfer(1, 2, 5)), Call::Balances(BalancesCall::force_transfer(1, 2, 5)), - Call::Balances(BalancesCall::force_transfer(1, 2, 5)) + call, // Check filters are correctly bypassed ])); assert_eq!(Balances::free_balance(1), 0); assert_eq!(Balances::free_balance(2), 20); + assert_eq!(storage::unhashed::get_raw(&k), Some(k)); }); } @@ -213,7 +211,7 @@ fn batch_with_signed_filters() { Call::System(frame_system::Call::remark(vec![])) ]), ); - expect_event(Event::Uncallable(0)); + expect_event(Event::BatchInterrupted(0, DispatchError::BadOrigin)); }); } diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index 63a092da30..5893869c91 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -380,6 +380,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; type Index = u64; type BlockNumber = u64; diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index fb46ba1dfa..b1739269e6 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -144,7 +144,7 @@ impl< } /// An error type that indicates that the origin is invalid. -#[derive(Encode, Decode)] +#[derive(Encode, Decode, RuntimeDebug)] pub struct BadOrigin; impl From for &'static str { diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index bf6c7450c5..eaac618b44 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -184,7 +184,7 @@ impl ExtrinsicT for Extrinsic { } impl sp_runtime::traits::Dispatchable for Extrinsic { - type Origin = (); + type Origin = Origin; type Trait = (); type Info = (); type PostInfo = (); @@ -401,6 +401,7 @@ parameter_types! { } impl frame_system::Trait for Runtime { + type BaseCallFilter = (); type Origin = Origin; type Call = Extrinsic; type Index = u64; -- GitLab From 4368fc66041b155050d68dccd43711ae01bc250b Mon Sep 17 00:00:00 2001 From: tgmichel Date: Mon, 15 Jun 2020 17:05:54 +0200 Subject: [PATCH 162/280] pallet-evm add get(fn) to AccountStorages (#6279) --- frame/evm/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index 3600b866b2..72392629d6 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -159,7 +159,8 @@ decl_storage! { trait Store for Module as EVM { Accounts get(fn accounts): map hasher(blake2_128_concat) H160 => Account; AccountCodes get(fn account_codes): map hasher(blake2_128_concat) H160 => Vec; - AccountStorages: double_map hasher(blake2_128_concat) H160, hasher(blake2_128_concat) H256 => H256; + AccountStorages get(fn account_storages): + double_map hasher(blake2_128_concat) H160, hasher(blake2_128_concat) H256 => H256; } add_extra_genesis { -- GitLab From 690701841709637df076ca34e0f74a131642c93f Mon Sep 17 00:00:00 2001 From: Demi Obenour Date: Tue, 16 Jun 2020 10:14:12 +0000 Subject: [PATCH 163/280] Add IPC support (#6348) This is useful for both security and performance reasons. IPC is faster than TCP, and it is subject to OS access controls. --- Cargo.lock | 80 +++++++++++++++++++++++++++++- client/cli/src/commands/mod.rs | 6 +++ client/cli/src/commands/run_cmd.rs | 8 +++ client/cli/src/config.rs | 8 +++ client/rpc-servers/Cargo.toml | 1 + client/rpc-servers/src/lib.rs | 19 +++++++ client/service/src/config.rs | 2 + client/service/src/lib.rs | 11 ++++ client/service/test/src/lib.rs | 1 + utils/browser/src/lib.rs | 1 + 10 files changed, 136 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 83c98c65c6..8948337d58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2383,6 +2383,20 @@ dependencies = [ "unicase", ] +[[package]] +name = "jsonrpc-ipc-server" +version = "14.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dedccd693325d833963b549e959137f30a7a0ea650cde92feda81dc0c1393cb5" +dependencies = [ + "jsonrpc-core", + "jsonrpc-server-utils", + "log", + "parity-tokio-ipc", + "parking_lot 0.10.2", + "tokio-service", +] + [[package]] name = "jsonrpc-pubsub" version = "14.2.0" @@ -3092,7 +3106,7 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow", + "miow 0.2.1", "net2", "slab", "winapi 0.2.8", @@ -3110,6 +3124,18 @@ dependencies = [ "slab", ] +[[package]] +name = "mio-named-pipes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +dependencies = [ + "log", + "mio", + "miow 0.3.5", + "winapi 0.3.8", +] + [[package]] name = "mio-uds" version = "0.6.7" @@ -3133,6 +3159,16 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +dependencies = [ + "socket2", + "winapi 0.3.8", +] + [[package]] name = "more-asserts" version = "0.2.1" @@ -4734,6 +4770,25 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" +[[package]] +name = "parity-tokio-ipc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e57fea504fea33f9fbb5f49f378359030e7e026a6ab849bb9e8f0787376f1bf" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.29", + "libc", + "log", + "mio-named-pipes", + "miow 0.3.5", + "rand 0.7.3", + "tokio 0.1.22", + "tokio-named-pipes", + "tokio-uds", + "winapi 0.3.8", +] + [[package]] name = "parity-util-mem" version = "0.6.1" @@ -6580,6 +6635,7 @@ version = "2.0.0-rc3" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", + "jsonrpc-ipc-server", "jsonrpc-pubsub", "jsonrpc-ws-server", "log", @@ -8655,6 +8711,19 @@ dependencies = [ "syn 1.0.17", ] +[[package]] +name = "tokio-named-pipes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d282d483052288b2308ba5ee795f5673b159c9bdf63c385a05609da782a5eae" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.29", + "mio", + "mio-named-pipes", + "tokio 0.1.22", +] + [[package]] name = "tokio-reactor" version = "0.1.12" @@ -8686,6 +8755,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "tokio-service" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" +dependencies = [ + "futures 0.1.29", +] + [[package]] name = "tokio-sync" version = "0.1.8" diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs index 6931a8715c..04cce66bef 100644 --- a/client/cli/src/commands/mod.rs +++ b/client/cli/src/commands/mod.rs @@ -285,6 +285,12 @@ macro_rules! substrate_cli_subcommands { } } + fn rpc_ipc(&self) -> $crate::Result<::std::option::Option<::std::string::String>> { + match self { + $($enum::$variant(cmd) => cmd.rpc_ipc()),* + } + } + fn rpc_http(&self) -> $crate::Result<::std::option::Option<::std::net::SocketAddr>> { match self { $($enum::$variant(cmd) => cmd.rpc_http()),* diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index 82d40e6a73..16bae1ea96 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -122,6 +122,10 @@ pub struct RunCmd { #[structopt(long = "prometheus-external")] pub prometheus_external: bool, + /// Specify IPC RPC server path + #[structopt(long = "ipc-path", value_name = "PATH")] + pub ipc_path: Option, + /// Specify HTTP RPC server TCP port. #[structopt(long = "rpc-port", value_name = "PORT")] pub rpc_port: Option, @@ -434,6 +438,10 @@ impl CliConfiguration for RunCmd { Ok(Some(SocketAddr::new(interface, self.rpc_port.unwrap_or(9933)))) } + fn rpc_ipc(&self) -> Result> { + Ok(self.ipc_path.clone()) + } + fn rpc_ws(&self) -> Result> { let interface = rpc_interface( self.ws_external, diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index d121546c19..2c3cfe8419 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -264,6 +264,13 @@ pub trait CliConfiguration: Sized { Ok(Default::default()) } + /// Get the RPC IPC path (`None` if disabled). + /// + /// By default this is `None`. + fn rpc_ipc(&self) -> Result> { + Ok(Default::default()) + } + /// Get the RPC websocket address (`None` if disabled). /// /// By default this is `None`. @@ -451,6 +458,7 @@ pub trait CliConfiguration: Sized { execution_strategies: self.execution_strategies(is_dev, is_validator)?, rpc_http: self.rpc_http()?, rpc_ws: self.rpc_ws()?, + rpc_ipc: self.rpc_ipc()?, rpc_methods: self.rpc_methods()?, rpc_ws_max_connections: self.rpc_ws_max_connections()?, rpc_cors: self.rpc_cors(is_dev)?, diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 9ea70f1794..b1ec04f5e4 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -22,3 +22,4 @@ sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.2.0" } ws = { package = "jsonrpc-ws-server", version = "14.2.0" } +ipc = { version = "14.2.0", package = "jsonrpc-ipc-server" } diff --git a/client/rpc-servers/src/lib.rs b/client/rpc-servers/src/lib.rs index 6fe4586b6e..1e476262ac 100644 --- a/client/rpc-servers/src/lib.rs +++ b/client/rpc-servers/src/lib.rs @@ -62,6 +62,8 @@ pub fn rpc_handler( mod inner { use super::*; + /// Type alias for ipc server + pub type IpcServer = ipc::Server; /// Type alias for http server pub type HttpServer = http::Server; /// Type alias for ws server @@ -89,6 +91,23 @@ mod inner { .start_http(addr) } + /// Start IPC server listening on given path. + /// + /// **Note**: Only available if `not(target_os = "unknown")`. + pub fn start_ipc( + addr: &str, + io: RpcHandler, + ) -> io::Result { + let builder = ipc::ServerBuilder::new(io); + #[cfg(target_os = "unix")] + builder.set_security_attributes({ + let security_attributes = ipc::SecurityAttributes::empty(); + security_attributes.set_mode(0o600)?; + security_attributes + }); + builder.start(addr) + } + /// Start WS server listening on given address. /// /// **Note**: Only available if `not(target_os = "unknown")`. diff --git a/client/service/src/config.rs b/client/service/src/config.rs index 2d4dc9dc2e..b79831d57b 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -67,6 +67,8 @@ pub struct Configuration { pub rpc_http: Option, /// RPC over Websockets binding address. `None` if disabled. pub rpc_ws: Option, + /// RPC over IPC binding path. `None` if disabled. + pub rpc_ipc: Option, /// Maximum number of connections for WebSockets RPC server. `None` if default. pub rpc_ws_max_connections: Option, /// CORS settings for HTTP & WS servers. `None` if all origins are allowed. diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index fc0567e268..6e230b253d 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -510,6 +510,16 @@ mod waiting { } } + pub struct IpcServer(pub Option); + impl Drop for IpcServer { + fn drop(&mut self) { + if let Some(server) = self.0.take() { + server.close_handle().close(); + let _ = server.wait(); + } + } + } + pub struct WsServer(pub Option); impl Drop for WsServer { fn drop(&mut self) { @@ -555,6 +565,7 @@ fn start_rpc_servers sc_rpc_server::RpcHandler Date: Tue, 16 Jun 2020 19:08:07 +0800 Subject: [PATCH 164/280] expose constants of pallet_recovery trait (#6363) --- frame/recovery/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frame/recovery/src/lib.rs b/frame/recovery/src/lib.rs index 470803d22e..9c7503666a 100644 --- a/frame/recovery/src/lib.rs +++ b/frame/recovery/src/lib.rs @@ -320,6 +320,18 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { type Error = Error; + /// The base amount of currency needed to reserve for creating a recovery configuration. + const ConfigDepositBase: BalanceOf = T::ConfigDepositBase::get(); + + /// The amount of currency needed per additional user when creating a recovery configuration. + const FriendDepositFactor: BalanceOf = T::FriendDepositFactor::get(); + + /// The maximum amount of friends allowed in a recovery configuration. + const MaxFriends: u16 = T::MaxFriends::get(); + + /// The base amount of currency needed to reserve for starting a recovery. + const RecoveryDeposit: BalanceOf = T::RecoveryDeposit::get(); + /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; -- GitLab From b29e467545d43e799795b35e415f6d44cc3525e7 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Tue, 16 Jun 2020 13:10:10 +0200 Subject: [PATCH 165/280] Impl integrity test for runtime (#6356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * impl integrity test for runtime * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Bastian Köcher * use thread local * update doc * Apply suggestions from code review Co-authored-by: Bastian Köcher Co-authored-by: Gavin Wood --- Cargo.lock | 1 + .../procedural/src/construct_runtime/mod.rs | 17 +++ frame/support/src/dispatch.rs | 129 +++++++++++++++++- frame/support/src/traits.rs | 11 ++ frame/support/test/Cargo.toml | 2 + .../{decl_error.rs => construct_runtime.rs} | 20 ++- 6 files changed, 175 insertions(+), 5 deletions(-) rename frame/support/test/tests/{decl_error.rs => construct_runtime.rs} (88%) diff --git a/Cargo.lock b/Cargo.lock index 8948337d58..18290e7748 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1515,6 +1515,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", + "sp-std", "trybuild", ] diff --git a/frame/support/procedural/src/construct_runtime/mod.rs b/frame/support/procedural/src/construct_runtime/mod.rs index d7529cd272..cac7549062 100644 --- a/frame/support/procedural/src/construct_runtime/mod.rs +++ b/frame/support/procedural/src/construct_runtime/mod.rs @@ -89,6 +89,7 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result Result( .find(|decl| decl.name == SYSTEM_MODULE_NAME) .map(|decl| &decl.module) } + +fn decl_integrity_test(scrate: &TokenStream2) -> TokenStream2 { + quote!( + #[cfg(test)] + mod __construct_runtime_integrity_test { + use super::*; + + #[test] + pub fn runtime_integrity_tests() { + ::integrity_test(); + } + } + ) +} diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index 70a552ce3a..094cbce263 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -269,8 +269,11 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {} /// * `fn on_finalize() -> frame_support::weights::Weight` /// /// * `offchain_worker`: Executes at the beginning of a block and produces extrinsics for a future block -/// upon completion. Using this function will implement the -/// [`OffchainWorker`](./traits/trait.OffchainWorker.html) trait. +/// upon completion. Using this function will implement the +/// [`OffchainWorker`](./traits/trait.OffchainWorker.html) trait. +/// * `integrity_test`: Executes in a test generated by `construct_runtime`, note it doesn't +/// execute in an externalities-provided environment. Implement +/// [`IntegrityTest`](./trait.IntegrityTest.html) trait. #[macro_export] macro_rules! decl_module { // Entry point #1. @@ -298,6 +301,7 @@ macro_rules! decl_module { {} {} {} + {} [] $($t)* ); @@ -331,6 +335,7 @@ macro_rules! decl_module { {} {} {} + {} [] $($t)* ); @@ -349,6 +354,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $vis:vis fn deposit_event() = default; @@ -366,6 +372,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -382,6 +389,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $vis:vis fn deposit_event @@ -404,6 +412,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn on_finalize( $( $param_name:ident : $param:ty ),* $(,)? ) { $( $impl:tt )* } @@ -423,6 +432,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -440,6 +450,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* #[weight = $weight:expr] @@ -466,6 +477,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn on_runtime_upgrade( $( $param_name:ident : $param:ty ),* $(,)? ) { $( $impl:tt )* } @@ -490,6 +502,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* #[weight = $weight:expr] @@ -516,6 +529,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn on_runtime_upgrade( $( $param_name:ident : $param:ty ),* $(,)? ) -> $return:ty { $( $impl:tt )* } @@ -535,6 +549,48 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } + [ $( $dispatchables )* ] + $($rest)* + ); + }; + // Add integrity_test + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )* } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + {} + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + fn integrity_test() { $( $impl:tt )* } + $($rest:tt)* + ) => { + $crate::decl_module!(@normalize + $(#[$attr])* + pub struct $mod_type<$trait_instance: $trait_name$(, I: $instantiable $(= $module_default_instance)?)?> + for enum $call_type where origin: $origin_type, system = $system + { $( $other_where_bounds )* } + { $( $deposit_event )* } + { $( $on_initialize )* } + { $( $on_runtime_upgrade )* } + { $( $on_finalize )* } + { $( $offchain )* } + { $( $constants )* } + { $( $error_type )* } + { + $(#[doc = $doc_attr])* + fn integrity_test() { $( $impl)* } + } [ $( $dispatchables )* ] $($rest)* ); @@ -554,6 +610,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn on_initialize( $( $param_name:ident : $param:ty ),* $(,)? ) { $( $impl:tt )* } @@ -578,6 +635,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* #[weight = $weight:expr] @@ -604,6 +662,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn on_initialize( $( $param_name:ident : $param:ty ),* $(,)? ) -> $return:ty { $( $impl:tt )* } @@ -623,6 +682,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -642,6 +702,7 @@ macro_rules! decl_module { { } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* fn offchain_worker( $( $param_name:ident : $param:ty ),* $(,)? ) { $( $impl:tt )* } @@ -661,6 +722,7 @@ macro_rules! decl_module { { fn offchain_worker( $( $param_name : $param ),* ) { $( $impl )* } } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -682,6 +744,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $( #[doc = $doc_attr:tt] )* const $name:ident: $ty:ty = $value:expr; @@ -706,6 +769,7 @@ macro_rules! decl_module { $name: $ty = $value; } { $( $error_type )* } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -727,6 +791,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* type Error = $error_type:ty; @@ -746,6 +811,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $error_type } + { $( $integrity_test)* } [ $( $dispatchables )* ] $($rest)* ); @@ -766,6 +832,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { } + { $( $integrity_test:tt )* } [ $($t:tt)* ] $($rest:tt)* ) => { @@ -783,6 +850,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { &'static str } + { $( $integrity_test)* } [ $($t)* ] $($rest)* ); @@ -804,6 +872,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $error_type:ty } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* #[weight = $weight:expr] @@ -826,6 +895,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $error_type } + { $( $integrity_test)* } [ $( $dispatchables )* $(#[doc = $doc_attr])* @@ -854,6 +924,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $fn_vis:vis fn $fn_name:ident( @@ -880,6 +951,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $(#[weight = $weight:expr])? @@ -906,6 +978,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $(#[weight = $weight:expr])? @@ -932,6 +1005,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] $(#[doc = $doc_attr:tt])* $(#[weight = $weight:expr])? @@ -959,6 +1033,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $( $error_type:tt )* } + { $( $integrity_test:tt )* } [ $( $dispatchables:tt )* ] ) => { $crate::decl_module!(@imp @@ -975,6 +1050,7 @@ macro_rules! decl_module { { $( $offchain )* } { $( $constants )* } { $( $error_type )* } + { $( $integrity_test)* } ); }; @@ -1081,6 +1157,32 @@ macro_rules! decl_module { {} }; + (@impl_integrity_test + $module:ident<$trait_instance:ident: $trait_name:ident$(, $instance:ident: $instantiable:path)?>; + { $( $other_where_bounds:tt )* } + $(#[doc = $doc_attr:tt])* + fn integrity_test() { $( $impl:tt )* } + ) => { + impl<$trait_instance: $trait_name$(, $instance: $instantiable)?> + $crate::traits::IntegrityTest + for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* + { + $(#[doc = $doc_attr])* + fn integrity_test() { + $( $impl )* + } + } + }; + + (@impl_integrity_test + $module:ident<$trait_instance:ident: $trait_name:ident$(, $instance:ident: $instantiable:path)?>; + { $( $other_where_bounds:tt )* } + ) => { + impl<$trait_instance: $trait_name$(, $instance: $instantiable)?> + $crate::traits::IntegrityTest + for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )* + {} + }; (@impl_on_finalize $module:ident<$trait_instance:ident: $trait_name:ident$(, $instance:ident: $instantiable:path)?>; @@ -1340,6 +1442,7 @@ macro_rules! decl_module { { $( $offchain:tt )* } { $( $constants:tt )* } { $error_type:ty } + { $( $integrity_test:tt )* } ) => { $crate::__check_reserved_fn_name! { $( $fn_name )* } @@ -1366,7 +1469,6 @@ macro_rules! decl_module { $( $on_runtime_upgrade )* } - $crate::decl_module! { @impl_on_finalize $mod_type<$trait_instance: $trait_name $(, $instance: $instantiable)?>; @@ -1388,6 +1490,13 @@ macro_rules! decl_module { $( $deposit_event )* } + $crate::decl_module! { + @impl_integrity_test + $mod_type<$trait_instance: $trait_name $(, $instance: $instantiable)?>; + { $( $other_where_bounds )* } + $( $integrity_test )* + } + /// Can also be called using [`Call`]. /// /// [`Call`]: enum.Call.html @@ -2015,6 +2124,9 @@ macro_rules! __check_reserved_fn_name { (offchain_worker $( $rest:ident )*) => { $crate::__check_reserved_fn_name!(@compile_error offchain_worker); }; + (integrity_test $( $rest:ident )*) => { + $crate::__check_reserved_fn_name!(@compile_error integrity_test); + }; ($t:ident $( $rest:ident )*) => { $crate::__check_reserved_fn_name!($( $rest )*); }; @@ -2050,7 +2162,8 @@ mod tests { use super::*; use crate::weights::{DispatchInfo, DispatchClass, Pays}; use crate::traits::{ - CallMetadata, GetCallMetadata, GetCallName, OnInitialize, OnFinalize, OnRuntimeUpgrade + CallMetadata, GetCallMetadata, GetCallName, OnInitialize, OnFinalize, OnRuntimeUpgrade, + IntegrityTest, }; pub trait Trait: system::Trait + Sized where Self::AccountId: From { @@ -2112,6 +2225,8 @@ mod tests { fn on_finalize(n: T::BlockNumber,) { if n.into() == 42 { panic!("on_finalize") } } fn on_runtime_upgrade() -> Weight { 10 } fn offchain_worker() {} + /// Some doc + fn integrity_test() { panic!("integrity_test") } } } @@ -2303,4 +2418,10 @@ mod tests { let module_names = OuterCall::get_module_names(); assert_eq!(["Test"], module_names); } + + #[test] + #[should_panic(expected = "integrity_test")] + fn integrity_test_should_work() { + as IntegrityTest>::integrity_test(); + } } diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 833160b61c..9a2dbf2b29 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -192,6 +192,17 @@ macro_rules! impl_filter_stack { } } +/// Type that provide some integrity tests. +/// +/// This implemented for modules by `decl_module`. +#[impl_for_tuples(30)] +pub trait IntegrityTest { + /// Run integrity test. + /// + /// The test is not executed in a externalities provided environment. + fn integrity_test() {} +} + #[cfg(test)] mod test_impl_filter_stack { use super::*; diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 65933929a5..a68edc6238 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -20,6 +20,7 @@ frame-support = { version = "2.0.0-rc3", default-features = false, path = "../" sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/inherents" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" @@ -33,6 +34,7 @@ std = [ "frame-support/std", "sp-inherents/std", "sp-core/std", + "sp-std/std", "sp-runtime/std", "sp-state-machine", ] diff --git a/frame/support/test/tests/decl_error.rs b/frame/support/test/tests/construct_runtime.rs similarity index 88% rename from frame/support/test/tests/decl_error.rs rename to frame/support/test/tests/construct_runtime.rs index 937e27873b..10fc3319fb 100644 --- a/frame/support/test/tests/decl_error.rs +++ b/frame/support/test/tests/construct_runtime.rs @@ -15,16 +15,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! General tests for construct_runtime macro, test for: +//! * error declareed with decl_error works +//! * integrity test is generated + #![recursion_limit="128"] use sp_runtime::{generic, traits::{BlakeTwo256, Block as _, Verify}, DispatchError}; use sp_core::{H256, sr25519}; - +use sp_std::cell::RefCell; mod system; pub trait Currency {} +thread_local! { + pub static INTEGRITY_TEST_EXEC: RefCell = RefCell::new(0); +} + mod module1 { use super::*; @@ -65,6 +73,10 @@ mod module2 { pub fn fail(_origin) -> frame_support::dispatch::DispatchResult { Err(Error::::Something.into()) } + + fn integrity_test() { + INTEGRITY_TEST_EXEC.with(|i| *i.borrow_mut() += 1); + } } } @@ -139,3 +151,9 @@ fn check_module2_error_type() { Err(DispatchError::Module { index: 2, error: 0, message: Some("Something") }), ); } + +#[test] +fn integrity_test_works() { + __construct_runtime_integrity_test::runtime_integrity_tests(); + assert_eq!(INTEGRITY_TEST_EXEC.with(|i| *i.borrow()), 1); +} -- GitLab From 10959200b9f9c955a9b869130221aa8bc4642007 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Tue, 16 Jun 2020 13:14:49 +0200 Subject: [PATCH 166/280] historical slashing w ocw w adhoc tree creation (#6220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * draft * steps * chore: fmt * step by step * more details * make test public * refactor: split into on and offchain * test stab * tabs my friend * offchain overlay: split key into prefix and true key Simplifies inspection and makes key actually unique. * test: share state * fix & test * docs improv * address review comments * cleanup test chore * refactor, abbrev link text * chore: linewidth * fix prefix key split fallout * minor fallout * minor changes * addresses review comments * rename historical.rs -> historical/mod.rs * avoid shared::* wildcard import * fix: add missing call to store_session_validator_set_to_offchain * fix/compile: missing shared:: prefix * fix/test: flow * fix/review: Apply suggestions from code review Co-authored-by: Tomasz Drwięga * fix/review: more review comment fixes * fix/review: make ValidatorSet private * fix/include: core -> sp_core * fix/review: fallout * fix/visbility: make them public API Ref #6358 * fix/review: review changes fallout - again Co-authored-by: Bernhard Schuster Co-authored-by: Tomasz Drwięga --- client/db/src/lib.rs | 7 +- frame/session/Cargo.toml | 6 +- .../src/{historical.rs => historical/mod.rs} | 17 +- frame/session/src/historical/offchain.rs | 263 ++++++++++++++++++ frame/session/src/historical/onchain.rs | 62 +++++ frame/session/src/historical/shared.rs | 39 +++ primitives/core/src/offchain/storage.rs | 35 +-- primitives/core/src/offchain/testing.rs | 87 +++++- primitives/state-machine/src/testing.rs | 19 +- 9 files changed, 496 insertions(+), 39 deletions(-) rename frame/session/src/{historical.rs => historical/mod.rs} (97%) create mode 100644 frame/session/src/historical/offchain.rs create mode 100644 frame/session/src/historical/onchain.rs create mode 100644 frame/session/src/historical/shared.rs diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index f75693ec9f..3bae234567 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -544,7 +544,12 @@ pub struct BlockImportOperation { impl BlockImportOperation { fn apply_offchain(&mut self, transaction: &mut Transaction) { - for (key, value_operation) in self.offchain_storage_updates.drain() { + for ((prefix, key), value_operation) in self.offchain_storage_updates.drain() { + let key: Vec = prefix + .into_iter() + .chain(sp_core::sp_std::iter::once(b'/')) + .chain(key.into_iter()) + .collect(); match value_operation { OffchainOverlayedChange::SetValue(val) => transaction.set_from_vec(columns::OFFCHAIN, &key, val), OffchainOverlayedChange::Remove => transaction.remove(columns::OFFCHAIN, &key), diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 6955940dc4..6b74e3ef5f 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -14,7 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } @@ -25,8 +27,6 @@ sp-trie = { version = "2.0.0-rc3", optional = true, default-features = false, pa impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" @@ -37,7 +37,9 @@ std = [ "serde", "codec/std", "sp-std/std", + "sp-io/std", "frame-support/std", + "sp-core/std", "sp-runtime/std", "sp-session/std", "sp-staking/std", diff --git a/frame/session/src/historical.rs b/frame/session/src/historical/mod.rs similarity index 97% rename from frame/session/src/historical.rs rename to frame/session/src/historical/mod.rs index a1c286eb39..20c3d57464 100644 --- a/frame/session/src/historical.rs +++ b/frame/session/src/historical/mod.rs @@ -37,6 +37,10 @@ use sp_trie::{MemoryDB, Trie, TrieMut, Recorder, EMPTY_PREFIX}; use sp_trie::trie_types::{TrieDBMut, TrieDB}; use super::{SessionIndex, Module as SessionModule}; +mod shared; +pub mod offchain; +pub mod onchain; + /// Trait necessary for the historical module. pub trait Trait: super::Trait { /// Full identification of the validator. @@ -116,6 +120,7 @@ impl crate::SessionManager for NoteHistoricalRoot { fn new_session(new_index: SessionIndex) -> Option> { + StoredRange::mutate(|range| { range.get_or_insert_with(|| (new_index, new_index)).1 = new_index + 1; }); @@ -143,10 +148,13 @@ impl crate::SessionManager for NoteHistoricalRoot>::start_session(start_index) } + fn end_session(end_index: SessionIndex) { + onchain::store_session_validator_set_to_offchain::(end_index); >::end_session(end_index) } } @@ -154,7 +162,7 @@ impl crate::SessionManager for NoteHistoricalRoot = (::ValidatorId, ::FullIdentification); -/// a trie instance for checking and generating proofs. +/// A trie instance for checking and generating proofs. pub struct ProvingTrie { db: MemoryDB, root: T::Hash, @@ -250,7 +258,6 @@ impl ProvingTrie { .ok()? .and_then(|raw| >::decode(&mut &*raw).ok()) } - } impl> frame_support::traits::KeyOwnerProofSystem<(KeyTypeId, D)> @@ -311,9 +318,9 @@ impl> frame_support::traits::KeyOwnerProofSystem<(KeyTy } #[cfg(test)] -mod tests { +pub(crate) mod tests { use super::*; - use sp_core::crypto::key_types::DUMMY; + use sp_runtime::key_types::DUMMY; use sp_runtime::testing::UintAuthorityId; use crate::mock::{ NEXT_VALIDATORS, force_new_session, @@ -323,7 +330,7 @@ mod tests { type Historical = Module; - fn new_test_ext() -> sp_io::TestExternalities { + pub(crate) fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); crate::GenesisConfig:: { keys: NEXT_VALIDATORS.with(|l| diff --git a/frame/session/src/historical/offchain.rs b/frame/session/src/historical/offchain.rs new file mode 100644 index 0000000000..97655d1a18 --- /dev/null +++ b/frame/session/src/historical/offchain.rs @@ -0,0 +1,263 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Off-chain logic for creating a proof based data provided by on-chain logic. +//! +//! Validator-set extracting an iterator from an off-chain worker stored list containing +//! historical validator-sets. +//! Based on the logic of historical slashing, but the validation is done off-chain. +//! Use [`fn store_current_session_validator_set_to_offchain()`](super::onchain) to store the +//! required data to the offchain validator set. +//! This is used in conjunction with [`ProvingTrie`](super::ProvingTrie) and +//! the off-chain indexing API. + +use sp_runtime::{offchain::storage::StorageValueRef, KeyTypeId}; +use sp_session::MembershipProof; + +use super::super::{Module as SessionModule, SessionIndex}; +use super::{IdentificationTuple, ProvingTrie, Trait}; + +use super::shared; +use sp_std::prelude::*; + + +/// A set of validators, which was used for a fixed session index. +struct ValidatorSet { + validator_set: Vec>, +} + +impl ValidatorSet { + /// Load the set of validators for a particular session index from the off-chain storage. + /// + /// If none is found or decodable given `prefix` and `session`, it will return `None`. + /// Empty validator sets should only ever exist for genesis blocks. + pub fn load_from_offchain_db(session_index: SessionIndex) -> Option { + let derived_key = shared::derive_key(shared::PREFIX, session_index); + StorageValueRef::persistent(derived_key.as_ref()) + .get::>() + .flatten() + .map(|validator_set| Self { validator_set }) + } + + #[inline] + fn len(&self) -> usize { + self.validator_set.len() + } +} + +/// Implement conversion into iterator for usage +/// with [ProvingTrie](super::ProvingTrie::generate_for). +impl sp_std::iter::IntoIterator for ValidatorSet { + type Item = (T::ValidatorId, T::FullIdentification); + type IntoIter = sp_std::vec::IntoIter; + fn into_iter(self) -> Self::IntoIter { + self.validator_set.into_iter() + } +} + +/// Create a proof based on the data available in the off-chain database. +/// +/// Based on the yielded `MembershipProof` the implementer may decide what +/// to do, i.e. in case of a failed proof, enqueue a transaction back on +/// chain reflecting that, with all its consequences such as i.e. slashing. +pub fn prove_session_membership>( + session_index: SessionIndex, + session_key: (KeyTypeId, D), +) -> Option { + let validators = ValidatorSet::::load_from_offchain_db(session_index)?; + let count = validators.len() as u32; + let trie = ProvingTrie::::generate_for(validators.into_iter()).ok()?; + + let (id, data) = session_key; + trie.prove(id, data.as_ref()) + .map(|trie_nodes| MembershipProof { + session: session_index, + trie_nodes, + validator_count: count, + }) +} + + +/// Attempt to prune anything that is older than `first_to_keep` session index. +/// +/// Due to re-organisation it could be that the `first_to_keep` might be less +/// than the stored one, in which case the conservative choice is made to keep records +/// up to the one that is the lesser. +pub fn prune_older_than(first_to_keep: SessionIndex) { + let derived_key = shared::LAST_PRUNE.to_vec(); + let entry = StorageValueRef::persistent(derived_key.as_ref()); + match entry.mutate(|current: Option>| -> Result<_, ()> { + match current { + Some(Some(current)) if current < first_to_keep => Ok(first_to_keep), + // do not move the cursor, if the new one would be behind ours + Some(Some(current)) => Ok(current), + None => Ok(first_to_keep), + // if the storage contains undecodable data, overwrite with current anyways + // which might leak some entries being never purged, but that is acceptable + // in this context + Some(None) => Ok(first_to_keep), + } + }) { + Ok(Ok(new_value)) => { + // on a re-org this is not necessarily true, with the above they might be equal + if new_value < first_to_keep { + for session_index in new_value..first_to_keep { + let derived_key = shared::derive_key(shared::PREFIX, session_index); + let _ = StorageValueRef::persistent(derived_key.as_ref()).clear(); + } + } + } + Ok(Err(_)) => {} // failed to store the value calculated with the given closure + Err(_) => {} // failed to calculate the value to store with the given closure + } +} + +/// Keep the newest `n` items, and prune all items older than that. +pub fn keep_newest(n_to_keep: usize) { + let session_index = >::current_index(); + let n_to_keep = n_to_keep as SessionIndex; + if n_to_keep < session_index { + prune_older_than::(session_index - n_to_keep) + } +} + +#[cfg(test)] +mod tests { + use super::super::{onchain, Module}; + use super::*; + use crate::mock::{ + force_new_session, set_next_validators, Session, System, Test, NEXT_VALIDATORS, + }; + use codec::Encode; + use frame_support::traits::{KeyOwnerProofSystem, OnInitialize}; + use sp_core::crypto::key_types::DUMMY; + use sp_core::offchain::{ + testing::TestOffchainExt, + OffchainExt, + StorageKind, + }; + + use sp_runtime::testing::UintAuthorityId; + + type Historical = Module; + + pub fn new_test_ext() -> sp_io::TestExternalities { + let mut ext = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Failed to create test externalities."); + + crate::GenesisConfig:: { + keys: NEXT_VALIDATORS.with(|l| { + l.borrow() + .iter() + .cloned() + .map(|i| (i, i, UintAuthorityId(i).into())) + .collect() + }), + } + .assimilate_storage(&mut ext) + .unwrap(); + + + let mut ext = sp_io::TestExternalities::new(ext); + + let (offchain, offchain_state) = TestOffchainExt::with_offchain_db(ext.offchain_db()); + + const ITERATIONS: u32 = 5u32; + let mut seed = [0u8; 32]; + seed[0..4].copy_from_slice(&ITERATIONS.to_le_bytes()); + offchain_state.write().seed = seed; + + ext.register_extension(OffchainExt::new(offchain)); + ext + } + + #[test] + fn encode_decode_roundtrip() { + use codec::{Decode, Encode}; + use super::super::super::Trait as SessionTrait; + use super::super::Trait as HistoricalTrait; + + let sample = ( + 22u32 as ::ValidatorId, + 7_777_777 as ::FullIdentification); + + let encoded = sample.encode(); + let decoded = Decode::decode(&mut encoded.as_slice()).expect("Must decode"); + assert_eq!(sample, decoded); + } + + #[test] + fn onchain_to_offchain() { + let mut ext = new_test_ext(); + + const DATA: &[u8] = &[7,8,9,10,11]; + ext.execute_with(|| { + b"alphaomega"[..].using_encoded(|key| sp_io::offchain_index::set(key, DATA)); + }); + + ext.persist_offchain_overlay(); + + ext.execute_with(|| { + let data = + b"alphaomega"[..].using_encoded(|key| { + sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, key) + }); + assert_eq!(data, Some(DATA.to_vec())); + }); + } + + + #[test] + fn historical_proof_offchain() { + let mut ext = new_test_ext(); + let encoded_key_1 = UintAuthorityId(1).encode(); + + ext.execute_with(|| { + set_next_validators(vec![1, 2]); + force_new_session(); + + System::set_block_number(1); + Session::on_initialize(1); + + // "on-chain" + onchain::store_current_session_validator_set_to_offchain::(); + assert_eq!(>::current_index(), 1); + + set_next_validators(vec![7, 8]); + + force_new_session(); + }); + + ext.persist_offchain_overlay(); + + ext.execute_with(|| { + + + System::set_block_number(2); + Session::on_initialize(2); + assert_eq!(>::current_index(), 2); + + // "off-chain" + let proof = prove_session_membership::(1, (DUMMY, &encoded_key_1)); + assert!(proof.is_some()); + let proof = proof.expect("Must be Some(Proof)"); + + assert!(Historical::check_proof((DUMMY, &encoded_key_1[..]), proof.clone()).is_some()); + }); + } +} diff --git a/frame/session/src/historical/onchain.rs b/frame/session/src/historical/onchain.rs new file mode 100644 index 0000000000..745603a498 --- /dev/null +++ b/frame/session/src/historical/onchain.rs @@ -0,0 +1,62 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! On-chain logic to store a validator-set for deferred validation using an off-chain worker. + +use codec::Encode; +use sp_runtime::traits::Convert; + +use super::super::Trait as SessionTrait; +use super::super::{Module as SessionModule, SessionIndex}; +use super::Trait as HistoricalTrait; + +use super::shared; +use sp_std::prelude::*; + +/// Store the validator-set associated to the `session_index` to the off-chain database. +/// +/// Further processing is then done [`off-chain side`](super::offchain). +/// +/// **Must** be called from on-chain, i.e. a call that originates from +/// `on_initialize(..)` or `on_finalization(..)`. +/// **Must** be called during the session, which validator-set is to be stored for further +/// off-chain processing. Otherwise the `FullIdentification` might not be available. +pub fn store_session_validator_set_to_offchain( + session_index: SessionIndex, +) { + let encoded_validator_list = >::validators() + .into_iter() + .filter_map(|validator_id: ::ValidatorId| { + let full_identification = + <::FullIdentificationOf>::convert(validator_id.clone()); + full_identification.map(|full_identification| (validator_id, full_identification)) + }) + .collect::>(); + + encoded_validator_list.using_encoded(|encoded_validator_list| { + let derived_key = shared::derive_key(shared::PREFIX, session_index); + sp_io::offchain_index::set(derived_key.as_slice(), encoded_validator_list); + }); +} + +/// Store the validator set associated to the _current_ session index to the off-chain database. +/// +/// See [`fn store_session_validator_set_...(..)`](Self::store_session_validator_set_to_offchain) +/// for further information and restrictions. +pub fn store_current_session_validator_set_to_offchain() { + store_session_validator_set_to_offchain::(>::current_index()); +} diff --git a/frame/session/src/historical/shared.rs b/frame/session/src/historical/shared.rs new file mode 100644 index 0000000000..fda0361b05 --- /dev/null +++ b/frame/session/src/historical/shared.rs @@ -0,0 +1,39 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Shared logic between on-chain and off-chain components used for slashing using an off-chain +//! worker. + + +use super::SessionIndex; +use sp_std::prelude::*; +use codec::Encode; + +pub(super) const PREFIX: &[u8] = b"session_historical"; +pub(super) const LAST_PRUNE: &[u8] = b"session_historical_last_prune"; + +/// Derive the key used to store the list of validators +pub(super) fn derive_key>(prefix: P, session_index: SessionIndex) -> Vec { + let prefix: &[u8] = prefix.as_ref(); + session_index.using_encoded(|encoded_session_index| { + prefix.into_iter() + .chain(b"/".into_iter()) + .chain(encoded_session_index.into_iter()) + .copied() + .collect::>() + }) +} \ No newline at end of file diff --git a/primitives/core/src/offchain/storage.rs b/primitives/core/src/offchain/storage.rs index 52a7bbe857..7d7c711ed9 100644 --- a/primitives/core/src/offchain/storage.rs +++ b/primitives/core/src/offchain/storage.rs @@ -101,8 +101,9 @@ pub enum OffchainOverlayedChange { pub enum OffchainOverlayedChanges { /// Writing overlay changes to the offchain worker database is disabled by configuration. Disabled, - /// Overlay changes can be recorded using the inner collection of this variant. - Enabled(HashMap, OffchainOverlayedChange>), + /// Overlay changes can be recorded using the inner collection of this variant, + /// where the identifier is the tuple of `(prefix, key)`. + Enabled(HashMap<(Vec, Vec), OffchainOverlayedChange>), } impl Default for OffchainOverlayedChanges { @@ -140,23 +141,21 @@ impl OffchainOverlayedChanges { /// Remove a key and its associated value from the offchain database. pub fn remove(&mut self, prefix: &[u8], key: &[u8]) { if let Self::Enabled(ref mut storage) = self { - let key: Vec = prefix.iter().chain(key).cloned().collect(); - let _ = storage.insert(key, OffchainOverlayedChange::Remove); + let _ = storage.insert((prefix.to_vec(), key.to_vec()), OffchainOverlayedChange::Remove); } } /// Set the value associated with a key under a prefix to the value provided. pub fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]) { if let Self::Enabled(ref mut storage) = self { - let key = prefix.iter().chain(key).cloned().collect(); - let _ = storage.insert(key, OffchainOverlayedChange::SetValue(value.to_vec())); + let _ = storage.insert((prefix.to_vec(), key.to_vec()), OffchainOverlayedChange::SetValue(value.to_vec())); } } /// Obtain a associated value to the given key in storage with prefix. pub fn get(&self, prefix: &[u8], key: &[u8]) -> Option { if let Self::Enabled(ref storage) = self { - let key: Vec = prefix.iter().chain(key).cloned().collect(); + let key = (prefix.to_vec(), key.to_vec()); storage.get(&key).cloned() } else { None @@ -168,11 +167,11 @@ use std::collections::hash_map; /// Iterate by reference over the prepared offchain worker storage changes. pub struct OffchainOverlayedChangesIter<'i> { - inner: Option, OffchainOverlayedChange>>, + inner: Option, Vec), OffchainOverlayedChange>>, } impl<'i> Iterator for OffchainOverlayedChangesIter<'i> { - type Item = (&'i Vec, &'i OffchainOverlayedChange); + type Item = (&'i (Vec, Vec), &'i OffchainOverlayedChange); fn next(&mut self) -> Option { if let Some(ref mut iter) = self.inner { iter.next() @@ -197,11 +196,11 @@ impl<'i> OffchainOverlayedChangesIter<'i> { /// Iterate by value over the prepared offchain worker storage changes. pub struct OffchainOverlayedChangesIntoIter { - inner: Option,OffchainOverlayedChange>>, + inner: Option,Vec),OffchainOverlayedChange>>, } impl Iterator for OffchainOverlayedChangesIntoIter { - type Item = (Vec, OffchainOverlayedChange); + type Item = ((Vec, Vec), OffchainOverlayedChange); fn next(&mut self) -> Option { if let Some(ref mut iter) = self.inner { iter.next() @@ -225,11 +224,11 @@ impl OffchainOverlayedChangesIntoIter { /// Iterate over all items while draining them from the collection. pub struct OffchainOverlayedChangesDrain<'d> { - inner: Option,OffchainOverlayedChange>>, + inner: Option, Vec), OffchainOverlayedChange>>, } impl<'d> Iterator for OffchainOverlayedChangesDrain<'d> { - type Item = (Vec, OffchainOverlayedChange); + type Item = ((Vec, Vec), OffchainOverlayedChange); fn next(&mut self) -> Option { if let Some(ref mut iter) = self.inner { iter.next() @@ -286,9 +285,13 @@ mod test { ooc.set(STORAGE_PREFIX, b"ppp", b"rrr"); let mut iter = ooc.into_iter(); - let mut k = STORAGE_PREFIX.to_vec(); - k.extend_from_slice(&b"ppp"[..]); - assert_eq!(iter.next(), Some((k, OffchainOverlayedChange::SetValue(b"rrr".to_vec())))); + assert_eq!( + iter.next(), + Some( + ((STORAGE_PREFIX.to_vec(), b"ppp".to_vec()), + OffchainOverlayedChange::SetValue(b"rrr".to_vec())) + ) + ); assert_eq!(iter.next(), None); } } diff --git a/primitives/core/src/offchain/testing.rs b/primitives/core/src/offchain/testing.rs index 76cf8915f2..a14e906f54 100644 --- a/primitives/core/src/offchain/testing.rs +++ b/primitives/core/src/offchain/testing.rs @@ -26,7 +26,7 @@ use std::{ }; use crate::offchain::{ self, - storage::InMemOffchainStorage, + storage::{InMemOffchainStorage, OffchainOverlayedChange, OffchainOverlayedChanges}, HttpError, HttpRequestId as RequestId, HttpRequestStatus as RequestStatus, @@ -36,6 +36,7 @@ use crate::offchain::{ TransactionPool, OffchainStorage, }; + use parking_lot::RwLock; /// Pending request. @@ -61,6 +62,57 @@ pub struct PendingRequest { pub response_headers: Vec<(String, String)>, } +/// Sharable "persistent" offchain storage for test. +#[derive(Debug, Clone, Default)] +pub struct TestPersistentOffchainDB { + persistent: Arc>, +} + +impl TestPersistentOffchainDB { + /// Create a new and empty offchain storage db for persistent items + pub fn new() -> Self { + Self { + persistent: Arc::new(RwLock::new(InMemOffchainStorage::default())) + } + } + + /// Apply a set of off-chain changes directly to the test backend + pub fn apply_offchain_changes(&mut self, changes: &mut OffchainOverlayedChanges) { + let mut me = self.persistent.write(); + for ((_prefix, key), value_operation) in changes.drain() { + match value_operation { + OffchainOverlayedChange::SetValue(val) => me.set(b"", key.as_slice(), val.as_slice()), + OffchainOverlayedChange::Remove => me.remove(b"", key.as_slice()), + } + } + } +} + +impl OffchainStorage for TestPersistentOffchainDB { + fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]) { + self.persistent.write().set(prefix, key, value); + } + + fn remove(&mut self, prefix: &[u8], key: &[u8]) { + self.persistent.write().remove(prefix, key); + } + + fn get(&self, prefix: &[u8], key: &[u8]) -> Option> { + self.persistent.read().get(prefix, key) + } + + fn compare_and_set( + &mut self, + prefix: &[u8], + key: &[u8], + old_value: Option<&[u8]>, + new_value: &[u8], + ) -> bool { + self.persistent.write().compare_and_set(prefix, key, old_value, new_value) + } +} + + /// Internal state of the externalities. /// /// This can be used in tests to respond or assert stuff about interactions. @@ -70,7 +122,7 @@ pub struct OffchainState { pub requests: BTreeMap, expected_requests: BTreeMap, /// Persistent local storage - pub persistent_storage: InMemOffchainStorage, + pub persistent_storage: TestPersistentOffchainDB, /// Local storage pub local_storage: InMemOffchainStorage, /// A supposedly random seed. @@ -145,6 +197,13 @@ impl TestOffchainExt { let state = ext.0.clone(); (ext, state) } + + /// Create new `TestOffchainExt` and a reference to the internal state. + pub fn with_offchain_db(offchain_db: TestPersistentOffchainDB) -> (Self, Arc>) { + let (ext, state) = Self::new(); + ext.0.write().persistent_storage = offchain_db; + (ext, state) + } } impl offchain::Externalities for TestOffchainExt { @@ -174,17 +233,17 @@ impl offchain::Externalities for TestOffchainExt { fn local_storage_set(&mut self, kind: StorageKind, key: &[u8], value: &[u8]) { let mut state = self.0.write(); match kind { - StorageKind::LOCAL => &mut state.local_storage, - StorageKind::PERSISTENT => &mut state.persistent_storage, - }.set(b"", key, value); + StorageKind::LOCAL => state.local_storage.set(b"", key, value), + StorageKind::PERSISTENT => state.persistent_storage.set(b"", key, value), + }; } fn local_storage_clear(&mut self, kind: StorageKind, key: &[u8]) { let mut state = self.0.write(); match kind { - StorageKind::LOCAL => &mut state.local_storage, - StorageKind::PERSISTENT => &mut state.persistent_storage, - }.remove(b"", key); + StorageKind::LOCAL => state.local_storage.remove(b"", key), + StorageKind::PERSISTENT => state.persistent_storage.remove(b"", key), + }; } fn local_storage_compare_and_set( @@ -196,17 +255,17 @@ impl offchain::Externalities for TestOffchainExt { ) -> bool { let mut state = self.0.write(); match kind { - StorageKind::LOCAL => &mut state.local_storage, - StorageKind::PERSISTENT => &mut state.persistent_storage, - }.compare_and_set(b"", key, old_value, new_value) + StorageKind::LOCAL => state.local_storage.compare_and_set(b"", key, old_value, new_value), + StorageKind::PERSISTENT => state.persistent_storage.compare_and_set(b"", key, old_value, new_value), + } } fn local_storage_get(&mut self, kind: StorageKind, key: &[u8]) -> Option> { let state = self.0.read(); match kind { - StorageKind::LOCAL => &state.local_storage, - StorageKind::PERSISTENT => &state.persistent_storage, - }.get(b"", key) + StorageKind::LOCAL => state.local_storage.get(b"", key), + StorageKind::PERSISTENT => state.persistent_storage.get(b"", key), + } } fn http_request_start(&mut self, method: &str, uri: &str, meta: &[u8]) -> Result { diff --git a/primitives/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs index 71124a68bb..2ea2961830 100644 --- a/primitives/state-machine/src/testing.rs +++ b/primitives/state-machine/src/testing.rs @@ -31,7 +31,10 @@ use crate::{ }, }; use sp_core::{ - offchain::storage::OffchainOverlayedChanges, + offchain::{ + testing::TestPersistentOffchainDB, + storage::OffchainOverlayedChanges + }, storage::{ well_known_keys::{CHANGES_TRIE_CONFIG, CODE, HEAP_PAGES, is_child_storage_key}, Storage, @@ -47,6 +50,7 @@ where { overlay: OverlayedChanges, offchain_overlay: OffchainOverlayedChanges, + offchain_db: TestPersistentOffchainDB, storage_transaction_cache: StorageTransactionCache< as Backend>::Transaction, H, N >, @@ -108,9 +112,12 @@ impl TestExternalities extensions.register(sp_core::traits::TaskExecutorExt(sp_core::tasks::executor())); + let offchain_db = TestPersistentOffchainDB::new(); + TestExternalities { overlay, offchain_overlay, + offchain_db, changes_trie_config, extensions, changes_trie_storage: ChangesTrieInMemoryStorage::new(), @@ -119,6 +126,16 @@ impl TestExternalities } } + /// Move offchain changes from overlay to the persistent store. + pub fn persist_offchain_overlay(&mut self) { + self.offchain_db.apply_offchain_changes(&mut self.offchain_overlay); + } + + /// A shared reference type around the offchain worker storage. + pub fn offchain_db(&self) -> TestPersistentOffchainDB { + self.offchain_db.clone() + } + /// Insert key/value into backend pub fn insert(&mut self, k: StorageKey, v: StorageValue) { self.backend.insert(vec![(None, vec![(k, Some(v))])]); -- GitLab From 1f536e98c509566245056369b752e9a4871de85c Mon Sep 17 00:00:00 2001 From: s3krit Date: Tue, 16 Jun 2020 14:12:43 +0200 Subject: [PATCH 167/280] [CI] Auto-label new PRs according to draft status (#6361) * add auto-label github action * Add missing 'remove-labels' line --- .github/workflows/auto-label-prs.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/auto-label-prs.yml diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 0000000000..cfa4f302fe --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,20 @@ +name: Label new PRs +on: + pull_request: + types: [opened,ready_for_review] + +jobs: + label-new-prs: + runs-on: ubuntu-latest + steps: + - name: Label new drafts + uses: andymckay/labeler@master + if: github.event.pull_request.draft == true + with: + add-labels: 'A3-inprogress' + - name: Label new PRs + uses: andymckay/labeler@master + if: github.event.pull_request.draft == false + with: + add-labels: 'A0-pleasereview' + remove-labels: 'A3-inprogress' -- GitLab From 6199d86c7fd404d8ca30a6175587fbe90e06cd29 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 16 Jun 2020 15:50:21 +0200 Subject: [PATCH 168/280] Split the service initialisation up into seperate functions (#6332) * Seperate out the complexity in ServiceBuilder::build_common into seperate functions * Fix line widths * Move some functions to their respective crates --- Cargo.lock | 2 + client/consensus/aura/src/lib.rs | 2 +- client/consensus/babe/src/lib.rs | 2 +- client/consensus/manual-seal/src/lib.rs | 2 +- client/consensus/pow/src/lib.rs | 2 +- client/informant/Cargo.toml | 1 + client/informant/src/lib.rs | 15 +- client/offchain/src/lib.rs | 40 +- client/service/src/builder.rs | 652 ++++++++++-------- client/service/src/lib.rs | 3 +- client/service/src/metrics.rs | 12 +- client/service/src/task_manager.rs | 6 +- client/transaction-pool/src/lib.rs | 20 + .../common/src/import_queue/basic_queue.rs | 2 +- primitives/core/src/testing.rs | 5 +- primitives/core/src/traits.rs | 8 +- primitives/utils/Cargo.toml | 1 + primitives/utils/src/lib.rs | 3 +- .../utils}/src/status_sinks.rs | 4 +- 19 files changed, 452 insertions(+), 330 deletions(-) rename {client/service => primitives/utils}/src/status_sinks.rs (98%) diff --git a/Cargo.lock b/Cargo.lock index 18290e7748..7cd16427c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6368,6 +6368,7 @@ dependencies = [ "futures 0.3.4", "log", "parity-util-mem", + "parking_lot 0.10.2", "sc-client-api", "sc-network", "sp-blockchain", @@ -7880,6 +7881,7 @@ version = "2.0.0-rc3" dependencies = [ "futures 0.3.4", "futures-core", + "futures-timer 3.0.2", "lazy_static", "prometheus", ] diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index 818bb56348..8b30720d0b 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -833,7 +833,7 @@ pub fn import_queue( P: Pair + Send + Sync + 'static, P::Public: Clone + Eq + Send + Sync + Hash + Debug + Encode + Decode, P::Signature: Encode + Decode, - S: sp_core::traits::SpawnBlocking, + S: sp_core::traits::SpawnNamed, { register_aura_inherent_data_provider(&inherent_data_providers, slot_duration.get())?; initialize_authorities_cache(&*client)?; diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index 3d14f0a7bf..961b0382c5 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -1291,7 +1291,7 @@ pub fn import_queue( finality_proof_import: Option>, client: Arc, inherent_data_providers: InherentDataProviders, - spawner: &impl sp_core::traits::SpawnBlocking, + spawner: &impl sp_core::traits::SpawnNamed, registry: Option<&Registry>, ) -> ClientResult>> where Inner: BlockImport> diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index 233a774a54..53cc57ba6e 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -70,7 +70,7 @@ impl Verifier for ManualSealVerifier { /// Instantiate the import queue for the manual seal consensus engine. pub fn import_queue( block_import: BoxBlockImport, - spawner: &impl sp_core::traits::SpawnBlocking, + spawner: &impl sp_core::traits::SpawnNamed, registry: Option<&Registry>, ) -> BasicQueue where diff --git a/client/consensus/pow/src/lib.rs b/client/consensus/pow/src/lib.rs index 24a8b63281..8c15528795 100644 --- a/client/consensus/pow/src/lib.rs +++ b/client/consensus/pow/src/lib.rs @@ -466,7 +466,7 @@ pub fn import_queue( finality_proof_import: Option>, algorithm: Algorithm, inherent_data_providers: InherentDataProviders, - spawner: &impl sp_core::traits::SpawnBlocking, + spawner: &impl sp_core::traits::SpawnNamed, registry: Option<&Registry>, ) -> Result< PowImportQueue, diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index 7cd678b26c..671535933b 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -23,3 +23,4 @@ sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } +parking_lot = "0.10.2" diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 1fe1304ff5..720f5d6a1b 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -27,10 +27,11 @@ use sc_network::{network_state::NetworkState, NetworkStatus}; use sp_blockchain::HeaderMetadata; use sp_runtime::traits::{Block as BlockT, Header}; use sp_transaction_pool::TransactionPool; -use sp_utils::mpsc::TracingUnboundedReceiver; +use sp_utils::{status_sinks, mpsc::tracing_unbounded}; use std::fmt::Display; use std::sync::Arc; use std::time::Duration; +use parking_lot::Mutex; mod display; @@ -60,12 +61,7 @@ impl TransactionPoolAndMaybeMallogSizeOf for /// Builds the informant and returns a `Future` that drives the informant. pub fn build( client: Arc, - network_status_stream_builder: impl FnOnce( - Duration, - ) -> TracingUnboundedReceiver<( - NetworkStatus, - NetworkState, - )>, + network_status_sinks: Arc, NetworkState)>>>, pool: Arc, format: OutputFormat, ) -> impl futures::Future @@ -76,7 +72,10 @@ where let mut display = display::InformantDisplay::new(format.clone()); let client_1 = client.clone(); - let display_notifications = network_status_stream_builder(Duration::from_millis(5000)) + let (network_status_sink, network_status_stream) = tracing_unbounded("mpsc_network_status"); + network_status_sinks.lock().push(Duration::from_millis(5000), network_status_sink); + + let display_notifications = network_status_stream .for_each(move |(net_status, _)| { let info = client_1.usage_info(); if let Some(ref usage) = info.usage { diff --git a/client/offchain/src/lib.rs b/client/offchain/src/lib.rs index d6e62501b6..a1ea16a72e 100644 --- a/client/offchain/src/lib.rs +++ b/client/offchain/src/lib.rs @@ -41,8 +41,9 @@ use sp_api::{ApiExt, ProvideRuntimeApi}; use futures::future::Future; use log::{debug, warn}; use sc_network::NetworkStateInfo; -use sp_core::{offchain::{self, OffchainStorage}, ExecutionContext}; +use sp_core::{offchain::{self, OffchainStorage}, ExecutionContext, traits::SpawnNamed}; use sp_runtime::{generic::BlockId, traits::{self, Header}}; +use futures::{prelude::*, future::ready}; mod api; @@ -161,6 +162,43 @@ impl OffchainWorkers< } } +/// Inform the offchain worker about new imported blocks +pub async fn notification_future( + is_validator: bool, + client: Arc, + offchain: Arc>, + spawner: Spawner, + network_state_info: Arc, +) + where + Block: traits::Block, + Client: ProvideRuntimeApi + sc_client_api::BlockchainEvents + Send + Sync + 'static, + Client::Api: OffchainWorkerApi, + Storage: OffchainStorage + 'static, + Spawner: SpawnNamed +{ + client.import_notification_stream().for_each(move |n| { + if n.is_new_best { + spawner.spawn( + "offchain-on-block", + offchain.on_block_imported( + &n.header, + network_state_info.clone(), + is_validator, + ).boxed(), + ); + } else { + log::debug!( + target: "sc_offchain", + "Skipping offchain workers for non-canon block: {:?}", + n.header, + ) + } + + ready(()) + }).await; +} + #[cfg(test)] mod tests { use super::*; diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 813fe50cce..23d736d98b 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -24,11 +24,11 @@ use crate::{ config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig}, }; use sc_client_api::{ - self, BlockchainEvents, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, + self, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider, backend::RemoteBackend, }; -use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; +use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender, TracingUnboundedReceiver}; use sc_chain_spec::get_extension; use sp_consensus::{ block_validation::{BlockAnnounceValidator, DefaultBlockAnnounceValidator}, @@ -42,7 +42,7 @@ use jsonrpc_pubsub::manager::SubscriptionManager; use sc_keystore::Store as Keystore; use log::{info, warn, error}; use sc_network::config::{Role, FinalityProofProvider, OnDemand, BoxFinalityProofRequestBuilder}; -use sc_network::{NetworkService, NetworkStateInfo}; +use sc_network::NetworkService; use parking_lot::{Mutex, RwLock}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{ @@ -1002,11 +1002,8 @@ ServiceBuilder< // A side-channel for essential tasks to communicate shutdown. let (essential_failed_tx, essential_failed_rx) = tracing_unbounded("mpsc_essential_tasks"); - let import_queue = Box::new(import_queue); let chain_info = client.chain_info(); - let chain_spec = &config.chain_spec; - let version = config.impl_version; info!("📦 Highest known block at #{}", chain_info.best_number); telemetry!( SUBSTRATE_INFO; @@ -1015,55 +1012,26 @@ ServiceBuilder< "best" => ?chain_info.best_hash ); - let transaction_pool_adapter = Arc::new(TransactionPoolAdapter { - imports_external_transactions: !matches!(config.role, Role::Light), - pool: transaction_pool.clone(), - client: client.clone(), - }); - - let protocol_id = { - let protocol_id_full = match chain_spec.protocol_id() { - Some(pid) => pid, - None => { - warn!("Using default protocol ID {:?} because none is configured in the \ - chain specs", DEFAULT_PROTOCOL_ID - ); - DEFAULT_PROTOCOL_ID - } - }.as_bytes(); - sc_network::config::ProtocolId::from(protocol_id_full) - }; - - let block_announce_validator = if let Some(f) = block_announce_validator_builder { - f(client.clone()) - } else { - Box::new(DefaultBlockAnnounceValidator::new(client.clone())) - }; + let spawn_handle = task_manager.spawn_handle(); + let (system_rpc_tx, system_rpc_rx) = tracing_unbounded("mpsc_system_rpc"); - let network_params = sc_network::config::Params { - role: config.role.clone(), - executor: { - let spawn_handle = task_manager.spawn_handle(); - Some(Box::new(move |fut| { - spawn_handle.spawn("libp2p-node", fut); - })) - }, - network_config: config.network.clone(), - chain: client.clone(), - finality_proof_provider, - finality_proof_request_builder, - on_demand: on_demand.clone(), - transaction_pool: transaction_pool_adapter.clone() as _, - import_queue, - protocol_id, - block_announce_validator, - metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()) - }; + let (network, network_status_sinks, network_future) = build_network( + &config, client.clone(), transaction_pool.clone(), Clone::clone(&spawn_handle), on_demand.clone(), + block_announce_validator_builder, finality_proof_request_builder, finality_proof_provider, + system_rpc_rx, import_queue + )?; - let has_bootnodes = !network_params.network_config.boot_nodes.is_empty(); - let network_mut = sc_network::NetworkWorker::new(network_params)?; - let network = network_mut.service().clone(); - let network_status_sinks = Arc::new(Mutex::new(status_sinks::StatusSinks::new())); + // The network worker is responsible for gathering all network messages and processing + // them. This is quite a heavy task, and at the time of the writing of this comment it + // frequently happens that this future takes several seconds or in some situations + // even more than a minute until it has processed its entire queue. This is clearly an + // issue, and ideally we would like to fix the network future to take as little time as + // possible, but we also take the extra harm-prevention measure to execute the networking + // future using `spawn_blocking`. + spawn_handle.spawn_blocking( + "network-worker", + network_future + ); let offchain_storage = backend.offchain_storage(); let offchain_workers = match (config.offchain_worker.clone(), offchain_storage.clone()) { @@ -1077,114 +1045,39 @@ ServiceBuilder< _ => None, }; - let spawn_handle = task_manager.spawn_handle(); - // Inform the tx pool about imported and finalized blocks. - { - let txpool = Arc::downgrade(&transaction_pool); - - let mut import_stream = client.import_notification_stream().map(Into::into).fuse(); - let mut finality_stream = client.finality_notification_stream() - .map(Into::into) - .fuse(); - - let events = async move { - loop { - let evt = futures::select! { - evt = import_stream.next() => evt, - evt = finality_stream.next() => evt, - complete => return, - }; - - let txpool = txpool.upgrade(); - if let Some((txpool, evt)) = txpool.and_then(|tp| evt.map(|evt| (tp, evt))) { - txpool.maintain(evt).await; - } - } - }; - - spawn_handle.spawn( - "txpool-notifications", - events, - ); - } + spawn_handle.spawn( + "txpool-notifications", + sc_transaction_pool::notification_future(client.clone(), transaction_pool.clone()), + ); // Inform the offchain worker about new imported blocks - { - let offchain = offchain_workers.as_ref().map(Arc::downgrade); - let notifications_spawn_handle = task_manager.spawn_handle(); - let network_state_info: Arc = network.clone(); - let is_validator = config.role.is_authority(); - - let events = client.import_notification_stream().for_each(move |n| { - let offchain = offchain.as_ref().and_then(|o| o.upgrade()); - match offchain { - Some(offchain) if n.is_new_best => { - notifications_spawn_handle.spawn( - "offchain-on-block", - offchain.on_block_imported( - &n.header, - network_state_info.clone(), - is_validator, - ), - ); - }, - Some(_) => log::debug!( - target: "sc_offchain", - "Skipping offchain workers for non-canon block: {:?}", - n.header, - ), - _ => {}, - } - - ready(()) - }); - + if let Some(offchain) = offchain_workers.clone() { spawn_handle.spawn( "offchain-notifications", - events, + sc_offchain::notification_future( + config.role.is_authority(), + client.clone(), + offchain, + task_manager.spawn_handle(), + network.clone() + ) ); } - { - // extrinsic notifications - let network = Arc::downgrade(&network); - let transaction_pool_ = transaction_pool.clone(); - let events = transaction_pool.import_notification_stream() - .for_each(move |hash| { - if let Some(network) = network.upgrade() { - network.propagate_extrinsic(hash); - } - let status = transaction_pool_.status(); - telemetry!(SUBSTRATE_INFO; "txpool.import"; - "ready" => status.ready, - "future" => status.future - ); - ready(()) - }); - - spawn_handle.spawn( - "on-transaction-imported", - events, - ); - } + spawn_handle.spawn( + "on-transaction-imported", + extrinsic_notifications(transaction_pool.clone(), network.clone()), + ); // Prometheus metrics. - let mut metrics_service = if let Some(PrometheusConfig { port, registry }) = config.prometheus_config.clone() { + let metrics_service = if let Some(PrometheusConfig { port, registry }) = config.prometheus_config.clone() { // Set static metrics. - - - let role_bits = match config.role { - Role::Full => 1u64, - Role::Light => 2u64, - Role::Sentry { .. } => 3u64, - Role::Authority { .. } => 4u64, - }; let metrics = MetricsService::with_prometheus( ®istry, &config.network.node_name, &config.impl_version, - role_bits, + &config.role, )?; spawn_handle.spawn( "prometheus-endpoint", @@ -1197,171 +1090,33 @@ ServiceBuilder< }; // Periodically notify the telemetry. - let transaction_pool_ = transaction_pool.clone(); - let client_ = client.clone(); - let (state_tx, state_rx) = tracing_unbounded::<(NetworkStatus<_>, NetworkState)>("mpsc_netstat1"); - network_status_sinks.lock().push(std::time::Duration::from_millis(5000), state_tx); - let tel_task = state_rx.for_each(move |(net_status, _)| { - let info = client_.usage_info(); - metrics_service.tick( - &info, - &transaction_pool_.status(), - &net_status, - ); - ready(()) - }); - - spawn_handle.spawn( - "telemetry-periodic-send", - tel_task, - ); + spawn_handle.spawn("telemetry-periodic-send", telemetry_periodic_send( + client.clone(), transaction_pool.clone(), metrics_service, network_status_sinks.clone() + )); // Periodically send the network state to the telemetry. - let (netstat_tx, netstat_rx) = tracing_unbounded::<(NetworkStatus<_>, NetworkState)>("mpsc_netstat2"); - network_status_sinks.lock().push(std::time::Duration::from_secs(30), netstat_tx); - let tel_task_2 = netstat_rx.for_each(move |(_, network_state)| { - telemetry!( - SUBSTRATE_INFO; - "system.network_state"; - "state" => network_state, - ); - ready(()) - }); spawn_handle.spawn( "telemetry-periodic-network-state", - tel_task_2, + telemetry_periodic_network_state(network_status_sinks.clone()), ); // RPC - let (system_rpc_tx, system_rpc_rx) = tracing_unbounded("mpsc_system_rpc"); - let gen_handler = |deny_unsafe: sc_rpc::DenyUnsafe| { - use sc_rpc::{chain, state, author, system, offchain}; - - let system_info = sc_rpc::system::SystemInfo { - chain_name: chain_spec.name().into(), - impl_name: config.impl_name.into(), - impl_version: config.impl_version.into(), - properties: chain_spec.properties().clone(), - chain_type: chain_spec.chain_type().clone(), - }; - - let subscriptions = SubscriptionManager::new(Arc::new(task_manager.spawn_handle())); - - let (chain, state, child_state) = if let (Some(remote_backend), Some(on_demand)) = - (remote_backend.as_ref(), on_demand.as_ref()) { - // Light clients - let chain = sc_rpc::chain::new_light( - client.clone(), - subscriptions.clone(), - remote_backend.clone(), - on_demand.clone() - ); - let (state, child_state) = sc_rpc::state::new_light( - client.clone(), - subscriptions.clone(), - remote_backend.clone(), - on_demand.clone() - ); - (chain, state, child_state) - - } else { - // Full nodes - let chain = sc_rpc::chain::new_full(client.clone(), subscriptions.clone()); - let (state, child_state) = sc_rpc::state::new_full(client.clone(), subscriptions.clone()); - (chain, state, child_state) - }; - - let author = sc_rpc::author::Author::new( - client.clone(), - transaction_pool.clone(), - subscriptions, - keystore.clone(), - deny_unsafe, - ); - let system = system::System::new(system_info, system_rpc_tx.clone(), deny_unsafe); - - let maybe_offchain_rpc = offchain_storage.clone() - .map(|storage| { - let offchain = sc_rpc::offchain::Offchain::new(storage, deny_unsafe); - // FIXME: Use plain Option (don't collect into HashMap) when we upgrade to jsonrpc 14.1 - // https://github.com/paritytech/jsonrpc/commit/20485387ed06a48f1a70bf4d609a7cde6cf0accf - let delegate = offchain::OffchainApi::to_delegate(offchain); - delegate.into_iter().collect::>() - }).unwrap_or_default(); - - sc_rpc_server::rpc_handler(( - state::StateApi::to_delegate(state), - state::ChildStateApi::to_delegate(child_state), - chain::ChainApi::to_delegate(chain), - maybe_offchain_rpc, - author::AuthorApi::to_delegate(author), - system::SystemApi::to_delegate(system), - rpc_extensions_builder.build(deny_unsafe), - )) - }; + let gen_handler = |deny_unsafe: sc_rpc::DenyUnsafe| gen_handler( + deny_unsafe, &config, &task_manager, client.clone(), transaction_pool.clone(), + keystore.clone(), on_demand.clone(), remote_backend.clone(), &*rpc_extensions_builder, + offchain_storage.clone(), system_rpc_tx.clone() + ); let rpc = start_rpc_servers(&config, gen_handler)?; // This is used internally, so don't restrict access to unsafe RPC let rpc_handlers = gen_handler(sc_rpc::DenyUnsafe::No); - // The network worker is responsible for gathering all network messages and processing - // them. This is quite a heavy task, and at the time of the writing of this comment it - // frequently happens that this future takes several seconds or in some situations - // even more than a minute until it has processed its entire queue. This is clearly an - // issue, and ideally we would like to fix the network future to take as little time as - // possible, but we also take the extra harm-prevention measure to execute the networking - // future using `spawn_blocking`. - spawn_handle.spawn_blocking( - "network-worker", - build_network_future( - config.role.clone(), - network_mut, - client.clone(), - network_status_sinks.clone(), - system_rpc_rx, - has_bootnodes, - config.announce_block, - ), - ); - let telemetry_connection_sinks: Arc>>> = Default::default(); // Telemetry let telemetry = config.telemetry_endpoints.clone().map(|endpoints| { - let is_authority = config.role.is_authority(); - let network_id = network.local_peer_id().to_base58(); - let name = config.network.node_name.clone(); - let impl_name = config.impl_name.to_owned(); - let version = version.clone(); - let chain_name = config.chain_spec.name().to_owned(); - let telemetry_connection_sinks_ = telemetry_connection_sinks.clone(); - let telemetry = sc_telemetry::init_telemetry(sc_telemetry::TelemetryConfig { - endpoints, - wasm_external_transport: config.telemetry_external_transport.take(), - }); - let startup_time = SystemTime::UNIX_EPOCH.elapsed() - .map(|dur| dur.as_millis()) - .unwrap_or(0); - let future = telemetry.clone() - .for_each(move |event| { - // Safe-guard in case we add more events in the future. - let sc_telemetry::TelemetryEvent::Connected = event; - - telemetry!(SUBSTRATE_INFO; "system.connected"; - "name" => name.clone(), - "implementation" => impl_name.clone(), - "version" => version.clone(), - "config" => "", - "chain" => chain_name.clone(), - "authority" => is_authority, - "startup_time" => startup_time, - "network_id" => network_id.clone() - ); - - telemetry_connection_sinks_.lock().retain(|sink| { - sink.unbounded_send(()).is_ok() - }); - ready(()) - }); + let (telemetry, future) = build_telemetry( + &mut config, endpoints, telemetry_connection_sinks.clone(), network.clone() + ); spawn_handle.spawn( "telemetry-worker", @@ -1383,18 +1138,12 @@ ServiceBuilder< } // Spawn informant task - let network_status_sinks_1 = network_status_sinks.clone(); - let informant_future = sc_informant::build( + spawn_handle.spawn("informant", sc_informant::build( client.clone(), - move |interval| { - let (sink, stream) = tracing_unbounded("mpsc_network_status"); - network_status_sinks_1.lock().push(interval, sink); - stream - }, + network_status_sinks.clone(), transaction_pool.clone(), sc_informant::OutputFormat { enable_color: true, prefix: informant_prefix }, - ); - spawn_handle.spawn("informant", informant_future); + )); Ok(Service { client, @@ -1495,3 +1244,296 @@ ServiceBuilder< self.build_common() } } + +async fn extrinsic_notifications( + transaction_pool: Arc, + network: Arc::Hash>> +) + where + TBl: BlockT, + TExPool: MaintainedTransactionPool::Hash>, +{ + // extrinsic notifications + transaction_pool.import_notification_stream() + .for_each(move |hash| { + network.propagate_extrinsic(hash); + let status = transaction_pool.status(); + telemetry!(SUBSTRATE_INFO; "txpool.import"; + "ready" => status.ready, + "future" => status.future + ); + ready(()) + }) + .await; +} + +// Periodically notify the telemetry. +async fn telemetry_periodic_send( + client: Arc>, + transaction_pool: Arc, + mut metrics_service: MetricsService, + network_status_sinks: Arc, NetworkState)>>> +) + where + TBl: BlockT, + TExec: CallExecutor, + Client: ProvideRuntimeApi, + TExPool: MaintainedTransactionPool::Hash>, + TBackend: sc_client_api::backend::Backend, +{ + let (state_tx, state_rx) = tracing_unbounded::<(NetworkStatus<_>, NetworkState)>("mpsc_netstat1"); + network_status_sinks.lock().push(std::time::Duration::from_millis(5000), state_tx); + state_rx.for_each(move |(net_status, _)| { + let info = client.usage_info(); + metrics_service.tick( + &info, + &transaction_pool.status(), + &net_status, + ); + ready(()) + }).await; +} + +async fn telemetry_periodic_network_state( + network_status_sinks: Arc, NetworkState)>>> +) { + // Periodically send the network state to the telemetry. + let (netstat_tx, netstat_rx) = tracing_unbounded::<(NetworkStatus<_>, NetworkState)>("mpsc_netstat2"); + network_status_sinks.lock().push(std::time::Duration::from_secs(30), netstat_tx); + netstat_rx.for_each(move |(_, network_state)| { + telemetry!( + SUBSTRATE_INFO; + "system.network_state"; + "state" => network_state, + ); + ready(()) + }).await; +} + +fn build_telemetry( + config: &mut Configuration, + endpoints: sc_telemetry::TelemetryEndpoints, + telemetry_connection_sinks: Arc>>>, + network: Arc::Hash>> +) -> (sc_telemetry::Telemetry, Pin + Send>>) { + let is_authority = config.role.is_authority(); + let network_id = network.local_peer_id().to_base58(); + let name = config.network.node_name.clone(); + let impl_name = config.impl_name.to_owned(); + let version = config.impl_version; + let chain_name = config.chain_spec.name().to_owned(); + let telemetry = sc_telemetry::init_telemetry(sc_telemetry::TelemetryConfig { + endpoints, + wasm_external_transport: config.telemetry_external_transport.take(), + }); + let startup_time = SystemTime::UNIX_EPOCH.elapsed() + .map(|dur| dur.as_millis()) + .unwrap_or(0); + let future = telemetry.clone() + .for_each(move |event| { + // Safe-guard in case we add more events in the future. + let sc_telemetry::TelemetryEvent::Connected = event; + + telemetry!(SUBSTRATE_INFO; "system.connected"; + "name" => name.clone(), + "implementation" => impl_name.clone(), + "version" => version, + "config" => "", + "chain" => chain_name.clone(), + "authority" => is_authority, + "startup_time" => startup_time, + "network_id" => network_id.clone() + ); + + telemetry_connection_sinks.lock().retain(|sink| { + sink.unbounded_send(()).is_ok() + }); + ready(()) + }) + .boxed(); + + (telemetry, future) +} + +fn gen_handler( + deny_unsafe: sc_rpc::DenyUnsafe, + config: &Configuration, + task_manager: &TaskManager, + client: Arc>, + transaction_pool: Arc, + keystore: Arc>, + on_demand: Option>>, + remote_backend: Option>>, + rpc_extensions_builder: &(dyn RpcExtensionBuilder + Send), + offchain_storage: Option<>::OffchainStorage>, + system_rpc_tx: TracingUnboundedSender> +) -> jsonrpc_pubsub::PubSubHandler + where + TBl: BlockT, + TExec: CallExecutor + Send + Sync + 'static, + TRtApi: Send + Sync + 'static, + Client: ProvideRuntimeApi, + TExPool: MaintainedTransactionPool::Hash> + 'static, + TBackend: sc_client_api::backend::Backend + 'static, + TRpc: sc_rpc::RpcExtension, + as ProvideRuntimeApi>::Api: + sp_session::SessionKeys + + sp_api::Metadata, +{ + use sc_rpc::{chain, state, author, system, offchain}; + + let system_info = sc_rpc::system::SystemInfo { + chain_name: config.chain_spec.name().into(), + impl_name: config.impl_name.into(), + impl_version: config.impl_version.into(), + properties: config.chain_spec.properties(), + chain_type: config.chain_spec.chain_type(), + }; + + let subscriptions = SubscriptionManager::new(Arc::new(task_manager.spawn_handle())); + + let (chain, state, child_state) = if let (Some(remote_backend), Some(on_demand)) = + (remote_backend, on_demand) { + // Light clients + let chain = sc_rpc::chain::new_light( + client.clone(), + subscriptions.clone(), + remote_backend.clone(), + on_demand.clone() + ); + let (state, child_state) = sc_rpc::state::new_light( + client.clone(), + subscriptions.clone(), + remote_backend.clone(), + on_demand.clone() + ); + (chain, state, child_state) + + } else { + // Full nodes + let chain = sc_rpc::chain::new_full(client.clone(), subscriptions.clone()); + let (state, child_state) = sc_rpc::state::new_full(client.clone(), subscriptions.clone()); + (chain, state, child_state) + }; + + let author = sc_rpc::author::Author::new( + client.clone(), + transaction_pool.clone(), + subscriptions, + keystore.clone(), + deny_unsafe, + ); + let system = system::System::new(system_info, system_rpc_tx.clone(), deny_unsafe); + + let maybe_offchain_rpc = offchain_storage.clone() + .map(|storage| { + let offchain = sc_rpc::offchain::Offchain::new(storage, deny_unsafe); + // FIXME: Use plain Option (don't collect into HashMap) when we upgrade to jsonrpc 14.1 + // https://github.com/paritytech/jsonrpc/commit/20485387ed06a48f1a70bf4d609a7cde6cf0accf + let delegate = offchain::OffchainApi::to_delegate(offchain); + delegate.into_iter().collect::>() + }).unwrap_or_default(); + + sc_rpc_server::rpc_handler(( + state::StateApi::to_delegate(state), + state::ChildStateApi::to_delegate(child_state), + chain::ChainApi::to_delegate(chain), + maybe_offchain_rpc, + author::AuthorApi::to_delegate(author), + system::SystemApi::to_delegate(system), + rpc_extensions_builder.build(deny_unsafe), + )) +} + +fn build_network( + config: &Configuration, + client: Arc>, + transaction_pool: Arc, + spawn_handle: SpawnTaskHandle, + on_demand: Option>>, + block_announce_validator_builder: Option>) -> + Box + Send> + Send + >>, + finality_proof_request_builder: Option>, + finality_proof_provider: Option>>, + system_rpc_rx: TracingUnboundedReceiver>, + import_queue: TImpQu +) -> Result< + ( + Arc::Hash>>, + Arc, NetworkState)>>>, + Pin + Send>> + ), + Error +> + where + TBl: BlockT, + TExec: CallExecutor + Send + Sync + 'static, + TRtApi: Send + Sync + 'static, + Client: ProvideRuntimeApi, + TExPool: MaintainedTransactionPool::Hash> + 'static, + TBackend: sc_client_api::backend::Backend + 'static, + TImpQu: ImportQueue + 'static, +{ + let transaction_pool_adapter = Arc::new(TransactionPoolAdapter { + imports_external_transactions: !matches!(config.role, Role::Light), + pool: transaction_pool.clone(), + client: client.clone(), + }); + + let protocol_id = { + let protocol_id_full = match config.chain_spec.protocol_id() { + Some(pid) => pid, + None => { + warn!("Using default protocol ID {:?} because none is configured in the \ + chain specs", DEFAULT_PROTOCOL_ID + ); + DEFAULT_PROTOCOL_ID + } + }.as_bytes(); + sc_network::config::ProtocolId::from(protocol_id_full) + }; + + let block_announce_validator = if let Some(f) = block_announce_validator_builder { + f(client.clone()) + } else { + Box::new(DefaultBlockAnnounceValidator::new(client.clone())) + }; + + let network_params = sc_network::config::Params { + role: config.role.clone(), + executor: { + Some(Box::new(move |fut| { + spawn_handle.spawn("libp2p-node", fut); + })) + }, + network_config: config.network.clone(), + chain: client.clone(), + finality_proof_provider, + finality_proof_request_builder, + on_demand: on_demand.clone(), + transaction_pool: transaction_pool_adapter.clone() as _, + import_queue: Box::new(import_queue), + protocol_id, + block_announce_validator, + metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()) + }; + + let has_bootnodes = !network_params.network_config.boot_nodes.is_empty(); + let network_mut = sc_network::NetworkWorker::new(network_params)?; + let network = network_mut.service().clone(); + let network_status_sinks = Arc::new(Mutex::new(status_sinks::StatusSinks::new())); + + let future = build_network_future( + config.role.clone(), + network_mut, + client.clone(), + network_status_sinks.clone(), + system_rpc_rx, + has_bootnodes, + config.announce_block, + ).boxed(); + + Ok((network, network_status_sinks, future)) +} diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 6e230b253d..37bac171c9 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -33,7 +33,6 @@ mod builder; pub mod client; #[cfg(not(feature = "test-helpers"))] mod client; -mod status_sinks; mod task_manager; use std::{io, pin::Pin}; @@ -58,7 +57,7 @@ use codec::{Encode, Decode}; use sp_runtime::generic::BlockId; use sp_runtime::traits::Block as BlockT; use parity_util_mem::MallocSizeOf; -use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; +use sp_utils::{status_sinks, mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}}; pub use self::error::Error; pub use self::builder::{ diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index 4a47d41216..232e9abdc1 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -25,6 +25,7 @@ use sp_runtime::traits::{NumberFor, Block, SaturatedConversion, UniqueSaturatedI use sp_transaction_pool::PoolStatus; use sp_utils::metrics::register_globals; use sc_client_api::ClientInfo; +use sc_network::config::Role; use sysinfo::{self, ProcessExt, SystemExt}; @@ -260,10 +261,17 @@ impl MetricsService { impl MetricsService { - pub fn with_prometheus(registry: &Registry, name: &str, version: &str, roles: u64) + pub fn with_prometheus(registry: &Registry, name: &str, version: &str, role: &Role) -> Result { - PrometheusMetrics::setup(registry, name, version, roles).map(|p| { + let role_bits = match role { + Role::Full => 1u64, + Role::Light => 2u64, + Role::Sentry { .. } => 3u64, + Role::Authority { .. } => 4u64, + }; + + PrometheusMetrics::setup(registry, name, version, role_bits).map(|p| { Self::inner_new(Some(p)) }) } diff --git a/client/service/src/task_manager.rs b/client/service/src/task_manager.rs index 553ca9c326..9cd92538e3 100644 --- a/client/service/src/task_manager.rs +++ b/client/service/src/task_manager.rs @@ -124,10 +124,14 @@ impl Spawn for SpawnTaskHandle { } } -impl sp_core::traits::SpawnBlocking for SpawnTaskHandle { +impl sp_core::traits::SpawnNamed for SpawnTaskHandle { fn spawn_blocking(&self, name: &'static str, future: BoxFuture<'static, ()>) { self.spawn_blocking(name, future); } + + fn spawn(&self, name: &'static str, future: BoxFuture<'static, ()>) { + self.spawn(name, future); + } } impl sc_client_api::CloneableSpawn for SpawnTaskHandle { diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 08c7508b50..ea8b4bf9de 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -683,3 +683,23 @@ impl MaintainedTransactionPool for BasicPool } } } + +/// Inform the transaction pool about imported and finalized blocks. +pub async fn notification_future( + client: Arc, + txpool: Arc +) + where + Block: BlockT, + Client: sc_client_api::BlockchainEvents, + Pool: MaintainedTransactionPool, +{ + let import_stream = client.import_notification_stream().map(Into::into).fuse(); + let finality_stream = client.finality_notification_stream() + .map(Into::into) + .fuse(); + + futures::stream::select(import_stream, finality_stream) + .for_each(|evt| txpool.maintain(evt)) + .await +} diff --git a/primitives/consensus/common/src/import_queue/basic_queue.rs b/primitives/consensus/common/src/import_queue/basic_queue.rs index 33c3da910d..8eb194841f 100644 --- a/primitives/consensus/common/src/import_queue/basic_queue.rs +++ b/primitives/consensus/common/src/import_queue/basic_queue.rs @@ -61,7 +61,7 @@ impl BasicQueue { block_import: BoxBlockImport, justification_import: Option>, finality_proof_import: Option>, - spawner: &impl sp_core::traits::SpawnBlocking, + spawner: &impl sp_core::traits::SpawnNamed, prometheus_registry: Option<&Registry>, ) -> Self { let (result_sender, result_port) = buffered_link::buffered_link(); diff --git a/primitives/core/src/testing.rs b/primitives/core/src/testing.rs index e14eb6a7f3..d31fabce5b 100644 --- a/primitives/core/src/testing.rs +++ b/primitives/core/src/testing.rs @@ -358,10 +358,13 @@ impl SpawnBlockingExecutor { } #[cfg(feature = "std")] -impl crate::traits::SpawnBlocking for SpawnBlockingExecutor { +impl crate::traits::SpawnNamed for SpawnBlockingExecutor { fn spawn_blocking(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) { self.0.spawn_ok(future); } + fn spawn(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) { + self.0.spawn_ok(future); + } } #[cfg(test)] diff --git a/primitives/core/src/traits.rs b/primitives/core/src/traits.rs index 880b34a1ed..0d5bc14fb4 100644 --- a/primitives/core/src/traits.rs +++ b/primitives/core/src/traits.rs @@ -349,10 +349,14 @@ impl TaskExecutorExt { } } -/// Something that can spawn a blocking future. -pub trait SpawnBlocking { +/// Something that can spawn futures (blocking and non-blocking) with am assigned name. +pub trait SpawnNamed { /// Spawn the given blocking future. /// /// The given `name` is used to identify the future in tracing. fn spawn_blocking(&self, name: &'static str, future: futures::future::BoxFuture<'static, ()>); + /// Spawn the given non-blocking future. + /// + /// The given `name` is used to identify the future in tracing. + fn spawn(&self, name: &'static str, future: futures::future::BoxFuture<'static, ()>); } diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index c5b74f98a9..9ae7beb1ff 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -13,6 +13,7 @@ futures = "0.3.4" futures-core = "0.3.4" lazy_static = "1.4.0" prometheus = "0.8.0" +futures-timer = "3.0.2" [features] default = ["metered"] diff --git a/primitives/utils/src/lib.rs b/primitives/utils/src/lib.rs index 644e94651d..77bcd09656 100644 --- a/primitives/utils/src/lib.rs +++ b/primitives/utils/src/lib.rs @@ -18,4 +18,5 @@ //! Utilities Primitives for Substrate pub mod metrics; -pub mod mpsc; \ No newline at end of file +pub mod mpsc; +pub mod status_sinks; diff --git a/client/service/src/status_sinks.rs b/primitives/utils/src/status_sinks.rs similarity index 98% rename from client/service/src/status_sinks.rs rename to primitives/utils/src/status_sinks.rs index c3de468ab0..47bccebb96 100644 --- a/client/service/src/status_sinks.rs +++ b/primitives/utils/src/status_sinks.rs @@ -19,7 +19,7 @@ use std::time::Duration; use std::pin::Pin; use std::task::{Poll, Context}; use futures_timer::Delay; -use sp_utils::mpsc::TracingUnboundedSender; +use crate::mpsc::TracingUnboundedSender; /// Holds a list of `UnboundedSender`s, each associated with a certain time period. Every time the /// period elapses, we push an element on the sender. @@ -109,7 +109,7 @@ impl futures::Future for YieldAfter { mod tests { use super::StatusSinks; use futures::prelude::*; - use sp_utils::mpsc::tracing_unbounded; + use crate::mpsc::tracing_unbounded; use std::time::Duration; use std::task::Poll; -- GitLab From 54d1c5c87f5fd14cb386c6c408d907f121e77806 Mon Sep 17 00:00:00 2001 From: s3krit Date: Tue, 16 Jun 2020 15:50:50 +0200 Subject: [PATCH 169/280] [CI] Add label enforcement (#6365) * Add label enforcement * fix .gitlab-ci.yml * update check_labels.sh --- .gitlab-ci.yml | 11 ++++++++ .maintain/gitlab/check_labels.sh | 46 ++++++++++++++++++++++++++++++++ .maintain/gitlab/lib.sh | 8 ++++-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 .maintain/gitlab/check_labels.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd4fc65e85..c4442dece9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -721,3 +721,14 @@ validator 4 4: <<: *validator-deploy script: - ./.maintain/flamingfir-deploy.sh flamingfir-validator4 + +#### stage: .post + +check-labels: + stage: .post + image: paritytech/tools:latest + <<: *kubernetes-build + only: + - /^[0-9]+$/ + script: + - ./.maintain/gitlab/check_labels.sh diff --git a/.maintain/gitlab/check_labels.sh b/.maintain/gitlab/check_labels.sh new file mode 100755 index 0000000000..5ab099b382 --- /dev/null +++ b/.maintain/gitlab/check_labels.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +#shellcheck source=lib.sh +source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh" + +ensure_labels() { + for label in "$@"; do + if has_label 'paritytech/substrate' "$CI_COMMIT_BRANCH" "$label"; then + return 0 + fi + done + return 1 +} + +# Must have one of the following labels +releasenotes_labels=( + 'B0-silent' + 'B3-apinoteworthy' + 'B5-clientnoteworthy' + 'B7-runtimenoteworthy' +) + +criticality_labels=( + 'C1-low' + 'C3-medium' + 'C7-high' + 'C9-critical' +) + +echo "[+] Checking release notes (B) labels for $CI_COMMIT_BRANCH" +if ensure_labels "${releasenotes_labels[@]}"; then + echo "[+] Release notes label detected. All is well." +else + echo "[!] Release notes label not detected. Please add one of: ${releasenotes_labels[*]}" + exit 1 +fi + +echo "[+] Checking release criticality (C) labels for $CI_COMMIT_BRANCH" +if ensure_labels "${criticality_labels[@]}"; then + echo "[+] Release criticality label detected. All is well." +else + echo "[!] Release criticality label not detected. Please add one of: ${criticality_labels[*]}" + exit 1 +fi + +exit 0 diff --git a/.maintain/gitlab/lib.sh b/.maintain/gitlab/lib.sh index ecc9a5f542..a7a83baaea 100755 --- a/.maintain/gitlab/lib.sh +++ b/.maintain/gitlab/lib.sh @@ -66,8 +66,12 @@ has_label(){ repo="$1" pr_id="$2" label="$3" - out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/pulls/$pr_id") - [ -n "$(echo "$out" | jq ".labels | .[] | select(.name==\"$label\")")" ] + if [ -n "$GITHUB_RELEASE_TOKEN" ]; then + out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/pulls/$pr_id") + else + out=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id") + fi + [ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ] } # Formats a message into a JSON string for posting to Matrix -- GitLab From 24cbfc442a80f602ee3e907d6ceb840f9fdeba9d Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 16 Jun 2020 16:34:05 +0200 Subject: [PATCH 170/280] vesting: Force Vested Transfer (#6368) * force-vested-transfer * Tweak weights * Update frame/vesting/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- frame/vesting/src/lib.rs | 136 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index 5893869c91..8308c84f91 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -58,7 +58,7 @@ use frame_support::traits::{ Currency, LockableCurrency, VestingSchedule, WithdrawReason, LockIdentifier, ExistenceRequirement, Get }; -use frame_system::{self as system, ensure_signed}; +use frame_system::{self as system, ensure_signed, ensure_root}; mod benchmarking; @@ -266,6 +266,47 @@ decl_module! { Ok(()) } + + /// Force a vested transfer. + /// + /// The dispatch origin for this call must be _Root_. + /// + /// - `source`: The account whose funds should be transferred. + /// - `target`: The account that should be transferred the vested funds. + /// - `amount`: The amount of funds to transfer and will be vested. + /// - `schedule`: The vesting schedule attached to the transfer. + /// + /// Emits `VestingCreated`. + /// + /// # + /// - `O(1)`. + /// - DbWeight: 4 Reads, 4 Writes + /// - Reads: Vesting Storage, Balances Locks, Target Account, Source Account + /// - Writes: Vesting Storage, Balances Locks, Target Account, Source Account + /// - Benchmark: 100.3 + .365 * l µs (min square analysis) + /// - Using 100 µs fixed. Assuming less than 50 locks on any user, else we may want factor in number of locks. + /// # + #[weight = 100_000_000 + T::DbWeight::get().reads_writes(4, 4)] + pub fn force_vested_transfer( + origin, + source: ::Source, + target: ::Source, + schedule: VestingInfo, T::BlockNumber>, + ) -> DispatchResult { + ensure_root(origin)?; + ensure!(schedule.locked >= T::MinVestedTransfer::get(), Error::::AmountLow); + + let target = T::Lookup::lookup(target)?; + let source = T::Lookup::lookup(source)?; + ensure!(!Vesting::::contains_key(&target), Error::::ExistingVestingSchedule); + + T::Currency::transfer(&source, &target, schedule.locked, ExistenceRequirement::AllowDeath)?; + + Self::add_vesting_schedule(&target, schedule.locked, schedule.per_block, schedule.starting_block) + .expect("user does not have an existing vesting schedule; q.e.d."); + + Ok(()) + } } } @@ -361,8 +402,9 @@ mod tests { use sp_runtime::{ Perbill, testing::Header, - traits::{BlakeTwo256, IdentityLookup, Identity}, + traits::{BlakeTwo256, IdentityLookup, Identity, BadOrigin}, }; + use frame_system::RawOrigin; impl_outer_origin! { pub enum Origin for Test where system = frame_system {} @@ -718,4 +760,94 @@ mod tests { assert_eq!(user4_free_balance, 256 * 40); }); } + + #[test] + fn force_vested_transfer_works() { + ExtBuilder::default() + .existential_deposit(256) + .build() + .execute_with(|| { + let user3_free_balance = Balances::free_balance(&3); + let user4_free_balance = Balances::free_balance(&4); + assert_eq!(user3_free_balance, 256 * 30); + assert_eq!(user4_free_balance, 256 * 40); + // Account 4 should not have any vesting yet. + assert_eq!(Vesting::vesting(&4), None); + // Make the schedule for the new transfer. + let new_vesting_schedule = VestingInfo { + locked: 256 * 5, + per_block: 64, // Vesting over 20 blocks + starting_block: 10, + }; + assert_noop!(Vesting::force_vested_transfer(Some(4).into(), 3, 4, new_vesting_schedule), BadOrigin); + assert_ok!(Vesting::force_vested_transfer(RawOrigin::Root.into(), 3, 4, new_vesting_schedule)); + // Now account 4 should have vesting. + assert_eq!(Vesting::vesting(&4), Some(new_vesting_schedule)); + // Ensure the transfer happened correctly. + let user3_free_balance_updated = Balances::free_balance(&3); + assert_eq!(user3_free_balance_updated, 256 * 25); + let user4_free_balance_updated = Balances::free_balance(&4); + assert_eq!(user4_free_balance_updated, 256 * 45); + // Account 4 has 5 * 256 locked. + assert_eq!(Vesting::vesting_balance(&4), Some(256 * 5)); + + System::set_block_number(20); + assert_eq!(System::block_number(), 20); + + // Account 4 has 5 * 64 units vested by block 20. + assert_eq!(Vesting::vesting_balance(&4), Some(10 * 64)); + + System::set_block_number(30); + assert_eq!(System::block_number(), 30); + + // Account 4 has fully vested. + assert_eq!(Vesting::vesting_balance(&4), Some(0)); + }); + } + + #[test] + fn force_vested_transfer_correctly_fails() { + ExtBuilder::default() + .existential_deposit(256) + .build() + .execute_with(|| { + let user2_free_balance = Balances::free_balance(&2); + let user4_free_balance = Balances::free_balance(&4); + assert_eq!(user2_free_balance, 256 * 20); + assert_eq!(user4_free_balance, 256 * 40); + // Account 2 should already have a vesting schedule. + let user2_vesting_schedule = VestingInfo { + locked: 256 * 20, + per_block: 256, // Vesting over 20 blocks + starting_block: 10, + }; + assert_eq!(Vesting::vesting(&2), Some(user2_vesting_schedule)); + + // The vesting schedule we will try to create, fails due to pre-existence of schedule. + let new_vesting_schedule = VestingInfo { + locked: 256 * 5, + per_block: 64, // Vesting over 20 blocks + starting_block: 10, + }; + assert_noop!( + Vesting::force_vested_transfer(RawOrigin::Root.into(), 4, 2, new_vesting_schedule), + Error::::ExistingVestingSchedule, + ); + + // Fails due to too low transfer amount. + let new_vesting_schedule_too_low = VestingInfo { + locked: 256 * 1, + per_block: 64, + starting_block: 10, + }; + assert_noop!( + Vesting::force_vested_transfer(RawOrigin::Root.into(), 3, 4, new_vesting_schedule_too_low), + Error::::AmountLow, + ); + + // Verify no currency transfer happened. + assert_eq!(user2_free_balance, 256 * 20); + assert_eq!(user4_free_balance, 256 * 40); + }); + } } -- GitLab From 288ead00e65959297c38a43b10bd862e22aa6353 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 16 Jun 2020 18:51:21 +0200 Subject: [PATCH 171/280] client/authority-discovery: Don't add own address to priority group (#6370) * client/authority-discovery: Don't add own address to priority group In the scenario of a validator publishing the address of its sentry node to the DHT, said sentry node should not add its own Multiaddr to the peerset "authority" priority group. Related to 70cfeff. * client/authority-discovery: Remove unused import PeerId * client/authority-discovery/tests: Add tcp protocol to multiaddresses --- client/authority-discovery/src/lib.rs | 23 ++++- client/authority-discovery/src/tests.rs | 107 +++++++++++++++++++++++- 2 files changed, 122 insertions(+), 8 deletions(-) diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs index de98e6a4a3..e816600b7c 100644 --- a/client/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -58,19 +58,26 @@ use futures::task::{Context, Poll}; use futures::{Future, FutureExt, ready, Stream, StreamExt}; use futures_timer::Delay; +use addr_cache::AddrCache; use codec::Decode; use error::{Error, Result}; +use libp2p::core::multiaddr; use log::{debug, error, log_enabled}; use prometheus_endpoint::{Counter, CounterVec, Gauge, Opts, U64, register}; use prost::Message; use sc_client_api::blockchain::HeaderBackend; -use sc_network::{Multiaddr, config::MultiaddrWithPeerId, DhtEvent, ExHashT, NetworkStateInfo}; +use sc_network::{ + config::MultiaddrWithPeerId, + DhtEvent, + ExHashT, + Multiaddr, + NetworkStateInfo, +}; use sp_authority_discovery::{AuthorityDiscoveryApi, AuthorityId, AuthoritySignature, AuthorityPair}; use sp_core::crypto::{key_types, Pair}; use sp_core::traits::BareCryptoStorePtr; use sp_runtime::{traits::Block as BlockT, generic::BlockId}; use sp_api::ProvideRuntimeApi; -use addr_cache::AddrCache; #[cfg(test)] mod tests; @@ -233,7 +240,7 @@ where .collect(), None => self.network.external_addresses() .into_iter() - .map(|a| a.with(libp2p::core::multiaddr::Protocol::P2p( + .map(|a| a.with(multiaddr::Protocol::P2p( self.network.local_peer_id().into(), ))) .map(|a| a.to_vec()) @@ -423,6 +430,8 @@ where .get(&remote_key) .ok_or(Error::MatchingHashedAuthorityIdWithAuthorityId)?; + let local_peer_id = multiaddr::Protocol::P2p(self.network.local_peer_id().into()); + let remote_addresses: Vec = values.into_iter() .map(|(_k, v)| { let schema::SignedAuthorityAddresses { signature, addresses } = @@ -447,7 +456,13 @@ where Ok(addresses) }) .collect::>>>()? - .into_iter().flatten().collect(); + .into_iter() + .flatten() + // Ignore own addresses. + .filter(|addr| !addr.iter().any(|protocol| + protocol == local_peer_id + )) + .collect(); if !remote_addresses.is_empty() { self.addr_cache.insert(authority_id.clone(), remote_addresses); diff --git a/client/authority-discovery/src/tests.rs b/client/authority-discovery/src/tests.rs index 12edcf5fc9..09a65fd138 100644 --- a/client/authority-discovery/src/tests.rs +++ b/client/authority-discovery/src/tests.rs @@ -24,10 +24,10 @@ use futures::future::{poll_fn, FutureExt}; use futures::sink::SinkExt; use futures::task::LocalSpawn; use futures::poll; -use libp2p::{kad, PeerId}; +use libp2p::{kad, core::multiaddr, PeerId}; use sp_api::{ProvideRuntimeApi, ApiRef}; -use sp_core::testing::KeyStore; +use sp_core::{crypto::Public, testing::KeyStore}; use sp_runtime::traits::{Zero, Block as BlockT, NumberFor}; use substrate_test_runtime_client::runtime::Block; @@ -210,7 +210,7 @@ impl NetworkStateInfo for TestNetwork { } fn external_addresses(&self) -> Vec { - vec!["/ip6/2001:db8::".parse().unwrap()] + vec!["/ip6/2001:db8::/tcp/30333".parse().unwrap()] } } @@ -281,7 +281,7 @@ fn publish_discover_cycle() { let peer_id = network.local_peer_id(); let address = network.external_addresses().pop().unwrap(); - address.with(libp2p::core::multiaddr::Protocol::P2p( + address.with(multiaddr::Protocol::P2p( peer_id.into(), )) }; @@ -461,3 +461,102 @@ fn dont_stop_polling_when_error_is_returned() { } ); } + +/// In the scenario of a validator publishing the address of its sentry node to +/// the DHT, said sentry node should not add its own Multiaddr to the +/// peerset "authority" priority group. +#[test] +fn never_add_own_address_to_priority_group() { + let validator_key_store = KeyStore::new(); + let validator_public = validator_key_store + .write() + .sr25519_generate_new(key_types::AUTHORITY_DISCOVERY, None) + .unwrap(); + + let sentry_network: Arc = Arc::new(Default::default()); + + let sentry_multiaddr = { + let peer_id = sentry_network.local_peer_id(); + let address: Multiaddr = "/ip6/2001:db8:0:0:0:0:0:2/tcp/30333".parse().unwrap(); + + address.with(multiaddr::Protocol::P2p( + peer_id.into(), + )) + }; + + // Address of some other sentry node of `validator`. + let random_multiaddr = { + let peer_id = PeerId::random(); + let address: Multiaddr = "/ip6/2001:db8:0:0:0:0:0:1/tcp/30333".parse().unwrap(); + + address.with(multiaddr::Protocol::P2p( + peer_id.into(), + )) + }; + + let dht_event = { + let addresses = vec![ + sentry_multiaddr.to_vec(), + random_multiaddr.to_vec(), + ]; + + let mut serialized_addresses = vec![]; + schema::AuthorityAddresses { addresses } + .encode(&mut serialized_addresses) + .map_err(Error::EncodingProto) + .unwrap(); + + let signature = validator_key_store.read() + .sign_with( + key_types::AUTHORITY_DISCOVERY, + &validator_public.clone().into(), + serialized_addresses.as_slice(), + ) + .map_err(|_| Error::Signing) + .unwrap(); + + let mut signed_addresses = vec![]; + schema::SignedAuthorityAddresses { + addresses: serialized_addresses.clone(), + signature, + } + .encode(&mut signed_addresses) + .map_err(Error::EncodingProto) + .unwrap(); + + let key = hash_authority_id(&validator_public.to_raw_vec()); + let value = signed_addresses; + (key, value) + }; + + let (_dht_event_tx, dht_event_rx) = channel(1); + let sentry_test_api = Arc::new(TestApi { + // Make sure the sentry node identifies its validator as an authority. + authorities: vec![validator_public.into()], + }); + + let mut sentry_authority_discovery = AuthorityDiscovery::new( + sentry_test_api, + sentry_network.clone(), + vec![], + dht_event_rx.boxed(), + Role::Sentry, + None, + ); + + sentry_authority_discovery.handle_dht_value_found_event(vec![dht_event]).unwrap(); + + assert_eq!( + sentry_network.set_priority_group_call.lock().unwrap().len(), 1, + "Expect authority discovery to set the priority set.", + ); + + assert_eq!( + sentry_network.set_priority_group_call.lock().unwrap()[0], + ( + "authorities".to_string(), + HashSet::from_iter(vec![random_multiaddr.clone()].into_iter(),) + ), + "Expect authority discovery to only add `random_multiaddr`." + ); +} -- GitLab From 74efab4049c0637b405efba4dac5269b40e5da25 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 16 Jun 2020 22:49:01 +0200 Subject: [PATCH 172/280] .gitlab-ci.yml: Run promtool on Prometheus alerting rules (#6344) * .gitlab-ci.yml: Run promtool on Prometheus alerting rules Add a CI stage to test the Prometheus alerting rules within `.maintain/monitoring`. * .gitlab-ci.yml: Switch Prometheus stage to paritytech/tools image * .gitlab-ci.yml: Follow http redirects in Prometheus stage * .gitlab-ci.yml: Fix Prometheus stage promtool folder name --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4442dece9..e146d40ee6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -359,6 +359,15 @@ cargo-check-macos: tags: - osx +test-prometheus-alerting-rules: + stage: test + image: paritytech/tools:latest + <<: *kubernetes-build + script: + - curl -L https://github.com/prometheus/prometheus/releases/download/v2.19.0/prometheus-2.19.0.linux-amd64.tar.gz --output prometheus.tar.gz + - tar -xzf prometheus.tar.gz + - ./prometheus-*/promtool check rules .maintain/monitoring/alerting-rules/alerting-rules.yaml + #### stage: build check-polkadot-companion-status: -- GitLab From 1823782590e51f53bb5bdc28ce198bfac3d91bbf Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 16 Jun 2020 22:49:44 +0200 Subject: [PATCH 173/280] Use /dns/ instead of /dns4/ (#6369) --- .maintain/sentry-node/docker-compose.yml | 14 +++++++------- bin/node/cli/res/flaming-fir.json | 2 +- client/network/src/discovery.rs | 3 ++- client/network/src/lib.rs | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.maintain/sentry-node/docker-compose.yml b/.maintain/sentry-node/docker-compose.yml index 376538dde5..235f2c4963 100644 --- a/.maintain/sentry-node/docker-compose.yml +++ b/.maintain/sentry-node/docker-compose.yml @@ -47,9 +47,9 @@ services: - "--validator" - "--alice" - "--sentry-nodes" - - "/dns4/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" + - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" - "--reserved-nodes" - - "/dns4/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" + - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" # Not only bind to localhost. - "--unsafe-ws-external" - "--unsafe-rpc-external" @@ -83,11 +83,11 @@ services: - "--port" - "30333" - "--sentry" - - "/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" + - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" - "--reserved-nodes" - - "/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" + - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" - "--bootnodes" - - "/dns4/validator-b/tcp/30333/p2p/QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk" + - "/dns/validator-b/tcp/30333/p2p/QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk" - "--no-telemetry" - "--rpc-cors" - "all" @@ -118,9 +118,9 @@ services: - "--validator" - "--bob" - "--bootnodes" - - "/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" + - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" - "--bootnodes" - - "/dns4/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" + - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi" - "--no-telemetry" - "--rpc-cors" - "all" diff --git a/bin/node/cli/res/flaming-fir.json b/bin/node/cli/res/flaming-fir.json index 7cc2c11c32..5f2eb26588 100644 --- a/bin/node/cli/res/flaming-fir.json +++ b/bin/node/cli/res/flaming-fir.json @@ -14,7 +14,7 @@ ], "telemetryEndpoints": [ [ - "/dns4/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", + "/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", 0 ] ], diff --git a/client/network/src/discovery.rs b/client/network/src/discovery.rs index f5c293b251..73a5916947 100644 --- a/client/network/src/discovery.rs +++ b/client/network/src/discovery.rs @@ -324,7 +324,8 @@ impl DiscoveryBehaviour { let ip = match addr.iter().next() { Some(Protocol::Ip4(ip)) => IpNetwork::from(ip), Some(Protocol::Ip6(ip)) => IpNetwork::from(ip), - Some(Protocol::Dns4(_)) | Some(Protocol::Dns6(_)) => return true, + Some(Protocol::Dns(_)) | Some(Protocol::Dns4(_)) | Some(Protocol::Dns6(_)) + => return true, _ => return false }; ip.is_global() diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 73e0b525a1..6106616d99 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -77,7 +77,7 @@ //! - WebSockets for addresses of the form `/ip4/1.2.3.4/tcp/5/ws`. A TCP/IP connection is open and //! the WebSockets protocol is negotiated on top. Communications then happen inside WebSockets data //! frames. Encryption and multiplexing are additionally negotiated again inside this channel. -//! - DNS for addresses of the form `/dns4/example.com/tcp/5` or `/dns4/example.com/tcp/5/ws`. A +//! - DNS for addresses of the form `/dns/example.com/tcp/5` or `/dns/example.com/tcp/5/ws`. A //! node's address can contain a domain name. //! - (All of the above using IPv6 instead of IPv4.) //! -- GitLab From 02e77d20b7949f89c4fb12b1ba22fd22acd7aeb4 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Wed, 17 Jun 2020 08:51:03 +1200 Subject: [PATCH 174/280] add system_dryRun (#6300) * add system_dryRun * fix build error * delete unneeded code * return ApplyExtrinsicResult directly * line width * mark dry run unsafe * line width * fix test * add test * update comment --- Cargo.lock | 3 + bin/node/rpc/Cargo.toml | 1 + bin/node/rpc/src/lib.rs | 9 +- client/consensus/babe/rpc/src/lib.rs | 3 +- utils/frame/rpc/system/Cargo.toml | 2 + utils/frame/rpc/system/src/lib.rs | 182 ++++++++++++++++++++++++--- 6 files changed, 180 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cd16427c5..4761c859f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3477,6 +3477,7 @@ dependencies = [ "sc-keystore", "sc-rpc-api", "sp-api", + "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", @@ -8116,9 +8117,11 @@ dependencies = [ "log", "parity-scale-codec", "sc-client-api", + "sc-rpc-api", "sc-transaction-pool", "serde", "sp-api", + "sp-block-builder", "sp-blockchain", "sp-core", "sp-runtime", diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 0c6c913b13..2bac8b6740 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -31,3 +31,4 @@ sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" sc-finality-grandpa = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa" } sc-finality-grandpa-rpc = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa/rpc" } sc-rpc-api = { version = "0.8.0-rc3", path = "../../../client/rpc-api" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs index 259a792441..9b6b599174 100644 --- a/bin/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -30,7 +30,7 @@ #![warn(missing_docs)] -use std::{sync::Arc, fmt}; +use std::sync::Arc; use node_primitives::{Block, BlockNumber, AccountId, Index, Balance, Hash}; use node_runtime::UncheckedExtrinsic; @@ -46,6 +46,7 @@ use sc_consensus_babe_rpc::BabeRpcHandler; use sc_finality_grandpa::{SharedVoterState, SharedAuthoritySet}; use sc_finality_grandpa_rpc::GrandpaRpcHandler; use sc_rpc_api::DenyUnsafe; +use sp_block_builder::BlockBuilder; /// Light client extra dependencies. pub struct LightDeps { @@ -104,7 +105,7 @@ pub fn create_full( C::Api: pallet_contracts_rpc::ContractsRuntimeApi, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BabeApi, - ::Error: fmt::Debug, + C::Api: BlockBuilder, P: TransactionPool + 'static, M: jsonrpc_core::Metadata + Default, SC: SelectChain +'static, @@ -133,7 +134,7 @@ pub fn create_full( } = grandpa; io.extend_with( - SystemApi::to_delegate(FullSystem::new(client.clone(), pool)) + SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)) ); // Making synchronous calls in light client freezes the browser currently, // more context: https://github.com/paritytech/substrate/pull/3480 @@ -185,7 +186,7 @@ pub fn create_light( } = deps; let mut io = jsonrpc_core::IoHandler::default(); io.extend_with( - SystemApi::::to_delegate(LightSystem::new(client, remote_blockchain, fetcher, pool)) + SystemApi::::to_delegate(LightSystem::new(client, remote_blockchain, fetcher, pool)) ); io diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 8e1282a8d7..35000770d4 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -38,7 +38,7 @@ use sp_api::{ProvideRuntimeApi, BlockId}; use sp_runtime::traits::{Block as BlockT, Header as _}; use sp_consensus::{SelectChain, Error as ConsensusError}; use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError}; -use std::{collections::HashMap, fmt, sync::Arc}; +use std::{collections::HashMap, sync::Arc}; type FutureResult = Box + Send>; @@ -93,7 +93,6 @@ impl BabeApi for BabeRpcHandler B: BlockT, C: ProvideRuntimeApi + HeaderBackend + HeaderMetadata + 'static, C::Api: BabeRuntimeApi, - ::Error: fmt::Debug, SC: SelectChain + Clone + 'static, { fn epoch_authorship(&self) -> FutureResult> { diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 11afd3b841..21cd00ebd4 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -26,6 +26,8 @@ frame-system-rpc-runtime-api = { version = "2.0.0-rc3", path = "../../../../fram sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } sp-blockchain = { version = "2.0.0-rc3", path = "../../../../primitives/blockchain" } sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../../primitives/transaction-pool" } +sp-block-builder = { version = "2.0.0-rc3", path = "../../../../primitives/block-builder" } +sc-rpc-api = { version = "0.8.0-rc3", path = "../../../../client/rpc-api" } [dev-dependencies] substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } diff --git a/utils/frame/rpc/system/src/lib.rs b/utils/frame/rpc/system/src/lib.rs index a3ce1466f6..6927f05b4f 100644 --- a/utils/frame/rpc/system/src/lib.rs +++ b/utils/frame/rpc/system/src/lib.rs @@ -22,8 +22,8 @@ use std::sync::Arc; use codec::{self, Codec, Decode, Encode}; use sc_client_api::light::{future_header, RemoteBlockchain, Fetcher, RemoteCallRequest}; use jsonrpc_core::{ - Error, ErrorCode, - futures::future::{result, Future}, + Error as RpcError, ErrorCode, + futures::future::{self as rpc_future,result, Future}, }; use jsonrpc_derive::rpc; use futures::future::{ready, TryFutureExt}; @@ -35,18 +35,20 @@ use sp_runtime::{ generic::BlockId, traits, }; -use sp_core::hexdisplay::HexDisplay; +use sp_core::{hexdisplay::HexDisplay, Bytes}; use sp_transaction_pool::{TransactionPool, InPoolTransaction}; +use sp_block_builder::BlockBuilder; +use sc_rpc_api::DenyUnsafe; pub use frame_system_rpc_runtime_api::AccountNonceApi; pub use self::gen_client::Client as SystemClient; /// Future that resolves to account nonce. -pub type FutureResult = Box + Send>; +pub type FutureResult = Box + Send>; /// System RPC methods. #[rpc] -pub trait SystemApi { +pub trait SystemApi { /// Returns the next valid index (aka nonce) for given account. /// /// This method takes into consideration all pending transactions @@ -54,34 +56,57 @@ pub trait SystemApi { /// it fallbacks to query the index from the runtime (aka. state nonce). #[rpc(name = "system_accountNextIndex", alias("account_nextIndex"))] fn nonce(&self, account: AccountId) -> FutureResult; + + /// Dry run an extrinsic at a given block. Return SCALE encoded ApplyExtrinsicResult. + #[rpc(name = "system_dryRun", alias("system_dryRunAt"))] + fn dry_run(&self, extrinsic: Bytes, at: Option) -> FutureResult; +} + +/// Error type of this RPC api. +pub enum Error { + /// The transaction was not decodable. + DecodeError, + /// The call to runtime failed. + RuntimeError, } -const RUNTIME_ERROR: i64 = 1; +impl From for i64 { + fn from(e: Error) -> i64 { + match e { + Error::RuntimeError => 1, + Error::DecodeError => 2, + } + } +} /// An implementation of System-specific RPC methods on full client. pub struct FullSystem { client: Arc, pool: Arc

, + deny_unsafe: DenyUnsafe, _marker: std::marker::PhantomData, } impl FullSystem { /// Create new `FullSystem` given client and transaction pool. - pub fn new(client: Arc, pool: Arc

) -> Self { + pub fn new(client: Arc, pool: Arc

, deny_unsafe: DenyUnsafe,) -> Self { FullSystem { client, pool, + deny_unsafe, _marker: Default::default(), } } } -impl SystemApi for FullSystem +impl SystemApi<::Hash, AccountId, Index> + for FullSystem where C: sp_api::ProvideRuntimeApi, C: HeaderBackend, C: Send + Sync + 'static, C::Api: AccountNonceApi, + C::Api: BlockBuilder, P: TransactionPool + 'static, Block: traits::Block, AccountId: Clone + std::fmt::Display + Codec, @@ -93,8 +118,8 @@ where let best = self.client.info().best_hash; let at = BlockId::hash(best); - let nonce = api.account_nonce(&at, account.clone()).map_err(|e| Error { - code: ErrorCode::ServerError(RUNTIME_ERROR), + let nonce = api.account_nonce(&at, account.clone()).map_err(|e| RpcError { + code: ErrorCode::ServerError(Error::RuntimeError.into()), message: "Unable to query nonce.".into(), data: Some(format!("{:?}", e).into()), })?; @@ -104,6 +129,38 @@ where Box::new(result(get_nonce())) } + + fn dry_run(&self, extrinsic: Bytes, at: Option<::Hash>) -> FutureResult { + if let Err(err) = self.deny_unsafe.check_if_safe() { + return Box::new(rpc_future::err(err.into())); + } + + let dry_run = || { + let api = self.client.runtime_api(); + let at = BlockId::::hash(at.unwrap_or_else(|| + // If the block hash is not supplied assume the best block. + self.client.info().best_hash + )); + + let uxt: ::Extrinsic = Decode::decode(&mut &*extrinsic).map_err(|e| RpcError { + code: ErrorCode::ServerError(Error::DecodeError.into()), + message: "Unable to dry run extrinsic.".into(), + data: Some(format!("{:?}", e).into()), + })?; + + let result = api.apply_extrinsic(&at, uxt) + .map_err(|e| RpcError { + code: ErrorCode::ServerError(Error::RuntimeError.into()), + message: "Unable to dry run extrinsic.".into(), + data: Some(format!("{:?}", e).into()), + })?; + + Ok(Encode::encode(&result).into()) + }; + + + Box::new(result(dry_run())) + } } /// An implementation of System-specific RPC methods on light client. @@ -131,7 +188,8 @@ impl LightSystem { } } -impl SystemApi for LightSystem +impl SystemApi<::Hash, AccountId, Index> + for LightSystem where P: TransactionPool + 'static, C: HeaderBackend, @@ -165,8 +223,8 @@ where ).compat(); let future_nonce = future_nonce.and_then(|nonce| Decode::decode(&mut &nonce[..]) .map_err(|e| ClientError::CallResultDecode("Cannot decode account nonce", e))); - let future_nonce = future_nonce.map_err(|e| Error { - code: ErrorCode::ServerError(RUNTIME_ERROR), + let future_nonce = future_nonce.map_err(|e| RpcError { + code: ErrorCode::ServerError(Error::RuntimeError.into()), message: "Unable to query nonce.".into(), data: Some(format!("{:?}", e).into()), }); @@ -176,6 +234,14 @@ where Box::new(future_nonce) } + + fn dry_run(&self, _extrinsic: Bytes, _at: Option<::Hash>) -> FutureResult { + Box::new(result(Err(RpcError { + code: ErrorCode::MethodNotFound, + message: "Unable to dry run extrinsic.".into(), + data: None, + }))) + } } /// Adjust account nonce from state, so that tx with the nonce will be @@ -224,6 +290,7 @@ mod tests { use futures::executor::block_on; use substrate_test_runtime_client::{runtime::Transfer, AccountKeyring}; use sc_transaction_pool::{BasicPool, FullChainApi}; + use sp_runtime::{ApplyExtrinsicResult, transaction_validity::{TransactionValidityError, InvalidTransaction}}; #[test] fn should_return_next_nonce_for_some_account() { @@ -255,7 +322,7 @@ mod tests { let ext1 = new_transaction(1); block_on(pool.submit_one(&BlockId::number(0), source, ext1)).unwrap(); - let accounts = FullSystem::new(client, pool); + let accounts = FullSystem::new(client, pool, DenyUnsafe::Yes); // when let nonce = accounts.nonce(AccountKeyring::Alice.into()); @@ -263,4 +330,91 @@ mod tests { // then assert_eq!(nonce.wait().unwrap(), 2); } + + #[test] + fn dry_run_should_deny_unsafe() { + let _ = env_logger::try_init(); + + // given + let client = Arc::new(substrate_test_runtime_client::new()); + let pool = Arc::new( + BasicPool::new( + Default::default(), + Arc::new(FullChainApi::new(client.clone())), + None, + ).0 + ); + + let accounts = FullSystem::new(client, pool, DenyUnsafe::Yes); + + // when + let res = accounts.dry_run(vec![].into(), None); + + // then + assert_eq!(res.wait(), Err(RpcError::method_not_found())); + } + + #[test] + fn dry_run_should_work() { + let _ = env_logger::try_init(); + + // given + let client = Arc::new(substrate_test_runtime_client::new()); + let pool = Arc::new( + BasicPool::new( + Default::default(), + Arc::new(FullChainApi::new(client.clone())), + None, + ).0 + ); + + let accounts = FullSystem::new(client, pool, DenyUnsafe::No); + + let tx = Transfer { + from: AccountKeyring::Alice.into(), + to: AccountKeyring::Bob.into(), + amount: 5, + nonce: 0, + }.into_signed_tx(); + + // when + let res = accounts.dry_run(tx.encode().into(), None); + + // then + let bytes = res.wait().unwrap().0; + let apply_res: ApplyExtrinsicResult = Decode::decode(&mut bytes.as_slice()).unwrap(); + assert_eq!(apply_res, Ok(Ok(()))); + } + + #[test] + fn dry_run_should_indicate_error() { + let _ = env_logger::try_init(); + + // given + let client = Arc::new(substrate_test_runtime_client::new()); + let pool = Arc::new( + BasicPool::new( + Default::default(), + Arc::new(FullChainApi::new(client.clone())), + None, + ).0 + ); + + let accounts = FullSystem::new(client, pool, DenyUnsafe::No); + + let tx = Transfer { + from: AccountKeyring::Alice.into(), + to: AccountKeyring::Bob.into(), + amount: 5, + nonce: 100, + }.into_signed_tx(); + + // when + let res = accounts.dry_run(tx.encode().into(), None); + + // then + let bytes = res.wait().unwrap().0; + let apply_res: ApplyExtrinsicResult = Decode::decode(&mut bytes.as_slice()).unwrap(); + assert_eq!(apply_res, Err(TransactionValidityError::Invalid(InvalidTransaction::Stale))); + } } -- GitLab From db8916a48e2bfc9ae9c18c3fa617f7302432c685 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 16 Jun 2020 23:51:45 +0300 Subject: [PATCH 175/280] fix BlockAttributes encoding (#6281) --- client/network/src/block_requests.rs | 49 +++++++++++++++------- client/network/src/light_client_handler.rs | 35 ++++++++++++---- client/network/src/protocol/message.rs | 14 +++++++ 3 files changed, 74 insertions(+), 24 deletions(-) diff --git a/client/network/src/block_requests.rs b/client/network/src/block_requests.rs index ae5a3a0b4e..6d698a7300 100644 --- a/client/network/src/block_requests.rs +++ b/client/network/src/block_requests.rs @@ -277,21 +277,13 @@ where return SendRequestOutcome::NotConnected; }; - let protobuf_rq = schema::v1::BlockRequest { - fields: u32::from_be_bytes([req.fields.bits(), 0, 0, 0]), - from_block: match req.from { - message::FromBlock::Hash(h) => - Some(schema::v1::block_request::FromBlock::Hash(h.encode())), - message::FromBlock::Number(n) => - Some(schema::v1::block_request::FromBlock::Number(n.encode())), - }, - to_block: req.to.map(|h| h.encode()).unwrap_or_default(), - direction: match req.direction { - message::Direction::Ascending => schema::v1::Direction::Ascending as i32, - message::Direction::Descending => schema::v1::Direction::Descending as i32, - }, - max_blocks: req.max.unwrap_or(0), - }; + let protobuf_rq = build_protobuf_block_request( + req.fields, + req.from.clone(), + req.to.clone(), + req.direction, + req.max, + ); let mut buf = Vec::with_capacity(protobuf_rq.encoded_len()); if let Err(err) = protobuf_rq.encode(&mut buf) { @@ -386,7 +378,7 @@ where return Err(io::Error::new(io::ErrorKind::Other, msg).into()) }; - let attributes = BlockAttributes::decode(&mut request.fields.to_be_bytes().as_ref())?; + let attributes = BlockAttributes::from_be_u32(request.fields)?; let get_header = attributes.contains(BlockAttributes::HEADER); let get_body = attributes.contains(BlockAttributes::BODY); let get_justification = attributes.contains(BlockAttributes::JUSTIFICATION); @@ -826,3 +818,28 @@ where }.boxed() } } + +/// Build protobuf block request message. +pub(crate) fn build_protobuf_block_request( + attributes: BlockAttributes, + from_block: message::FromBlock, + to_block: Option, + direction: message::Direction, + max_blocks: Option, +) -> schema::v1::BlockRequest { + schema::v1::BlockRequest { + fields: attributes.to_be_u32(), + from_block: match from_block { + message::FromBlock::Hash(h) => + Some(schema::v1::block_request::FromBlock::Hash(h.encode())), + message::FromBlock::Number(n) => + Some(schema::v1::block_request::FromBlock::Number(n.encode())), + }, + to_block: to_block.map(|h| h.encode()).unwrap_or_default(), + direction: match direction { + message::Direction::Ascending => schema::v1::Direction::Ascending as i32, + message::Direction::Descending => schema::v1::Direction::Descending as i32, + }, + max_blocks: max_blocks.unwrap_or(0), + } +} diff --git a/client/network/src/light_client_handler.rs b/client/network/src/light_client_handler.rs index 236ae81747..ab6bea8761 100644 --- a/client/network/src/light_client_handler.rs +++ b/client/network/src/light_client_handler.rs @@ -27,9 +27,10 @@ use bytes::Bytes; use codec::{self, Encode, Decode}; use crate::{ + block_requests::build_protobuf_block_request, chain::Client, config::ProtocolId, - protocol::message::BlockAttributes, + protocol::message::{BlockAttributes, Direction, FromBlock}, schema, }; use futures::{channel::oneshot, future::BoxFuture, prelude::*, stream::FuturesUnordered}; @@ -1062,13 +1063,13 @@ fn retries(request: &Request) -> usize { fn serialize_request(request: &Request) -> Result, prost::EncodeError> { let request = match request { Request::Body { request, .. } => { - let rq = schema::v1::BlockRequest { - fields: u32::from(BlockAttributes::BODY.bits()), - from_block: Some(schema::v1::block_request::FromBlock::Hash(request.header.hash().encode())), - to_block: Vec::new(), - direction: schema::v1::Direction::Ascending as i32, - max_blocks: 1, - }; + let rq = build_protobuf_block_request::<_, NumberFor>( + BlockAttributes::BODY, + FromBlock::Hash(request.header.hash()), + None, + Direction::Ascending, + Some(1), + ); let mut buf = Vec::with_capacity(rq.encoded_len()); rq.encode(&mut buf)?; return Ok(buf); @@ -2036,4 +2037,22 @@ mod tests { assert_eq!(vec![(100, 2)], task::block_on(chan.1).unwrap().unwrap()); // ^--- from `DummyFetchChecker::check_changes_proof` } + + #[test] + fn body_request_fields_encoded_properly() { + let (sender, _) = oneshot::channel(); + let serialized_request = serialize_request::(&Request::Body { + request: RemoteBodyRequest { + header: dummy_header(), + retry_count: None, + }, + sender, + }).unwrap(); + let deserialized_request = schema::v1::BlockRequest::decode(&serialized_request[..]).unwrap(); + assert!( + BlockAttributes::from_be_u32(deserialized_request.fields) + .unwrap() + .contains(BlockAttributes::BODY) + ); + } } diff --git a/client/network/src/protocol/message.rs b/client/network/src/protocol/message.rs index bb2253b733..a7fbb92387 100644 --- a/client/network/src/protocol/message.rs +++ b/client/network/src/protocol/message.rs @@ -87,6 +87,20 @@ bitflags! { } } +impl BlockAttributes { + /// Encodes attributes as big endian u32, compatible with SCALE-encoding (i.e the + /// significant byte has zero index). + pub fn to_be_u32(&self) -> u32 { + u32::from_be_bytes([self.bits(), 0, 0, 0]) + } + + /// Decodes attributes, encoded with the `encode_to_be_u32()` call. + pub fn from_be_u32(encoded: u32) -> Result { + BlockAttributes::from_bits(encoded.to_be_bytes()[0]) + .ok_or_else(|| Error::from("Invalid BlockAttributes")) + } +} + impl Encode for BlockAttributes { fn encode_to(&self, dest: &mut T) { dest.push_byte(self.bits()) -- GitLab From bdae39fb52e1e5394cba2a429ad10c665353e96b Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Wed, 17 Jun 2020 12:22:57 +0200 Subject: [PATCH 176/280] Allow Sudo to do anything (#6375) * All Sudo to do anything. * Rename old labels. --- .maintain/gitlab/check_runtime.sh | 2 +- docs/CONTRIBUTING.adoc | 10 +++++----- frame/sudo/src/lib.rs | 12 ++++++------ frame/sudo/src/mock.rs | 18 +++++++++++++----- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.maintain/gitlab/check_runtime.sh b/.maintain/gitlab/check_runtime.sh index 5b7e25e3af..6d009c5aaf 100755 --- a/.maintain/gitlab/check_runtime.sh +++ b/.maintain/gitlab/check_runtime.sh @@ -67,7 +67,7 @@ sub_spec_version="$(git diff tags/release...${CI_COMMIT_SHA} ${VERSIONS_FILE} \ if [ "${add_spec_version}" != "${sub_spec_version}" ] then - github_label "B2-breaksapi" + github_label "D2-breaksapi" boldcat <<-EOT diff --git a/docs/CONTRIBUTING.adoc b/docs/CONTRIBUTING.adoc index 3dca7432c0..ec747d6693 100644 --- a/docs/CONTRIBUTING.adoc +++ b/docs/CONTRIBUTING.adoc @@ -37,9 +37,9 @@ A PR needs to be reviewed and approved by project maintainers unless: . Please tag each PR with exactly one `A`, `B` and `C` label at the minimum. . Once a PR is ready for review please add the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`A0-pleasereview`] label. Generally PRs should sit with this label for 48 hours in order to garner feedback. It may be merged before if all relevant parties had a look at it. -. If the first review is not an approval, swap `A0-pleasereview` to any label `[A3, A7]` to indicate that the PR has received some feedback, but needs further work. For example. https://github.com/paritytech/substrate/labels/A3-inprogress[`A3-inprogress`] is a general indicator that the PR is work in progress and https://github.com/paritytech/substrate/labels/A4-gotissues[`A4-gotissues`] means that it has significant problems that need fixing. Once the work is done, change the label back to `A0-pleasereview`. You might end up swapping a few times back and forth to climb up the A label group. Once a PR is https://github.com/paritytech/substrate/labels/A8-mergeoncegreen[`A8-mergeoncegreen`], it is ready to merge. +. If the first review is not an approval, swap `A0-pleasereview` to any label `[A3, A7]` to indicate that the PR has received some feedback, but needs further work. For example. https://github.com/paritytech/substrate/labels/A3-inprogress[`A3-inprogress`] is a general indicator that the PR is work in progress and https://github.com/paritytech/substrate/labels/A4-gotissues[`A4-gotissues`] means that it has significant problems that need fixing. Once the work is done, change the label back to `A0-pleasereview`. You might end up swapping a few times back and forth to climb up the A label group. Once a PR is https://github.com/paritytech/substrate/labels/A8-mergeoncegreen[`A8-mergeoncegreen`], it is ready to merge. . PRs must be tagged with respect to _release notes_ with https://github.com/paritytech/substrate/labels/B0-silent[`B0-silent`] and `B1-..`. The former indicates that no changes should be mentioned in any release notes. The latter indicates that the changes should be reported in the corresponding release note -. PRs that break the external API must be tagged with https://github.com/paritytech/substrate/labels/B2-breaksapi[`B2-breaksapi`], when it changes the FRAME or consensus of running system with https://github.com/paritytech/substrate/labels/B3-breaksconsensus[`B3-breaksconsensus`]. +. PRs that break the external API must be tagged with https://github.com/paritytech/substrate/labels/D2-breaksapi[`D2-breaksapi`], when it changes the FRAME or consensus of running system with https://github.com/paritytech/substrate/labels/B3-breaksconsensus[`B3-breaksconsensus`]. . PRs should be labeled with their release importance via the `C1-C9`. . PRs should be categorized into projects. . No PR should be merged until all reviews' comments are addressed and CI is successful. @@ -69,12 +69,12 @@ To create a Polkadot companion PR: . Pull latest Polkadot master (or clone it, if you haven't yet). . Override your local cargo config to point to your local substrate (pointing to your WIP branch): place `paths = ["path/to/substrate"]` in `~/.cargo/config`. . Make the changes required and build polkadot locally. -. Submit all this as a PR against the Polkadot Repo. Link to your Polkadot PR in the _description_ of your Substrate PR as "polkadot companion: [URL]" OR use the same name for your Polkdadot branch as the Substrate branch. +. Submit all this as a PR against the Polkadot Repo. Link to your Polkadot PR in the _description_ of your Substrate PR as "polkadot companion: [URL]" OR use the same name for your Polkdadot branch as the Substrate branch. . Now you should see that the `check_polkadot` CI job will build your Substrate PR agains the mentioned Polkadot branch in your PR description. . Wait for reviews on both -. Once both PRs have been green lit, they can both be merged 🍻. +. Once both PRs have been green lit, they can both be merged 🍻. -If your PR is reviewed well, but a Polkadot PR is missing, signal it with https://github.com/paritytech/substrate/labels/A7-needspolkadotpr[`A7-needspolkadotpr`] to prevent it from getting automatically merged. +If your PR is reviewed well, but a Polkadot PR is missing, signal it with https://github.com/paritytech/substrate/labels/A7-needspolkadotpr[`A7-needspolkadotpr`] to prevent it from getting automatically merged. As there might be multiple pending PRs that might conflict with one another, a) you should not merge the substrate PR until the Polkadot PR has also been reviewed and b) both should be merged pretty quickly after another to not block others. diff --git a/frame/sudo/src/lib.rs b/frame/sudo/src/lib.rs index 55c2c97d12..233e75e869 100644 --- a/frame/sudo/src/lib.rs +++ b/frame/sudo/src/lib.rs @@ -88,12 +88,12 @@ #![cfg_attr(not(feature = "std"), no_std)] use sp_std::prelude::*; -use sp_runtime::{DispatchResult, traits::{StaticLookup, Dispatchable}}; +use sp_runtime::{DispatchResult, traits::StaticLookup}; use frame_support::{ Parameter, decl_module, decl_event, decl_storage, decl_error, ensure, }; -use frame_support::weights::{Weight, GetDispatchInfo}; +use frame_support::{weights::{Weight, GetDispatchInfo}, traits::UnfilteredDispatchable}; use frame_system::{self as system, ensure_signed}; #[cfg(test)] @@ -106,7 +106,7 @@ pub trait Trait: frame_system::Trait { type Event: From> + Into<::Event>; /// A sudo-able call. - type Call: Parameter + Dispatchable + GetDispatchInfo; + type Call: Parameter + UnfilteredDispatchable + GetDispatchInfo; } decl_module! { @@ -132,7 +132,7 @@ decl_module! { let sender = ensure_signed(origin)?; ensure!(sender == Self::key(), Error::::RequireSudo); - let res = call.dispatch(frame_system::RawOrigin::Root.into()); + let res = call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()); Self::deposit_event(RawEvent::Sudid(res.map(|_| ()).map_err(|e| e.error))); } @@ -152,7 +152,7 @@ decl_module! { let sender = ensure_signed(origin)?; ensure!(sender == Self::key(), Error::::RequireSudo); - let res = call.dispatch(frame_system::RawOrigin::Root.into()); + let res = call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()); Self::deposit_event(RawEvent::Sudid(res.map(|_| ()).map_err(|e| e.error))); } @@ -195,7 +195,7 @@ decl_module! { let who = T::Lookup::lookup(who)?; - let res = match call.dispatch(frame_system::RawOrigin::Signed(who).into()) { + let res = match call.dispatch_bypass_filter(frame_system::RawOrigin::Signed(who).into()) { Ok(_) => true, Err(e) => { sp_runtime::print(e); diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 73c3609d3f..3bf67f581b 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -24,10 +24,11 @@ use frame_support::{ }; use sp_core::H256; // The testing primitives are very useful for avoiding having to work with signatures -// or public keys. +// or public keys. use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; use sp_io; use crate as sudo; +use frame_support::traits::Filter; // Logger module to track execution. pub mod logger { @@ -58,7 +59,7 @@ pub mod logger { #[weight = *weight] fn privileged_i32_log(origin, i: i32, weight: Weight){ - // Ensure that the `origin` is `Root`. + // Ensure that the `origin` is `Root`. ensure_root(origin)?; ::append(i); Self::deposit_event(RawEvent::AppendI32(i, weight)); @@ -66,7 +67,7 @@ pub mod logger { #[weight = *weight] fn non_privileged_log(origin, i: i32, weight: Weight){ - // Ensure that the `origin` is some signed account. + // Ensure that the `origin` is some signed account. let sender = ensure_signed(origin)?; ::append(i); >::append(sender.clone()); @@ -112,8 +113,15 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } +pub struct BlockEverything; +impl Filter for BlockEverything { + fn filter(_: &Call) -> bool { + false + } +} + impl frame_system::Trait for Test { - type BaseCallFilter = (); + type BaseCallFilter = BlockEverything; type Origin = Origin; type Call = Call; type Index = u64; @@ -121,7 +129,7 @@ impl frame_system::Trait for Test { type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; - type Lookup = IdentityLookup; + type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; type BlockHashCount = BlockHashCount; -- GitLab From 17be6fd5e5dec2b358dbffa9ce07e4bc1d3e01e2 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Wed, 17 Jun 2020 12:24:32 +0200 Subject: [PATCH 177/280] Stored call in multisig (#6319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Stored call in multisig * Docs. * Benchmarks. * Fix * Update frame/multisig/src/lib.rs Co-authored-by: Bastian Köcher * patch benchmarks * Minor grumbles. * Update as_multi weight * Fixes and refactoring. * Split out threshold=1 and opaquify Call. * Compiles, tests pass, weights are broken * Update benchmarks, add working tests * Add benchmark to threshold 1, add event too * suppress warning for now * @xlc improvment nit * Update weight and tests * Test for weight check * Fix line width * one more line width error * Apply suggestions from code review Co-authored-by: Alexander Popiak * fix merge * more @apopiak feedback * Multisig handles no preimage * Optimize return weight after dispatch * Error on failed deposit. Co-authored-by: Bastian Köcher Co-authored-by: Shawn Tabrizi Co-authored-by: Alexander Popiak --- frame/multisig/src/benchmarking.rs | 176 +++++++++-- frame/multisig/src/lib.rs | 475 +++++++++++++++++++---------- frame/multisig/src/tests.rs | 295 ++++++++++++++---- 3 files changed, 708 insertions(+), 238 deletions(-) diff --git a/frame/multisig/src/benchmarking.rs b/frame/multisig/src/benchmarking.rs index fa2ec52e6b..9479c16cb2 100644 --- a/frame/multisig/src/benchmarking.rs +++ b/frame/multisig/src/benchmarking.rs @@ -22,14 +22,15 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account}; -use sp_runtime::traits::Saturating; +use sp_runtime::traits::{Bounded, Saturating}; +use core::convert::TryInto; use crate::Module as Multisig; const SEED: u32 = 0; fn setup_multi(s: u32, z: u32) - -> Result<(Vec, Box<::Call>), &'static str> + -> Result<(Vec, Vec), &'static str> { let mut signatories: Vec = Vec::new(); for i in 0 .. s { @@ -41,36 +42,79 @@ fn setup_multi(s: u32, z: u32) signatories.push(signatory); } signatories.sort(); - let call: Box<::Call> = Box::new(frame_system::Call::remark(vec![0; z as usize]).into()); - return Ok((signatories, call)) + // Must first convert to outer call type. + let call: ::Call = frame_system::Call::::remark(vec![0; z as usize]).into(); + let call_data = call.encode(); + return Ok((signatories, call_data)) } benchmarks! { _ { } + as_multi_threshold_1 { + // Transaction Length + let z in 0 .. 10_000; + let max_signatories = T::MaxSignatories::get().into(); + let (mut signatories, _) = setup_multi::(max_signatories, z)?; + let call: ::Call = frame_system::Call::::remark(vec![0; z as usize]).into(); + let call_hash = call.using_encoded(blake2_256); + let multi_account_id = Multisig::::multi_account_id(&signatories, 1); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + }: _(RawOrigin::Signed(caller.clone()), signatories, Box::new(call)) + verify { + // If the benchmark resolves, then the call was dispatched successfully. + } + as_multi_create { // Signatories, need at least 2 total people let s in 2 .. T::MaxSignatories::get() as u32; // Transaction Length let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; + let call_hash = blake2_256(&call); + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call) + }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, false, 0) + verify { + assert!(Multisigs::::contains_key(multi_account_id, call_hash)); + } - as_multi_approve { - // Signatories, need at least 2 people + as_multi_create_store { + // Signatories, need at least 2 total people let s in 2 .. T::MaxSignatories::get() as u32; // Transaction Length let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; + let call_hash = blake2_256(&call); + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, true, 0) + verify { + assert!(Multisigs::::contains_key(multi_account_id, call_hash)); + assert!(Calls::::contains_key(call_hash)); + } + + as_multi_approve { + // Signatories, need at least 3 people (so we don't complete the multisig) + let s in 3 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let call_hash = blake2_256(&call); + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; // before the call, get the timepoint let timepoint = Multisig::::timepoint(); - // Create the multi - Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + // Create the multi, storing for worst case + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?; let caller2 = signatories2.remove(0); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, 0) + verify { + let multisig = Multisigs::::get(multi_account_id, call_hash).ok_or("multisig not created")?; + assert_eq!(multisig.approvals.len(), 2); + } as_multi_complete { // Signatories, need at least 2 people @@ -78,21 +122,27 @@ benchmarks! { // Transaction Length let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; + let call_hash = blake2_256(&call); + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; // before the call, get the timepoint let timepoint = Multisig::::timepoint(); - // Create the multi - Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + // Create the multi, storing it for worst case + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?; // Everyone except the first person approves for i in 1 .. s - 1 { let mut signatories_loop = signatories2.clone(); let caller_loop = signatories_loop.remove(i as usize); let o = RawOrigin::Signed(caller_loop).into(); - Multisig::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone())?; + Multisig::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, 0)?; } let caller2 = signatories2.remove(0); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call) + assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, Weight::max_value()) + verify { + assert!(!Multisigs::::contains_key(&multi_account_id, call_hash)); + } approve_as_multi_create { // Signatories, need at least 2 people @@ -100,10 +150,14 @@ benchmarks! { // Transaction Length let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); + let call_hash = blake2_256(&call); // Create the multi - }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash) + }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash, 0) + verify { + assert!(Multisigs::::contains_key(multi_account_id, call_hash)); + } approve_as_multi_approve { // Signatories, need at least 2 people @@ -112,14 +166,63 @@ benchmarks! { let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; let mut signatories2 = signatories.clone(); + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); + let call_hash = blake2_256(&call); // before the call, get the timepoint let timepoint = Multisig::::timepoint(); // Create the multi - Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone())?; + Multisig::::as_multi( + RawOrigin::Signed(caller.clone()).into(), + s as u16, + signatories, + None, + call.clone(), + false, + 0 + )?; let caller2 = signatories2.remove(0); - }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash) + }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash, 0) + verify { + let multisig = Multisigs::::get(multi_account_id, call_hash).ok_or("multisig not created")?; + assert_eq!(multisig.approvals.len(), 2); + } + + approve_as_multi_complete { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); + let mut signatories2 = signatories.clone(); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + let call_hash = blake2_256(&call); + // before the call, get the timepoint + let timepoint = Multisig::::timepoint(); + // Create the multi + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?; + // Everyone except the first person approves + for i in 1 .. s - 1 { + let mut signatories_loop = signatories2.clone(); + let caller_loop = signatories_loop.remove(i as usize); + let o = RawOrigin::Signed(caller_loop).into(); + Multisig::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, 0)?; + } + let caller2 = signatories2.remove(0); + assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); + }: approve_as_multi( + RawOrigin::Signed(caller2), + s as u16, + signatories2, + Some(timepoint), + call_hash, + Weight::max_value() + ) + verify { + assert!(!Multisigs::::contains_key(multi_account_id, call_hash)); + } cancel_as_multi { // Signatories, need at least 2 people @@ -127,13 +230,40 @@ benchmarks! { // Transaction Length let z in 0 .. 10_000; let (mut signatories, call) = setup_multi::(s, z)?; + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - let call_hash = call.using_encoded(blake2_256); + let call_hash = blake2_256(&call); let timepoint = Multisig::::timepoint(); // Create the multi let o = RawOrigin::Signed(caller.clone()).into(); - Multisig::::as_multi(o, s as u16, signatories.clone(), None, call.clone())?; + Multisig::::as_multi(o, s as u16, signatories.clone(), None, call.clone(), true, 0)?; + assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); }: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) + verify { + assert!(!Multisigs::::contains_key(multi_account_id, call_hash)); + } + + cancel_as_multi_store { + // Signatories, need at least 2 people + let s in 2 .. T::MaxSignatories::get() as u32; + // Transaction Length + let z in 0 .. 10_000; + let (mut signatories, call) = setup_multi::(s, z)?; + let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + let call_hash = blake2_256(&call); + let timepoint = Multisig::::timepoint(); + // Create the multi + let o = RawOrigin::Signed(caller.clone()).into(); + Multisig::::as_multi(o, s as u16, signatories.clone(), None, call.clone(), true, 0)?; + assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); + assert!(Calls::::contains_key(call_hash)); + }: cancel_as_multi(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) + verify { + assert!(!Multisigs::::contains_key(&multi_account_id, call_hash)); + assert!(!Calls::::contains_key(call_hash)); + } } #[cfg(test)] @@ -145,12 +275,16 @@ mod tests { #[test] fn test_benchmarks() { new_test_ext().execute_with(|| { + assert_ok!(test_benchmark_as_multi_threshold_1::()); assert_ok!(test_benchmark_as_multi_create::()); + assert_ok!(test_benchmark_as_multi_create_store::()); assert_ok!(test_benchmark_as_multi_approve::()); assert_ok!(test_benchmark_as_multi_complete::()); assert_ok!(test_benchmark_approve_as_multi_create::()); assert_ok!(test_benchmark_approve_as_multi_approve::()); + assert_ok!(test_benchmark_approve_as_multi_complete::()); assert_ok!(test_benchmark_cancel_as_multi::()); + assert_ok!(test_benchmark_cancel_as_multi_store::()); }); } } diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs index 672e6bed20..50bd96aca3 100644 --- a/frame/multisig/src/lib.rs +++ b/frame/multisig/src/lib.rs @@ -51,11 +51,11 @@ use codec::{Encode, Decode}; use sp_io::hashing::blake2_256; use frame_support::{decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, RuntimeDebug}; use frame_support::{traits::{Get, ReservableCurrency, Currency}, - weights::{Weight, GetDispatchInfo, DispatchClass, Pays}, + weights::{Weight, GetDispatchInfo, constants::{WEIGHT_PER_NANOS, WEIGHT_PER_MICROS}}, dispatch::{DispatchResultWithPostInfo, DispatchErrorWithPostInfo, PostDispatchInfo}, }; -use frame_system::{self as system, ensure_signed}; -use sp_runtime::{DispatchError, DispatchResult, traits::Dispatchable}; +use frame_system::{self as system, ensure_signed, RawOrigin}; +use sp_runtime::{DispatchError, DispatchResult, traits::{Dispatchable, Zero}}; mod tests; mod benchmarking; @@ -74,10 +74,12 @@ pub trait Trait: frame_system::Trait { /// The currency mechanism. type Currency: ReservableCurrency; - /// The base amount of currency needed to reserve for creating a multisig execution. + /// The base amount of currency needed to reserve for creating a multisig execution or to store + /// a dispatch call for later. /// /// This is held for an additional storage item whose value size is - /// `4 + sizeof((BlockNumber, Balance, AccountId))` bytes. + /// `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is + /// `32 + sizeof(AccountId)` bytes. type DepositBase: Get>; /// The amount of currency needed per unit threshold when creating a multisig execution. @@ -119,13 +121,15 @@ decl_storage! { pub Multisigs: double_map hasher(twox_64_concat) T::AccountId, hasher(blake2_128_concat) [u8; 32] => Option, T::AccountId>>; + + pub Calls: map hasher(identity) [u8; 32] => Option<(Vec, T::AccountId, BalanceOf)>; } } decl_error! { pub enum Error for Module { - /// Threshold is too low (zero). - ZeroThreshold, + /// Threshold must be 2 or greater. + MinimumThreshold, /// Call is already approved by this signatory. AlreadyApproved, /// Call doesn't need any (more) approvals. @@ -148,6 +152,10 @@ decl_error! { WrongTimepoint, /// A timepoint was given, yet no multisig operation is underway. UnexpectedTimepoint, + /// The maximum weight information provided was too low. + WeightTooLow, + /// The data to be stored is already stored. + AlreadyStored, } } @@ -176,22 +184,50 @@ decl_event! { mod weight_of { use super::*; + /// - Base Weight: 33.72 + 0.002 * Z µs + /// - DB Weight: None + /// - Plus Call Weight + pub fn as_multi_threshold_1( + call_len: usize, + call_weight: Weight, + ) -> Weight { + (34 * WEIGHT_PER_MICROS) + .saturating_add((2 * WEIGHT_PER_NANOS).saturating_mul(call_len as Weight)) + .saturating_add(call_weight) + } + /// - Base Weight: - /// - Create: 46.55 + 0.089 * S µs - /// - Approve: 34.03 + .112 * S µs - /// - Complete: 40.36 + .225 * S µs + /// - Create: 38.82 + 0.121 * S + .001 * Z µs + /// - Create w/ Store: 54.22 + 0.120 * S + .003 * Z µs + /// - Approve: 29.86 + 0.143 * S + .001 * Z µs + /// - Complete: 39.55 + 0.267 * S + .002 * Z µs /// - DB Weight: - /// - Reads: Multisig Storage, [Caller Account] - /// - Writes: Multisig Storage, [Caller Account] + /// - Reads: Multisig Storage, [Caller Account], Calls, Depositor Account + /// - Writes: Multisig Storage, [Caller Account], Calls, Depositor Account /// - Plus Call Weight - pub fn as_multi(other_sig_len: usize, call_weight: Weight) -> Weight { + pub fn as_multi( + sig_len: usize, + call_len: usize, + call_weight: Weight, + calls_write: bool, + refunded: bool, + ) -> Weight { call_weight - .saturating_add(45_000_000) - .saturating_add((other_sig_len as Weight).saturating_mul(250_000)) - .saturating_add(T::DbWeight::get().reads_writes(1, 1)) + .saturating_add(55 * WEIGHT_PER_MICROS) + .saturating_add((250 * WEIGHT_PER_NANOS).saturating_mul(sig_len as Weight)) + .saturating_add((3 * WEIGHT_PER_NANOS).saturating_mul(call_len as Weight)) + .saturating_add(T::DbWeight::get().reads_writes(1, 1)) // Multisig read/write + .saturating_add(T::DbWeight::get().reads(1)) // Calls read + .saturating_add(T::DbWeight::get().writes(calls_write.into())) // Calls write + .saturating_add(T::DbWeight::get().reads_writes(refunded.into(), refunded.into())) // Deposit refunded } } +enum CallOrHash { + Call(Vec, bool), + Hash([u8; 32]), +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { type Error = Error; @@ -210,6 +246,66 @@ decl_module! { 1_000_000_000 } + /// Immediately dispatch a multi-signature call using a single approval from the caller. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `other_signatories`: The accounts (other than the sender) who are part of the + /// multi-signature, but do not participate in the approval process. + /// - `call`: The call to be executed. + /// + /// Result is equivalent to the dispatched result. + /// + /// # + /// O(Z + C) where Z is the length of the call and C its execution weight. + /// ------------------------------- + /// - Base Weight: 33.72 + 0.002 * Z µs + /// - DB Weight: None + /// - Plus Call Weight + /// # + #[weight = ( + weight_of::as_multi_threshold_1::( + call.using_encoded(|c| c.len()), + call.get_dispatch_info().weight + ), + call.get_dispatch_info().class, + )] + fn as_multi_threshold_1(origin, + other_signatories: Vec, + call: Box<::Call>, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); + let other_signatories_len = other_signatories.len(); + ensure!(other_signatories_len < max_sigs, Error::::TooManySignatories); + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + + let id = Self::multi_account_id(&signatories, 1); + + let call_len = call.using_encoded(|c| c.len()); + let result = call.dispatch(RawOrigin::Signed(id.clone()).into()); + + result.map(|post_dispatch_info| post_dispatch_info.actual_weight + .map(|actual_weight| weight_of::as_multi_threshold_1::( + call_len, + actual_weight, + )) + .into() + ).map_err(|err| match err.post_info.actual_weight { + Some(actual_weight) => { + let weight_used = weight_of::as_multi_threshold_1::( + call_len, + actual_weight, + ); + let post_info = Some(weight_used).into(); + let error = err.error.into(); + DispatchErrorWithPostInfo { post_info, error } + }, + None => err, + }) + } + /// Register approval for a dispatch to be made from a deterministic composite account if /// approved by a total of `threshold - 1` of `other_signatories`. /// @@ -252,99 +348,32 @@ decl_module! { /// `DepositBase + threshold * DepositFactor`. /// ------------------------------- /// - Base Weight: - /// - Create: 46.55 + 0.089 * S µs - /// - Approve: 34.03 + .112 * S µs - /// - Complete: 40.36 + .225 * S µs + /// - Create: 41.89 + 0.118 * S + .002 * Z µs + /// - Create w/ Store: 53.57 + 0.119 * S + .003 * Z µs + /// - Approve: 31.39 + 0.136 * S + .002 * Z µs + /// - Complete: 39.94 + 0.26 * S + .002 * Z µs /// - DB Weight: - /// - Reads: Multisig Storage, [Caller Account] - /// - Writes: Multisig Storage, [Caller Account] + /// - Reads: Multisig Storage, [Caller Account], Calls (if `store_call`) + /// - Writes: Multisig Storage, [Caller Account], Calls (if `store_call`) /// - Plus Call Weight /// # - #[weight = ( - weight_of::as_multi::(other_signatories.len(), call.get_dispatch_info().weight), - call.get_dispatch_info().class, - Pays::Yes, + #[weight = weight_of::as_multi::( + other_signatories.len(), + call.len(), + *max_weight, + true, // assume worst case: calls write + true, // assume worst case: refunded )] fn as_multi(origin, threshold: u16, other_signatories: Vec, maybe_timepoint: Option>, - call: Box<::Call>, + call: Vec, + store_call: bool, + max_weight: Weight, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - ensure!(threshold >= 1, Error::::ZeroThreshold); - let max_sigs = T::MaxSignatories::get() as usize; - ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); - let other_signatories_len = other_signatories.len(); - ensure!(other_signatories_len < max_sigs, Error::::TooManySignatories); - let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; - - let id = Self::multi_account_id(&signatories, threshold); - let call_hash = call.using_encoded(blake2_256); - - if let Some(mut m) = >::get(&id, call_hash) { - let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - if let Err(pos) = m.approvals.binary_search(&who) { - // we know threshold is greater than zero from the above ensure. - if (m.approvals.len() as u16) < threshold - 1 { - m.approvals.insert(pos, who.clone()); - >::insert(&id, call_hash, m); - Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); - // Call is not made, so the actual weight does not include call - return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) - } - } else { - if (m.approvals.len() as u16) < threshold { - Err(Error::::AlreadyApproved)? - } - } - - let result = call.dispatch(frame_system::RawOrigin::Signed(id.clone()).into()); - let _ = T::Currency::unreserve(&m.depositor, m.deposit); - >::remove(&id, call_hash); - Self::deposit_event(RawEvent::MultisigExecuted( - who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error) - )); - return Ok(None.into()) - } else { - ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); - if threshold > 1 { - let deposit = T::DepositBase::get() - + T::DepositFactor::get() * threshold.into(); - T::Currency::reserve(&who, deposit)?; - >::insert(&id, call_hash, Multisig { - when: Self::timepoint(), - deposit, - depositor: who.clone(), - approvals: vec![who.clone()], - }); - Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); - // Call is not made, so we can return that weight - return Ok(Some(weight_of::as_multi::(other_signatories_len, 0)).into()) - } else { - let result = call.dispatch(frame_system::RawOrigin::Signed(id).into()); - match result { - Ok(post_dispatch_info) => { - match post_dispatch_info.actual_weight { - Some(actual_weight) => return Ok(Some(weight_of::as_multi::(other_signatories_len, actual_weight)).into()), - None => return Ok(None.into()), - } - }, - Err(err) => { - match err.post_info.actual_weight { - Some(actual_weight) => { - let weight_used = weight_of::as_multi::(other_signatories_len, actual_weight); - return Err(DispatchErrorWithPostInfo { post_info: Some(weight_used).into(), error: err.error.into() }) - }, - None => { - return Err(err) - } - } - } - } - } - } + Self::operate(who, threshold, other_signatories, maybe_timepoint, CallOrHash::Call(call, store_call), max_weight) } /// Register approval for a dispatch to be made from a deterministic composite account if @@ -386,57 +415,22 @@ decl_module! { /// - Read: Multisig Storage, [Caller Account] /// - Write: Multisig Storage, [Caller Account] /// # - #[weight = ( - T::DbWeight::get().reads_writes(1, 1) - .saturating_add(45_000_000) - .saturating_add((other_signatories.len() as Weight).saturating_mul(120_000)), - DispatchClass::Normal, - Pays::Yes, + #[weight = weight_of::as_multi::( + other_signatories.len(), + 0, // call_len is zero in this case + *max_weight, + true, // assume worst case: calls write + true, // assume worst case: refunded )] fn approve_as_multi(origin, threshold: u16, other_signatories: Vec, maybe_timepoint: Option>, call_hash: [u8; 32], - ) -> DispatchResult { + max_weight: Weight, + ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - ensure!(threshold >= 1, Error::::ZeroThreshold); - let max_sigs = T::MaxSignatories::get() as usize; - ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); - ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); - let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; - - let id = Self::multi_account_id(&signatories, threshold); - - if let Some(mut m) = >::get(&id, call_hash) { - let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - ensure!(m.approvals.len() < threshold as usize, Error::::NoApprovalsNeeded); - if let Err(pos) = m.approvals.binary_search(&who) { - m.approvals.insert(pos, who.clone()); - >::insert(&id, call_hash, m); - Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); - } else { - Err(Error::::AlreadyApproved)? - } - } else { - if threshold > 1 { - ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); - let deposit = T::DepositBase::get() - + T::DepositFactor::get() * threshold.into(); - T::Currency::reserve(&who, deposit)?; - >::insert(&id, call_hash, Multisig { - when: Self::timepoint(), - deposit, - depositor: who.clone(), - approvals: vec![who.clone()], - }); - Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); - } else { - Err(Error::::NoApprovalsNeeded)? - } - } - Ok(()) + Self::operate(who, threshold, other_signatories, maybe_timepoint, CallOrHash::Hash(call_hash), max_weight) } /// Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously @@ -461,18 +455,15 @@ decl_module! { /// - I/O: 1 read `O(S)`, one remove. /// - Storage: removes one item. /// ---------------------------------- - /// - Base Weight: 37.6 + 0.084 * S + /// - Base Weight: 36.07 + 0.124 * S /// - DB Weight: - /// - Read: Multisig Storage, [Caller Account] - /// - Write: Multisig Storage, [Caller Account] + /// - Read: Multisig Storage, [Caller Account], Refund Account, Calls + /// - Write: Multisig Storage, [Caller Account], Refund Account, Calls /// # - #[weight = ( - T::DbWeight::get().reads_writes(1, 1) - .saturating_add(40_000_000) - .saturating_add((other_signatories.len() as Weight).saturating_mul(100_000)), - DispatchClass::Normal, - Pays::Yes, - )] + #[weight = T::DbWeight::get().reads_writes(3, 3) + .saturating_add(36 * WEIGHT_PER_MICROS) + .saturating_add((other_signatories.len() as Weight).saturating_mul(100 * WEIGHT_PER_NANOS)) + ] fn cancel_as_multi(origin, threshold: u16, other_signatories: Vec, @@ -480,7 +471,7 @@ decl_module! { call_hash: [u8; 32], ) -> DispatchResult { let who = ensure_signed(origin)?; - ensure!(threshold >= 1, Error::::ZeroThreshold); + ensure!(threshold >= 2, Error::::MinimumThreshold); let max_sigs = T::MaxSignatories::get() as usize; ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); ensure!(other_signatories.len() < max_sigs, Error::::TooManySignatories); @@ -494,7 +485,8 @@ decl_module! { ensure!(m.depositor == who, Error::::NotOwner); let _ = T::Currency::unreserve(&m.depositor, m.deposit); - >::remove(&id, call_hash); + >::remove(&id, &call_hash); + Self::clear_call(&call_hash); Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id, call_hash)); Ok(()) @@ -512,6 +504,169 @@ impl Module { T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() } + fn operate( + who: T::AccountId, + threshold: u16, + other_signatories: Vec, + maybe_timepoint: Option>, + call_or_hash: CallOrHash, + max_weight: Weight, + ) -> DispatchResultWithPostInfo { + ensure!(threshold >= 2, Error::::MinimumThreshold); + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); + let other_signatories_len = other_signatories.len(); + ensure!(other_signatories_len < max_sigs, Error::::TooManySignatories); + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + + let id = Self::multi_account_id(&signatories, threshold); + + // Threshold > 1; this means it's a multi-step operation. We extract the `call_hash`. + let (call_hash, call_len, maybe_call, store) = match call_or_hash { + CallOrHash::Call(call, should_store) => { + let call_hash = blake2_256(&call); + let call_len = call.len(); + (call_hash, call_len, Some(call), should_store) + } + CallOrHash::Hash(h) => (h, 0, None, false), + }; + + // Branch on whether the operation has already started or not. + if let Some(mut m) = >::get(&id, call_hash) { + // Yes; ensure that the timepoint exists and agrees. + let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; + ensure!(m.when == timepoint, Error::::WrongTimepoint); + + // Ensure that either we have not yet signed or that it is at threshold. + let mut approvals = m.approvals.len() as u16; + // We only bother with the approval if we're below threshold. + let maybe_pos = m.approvals.binary_search(&who).err().filter(|_| approvals < threshold); + // Bump approvals if not yet voted and the vote is needed. + if maybe_pos.is_some() { approvals += 1; } + + // We only bother fetching/decoding call if we know that we're ready to execute. + let maybe_approved_call = if approvals >= threshold { + Self::get_call(&call_hash, maybe_call.as_ref().map(|c| c.as_ref())) + } else { None }; + + if let Some(call) = maybe_approved_call { + // verify weight + ensure!(call.get_dispatch_info().weight <= max_weight, Error::::WeightTooLow); + + let result = call.dispatch(RawOrigin::Signed(id.clone()).into()); + T::Currency::unreserve(&m.depositor, m.deposit); + >::remove(&id, call_hash); + Self::clear_call(&call_hash); + Self::deposit_event(RawEvent::MultisigExecuted( + who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error) + )); + Ok(get_result_weight(result).map(|actual_weight| weight_of::as_multi::( + other_signatories_len, + call_len, + actual_weight, + true, // Call is removed + true, // User is refunded + )).into()) + } else { + // We cannot dispatch the call now; either it isn't available, or it is, but we + // don't have threshold approvals even with our signature. + + // Store the call if desired. + let stored = if let Some(data) = maybe_call.filter(|_| store) { + Self::store_call_and_reserve(who.clone(), &call_hash, data, BalanceOf::::zero())?; + true + } else { + false + }; + + if let Some(pos) = maybe_pos { + // Record approval. + m.approvals.insert(pos, who.clone()); + >::insert(&id, call_hash, m); + Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash)); + } else { + // If we already approved and didn't store the Call, then this was useless and + // we report an error. + ensure!(stored, Error::::AlreadyApproved); + } + + // Call is not made, so the actual weight does not include call + Ok(Some(weight_of::as_multi::( + other_signatories_len, + call_len, + 0, + stored, // Call stored? + false, // No refund + )).into()) + } + } else { + // Not yet started; there should be no timepoint given. + ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); + + // Just start the operation by recording it in storage. + let deposit = T::DepositBase::get() + T::DepositFactor::get() * threshold.into(); + + // Store the call if desired. + let stored = if let Some(data) = maybe_call.filter(|_| store) { + Self::store_call_and_reserve(who.clone(), &call_hash, data, deposit)?; + true + } else { + T::Currency::reserve(&who, deposit)?; + false + }; + + >::insert(&id, call_hash, Multisig { + when: Self::timepoint(), + deposit, + depositor: who.clone(), + approvals: vec![who.clone()], + }); + Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash)); + // Call is not made, so we can return that weight + return Ok(Some(weight_of::as_multi::( + other_signatories_len, + call_len, + 0, + stored, // Call stored? + false, // No refund + )).into()) + } + } + + /// Place a call's encoded data in storage, reserving funds as appropriate. + /// + /// We store `data` here because storing `call` would result in needing another `.encode`. + /// + /// Returns a `bool` indicating whether the data did end up being stored. + fn store_call_and_reserve(who: T::AccountId, hash: &[u8; 32], data: Vec, other_deposit: BalanceOf) + -> DispatchResult + { + ensure!(!Calls::::contains_key(hash), Error::::AlreadyStored); + let deposit = other_deposit + T::DepositBase::get() + + T::DepositFactor::get() * BalanceOf::::from(((data.len() + 31) / 32) as u32); + T::Currency::reserve(&who, deposit)?; + Calls::::insert(&hash, (data, who, deposit)); + Ok(()) + } + + /// Attempt to decode and return the call, provided by the user or from storage. + fn get_call(hash: &[u8; 32], maybe_known: Option<&[u8]>) -> Option<::Call> { + maybe_known.map_or_else(|| { + Calls::::get(hash).and_then(|(data, ..)| { + Decode::decode(&mut &data[..]).ok() + }) + }, |data| { + Decode::decode(&mut &data[..]).ok() + }) + } + + /// Attempt to remove a call from storage, returning any deposit on it to the owner. + fn clear_call(hash: &[u8; 32]) { + if let Some((_, who, deposit)) = Calls::::take(hash) { + T::Currency::unreserve(&who, deposit); + } + } + /// The current `Timepoint`. pub fn timepoint() -> Timepoint { Timepoint { @@ -541,3 +696,13 @@ impl Module { Ok(signatories) } } + +/// Return the weight of a dispatch call result as an `Option`. +/// +/// Will return the weight regardless of what the state of the result is. +fn get_result_weight(result: DispatchResultWithPostInfo) -> Option { + match result { + Ok(post_info) => post_info.actual_weight, + Err(err) => err.post_info.actual_weight, + } +} diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index 4b1395476d..4911ca90cf 100644 --- a/frame/multisig/src/tests.rs +++ b/frame/multisig/src/tests.rs @@ -156,24 +156,79 @@ fn multisig_deposit_is_taken_and_returned() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data.clone(), false, 0)); assert_eq!(Balances::free_balance(1), 2); assert_eq!(Balances::reserved_balance(1), 3); - assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), data, false, call_weight)); assert_eq!(Balances::free_balance(1), 5); assert_eq!(Balances::reserved_balance(1), 0); }); } +#[test] +fn multisig_deposit_is_taken_and_returned_with_call_storage() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data, true, 0)); + assert_eq!(Balances::free_balance(1), 0); + assert_eq!(Balances::reserved_balance(1), 5); + + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash, call_weight)); + assert_eq!(Balances::free_balance(1), 5); + assert_eq!(Balances::reserved_balance(1), 0); + }); +} + +#[test] +fn multisig_deposit_is_taken_and_returned_with_alt_call_storage() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 3); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_eq!(Balances::free_balance(1), 1); + assert_eq!(Balances::reserved_balance(1), 4); + + assert_ok!(Multisig::as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), data, true, 0)); + assert_eq!(Balances::free_balance(2), 3); + assert_eq!(Balances::reserved_balance(2), 2); + assert_eq!(Balances::free_balance(1), 1); + assert_eq!(Balances::reserved_balance(1), 4); + + assert_ok!(Multisig::approve_as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), hash, call_weight)); + assert_eq!(Balances::free_balance(1), 5); + assert_eq!(Balances::reserved_balance(1), 0); + assert_eq!(Balances::free_balance(2), 5); + assert_eq!(Balances::reserved_balance(2), 0); + }); +} + #[test] fn cancel_multisig_returns_deposit() { new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone(), 0)); assert_eq!(Balances::free_balance(1), 6); assert_eq!(Balances::reserved_balance(1), 4); assert_ok!( @@ -192,28 +247,48 @@ fn timepoint_checking_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); assert_noop!( - Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone()), + Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone(), 0), Error::::UnexpectedTimepoint, ); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0)); assert_noop!( - Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, call.clone()), + Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, call.clone(), false, 0), Error::::NoTimepoint, ); let later = Timepoint { index: 1, .. now() }; assert_noop!( - Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(later), call.clone()), + Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(later), call.clone(), false, 0), Error::::WrongTimepoint, ); }); } +#[test] +fn multisig_2_of_3_works_with_call_storing() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data, true, 0)); + assert_eq!(Balances::free_balance(6), 0); + + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash, call_weight)); + assert_eq!(Balances::free_balance(6), 15); + }); +} + #[test] fn multisig_2_of_3_works() { new_test_ext().execute_with(|| { @@ -222,12 +297,14 @@ fn multisig_2_of_3_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash)); + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0)); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), data, false, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -240,13 +317,15 @@ fn multisig_3_of_3_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone(), 0)); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), call)); + assert_ok!(Multisig::as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), data, false, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -254,10 +333,10 @@ fn multisig_3_of_3_works() { #[test] fn cancel_multisig_works() { new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone())); - assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone(), 0)); assert_noop!( Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()), Error::::NotOwner, @@ -268,6 +347,40 @@ fn cancel_multisig_works() { }); } +#[test] +fn cancel_multisig_with_call_storage_works() { + new_test_ext().execute_with(|| { + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); + assert_ok!(Multisig::as_multi(Origin::signed(1), 3, vec![2, 3], None, call, true, 0)); + assert_eq!(Balances::free_balance(1), 4); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone(), 0)); + assert_noop!( + Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()), + Error::::NotOwner, + ); + assert_ok!( + Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash.clone()), + ); + assert_eq!(Balances::free_balance(1), 10); + }); +} + +#[test] +fn cancel_multisig_with_alt_call_storage_works() { + new_test_ext().execute_with(|| { + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_eq!(Balances::free_balance(1), 6); + assert_ok!(Multisig::as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), call, true, 0)); + assert_eq!(Balances::free_balance(2), 8); + assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash)); + assert_eq!(Balances::free_balance(1), 10); + assert_eq!(Balances::free_balance(2), 10); + }); +} + #[test] fn multisig_2_of_3_as_multi_works() { new_test_ext().execute_with(|| { @@ -276,11 +389,13 @@ fn multisig_2_of_3_as_multi_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data.clone(), false, 0)); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call)); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), data, false, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -293,13 +408,17 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call1 = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); - let call2 = Box::new(Call::Balances(BalancesCall::transfer(7, 5))); + let call1 = Call::Balances(BalancesCall::transfer(6, 10)); + let call1_weight = call1.get_dispatch_info().weight; + let data1 = call1.encode(); + let call2 = Call::Balances(BalancesCall::transfer(7, 5)); + let call2_weight = call2.get_dispatch_info().weight; + let data2 = call2.encode(); - assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call1.clone())); - assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, call2.clone())); - assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call2)); - assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call1)); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data1.clone(), false, 0)); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], None, data2.clone(), false, 0)); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), data1, false, call1_weight)); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), data2, false, call2_weight)); assert_eq!(Balances::free_balance(6), 10); assert_eq!(Balances::free_balance(7), 5); @@ -314,26 +433,33 @@ fn multisig_2_of_3_cannot_reissue_same_call() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 10))); - assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), call.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 10)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data.clone(), false, 0)); + assert_ok!(Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), data.clone(), false, call_weight)); assert_eq!(Balances::free_balance(multi), 5); - assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone())); - assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call.clone())); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data.clone(), false, 0)); + assert_ok!(Multisig::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), data.clone(), false, call_weight)); let err = DispatchError::from(BalancesError::::InsufficientBalance).stripped(); - expect_event(RawEvent::MultisigExecuted(3, now(), multi, call.using_encoded(blake2_256), Err(err))); + expect_event(RawEvent::MultisigExecuted(3, now(), multi, hash, Err(err))); }); } #[test] -fn zero_threshold_fails() { +fn minimum_threshold_check_works() { new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + assert_noop!( + Multisig::as_multi(Origin::signed(1), 0, vec![2], None, call.clone(), false, 0), + Error::::MinimumThreshold, + ); assert_noop!( - Multisig::as_multi(Origin::signed(1), 0, vec![2], None, call), - Error::::ZeroThreshold, + Multisig::as_multi(Origin::signed(1), 1, vec![2], None, call.clone(), false, 0), + Error::::MinimumThreshold, ); }); } @@ -341,9 +467,9 @@ fn zero_threshold_fails() { #[test] fn too_many_signatories_fails() { new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); assert_noop!( - Multisig::as_multi(Origin::signed(1), 2, vec![2, 3, 4], None, call.clone()), + Multisig::as_multi(Origin::signed(1), 2, vec![2, 3, 4], None, call.clone(), false, 0), Error::::TooManySignatories, ); }); @@ -352,17 +478,17 @@ fn too_many_signatories_fails() { #[test] fn duplicate_approvals_are_ignored() { new_test_ext().execute_with(|| { - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); - assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash.clone())); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash.clone(), 0)); assert_noop!( - Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash.clone()), + Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash.clone(), 0), Error::::AlreadyApproved, ); - assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone())); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash.clone(), 0)); assert_noop!( - Multisig::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash.clone()), - Error::::NoApprovalsNeeded, + Multisig::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash.clone(), 0), + Error::::AlreadyApproved, ); }); } @@ -375,17 +501,18 @@ fn multisig_1_of_3_works() { assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); - let call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); - let hash = call.using_encoded(blake2_256); + let call = Call::Balances(BalancesCall::transfer(6, 15)).encode(); + let hash = blake2_256(&call); assert_noop!( - Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash.clone()), - Error::::NoApprovalsNeeded, + Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash.clone(), 0), + Error::::MinimumThreshold, ); assert_noop!( - Multisig::as_multi(Origin::signed(4), 1, vec![2, 3], None, call.clone()), - BalancesError::::InsufficientBalance, + Multisig::as_multi(Origin::signed(1), 1, vec![2, 3], None, call.clone(), false, 0), + Error::::MinimumThreshold, ); - assert_ok!(Multisig::as_multi(Origin::signed(1), 1, vec![2, 3], None, call)); + let boxed_call = Box::new(Call::Balances(BalancesCall::transfer(6, 15))); + assert_ok!(Multisig::as_multi_threshold_1(Origin::signed(1), vec![2, 3], boxed_call)); assert_eq!(Balances::free_balance(6), 15); }); @@ -396,8 +523,52 @@ fn multisig_filters() { new_test_ext().execute_with(|| { let call = Box::new(Call::System(frame_system::Call::set_code(vec![]))); assert_noop!( - Multisig::as_multi(Origin::signed(1), 1, vec![2], None, call.clone()), + Multisig::as_multi_threshold_1(Origin::signed(1), vec![2], call.clone()), DispatchError::BadOrigin, ); }); } + +#[test] +fn weight_check_works() { + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let data = call.encode(); + assert_ok!(Multisig::as_multi(Origin::signed(1), 2, vec![2, 3], None, data.clone(), false, 0)); + assert_eq!(Balances::free_balance(6), 0); + + assert_noop!( + Multisig::as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), data, false, 0), + Error::::WeightTooLow, + ); + }); +} + +#[test] +fn multisig_handles_no_preimage_after_all_approve() { + // This test checks the situation where everyone approves a multi-sig, but no-one provides the call data. + // In the end, any of the multisig callers can approve again with the call data and the call will go through. + new_test_ext().execute_with(|| { + let multi = Multisig::multi_account_id(&[1, 2, 3][..], 3); + assert_ok!(Balances::transfer(Origin::signed(1), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(2), multi, 5)); + assert_ok!(Balances::transfer(Origin::signed(3), multi, 5)); + + let call = Call::Balances(BalancesCall::transfer(6, 15)); + let call_weight = call.get_dispatch_info().weight; + let data = call.encode(); + let hash = blake2_256(&data); + assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash.clone(), 0)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(2), 3, vec![1, 3], Some(now()), hash.clone(), 0)); + assert_ok!(Multisig::approve_as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), hash.clone(), 0)); + assert_eq!(Balances::free_balance(6), 0); + + assert_ok!(Multisig::as_multi(Origin::signed(3), 3, vec![1, 2], Some(now()), data, false, call_weight)); + assert_eq!(Balances::free_balance(6), 15); + }); +} -- GitLab From 0c42cedaac0b1bf3a608031ee3e494b51bfaa0fe Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Wed, 17 Jun 2020 15:20:17 +0200 Subject: [PATCH 178/280] Fix the broken weight multiplier update function (#6334) * Initial draft, has some todos left * remove ununsed import * Apply suggestions from code review * Some refactors with migration * Fix more test and cleanup * Fix for companion * Apply suggestions from code review Co-authored-by: Alexander Popiak * Update bin/node/runtime/src/impls.rs * Fix weight * Add integrity test * length is not affected. Co-authored-by: Alexander Popiak --- Cargo.lock | 1 + bin/node/executor/tests/basic.rs | 55 ++--- bin/node/executor/tests/fees.rs | 12 +- bin/node/runtime/src/impls.rs | 294 +++++++++++----------- bin/node/runtime/src/lib.rs | 21 +- frame/balances/src/tests.rs | 7 +- frame/system/src/lib.rs | 2 +- frame/transaction-payment/Cargo.toml | 2 + frame/transaction-payment/src/lib.rs | 296 +++++++++++++++++++---- primitives/arithmetic/src/fixed_point.rs | 17 ++ 10 files changed, 456 insertions(+), 251 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4761c859f8..aeacd6e353 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4587,6 +4587,7 @@ dependencies = [ "pallet-balances", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", + "serde", "smallvec 1.4.0", "sp-core", "sp-io", diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 2bb444b47c..e4de98d90e 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -19,14 +19,11 @@ use codec::{Encode, Decode, Joiner}; use frame_support::{ StorageValue, StorageMap, traits::Currency, - weights::{ - GetDispatchInfo, DispatchInfo, DispatchClass, constants::ExtrinsicBaseWeight, - WeightToFeePolynomial, - }, + weights::{GetDispatchInfo, DispatchInfo, DispatchClass}, }; use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys}; use sp_runtime::{ - ApplyExtrinsicResult, FixedI128, FixedPointNumber, + ApplyExtrinsicResult, traits::Hash as HashT, transaction_validity::InvalidTransaction, }; @@ -35,7 +32,7 @@ use frame_system::{self, EventRecord, Phase}; use node_runtime::{ Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances, - System, TransactionPayment, Event, TransactionByteFee, + System, TransactionPayment, Event, constants::currency::*, }; use node_primitives::{Balance, Hash}; @@ -52,16 +49,17 @@ use self::common::{*, sign}; /// test code paths that differ between native and wasm versions. pub const BLOATY_CODE: &[u8] = node_runtime::WASM_BINARY_BLOATY; -/// Default transfer fee -fn transfer_fee(extrinsic: &E, fee_multiplier: FixedI128) -> Balance { - let length_fee = TransactionByteFee::get() * (extrinsic.encode().len() as Balance); - - let base_weight = ExtrinsicBaseWeight::get(); - let base_fee = ::WeightToFee::calc(&base_weight); - let weight = default_transfer_call().get_dispatch_info().weight; - let weight_fee = ::WeightToFee::calc(&weight); - - base_fee + fee_multiplier.saturating_mul_acc_int(length_fee + weight_fee) +/// Default transfer fee. This will use the same logic that is implemented in transaction-payment module. +/// +/// Note that reads the multiplier from storage directly, hence to get the fee of `extrinsic` +/// at block `n`, it must be called prior to executing block `n` to do the calculation with the +/// correct multiplier. +fn transfer_fee(extrinsic: &E) -> Balance { + TransactionPayment::compute_fee( + extrinsic.encode().len() as u32, + &default_transfer_call().get_dispatch_info(), + 0, + ) } fn xt() -> UncheckedExtrinsic { @@ -242,7 +240,7 @@ fn successful_execution_with_native_equivalent_code_gives_ok() { ).0; assert!(r.is_ok()); - let fm = t.execute_with(TransactionPayment::next_fee_multiplier); + let fees = t.execute_with(|| transfer_fee(&xt())); let r = executor_call:: _>( &mut t, @@ -254,7 +252,6 @@ fn successful_execution_with_native_equivalent_code_gives_ok() { assert!(r.is_ok()); t.execute_with(|| { - let fees = transfer_fee(&xt(), fm); assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees); assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS); }); @@ -286,7 +283,7 @@ fn successful_execution_with_foreign_code_gives_ok() { ).0; assert!(r.is_ok()); - let fm = t.execute_with(TransactionPayment::next_fee_multiplier); + let fees = t.execute_with(|| transfer_fee(&xt())); let r = executor_call:: _>( &mut t, @@ -298,7 +295,6 @@ fn successful_execution_with_foreign_code_gives_ok() { assert!(r.is_ok()); t.execute_with(|| { - let fees = transfer_fee(&xt(), fm); assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees); assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS); }); @@ -311,7 +307,7 @@ fn full_native_block_import_works() { let (block1, block2) = blocks(); let mut alice_last_known_balance: Balance = Default::default(); - let mut fm = t.execute_with(TransactionPayment::next_fee_multiplier); + let mut fees = t.execute_with(|| transfer_fee(&xt())); executor_call:: _>( &mut t, @@ -322,7 +318,6 @@ fn full_native_block_import_works() { ).0.unwrap(); t.execute_with(|| { - let fees = transfer_fee(&xt(), fm); assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees); assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS); alice_last_known_balance = Balances::total_balance(&alice()); @@ -361,7 +356,7 @@ fn full_native_block_import_works() { assert_eq!(System::events(), events); }); - fm = t.execute_with(TransactionPayment::next_fee_multiplier); + fees = t.execute_with(|| transfer_fee(&xt())); executor_call:: _>( &mut t, @@ -372,7 +367,6 @@ fn full_native_block_import_works() { ).0.unwrap(); t.execute_with(|| { - let fees = transfer_fee(&xt(), fm); assert_eq!( Balances::total_balance(&alice()), alice_last_known_balance - 10 * DOLLARS - fees, @@ -450,7 +444,7 @@ fn full_wasm_block_import_works() { let (block1, block2) = blocks(); let mut alice_last_known_balance: Balance = Default::default(); - let mut fm = t.execute_with(TransactionPayment::next_fee_multiplier); + let mut fees = t.execute_with(|| transfer_fee(&xt())); executor_call:: _>( &mut t, @@ -461,12 +455,12 @@ fn full_wasm_block_import_works() { ).0.unwrap(); t.execute_with(|| { - assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt(), fm)); + assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees); assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS); alice_last_known_balance = Balances::total_balance(&alice()); }); - fm = t.execute_with(TransactionPayment::next_fee_multiplier); + fees = t.execute_with(|| transfer_fee(&xt())); executor_call:: _>( &mut t, @@ -479,11 +473,11 @@ fn full_wasm_block_import_works() { t.execute_with(|| { assert_eq!( Balances::total_balance(&alice()), - alice_last_known_balance - 10 * DOLLARS - transfer_fee(&xt(), fm), + alice_last_known_balance - 10 * DOLLARS - fees, ); assert_eq!( Balances::total_balance(&bob()), - 179 * DOLLARS - 1 * transfer_fee(&xt(), fm), + 179 * DOLLARS - 1 * fees, ); }); } @@ -755,7 +749,7 @@ fn successful_execution_gives_ok() { assert_eq!(Balances::total_balance(&alice()), 111 * DOLLARS); }); - let fm = t.execute_with(TransactionPayment::next_fee_multiplier); + let fees = t.execute_with(|| transfer_fee(&xt())); let r = executor_call:: _>( &mut t, @@ -770,7 +764,6 @@ fn successful_execution_gives_ok() { .expect("Extrinsic failed"); t.execute_with(|| { - let fees = transfer_fee(&xt(), fm); assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees); assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS); }); diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs index 280408357e..8f828263c5 100644 --- a/bin/node/executor/tests/fees.rs +++ b/bin/node/executor/tests/fees.rs @@ -22,9 +22,9 @@ use frame_support::{ weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial}, }; use sp_core::NeverNativeValue; -use sp_runtime::{FixedPointNumber, FixedI128, Perbill}; +use sp_runtime::{Perbill, FixedPointNumber}; use node_runtime::{ - CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, + CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, Multiplier, TransactionByteFee, constants::currency::*, }; @@ -38,8 +38,8 @@ use self::common::{*, sign}; fn fee_multiplier_increases_and_decreases_on_big_weight() { let mut t = new_test_ext(COMPACT_CODE, false); - // initial fee multiplier must be zero - let mut prev_multiplier = FixedI128::from_inner(0); + // initial fee multiplier must be one. + let mut prev_multiplier = Multiplier::one(); t.execute_with(|| { assert_eq!(TransactionPayment::next_fee_multiplier(), prev_multiplier); @@ -59,7 +59,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() { }, CheckedExtrinsic { signed: Some((charlie(), signed_extra(0, 0))), - function: Call::System(frame_system::Call::fill_block(Perbill::from_percent(90))), + function: Call::System(frame_system::Call::fill_block(Perbill::from_percent(60))), } ] ); @@ -122,7 +122,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() { } #[test] -fn transaction_fee_is_correct_ultimate() { +fn transaction_fee_is_correct() { // This uses the exact values of substrate-node. // // weight of transfer call as of now: 1_000_000 diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index c8f42f3f26..039093ddee 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -18,11 +18,9 @@ //! Some configurable implementations as associated type for the substrate runtime. use node_primitives::Balance; -use sp_runtime::traits::{Convert, Saturating}; -use sp_runtime::{FixedPointNumber, Perquintill}; -use frame_support::traits::{OnUnbalanced, Currency, Get}; -use pallet_transaction_payment::Multiplier; -use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance}; +use sp_runtime::traits::Convert; +use frame_support::traits::{OnUnbalanced, Currency}; +use crate::{Balances, Authorship, NegativeImbalance}; pub struct Author; impl OnUnbalanced for Author { @@ -47,89 +45,63 @@ impl Convert for CurrencyToVoteHandler { fn convert(x: u128) -> Balance { x * Self::factor() } } -/// Update the given multiplier based on the following formula -/// -/// diff = (previous_block_weight - target_weight)/max_weight -/// v = 0.00004 -/// next_weight = weight * (1 + (v * diff) + (v * diff)^2 / 2) -/// -/// Where `target_weight` must be given as the `Get` implementation of the `T` generic type. -/// https://research.web3.foundation/en/latest/polkadot/Token%20Economics/#relay-chain-transaction-fees -pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData); - -impl> Convert for TargetedFeeAdjustment { - fn convert(multiplier: Multiplier) -> Multiplier { - let max_weight = MaximumBlockWeight::get(); - let block_weight = System::block_weight().total().min(max_weight); - let target_weight = (T::get() * max_weight) as u128; - let block_weight = block_weight as u128; - - // determines if the first_term is positive - let positive = block_weight >= target_weight; - let diff_abs = block_weight.max(target_weight) - block_weight.min(target_weight); - // safe, diff_abs cannot exceed u64. - let diff = Multiplier::saturating_from_rational(diff_abs, max_weight.max(1)); - let diff_squared = diff.saturating_mul(diff); - - // 0.00004 = 4/100_000 = 40_000/10^9 - let v = Multiplier::saturating_from_rational(4, 100_000); - // 0.00004^2 = 16/10^10 Taking the future /2 into account... 8/10^10 - let v_squared_2 = Multiplier::saturating_from_rational(8, 10_000_000_000u64); - - let first_term = v.saturating_mul(diff); - let second_term = v_squared_2.saturating_mul(diff_squared); - - if positive { - // Note: this is merely bounded by how big the multiplier and the inner value can go, - // not by any economical reasoning. - let excess = first_term.saturating_add(second_term); - multiplier.saturating_add(excess) - } else { - // Defensive-only: first_term > second_term. Safe subtraction. - let negative = first_term.saturating_sub(second_term); - multiplier.saturating_sub(negative) - // despite the fact that apply_to saturates weight (final fee cannot go below 0) - // it is crucially important to stop here and don't further reduce the weight fee - // multiplier. While at -1, it means that the network is so un-congested that all - // transactions have no weight fee. We stop here and only increase if the network - // became more busy. - .max(Multiplier::saturating_from_integer(-1)) - } - } -} - #[cfg(test)] -mod tests { +mod multiplier_tests { use super::*; - use sp_runtime::assert_eq_error_rate; - use crate::{MaximumBlockWeight, AvailableBlockRatio, Runtime}; - use crate::{constants::currency::*, TransactionPayment, TargetBlockFullness}; + use sp_runtime::{assert_eq_error_rate, FixedPointNumber}; + use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; + + use crate::{ + constants::{currency::*, time::*}, + TransactionPayment, MaximumBlockWeight, AvailableBlockRatio, Runtime, TargetBlockFullness, + AdjustmentVariable, System, MinimumMultiplier, + }; use frame_support::weights::{Weight, WeightToFeePolynomial}; fn max() -> Weight { - MaximumBlockWeight::get() + AvailableBlockRatio::get() * MaximumBlockWeight::get() + } + + fn min_multiplier() -> Multiplier { + MinimumMultiplier::get() } fn target() -> Weight { TargetBlockFullness::get() * max() } - // poc reference implementation. - fn fee_multiplier_update(block_weight: Weight, previous: Multiplier) -> Multiplier { + // update based on runtime impl. + fn runtime_multiplier_update(fm: Multiplier) -> Multiplier { + TargetedFeeAdjustment::< + Runtime, + TargetBlockFullness, + AdjustmentVariable, + MinimumMultiplier, + >::convert(fm) + } + + // update based on reference impl. + fn truth_value_update(block_weight: Weight, previous: Multiplier) -> Multiplier { + let accuracy = Multiplier::accuracy() as f64; + let previous_float = previous.into_inner() as f64 / accuracy; + // bump if it is zero. + let previous_float = previous_float.max(min_multiplier().into_inner() as f64 / accuracy); + // maximum tx weight let m = max() as f64; // block weight always truncated to max weight let block_weight = (block_weight as f64).min(m); - let v: f64 = 0.00004; + let v: f64 = AdjustmentVariable::get().to_fraction(); // Ideal saturation in terms of weight let ss = target() as f64; // Current saturation in terms of weight let s = block_weight; - let fm = v * (s/m - ss/m) + v.powi(2) * (s/m - ss/m).powi(2) / 2.0; - let addition_fm = Multiplier::from_inner((fm * Multiplier::accuracy() as f64).round() as i128); - previous.saturating_add(addition_fm) + let t1 = v * (s/m - ss/m); + let t2 = v.powi(2) * (s/m - ss/m).powi(2) / 2.0; + let next_float = previous_float * (1.0 + t1 + t2); + Multiplier::from_fraction(next_float) } fn run_with_system_weight(w: Weight, assertions: F) where F: Fn() -> () { @@ -142,11 +114,12 @@ mod tests { } #[test] - fn fee_multiplier_update_poc_works() { - let fm = Multiplier::saturating_from_rational(0, 1); + fn truth_value_update_poc_works() { + let fm = Multiplier::saturating_from_rational(1, 2); let test_set = vec![ (0, fm.clone()), (100, fm.clone()), + (1000, fm.clone()), (target(), fm.clone()), (max() / 2, fm.clone()), (max(), fm.clone()), @@ -154,37 +127,71 @@ mod tests { test_set.into_iter().for_each(|(w, fm)| { run_with_system_weight(w, || { assert_eq_error_rate!( - fee_multiplier_update(w, fm), - TargetedFeeAdjustment::::convert(fm), - // Error is only 1 in 10^18 - Multiplier::from_inner(1), + truth_value_update(w, fm), + runtime_multiplier_update(fm), + // Error is only 1 in 100^18 + Multiplier::from_inner(100), ); }) }) } #[test] - fn empty_chain_simulation() { - // just a few txs per_block. - let block_weight = 0; - run_with_system_weight(block_weight, || { - let mut fm = Multiplier::default(); + fn multiplier_can_grow_from_zero() { + // if the min is too small, then this will not change, and we are doomed forever. + // the weight is 1/100th bigger than target. + run_with_system_weight(target() * 101 / 100, || { + let next = runtime_multiplier_update(min_multiplier()); + assert!(next > min_multiplier(), "{:?} !>= {:?}", next, min_multiplier()); + }) + } + + #[test] + fn multiplier_cannot_go_below_limit() { + // will not go any further below even if block is empty. + run_with_system_weight(0, || { + let next = runtime_multiplier_update(min_multiplier()); + assert_eq!(next, min_multiplier()); + }) + } + + #[test] + fn time_to_reach_zero() { + // blocks per 24h in substrate-node: 28,800 (k) + // s* = 0.1875 + // The bound from the research in an empty chain is: + // v <~ (p / k(0 - s*)) + // p > v * k * -0.1875 + // to get p == -1 we'd need + // -1 > 0.00001 * k * -0.1875 + // 1 < 0.00001 * k * 0.1875 + // 10^9 / 1875 < k + // k > 533_333 ~ 18,5 days. + run_with_system_weight(0, || { + // start from 1, the default. + let mut fm = Multiplier::one(); let mut iterations: u64 = 0; loop { - let next = TargetedFeeAdjustment::::convert(fm); + let next = runtime_multiplier_update(fm); fm = next; - if fm == Multiplier::saturating_from_integer(-1) { break; } + if fm == min_multiplier() { break; } iterations += 1; } - println!("iteration {}, new fm = {:?}. Weight fee is now zero", iterations, fm); - assert!(iterations > 50_000, "This assertion is just a warning; Don't panic. \ - Current substrate/polkadot node are configured with a _slow adjusting fee_ \ - mechanism. Hence, it is really unlikely that fees collapse to zero even on an \ - empty chain in less than at least of couple of thousands of empty blocks. But this \ - simulation indicates that fees collapsed to zero after {} almost-empty blocks. \ - Check it", - iterations, - ); + assert!(iterations > 533_333); + }) + } + + #[test] + fn min_change_per_day() { + run_with_system_weight(max(), || { + let mut fm = Multiplier::one(); + // See the example in the doc of `TargetedFeeAdjustment`. are at least 0.234, hence + // `fm > 1.234`. + for _ in 0..DAYS { + let next = runtime_multiplier_update(fm); + fm = next; + } + assert!(fm > Multiplier::saturating_from_rational(1234, 1000)); }) } @@ -196,17 +203,17 @@ mod tests { // almost full. The entire quota of normal transactions is taken. let block_weight = AvailableBlockRatio::get() * max() - 100; - // Default substrate minimum. - let tx_weight = 10_000; + // Default substrate weight. + let tx_weight = frame_support::weights::constants::ExtrinsicBaseWeight::get(); run_with_system_weight(block_weight, || { // initial value configured on module - let mut fm = Multiplier::default(); + let mut fm = Multiplier::one(); assert_eq!(fm, TransactionPayment::next_fee_multiplier()); let mut iterations: u64 = 0; loop { - let next = TargetedFeeAdjustment::::convert(fm); + let next = runtime_multiplier_update(fm); // if no change, panic. This should never happen in this case. if fm == next { panic!("The fee should ever increase"); } fm = next; @@ -230,95 +237,86 @@ mod tests { #[test] fn stateless_weight_mul() { - // This test will show that heavy blocks have a weight multiplier greater than 0 - // and light blocks will have a weight multiplier less than 0. + let fm = Multiplier::saturating_from_rational(1, 2); run_with_system_weight(target() / 4, || { - // `fee_multiplier_update` is enough as it is the absolute truth value. - let next = TargetedFeeAdjustment::::convert(Multiplier::default()); - assert_eq!( + let next = runtime_multiplier_update(fm); + assert_eq_error_rate!( next, - fee_multiplier_update(target() / 4 ,Multiplier::default()) + truth_value_update(target() / 4 , fm), + Multiplier::from_inner(100), ); - // Light block. Fee is reduced a little. - assert!(next < Multiplier::zero()) + // Light block. Multiplier is reduced a little. + assert!(next < fm); }); + run_with_system_weight(target() / 2, || { - let next = TargetedFeeAdjustment::::convert(Multiplier::default()); - assert_eq!( + let next = runtime_multiplier_update(fm); + assert_eq_error_rate!( next, - fee_multiplier_update(target() / 2 ,Multiplier::default()) + truth_value_update(target() / 2 , fm), + Multiplier::from_inner(100), ); - - // Light block. Fee is reduced a little. - assert!(next < Multiplier::zero()) + // Light block. Multiplier is reduced a little. + assert!(next < fm); }); run_with_system_weight(target(), || { - // ideal. Original fee. No changes. - let next = TargetedFeeAdjustment::::convert(Multiplier::default()); - assert_eq!(next, Multiplier::zero()) + let next = runtime_multiplier_update(fm); + assert_eq_error_rate!( + next, + truth_value_update(target(), fm), + Multiplier::from_inner(100), + ); + // ideal. No changes. + assert_eq!(next, fm) }); run_with_system_weight(target() * 2, || { // More than ideal. Fee is increased. - let next = TargetedFeeAdjustment::::convert(Multiplier::default()); - assert_eq!( + let next = runtime_multiplier_update(fm); + assert_eq_error_rate!( next, - fee_multiplier_update(target() * 2 ,Multiplier::default()) + truth_value_update(target() * 2 , fm), + Multiplier::from_inner(100), ); // Heavy block. Fee is increased a little. - assert!(next > Multiplier::zero()) + assert!(next > fm); }); } #[test] - fn stateful_weight_mul_grow_to_infinity() { + fn weight_mul_grow_on_big_block() { run_with_system_weight(target() * 2, || { - let mut original = Multiplier::default(); + let mut original = Multiplier::zero(); let mut next = Multiplier::default(); (0..1_000).for_each(|_| { - next = TargetedFeeAdjustment::::convert(original); - assert_eq!( + next = runtime_multiplier_update(original); + assert_eq_error_rate!( next, - fee_multiplier_update(target() * 2, original), + truth_value_update(target() * 2, original), + Multiplier::from_inner(100), ); // must always increase - assert!(next > original); + assert!(next > original, "{:?} !>= {:?}", next, original); original = next; }); }); } #[test] - fn stateful_weight_mil_collapse_to_minus_one() { - run_with_system_weight(0, || { - let mut original = Multiplier::default(); // 0 + fn weight_mul_decrease_on_small_block() { + run_with_system_weight(target() / 2, || { + let mut original = Multiplier::saturating_from_rational(1, 2); let mut next; - // decreases - next = TargetedFeeAdjustment::::convert(original); - assert_eq!( - next, - fee_multiplier_update(0, original), - ); - assert!(next < original); - original = next; - - // keeps decreasing - next = TargetedFeeAdjustment::::convert(original); - assert_eq!( - next, - fee_multiplier_update(0, original), - ); - assert!(next < original); - - // ... stops going down at -1 - assert_eq!( - TargetedFeeAdjustment::::convert(Multiplier::saturating_from_integer(-1)), - Multiplier::saturating_from_integer(-1) - ); + for _ in 0..100 { + // decreases + next = runtime_multiplier_update(original); + assert!(next < original, "{:?} !<= {:?}", next, original); + original = next; + } }) } @@ -347,8 +345,8 @@ mod tests { Weight::max_value(), ].into_iter().for_each(|i| { run_with_system_weight(i, || { - let next = TargetedFeeAdjustment::::convert(Multiplier::default()); - let truth = fee_multiplier_update(i, Multiplier::default()); + let next = runtime_multiplier_update(Multiplier::one()); + let truth = truth_value_update(i, Multiplier::one()); assert_eq_error_rate!(truth, next, Multiplier::from_inner(50_000_000)); }); }); @@ -359,7 +357,7 @@ mod tests { .into_iter() .for_each(|i| { run_with_system_weight(i, || { - let fm = TargetedFeeAdjustment::::convert(max_fm); + let fm = runtime_multiplier_update(max_fm); // won't grow. The convert saturates everything. assert_eq!(fm, max_fm); }) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index d776d72e2b..feb1b05a8e 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -44,8 +44,8 @@ pub use node_primitives::{AccountId, Signature}; use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment}; use sp_api::impl_runtime_apis; use sp_runtime::{ - Permill, Perbill, Perquintill, Percent, PerThing, ApplyExtrinsicResult, - impl_opaque_keys, generic, create_runtime_str, ModuleId, + Permill, Perbill, Perquintill, Percent, ApplyExtrinsicResult, + impl_opaque_keys, generic, create_runtime_str, ModuleId, FixedPointNumber, }; use sp_runtime::curve::PiecewiseLinear; use sp_runtime::transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority}; @@ -61,6 +61,7 @@ use pallet_grandpa::fg_primitives; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; +pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; use pallet_contracts_rpc_runtime_api::ContractExecResult; use pallet_session::{historical as pallet_session_historical}; use sp_inherents::{InherentData, CheckInherentsResult}; @@ -77,7 +78,7 @@ pub use pallet_staking::StakerStatus; /// Implementations of some helper traits passed into runtime modules as associated types. pub mod impls; -use impls::{CurrencyToVoteHandler, Author, TargetedFeeAdjustment}; +use impls::{CurrencyToVoteHandler, Author}; /// Constant values used within the runtime. pub mod constants; @@ -295,23 +296,17 @@ impl pallet_balances::Trait for Runtime { parameter_types! { pub const TransactionByteFee: Balance = 10 * MILLICENTS; pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); + pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(1, 100_000); + pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000_000u128); } -// for a sane configuration, this should always be less than `AvailableBlockRatio`. -const_assert!( - TargetBlockFullness::get().deconstruct() < - (AvailableBlockRatio::get().deconstruct() as ::Inner) - * (::ACCURACY / ::ACCURACY as ::Inner) -); - impl pallet_transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; type TransactionByteFee = TransactionByteFee; - // In the Substrate node, a weight of 10_000_000 (smallest non-zero weight) - // is mapped to 10_000_000 units of fees, hence: type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = TargetedFeeAdjustment; + type FeeMultiplierUpdate = + TargetedFeeAdjustment; } parameter_types! { diff --git a/frame/balances/src/tests.rs b/frame/balances/src/tests.rs index 2724291f14..210c75631d 100644 --- a/frame/balances/src/tests.rs +++ b/frame/balances/src/tests.rs @@ -26,6 +26,7 @@ impl sp_runtime::traits::Dispatchable for CallWithDispatchInfo { type Trait = (); type Info = frame_support::weights::DispatchInfo; type PostInfo = frame_support::weights::PostDispatchInfo; + fn dispatch(self, _origin: Self::Origin) -> sp_runtime::DispatchResultWithInfo { panic!("Do not use dummy implementation for dispatch."); @@ -37,7 +38,7 @@ macro_rules! decl_tests { ($test:ty, $ext_builder:ty, $existential_deposit:expr) => { use crate::*; - use sp_runtime::{FixedPointNumber, FixedI128, traits::{SignedExtension, BadOrigin}}; + use sp_runtime::{FixedPointNumber, traits::{SignedExtension, BadOrigin}}; use frame_support::{ assert_noop, assert_ok, assert_err, traits::{ @@ -45,7 +46,7 @@ macro_rules! decl_tests { Currency, ReservableCurrency, ExistenceRequirement::AllowDeath, StoredMap } }; - use pallet_transaction_payment::ChargeTransactionPayment; + use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier}; use frame_system::RawOrigin; const ID_1: LockIdentifier = *b"1 "; @@ -166,7 +167,7 @@ macro_rules! decl_tests { .monied(true) .build() .execute_with(|| { - pallet_transaction_payment::NextFeeMultiplier::put(FixedI128::saturating_from_integer(1)); + pallet_transaction_payment::NextFeeMultiplier::put(Multiplier::saturating_from_integer(1)); Balances::set_lock(ID_1, &1, 10, WithdrawReason::Reserve.into()); assert_noop!( >::transfer(&1, &2, 1, AllowDeath), diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index b38b8c8a4a..b64b5d58f7 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -570,7 +570,7 @@ decl_module! { /// A dispatch that will fill the block weight up to the given ratio. // TODO: This should only be available for testing, rather than in general usage, but // that's not possible at present (since it's within the decl_module macro). - #[weight = (*_ratio * T::MaximumBlockWeight::get(), DispatchClass::Operational)] + #[weight = *_ratio * T::MaximumBlockWeight::get()] fn fill_block(origin, _ratio: Perbill) { ensure_root(origin)?; } diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index e1abb00cbf..a8b23bfda0 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.101", optional = true } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } @@ -29,6 +30,7 @@ sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } [features] default = ["std"] std = [ + "serde", "codec/std", "sp-std/std", "sp-runtime/std", diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 740fec099d..31d0cfb20d 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -44,7 +44,7 @@ use frame_support::{ dispatch::DispatchResult, }; use sp_runtime::{ - FixedI128, FixedPointNumber, FixedPointOperand, + FixedU128, FixedPointNumber, FixedPointOperand, Perquintill, RuntimeDebug, transaction_validity::{ TransactionPriority, ValidTransaction, InvalidTransaction, TransactionValidityError, TransactionValidity, @@ -57,13 +57,125 @@ use sp_runtime::{ use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; /// Fee multiplier. -pub type Multiplier = FixedI128; +pub type Multiplier = FixedU128; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; type NegativeImbalanceOf = <::Currency as Currency<::AccountId>>::NegativeImbalance; +/// A struct to update the weight multiplier per block. It implements `Convert`, meaning that it can convert the previous multiplier to the next one. This should +/// be called on `on_finalize` of a block, prior to potentially cleaning the weight data from the +/// system module. +/// +/// given: +/// s = previous block weight +/// s'= ideal block weight +/// m = maximum block weight +/// diff = (s - s')/m +/// v = 0.00001 +/// t1 = (v * diff) +/// t2 = (v * diff)^2 / 2 +/// then: +/// next_multiplier = prev_multiplier * (1 + t1 + t2) +/// +/// Where `(s', v)` must be given as the `Get` implementation of the `T` generic type. Moreover, `M` +/// must provide the minimum allowed value for the multiplier. Note that a runtime should ensure +/// with tests that the combination of this `M` and `V` is not such that the multiplier can drop to +/// zero and never recover. +/// +/// note that `s'` is interpreted as a portion in the _normal transaction_ capacity of the block. +/// For example, given `s' == 0.25` and `AvailableBlockRatio = 0.75`, then the target fullness is +/// _0.25 of the normal capacity_ and _0.1875 of the entire block_. +/// +/// This implementation implies the bound: +/// - `v ≤ p / k * (s − s')` +/// - or, solving for `p`: `p >= v * k * (s - s')` +/// +/// where `p` is the amount of change over `k` blocks. +/// +/// Hence: +/// - in a fully congested chain: `p >= v * k * (1 - s')`. +/// - in an empty chain: `p >= v * k * (-s')`. +/// +/// For example, when all blocks are full and there are 28800 blocks per day (default in `substrate-node`) +/// and v == 0.00001, s' == 0.1875, we'd have: +/// +/// p >= 0.00001 * 28800 * 0.8125 +/// p >= 0.234 +/// +/// Meaning that fees can change by around ~23% per day, given extreme congestion. +/// +/// More info can be found at: +/// https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html +pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData<(T, S, V, M)>); + +impl Convert for TargetedFeeAdjustment + where T: frame_system::Trait, S: Get, V: Get, M: Get, +{ + fn convert(previous: Multiplier) -> Multiplier { + // Defensive only. The multiplier in storage should always be at most positive. Nonetheless + // we recover here in case of errors, because any value below this would be stale and can + // never change. + let min_multiplier = M::get(); + let previous = previous.max(min_multiplier); + + // the computed ratio is only among the normal class. + let normal_max_weight = + ::AvailableBlockRatio::get() * + ::MaximumBlockWeight::get(); + let normal_block_weight = + >::block_weight() + .get(frame_support::weights::DispatchClass::Normal) + .min(normal_max_weight); + + let s = S::get(); + let v = V::get(); + + let target_weight = (s * normal_max_weight) as u128; + let block_weight = normal_block_weight as u128; + + // determines if the first_term is positive + let positive = block_weight >= target_weight; + let diff_abs = block_weight.max(target_weight) - block_weight.min(target_weight); + + // defensive only, a test case assures that the maximum weight diff can fit in Multiplier + // without any saturation. + let diff = Multiplier::saturating_from_rational(diff_abs, normal_max_weight.max(1)); + let diff_squared = diff.saturating_mul(diff); + + let v_squared_2 = v.saturating_mul(v) / Multiplier::saturating_from_integer(2); + + let first_term = v.saturating_mul(diff); + let second_term = v_squared_2.saturating_mul(diff_squared); + + if positive { + let excess = first_term.saturating_add(second_term).saturating_mul(previous); + previous.saturating_add(excess).max(min_multiplier) + } else { + // Defensive-only: first_term > second_term. Safe subtraction. + let negative = first_term.saturating_sub(second_term).saturating_mul(previous); + previous.saturating_sub(negative).max(min_multiplier) + } + } +} + +/// Storage releases of the module. +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] +enum Releases { + /// Original version of the module. + V1Ancient, + /// One that bumps the usage to FixedU128 from FixedI128. + V2, +} + +impl Default for Releases { + fn default() -> Self { + Releases::V1Ancient + } +} + pub trait Trait: frame_system::Trait { /// The currency type in which fees will be paid. type Currency: Currency + Send + Sync; @@ -85,7 +197,9 @@ pub trait Trait: frame_system::Trait { decl_storage! { trait Store for Module as TransactionPayment { - pub NextFeeMultiplier get(fn next_fee_multiplier): Multiplier = Multiplier::from_inner(0); + pub NextFeeMultiplier get(fn next_fee_multiplier): Multiplier = Multiplier::saturating_from_integer(1); + + StorageVersion build(|_: &GenesisConfig| Releases::V2): Releases; } } @@ -103,6 +217,51 @@ decl_module! { *fm = T::FeeMultiplierUpdate::convert(*fm); }); } + + fn integrity_test() { + // given weight == u64, we build multipliers from `diff` of two weight values, which can + // at most be MaximumBlockWeight. Make sure that this can fit in a multiplier without + // loss. + use sp_std::convert::TryInto; + assert!( + ::max_value() >= + Multiplier::checked_from_integer( + ::MaximumBlockWeight::get().try_into().unwrap() + ).unwrap(), + ); + } + + fn on_runtime_upgrade() -> Weight { + use frame_support::migration::take_storage_value; + use sp_std::convert::TryInto; + use frame_support::debug::native::error; + + type OldMultiplier = sp_runtime::FixedI128; + type OldInner = ::Inner; + type Inner = ::Inner; + + if let Releases::V1Ancient = StorageVersion::get() { + StorageVersion::put(Releases::V2); + + if let Some(old) = take_storage_value::( + b"TransactionPayment", + b"NextFeeMultiplier", + &[], + ) { + let inner = old.into_inner(); + let new_inner = >::try_into(inner) + .unwrap_or_default(); + let new = Multiplier::from_inner(new_inner); + NextFeeMultiplier::put(new); + T::DbWeight::get().reads_writes(1, 1) + } else { + error!("transaction-payment migration failed."); + T::DbWeight::get().reads(1) + } + } else { + T::DbWeight::get().reads(1) + } + } } } @@ -157,7 +316,7 @@ impl Module where /// the minimum fee for a transaction to be included in a block. /// /// ```ignore - /// inclusion_fee = base_fee + targeted_fee_adjustment * (len_fee + weight_fee); + /// inclusion_fee = base_fee + len_fee + [targeted_fee_adjustment * weight_fee]; /// final_fee = inclusion_fee + tip; /// ``` pub fn compute_fee( @@ -194,16 +353,21 @@ impl Module where if pays_fee == Pays::Yes { let len = >::from(len); let per_byte = T::TransactionByteFee::get(); - let len_fee = per_byte.saturating_mul(len); - let unadjusted_weight_fee = Self::weight_to_fee(weight); - // the adjustable part of the fee - let adjustable_fee = len_fee.saturating_add(unadjusted_weight_fee); - let targeted_fee_adjustment = NextFeeMultiplier::get(); - let adjusted_fee = targeted_fee_adjustment.saturating_mul_acc_int(adjustable_fee); + // length fee. this is not adjusted. + let fixed_len_fee = per_byte.saturating_mul(len); + + // the adjustable part of the fee. + let unadjusted_weight_fee = Self::weight_to_fee(weight); + let multiplier = Self::next_fee_multiplier(); + // final adjusted weight fee. + let adjusted_weight_fee = multiplier.saturating_mul_int(unadjusted_weight_fee); let base_fee = Self::weight_to_fee(T::ExtrinsicBaseWeight::get()); - base_fee.saturating_add(adjusted_fee).saturating_add(tip) + base_fee + .saturating_add(fixed_len_fee) + .saturating_add(adjusted_weight_fee) + .saturating_add(tip) } else { tip } @@ -213,12 +377,12 @@ impl Module where impl Module { /// Compute the fee for the specified weight. /// - /// This fee is already adjusted by the per block fee adjustment factor and is therefore - /// the share that the weight contributes to the overall fee of a transaction. + /// This fee is already adjusted by the per block fee adjustment factor and is therefore the + /// share that the weight contributes to the overall fee of a transaction. /// - /// This function is generic in order to supply the contracts module with a way - /// to calculate the gas price. The contracts module is not able to put the necessary - /// `BalanceOf` contraints on its trait. This function is not to be used by this module. + /// This function is generic in order to supply the contracts module with a way to calculate the + /// gas price. The contracts module is not able to put the necessary `BalanceOf` constraints + /// on its trait. This function is not to be used by this module. pub fn weight_to_fee_with_adjustment(weight: Weight) -> Balance where Balance: UniqueSaturatedFrom { @@ -576,6 +740,37 @@ mod tests { PostDispatchInfo { actual_weight: None, } } + #[test] + fn migration_to_v2_works() { + use sp_runtime::FixedI128; + use frame_support::traits::OnRuntimeUpgrade; + + let with_old_multiplier = |mul: FixedI128, expected: FixedU128| { + ExtBuilder::default().build().execute_with(|| { + frame_support::migration::put_storage_value( + b"TransactionPayment", + b"NextFeeMultiplier", + &[], + mul, + ); + + assert_eq!(StorageVersion::get(), Releases::V1Ancient); + + TransactionPayment::on_runtime_upgrade(); + + assert_eq!(StorageVersion::get(), Releases::V2); + assert_eq!(NextFeeMultiplier::get(), expected); + }) + }; + + with_old_multiplier(FixedI128::saturating_from_integer(-1), FixedU128::zero()); + with_old_multiplier(FixedI128::saturating_from_rational(-1, 2), FixedU128::zero()); + with_old_multiplier( + FixedI128::saturating_from_rational(1, 2), + FixedU128::saturating_from_rational(1, 2), + ); + } + #[test] fn signed_extension_transaction_payment_work() { ExtBuilder::default() @@ -620,21 +815,21 @@ mod tests { .execute_with(|| { let len = 10; - NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(3, 2)); let pre = ChargeTransactionPayment::::from(5 /* tipped */) .pre_dispatch(&2, CALL, &info_from_weight(100), len) .unwrap(); - // 5 base fee, 3/2 * 10 byte fee, 3/2 * 100 weight fee, 5 tip - assert_eq!(Balances::free_balance(2), 200 - 5 - 15 - 150 - 5); + // 5 base fee, 10 byte fee, 3/2 * 100 weight fee, 5 tip + assert_eq!(Balances::free_balance(2), 200 - 5 - 10 - 150 - 5); assert!( ChargeTransactionPayment:: ::post_dispatch(pre, &info_from_weight(100), &post_info_from_weight(50), len, &Ok(())) .is_ok() ); - // 75 (3/2 of the returned 50 units of weight ) is refunded - assert_eq!(Balances::free_balance(2), 200 - 5 - 15 - 75 - 5); + // 75 (3/2 of the returned 50 units of weight) is refunded + assert_eq!(Balances::free_balance(2), 200 - 5 - 10 - 75 - 5); }); } @@ -708,7 +903,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(3, 2)); let len = 10; assert!( @@ -716,7 +911,14 @@ mod tests { .pre_dispatch(&1, CALL, &info_from_weight(3), len) .is_ok() ); - assert_eq!(Balances::free_balance(1), 100 - 10 - 5 - (10 + 3) * 3 / 2); + assert_eq!( + Balances::free_balance(1), + 100 // original + - 10 // tip + - 5 // base + - 10 // len + - (3 * 3 / 2) // adjusted weight + ); }) } @@ -736,7 +938,7 @@ mod tests { .execute_with(|| { // all fees should be x1.5 - NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(3, 2)); assert_eq!( TransactionPayment::query_info(xt, len), @@ -745,10 +947,8 @@ mod tests { class: info.class, partial_fee: 5 * 2 /* base * weight_fee */ - + ( - len as u64 /* len * 1 */ - + info.weight.min(MaximumBlockWeight::get()) as u64 * 2 /* weight * weight_to_fee */ - ) * 3 / 2 + + len as u64 /* len * 1 */ + + info.weight.min(MaximumBlockWeight::get()) as u64 * 2 * 3 / 2 /* weight */ }, ); @@ -765,7 +965,7 @@ mod tests { .execute_with(|| { // Next fee multiplier is zero - assert_eq!(NextFeeMultiplier::get(), Multiplier::saturating_from_integer(0)); + assert_eq!(NextFeeMultiplier::get(), Multiplier::one()); // Tip only, no fees works let dispatch_info = DispatchInfo { @@ -804,8 +1004,8 @@ mod tests { .build() .execute_with(|| { - // Add a next fee multiplier - NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); // = 1/2 = .5 + // Add a next fee multiplier. Fees will be x3/2. + NextFeeMultiplier::put(Multiplier::saturating_from_rational(3, 2)); // Base fee is unaffected by multiplier let dispatch_info = DispatchInfo { weight: 0, @@ -821,10 +1021,10 @@ mod tests { pays_fee: Pays::Yes, }; // 123 weight, 456 length, 100 base - // adjustable fee = (123 * 1) + (456 * 10) = 4683 - // adjusted fee = (4683 * .5) + 4683 = 7024.5 -> 7024 - // final fee = 100 + 7024 + 789 tip = 7913 - assert_eq!(Module::::compute_fee(456, &dispatch_info, 789), 7913); + assert_eq!( + Module::::compute_fee(456, &dispatch_info, 789), + 100 + (3 * 123 / 2) + 4560 + 789, + ); }); } @@ -837,9 +1037,10 @@ mod tests { .build() .execute_with(|| { - // Add a next fee multiplier - NextFeeMultiplier::put(Multiplier::saturating_from_rational(-1, 2)); // = -1/2 = -.5 - // Base fee is unaffected by multiplier + // Add a next fee multiplier. All fees will be x1/2. + NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 2)); + + // Base fee is unaffected by multiplier. let dispatch_info = DispatchInfo { weight: 0, class: DispatchClass::Operational, @@ -847,17 +1048,17 @@ mod tests { }; assert_eq!(Module::::compute_fee(0, &dispatch_info, 0), 100); - // Everything works together :) + // Everything works together. let dispatch_info = DispatchInfo { weight: 123, class: DispatchClass::Operational, pays_fee: Pays::Yes, }; // 123 weight, 456 length, 100 base - // adjustable fee = (123 * 1) + (456 * 10) = 4683 - // adjusted fee = 4683 - (4683 * -.5) = 4683 - 2341.5 = 4683 - 2341 = 2342 - // final fee = 100 + 2342 + 789 tip = 3231 - assert_eq!(Module::::compute_fee(456, &dispatch_info, 789), 3231); + assert_eq!( + Module::::compute_fee(456, &dispatch_info, 789), + 100 + (123 / 2) + 4560 + 789, + ); }); } @@ -993,7 +1194,7 @@ mod tests { let len = 10; let tip = 5; - NextFeeMultiplier::put(Multiplier::saturating_from_rational(1, 4)); + NextFeeMultiplier::put(Multiplier::saturating_from_rational(5, 4)); let pre = ChargeTransactionPayment::::from(tip) .pre_dispatch(&2, CALL, &info, len) @@ -1007,11 +1208,8 @@ mod tests { let actual_fee = Module:: ::compute_actual_fee(len as u32, &info, &post_info, tip); - // 33 weight, 10 length, 7 base - // adjustable fee = (33 * 1) + (10 * 1) = 43 - // adjusted fee = 43 + (43 * .25) = 43 + 10.75 = 43 + 10 = 53 - // final fee = 7 + 53 + 5 tip = 65 - assert_eq!(actual_fee, 65); + // 33 weight, 10 length, 7 base, 5 tip + assert_eq!(actual_fee, 7 + 10 + (33 * 5 / 4) + 5); assert_eq!(refund_based_fee, actual_fee); }); } diff --git a/primitives/arithmetic/src/fixed_point.rs b/primitives/arithmetic/src/fixed_point.rs index 55581ff54c..2362b1e8af 100644 --- a/primitives/arithmetic/src/fixed_point.rs +++ b/primitives/arithmetic/src/fixed_point.rs @@ -372,6 +372,23 @@ macro_rules! implement_fixed { } } + impl $name { + /// const version of `FixedPointNumber::from_inner`. + pub const fn from_inner(inner: $inner_type) -> Self { + Self(inner) + } + + #[cfg(any(feature = "std", test))] + pub fn from_fraction(x: f64) -> Self { + Self((x * (::DIV as f64)) as $inner_type) + } + + #[cfg(any(feature = "std", test))] + pub fn to_fraction(self) -> f64 { + self.0 as f64 / ::DIV as f64 + } + } + impl Saturating for $name { fn saturating_add(self, rhs: Self) -> Self { Self(self.0.saturating_add(rhs.0)) -- GitLab From 8e1f75316d3bc8c1f3d2a667e4e99ca7ea30372b Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Thu, 18 Jun 2020 09:33:51 +0200 Subject: [PATCH 179/280] Restrict remove_proxies (#6383) --- frame/proxy/src/lib.rs | 4 ++++ frame/proxy/src/tests.rs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index 14c7ced151..66e3e76038 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -68,6 +68,8 @@ pub trait Trait: frame_system::Trait { /// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler. /// The instance filter determines whether a given call may be proxied under this type. + /// + /// IMPORTANT: `Default` must be provided and MUST BE the the *most permissive* value. type ProxyType: Parameter + Member + Ord + PartialOrd + InstanceFilter<::Call> + Default; @@ -174,6 +176,8 @@ decl_module! { match c.is_sub_type() { Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt)) if !proxy_type.is_superset(&pt) => false, + Some(Call::remove_proxies(..)) | Some(Call::kill_anonymous(..)) + if proxy_type != T::ProxyType::default() => false, _ => proxy_type.filter(c) } }); diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index be99e9424a..72c9c0d577 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -154,6 +154,7 @@ type Proxy = Module; use frame_system::Call as SystemCall; use pallet_balances::Call as BalancesCall; use pallet_balances::Error as BalancesError; +use pallet_balances::Event as BalancesEvent; use pallet_utility::Call as UtilityCall; use pallet_utility::Event as UtilityEvent; use super::Call as ProxyCall; @@ -242,6 +243,14 @@ fn filtering_works() { UtilityEvent::BatchInterrupted(0, DispatchError::BadOrigin).into(), RawEvent::ProxyExecuted(Ok(())).into(), ]); + + let call = Box::new(Call::Proxy(ProxyCall::remove_proxies())); + assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); + assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); + expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); + assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); + expect_events(vec![BalancesEvent::::Unreserved(1, 5).into(), RawEvent::ProxyExecuted(Ok(())).into()]); }); } -- GitLab From a2653e87e05b7666a45b2a1a53fd25967807575f Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 18 Jun 2020 09:34:53 +0200 Subject: [PATCH 180/280] Remove penalty on duplicate Status message (#6377) --- client/network/src/protocol.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 83f459d344..764c416495 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -104,8 +104,6 @@ mod rep { pub const CLOGGED_PEER: Rep = Rep::new(-(1 << 12), "Clogged message queue"); /// Reputation change when a peer doesn't respond in time to our messages. pub const TIMEOUT: Rep = Rep::new(-(1 << 10), "Request timeout"); - /// Reputation change when a peer sends us a status message while we already received one. - pub const UNEXPECTED_STATUS: Rep = Rep::new(-(1 << 20), "Unexpected status message"); /// Reputation change when we are a light client and a peer is behind us. pub const PEER_BEHIND_US_LIGHT: Rep = Rep::new(-(1 << 8), "Useless for a light peer"); /// Reputation change when a peer sends us any extrinsic. @@ -979,12 +977,7 @@ impl Protocol { trace!(target: "sync", "New peer {} {:?}", who, status); let _protocol_version = { if self.context_data.peers.contains_key(&who) { - log!( - target: "sync", - if self.important_peers.contains(&who) { Level::Warn } else { Level::Debug }, - "Unexpected status packet from {}", who - ); - self.peerset_handle.report_peer(who, rep::UNEXPECTED_STATUS); + debug!(target: "sync", "Ignoring duplicate status packet from {}", who); return CustomMessageOutcome::None; } if status.genesis_hash != self.genesis_hash { -- GitLab From d6d688c4952a99dbfd2155784c937b42ec899da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 18 Jun 2020 09:35:18 +0200 Subject: [PATCH 181/280] `decl_module!` print better error on duplicate reserved keyword (#6384) * `decl_module!` print better error on duplicate reserved keyword This prints a better error message on duplicated reserved keywords, instead of complaining because of missing `origin`. * Review feedback --- frame/support/src/dispatch.rs | 140 +++++++++++++++++- frame/support/test/tests/decl_module_ui.rs | 26 ++++ ...served_keyword_two_times_integrity_test.rs | 7 + ...ed_keyword_two_times_integrity_test.stderr | 25 ++++ ...eserved_keyword_two_times_on_initialize.rs | 11 ++ ...ved_keyword_two_times_on_initialize.stderr | 25 ++++ 6 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 frame/support/test/tests/decl_module_ui.rs create mode 100644 frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs create mode 100644 frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.stderr create mode 100644 frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.rs create mode 100644 frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.stderr diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index 094cbce263..edb6e62639 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -399,6 +399,29 @@ macro_rules! decl_module { "`deposit_event` function is reserved and must follow the syntax: `$vis:vis fn deposit_event() = default;`" ); }; + // Compile error on `deposit_event` being added a second time. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )+ } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )* } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )* } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + $vis:vis fn deposit_event() = default; + $($rest:tt)* + ) => { + compile_error!("`deposit_event` can only be passed once as input."); + }; // Add on_finalize (@normalize $(#[$attr:meta])* @@ -462,6 +485,30 @@ macro_rules! decl_module { `on_initialize` or `on_runtime_upgrade` instead" ); }; + // Compile error on `on_finalize` being added a second time. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )+ } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )* } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + #[weight = $weight:expr] + fn on_finalize( $( $param_name:ident : $param:ty ),* $(,)? ) { $( $impl:tt )* } + $($rest:tt)* + ) => { + compile_error!("`on_finalize` can only be passed once as input."); + }; // compile_error on_runtime_upgrade, without a given weight removed syntax. (@normalize $(#[$attr:meta])* @@ -554,6 +601,29 @@ macro_rules! decl_module { $($rest)* ); }; + // Compile error on `on_runtime_upgrade` being added a second time. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )+ } + { $( $on_finalize:tt )* } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )* } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + fn on_runtime_upgrade( $( $param_name:ident : $param:ty ),* $(,)? ) -> $return:ty { $( $impl:tt )* } + $($rest:tt)* + ) => { + compile_error!("`on_runtime_upgrade` can only be passed once as input."); + }; // Add integrity_test (@normalize $(#[$attr:meta])* @@ -595,6 +665,29 @@ macro_rules! decl_module { $($rest)* ); }; + // Compile error on `integrity_test` being added a second time. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )* } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )+ } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + fn integrity_test() { $( $impl:tt )* } + $($rest:tt)* + ) => { + compile_error!("`integrity_test` can only be passed once as input."); + }; // compile_error on_initialize, without a given weight removed syntax. (@normalize $(#[$attr:meta])* @@ -687,6 +780,29 @@ macro_rules! decl_module { $($rest)* ); }; + // Compile error on trying to add a second `on_initialize`. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )+ } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )* } + { $( $offchain:tt )* } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )* } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + fn on_initialize( $( $param_name:ident : $param:ty ),* $(,)? ) -> $return:ty { $( $impl:tt )* } + $($rest:tt)* + ) => { + compile_error!("`on_initialize` can only be passed once as input."); + }; (@normalize $(#[$attr:meta])* pub struct $mod_type:ident< @@ -727,7 +843,29 @@ macro_rules! decl_module { $($rest)* ); }; - + // Compile error on trying to add a second `offchain_worker`. + (@normalize + $(#[$attr:meta])* + pub struct $mod_type:ident< + $trait_instance:ident: $trait_name:ident$(, I: $instantiable:path $(= $module_default_instance:path)?)? + > + for enum $call_type:ident where origin: $origin_type:ty, system = $system:ident + { $( $other_where_bounds:tt )* } + { $( $deposit_event:tt )* } + { $( $on_initialize:tt )* } + { $( $on_runtime_upgrade:tt )* } + { $( $on_finalize:tt )* } + { $( $offchain:tt )+ } + { $( $constants:tt )* } + { $( $error_type:tt )* } + { $( $integrity_test:tt )* } + [ $( $dispatchables:tt )* ] + $(#[doc = $doc_attr:tt])* + fn offchain_worker( $( $param_name:ident : $param:ty ),* $(,)? ) -> $return:ty { $( $impl:tt )* } + $($rest:tt)* + ) => { + compile_error!("`offchain_worker` can only be passed once as input."); + }; // This puts a constant in the parsed constants list. (@normalize $(#[$attr:meta])* diff --git a/frame/support/test/tests/decl_module_ui.rs b/frame/support/test/tests/decl_module_ui.rs new file mode 100644 index 0000000000..90d105e7cf --- /dev/null +++ b/frame/support/test/tests/decl_module_ui.rs @@ -0,0 +1,26 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//#[rustversion::attr(not(stable), ignore)] +#[test] +fn decl_module_ui() { + // As trybuild is using `cargo check`, we don't need the real WASM binaries. + std::env::set_var("BUILD_DUMMY_WASM_BINARY", "1"); + + let t = trybuild::TestCases::new(); + t.compile_fail("tests/decl_module_ui/*.rs"); +} diff --git a/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs new file mode 100644 index 0000000000..4dbae05f07 --- /dev/null +++ b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs @@ -0,0 +1,7 @@ +frame_support::decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn integrity_test() {} + + fn integrity_test() {} + } +} diff --git a/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.stderr b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.stderr new file mode 100644 index 0000000000..d6498961d3 --- /dev/null +++ b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.stderr @@ -0,0 +1,25 @@ +error: `integrity_test` can only be passed once as input. + --> $DIR/reserved_keyword_two_times_integrity_test.rs:1:1 + | +1 | / frame_support::decl_module! { +2 | | pub struct Module for enum Call where origin: T::Origin { +3 | | fn integrity_test() {} +4 | | +5 | | fn integrity_test() {} +6 | | } +7 | | } + | |_^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0601]: `main` function not found in crate `$CRATE` + --> $DIR/reserved_keyword_two_times_integrity_test.rs:1:1 + | +1 | / frame_support::decl_module! { +2 | | pub struct Module for enum Call where origin: T::Origin { +3 | | fn integrity_test() {} +4 | | +5 | | fn integrity_test() {} +6 | | } +7 | | } + | |_^ consider adding a `main` function to `$DIR/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs` diff --git a/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.rs b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.rs new file mode 100644 index 0000000000..4f05134997 --- /dev/null +++ b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.rs @@ -0,0 +1,11 @@ +frame_support::decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn on_initialize() -> Weight { + 0 + } + + fn on_initialize() -> Weight { + 0 + } + } +} diff --git a/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.stderr b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.stderr new file mode 100644 index 0000000000..8a9f025046 --- /dev/null +++ b/frame/support/test/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.stderr @@ -0,0 +1,25 @@ +error: `on_initialize` can only be passed once as input. + --> $DIR/reserved_keyword_two_times_on_initialize.rs:1:1 + | +1 | / frame_support::decl_module! { +2 | | pub struct Module for enum Call where origin: T::Origin { +3 | | fn on_initialize() -> Weight { +4 | | 0 +... | +10 | | } +11 | | } + | |_^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0601]: `main` function not found in crate `$CRATE` + --> $DIR/reserved_keyword_two_times_on_initialize.rs:1:1 + | +1 | / frame_support::decl_module! { +2 | | pub struct Module for enum Call where origin: T::Origin { +3 | | fn on_initialize() -> Weight { +4 | | 0 +... | +10 | | } +11 | | } + | |_^ consider adding a `main` function to `$DIR/tests/decl_module_ui/reserved_keyword_two_times_on_initialize.rs` -- GitLab From f8afa5203f41c0f71e40cf8af0ef97d5e38a3e1e Mon Sep 17 00:00:00 2001 From: Shaopeng Wang Date: Thu, 18 Jun 2020 19:35:49 +1200 Subject: [PATCH 182/280] FixedPointNumber: zero is not positive. (#6385) --- primitives/arithmetic/src/fixed_point.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/primitives/arithmetic/src/fixed_point.rs b/primitives/arithmetic/src/fixed_point.rs index 2362b1e8af..8653ee2c8f 100644 --- a/primitives/arithmetic/src/fixed_point.rs +++ b/primitives/arithmetic/src/fixed_point.rs @@ -214,12 +214,12 @@ pub trait FixedPointNumber: self.into_inner() == Self::Inner::one() } - /// Checks if the number is positive. + /// Returns `true` if `self` is positive and `false` if the number is zero or negative. fn is_positive(self) -> bool { - self.into_inner() >= Self::Inner::zero() + self.into_inner() > Self::Inner::zero() } - /// Checks if the number is negative. + /// Returns `true` if `self` is negative and `false` if the number is zero or positive. fn is_negative(self) -> bool { self.into_inner() < Self::Inner::zero() } @@ -1393,6 +1393,23 @@ macro_rules! implement_fixed { assert_eq!(d.checked_div(&$name::zero()), None); } + #[test] + fn is_positive_negative_works() { + let one = $name::one(); + assert!(one.is_positive()); + assert!(!one.is_negative()); + + let zero = $name::zero(); + assert!(!zero.is_positive()); + assert!(!zero.is_negative()); + + if $signed { + let minus_one = $name::saturating_from_integer(-1); + assert!(minus_one.is_negative()); + assert!(!minus_one.is_positive()); + } + } + #[test] fn trunc_works() { let n = $name::saturating_from_rational(5, 2).trunc(); -- GitLab From b02101e9f9424251cb9f965dbf6ff66268d4fa93 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Thu, 18 Jun 2020 09:36:52 +0200 Subject: [PATCH 183/280] Allow empty values in the storage (#6364) * Allow empty values in the storage * Bump trie-bench * Bump trie-bench --- Cargo.lock | 12 ++++----- frame/executive/src/lib.rs | 2 +- primitives/state-machine/Cargo.toml | 2 +- primitives/state-machine/src/lib.rs | 36 +++++++++++++++++++++++++ primitives/state-machine/src/testing.rs | 6 ++--- primitives/trie/Cargo.toml | 6 ++--- primitives/trie/src/lib.rs | 1 + test-utils/runtime/Cargo.toml | 4 +-- 8 files changed, 53 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeacd6e353..f67d22aa6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3057,9 +3057,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be512cb2ccb4ecbdca937fdd4a62ea5f09f8e7195466a85e4632b3d5bcce82e6" +checksum = "fb2999ff7a65d5a1d72172f6d51fa2ea03024b51aee709ba5ff81c3c629a2410" dependencies = [ "ahash", "hash-db", @@ -8935,9 +8935,9 @@ checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" [[package]] name = "trie-bench" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48b309cdda1abbdada28424bdc46f8b85362b3e66d6786d91223e83874429c7" +checksum = "ed8419971832eb3333dc26066e50943a20e0934efeb451b3df5ee94f7f7323ab" dependencies = [ "criterion 0.2.11", "hash-db", @@ -8951,9 +8951,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc309f34008563989045a4c4dbcc5770467f3a3785ee80a9b5cc0d83362475f" +checksum = "cb230c24c741993b04cfccbabb45acff6f6480c5f00d3ed8794ea43db3a9d727" dependencies = [ "hash-db", "hashbrown", diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index c6371d914a..9b0e4eab02 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -709,7 +709,7 @@ mod tests { header: Header { parent_hash: [69u8; 32].into(), number: 1, - state_root: hex!("05a38fa4a48ca80ffa8482304be7749a484dc8c9c31462a570d0fbadde6a3633").into(), + state_root: hex!("e8ff7b3dd4375f6f3a76e24a1999e2a7be2d15b353e49ac94ace1eae3e80eb87").into(), extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(), digest: Digest { logs: vec![], }, }, diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index 22dc73fc7e..b94195db90 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" parking_lot = "0.10.0" hash-db = "0.15.2" -trie-db = "0.20.1" +trie-db = "0.21.0" trie-root = "0.16.0" sp-trie = { version = "2.0.0-rc3", path = "../trie" } sp-core = { version = "2.0.0-rc3", path = "../core" } diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index 693a7bc12f..b863d155e7 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -1306,4 +1306,40 @@ mod tests { } assert!(!duplicate); } + + #[test] + fn set_storage_empty_allowed() { + let initial: BTreeMap<_, _> = map![ + b"aaa".to_vec() => b"0".to_vec(), + b"bbb".to_vec() => b"".to_vec() + ]; + let mut state = InMemoryBackend::::from(initial); + let backend = state.as_trie_backend().unwrap(); + + let mut overlay = OverlayedChanges::default(); + overlay.set_storage(b"ccc".to_vec(), Some(b"".to_vec())); + assert_eq!(overlay.storage(b"ccc"), Some(Some(&[][..]))); + overlay.commit_prospective(); + assert_eq!(overlay.storage(b"ccc"), Some(Some(&[][..]))); + assert_eq!(overlay.storage(b"bbb"), None); + + { + let mut offchain_overlay = Default::default(); + let mut cache = StorageTransactionCache::default(); + let mut ext = Ext::new( + &mut overlay, + &mut offchain_overlay, + &mut cache, + backend, + changes_trie::disabled_state::<_, u64>(), + None, + ); + assert_eq!(ext.storage(b"bbb"), Some(vec![])); + assert_eq!(ext.storage(b"ccc"), Some(vec![])); + ext.clear_storage(b"ccc"); + assert_eq!(ext.storage(b"ccc"), None); + } + overlay.commit_prospective(); + assert_eq!(overlay.storage(b"ccc"), Some(None)); + } } diff --git a/primitives/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs index 2ea2961830..90da547983 100644 --- a/primitives/state-machine/src/testing.rs +++ b/primitives/state-machine/src/testing.rs @@ -242,7 +242,7 @@ impl sp_externalities::ExtensionStore for TestExternalities where #[cfg(test)] mod tests { use super::*; - use sp_core::traits::Externalities; + use sp_core::{H256, traits::Externalities}; use sp_runtime::traits::BlakeTwo256; use hex_literal::hex; @@ -253,8 +253,8 @@ mod tests { ext.set_storage(b"doe".to_vec(), b"reindeer".to_vec()); ext.set_storage(b"dog".to_vec(), b"puppy".to_vec()); ext.set_storage(b"dogglesworth".to_vec(), b"cat".to_vec()); - const ROOT: [u8; 32] = hex!("555d4777b52e9196e3f6373c556cc661e79cd463f881ab9e921e70fc30144bf4"); - assert_eq!(&ext.storage_root()[..], &ROOT); + let root = H256::from(hex!("2a340d3dfd52f5992c6b117e9e45f479e6da5afffafeb26ab619cf137a95aeb8")); + assert_eq!(H256::from_slice(ext.storage_root().as_slice()), root); } #[test] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index c436092c09..823d5bc5df 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -20,13 +20,13 @@ harness = false codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } -trie-db = { version = "0.20.1", default-features = false } +trie-db = { version = "0.21.0", default-features = false } trie-root = { version = "0.16.0", default-features = false } -memory-db = { version = "0.20.0", default-features = false } +memory-db = { version = "0.21.0", default-features = false } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } [dev-dependencies] -trie-bench = "0.21.0" +trie-bench = "0.22.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" diff --git a/primitives/trie/src/lib.rs b/primitives/trie/src/lib.rs index db471fd713..7d1879a4f9 100644 --- a/primitives/trie/src/lib.rs +++ b/primitives/trie/src/lib.rs @@ -51,6 +51,7 @@ pub struct Layout(sp_std::marker::PhantomData); impl TrieLayout for Layout { const USE_EXTENSION: bool = false; + const ALLOW_EMPTY: bool = true; type Hash = H; type Codec = NodeCodec; } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index a4e4bd1f16..9016ddbff5 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../frame/executive" } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } -memory-db = { version = "0.20.0", default-features = false } +memory-db = { version = "0.21.0", default-features = false } sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc3"} sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } @@ -39,7 +39,7 @@ pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = ".. sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } sp-trie = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/trie" } sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/transaction-pool" } -trie-db = { version = "0.20.1", default-features = false } +trie-db = { version = "0.21.0", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } sc-service = { version = "0.8.0-rc3", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } -- GitLab From bd72cb62a9c2d8272c577e37e8464b8ba227f8c3 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 18 Jun 2020 09:42:31 +0200 Subject: [PATCH 184/280] Pallet: Atomic Swap (#6349) * Init atomic swap pallet * Implement module swap operations * Add successful swap test * Bump node spec_version * Fix storage name * Add ProofLimit parameter to prevent proof size being too large * Add missing events * Basic weight support * Add basic docs * Mark swap on claim This handles the additional case if `repatriate_reserved` fails. * Add additional expire handler * Update frame/atomic-swap/src/lib.rs Co-authored-by: Shawn Tabrizi * Add docs on ProofLimit * Fix test * Return Ok(()) even when the transfer fails Because we need to mark the swap as claimed no matter what. * Remove retry logic It's overkill. Swap is about something being executed, not necessarily successful. Although there should be logic (reserve and unreserve) to make it so that both parties *believes* that the execution is successful. * succeed -> succeeded * Add docs on duration -- revealer should use duration shorter than counterparty * Missing trait type Co-authored-by: Shawn Tabrizi --- Cargo.lock | 15 ++ Cargo.toml | 1 + bin/node/runtime/src/lib.rs | 4 +- frame/atomic-swap/Cargo.toml | 39 ++++++ frame/atomic-swap/src/lib.rs | 248 +++++++++++++++++++++++++++++++++ frame/atomic-swap/src/tests.rs | 155 +++++++++++++++++++++ 6 files changed, 460 insertions(+), 2 deletions(-) create mode 100644 frame/atomic-swap/Cargo.toml create mode 100644 frame/atomic-swap/src/lib.rs create mode 100644 frame/atomic-swap/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index f67d22aa6e..764157e847 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3845,6 +3845,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-atomic-swap" +version = "2.0.0-rc3" +dependencies = [ + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-aura" version = "2.0.0-rc3" diff --git a/Cargo.toml b/Cargo.toml index d3004fcadc..d1c7339b99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,6 +60,7 @@ members = [ "utils/wasm-builder-runner", "frame/assets", "frame/aura", + "frame/atomic-swap", "frame/authority-discovery", "frame/authorship", "frame/babe", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index feb1b05a8e..cf3d262298 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -97,8 +97,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 252, - impl_version: 1, + spec_version: 253, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml new file mode 100644 index 0000000000..be197096e7 --- /dev/null +++ b/frame/atomic-swap/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "pallet-atomic-swap" +version = "2.0.0-rc3" +authors = ["Parity Technologies "] +edition = "2018" +license = "Apache-2.0" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/substrate/" +description = "FRAME atomic swap pallet" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.101", optional = true } +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } + +[dev-dependencies] +pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } + +[features] +default = ["std"] +std = [ + "serde", + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "sp-io/std", + "sp-core/std", + "pallet-balances/std", +] diff --git a/frame/atomic-swap/src/lib.rs b/frame/atomic-swap/src/lib.rs new file mode 100644 index 0000000000..aa33c9a849 --- /dev/null +++ b/frame/atomic-swap/src/lib.rs @@ -0,0 +1,248 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Atomic swap support pallet + +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +mod tests; + +use sp_std::prelude::*; +use sp_io::hashing::blake2_256; +use frame_support::{ + decl_module, decl_storage, decl_event, decl_error, ensure, + traits::{Get, Currency, ReservableCurrency, BalanceStatus}, + weights::Weight, + dispatch::DispatchResult, +}; +use frame_system::{self as system, ensure_signed}; +use codec::{Encode, Decode}; +use sp_runtime::RuntimeDebug; + +/// Pending atomic swap operation. +#[derive(Clone, RuntimeDebug, Eq, PartialEq, Encode, Decode)] +pub struct PendingSwap { + /// Source of the swap. + pub source: AccountId, + /// Balance value of the swap. + pub balance: Balance, + /// End block of the lock. + pub end_block: BlockNumber, +} + +/// Balance type from the pallet's point of view. +pub type BalanceFor = <::Currency as Currency<::AccountId>>::Balance; + +/// AccountId type from the pallet's point of view. +pub type AccountIdFor = ::AccountId; + +/// BlockNumber type from the pallet's point of view. +pub type BlockNumberFor = ::BlockNumber; + +/// PendingSwap type from the pallet's point of view. +pub type PendingSwapFor = PendingSwap, BalanceFor, BlockNumberFor>; + +/// Hashed proof type. +pub type HashedProof = [u8; 32]; + +/// Atomic swap's pallet configuration trait. +pub trait Trait: frame_system::Trait { + /// The overarching event type. + type Event: From> + Into<::Event>; + /// The currency mechanism. + type Currency: ReservableCurrency; + /// Limit of proof size. + /// + /// Atomic swap is only atomic if once the proof is revealed, both parties can submit the proofs + /// on-chain. If A is the one that generates the proof, then it requires that either: + /// - A's blockchain has the same proof length limit as B's blockchain. + /// - Or A's blockchain has shorter proof length limit as B's blockchain. + /// + /// If B sees A is on a blockchain with larger proof length limit, then it should kindly refuse + /// to accept the atomic swap request if A generates the proof, and asks that B generates the + /// proof instead. + type ProofLimit: Get; +} + +decl_storage! { + trait Store for Module as AtomicSwap { + pub PendingSwaps: double_map + hasher(twox_64_concat) T::AccountId, hasher(blake2_128_concat) HashedProof + => Option>; + } +} + +decl_error! { + pub enum Error for Module { + /// Swap already exists. + AlreadyExist, + /// Swap proof is invalid. + InvalidProof, + /// Proof is too large. + ProofTooLarge, + /// Source does not match. + SourceMismatch, + /// Swap has already been claimed. + AlreadyClaimed, + /// Swap does not exist. + NotExist, + /// Duration has not yet passed for the swap to be cancelled. + DurationNotPassed, + } +} + +decl_event!( + /// Event of atomic swap pallet. + pub enum Event where + Balance = BalanceFor, + AccountId = AccountIdFor, + PendingSwap = PendingSwapFor, + { + /// Swap created. + NewSwap(AccountId, HashedProof, PendingSwap), + /// Swap claimed. The last parameter indicates whether the execution succeeds. + SwapClaimed(AccountId, HashedProof, Balance, bool), + /// Swap cancelled. + SwapCancelled(AccountId, HashedProof), + } +); + +decl_module! { + /// Module definition of atomic swap pallet. + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + fn deposit_event() = default; + + /// Register a new atomic swap, declaring an intention to send funds from origin to target + /// on the current blockchain. The target can claim the fund using the revealed proof. If + /// the fund is not claimed after `duration` blocks, then the sender can cancel the swap. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `target`: Receiver of the atomic swap. + /// - `hashed_proof`: The blake2_256 hash of the secret proof. + /// - `balance`: Funds to be sent from origin. + /// - `duration`: Locked duration of the atomic swap. For safety reasons, it is recommended + /// that the revealer uses a shorter duration than the counterparty, to prevent the + /// situation where the revealer reveals the proof too late around the end block. + #[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)] + fn create_swap( + origin, + target: AccountIdFor, + hashed_proof: HashedProof, + balance: BalanceFor, + duration: BlockNumberFor, + ) { + let source = ensure_signed(origin)?; + ensure!( + !PendingSwaps::::contains_key(&target, hashed_proof), + Error::::AlreadyExist + ); + + T::Currency::reserve(&source, balance)?; + + let swap = PendingSwap { + source, + balance, + end_block: frame_system::Module::::block_number() + duration, + }; + PendingSwaps::::insert(target.clone(), hashed_proof.clone(), swap.clone()); + + Self::deposit_event( + RawEvent::NewSwap(target, hashed_proof, swap) + ); + } + + /// Claim an atomic swap. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `proof`: Revealed proof of the claim. + #[weight = T::DbWeight::get().reads_writes(2, 2) + .saturating_add(40_000_000) + .saturating_add((proof.len() as Weight).saturating_mul(100)) + ] + fn claim_swap( + origin, + proof: Vec, + ) -> DispatchResult { + ensure!( + proof.len() <= T::ProofLimit::get() as usize, + Error::::ProofTooLarge, + ); + + let target = ensure_signed(origin)?; + let hashed_proof = blake2_256(&proof); + + let swap = PendingSwaps::::get(&target, hashed_proof) + .ok_or(Error::::InvalidProof)?; + + let succeeded = T::Currency::repatriate_reserved( + &swap.source, + &target, + swap.balance, + BalanceStatus::Free, + ).is_ok(); + + PendingSwaps::::remove(target.clone(), hashed_proof.clone()); + + Self::deposit_event( + RawEvent::SwapClaimed(target, hashed_proof, swap.balance, succeeded) + ); + + Ok(()) + } + + /// Cancel an atomic swap. Only possible after the originally set duration has passed. + /// + /// The dispatch origin for this call must be _Signed_. + /// + /// - `target`: Target of the original atomic swap. + /// - `hashed_proof`: Hashed proof of the original atomic swap. + #[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)] + fn cancel_swap( + origin, + target: AccountIdFor, + hashed_proof: HashedProof, + ) { + let source = ensure_signed(origin)?; + + let swap = PendingSwaps::::get(&target, hashed_proof) + .ok_or(Error::::NotExist)?; + ensure!( + swap.source == source, + Error::::SourceMismatch, + ); + ensure!( + frame_system::Module::::block_number() >= swap.end_block, + Error::::DurationNotPassed, + ); + + T::Currency::unreserve( + &swap.source, + swap.balance, + ); + PendingSwaps::::remove(&target, hashed_proof.clone()); + + Self::deposit_event( + RawEvent::SwapCancelled(target, hashed_proof) + ); + } + } +} diff --git a/frame/atomic-swap/src/tests.rs b/frame/atomic-swap/src/tests.rs new file mode 100644 index 0000000000..72db841de1 --- /dev/null +++ b/frame/atomic-swap/src/tests.rs @@ -0,0 +1,155 @@ +#![cfg(test)] + +use super::*; + +use frame_support::{ + impl_outer_origin, parameter_types, weights::Weight, +}; +use sp_core::H256; +// The testing primitives are very useful for avoiding having to work with signatures +// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. +use sp_runtime::{ + Perbill, + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; + +impl_outer_origin! { + pub enum Origin for Test where system = frame_system {} +} + +// For testing the pallet, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of pallets we want to use. +#[derive(Clone, Eq, PartialEq)] +pub struct Test; +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); +} +impl frame_system::Trait for Test { + type BaseCallFilter = (); + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Call = (); + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = (); + type BlockHashCount = BlockHashCount; + type MaximumBlockWeight = MaximumBlockWeight; + type DbWeight = (); + type BlockExecutionWeight = (); + type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; + type MaximumBlockLength = MaximumBlockLength; + type AvailableBlockRatio = AvailableBlockRatio; + type Version = (); + type ModuleToIndex = (); + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); +} +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} +impl pallet_balances::Trait for Test { + type Balance = u64; + type DustRemoval = (); + type Event = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; +} +parameter_types! { + pub const ProofLimit: u32 = 1024; + pub const ExpireDuration: u64 = 100; +} +impl Trait for Test { + type Event = (); + type Currency = Balances; + type ProofLimit = ProofLimit; +} +type System = frame_system::Module; +type Balances = pallet_balances::Module; +type AtomicSwap = Module; + +const A: u64 = 1; +const B: u64 = 2; + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let genesis = pallet_balances::GenesisConfig:: { + balances: vec![ + (A, 100), + (B, 200), + ], + }; + genesis.assimilate_storage(&mut t).unwrap(); + t.into() +} + +#[test] +fn two_party_successful_swap() { + let mut chain1 = new_test_ext(); + let mut chain2 = new_test_ext(); + + // A generates a random proof. Keep it secret. + let proof: [u8; 2] = [4, 2]; + // The hashed proof is the blake2_256 hash of the proof. This is public. + let hashed_proof = blake2_256(&proof); + + // A creates the swap on chain1. + chain1.execute_with(|| { + AtomicSwap::create_swap( + Origin::signed(A), + B, + hashed_proof.clone(), + 50, + 1000, + ).unwrap(); + + assert_eq!(Balances::free_balance(A), 100 - 50); + assert_eq!(Balances::free_balance(B), 200); + }); + + // B creates the swap on chain2. + chain2.execute_with(|| { + AtomicSwap::create_swap( + Origin::signed(B), + A, + hashed_proof.clone(), + 75, + 1000, + ).unwrap(); + + assert_eq!(Balances::free_balance(A), 100); + assert_eq!(Balances::free_balance(B), 200 - 75); + }); + + // A reveals the proof and claims the swap on chain2. + chain2.execute_with(|| { + AtomicSwap::claim_swap( + Origin::signed(A), + proof.to_vec(), + ).unwrap(); + + assert_eq!(Balances::free_balance(A), 100 + 75); + assert_eq!(Balances::free_balance(B), 200 - 75); + }); + + // B use the revealed proof to claim the swap on chain1. + chain1.execute_with(|| { + AtomicSwap::claim_swap( + Origin::signed(B), + proof.to_vec(), + ).unwrap(); + + assert_eq!(Balances::free_balance(A), 100 - 50); + assert_eq!(Balances::free_balance(B), 200 + 50); + }); +} -- GitLab From 81ba3e2809056899c050c29154a1bc6b25653b48 Mon Sep 17 00:00:00 2001 From: mattrutherford <44339188+mattrutherford@users.noreply.github.com> Date: Thu, 18 Jun 2020 08:44:03 +0100 Subject: [PATCH 185/280] Runtime interface to add support for tracing from wasm (#6381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add span recording to tracing implementation * Add tracing proxy * switch to rustc_hash::FxHashMap * Replace lazy_static and hashmap with thread_local and vec. * fix marking valid span as invalid while removing invalid spans * refactor, add wasm_tracing module in `support` * update registered spans * tidy up * typos * refactor * update flag name to signal lost trace - `is_valid_trace` * update flag name to signal lost trace - `is_valid_trace` * update docs * update docs * Use tracing Field recording to store the actual `name` and `target` from wasm traces. * fix debug log in subscriber + small refactor * add tests * handle misuse in case trying to exit span not held * Implement filter for wasm traces, simplify field recording for primitive types * remove superfluous warning * update docs * Update primitives/tracing/src/proxy.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Bastian Köcher * update docs, apply suggestions * move Proxy from thread_local to `Extension`, rename macro * fix test * unify native & wasm span macro calls * implement wasm tracing control facility in primitives and frame * add cli flag `--wasm-tracing` * fix * switch to `Option` (possible performance degradation), switch to static mut bool * performance improvement using u64 vs Option * performance improvement moving concat to client * update docs * Update client/cli/src/params/import_params.rs Co-authored-by: Cecile Tonglet * performance improvement * Revert "performance improvement" This reverts commit cff0aa2670cd1d380f1893f0a6f4d498b384e7b7. * small refactor * formatting * bump impl_version * Update client/cli/src/config.rs Co-authored-by: Bastian Köcher * update docs * small fixes, remove pub static * nit * add integration tests and refactor Subscriber * tests * revert formatting * try fix test that works locally but not in CI * try fix test that works locally but not in CI * debug test that works locally but not in CI * fix test that works locally but not in CI * remove pub visibility from bool in runtime * make TracingSpanGuard #[cfg(not(feature = "std"))], update docs, comments * make TracingProxy drop implementation conditional on !empty state * add docs for TraceHandler * remove blank line * update expect message * update tests * rename cli option to tracing_enable_wasm * rename cli option to tracing_enable_wasm * fix * ensure wasm-tracing features are wasm only * bump impl_version * bump impl_version * add `"pallet-scheduler/std"` to `[features]` `std` in node/runtime * refactor service to remove sp_tracing dependency * refactor: line width, trait bounds * improve LogTraceHandler output * fix test * improve tracing log output * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Bastian Köcher * swap wasm indication from trace name to a separate value * Update client/tracing/src/lib.rs * add docs * remove runtime features remove wasm_tracing option from CLI remove wasm_tracing flag from ProfilingSubscriber Co-authored-by: Matt Rutherford Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher Co-authored-by: Cecile Tonglet --- Cargo.lock | 38 ++- bin/node/runtime/Cargo.toml | 1 + client/executor/Cargo.toml | 3 + client/executor/runtime-test/src/lib.rs | 10 +- client/executor/src/integration_tests/mod.rs | 99 ++++++++ client/tracing/Cargo.toml | 2 + client/tracing/src/lib.rs | 237 +++++++++++++------ primitives/io/Cargo.toml | 1 + primitives/io/src/lib.rs | 52 +++- primitives/tracing/Cargo.toml | 4 +- primitives/tracing/src/lib.rs | 34 ++- primitives/tracing/src/proxy.rs | 165 +++++++++++++ 12 files changed, 561 insertions(+), 85 deletions(-) create mode 100644 primitives/tracing/src/proxy.rs diff --git a/Cargo.lock b/Cargo.lock index 764157e847..2c1d3e2c4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5636,6 +5636,27 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "rental" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f" +dependencies = [ + "rental-impl", + "stable_deref_trait", +] + +[[package]] +name = "rental-impl" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" +dependencies = [ + "proc-macro2", + "quote 1.0.6", + "syn 1.0.17", +] + [[package]] name = "ring" version = "0.16.12" @@ -6246,6 +6267,7 @@ dependencies = [ "sc-executor-wasmi", "sc-executor-wasmtime", "sc-runtime-test", + "sc-tracing", "sp-api", "sp-core", "sp-externalities", @@ -6255,11 +6277,13 @@ dependencies = [ "sp-runtime-interface", "sp-serializer", "sp-state-machine", + "sp-tracing", "sp-trie", "sp-version", "sp-wasm-interface", "substrate-test-runtime", "test-case", + "tracing", "wabt", "wasmi", ] @@ -6820,10 +6844,12 @@ dependencies = [ "erased-serde", "log", "parking_lot 0.10.2", + "rustc-hash", "sc-telemetry", "serde", "serde_json", "slog", + "sp-tracing", "tracing", "tracing-core", ] @@ -7581,6 +7607,7 @@ dependencies = [ "sp-runtime-interface", "sp-state-machine", "sp-std", + "sp-tracing", "sp-trie", "sp-wasm-interface", ] @@ -7856,6 +7883,8 @@ dependencies = [ name = "sp-tracing" version = "2.0.0-rc3" dependencies = [ + "log", + "rental", "tracing", ] @@ -8914,9 +8943,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" +checksum = "a7c6b59d116d218cb2d990eb06b77b64043e0268ef7323aae63d8b30ae462923" dependencies = [ "cfg-if", "tracing-attributes", @@ -8925,10 +8954,11 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" +checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" dependencies = [ + "proc-macro2", "quote 1.0.6", "syn 1.0.17", ] diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index ebe3196dd7..7cc4018fb6 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -111,6 +111,7 @@ std = [ "pallet-membership/std", "pallet-multisig/std", "pallet-identity/std", + "pallet-scheduler/std", "node-primitives/std", "sp-offchain/std", "pallet-offences/std", diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index 9eee3de1e2..96d2d9eb94 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -44,6 +44,9 @@ substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runti sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } test-case = "0.3.3" sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc3", path = "../../primitives/tracing" } +sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } +tracing = "0.1.14" [features] default = [ "std" ] diff --git a/client/executor/runtime-test/src/lib.rs b/client/executor/runtime-test/src/lib.rs index dc6bab759e..4962c558ea 100644 --- a/client/executor/runtime-test/src/lib.rs +++ b/client/executor/runtime-test/src/lib.rs @@ -10,7 +10,7 @@ use sp_std::{vec::Vec, vec}; #[cfg(not(feature = "std"))] use sp_io::{ storage, hashing::{blake2_128, blake2_256, sha2_256, twox_128, twox_256}, - crypto::{ed25519_verify, sr25519_verify}, + crypto::{ed25519_verify, sr25519_verify}, wasm_tracing, }; #[cfg(not(feature = "std"))] use sp_runtime::{print, traits::{BlakeTwo256, Hash}}; @@ -246,6 +246,14 @@ sp_core::wasm_export_functions! { sp_allocator::FreeingBumpHeapAllocator::new(0); } + fn test_enter_span() -> u64 { + wasm_tracing::enter_span("integration_test_span_target", "integration_test_span_name") + } + + fn test_exit_span(span_id: u64) { + wasm_tracing::exit_span(span_id) + } + fn returns_mutable_static() -> u64 { unsafe { MUTABLE_STATIC += 1; diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 80b123ed4b..f07e98178b 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -658,3 +658,102 @@ fn parallel_execution(wasm_method: WasmExecutionMethod) { t.join().unwrap(); } } + +#[test_case(WasmExecutionMethod::Interpreted)] +fn wasm_tracing_should_work(wasm_method: WasmExecutionMethod) { + + use std::sync::{Arc, Mutex}; + + use sc_tracing::SpanDatum; + + impl sc_tracing::TraceHandler for TestTraceHandler { + fn process_span(&self, sd: SpanDatum) { + self.0.lock().unwrap().push(sd); + } + } + + struct TestTraceHandler(Arc>>); + + let traces = Arc::new(Mutex::new(Vec::new())); + let handler = TestTraceHandler(traces.clone()); + + // Create subscriber with wasm_tracing disabled + let test_subscriber = sc_tracing::ProfilingSubscriber::new_with_handler( + Box::new(handler), "integration_test_span_target"); + + let _guard = tracing::subscriber::set_default(test_subscriber); + + let mut ext = TestExternalities::default(); + let mut ext = ext.ext(); + + // Test tracing disabled + assert!(!sp_tracing::wasm_tracing_enabled()); + + let span_id = call_in_wasm( + "test_enter_span", + &[], + wasm_method, + &mut ext, + ).unwrap(); + + assert_eq!( + 0u64.encode(), + span_id + ); + // Repeat to check span id always 0 when deactivated + let span_id = call_in_wasm( + "test_enter_span", + &[], + wasm_method, + &mut ext, + ).unwrap(); + + assert_eq!( + 0u64.encode(), + span_id + ); + + call_in_wasm( + "test_exit_span", + &span_id.encode(), + wasm_method, + &mut ext, + ).unwrap(); + // Check span has not been recorded + let len = traces.lock().unwrap().len(); + assert_eq!(len, 0); + + // Test tracing enabled + sp_tracing::set_wasm_tracing(true); + + let span_id = call_in_wasm( + "test_enter_span", + &[], + wasm_method, + &mut ext, + ).unwrap(); + + let span_id = u64::decode(&mut &span_id[..]).unwrap(); + + assert!( + span_id > 0 + ); + + call_in_wasm( + "test_exit_span", + &span_id.encode(), + wasm_method, + &mut ext, + ).unwrap(); + + // Check there is only the single trace + let len = traces.lock().unwrap().len(); + assert_eq!(len, 1); + + let span_datum = traces.lock().unwrap().pop().unwrap(); + let values = span_datum.values.into_inner(); + assert_eq!(span_datum.target, "integration_test_span_target"); + assert_eq!(span_datum.name, "integration_test_span_name"); + assert_eq!(values.get("wasm").unwrap(), "true"); + assert_eq!(values.get("is_valid_trace").unwrap(), "true"); +} diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index bc402442b9..c4345648ef 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -15,10 +15,12 @@ targets = ["x86_64-unknown-linux-gnu"] erased-serde = "0.3.9" log = { version = "0.4.8" } parking_lot = "0.10.0" +rustc-hash = "1.1.0" serde = "1.0.101" serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" +sp-tracing = { version = "2.0.0-rc2", path = "../../primitives/tracing" } sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } diff --git a/client/tracing/src/lib.rs b/client/tracing/src/lib.rs index d450700ed3..c62b8d5b1e 100644 --- a/client/tracing/src/lib.rs +++ b/client/tracing/src/lib.rs @@ -24,7 +24,7 @@ //! //! Currently we provide `Log` (default), `Telemetry` variants for `Receiver` -use std::collections::HashMap; +use rustc_hash::FxHashMap; use std::fmt; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::{Duration, Instant}; @@ -38,10 +38,14 @@ use tracing_core::{ Level, metadata::Metadata, span::{Attributes, Id, Record}, - subscriber::Subscriber + subscriber::Subscriber, }; use sc_telemetry::{telemetry, SUBSTRATE_INFO}; +use sp_tracing::proxy::{WASM_NAME_KEY, WASM_TARGET_KEY, WASM_TRACE_IDENTIFIER}; + +const ZERO_DURATION: Duration = Duration::from_nanos(0); +const PROXY_TARGET: &'static str = "sp_tracing::proxy"; /// Used to configure how to receive the metrics #[derive(Debug, Clone)] @@ -58,36 +62,55 @@ impl Default for TracingReceiver { } } +/// A handler for tracing `SpanDatum` +pub trait TraceHandler: Send + Sync { + /// Process a `SpanDatum` + fn process_span(&self, span: SpanDatum); +} + +/// Represents a single instance of a tracing span #[derive(Debug)] -struct SpanDatum { - id: u64, - name: &'static str, - target: &'static str, - level: Level, - line: u32, - start_time: Instant, - overall_time: Duration, - values: Visitor, +pub struct SpanDatum { + pub id: u64, + pub name: String, + pub target: String, + pub level: Level, + pub line: u32, + pub start_time: Instant, + pub overall_time: Duration, + pub values: Visitor, } +/// Holds associated values for a tracing span #[derive(Clone, Debug)] -struct Visitor(Vec<(String, String)>); +pub struct Visitor(FxHashMap); + +impl Visitor { + /// Consume the Visitor, returning the inner FxHashMap + pub fn into_inner(self) -> FxHashMap { + self.0 + } +} impl Visit for Visitor { fn record_i64(&mut self, field: &Field, value: i64) { - self.record_debug(field, &value) + self.0.insert(field.name().to_string(), value.to_string()); } fn record_u64(&mut self, field: &Field, value: u64) { - self.record_debug(field, &value) + self.0.insert(field.name().to_string(), value.to_string()); } fn record_bool(&mut self, field: &Field, value: bool) { - self.record_debug(field, &value) + self.0.insert(field.name().to_string(), value.to_string()); + } + + fn record_str(&mut self, field: &Field, value: &str) { + self.0.insert(field.name().to_string(), value.to_owned()); } fn record_debug(&mut self, field: &Field, value: &dyn std::fmt::Debug) { - self.0.push((field.name().to_string(), format!("{:?}",value))); + self.0.insert(field.name().to_string(), format!("{:?}", value)); } } @@ -105,7 +128,7 @@ impl Serialize for Visitor { impl fmt::Display for Visitor { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let values = self.0.iter().map(|(k,v)| format!("{}={}",k,v)).collect::>().join(", "); + let values = self.0.iter().map(|(k, v)| format!("{}={}", k, v)).collect::>().join(", "); write!(f, "{}", values) } } @@ -135,23 +158,50 @@ impl Value for Visitor { pub struct ProfilingSubscriber { next_id: AtomicU64, targets: Vec<(String, Level)>, - receiver: TracingReceiver, - span_data: Mutex>, + trace_handler: Box, + span_data: Mutex>, } impl ProfilingSubscriber { - /// Takes a `Receiver` and a comma separated list of targets, - /// either with a level: "pallet=trace" - /// or without: "pallet". - pub fn new(receiver: TracingReceiver, targets: &str) -> Self { + /// Takes a `TracingReceiver` and a comma separated list of targets, + /// either with a level: "pallet=trace,frame=debug" + /// or without: "pallet,frame" in which case the level defaults to `trace`. + /// wasm_tracing indicates whether to enable wasm traces + pub fn new(receiver: TracingReceiver, targets: &str) -> ProfilingSubscriber { + match receiver { + TracingReceiver::Log => Self::new_with_handler(Box::new(LogTraceHandler), targets), + TracingReceiver::Telemetry => Self::new_with_handler( + Box::new(TelemetryTraceHandler), + targets, + ), + } + } + + /// Allows use of a custom TraceHandler to create a new instance of ProfilingSubscriber. + /// Takes a comma separated list of targets, + /// either with a level, eg: "pallet=trace" + /// or without: "pallet" in which case the level defaults to `trace`. + /// wasm_tracing indicates whether to enable wasm traces + pub fn new_with_handler(trace_handler: Box, targets: &str) + -> ProfilingSubscriber + { let targets: Vec<_> = targets.split(',').map(|s| parse_target(s)).collect(); ProfilingSubscriber { next_id: AtomicU64::new(1), targets, - receiver, - span_data: Mutex::new(HashMap::new()), + trace_handler, + span_data: Mutex::new(FxHashMap::default()), } } + + fn check_target(&self, target: &str, level: &Level) -> bool { + for t in &self.targets { + if target.starts_with(t.0.as_str()) && level <= &t.1 { + return true; + } + } + false + } } // Default to TRACE if no level given or unable to parse Level @@ -173,36 +223,45 @@ fn parse_target(s: &str) -> (String, Level) { impl Subscriber for ProfilingSubscriber { fn enabled(&self, metadata: &Metadata<'_>) -> bool { - for t in &self.targets { - if metadata.target().starts_with(t.0.as_str()) && metadata.level() <= &t.1 { - log::debug!("Enabled target: {}, level: {}", metadata.target(), metadata.level()); - return true; - } else { - log::debug!("Disabled target: {}, level: {}", metadata.target(), metadata.level()); - } + if metadata.target() == PROXY_TARGET || self.check_target(metadata.target(), metadata.level()) { + log::debug!(target: "tracing", "Enabled target: {}, level: {}", metadata.target(), metadata.level()); + true + } else { + log::debug!(target: "tracing", "Disabled target: {}, level: {}", metadata.target(), metadata.level()); + false } - false } fn new_span(&self, attrs: &Attributes<'_>) -> Id { let id = self.next_id.fetch_add(1, Ordering::Relaxed); - let mut values = Visitor(Vec::new()); + let mut values = Visitor(FxHashMap::default()); attrs.record(&mut values); + // If this is a wasm trace, check if target/level is enabled + if let Some(wasm_target) = values.0.get(WASM_TARGET_KEY) { + if !self.check_target(wasm_target, attrs.metadata().level()) { + return Id::from_u64(id); + } + } let span_datum = SpanDatum { id, - name: attrs.metadata().name(), - target: attrs.metadata().target(), + name: attrs.metadata().name().to_owned(), + target: attrs.metadata().target().to_owned(), level: attrs.metadata().level().clone(), line: attrs.metadata().line().unwrap_or(0), start_time: Instant::now(), - overall_time: Duration::from_nanos(0), + overall_time: ZERO_DURATION, values, }; self.span_data.lock().insert(id, span_datum); Id::from_u64(id) } - fn record(&self, _span: &Id, _values: &Record<'_>) {} + fn record(&self, span: &Id, values: &Record<'_>) { + let mut span_data = self.span_data.lock(); + if let Some(s) = span_data.get_mut(&span.into_u64()) { + values.record(&mut s.values); + } + } fn record_follows_from(&self, _span: &Id, _follows: &Id) {} @@ -213,65 +272,89 @@ impl Subscriber for ProfilingSubscriber { let start_time = Instant::now(); if let Some(mut s) = span_data.get_mut(&span.into_u64()) { s.start_time = start_time; - } else { - log::warn!("Tried to enter span {:?} that has already been closed!", span); } } fn exit(&self, span: &Id) { - let mut span_data = self.span_data.lock(); let end_time = Instant::now(); + let mut span_data = self.span_data.lock(); if let Some(mut s) = span_data.get_mut(&span.into_u64()) { s.overall_time = end_time - s.start_time + s.overall_time; } } fn try_close(&self, span: Id) -> bool { - let mut span_data = self.span_data.lock(); - if let Some(data) = span_data.remove(&span.into_u64()) { - self.send_span(data); + let span_datum = { + let mut span_data = self.span_data.lock(); + span_data.remove(&span.into_u64()) + }; + if let Some(mut span_datum) = span_datum { + if span_datum.name == WASM_TRACE_IDENTIFIER { + span_datum.values.0.insert("wasm".to_owned(), "true".to_owned()); + if let Some(n) = span_datum.values.0.remove(WASM_NAME_KEY) { + span_datum.name = n; + } + if let Some(t) = span_datum.values.0.remove(WASM_TARGET_KEY) { + span_datum.target = t; + } + } + if self.check_target(&span_datum.target, &span_datum.level) { + self.trace_handler.process_span(span_datum); + } }; true } } -impl ProfilingSubscriber { - fn send_span(&self, span_datum: SpanDatum) { - match self.receiver { - TracingReceiver::Log => print_log(span_datum), - TracingReceiver::Telemetry => send_telemetry(span_datum), - } +/// TraceHandler for sending span data to the logger +pub struct LogTraceHandler; + +fn log_level(level: Level) -> log::Level { + match level { + Level::TRACE => log::Level::Trace, + Level::DEBUG => log::Level::Debug, + Level::INFO => log::Level::Info, + Level::WARN => log::Level::Warn, + Level::ERROR => log::Level::Error, } } -fn print_log(span_datum: SpanDatum) { - if span_datum.values.0.is_empty() { - log::info!("TRACING: {} {}: {}, line: {}, time: {}", - span_datum.level, - span_datum.target, - span_datum.name, - span_datum.line, - span_datum.overall_time.as_nanos(), - ); - } else { - log::info!("TRACING: {} {}: {}, line: {}, time: {}, {}", - span_datum.level, - span_datum.target, - span_datum.name, - span_datum.line, - span_datum.overall_time.as_nanos(), - span_datum.values - ); +impl TraceHandler for LogTraceHandler { + fn process_span(&self, span_datum: SpanDatum) { + if span_datum.values.0.is_empty() { + log::log!( + log_level(span_datum.level), + "{}: {}, time: {}", + span_datum.target, + span_datum.name, + span_datum.overall_time.as_nanos(), + ); + } else { + log::log!( + log_level(span_datum.level), + "{}: {}, time: {}, {}", + span_datum.target, + span_datum.name, + span_datum.overall_time.as_nanos(), + span_datum.values, + ); + } } } -fn send_telemetry(span_datum: SpanDatum) { - telemetry!(SUBSTRATE_INFO; "tracing.profiling"; - "name" => span_datum.name, - "target" => span_datum.target, - "line" => span_datum.line, - "time" => span_datum.overall_time.as_nanos(), - "values" => span_datum.values - ); +/// TraceHandler for sending span data to telemetry, +/// Please see telemetry documentation for details on how to specify endpoints and +/// set the required telemetry level to activate tracing messages +pub struct TelemetryTraceHandler; + +impl TraceHandler for TelemetryTraceHandler { + fn process_span(&self, span_datum: SpanDatum) { + telemetry!(SUBSTRATE_INFO; "tracing.profiling"; + "name" => span_datum.name, + "target" => span_datum.target, + "line" => span_datum.line, + "time" => span_datum.overall_time.as_nanos(), + "values" => span_datum.values + ); + } } - diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index 353532b1b4..df66740d65 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -24,6 +24,7 @@ sp-wasm-interface = { version = "2.0.0-rc3", path = "../../primitives/wasm-inter sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../runtime-interface" } sp-trie = { version = "2.0.0-rc3", optional = true, path = "../../primitives/trie" } sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } +sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../tracing" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index 8d81a84c4c..1d5e01bdff 100644 --- a/primitives/io/src/lib.rs +++ b/primitives/io/src/lib.rs @@ -216,7 +216,7 @@ pub trait DefaultChildStorage { /// Clear a child storage key. /// /// For the default child storage at `storage_key`, clear value at `key`. - fn clear ( + fn clear( &mut self, storage_key: &[u8], key: &[u8], @@ -965,6 +965,55 @@ pub trait Logging { } } +#[cfg(feature = "std")] +sp_externalities::decl_extension! { + /// Extension to allow running traces in wasm via Proxy + pub struct TracingProxyExt(sp_tracing::proxy::TracingProxy); +} + +/// Interface that provides functions for profiling the runtime. +#[runtime_interface] +pub trait WasmTracing { + /// To create and enter a `tracing` span, using `sp_tracing::proxy` + /// Returns 0 value to indicate that no further traces should be attempted + fn enter_span(&mut self, target: &str, name: &str) -> u64 { + if sp_tracing::wasm_tracing_enabled() { + match self.extension::() { + Some(proxy) => return proxy.enter_span(target, name), + None => { + if self.register_extension(TracingProxyExt(sp_tracing::proxy::TracingProxy::new())).is_ok() { + if let Some(proxy) = self.extension::() { + return proxy.enter_span(target, name); + } + } else { + log::warn!( + target: "tracing", + "Unable to register extension: TracingProxyExt" + ); + } + } + } + } + log::debug!( + target: "tracing", + "Notify to runtime that tracing is disabled." + ); + 0 + } + + /// Exit a `tracing` span, using `sp_tracing::proxy` + fn exit_span(&mut self, id: u64) { + if let Some(proxy) = self.extension::() { + proxy.exit_span(id) + } else { + log::warn!( + target: "tracing", + "Unable to load extension: TracingProxyExt" + ); + } + } +} + /// Wasm-only interface that provides functions for interacting with the sandbox. #[runtime_interface(wasm_only)] pub trait Sandbox { @@ -1111,6 +1160,7 @@ pub type SubstrateHostFunctions = ( storage::HostFunctions, default_child_storage::HostFunctions, misc::HostFunctions, + wasm_tracing::HostFunctions, offchain::HostFunctions, crypto::HostFunctions, hashing::HostFunctions, diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index f0560adb06..e47d9859c9 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -13,7 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] tracing = { version = "0.1.13", optional = true } +rental = { version = "0.5.5", optional = true } +log = { version = "0.4.8", optional = true } [features] default = [ "std" ] -std = [ "tracing" ] +std = [ "tracing", "rental", "log" ] diff --git a/primitives/tracing/src/lib.rs b/primitives/tracing/src/lib.rs index fa43f812d2..e82d8861cd 100644 --- a/primitives/tracing/src/lib.rs +++ b/primitives/tracing/src/lib.rs @@ -19,13 +19,35 @@ //! //! To trace functions or invidual code in Substrate, this crate provides [`tracing_span`] //! and [`enter_span`]. See the individual docs for how to use these macros. - +//! +//! Note that to allow traces from wasm execution environment there are +//! 2 reserved identifiers for tracing `Field` recording, stored in the consts: +//! `WASM_TARGET_KEY` and `WASM_NAME_KEY` - if you choose to record fields, you +//! must ensure that your identifiers do not clash with either of these. +//! +//! Additionally, we have a const: `WASM_TRACE_IDENTIFIER`, which holds a span name used +//! to signal that the 'actual' span name and target should be retrieved instead from +//! the associated Fields mentioned above. #![cfg_attr(not(feature = "std"), no_std)] +#[cfg(feature = "std")] +#[macro_use] +extern crate rental; + #[cfg(feature = "std")] #[doc(hidden)] pub use tracing; +#[cfg(feature = "std")] +pub mod proxy; + +#[cfg(feature = "std")] +use std::sync::atomic::{AtomicBool, Ordering}; + +/// Flag to signal whether to run wasm tracing +#[cfg(feature = "std")] +static WASM_TRACING_ENABLED: AtomicBool = AtomicBool::new(false); + /// Runs given code within a tracing span, measuring it's execution time. /// /// If tracing is not enabled, the code is still executed. @@ -83,3 +105,13 @@ macro_rules! if_tracing { macro_rules! if_tracing { ( $if:expr ) => {{}} } + +#[cfg(feature = "std")] +pub fn wasm_tracing_enabled() -> bool { + WASM_TRACING_ENABLED.load(Ordering::Relaxed) +} + +#[cfg(feature = "std")] +pub fn set_wasm_tracing(b: bool) { + WASM_TRACING_ENABLED.store(b, Ordering::Relaxed) +} \ No newline at end of file diff --git a/primitives/tracing/src/proxy.rs b/primitives/tracing/src/proxy.rs new file mode 100644 index 0000000000..270f57aaa6 --- /dev/null +++ b/primitives/tracing/src/proxy.rs @@ -0,0 +1,165 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Proxy to allow entering tracing spans from wasm. +//! +//! Use `enter_span` and `exit_span` to surround the code that you wish to trace +use rental; +use tracing::info_span; + +/// Used to identify a proxied WASM trace +pub const WASM_TRACE_IDENTIFIER: &'static str = "WASM_TRACE"; +/// Used to extract the real `target` from the associated values of the span +pub const WASM_TARGET_KEY: &'static str = "proxied_wasm_target"; +/// Used to extract the real `name` from the associated values of the span +pub const WASM_NAME_KEY: &'static str = "proxied_wasm_name"; + +const MAX_SPANS_LEN: usize = 1000; + +rental! { + pub mod rent_span { + #[rental] + pub struct SpanAndGuard { + span: Box, + guard: tracing::span::Entered<'span>, + } + } +} + +/// Requires a tracing::Subscriber to process span traces, +/// this is available when running with client (and relevant cli params). +pub struct TracingProxy { + next_id: u64, + spans: Vec<(u64, rent_span::SpanAndGuard)>, +} + +impl Drop for TracingProxy { + fn drop(&mut self) { + if !self.spans.is_empty() { + log::debug!( + target: "tracing", + "Dropping TracingProxy with {} un-exited spans, marking as not valid", self.spans.len() + ); + while let Some((_, mut sg)) = self.spans.pop() { + sg.rent_all_mut(|s| { s.span.record("is_valid_trace", &false); }); + } + } + } +} + +impl TracingProxy { + pub fn new() -> TracingProxy { + TracingProxy { + next_id: 0, + spans: Vec::new(), + } + } +} + +impl TracingProxy { + /// Create and enter a `tracing` Span, returning the span id, + /// which should be passed to `exit_span(id)` to signal that the span should exit. + pub fn enter_span(&mut self, proxied_wasm_target: &str, proxied_wasm_name: &str) -> u64 { + // The identifiers `proxied_wasm_target` and `proxied_wasm_name` must match their associated const, + // WASM_TARGET_KEY and WASM_NAME_KEY. + let span = info_span!(WASM_TRACE_IDENTIFIER, is_valid_trace = true, proxied_wasm_target, proxied_wasm_name); + self.next_id += 1; + let sg = rent_span::SpanAndGuard::new( + Box::new(span), + |span| span.enter(), + ); + self.spans.push((self.next_id, sg)); + if self.spans.len() > MAX_SPANS_LEN { + // This is to prevent unbounded growth of Vec and could mean one of the following: + // 1. Too many nested spans, or MAX_SPANS_LEN is too low. + // 2. Not correctly exiting spans due to misconfiguration / misuse + log::warn!( + target: "tracing", + "TracingProxy MAX_SPANS_LEN exceeded, removing oldest span." + ); + let mut sg = self.spans.remove(0).1; + sg.rent_all_mut(|s| { s.span.record("is_valid_trace", &false); }); + } + self.next_id + } + + /// Exit a span by dropping it along with it's associated guard. + pub fn exit_span(&mut self, id: u64) { + if self.spans.last().map(|l| id > l.0).unwrap_or(true) { + log::warn!(target: "tracing", "Span id not found in TracingProxy: {}", id); + return; + } + let mut last_span = self.spans.pop().expect("Just checked that there is an element to pop; qed"); + while id < last_span.0 { + log::warn!( + target: "tracing", + "TracingProxy Span ids not equal! id parameter given: {}, last span: {}", + id, + last_span.0, + ); + last_span.1.rent_all_mut(|s| { s.span.record("is_valid_trace", &false); }); + if let Some(s) = self.spans.pop() { + last_span = s; + } else { + log::warn!(target: "tracing", "Span id not found in TracingProxy {}", id); + return; + } + } + } +} + + +#[cfg(test)] +mod tests { + use super::*; + + fn create_spans(proxy: &mut TracingProxy, qty: usize) -> Vec { + let mut spans = Vec::new(); + for n in 0..qty { + spans.push(proxy.enter_span("target", &format!("{}", n))); + } + spans + } + + #[test] + fn max_spans_len_respected() { + let mut proxy = TracingProxy::new(); + let _spans = create_spans(&mut proxy, MAX_SPANS_LEN + 10); + assert_eq!(proxy.spans.len(), MAX_SPANS_LEN); + // ensure oldest spans removed + assert_eq!(proxy.spans[0].0, 11); + } + + #[test] + fn handles_span_exit_scenarios() { + let mut proxy = TracingProxy::new(); + let _spans = create_spans(&mut proxy, 10); + assert_eq!(proxy.spans.len(), 10); + // exit span normally + proxy.exit_span(10); + assert_eq!(proxy.spans.len(), 9); + // skip and exit outer span without exiting inner, id: 8 instead of 9 + proxy.exit_span(8); + // should have also removed the inner span that was lost + assert_eq!(proxy.spans.len(), 7); + // try to exit span not held + proxy.exit_span(9); + assert_eq!(proxy.spans.len(), 7); + // exit all spans + proxy.exit_span(1); + assert_eq!(proxy.spans.len(), 0); + } +} -- GitLab From 9a5892e187f7d9b3f058b549ad5859793d117d7b Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 18 Jun 2020 10:39:54 +0200 Subject: [PATCH 186/280] Block packet size limit --- client/network/src/protocol.rs | 8 +++++++- client/network/src/protocol/sync.rs | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 764c416495..6e08215050 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -92,6 +92,10 @@ pub(crate) const MIN_VERSION: u32 = 3; // Maximum allowed entries in `BlockResponse` const MAX_BLOCK_DATA_RESPONSE: u32 = 128; +// Maximum total bytes allowed for block bodies in `BlockResponse` +// TODO: increase this to 4Mb once yamux limit is increased +const MAX_BODIES_BYTES: usize = 1 * 1024 * 1024; + /// When light node connects to the full node and the full node is behind light node /// for at least `LIGHT_MAXIMAL_BLOCKS_DIFFERENCE` blocks, we consider it not useful /// and disconnect to free connection slot. @@ -762,8 +766,9 @@ impl Protocol { let get_justification = request .fields .contains(message::BlockAttributes::JUSTIFICATION); + let mut total_size = 0; while let Some(header) = self.context_data.chain.header(id).unwrap_or(None) { - if blocks.len() >= max { + if blocks.len() >= max || total_size > MAX_BODIES_BYTES { break; } let number = *header.number(); @@ -794,6 +799,7 @@ impl Protocol { trace!(target: "sync", "Missing data for block request."); break; } + total_size += block_data.body.as_ref().map_or(0, |b| b.len()); blocks.push(block_data); match request.direction { message::Direction::Ascending => id = BlockId::Number(number + One::one()), diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index 781d410fff..453d3f6f04 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -54,7 +54,8 @@ mod blocks; mod extra_requests; /// Maximum blocks to request in a single packet. -const MAX_BLOCKS_TO_REQUEST: usize = 128; +/// TODO: set to 128 once yamux issue is resolved. +const MAX_BLOCKS_TO_REQUEST: usize = 64; /// Maximum blocks to store in the import queue. const MAX_IMPORTING_BLOCKS: usize = 2048; -- GitLab From 0bb3001a41ed63eb825a04b811cb13c2b2a2515d Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 18 Jun 2020 10:43:03 +0200 Subject: [PATCH 187/280] Revert "Block packet size limit" This reverts commit 9a5892e187f7d9b3f058b549ad5859793d117d7b. --- client/network/src/protocol.rs | 8 +------- client/network/src/protocol/sync.rs | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 6e08215050..764c416495 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -92,10 +92,6 @@ pub(crate) const MIN_VERSION: u32 = 3; // Maximum allowed entries in `BlockResponse` const MAX_BLOCK_DATA_RESPONSE: u32 = 128; -// Maximum total bytes allowed for block bodies in `BlockResponse` -// TODO: increase this to 4Mb once yamux limit is increased -const MAX_BODIES_BYTES: usize = 1 * 1024 * 1024; - /// When light node connects to the full node and the full node is behind light node /// for at least `LIGHT_MAXIMAL_BLOCKS_DIFFERENCE` blocks, we consider it not useful /// and disconnect to free connection slot. @@ -766,9 +762,8 @@ impl Protocol { let get_justification = request .fields .contains(message::BlockAttributes::JUSTIFICATION); - let mut total_size = 0; while let Some(header) = self.context_data.chain.header(id).unwrap_or(None) { - if blocks.len() >= max || total_size > MAX_BODIES_BYTES { + if blocks.len() >= max { break; } let number = *header.number(); @@ -799,7 +794,6 @@ impl Protocol { trace!(target: "sync", "Missing data for block request."); break; } - total_size += block_data.body.as_ref().map_or(0, |b| b.len()); blocks.push(block_data); match request.direction { message::Direction::Ascending => id = BlockId::Number(number + One::one()), diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index 453d3f6f04..781d410fff 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -54,8 +54,7 @@ mod blocks; mod extra_requests; /// Maximum blocks to request in a single packet. -/// TODO: set to 128 once yamux issue is resolved. -const MAX_BLOCKS_TO_REQUEST: usize = 64; +const MAX_BLOCKS_TO_REQUEST: usize = 128; /// Maximum blocks to store in the import queue. const MAX_IMPORTING_BLOCKS: usize = 2048; -- GitLab From 94023340a1ff4ccde5a46fe2395f73e5d6fbcb95 Mon Sep 17 00:00:00 2001 From: ddorgan Date: Thu, 18 Jun 2020 10:48:34 +0100 Subject: [PATCH 188/280] Update s3 artifact url (#6399) --- .maintain/flamingfir-deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.maintain/flamingfir-deploy.sh b/.maintain/flamingfir-deploy.sh index 596bb04ece..8f0fb3a2bc 100755 --- a/.maintain/flamingfir-deploy.sh +++ b/.maintain/flamingfir-deploy.sh @@ -5,7 +5,7 @@ RETRY_ATTEMPT=0 SLEEP_TIME=15 TARGET_HOST="$1" COMMIT=$(cat artifacts/substrate/VERSION) -DOWNLOAD_URL="https://releases.parity.io/substrate/x86_64-debian:stretch/${COMMIT}/substrate" +DOWNLOAD_URL="https://releases.parity.io/substrate/x86_64-debian:stretch/${COMMIT}/substrate/substrate" POST_DATA='{"extra_vars":{"artifact_path":"'${DOWNLOAD_URL}'","target_host":"'${TARGET_HOST}'"}}' JOB_ID=$(wget -O - --header "Authorization: Bearer ${AWX_TOKEN}" --header "Content-type: application/json" --post-data "${POST_DATA}" https://ansible-awx.parity.io/api/v2/job_templates/32/launch/ | jq .job) -- GitLab From 44978b9b13cc0bd235519c5f1122f9b2ed8ff807 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 18 Jun 2020 13:55:45 +0200 Subject: [PATCH 189/280] Increase network buffer sizes even more (#6080) --- client/network/src/service.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 2297fe6a52..4b4a040e83 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -298,8 +298,8 @@ impl NetworkWorker { }; let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id.clone()) .peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER) - .notify_handler_buffer_size(NonZeroUsize::new(16).expect("16 != 0; qed")) - .connection_event_buffer_size(128); + .notify_handler_buffer_size(NonZeroUsize::new(32).expect("32 != 0; qed")) + .connection_event_buffer_size(1024); if let Some(spawner) = params.executor { struct SpawnImpl(F); impl + Send>>)> Executor for SpawnImpl { -- GitLab From cb833913c4308b6342474d3ec16e4e34ddf43670 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Thu, 18 Jun 2020 17:01:23 +0200 Subject: [PATCH 190/280] Remove pallet-balances from non-dev-deps (#6407) --- frame/atomic-swap/Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml index be197096e7..a3bf95b2e2 100644 --- a/frame/atomic-swap/Cargo.toml +++ b/frame/atomic-swap/Cargo.toml @@ -22,7 +22,7 @@ sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primiti sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-rc3", path = "../balances" } [features] default = ["std"] @@ -35,5 +35,4 @@ std = [ "sp-std/std", "sp-io/std", "sp-core/std", - "pallet-balances/std", ] -- GitLab From 9b08492e1e7d9a939c0cd9de19059be0b42c4deb Mon Sep 17 00:00:00 2001 From: Rakan Alhneiti Date: Thu, 18 Jun 2020 20:37:49 +0200 Subject: [PATCH 191/280] Babe VRF Signing in keystore (#6225) * Introduce trait * Implement VRFSigner in keystore * Use vrf_sign from keystore * Convert output to VRFInOut * Simplify conversion * vrf_sign secondary slot using keystore * Fix RPC call to claim_slot * Use Public instead of Pair * Check primary threshold in signer * Fix interface to return error * Move vrf_sign to BareCryptoStore * Fix authorship_works test * Fix BABE logic leaks * Acquire a read lock once * Also fix RPC acquiring the read lock once * Implement a generic way to construct VRF Transcript * Use make_transcript_data to call sr25519_vrf_sign * Make sure VRFTranscriptData is serializable * Cleanup * Move VRF to it's own module * Implement & test VRF signing in testing module * Remove leftover * Fix feature requirements * Revert removing vec macro * Drop keystore pointer to prevent deadlock * Nitpicks * Add test to make sure make_transcript works * Fix mismatch in VRF transcript * Add a test to verify transcripts match in babe * Return VRFOutput and VRFProof from keystore --- Cargo.lock | 4 + client/consensus/babe/Cargo.toml | 1 + client/consensus/babe/rpc/Cargo.toml | 2 +- client/consensus/babe/rpc/src/lib.rs | 22 ++-- client/consensus/babe/src/authorship.rs | 133 ++++++++++++++---------- client/consensus/babe/src/tests.rs | 48 ++++++++- client/keystore/Cargo.toml | 3 +- client/keystore/src/lib.rs | 21 +++- primitives/consensus/babe/Cargo.toml | 2 + primitives/consensus/babe/src/lib.rs | 19 ++++ primitives/core/Cargo.toml | 1 + primitives/core/src/lib.rs | 2 + primitives/core/src/testing.rs | 86 ++++++++++++--- primitives/core/src/traits.rs | 45 +++++--- primitives/core/src/vrf.rs | 99 ++++++++++++++++++ 15 files changed, 394 insertions(+), 94 deletions(-) create mode 100644 primitives/core/src/vrf.rs diff --git a/Cargo.lock b/Cargo.lock index 2c1d3e2c4b..1a1cee642e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6092,6 +6092,7 @@ dependencies = [ "parking_lot 0.10.2", "pdqselect", "rand 0.7.3", + "rand_chacha 0.2.2", "sc-block-builder", "sc-client-api", "sc-consensus-epochs", @@ -6425,6 +6426,7 @@ version = "2.0.0-rc3" dependencies = [ "derive_more", "hex", + "merlin", "parking_lot 0.10.2", "rand 0.7.3", "serde_json", @@ -7456,6 +7458,7 @@ dependencies = [ "sp-application-crypto", "sp-consensus", "sp-consensus-vrf", + "sp-core", "sp-inherents", "sp-runtime", "sp-std", @@ -7511,6 +7514,7 @@ dependencies = [ "pretty_assertions", "primitive-types", "rand 0.7.3", + "rand_chacha 0.2.2", "regex", "schnorrkel", "serde", diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 86bc5b19f1..cf4e32a94c 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -58,6 +58,7 @@ sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../se substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } env_logger = "0.7.0" +rand_chacha = "0.2.2" tempfile = "3.1.0" [features] diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 79cff3eb38..401434cadb 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -27,12 +27,12 @@ derive_more = "0.99.2" sp-api = { version = "2.0.0-rc3", path = "../../../../primitives/api" } sp-consensus = { version = "0.8.0-rc3", path = "../../../../primitives/consensus/common" } sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc3", path = "../../../../primitives/application-crypto" } sc-keystore = { version = "2.0.0-rc3", path = "../../../keystore" } [dev-dependencies] sc-consensus = { version = "0.8.0-rc3", path = "../../../consensus/common" } serde_json = "1.0.50" -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../../primitives/application-crypto" } sp-keyring = { version = "2.0.0-rc3", path = "../../../../primitives/keyring" } substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 35000770d4..652f4f00ba 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -32,6 +32,11 @@ use sp_consensus_babe::{ digests::PreDigest, }; use serde::{Deserialize, Serialize}; +use sp_core::{ + crypto::Public, + traits::BareCryptoStore, +}; +use sp_application_crypto::AppKey; use sc_keystore::KeyStorePtr; use sc_rpc_api::DenyUnsafe; use sp_api::{ProvideRuntimeApi, BlockId}; @@ -125,22 +130,23 @@ impl BabeApi for BabeRpcHandler let mut claims: HashMap = HashMap::new(); - let key_pairs = { - let keystore = keystore.read(); + let keys = { + let ks = keystore.read(); epoch.authorities.iter() .enumerate() - .flat_map(|(i, a)| { - keystore - .key_pair::(&a.0) - .ok() - .map(|kp| (kp, i)) + .filter_map(|(i, a)| { + if ks.has_keys(&[(a.0.to_raw_vec(), AuthorityId::ID)]) { + Some((a.0.clone(), i)) + } else { + None + } }) .collect::>() }; for slot_number in epoch_start..epoch_end { if let Some((claim, key)) = - authorship::claim_slot_using_key_pairs(slot_number, &epoch, &key_pairs) + authorship::claim_slot_using_keys(slot_number, &epoch, &keystore, &keys) { match claim { PreDigest::Primary { .. } => { diff --git a/client/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs index 1a6852c0c1..dfca491eaa 100644 --- a/client/consensus/babe/src/authorship.rs +++ b/client/consensus/babe/src/authorship.rs @@ -16,18 +16,24 @@ //! BABE authority selection and slot claiming. +use sp_application_crypto::AppKey; use sp_consensus_babe::{ - make_transcript, AuthorityId, BabeAuthorityWeight, BABE_VRF_PREFIX, - SlotNumber, AuthorityPair, + BABE_VRF_PREFIX, + AuthorityId, BabeAuthorityWeight, + SlotNumber, + make_transcript, + make_transcript_data, }; use sp_consensus_babe::digests::{ PreDigest, PrimaryPreDigest, SecondaryPlainPreDigest, SecondaryVRFPreDigest, }; use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; -use sp_core::{U256, blake2_256}; +use sp_core::{U256, blake2_256, crypto::Public, traits::BareCryptoStore}; use codec::Encode; -use schnorrkel::vrf::VRFInOut; -use sp_core::Pair; +use schnorrkel::{ + keys::PublicKey, + vrf::VRFInOut, +}; use sc_keystore::KeyStorePtr; use super::Epoch; @@ -124,7 +130,8 @@ pub(super) fn secondary_slot_author( fn claim_secondary_slot( slot_number: SlotNumber, epoch: &Epoch, - key_pairs: &[(AuthorityPair, usize)], + keys: &[(AuthorityId, usize)], + keystore: &KeyStorePtr, author_secondary_vrf: bool, ) -> Option<(PreDigest, AuthorityId)> { let Epoch { authorities, randomness, epoch_index, .. } = epoch; @@ -139,31 +146,39 @@ fn claim_secondary_slot( *randomness, )?; - for (pair, authority_index) in key_pairs { - if pair.public() == *expected_author { + for (authority_id, authority_index) in keys { + if authority_id == expected_author { let pre_digest = if author_secondary_vrf { - let transcript = super::authorship::make_transcript( + let transcript_data = super::authorship::make_transcript_data( randomness, slot_number, *epoch_index, ); - - let s = get_keypair(&pair).vrf_sign(transcript); - - PreDigest::SecondaryVRF(SecondaryVRFPreDigest { - slot_number, - vrf_output: VRFOutput(s.0.to_output()), - vrf_proof: VRFProof(s.1), - authority_index: *authority_index as u32, - }) + let result = keystore.read().sr25519_vrf_sign( + AuthorityId::ID, + authority_id.as_ref(), + transcript_data, + ); + if let Ok(signature) = result { + Some(PreDigest::SecondaryVRF(SecondaryVRFPreDigest { + slot_number, + vrf_output: VRFOutput(signature.output), + vrf_proof: VRFProof(signature.proof), + authority_index: *authority_index as u32, + })) + } else { + None + } } else { - PreDigest::SecondaryPlain(SecondaryPlainPreDigest { + Some(PreDigest::SecondaryPlain(SecondaryPlainPreDigest { slot_number, authority_index: *authority_index as u32, - }) + })) }; - return Some((pre_digest, pair.public())); + if let Some(pre_digest) = pre_digest { + return Some((pre_digest, authority_id.clone())); + } } } @@ -179,26 +194,22 @@ pub fn claim_slot( epoch: &Epoch, keystore: &KeyStorePtr, ) -> Option<(PreDigest, AuthorityId)> { - let key_pairs = { - let keystore = keystore.read(); - epoch.authorities.iter() - .enumerate() - .flat_map(|(i, a)| { - keystore.key_pair::(&a.0).ok().map(|kp| (kp, i)) - }) - .collect::>() - }; - claim_slot_using_key_pairs(slot_number, epoch, &key_pairs) + let authorities = epoch.authorities.iter() + .enumerate() + .map(|(index, a)| (a.0.clone(), index)) + .collect::>(); + claim_slot_using_keys(slot_number, epoch, keystore, &authorities) } /// Like `claim_slot`, but allows passing an explicit set of key pairs. Useful if we intend /// to make repeated calls for different slots using the same key pairs. -pub fn claim_slot_using_key_pairs( +pub fn claim_slot_using_keys( slot_number: SlotNumber, epoch: &Epoch, - key_pairs: &[(AuthorityPair, usize)], + keystore: &KeyStorePtr, + keys: &[(AuthorityId, usize)], ) -> Option<(PreDigest, AuthorityId)> { - claim_primary_slot(slot_number, epoch, epoch.config.c, &key_pairs) + claim_primary_slot(slot_number, epoch, epoch.config.c, keystore, &keys) .or_else(|| { if epoch.config.allowed_slots.is_secondary_plain_slots_allowed() || epoch.config.allowed_slots.is_secondary_vrf_slots_allowed() @@ -206,7 +217,8 @@ pub fn claim_slot_using_key_pairs( claim_secondary_slot( slot_number, &epoch, - &key_pairs, + keys, + keystore, epoch.config.allowed_slots.is_secondary_vrf_slots_allowed(), ) } else { @@ -215,11 +227,6 @@ pub fn claim_slot_using_key_pairs( }) } -fn get_keypair(q: &AuthorityPair) -> &schnorrkel::Keypair { - use sp_core::crypto::IsWrappedBy; - sp_core::sr25519::Pair::from_ref(q).as_ref() -} - /// Claim a primary slot if it is our turn. Returns `None` if it is not our turn. /// This hashes the slot number, epoch, genesis hash, and chain randomness into /// the VRF. If the VRF produces a value less than `threshold`, it is our turn, @@ -228,33 +235,49 @@ fn claim_primary_slot( slot_number: SlotNumber, epoch: &Epoch, c: (u64, u64), - key_pairs: &[(AuthorityPair, usize)], + keystore: &KeyStorePtr, + keys: &[(AuthorityId, usize)], ) -> Option<(PreDigest, AuthorityId)> { let Epoch { authorities, randomness, epoch_index, .. } = epoch; - for (pair, authority_index) in key_pairs { - let transcript = super::authorship::make_transcript(randomness, slot_number, *epoch_index); - + for (authority_id, authority_index) in keys { + let transcript = super::authorship::make_transcript( + randomness, + slot_number, + *epoch_index + ); + let transcript_data = super::authorship::make_transcript_data( + randomness, + slot_number, + *epoch_index + ); // Compute the threshold we will use. // // We already checked that authorities contains `key.public()`, so it can't // be empty. Therefore, this division in `calculate_threshold` is safe. let threshold = super::authorship::calculate_primary_threshold(c, authorities, *authority_index); - let pre_digest = get_keypair(pair) - .vrf_sign_after_check(transcript, |inout| super::authorship::check_primary_threshold(inout, threshold)) - .map(|s| { - PreDigest::Primary(PrimaryPreDigest { + let result = keystore.read().sr25519_vrf_sign( + AuthorityId::ID, + authority_id.as_ref(), + transcript_data, + ); + if let Ok(signature) = result { + let public = PublicKey::from_bytes(&authority_id.to_raw_vec()).ok()?; + let inout = match signature.output.attach_input_hash(&public, transcript) { + Ok(inout) => inout, + Err(_) => continue, + }; + if super::authorship::check_primary_threshold(&inout, threshold) { + let pre_digest = PreDigest::Primary(PrimaryPreDigest { slot_number, - vrf_output: VRFOutput(s.0.to_output()), - vrf_proof: VRFProof(s.1), + vrf_output: VRFOutput(signature.output), + vrf_proof: VRFProof(signature.proof), authority_index: *authority_index as u32, - }) - }); + }); - // early exit on first successful claim - if let Some(pre_digest) = pre_digest { - return Some((pre_digest, pair.public())); + return Some((pre_digest, authority_id.clone())); + } } } diff --git a/client/consensus/babe/src/tests.rs b/client/consensus/babe/src/tests.rs index ada1332295..1caed18c17 100644 --- a/client/consensus/babe/src/tests.rs +++ b/client/consensus/babe/src/tests.rs @@ -21,8 +21,14 @@ #![allow(deprecated)] use super::*; use authorship::claim_slot; -use sp_core::crypto::Pair; -use sp_consensus_babe::{AuthorityPair, SlotNumber, AllowedSlots}; +use sp_core::{crypto::Pair, vrf::make_transcript as transcript_from_data}; +use sp_consensus_babe::{ + AuthorityPair, + SlotNumber, + AllowedSlots, + make_transcript, + make_transcript_data, +}; use sc_block_builder::{BlockBuilder, BlockBuilderProvider}; use sp_consensus::{ NoNetwork as DummyOracle, Proposal, RecordProof, @@ -35,6 +41,11 @@ use sp_runtime::{generic::DigestItem, traits::{Block as BlockT, DigestFor}}; use sc_client_api::{BlockchainEvents, backend::TransactionFor}; use log::debug; use std::{time::Duration, cell::RefCell, task::Poll}; +use rand::RngCore; +use rand_chacha::{ + rand_core::SeedableRng, + ChaChaRng, +}; type Item = DigestItem; @@ -796,3 +807,36 @@ fn verify_slots_are_strictly_increasing() { &mut block_import, ); } + +#[test] +fn babe_transcript_generation_match() { + let _ = env_logger::try_init(); + let keystore_path = tempfile::tempdir().expect("Creates keystore path"); + let keystore = sc_keystore::Store::open(keystore_path.path(), None).expect("Creates keystore"); + let pair = keystore.write().insert_ephemeral_from_seed::("//Alice") + .expect("Generates authority pair"); + + let epoch = Epoch { + start_slot: 0, + authorities: vec![(pair.public(), 1)], + randomness: [0; 32], + epoch_index: 1, + duration: 100, + config: BabeEpochConfiguration { + c: (3, 10), + allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, + }, + }; + + let orig_transcript = make_transcript(&epoch.randomness.clone(), 1, epoch.epoch_index); + let new_transcript = make_transcript_data(&epoch.randomness, 1, epoch.epoch_index); + + let test = |t: merlin::Transcript| -> [u8; 16] { + let mut b = [0u8; 16]; + t.build_rng() + .finalize(&mut ChaChaRng::from_seed([0u8;32])) + .fill_bytes(&mut b); + b + }; + debug_assert!(test(orig_transcript) == test(transcript_from_data(new_transcript))); +} diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index 7ceffc9061..47308dd692 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -18,10 +18,11 @@ derive_more = "0.99.2" sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } hex = "0.4.0" +merlin = { version = "2.0", default-features = false } +parking_lot = "0.10.0" rand = "0.7.2" serde_json = "1.0.41" subtle = "2.1.1" -parking_lot = "0.10.0" [dev-dependencies] tempfile = "3.1.0" diff --git a/client/keystore/src/lib.rs b/client/keystore/src/lib.rs index 6510bb8232..5be4d6d12c 100644 --- a/client/keystore/src/lib.rs +++ b/client/keystore/src/lib.rs @@ -20,7 +20,9 @@ use std::{collections::{HashMap, HashSet}, path::PathBuf, fs::{self, File}, io::{self, Write}, sync::Arc}; use sp_core::{ crypto::{IsWrappedBy, CryptoTypePublicPair, KeyTypeId, Pair as PairT, Protected, Public}, - traits::{BareCryptoStore, BareCryptoStoreError as TraitError}, + traits::{BareCryptoStore, Error as TraitError}, + sr25519::{Public as Sr25519Public, Pair as Sr25519Pair}, + vrf::{VRFTranscriptData, VRFSignature, make_transcript}, Encode, }; use sp_application_crypto::{AppKey, AppPublic, AppPair, ed25519, sr25519, ecdsa}; @@ -438,6 +440,23 @@ impl BareCryptoStore for Store { fn has_keys(&self, public_keys: &[(Vec, KeyTypeId)]) -> bool { public_keys.iter().all(|(p, t)| self.key_phrase_by_type(&p, *t).is_ok()) } + + fn sr25519_vrf_sign( + &self, + key_type: KeyTypeId, + public: &Sr25519Public, + transcript_data: VRFTranscriptData, + ) -> std::result::Result { + let transcript = make_transcript(transcript_data); + let pair = self.key_pair_by_type::(public, key_type) + .map_err(|e| TraitError::PairNotFound(e.to_string()))?; + + let (inout, proof, _) = pair.as_ref().vrf_sign(transcript); + Ok(VRFSignature { + output: inout.to_output(), + proof, + }) + } } #[cfg(test)] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 4884e9a9f4..538b0a5b05 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -17,6 +17,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = merlin = { version = "2.0", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } +sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } sp-consensus = { version = "0.8.0-rc3", optional = true, path = "../common" } sp-consensus-vrf = { version = "0.8.0-rc3", path = "../vrf", default-features = false } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../inherents" } @@ -26,6 +27,7 @@ sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../ [features] default = ["std"] std = [ + "sp-core/std", "sp-application-crypto/std", "codec/std", "merlin/std", diff --git a/primitives/consensus/babe/src/lib.rs b/primitives/consensus/babe/src/lib.rs index 9848715a47..10d4aa5ae5 100644 --- a/primitives/consensus/babe/src/lib.rs +++ b/primitives/consensus/babe/src/lib.rs @@ -31,6 +31,8 @@ pub use merlin::Transcript; use codec::{Encode, Decode}; use sp_std::vec::Vec; use sp_runtime::{ConsensusEngineId, RuntimeDebug}; +#[cfg(feature = "std")] +use sp_core::vrf::{VRFTranscriptData, VRFTranscriptValue}; use crate::digests::{NextEpochDescriptor, NextConfigDescriptor}; mod app { @@ -94,6 +96,23 @@ pub fn make_transcript( transcript } +/// Make a VRF transcript data container +#[cfg(feature = "std")] +pub fn make_transcript_data( + randomness: &Randomness, + slot_number: u64, + epoch: u64, +) -> VRFTranscriptData { + VRFTranscriptData { + label: &BABE_ENGINE_ID, + items: vec![ + ("slot number", VRFTranscriptValue::U64(slot_number)), + ("current epoch", VRFTranscriptValue::U64(epoch)), + ("chain randomness", VRFTranscriptValue::Bytes(&randomness[..])), + ] + } +} + /// An consensus log item for BABE. #[derive(Decode, Encode, Clone, PartialEq, Eq)] pub enum ConsensusLog { diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index e1a281da6b..69872349ff 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -59,6 +59,7 @@ hex-literal = "0.2.1" rand = "0.7.2" criterion = "0.2.11" serde_json = "1.0" +rand_chacha = "0.2.2" [[bench]] name = "bench" diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 5fbbf3ca6d..1038c887e2 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -73,6 +73,8 @@ pub mod traits; pub mod testing; #[cfg(feature = "std")] pub mod tasks; +#[cfg(feature = "std")] +pub mod vrf; pub use self::hash::{H160, H256, H512, convert_hash}; pub use self::uint::{U256, U512}; diff --git a/primitives/core/src/testing.rs b/primitives/core/src/testing.rs index d31fabce5b..1d88e1fad5 100644 --- a/primitives/core/src/testing.rs +++ b/primitives/core/src/testing.rs @@ -22,10 +22,12 @@ use crate::crypto::KeyTypeId; use crate::{ crypto::{Pair, Public, CryptoTypePublicPair}, ed25519, sr25519, ecdsa, - traits::BareCryptoStoreError + traits::Error, + vrf::{VRFTranscriptData, VRFSignature, make_transcript}, }; #[cfg(feature = "std")] use std::collections::HashSet; + /// Key type for generic Ed25519 key. pub const ED25519: KeyTypeId = KeyTypeId(*b"ed25"); /// Key type for generic Sr 25519 key. @@ -76,7 +78,7 @@ impl KeyStore { #[cfg(feature = "std")] impl crate::traits::BareCryptoStore for KeyStore { - fn keys(&self, id: KeyTypeId) -> Result, BareCryptoStoreError> { + fn keys(&self, id: KeyTypeId) -> Result, Error> { self.keys .get(&id) .map(|map| { @@ -106,11 +108,11 @@ impl crate::traits::BareCryptoStore for KeyStore { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result { + ) -> Result { match seed { Some(seed) => { let pair = sr25519::Pair::from_string(seed, None) - .map_err(|_| BareCryptoStoreError::ValidationError("Generates an `sr25519` pair.".to_owned()))?; + .map_err(|_| Error::ValidationError("Generates an `sr25519` pair.".to_owned()))?; self.keys.entry(id).or_default().insert(pair.public().to_raw_vec(), seed.into()); Ok(pair.public()) }, @@ -137,11 +139,11 @@ impl crate::traits::BareCryptoStore for KeyStore { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result { + ) -> Result { match seed { Some(seed) => { let pair = ed25519::Pair::from_string(seed, None) - .map_err(|_| BareCryptoStoreError::ValidationError("Generates an `ed25519` pair.".to_owned()))?; + .map_err(|_| Error::ValidationError("Generates an `ed25519` pair.".to_owned()))?; self.keys.entry(id).or_default().insert(pair.public().to_raw_vec(), seed.into()); Ok(pair.public()) }, @@ -168,11 +170,11 @@ impl crate::traits::BareCryptoStore for KeyStore { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result { + ) -> Result { match seed { Some(seed) => { let pair = ecdsa::Pair::from_string(seed, None) - .map_err(|_| BareCryptoStoreError::ValidationError("Generates an `ecdsa` pair.".to_owned()))?; + .map_err(|_| Error::ValidationError("Generates an `ecdsa` pair.".to_owned()))?; self.keys.entry(id).or_default().insert(pair.public().to_raw_vec(), seed.into()); Ok(pair.public()) }, @@ -201,7 +203,7 @@ impl crate::traits::BareCryptoStore for KeyStore { &self, id: KeyTypeId, keys: Vec, - ) -> std::result::Result, BareCryptoStoreError> { + ) -> std::result::Result, Error> { let provided_keys = keys.into_iter().collect::>(); let all_keys = self.keys(id)?.into_iter().collect::>(); @@ -213,31 +215,48 @@ impl crate::traits::BareCryptoStore for KeyStore { id: KeyTypeId, key: &CryptoTypePublicPair, msg: &[u8], - ) -> Result, BareCryptoStoreError> { + ) -> Result, Error> { use codec::Encode; match key.0 { ed25519::CRYPTO_ID => { let key_pair: ed25519::Pair = self .ed25519_key_pair(id, &ed25519::Public::from_slice(key.1.as_slice())) - .ok_or(BareCryptoStoreError::PairNotFound("ed25519".to_owned()))?; + .ok_or(Error::PairNotFound("ed25519".to_owned()))?; return Ok(key_pair.sign(msg).encode()); } sr25519::CRYPTO_ID => { let key_pair: sr25519::Pair = self .sr25519_key_pair(id, &sr25519::Public::from_slice(key.1.as_slice())) - .ok_or(BareCryptoStoreError::PairNotFound("sr25519".to_owned()))?; + .ok_or(Error::PairNotFound("sr25519".to_owned()))?; return Ok(key_pair.sign(msg).encode()); } ecdsa::CRYPTO_ID => { let key_pair: ecdsa::Pair = self .ecdsa_key_pair(id, &ecdsa::Public::from_slice(key.1.as_slice())) - .ok_or(BareCryptoStoreError::PairNotFound("ecdsa".to_owned()))?; + .ok_or(Error::PairNotFound("ecdsa".to_owned()))?; return Ok(key_pair.sign(msg).encode()); } - _ => Err(BareCryptoStoreError::KeyNotSupported(id)) + _ => Err(Error::KeyNotSupported(id)) } } + + fn sr25519_vrf_sign( + &self, + key_type: KeyTypeId, + public: &sr25519::Public, + transcript_data: VRFTranscriptData, + ) -> Result { + let transcript = make_transcript(transcript_data); + let pair = self.sr25519_key_pair(key_type, public) + .ok_or(Error::PairNotFound("Not found".to_owned()))?; + + let (inout, proof, _) = pair.as_ref().vrf_sign(transcript); + Ok(VRFSignature { + output: inout.to_output(), + proof, + }) + } } /// Macro for exporting functions from wasm in with the expected signature for using it with the @@ -372,6 +391,7 @@ mod tests { use super::*; use crate::sr25519; use crate::testing::{ED25519, SR25519}; + use crate::vrf::VRFTranscriptValue; #[test] fn store_key_and_extract() { @@ -403,4 +423,42 @@ mod tests { assert!(public_keys.contains(&key_pair.public().into())); } + + #[test] + fn vrf_sign() { + let store = KeyStore::new(); + + let secret_uri = "//Alice"; + let key_pair = sr25519::Pair::from_string(secret_uri, None).expect("Generates key pair"); + + let transcript_data = VRFTranscriptData { + label: b"Test", + items: vec![ + ("one", VRFTranscriptValue::U64(1)), + ("two", VRFTranscriptValue::U64(2)), + ("three", VRFTranscriptValue::Bytes("test".as_bytes())), + ] + }; + + let result = store.read().sr25519_vrf_sign( + SR25519, + &key_pair.public(), + transcript_data.clone(), + ); + assert!(result.is_err()); + + store.write().insert_unknown( + SR25519, + secret_uri, + key_pair.public().as_ref(), + ).expect("Inserts unknown key"); + + let result = store.read().sr25519_vrf_sign( + SR25519, + &key_pair.public(), + transcript_data, + ); + + assert!(result.is_ok()); + } } diff --git a/primitives/core/src/traits.rs b/primitives/core/src/traits.rs index 0d5bc14fb4..4481145818 100644 --- a/primitives/core/src/traits.rs +++ b/primitives/core/src/traits.rs @@ -19,9 +19,9 @@ use crate::{ crypto::{KeyTypeId, CryptoTypePublicPair}, + vrf::{VRFTranscriptData, VRFSignature}, ed25519, sr25519, ecdsa, }; - use std::{ borrow::Cow, fmt::{Debug, Display}, @@ -33,7 +33,7 @@ pub use sp_externalities::{Externalities, ExternalitiesExt}; /// BareCryptoStore error #[derive(Debug, derive_more::Display)] -pub enum BareCryptoStoreError { +pub enum Error { /// Public key type is not supported #[display(fmt="Key not supported: {:?}", _0)] KeyNotSupported(KeyTypeId), @@ -64,7 +64,7 @@ pub trait BareCryptoStore: Send + Sync { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result; + ) -> Result; /// Returns all ed25519 public keys for the given key type. fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec; /// Generate a new ed25519 key pair for the given key type and an optional seed. @@ -76,7 +76,7 @@ pub trait BareCryptoStore: Send + Sync { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result; + ) -> Result; /// Returns all ecdsa public keys for the given key type. fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec; /// Generate a new ecdsa key pair for the given key type and an optional seed. @@ -88,7 +88,7 @@ pub trait BareCryptoStore: Send + Sync { &mut self, id: KeyTypeId, seed: Option<&str>, - ) -> Result; + ) -> Result; /// Insert a new key. This doesn't require any known of the crypto; but a public key must be /// manually provided. @@ -108,11 +108,11 @@ pub trait BareCryptoStore: Send + Sync { &self, id: KeyTypeId, keys: Vec - ) -> Result, BareCryptoStoreError>; + ) -> Result, Error>; /// List all supported keys /// /// Returns a set of public keys the signer supports. - fn keys(&self, id: KeyTypeId) -> Result, BareCryptoStoreError>; + fn keys(&self, id: KeyTypeId) -> Result, Error>; /// Checks if the private keys for the given public key and key type combinations exist. /// @@ -131,7 +131,7 @@ pub trait BareCryptoStore: Send + Sync { id: KeyTypeId, key: &CryptoTypePublicPair, msg: &[u8], - ) -> Result, BareCryptoStoreError>; + ) -> Result, Error>; /// Sign with any key /// @@ -144,7 +144,7 @@ pub trait BareCryptoStore: Send + Sync { id: KeyTypeId, keys: Vec, msg: &[u8] - ) -> Result<(CryptoTypePublicPair, Vec), BareCryptoStoreError> { + ) -> Result<(CryptoTypePublicPair, Vec), Error> { if keys.len() == 1 { return self.sign_with(id, &keys[0], msg).map(|s| (keys[0].clone(), s)); } else { @@ -154,7 +154,7 @@ pub trait BareCryptoStore: Send + Sync { } } } - Err(BareCryptoStoreError::KeyNotSupported(id)) + Err(Error::KeyNotSupported(id)) } /// Sign with all keys @@ -163,15 +163,36 @@ pub trait BareCryptoStore: Send + Sync { /// each key given that the key is supported. /// /// Returns a list of `Result`s each representing the SCALE encoded - /// signature of each key or a BareCryptoStoreError for non-supported keys. + /// signature of each key or a Error for non-supported keys. fn sign_with_all( &self, id: KeyTypeId, keys: Vec, msg: &[u8], - ) -> Result, BareCryptoStoreError>>, ()>{ + ) -> Result, Error>>, ()>{ Ok(keys.iter().map(|k| self.sign_with(id, k, msg)).collect()) } + + /// Generate VRF signature for given transcript data. + /// + /// Receives KeyTypeId and Public key to be able to map + /// them to a private key that exists in the keystore which + /// is, in turn, used for signing the provided transcript. + /// + /// Returns a result containing the signature data. + /// Namely, VRFOutput and VRFProof which are returned + /// inside the `VRFSignature` container struct. + /// + /// This function will return an error in the cases where + /// the public key and key type provided do not match a private + /// key in the keystore. Or, in the context of remote signing + /// an error could be a network one. + fn sr25519_vrf_sign( + &self, + key_type: KeyTypeId, + public: &sr25519::Public, + transcript_data: VRFTranscriptData, + ) -> Result; } /// A pointer to the key store. diff --git a/primitives/core/src/vrf.rs b/primitives/core/src/vrf.rs new file mode 100644 index 0000000000..d392587cb7 --- /dev/null +++ b/primitives/core/src/vrf.rs @@ -0,0 +1,99 @@ +// This file is part of Substrate. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! VRF-specifc data types and helpers + +use codec::Encode; +use merlin::Transcript; +use schnorrkel::vrf::{VRFOutput, VRFProof}; +/// An enum whose variants represent possible +/// accepted values to construct the VRF transcript +#[derive(Clone, Encode)] +pub enum VRFTranscriptValue<'a> { + /// Value is an array of bytes + Bytes(&'a [u8]), + /// Value is a u64 integer + U64(u64), +} +/// VRF Transcript data +#[derive(Clone, Encode)] +pub struct VRFTranscriptData<'a> { + /// The transcript's label + pub label: &'static [u8], + /// Additional data to be registered into the transcript + pub items: Vec<(&'static str, VRFTranscriptValue<'a>)>, +} +/// VRF signature data +pub struct VRFSignature { + /// The VRFOutput serialized + pub output: VRFOutput, + /// The calculated VRFProof + pub proof: VRFProof, +} + +/// Construct a `Transcript` object from data. +/// +/// Returns `merlin::Transcript` +pub fn make_transcript(data: VRFTranscriptData) -> Transcript { + let mut transcript = Transcript::new(data.label); + for (label, value) in data.items.into_iter() { + match value { + VRFTranscriptValue::Bytes(bytes) => { + transcript.append_message(label.as_bytes(), &bytes); + }, + VRFTranscriptValue::U64(val) => { + transcript.append_u64(label.as_bytes(), val); + } + } + } + transcript +} + + +#[cfg(test)] +mod tests { + use super::*; + use crate::vrf::VRFTranscriptValue; + use rand::RngCore; + use rand_chacha::{ + rand_core::SeedableRng, + ChaChaRng, + }; + + #[test] + fn transcript_creation_matches() { + let mut orig_transcript = Transcript::new(b"My label"); + orig_transcript.append_u64(b"one", 1); + orig_transcript.append_message(b"two", "test".as_bytes()); + + let new_transcript = make_transcript(VRFTranscriptData { + label: b"My label", + items: vec![ + ("one", VRFTranscriptValue::U64(1)), + ("two", VRFTranscriptValue::Bytes("test".as_bytes())), + ], + }); + let test = |t: Transcript| -> [u8; 16] { + let mut b = [0u8; 16]; + t.build_rng() + .finalize(&mut ChaChaRng::from_seed([0u8;32])) + .fill_bytes(&mut b); + b + }; + debug_assert!(test(orig_transcript) == test(new_transcript)); + } +} -- GitLab From caf9fbe005b6fd4505e824ad969e379b89e72d52 Mon Sep 17 00:00:00 2001 From: Toralf Wittner Date: Fri, 19 Jun 2020 00:22:48 +0200 Subject: [PATCH 192/280] Update `libp2p-ping`. (#6412) Bugfix release, see [CHANGELOG]. [CHANGELOG]: https://github.com/libp2p/rust-libp2p/blob/master/protocols/ping/CHANGELOG.md --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a1cee642e..86744c2537 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2776,9 +2776,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c189cf1dfe4b3f01e2c0fe5e97a6f5df8aeb6f3569e26981015eb7c08015ce5f" +checksum = "ffb3c4f9273313357d4977799aec69f581cfe9568854919c5b8066018ccf59f5" dependencies = [ "futures 0.3.4", "libp2p-core", -- GitLab From 7a4bd762e0e8c2ddf959787981cd2e55d080b47d Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 19 Jun 2020 00:23:58 +0200 Subject: [PATCH 193/280] Remove --legacy-network-protocol CLI flag (#6411) --- client/cli/src/params/network_params.rs | 6 - client/network/src/config.rs | 4 - client/network/src/protocol.rs | 164 ++++++------------------ client/network/src/service.rs | 1 - 4 files changed, 36 insertions(+), 139 deletions(-) diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index 2e0a6f1973..253585544d 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -102,11 +102,6 @@ pub struct NetworkParams { /// By default this option is true for `--dev` and false otherwise. #[structopt(long)] pub discover_local: bool, - - /// Use the legacy "pre-mainnet-launch" networking protocol. Enable if things seem broken. - /// This option will be removed in the future. - #[structopt(long)] - pub legacy_network_protocol: bool, } impl NetworkParams { @@ -165,7 +160,6 @@ impl NetworkParams { }, max_parallel_downloads: self.max_parallel_downloads, allow_non_globals_in_dht: self.discover_local || is_dev, - use_new_block_requests_protocol: !self.legacy_network_protocol, } } } diff --git a/client/network/src/config.rs b/client/network/src/config.rs index 6c9bd3adb9..94b2993b4e 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -425,9 +425,6 @@ pub struct NetworkConfiguration { pub max_parallel_downloads: u32, /// Should we insert non-global addresses into the DHT? pub allow_non_globals_in_dht: bool, - /// If true, uses the `//block-requests/` experimental protocol rather than - /// the legacy substream. This option is meant to be hard-wired to `true` in the future. - pub use_new_block_requests_protocol: bool, } impl NetworkConfiguration { @@ -459,7 +456,6 @@ impl NetworkConfiguration { }, max_parallel_downloads: 5, allow_non_globals_in_dht: false, - use_new_block_requests_protocol: true, } } } diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 764c416495..06f117b3bb 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -250,9 +250,6 @@ pub struct Protocol { metrics: Option, /// The `PeerId`'s of all boot nodes. boot_node_ids: Arc>, - /// If true, we send back requests as `CustomMessageOutcome` events. If false, we directly - /// dispatch requests using the legacy substream. - use_new_block_requests_protocol: bool, } #[derive(Default)] @@ -374,7 +371,6 @@ impl Protocol { block_announce_validator: Box + Send>, metrics_registry: Option<&Registry>, boot_node_ids: Arc>, - use_new_block_requests_protocol: bool, queue_size_report: Option, ) -> error::Result<(Protocol, sc_peerset::PeersetHandle)> { let info = chain.info(); @@ -458,7 +454,6 @@ impl Protocol { None }, boot_node_ids, - use_new_block_requests_protocol, }; Ok((protocol, peerset_handle)) @@ -655,16 +650,6 @@ impl Protocol { CustomMessageOutcome::None } - fn send_request(&mut self, who: &PeerId, message: Message) { - send_request::( - &mut self.behaviour, - &mut self.context_data.stats, - &mut self.context_data.peers, - who, - message, - ); - } - fn send_message( &mut self, who: &PeerId, @@ -896,15 +881,10 @@ impl Protocol { Ok(sync::OnBlockData::Import(origin, blocks)) => CustomMessageOutcome::BlockImport(origin, blocks), Ok(sync::OnBlockData::Request(peer, mut req)) => { - if self.use_new_block_requests_protocol { - self.update_peer_request(&peer, &mut req); - CustomMessageOutcome::BlockRequest { - target: peer, - request: req, - } - } else { - self.send_request(&peer, GenericMessage::BlockRequest(req)); - CustomMessageOutcome::None + self.update_peer_request(&peer, &mut req); + CustomMessageOutcome::BlockRequest { + target: peer, + request: req, } } Err(sync::BadPeer(id, repu)) => { @@ -1077,15 +1057,11 @@ impl Protocol { match self.sync.new_peer(who.clone(), info.best_hash, info.best_number) { Ok(None) => (), Ok(Some(mut req)) => { - if self.use_new_block_requests_protocol { - self.update_peer_request(&who, &mut req); - self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { - target: who.clone(), - request: req, - }); - } else { - self.send_request(&who, GenericMessage::BlockRequest(req)) - } + self.update_peer_request(&who, &mut req); + self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { + target: who.clone(), + request: req, + }); }, Err(sync::BadPeer(id, repu)) => { self.behaviour.disconnect_peer(&id); @@ -1415,15 +1391,10 @@ impl Protocol { CustomMessageOutcome::BlockImport(origin, blocks) }, Ok(sync::OnBlockData::Request(peer, mut req)) => { - if self.use_new_block_requests_protocol { - self.update_peer_request(&peer, &mut req); - CustomMessageOutcome::BlockRequest { - target: peer, - request: req, - } - } else { - self.send_request(&peer, GenericMessage::BlockRequest(req)); - CustomMessageOutcome::None + self.update_peer_request(&peer, &mut req); + CustomMessageOutcome::BlockRequest { + target: peer, + request: req, } } Err(sync::BadPeer(id, repu)) => { @@ -1523,22 +1494,11 @@ impl Protocol { for result in results { match result { Ok((id, mut req)) => { - if self.use_new_block_requests_protocol { - update_peer_request(&mut self.context_data.peers, &id, &mut req); - self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { - target: id, - request: req, - }); - } else { - let msg = GenericMessage::BlockRequest(req); - send_request( - &mut self.behaviour, - &mut self.context_data.stats, - &mut self.context_data.peers, - &id, - msg - ) - } + update_peer_request(&mut self.context_data.peers, &id, &mut req); + self.pending_messages.push_back(CustomMessageOutcome::BlockRequest { + target: id, + request: req, + }); } Err(sync::BadPeer(id, repu)) => { self.behaviour.disconnect_peer(&id); @@ -1917,27 +1877,6 @@ pub enum CustomMessageOutcome { None, } -fn send_request( - behaviour: &mut GenericProto, - stats: &mut HashMap<&'static str, PacketStats>, - peers: &mut HashMap>, - who: &PeerId, - mut message: Message, -) { - if let GenericMessage::BlockRequest(ref mut r) = message { - if let Some(ref mut peer) = peers.get_mut(who) { - r.id = peer.next_request_id; - peer.next_request_id += 1; - if let Some((timestamp, request)) = peer.block_request.take() { - trace!(target: "sync", "Request {} for {} is now obsolete.", request.id, who); - peer.obsolete_requests.insert(request.id, timestamp); - } - peer.block_request = Some((Instant::now(), r.clone())); - } - } - send_message::(behaviour, stats, who, None, message) -} - fn update_peer_request( peers: &mut HashMap>, who: &PeerId, @@ -2032,58 +1971,28 @@ impl NetworkBehaviour for Protocol { } for (id, mut r) in self.sync.block_requests() { - if self.use_new_block_requests_protocol { - update_peer_request(&mut self.context_data.peers, &id, &mut r); - let event = CustomMessageOutcome::BlockRequest { - target: id.clone(), - request: r, - }; - self.pending_messages.push_back(event); - } else { - send_request( - &mut self.behaviour, - &mut self.context_data.stats, - &mut self.context_data.peers, - &id, - GenericMessage::BlockRequest(r), - ) - } + update_peer_request(&mut self.context_data.peers, &id, &mut r); + let event = CustomMessageOutcome::BlockRequest { + target: id.clone(), + request: r, + }; + self.pending_messages.push_back(event); } for (id, mut r) in self.sync.justification_requests() { - if self.use_new_block_requests_protocol { - update_peer_request(&mut self.context_data.peers, &id, &mut r); - let event = CustomMessageOutcome::BlockRequest { - target: id, - request: r, - }; - self.pending_messages.push_back(event); - } else { - send_request( - &mut self.behaviour, - &mut self.context_data.stats, - &mut self.context_data.peers, - &id, - GenericMessage::BlockRequest(r), - ) - } + update_peer_request(&mut self.context_data.peers, &id, &mut r); + let event = CustomMessageOutcome::BlockRequest { + target: id, + request: r, + }; + self.pending_messages.push_back(event); } for (id, r) in self.sync.finality_proof_requests() { - if self.use_new_block_requests_protocol { - let event = CustomMessageOutcome::FinalityProofRequest { - target: id, - block_hash: r.block, - request: r.request, - }; - self.pending_messages.push_back(event); - } else { - send_request( - &mut self.behaviour, - &mut self.context_data.stats, - &mut self.context_data.peers, - &id, - GenericMessage::FinalityProofRequest(r), - ) - } + let event = CustomMessageOutcome::FinalityProofRequest { + target: id, + block_hash: r.block, + request: r.request, + }; + self.pending_messages.push_back(event); } if let Poll::Ready(Some((peer_id, result))) = self.pending_transactions.poll_next_unpin(cx) { self.on_handle_extrinsic_import(peer_id, result); @@ -2237,7 +2146,6 @@ mod tests { Box::new(DefaultBlockAnnounceValidator::new(client.clone())), None, Default::default(), - true, None, ).unwrap(); diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 4b4a040e83..0d5f037a37 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -224,7 +224,6 @@ impl NetworkWorker { params.block_announce_validator, params.metrics_registry.as_ref(), boot_node_ids.clone(), - params.network_config.use_new_block_requests_protocol, metrics.as_ref().map(|m| m.notifications_queues_size.clone()), )?; -- GitLab From 4f0b60164855339cc645ceeba3c554c5cc5cf59f Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Fri, 19 Jun 2020 08:25:09 +0200 Subject: [PATCH 194/280] Scale and increase validator count (#6417) --- frame/staking/src/lib.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index bd4fb21cb5..aca68bd706 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -303,7 +303,7 @@ use frame_support::{ }; use pallet_session::historical; use sp_runtime::{ - Perbill, PerU16, PerThing, RuntimeDebug, DispatchError, + Percent, Perbill, PerU16, PerThing, RuntimeDebug, DispatchError, curve::PiecewiseLinear, traits::{ Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, AtLeast32Bit, @@ -1794,6 +1794,34 @@ decl_module! { ValidatorCount::put(new); } + /// Increments the ideal number of validators. + /// + /// The dispatch origin must be Root. + /// + /// # + /// Base Weight: 1.717 µs + /// Read/Write: Validator Count + /// # + #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)] + fn increase_validator_count(origin, #[compact] additional: u32) { + ensure_root(origin)?; + ValidatorCount::mutate(|n| *n += additional); + } + + /// Scale up the ideal number of validators by a factor. + /// + /// The dispatch origin must be Root. + /// + /// # + /// Base Weight: 1.717 µs + /// Read/Write: Validator Count + /// # + #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)] + fn scale_validator_count(origin, factor: Percent) { + ensure_root(origin)?; + ValidatorCount::mutate(|n| *n += factor * *n); + } + /// Force there to be no new eras indefinitely. /// /// The dispatch origin must be Root. -- GitLab From 369f9fc2f5493a94398e8ce132832b9dc4752af4 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 19 Jun 2020 08:26:06 +0200 Subject: [PATCH 195/280] Expose constants from Proxy Pallet (#6420) --- frame/proxy/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index 66e3e76038..bd56ad3f0f 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -135,6 +135,15 @@ decl_module! { /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; + /// The base amount of currency needed to reserve for creating a proxy. + const ProxyDepositBase: BalanceOf = T::ProxyDepositBase::get(); + + /// The amount of currency needed per proxy added. + const ProxyDepositFactor: BalanceOf = T::ProxyDepositFactor::get(); + + /// The maximum amount of proxies allowed for a single account. + const MaxProxies: u16 = T::MaxProxies::get(); + /// Dispatch the given `call` from an account that the sender is authorised for through /// `add_proxy`. /// -- GitLab From 31c3e06ded197bdf28130ac0c5310283b2d1b5b3 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 19 Jun 2020 08:31:42 +0200 Subject: [PATCH 196/280] .maintain/monitoring: Add alerting rule tests (#6343) * .maintain/monitoring: Add alerting rule tests * .maintain/monitoring/alerting-rules/alerting-rules.yaml: Break lines * .gitlab-ci.yml: Add promtool rule testing step --- .gitlab-ci.yml | 1 + .../alerting-rules/alerting-rule-tests.yaml | 239 ++++++++++++++++++ .../alerting-rules/alerting-rules.yaml | 46 ++-- 3 files changed, 271 insertions(+), 15 deletions(-) create mode 100644 .maintain/monitoring/alerting-rules/alerting-rule-tests.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e146d40ee6..76ae934900 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -367,6 +367,7 @@ test-prometheus-alerting-rules: - curl -L https://github.com/prometheus/prometheus/releases/download/v2.19.0/prometheus-2.19.0.linux-amd64.tar.gz --output prometheus.tar.gz - tar -xzf prometheus.tar.gz - ./prometheus-*/promtool check rules .maintain/monitoring/alerting-rules/alerting-rules.yaml + - cat .maintain/monitoring/alerting-rules/alerting-rules.yaml | ./prometheus-*/promtool test rules .maintain/monitoring/alerting-rules/alerting-rule-tests.yaml #### stage: build diff --git a/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml b/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml new file mode 100644 index 0000000000..069cfaf977 --- /dev/null +++ b/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml @@ -0,0 +1,239 @@ +rule_files: + - /dev/stdin + +evaluation_interval: 1m + +tests: + - interval: 1m + input_series: + - series: 'polkadot_sub_libp2p_peers_count{ + job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '3 2+0x4 1+0x9' # 3 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 + + - series: 'polkadot_sub_txpool_validations_scheduled{ + job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '10+1x30' # 10 11 12 13 .. 40 + + - series: 'polkadot_sub_txpool_validations_finished{ + job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '0x30' # 0 0 0 0 .. 0 + + - series: 'polkadot_block_height{ + status="best", job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '1+1x3 4+0x13' # 1 2 3 4 4 4 4 4 4 4 4 4 ... + + - series: 'polkadot_block_height{ + status="finalized", + job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '1+1x3 4+0x13' # 1 2 3 4 4 4 4 4 4 4 4 4 ... + + - series: 'polkadot_cpu_usage_percentage{ + job="polkadot", + pod="polkadot-abcdef01234-abcdef", + instance="polkadot-abcdef01234-abcdef", + }' + values: '0+20x5 100+0x5' # 0 20 40 60 80 100 100 100 100 100 100 + + alert_rule_test: + + ###################################################################### + # Resource usage + ###################################################################### + + - eval_time: 9m + alertname: HighCPUUsage + exp_alerts: + - eval_time: 10m + alertname: HighCPUUsage + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has a CPU + usage higher than 100% for more than 5 minutes" + + ###################################################################### + # Block production + ###################################################################### + + - eval_time: 6m + alertname: LowNumberOfNewBlocks + exp_alerts: + - eval_time: 7m + alertname: LowNumberOfNewBlocks + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: best + exp_annotations: + message: "Less than one new block per minute on instance + polkadot-abcdef01234-abcdef." + + - eval_time: 14m + alertname: LowNumberOfNewBlocks + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: best + exp_annotations: + message: "Less than one new block per minute on instance + polkadot-abcdef01234-abcdef." + - exp_labels: + severity: critical + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: best + exp_annotations: + message: "Less than one new block per minute on instance + polkadot-abcdef01234-abcdef." + + ###################################################################### + # Block finalization + ###################################################################### + + - eval_time: 6m + alertname: BlockFinalizationSlow + exp_alerts: + - eval_time: 7m + alertname: BlockFinalizationSlow + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: finalized + exp_annotations: + message: "Finalized block on instance + polkadot-abcdef01234-abcdef increases by less than 1 per + minute." + + - eval_time: 14m + alertname: BlockFinalizationSlow + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: finalized + exp_annotations: + message: "Finalized block on instance + polkadot-abcdef01234-abcdef increases by less than 1 per + minute." + - exp_labels: + severity: critical + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + status: finalized + exp_annotations: + message: "Finalized block on instance + polkadot-abcdef01234-abcdef increases by less than 1 per + minute." + + ###################################################################### + # Transaction queue + ###################################################################### + + - eval_time: 10m + alertname: TransactionQueueSize + exp_alerts: + - eval_time: 11m + alertname: TransactionQueueSize + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has more + than 10 transactions in the queue for more than 10 + minutes" + + - eval_time: 31m + alertname: TransactionQueueSize + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has more + than 10 transactions in the queue for more than 10 + minutes" + - exp_labels: + severity: critical + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has more + than 10 transactions in the queue for more than 30 + minutes" + + ###################################################################### + # Networking + ###################################################################### + + - eval_time: 3m # Values: 3 2 2 + alertname: LowNumberOfPeers + exp_alerts: + - eval_time: 4m # Values: 2 2 2 + alertname: LowNumberOfPeers + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has less + than 3 peers for more than 3 minutes" + + - eval_time: 16m # Values: 3 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 + alertname: LowNumberOfPeers + exp_alerts: + - exp_labels: + severity: warning + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has less + than 3 peers for more than 3 minutes" + - exp_labels: + severity: critical + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The node polkadot-abcdef01234-abcdef has less + than 3 peers for more than 15 minutes" diff --git a/.maintain/monitoring/alerting-rules/alerting-rules.yaml b/.maintain/monitoring/alerting-rules/alerting-rules.yaml index cb5b3c271d..06d204f7af 100644 --- a/.maintain/monitoring/alerting-rules/alerting-rules.yaml +++ b/.maintain/monitoring/alerting-rules/alerting-rules.yaml @@ -12,7 +12,8 @@ groups: labels: severity: warning annotations: - message: 'The node {{ $labels.instance }} has a CPU usage higher than 100% for more than 5 minutes' + message: 'The node {{ $labels.instance }} has a CPU usage higher than 100% + for more than 5 minutes' ############################################################################## # Block production @@ -20,14 +21,16 @@ groups: - alert: LowNumberOfNewBlocks annotations: - message: 'Less than one new block per minute on instance {{ $labels.instance }}.' + message: 'Less than one new block per minute on instance {{ + $labels.instance }}.' expr: increase(polkadot_block_height{status="best"}[1m]) < 1 for: 3m labels: severity: warning - alert: LowNumberOfNewBlocks annotations: - message: 'Less than one new block per minute on instance {{ $labels.instance }}.' + message: 'Less than one new block per minute on instance {{ + $labels.instance }}.' expr: increase(polkadot_block_height{status="best"}[1m]) < 1 for: 10m labels: @@ -43,43 +46,51 @@ groups: labels: severity: warning annotations: - message: 'Finalized block on instance {{ $labels.instance }} increases by less than 1 per minute.' + message: 'Finalized block on instance {{ $labels.instance }} increases by + less than 1 per minute.' - alert: BlockFinalizationSlow expr: increase(polkadot_block_height{status="finalized"}[1m]) < 1 for: 10m labels: severity: critical annotations: - message: 'Finalized block on instance {{ $labels.instance }} increases by less than 1 per minute.' + message: 'Finalized block on instance {{ $labels.instance }} increases by + less than 1 per minute.' - alert: BlockFinalizationLaggingBehind # Under the assumption of an average block production of 6 seconds, # "best" and "finalized" being more than 10 blocks apart would imply # more than a 1 minute delay between block production and finalization. - expr: (polkadot_block_height_number{status="best"} - ignoring(status) polkadot_block_height_number{status="finalized"}) > 10 + expr: '(polkadot_block_height_number{status="best"} - ignoring(status) + polkadot_block_height_number{status="finalized"}) > 10' for: 8m labels: severity: critical annotations: - message: "Block finalization on instance {{ $labels.instance }} is behind block production by {{ $value }} for more than 8m" + message: "Block finalization on instance {{ $labels.instance }} is behind + block production by {{ $value }} for more than 8m" ############################################################################## # Transaction queue ############################################################################## - alert: TransactionQueueSize - expr: polkadot_sub_txpool_validations_scheduled - polkadot_sub_txpool_validations_finished > 10 + expr: 'polkadot_sub_txpool_validations_scheduled - + polkadot_sub_txpool_validations_finished > 10' for: 10m labels: severity: warning annotations: - message: 'The node {{ $labels.instance }} has more than 10 transactions in the queue for more than 10 minutes' + message: 'The node {{ $labels.instance }} has more than 10 transactions in + the queue for more than 10 minutes' - alert: TransactionQueueSize - expr: polkadot_sub_txpool_validations_scheduled - polkadot_sub_txpool_validations_finished > 10 + expr: 'polkadot_sub_txpool_validations_scheduled - + polkadot_sub_txpool_validations_finished > 10' for: 30m labels: severity: critical annotations: - message: 'The node {{ $labels.instance }} has more than 10 transactions in the queue for more than 30 minutes' + message: 'The node {{ $labels.instance }} has more than 10 transactions in + the queue for more than 30 minutes' ############################################################################## # Networking @@ -91,23 +102,28 @@ groups: labels: severity: warning annotations: - message: 'The node {{ $labels.instance }} has less than 3 peers for more than 3 minutes' + message: 'The node {{ $labels.instance }} has less than 3 peers for more + than 3 minutes' - alert: LowNumberOfPeers expr: polkadot_sub_libp2p_peers_count < 3 for: 15m labels: severity: critical annotations: - message: 'The node {{ $labels.instance }} has less than 3 peers for more than 15 minutes' + message: 'The node {{ $labels.instance }} has less than 3 peers for more + than 15 minutes' ############################################################################## # Others ############################################################################## - alert: AuthorityDiscoveryHighDiscoveryFailure - expr: polkadot_authority_discovery_handle_value_found_event_failure / ignoring(name) polkadot_authority_discovery_dht_event_received{name="value_found"} > 0.5 + expr: 'polkadot_authority_discovery_handle_value_found_event_failure / + ignoring(name) + polkadot_authority_discovery_dht_event_received{name="value_found"} > 0.5' for: 2h labels: severity: warning annotations: - message: "Authority discovery on node {{ $labels.instance }} fails to process more than 50 % of the values found on the DHT." + message: "Authority discovery on node {{ $labels.instance }} fails to + process more than 50 % of the values found on the DHT." -- GitLab From 31af20346a0f0c47bf776f029e6579acd473b2d3 Mon Sep 17 00:00:00 2001 From: s3krit Date: Fri, 19 Jun 2020 08:59:59 +0200 Subject: [PATCH 197/280] [CI] Label PRs if polkadot companion build fails (#6410) * add polkadot-companion-labels.yml * fix polkadot companion job name * add opened event to polkadot-companion-labels.yml * Dont label on timeouts * increase timeouts * increase timeouts again... to be sure * Switch to s3krit/await-status-action Turns out Sibz/await-status-action looks at /ref/statuses, which lists ALL statuses (i.e., if you send a pending and a failure for the same context, it will see both and assume the job is still pending.). I forked and point at /ref/status, which shows a combined summary of each status (i.e., only ever shows the most recent status of a single context). --- .../workflows/polkadot-companion-labels.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/polkadot-companion-labels.yml diff --git a/.github/workflows/polkadot-companion-labels.yml b/.github/workflows/polkadot-companion-labels.yml new file mode 100644 index 0000000000..dd00e72d6c --- /dev/null +++ b/.github/workflows/polkadot-companion-labels.yml @@ -0,0 +1,29 @@ +name: Check Polkadot Companion and Label + +on: + pull_request: + types: [opened, synchronize] + +jobs: + check_status: + runs-on: ubuntu-latest + steps: + - name: Monitor the status of the gitlab-check-companion-build job + uses: s3krit/await-status-action@4528ebbdf6e29bbec77c41caad1b2dec148ba894 + id: 'check-companion-status' + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ github.event.pull_request.head.sha }} + contexts: 'continuous-integration/gitlab-check-polkadot-companion-build' + timeout: 1800 + notPresentTimeout: 3600 # It can take quite a while before the job starts... + - name: Label success + uses: andymckay/labeler@master + if: steps.check-companion-status.outputs.result == 'success' + with: + remove-labels: 'A7-needspolkadotpr' + - name: Label failure + uses: andymckay/labeler@master + if: steps.check-companion-status.outputs.result == 'failure' + with: + add-labels: 'A7-needspolkadotpr' -- GitLab From 3ca1d91f0f53f03d95e5335ad3d7d125e379c9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 13:15:21 +0200 Subject: [PATCH 198/280] Print bad mandatory error (#6416) * Print bad mandatory error This prints the error that leads to bad mandatory. * Update frame/system/src/lib.rs Co-authored-by: Shawn Tabrizi * Adds missing trait import Co-authored-by: Shawn Tabrizi --- frame/system/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index b64b5d58f7..71e1f38770 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -112,7 +112,7 @@ use sp_runtime::{ self, CheckEqual, AtLeast32Bit, Zero, SignedExtension, Lookup, LookupError, SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, SaturatedConversion, MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded, - Dispatchable, DispatchInfoOf, PostDispatchInfoOf, + Dispatchable, DispatchInfoOf, PostDispatchInfoOf, Printable, }, offchain::storage_lock::BlockNumberProvider, }; @@ -1591,7 +1591,10 @@ impl SignedExtension for CheckWeight where // Since mandatory dispatched do not get validated for being overweight, we are sensitive // to them actually being useful. Block producers are thus not allowed to include mandatory // extrinsics that result in error. - if info.class == DispatchClass::Mandatory && result.is_err() { + if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { + "Bad mandantory".print(); + e.print(); + Err(InvalidTransaction::BadMandatory)? } -- GitLab From 97583766efde5eb628ebda73add493aa3f87d8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 15:48:09 +0200 Subject: [PATCH 199/280] Track last blocks in informant display (#6429) This implements tracking of the last seen blocks in informant display to prevent printing the import message twice. In Cumulus we first import blocks as part of the block building with `new_best == false` and set the best block after we know which one was included by the relay chain. This leads to printing the import messages two times. This pr solves the problem by track the latest seen blocks to not print the message twice. --- client/informant/src/lib.rs | 59 ++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 720f5d6a1b..6a8acbadc3 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -28,9 +28,7 @@ use sp_blockchain::HeaderMetadata; use sp_runtime::traits::{Block as BlockT, Header}; use sp_transaction_pool::TransactionPool; use sp_utils::{status_sinks, mpsc::tracing_unbounded}; -use std::fmt::Display; -use std::sync::Arc; -use std::time::Duration; +use std::{fmt::Display, sync::Arc, time::Duration, collections::VecDeque}; use parking_lot::Mutex; mod display; @@ -96,12 +94,30 @@ where future::ready(()) }); + future::join( + display_notifications, + display_block_import(client, format.prefix), + ).map(|_| ()) +} + +fn display_block_import( + client: Arc, + prefix: String, +) -> impl Future +where + C: UsageProvider + HeaderMetadata + BlockchainEvents, + >::Error: Display, +{ let mut last_best = { let info = client.usage_info(); Some((info.chain.best_number, info.chain.best_hash)) }; - let display_block_import = client.import_notification_stream().for_each(move |n| { + // Hashes of the last blocks we have seen at import. + let mut last_blocks = VecDeque::new(); + let max_blocks_to_track = 100; + + client.import_notification_stream().for_each(move |n| { // detect and log reorganizations. if let Some((ref last_num, ref last_hash)) = last_best { if n.header.parent_hash() != last_hash && n.is_new_best { @@ -114,7 +130,7 @@ where match maybe_ancestor { Ok(ref ancestor) if ancestor.hash != *last_hash => info!( "♻️ {}Reorg on #{},{} to #{},{}, common ancestor #{},{}", - format.prefix, + prefix, Colour::Red.bold().paint(format!("{}", last_num)), last_hash, Colour::Green.bold().paint(format!("{}", n.header.number())), n.hash, Colour::White.bold().paint(format!("{}", ancestor.number)), ancestor.hash, @@ -129,18 +145,25 @@ where last_best = Some((n.header.number().clone(), n.hash.clone())); } - info!( - target: "substrate", - "✨ {}Imported #{} ({})", - format.prefix, - Colour::White.bold().paint(format!("{}", n.header.number())), - n.hash, - ); - future::ready(()) - }); - future::join( - display_notifications, - display_block_import - ).map(|_| ()) + // If we already printed a message for a given block recently, + // we should not print it again. + if !last_blocks.contains(&n.hash) { + last_blocks.push_back(n.hash.clone()); + + if last_blocks.len() > max_blocks_to_track { + last_blocks.pop_front(); + } + + info!( + target: "substrate", + "✨ {}Imported #{} ({})", + prefix, + Colour::White.bold().paint(format!("{}", n.header.number())), + n.hash, + ); + } + + future::ready(()) + }) } -- GitLab From 2bb79cb6500d0bc338ca4c480c66ced0d284b0a4 Mon Sep 17 00:00:00 2001 From: Dan Forbes Date: Fri, 19 Jun 2020 06:55:15 -0700 Subject: [PATCH 200/280] Simple Docs for Atomic Swap Pallet (#6434) * Simple Docs for Atomic Swap Pallet * Fix copy-and-paste error --- frame/atomic-swap/src/lib.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/frame/atomic-swap/src/lib.rs b/frame/atomic-swap/src/lib.rs index aa33c9a849..8686138c2b 100644 --- a/frame/atomic-swap/src/lib.rs +++ b/frame/atomic-swap/src/lib.rs @@ -15,7 +15,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Atomic swap support pallet +//! # Atomic Swap +//! +//! A module for atomically sending funds. +//! +//! - [`atomic_swap::Trait`](./trait.Trait.html) +//! - [`Call`](./enum.Call.html) +//! - [`Module`](./struct.Module.html) +//! +//! ## Overview +//! +//! A module for atomically sending funds from an origin to a target. A proof +//! is used to allow the target to approve (claim) the swap. If the swap is not +//! claimed within a specified duration of time, the sender may cancel it. +//! +//! ## Interface +//! +//! ### Dispatchable Functions +//! +//! * `create_swap` - called by a sender to register a new atomic swap +//! * `claim_swap` - called by the target to approve a swap +//! * `cancel_swap` - may be called by a sender after a specified duration // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -- GitLab From a2c493d4de8e5f0a3c8bf9b0518b45aa35b2cb71 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Fri, 19 Jun 2020 15:56:09 +0200 Subject: [PATCH 201/280] More descriptive error message when invalid slot duration is used (#6430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit Forked at: d735e4d0b5378c227f81a5127a1d4544de112fd8 No parent branch. * Errors if slot_duration is zero * Errors if slot_duration is zero * Revert "Errors if slot_duration is zero" This reverts commit a9e9820e124571f73d3e498e969a74d01fd3fe96. * Update client/consensus/slots/src/lib.rs Co-authored-by: Bastian Köcher --- client/consensus/slots/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/consensus/slots/src/lib.rs b/client/consensus/slots/src/lib.rs index fe1c6bab7b..950f83fbce 100644 --- a/client/consensus/slots/src/lib.rs +++ b/client/consensus/slots/src/lib.rs @@ -455,7 +455,7 @@ impl SlotDuration { CB: FnOnce(ApiRef, &BlockId) -> sp_blockchain::Result, T: SlotData + Encode + Decode + Debug, { - match client.get_aux(T::SLOT_KEY)? { + let slot_duration = match client.get_aux(T::SLOT_KEY)? { Some(v) => ::decode(&mut &v[..]) .map(SlotDuration) .map_err(|_| { @@ -479,7 +479,15 @@ impl SlotDuration { Ok(SlotDuration(genesis_slot_duration)) } + }?; + + if slot_duration.slot_duration() == 0 { + return Err(sp_blockchain::Error::Msg( + "Invalid value for slot_duration: the value must be greater than 0.".into(), + )) } + + Ok(slot_duration) } /// Returns slot data value. -- GitLab From d343bfc87acf1eb5cbff49827eea2d59b729724b Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Fri, 19 Jun 2020 15:59:29 +0200 Subject: [PATCH 202/280] Root origin use no filter by default. Scheduler and Democracy dispatch without asserting BaseCallFilter (#6408) * make system root origin build runtime origin with no filter * additional doc --- frame/democracy/src/tests.rs | 21 +++++++++++++++++++-- frame/scheduler/src/lib.rs | 17 ++++++++++++++--- frame/support/src/origin.rs | 24 ++++++++++++++++++++---- frame/system/src/lib.rs | 3 ++- 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index 85bb1ffcfb..c1bab3c021 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -22,7 +22,8 @@ use std::cell::RefCell; use codec::Encode; use frame_support::{ impl_outer_origin, impl_outer_dispatch, assert_noop, assert_ok, parameter_types, - impl_outer_event, ord_parameter_types, traits::{Contains, OnInitialize}, weights::Weight, + impl_outer_event, ord_parameter_types, traits::{Contains, OnInitialize, Filter}, + weights::Weight, }; use sp_core::H256; use sp_runtime::{ @@ -74,6 +75,14 @@ impl_outer_event! { } } +// Test that a fitlered call can be dispatched. +pub struct BaseFilter; +impl Filter for BaseFilter { + fn filter(call: &Call) -> bool { + !matches!(call, &Call::Balances(pallet_balances::Call::set_balance(..))) + } +} + // Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted. #[derive(Clone, Eq, PartialEq, Debug)] pub struct Test; @@ -84,7 +93,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Trait for Test { - type BaseCallFilter = (); + type BaseCallFilter = BaseFilter; type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -225,6 +234,14 @@ fn set_balance_proposal(value: u64) -> Vec { Call::Balances(pallet_balances::Call::set_balance(42, value, 0)).encode() } +#[test] +fn set_balance_proposal_is_correctly_filtered_out() { + for i in 0..10 { + let call = Call::decode(&mut &set_balance_proposal(i)[..]).unwrap(); + assert!(!::BaseCallFilter::filter(&call)); + } +} + fn set_balance_proposal_hash(value: u64) -> H256 { BlakeTwo256::hash(&set_balance_proposal(value)[..]) } diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 00189c6b5d..18b4eef0a8 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -399,7 +399,7 @@ mod tests { use frame_support::{ impl_outer_event, impl_outer_origin, impl_outer_dispatch, parameter_types, assert_ok, - traits::{OnInitialize, OnFinalize}, + traits::{OnInitialize, OnFinalize, Filter}, weights::constants::RocksDbWeight, }; use sp_core::H256; @@ -469,6 +469,15 @@ mod tests { scheduler, } } + + // Scheduler must dispatch with root and no filter, this tests base filter is indeed not used. + pub struct BaseFilter; + impl Filter for BaseFilter { + fn filter(call: &Call) -> bool { + !matches!(call, Call::Logger(_)) + } + } + // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of pallets we want to use. @@ -481,7 +490,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl system::Trait for Test { - type BaseCallFilter = (); + type BaseCallFilter = BaseFilter; type Origin = Origin; type Call = Call; type Index = u64; @@ -540,7 +549,9 @@ mod tests { #[test] fn basic_scheduling_works() { new_test_ext().execute_with(|| { - Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(42, 1000))); + let call = Call::Logger(logger::Call::log(42, 1000)); + assert!(!::BaseCallFilter::filter(&call)); + Scheduler::do_schedule(4, None, 127, call); run_to_block(3); assert!(logger::log().is_empty()); run_to_block(4); diff --git a/frame/support/src/origin.rs b/frame/support/src/origin.rs index 038c8540f6..77fe86cc55 100644 --- a/frame/support/src/origin.rs +++ b/frame/support/src/origin.rs @@ -163,8 +163,8 @@ macro_rules! impl_outer_origin { Modules { }; $( $module:ident $( < $generic:ident > )? $( { $generic_instance:ident } )? ,)* ) => { - // WARNING: All instance must hold the filter `frame_system::Trait::BaseCallFilter`. - // One can use `OriginTrait::reset_filter` to do so. + // WARNING: All instance must hold the filter `frame_system::Trait::BaseCallFilter`, except + // when caller is system Root. One can use `OriginTrait::reset_filter` to do so. #[derive(Clone)] pub struct $name { caller: $caller_name, @@ -241,28 +241,40 @@ macro_rules! impl_outer_origin { #[allow(dead_code)] impl $name { + /// Create with system none origin and `frame-system::Trait::BaseCallFilter`. pub fn none() -> Self { $system::RawOrigin::None.into() } + /// Create with system root origin and no filter. pub fn root() -> Self { $system::RawOrigin::Root.into() } + /// Create with system signed origin and `frame-system::Trait::BaseCallFilter`. pub fn signed(by: <$runtime as $system::Trait>::AccountId) -> Self { $system::RawOrigin::Signed(by).into() } } impl From<$system::Origin<$runtime>> for $name { + /// Convert to runtime origin: + /// * root origin is built with no filter + /// * others use `frame-system::Trait::BaseCallFilter` fn from(x: $system::Origin<$runtime>) -> Self { let mut o = $name { caller: $caller_name::system(x), filter: $crate::sp_std::rc::Rc::new(Box::new(|_| true)), }; - $crate::traits::OriginTrait::reset_filter(&mut o); + + // Root has no filter + if !matches!(o.caller, $caller_name::system($system::Origin::<$runtime>::Root)) { + $crate::traits::OriginTrait::reset_filter(&mut o); + } + o } } impl Into<$crate::sp_std::result::Result<$system::Origin<$runtime>, $name>> for $name { + /// NOTE: converting to pallet origin loses the origin filter information. fn into(self) -> $crate::sp_std::result::Result<$system::Origin<$runtime>, Self> { if let $caller_name::system(l) = self.caller { Ok(l) @@ -272,6 +284,8 @@ macro_rules! impl_outer_origin { } } impl From::AccountId>> for $name { + /// Convert to runtime origin with caller being system signed or none and use filter + /// `frame-system::Trait::BaseCallFilter`. fn from(x: Option<<$runtime as $system::Trait>::AccountId>) -> Self { <$system::Origin<$runtime>>::from(x).into() } @@ -279,6 +293,7 @@ macro_rules! impl_outer_origin { $( $crate::paste::item! { impl From<$module::Origin < $( $generic )? $(, $module::$generic_instance )? > > for $name { + /// Convert to runtime origin using `frame-system::Trait::BaseCallFilter`. fn from(x: $module::Origin < $( $generic )? $(, $module::$generic_instance )? >) -> Self { let mut o = $name { caller: $caller_name::[< $module $( _ $generic_instance )? >](x), @@ -294,6 +309,7 @@ macro_rules! impl_outer_origin { $name, >> for $name { + /// NOTE: converting to pallet origin loses the origin filter information. fn into(self) -> $crate::sp_std::result::Result< $module::Origin < $( $generic )? $(, $module::$generic_instance )? >, Self, @@ -402,7 +418,7 @@ mod tests { #[test] fn test_default_filter() { assert_eq!(OriginWithSystem::root().filter_call(&0), true); - assert_eq!(OriginWithSystem::root().filter_call(&1), false); + assert_eq!(OriginWithSystem::root().filter_call(&1), true); assert_eq!(OriginWithSystem::none().filter_call(&0), true); assert_eq!(OriginWithSystem::none().filter_call(&1), false); assert_eq!(OriginWithSystem::signed(0).filter_call(&0), true); diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 71e1f38770..db6b528bcf 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -149,7 +149,8 @@ pub fn extrinsics_data_root(xts: Vec>) -> H::Output { } pub trait Trait: 'static + Eq + Clone { - /// The basic call filter to use in Origin. + /// The basic call filter to use in Origin. All origins are built with this filter as base, + /// except Root. type BaseCallFilter: Filter; /// The `Origin` type used by dispatchable calls. -- GitLab From 111b628ccd2895dce26f2af12ee5f28206fa9e2b Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Fri, 19 Jun 2020 16:00:06 +0200 Subject: [PATCH 203/280] llow decl-module to have a where clause with trailing comma (#6431) --- frame/support/src/dispatch.rs | 3 ++- frame/support/test/tests/system.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index edb6e62639..d9a3561802 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -283,7 +283,7 @@ macro_rules! decl_module { $trait_instance:ident: $trait_name:ident $( , I: $instantiable:path $( = $module_default_instance:path )? )? > - for enum $call_type:ident where origin: $origin_type:ty $(, $where_ty:ty: $where_bound:path )* { + for enum $call_type:ident where origin: $origin_type:ty $(, $where_ty:ty: $where_bound:path )* $(,)? { $( $t:tt )* } ) => { @@ -317,6 +317,7 @@ macro_rules! decl_module { origin: $origin_type:ty, system = $system:ident $(, $where_ty:ty: $where_bound:path )* + $(,)? { $($t:tt)* } diff --git a/frame/support/test/tests/system.rs b/frame/support/test/tests/system.rs index c3c47d2065..0d6a22fd1a 100644 --- a/frame/support/test/tests/system.rs +++ b/frame/support/test/tests/system.rs @@ -31,7 +31,7 @@ pub trait Trait: 'static + Eq + Clone { } frame_support::decl_module! { - pub struct Module for enum Call where origin: T::Origin {} + pub struct Module for enum Call where origin: T::Origin, {} } impl Module { -- GitLab From 18707b3314bc2c48991ca68a53539fc98b9a092d Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 19 Jun 2020 16:00:33 +0200 Subject: [PATCH 204/280] .gitlab-ci.yml: Use promtool from paritytech/tools:latest image (#6425) --- .gitlab-ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76ae934900..a21affdeb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -364,10 +364,8 @@ test-prometheus-alerting-rules: image: paritytech/tools:latest <<: *kubernetes-build script: - - curl -L https://github.com/prometheus/prometheus/releases/download/v2.19.0/prometheus-2.19.0.linux-amd64.tar.gz --output prometheus.tar.gz - - tar -xzf prometheus.tar.gz - - ./prometheus-*/promtool check rules .maintain/monitoring/alerting-rules/alerting-rules.yaml - - cat .maintain/monitoring/alerting-rules/alerting-rules.yaml | ./prometheus-*/promtool test rules .maintain/monitoring/alerting-rules/alerting-rule-tests.yaml + - promtool check rules .maintain/monitoring/alerting-rules/alerting-rules.yaml + - cat .maintain/monitoring/alerting-rules/alerting-rules.yaml | promtool test rules .maintain/monitoring/alerting-rules/alerting-rule-tests.yaml #### stage: build -- GitLab From 26aec420371a41f7202bb50a98dac4b0fcce591e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 16:00:58 +0200 Subject: [PATCH 205/280] Update sync chain info on own block import (#6424) Before we only updated the chain info of sync when we have imported something using the import queue. However, if you import your own blocks, this is not done using the import queue and so sync is not updated. If we don't do this, it can lead to sync switching to "major sync" mode because sync is not informed about new blocks. This especially happens on Cumulus, where a collator is selected multiple times to include its block into the relay chain and thus, sync switches to major sync mode while the node is still building blocks. --- client/network/src/protocol.rs | 5 +++++ client/network/src/service.rs | 9 +++++++++ client/service/src/lib.rs | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 06f117b3bb..ccd4463901 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -544,6 +544,11 @@ impl Protocol { self.sync.update_chain_info(&info.best_hash, info.best_number); } + /// Inform sync about an own imported block. + pub fn own_block_imported(&mut self, hash: B::Hash, number: NumberFor) { + self.sync.update_chain_info(&hash, number); + } + fn update_peer_info(&mut self, who: &PeerId) { if let Some(info) = self.sync.peer_info(who) { if let Some(ref mut peer) = self.context_data.peers.get_mut(who) { diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 0d5f037a37..90fffc8a37 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -746,6 +746,12 @@ impl NetworkService { .unbounded_send(ServiceToWorkerMsg::UpdateChain); } + /// Inform the network service about an own imported block. + pub fn own_block_imported(&self, hash: B::Hash, number: NumberFor) { + let _ = self + .to_worker + .unbounded_send(ServiceToWorkerMsg::OwnBlockImported(hash, number)); + } } impl sp_consensus::SyncOracle @@ -812,6 +818,7 @@ enum ServiceToWorkerMsg { }, DisconnectPeer(PeerId), UpdateChain, + OwnBlockImported(B::Hash, NumberFor), } /// Main network worker. Must be polled in order for the network to advance. @@ -1142,6 +1149,8 @@ impl Future for NetworkWorker { this.network_service.user_protocol_mut().disconnect_peer(&who), ServiceToWorkerMsg::UpdateChain => this.network_service.user_protocol_mut().update_chain(), + ServiceToWorkerMsg::OwnBlockImported(hash, number) => + this.network_service.user_protocol_mut().own_block_imported(hash, number), } } diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 37bac171c9..5184886efd 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -55,7 +55,7 @@ use sc_network::{NetworkService, NetworkStatus, network_state::NetworkState, Pee use log::{log, warn, debug, error, Level}; use codec::{Encode, Decode}; use sp_runtime::generic::BlockId; -use sp_runtime::traits::Block as BlockT; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use parity_util_mem::MallocSizeOf; use sp_utils::{status_sinks, mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}}; @@ -382,6 +382,13 @@ fn build_network_future< if announce_imported_blocks { network.service().announce_block(notification.hash, Vec::new()); } + + if let sp_consensus::BlockOrigin::Own = notification.origin { + network.service().own_block_imported( + notification.hash, + notification.header.number().clone(), + ); + } } // We poll `finality_notification_stream`, but we only take the last event. -- GitLab From 4c67aeec54bfa255eed88d391e2f401434d1e51f Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 19 Jun 2020 16:01:16 +0200 Subject: [PATCH 206/280] client/authority-discovery: Compare PeerIds and not Multihashes (#6414) In order to tell whether an address is the local nodes address the authority discovery module previously compared the Multihash within the `p2p` Multiaddr protocol. rust-libp2p recently switched to a new PeerId representation (see [1]). Multihashes of the same PeerId in the new and the old format don't equal. Instead of comparing the Multihashes, this patch ensures the module compares the PeerIds [1] https://github.com/libp2p/rust-libp2p/issues/555 --- client/authority-discovery/src/lib.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs index e816600b7c..ba1c9f0fa8 100644 --- a/client/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -72,6 +72,7 @@ use sc_network::{ ExHashT, Multiaddr, NetworkStateInfo, + PeerId, }; use sp_authority_discovery::{AuthorityDiscoveryApi, AuthorityId, AuthoritySignature, AuthorityPair}; use sp_core::crypto::{key_types, Pair}; @@ -430,7 +431,7 @@ where .get(&remote_key) .ok_or(Error::MatchingHashedAuthorityIdWithAuthorityId)?; - let local_peer_id = multiaddr::Protocol::P2p(self.network.local_peer_id().into()); + let local_peer_id = self.network.local_peer_id(); let remote_addresses: Vec = values.into_iter() .map(|(_k, v)| { @@ -459,9 +460,23 @@ where .into_iter() .flatten() // Ignore own addresses. - .filter(|addr| !addr.iter().any(|protocol| - protocol == local_peer_id - )) + .filter(|addr| !addr.iter().any(|protocol| { + // Parse to PeerId first as Multihashes of old and new PeerId + // representation don't equal. + // + // See https://github.com/libp2p/rust-libp2p/issues/555 for + // details. + if let multiaddr::Protocol::P2p(hash) = protocol { + let peer_id = match PeerId::from_multihash(hash) { + Ok(peer_id) => peer_id, + Err(_) => return true, // Discard address. + }; + + return peer_id == local_peer_id; + } + + false // Multiaddr does not contain a PeerId. + })) .collect(); if !remote_addresses.is_empty() { -- GitLab From c8c16d1803c5d84565ffb788ab35e2cedf289530 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Fri, 19 Jun 2020 17:40:39 +0300 Subject: [PATCH 207/280] add network propagated metrics (#6438) --- client/network/src/protocol.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index ccd4463901..9bec906787 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -48,7 +48,7 @@ use sp_runtime::traits::{ use sp_arithmetic::traits::SaturatedConversion; use message::{BlockAnnounce, Message}; use message::generic::{Message as GenericMessage, ConsensusMessage, Roles}; -use prometheus_endpoint::{Registry, Gauge, GaugeVec, HistogramVec, PrometheusError, Opts, register, U64}; +use prometheus_endpoint::{Registry, Gauge, Counter, GaugeVec, HistogramVec, PrometheusError, Opts, register, U64}; use sync::{ChainSync, SyncState}; use std::borrow::Cow; use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; @@ -145,6 +145,7 @@ struct Metrics { fork_targets: Gauge, finality_proofs: GaugeVec, justifications: GaugeVec, + propagated_extrinsics: Counter, } impl Metrics { @@ -190,6 +191,10 @@ impl Metrics { )?; register(g, r)? }, + propagated_extrinsics: register(Counter::new( + "sync_propagated_extrinsics", + "Number of transactions propagated to at least one peer", + )?, r)?, }) } } @@ -1237,6 +1242,12 @@ impl Protocol { } } + if propagated_to.len() > 0 { + if let Some(ref metrics) = self.metrics { + metrics.propagated_extrinsics.inc(); + } + } + propagated_to } -- GitLab From f9d4d302e797e82aecf9782c4af8dc6abc4074a0 Mon Sep 17 00:00:00 2001 From: Denis Pisarev Date: Fri, 19 Jun 2020 18:53:43 +0200 Subject: [PATCH 208/280] change (ci): add interruptible to kubernetes jobs (#6441) --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a21affdeb9..594c9d1dde 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,7 @@ default: - kubernetes-parity-build environment: name: parity-build + interruptible: true .docker-env: &docker-env image: paritytech/ci-linux:production -- GitLab From 9cbda1eab93a1384086b4b88b6995669ed6435d2 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Fri, 19 Jun 2020 20:12:42 +0200 Subject: [PATCH 209/280] Avoid multisig reentrancy (#6445) --- frame/multisig/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs index 50bd96aca3..fc7a6c25b3 100644 --- a/frame/multisig/src/lib.rs +++ b/frame/multisig/src/lib.rs @@ -553,10 +553,13 @@ impl Module { // verify weight ensure!(call.get_dispatch_info().weight <= max_weight, Error::::WeightTooLow); - let result = call.dispatch(RawOrigin::Signed(id.clone()).into()); - T::Currency::unreserve(&m.depositor, m.deposit); + // Clean up storage before executing call to avoid an possibility of reentrancy + // attack. >::remove(&id, call_hash); Self::clear_call(&call_hash); + T::Currency::unreserve(&m.depositor, m.deposit); + + let result = call.dispatch(RawOrigin::Signed(id.clone()).into()); Self::deposit_event(RawEvent::MultisigExecuted( who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error) )); -- GitLab From d0ab405f548225ef2d7fb4a4fbcba136c1e7db8b Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Fri, 19 Jun 2020 21:27:16 +0200 Subject: [PATCH 210/280] Validate encoding of extrinsics passed to runtime (#6442) * Validate encoding of extrinsics passed to runtime * Bump codec version explicitly --- Cargo.lock | 4 ++-- bin/node-template/pallets/template/Cargo.toml | 2 +- bin/node-template/runtime/Cargo.toml | 2 +- bin/node/cli/Cargo.toml | 2 +- bin/node/executor/Cargo.toml | 2 +- bin/node/inspect/Cargo.toml | 2 +- bin/node/primitives/Cargo.toml | 2 +- bin/node/runtime/Cargo.toml | 2 +- bin/node/testing/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/api/Cargo.toml | 2 +- client/authority-discovery/Cargo.toml | 2 +- client/basic-authorship/Cargo.toml | 2 +- client/block-builder/Cargo.toml | 2 +- client/consensus/aura/Cargo.toml | 2 +- client/consensus/babe/Cargo.toml | 2 +- client/consensus/epochs/Cargo.toml | 2 +- client/consensus/pow/Cargo.toml | 2 +- client/consensus/slots/Cargo.toml | 2 +- client/db/Cargo.toml | 2 +- client/executor/Cargo.toml | 2 +- client/executor/common/Cargo.toml | 2 +- client/executor/wasmi/Cargo.toml | 2 +- client/executor/wasmtime/Cargo.toml | 2 +- client/finality-grandpa/Cargo.toml | 2 +- client/light/Cargo.toml | 2 +- client/network/Cargo.toml | 2 +- client/offchain/Cargo.toml | 2 +- client/rpc-api/Cargo.toml | 2 +- client/rpc/Cargo.toml | 2 +- client/service/Cargo.toml | 2 +- client/service/test/Cargo.toml | 2 +- client/state-db/Cargo.toml | 2 +- client/transaction-pool/Cargo.toml | 2 +- client/transaction-pool/graph/Cargo.toml | 2 +- frame/assets/Cargo.toml | 2 +- frame/atomic-swap/Cargo.toml | 2 +- frame/aura/Cargo.toml | 2 +- frame/authority-discovery/Cargo.toml | 2 +- frame/authorship/Cargo.toml | 2 +- frame/babe/Cargo.toml | 2 +- frame/balances/Cargo.toml | 2 +- frame/benchmarking/Cargo.toml | 2 +- frame/collective/Cargo.toml | 2 +- frame/contracts/Cargo.toml | 2 +- frame/contracts/common/Cargo.toml | 2 +- frame/contracts/rpc/Cargo.toml | 2 +- frame/contracts/rpc/runtime-api/Cargo.toml | 2 +- frame/democracy/Cargo.toml | 2 +- frame/elections-phragmen/Cargo.toml | 2 +- frame/elections/Cargo.toml | 2 +- frame/evm/Cargo.toml | 2 +- frame/example-offchain-worker/Cargo.toml | 2 +- frame/example/Cargo.toml | 2 +- frame/executive/Cargo.toml | 2 +- frame/finality-tracker/Cargo.toml | 2 +- frame/generic-asset/Cargo.toml | 2 +- frame/grandpa/Cargo.toml | 2 +- frame/identity/Cargo.toml | 2 +- frame/im-online/Cargo.toml | 2 +- frame/indices/Cargo.toml | 2 +- frame/membership/Cargo.toml | 2 +- frame/metadata/Cargo.toml | 2 +- frame/multisig/Cargo.toml | 2 +- frame/nicks/Cargo.toml | 2 +- frame/offences/Cargo.toml | 2 +- frame/offences/benchmarking/Cargo.toml | 4 ++-- frame/proxy/Cargo.toml | 2 +- frame/randomness-collective-flip/Cargo.toml | 2 +- frame/recovery/Cargo.toml | 2 +- frame/scored-pool/Cargo.toml | 2 +- frame/session/Cargo.toml | 2 +- frame/session/benchmarking/Cargo.toml | 2 +- frame/society/Cargo.toml | 2 +- frame/staking/Cargo.toml | 2 +- frame/staking/fuzzer/Cargo.toml | 2 +- frame/sudo/Cargo.toml | 2 +- frame/support/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 2 +- frame/system/Cargo.toml | 2 +- frame/system/benchmarking/Cargo.toml | 2 +- frame/system/rpc/runtime-api/Cargo.toml | 2 +- frame/timestamp/Cargo.toml | 2 +- frame/transaction-payment/Cargo.toml | 2 +- frame/transaction-payment/rpc/Cargo.toml | 2 +- frame/transaction-payment/rpc/runtime-api/Cargo.toml | 2 +- frame/treasury/Cargo.toml | 2 +- frame/utility/Cargo.toml | 2 +- frame/vesting/Cargo.toml | 2 +- primitives/api/Cargo.toml | 2 +- primitives/api/proc-macro/src/decl_runtime_apis.rs | 3 ++- primitives/api/proc-macro/src/impl_runtime_apis.rs | 5 ++++- primitives/api/src/lib.rs | 5 ++++- primitives/api/test/Cargo.toml | 2 +- primitives/api/test/tests/ui/mock_only_one_error_type.stderr | 4 ++-- primitives/application-crypto/Cargo.toml | 2 +- primitives/arithmetic/Cargo.toml | 2 +- primitives/authority-discovery/Cargo.toml | 2 +- primitives/authorship/Cargo.toml | 2 +- primitives/block-builder/Cargo.toml | 2 +- primitives/blockchain/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 2 +- primitives/consensus/babe/Cargo.toml | 2 +- primitives/consensus/common/Cargo.toml | 2 +- primitives/consensus/pow/Cargo.toml | 2 +- primitives/core/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 2 +- primitives/finality-grandpa/Cargo.toml | 2 +- primitives/finality-tracker/Cargo.toml | 2 +- primitives/inherents/Cargo.toml | 2 +- primitives/io/Cargo.toml | 2 +- primitives/runtime-interface/Cargo.toml | 2 +- primitives/runtime/Cargo.toml | 2 +- primitives/sandbox/Cargo.toml | 2 +- primitives/session/Cargo.toml | 2 +- primitives/staking/Cargo.toml | 2 +- primitives/state-machine/Cargo.toml | 2 +- primitives/test-primitives/Cargo.toml | 2 +- primitives/timestamp/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 2 +- primitives/trie/Cargo.toml | 2 +- primitives/version/Cargo.toml | 2 +- primitives/wasm-interface/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 2 +- test-utils/runtime/Cargo.toml | 2 +- test-utils/runtime/client/Cargo.toml | 2 +- test-utils/runtime/transaction-pool/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 2 +- utils/frame/rpc/support/Cargo.toml | 2 +- utils/frame/rpc/system/Cargo.toml | 2 +- 131 files changed, 141 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86744c2537..8a620ab5c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4759,9 +4759,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329c8f7f4244ddb5c37c103641027a76c530e65e8e4b8240b29f81ea40508b17" +checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf" dependencies = [ "arrayvec 0.5.1", "bitvec", diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 6b99b6f807..714c9d93a9 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME pallet template" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [dependencies.frame-support] default-features = false diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index 9042edc8fa..16bb0fe0cb 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } aura = { version = "2.0.0-rc3", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } balances = { version = "2.0.0-rc3", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 74edf2f257..4e2c0151b7 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -34,7 +34,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] # third-party dependencies -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } serde = { version = "1.0.102", features = ["derive"] } futures = { version = "0.3.1", features = ["compat"] } hex-literal = "0.2.1" diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 64799129fc..2c5a5db281 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } node-primitives = { version = "2.0.0-rc3", path = "../primitives" } node-runtime = { version = "2.0.0-rc3", path = "../runtime" } sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index 1c2f316b40..91202191f1 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } derive_more = "0.99" log = "0.4.8" sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index ec8d58fe27..75a8cbb332 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system" } sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/application-crypto" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 7cc4018fb6..b26b53cd6c 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # third-party dependencies -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } integer-sqrt = { version = "0.1.2" } serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index f423c58fe6..6bf4abc03d 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -17,7 +17,7 @@ pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } sc-service = { version = "0.8.0-rc3", features = ["test-helpers", "db"], path = "../../../client/service" } sc-client-db = { version = "0.8.0-rc3", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api/" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 064470ea7c..fa570f5759 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -22,7 +22,7 @@ tiny-bip39 = "0.7" substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index 7730168136..606c1c4813 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sc-client-api" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } sc-executor = { version = "0.8.0-rc3", path = "../executor" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 8833306f06..114092ab31 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -17,7 +17,7 @@ prost-build = "0.6.1" [dependencies] bytes = "0.5.0" -codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } +codec = { package = "parity-scale-codec", default-features = false, version = "1.3.1" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index 964d1c3798..6e3ec49ea7 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -12,7 +12,7 @@ description = "Basic implementation of block-authoring logic." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index ff142887ff..ce94526e0c 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -21,7 +21,7 @@ sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } sc-client-api = { version = "2.0.0-rc3", path = "../api" } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index 1cb1c4657b..04bdc19fe4 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -17,7 +17,7 @@ sp-consensus-aura = { version = "0.8.0-rc3", path = "../../../primitives/consens sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index cf4e32a94c..4f8f4db264 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sc-consensus-babe" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index c1c47a1a68..3911a59b72 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" fork-tree = { version = "2.0.0-rc3", path = "../../../utils/fork-tree" } sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc3"} diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index b48f54a325..cd8d4cab42 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index dae0a924b7..25a137d214 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -13,7 +13,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-client-api = { version = "2.0.0-rc3", path = "../../api" } sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index d9fcdf7f6a..22ca6e64aa 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -20,7 +20,7 @@ kvdb-memorydb = "0.6.0" linked-hash-map = "0.5.2" hash-db = "0.15.2" parity-util-mem = { version = "0.6.1", default-features = false, features = ["std"] } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } blake2-rfc = "0.2.18" sc-client-api = { version = "2.0.0-rc3", path = "../api" } diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index 96d2d9eb94..f1499693f3 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index e9d2586e36..a6ff79a067 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" derive_more = "0.99.2" parity-wasm = "0.41.0" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } wasmi = "0.6.2" sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index 94f28f744b..f3c2ee2c67 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4.8" wasmi = "0.6.2" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-executor-common = { version = "0.8.0-rc3", path = "../common" } sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 730bc74932..6d008bcee6 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-executor-common = { version = "0.8.0-rc3", path = "../common" } sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index d101fe66d0..29b9cdaeba 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -22,7 +22,7 @@ log = "0.4.8" parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" -parity-scale-codec = { version = "1.3.0", features = ["derive"] } +parity-scale-codec = { version = "1.3.1", features = ["derive"] } sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } sp-arithmetic = { version = "2.0.0-rc3", path = "../../primitives/arithmetic" } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } diff --git a/client/light/Cargo.toml b/client/light/Cargo.toml index 1ef35f72ac..490da15364 100644 --- a/client/light/Cargo.toml +++ b/client/light/Cargo.toml @@ -20,7 +20,7 @@ sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" } sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" } sc-client-api = { version = "2.0.0-rc2", path = "../api" } sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-executor = { version = "0.8.0-rc2", path = "../executor" } [features] diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 94a7b2b57d..8467aa1154 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -21,7 +21,7 @@ prost-build = "0.6.1" bitflags = "1.2.0" bs58 = "0.3.1" bytes = "0.5.0" -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 7f1d23f558..a9cd8c4dea 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -22,7 +22,7 @@ log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" sp-offchain = { version = "2.0.0-rc3", path = "../../primitives/offchain" } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } rand = "0.7.2" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index c7aad9a1b3..3e3195b914 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -12,7 +12,7 @@ description = "Substrate RPC interfaces." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } derive_more = "0.99.2" futures = { version = "0.3.1", features = ["compat"] } jsonrpc-core = "14.2.0" diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index f3557ca6b2..9cda4451c1 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] sc-rpc-api = { version = "0.8.0-rc3", path = "../rpc-api" } sc-client-api = { version = "2.0.0-rc3", path = "../api" } sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.2.0" log = "0.4.8" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 71e8e74c4c..1740e6fad4 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -59,7 +59,7 @@ sc-light = { version = "2.0.0-rc3", path = "../light" } sc-client-api = { version = "2.0.0-rc3", path = "../api" } sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-executor = { version = "0.8.0-rc3", path = "../executor" } sc-transaction-pool = { version = "2.0.0-rc3", path = "../transaction-pool" } sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index 5835dc14c9..7d61e86708 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -41,4 +41,4 @@ sc-client-api = { version = "2.0.0-rc3", path = "../../api" } sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } sc-executor = { version = "0.8.0-rc3", path = "../../executor" } sp-panic-handler = { version = "2.0.0-rc3", path = "../../../primitives/panic-handler" } -parity-scale-codec = "1.3.0" +parity-scale-codec = "1.3.1" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index 5b30a2230a..ee9bbf7273 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -16,7 +16,7 @@ parking_lot = "0.10.0" log = "0.4.8" sc-client-api = { version = "2.0.0-rc3", path = "../api" } sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index dce8ce48d2..e837f40a34 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -12,7 +12,7 @@ description = "Substrate transaction pool implementation." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } derive_more = "0.99.2" futures = { version = "0.3.1", features = ["compat"] } futures-diagnose = "1.0" diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index e174b31988..cb16af0f53 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -28,7 +28,7 @@ linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } criterion = "0.3" diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index 0039e8898c..33882671a4 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } # Needed for various traits. In our case, `OnFinalize`. sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml index a3bf95b2e2..ce32d8b783 100644 --- a/frame/atomic-swap/Cargo.toml +++ b/frame/atomic-swap/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index f28171ae91..5a60d23270 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 5cd93d3c31..e3c7a256a9 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authority-discovery" } sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } pallet-session = { version = "2.0.0-rc3", features = ["historical" ], path = "../session", default-features = false } diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 6f7ae89762..9cc25b075d 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-authorship = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authorship" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index dcc6b29376..5e9dcf7fb5 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -12,7 +12,7 @@ description = "Consensus extension module for BABE consensus. Collects on-chain targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index d65090b540..02b5732e00 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index 3b383d2a96..5c6306ebbb 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] linregress = "0.1" paste = "0.1" -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-api = { version = "2.0.0-rc3", path = "../../primitives/api", default-features = false } sp-runtime-interface = { version = "2.0.0-rc3", path = "../../primitives/runtime-interface", default-features = false } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime", default-features = false } diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index 071fc83b72..5517f3b03f 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 6c41875c63..b2ba8d014a 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } pwasm-utils = { version = "0.12.0", default-features = false } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index 4a0581524e..520b723933 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index ccfb2ad511..75dc1bf3fb 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -12,7 +12,7 @@ description = "Node-specific RPC methods for interaction with contracts." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index 60d7965342..3596677316 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "../../common" } diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index 9af038aab3..fea378caca 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index a33ce0ed29..08cdc5a98e 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME pallet based on seq-Phragmén election method." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index 60bb2dcb62..d03ad4f056 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index c465090743..1a6d691cde 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index d32f206de8..f93ffcf9e4 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME example pallet for offchain worker" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index 89be881437..597f2266c3 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 303cf1c1f7..a922333eb9 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME executives engine" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index a8e11e83f9..497f4fdec7 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index eb62b2986f..cdac7a6d6d 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 99a5dad149..1ec939c9bd 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 39eae1b689..0435d8c086 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 99979a47c0..2f89ff2cb2 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../authorship" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index a52ad8e331..2c856064e7 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index 6ea035c3f7..e0c94da308 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index 459f76b5e8..a8fb9eae5f 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -12,7 +12,7 @@ description = "Decodable variant of the RuntimeMetadata." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml index 00f3e51f38..44ea4dc3e9 100644 --- a/frame/multisig/Cargo.toml +++ b/frame/multisig/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 229c548ead..544a0dc734 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index fa36f42e4a..0b8b74c4a9 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index 366736ac4c..ad8520484e 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME offences pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } @@ -28,7 +28,7 @@ sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../.. sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } [dev-dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } serde = { version = "1.0.101" } diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index beb924ab27..215f362cc8 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index fb3775a625..7e64539491 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 88a738b058..33f7b5e521 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index b5009079d2..d1e0a5d62e 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME pallet for scored pools" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 6b74e3ef5f..38eef24bc6 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index da969932b1..b2c70c28d1 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -22,7 +22,7 @@ pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../. [dev-dependencies] serde = { version = "1.0.101" } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index c9e4f9cb40..eb28046d3f 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 829f39b70b..45b2b42d97 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } sp-io ={ version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index 6362ebf414..97d79ecad5 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } pallet-staking = { version = "2.0.0-rc3", path = "..", features = ["runtime-benchmarks"] } pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../reward-curve" } pallet-session = { version = "2.0.0-rc3", path = "../../session" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index 5aef45f8c2..1bdd2aab69 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index dd9354d019..e648eaf32d 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } frame-metadata = { version = "11.0.0-rc3", default-features = false, path = "../metadata" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index a68edc6238..d6e7d7d633 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io", default-features = false } sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../../primitives/state-machine" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../" } diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index ca1b5d6a12..af3288a907 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", path = "../../primitives/io", default-features = false } diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 71896f8a39..b1636c21e5 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME System benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index 4f599d6d47..d919fd1b58 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } [features] default = ["std"] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 804f17a23a..7d08164bdd 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io", optional = true } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index a8b23bfda0..f7a15d962b 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME pallet to manage transaction payments" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index 2f1e0f06d7..22be6e700b 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -12,7 +12,7 @@ description = "RPC interface for the transaction payment module." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index 8ffa6fb6ee..e63b94cb4b 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../support" } diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 4c0aae3713..338a6f1dec 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index 65eae9d4cc..f14274d709 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index 885768e365..a98a59acef 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index 6e46586975..46bd9164ac 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -12,7 +12,7 @@ description = "Substrate runtime api primitives" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-api-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } diff --git a/primitives/api/proc-macro/src/decl_runtime_apis.rs b/primitives/api/proc-macro/src/decl_runtime_apis.rs index 7e1391b7b5..93ec09d0e6 100644 --- a/primitives/api/proc-macro/src/decl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/decl_runtime_apis.rs @@ -191,7 +191,8 @@ fn generate_native_call_generators(decl: &ItemTrait) -> Result { input: &I, error_desc: &'static str, ) -> std::result::Result { - ::decode( + ::decode_with_depth_limit( + #crate_::MAX_EXTRINSIC_DEPTH, &mut &#crate_::Encode::encode(input)[..], ).map_err(|e| format!("{} {}", error_desc, e.what())) } diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index 2878bd2c13..b999b9eefd 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -83,7 +83,10 @@ fn generate_impl_call( Ok( quote!( #( - let #pnames : #ptypes = match #c_iter::Decode::decode(&mut #input) { + let #pnames : #ptypes = match #c_iter::DecodeLimit::decode_all_with_depth_limit( + #c_iter::MAX_EXTRINSIC_DEPTH, + &mut #input + ) { Ok(input) => input, Err(e) => panic!("Bad input data provided to {}: {}", #fn_name_str, e.what()), }; diff --git a/primitives/api/src/lib.rs b/primitives/api/src/lib.rs index ec15c1eae7..0aaf72e2d2 100644 --- a/primitives/api/src/lib.rs +++ b/primitives/api/src/lib.rs @@ -69,11 +69,14 @@ pub use sp_std::{slice, mem}; #[cfg(feature = "std")] use sp_std::result; #[doc(hidden)] -pub use codec::{Encode, Decode}; +pub use codec::{Encode, Decode, DecodeLimit}; use sp_core::OpaqueMetadata; #[cfg(feature = "std")] use std::{panic::UnwindSafe, cell::RefCell}; +/// Maximum nesting level for extrinsics. +pub const MAX_EXTRINSIC_DEPTH: u32 = 256; + /// Declares given traits as runtime apis. /// /// The macro will create two declarations, one for using on the client side and one for using diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 79bd37c826..04181d93f0 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -19,7 +19,7 @@ sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } sp-blockchain = { version = "2.0.0-rc3", path = "../../blockchain" } sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" diff --git a/primitives/api/test/tests/ui/mock_only_one_error_type.stderr b/primitives/api/test/tests/ui/mock_only_one_error_type.stderr index 281f0024ee..65d05e83a7 100644 --- a/primitives/api/test/tests/ui/mock_only_one_error_type.stderr +++ b/primitives/api/test/tests/ui/mock_only_one_error_type.stderr @@ -16,9 +16,9 @@ error[E0277]: the trait bound `u32: std::convert::From` is 27 | | } | |_^ the trait `std::convert::From` is not implemented for `u32` | - ::: $WORKSPACE/primitives/api/src/lib.rs:347:35 + ::: $WORKSPACE/primitives/api/src/lib.rs:350:35 | -347 | type Error: std::fmt::Debug + From; +350 | type Error: std::fmt::Debug + From; | ------------ required by this bound in `sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ApiErrorExt` | = help: the following implementations were found: diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index ebc716cd72..29f385a54a 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index 0912d6a69e..b4c655c968 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index 4201cd342b..584aef986a 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } -codec = { package = "parity-scale-codec", default-features = false, version = "1.3.0" } +codec = { package = "parity-scale-codec", default-features = false, version = "1.3.1" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index 4ca6f06207..eb52ca3e0c 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] default = [ "std" ] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index 968107e69a..8f8976949d 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } [features] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index bf1e5d8354..b4c22a524a 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -17,7 +17,7 @@ log = "0.4.8" lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-consensus = { version = "0.8.0-rc3", path = "../consensus/common" } sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } sp-block-builder = { version = "2.0.0-rc3", path = "../block-builder" } diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index 9dddc47fe2..24b82f4642 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 538b0a5b05..978b415dc5 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } merlin = { version = "2.0", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index 3f256d3f73..d63abab883 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -26,7 +26,7 @@ sp-std = { version = "2.0.0-rc3", path = "../../std" } sp-version = { version = "2.0.0-rc3", path = "../../version" } sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } sp-utils = { version = "2.0.0-rc3", path = "../../utils" } -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index f8b254ff6e..9f9fedb76c 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -16,7 +16,7 @@ sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 69872349ff..3c37f57e70 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } byteorder = { version = "1.3.2", default-features = false } diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index faa95fd9a1..3af61bbeb0 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -16,4 +16,4 @@ targets = ["x86_64-unknown-linux-gnu"] sp-storage = { version = "2.0.0-rc3", path = "../storage" } sp-std = { version = "2.0.0-rc3", path = "../std" } environmental = { version = "1.1.1" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index 254c27e8dd..27315b0ff9 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index 779507ea81..60ed88c110 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -12,7 +12,7 @@ description = "FRAME module that tracks the last finalized block, as perceived b targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 2e3820d392..503aa29d29 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] parking_lot = { version = "0.10.0", optional = true } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } [features] diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index df66740d65..8bb113b1f1 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } hash-db = { version = "0.15.2", default-features = false } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index 3a3d625b5f..12d070b47c 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -18,7 +18,7 @@ sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../tracing" } sp-runtime-interface-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index c38faa15a8..d3508c0e8b 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../arithmetic" } diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index 1a2175aebd..dfd3a44053 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -17,7 +17,7 @@ sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-io = { version = "2.0.0-rc3", default-features = false, path = "../io" } sp-wasm-interface = { version = "2.0.0-rc3", default-features = false, path = "../wasm-interface" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } [dev-dependencies] wabt = "0.9.2" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index b3dd297ceb..4abcb80d24 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -12,7 +12,7 @@ description = "Primitives for sessions" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index ce44d8a0f7..7ec400d74a 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -12,7 +12,7 @@ description = "A crate which contains primitives that are useful for implementat targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index b94195db90..77b9e304d4 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -21,7 +21,7 @@ trie-root = "0.16.0" sp-trie = { version = "2.0.0-rc3", path = "../trie" } sp-core = { version = "2.0.0-rc3", path = "../core" } sp-panic-handler = { version = "2.0.0-rc3", path = "../panic-handler" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } num-traits = "0.2.8" rand = "0.7.2" sp-externalities = { version = "0.8.0-rc3", path = "../externalities" } diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index 87cb398579..abc47f6f9a 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 59c090eb46..5b2217f0f3 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index 94daf519db..6417ae8c29 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", optional = true } +codec = { package = "parity-scale-codec", version = "1.3.1", optional = true } derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index 823d5bc5df..d99a3d1ae7 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -17,7 +17,7 @@ name = "bench" harness = false [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.21.0", default-features = false } diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index eb8c845075..18357953d7 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index 39684a0381..c2e70ce1e4 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" sp-std = { version = "2.0.0-rc3", path = "../std", default-features = false } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] default = [ "std" ] diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index 331c7e2801..f5604ceb23 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -22,7 +22,7 @@ sc-service = { version = "0.8.0-rc3", default-features = false, features = ["tes futures = "0.3.4" hash-db = "0.15.2" sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 9016ddbff5..e307522ead 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -17,7 +17,7 @@ sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path sp-consensus-aura = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/aura" } sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/babe" } sp-block-builder = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/block-builder" } -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../frame/executive" } sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 1b41b63b99..7a69f5ed22 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -21,7 +21,7 @@ substrate-test-runtime = { version = "2.0.0-rc3", path = "../../runtime" } sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index 0dc14f4edf..e5c93ef8ad 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../client" } parking_lot = "0.10.0" -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index de3f19f0a1..6c8410ab76 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -13,4 +13,4 @@ documentation = "https://docs.rs/fork-tree" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index d53c4c2fe0..364dc472cb 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -22,7 +22,7 @@ sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/external sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } structopt = "0.3.8" -codec = { version = "1.3.0", package = "parity-scale-codec" } +codec = { version = "1.3.1", package = "parity-scale-codec" } [features] default = ["db"] diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 092c2c402d..d7e4259635 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] futures = { version = "0.3.0", features = ["compat"] } jsonrpc-client-transports = { version = "14.2.0", default-features = false, features = ["http"] } jsonrpc-core = "14.2.0" -codec = { package = "parity-scale-codec", version = "1" } +codec = { package = "parity-scale-codec", version = "1.3.1" } serde = "1" frame-support = { version = "2.0.0-rc3", path = "../../../../frame/support" } sp-storage = { version = "2.0.0-rc3", path = "../../../../primitives/storage" } diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 21cd00ebd4..a03a08b3ff 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sc-client-api = { version = "2.0.0-rc3", path = "../../../../client/api" } -codec = { package = "parity-scale-codec", version = "1.3.0" } +codec = { package = "parity-scale-codec", version = "1.3.1" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" -- GitLab From 80323210d378bc39c4154946055f52b005d6a873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 23:14:14 +0200 Subject: [PATCH 211/280] Fix Babe secondary plain slots claiming (#6451) We need to check that the public key of an authority exists in our keystore before we can successfully claim a plain secondary slot. --- client/consensus/babe/src/authorship.rs | 42 ++++++++++++++++++++++++- client/keystore/src/lib.rs | 4 +-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/client/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs index dfca491eaa..682e04e380 100644 --- a/client/consensus/babe/src/authorship.rs +++ b/client/consensus/babe/src/authorship.rs @@ -169,11 +169,13 @@ fn claim_secondary_slot( } else { None } - } else { + } else if keystore.read().has_keys(&[(authority_id.to_raw_vec(), AuthorityId::ID)]) { Some(PreDigest::SecondaryPlain(SecondaryPlainPreDigest { slot_number, authority_index: *authority_index as u32, })) + } else { + None }; if let Some(pre_digest) = pre_digest { @@ -283,3 +285,41 @@ fn claim_primary_slot( None } + +#[cfg(test)] +mod tests { + use super::*; + use sp_core::{sr25519::Pair, crypto::Pair as _}; + use sp_consensus_babe::{AuthorityId, BabeEpochConfiguration, AllowedSlots}; + + #[test] + fn claim_secondary_plain_slot_works() { + let keystore = sc_keystore::Store::new_in_memory(); + let valid_public_key = dbg!(keystore.write().sr25519_generate_new( + AuthorityId::ID, + Some(sp_core::crypto::DEV_PHRASE), + ).unwrap()); + + let authorities = vec![ + (AuthorityId::from(Pair::generate().0.public()), 5), + (AuthorityId::from(Pair::generate().0.public()), 7), + ]; + + let mut epoch = Epoch { + epoch_index: 10, + start_slot: 0, + duration: 20, + authorities: authorities.clone(), + randomness: Default::default(), + config: BabeEpochConfiguration { + c: (3, 10), + allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, + }, + }; + + assert!(claim_slot(10, &epoch, &keystore).is_none()); + + epoch.authorities.push((valid_public_key.clone().into(), 10)); + assert_eq!(claim_slot(10, &epoch, &keystore).unwrap().1, valid_public_key.into()); + } +} diff --git a/client/keystore/src/lib.rs b/client/keystore/src/lib.rs index 5be4d6d12c..aed60ab0cf 100644 --- a/client/keystore/src/lib.rs +++ b/client/keystore/src/lib.rs @@ -272,7 +272,7 @@ impl Store { fn raw_public_keys(&self, id: KeyTypeId) -> Result>> { let mut public_keys: Vec> = self.additional.keys() .into_iter() - .filter_map(|k| if k.0 == id { Some(k.1.clone()) } else { None }) + .filter_map(|k| if k.0 == id { Some(k.1.clone()) } else { None }) .collect(); if let Some(path) = &self.path { @@ -365,7 +365,7 @@ impl BareCryptoStore for Store { .map(|k| sr25519::Public::from_slice(k.as_slice())) .collect() }) - .unwrap_or_default() + .unwrap_or_default() } fn sr25519_generate_new( -- GitLab From 1fae45f63aaaac4d8bd74605387bcdf14d150ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 20 Jun 2020 11:49:18 +0200 Subject: [PATCH 212/280] sp-npos-elections should not depend on itself (#6444) This removes the `dev-dependency` onto `sp-npos-elections` from itself. A crate should not depend on itself directly, especially not to make any macros work. --- Cargo.lock | 1 - primitives/npos-elections/Cargo.toml | 1 - .../npos-elections/compact/src/assignment.rs | 4 ++-- primitives/npos-elections/compact/src/lib.rs | 22 ++++++++++--------- primitives/npos-elections/src/tests.rs | 10 ++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a620ab5c2..7597682395 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7634,7 +7634,6 @@ dependencies = [ "rand 0.7.3", "serde", "sp-arithmetic", - "sp-npos-elections", "sp-npos-elections-compact", "sp-runtime", "sp-std", diff --git a/primitives/npos-elections/Cargo.toml b/primitives/npos-elections/Cargo.toml index 3e425f2adc..7982c8ce4d 100644 --- a/primitives/npos-elections/Cargo.toml +++ b/primitives/npos-elections/Cargo.toml @@ -21,7 +21,6 @@ sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../ar [dev-dependencies] substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } rand = "0.7.3" -sp-npos-elections = { version = "2.0.0-rc3", path = "." } sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } [features] diff --git a/primitives/npos-elections/compact/src/assignment.rs b/primitives/npos-elections/compact/src/assignment.rs index fb3d4330b0..96c68ece92 100644 --- a/primitives/npos-elections/compact/src/assignment.rs +++ b/primitives/npos-elections/compact/src/assignment.rs @@ -18,8 +18,8 @@ //! Code generation for the ratio assignment type. use crate::field_name_for; -use proc_macro2::{TokenStream as TokenStream2}; -use syn::{GenericArgument}; +use proc_macro2::TokenStream as TokenStream2; +use syn::GenericArgument; use quote::quote; fn from_impl(count: usize) -> TokenStream2 { diff --git a/primitives/npos-elections/compact/src/lib.rs b/primitives/npos-elections/compact/src/lib.rs index 022782a7dd..1b88ff6531 100644 --- a/primitives/npos-elections/compact/src/lib.rs +++ b/primitives/npos-elections/compact/src/lib.rs @@ -224,17 +224,19 @@ fn struct_def( } fn imports() -> Result { - let sp_phragmen_imports = match crate_name("sp-npos-elections") { - Ok(sp_npos_elections) => { - let ident = syn::Ident::new(&sp_npos_elections, Span::call_site()); - quote!( extern crate #ident as _phragmen; ) + if std::env::var("CARGO_PKG_NAME").unwrap() == "sp-npos-elections" { + Ok(quote! { + use crate as _phragmen; + }) + } else { + match crate_name("sp-npos-elections") { + Ok(sp_npos_elections) => { + let ident = syn::Ident::new(&sp_npos_elections, Span::call_site()); + Ok(quote!( extern crate #ident as _phragmen; )) + }, + Err(e) => Err(syn::Error::new(Span::call_site(), &e)), } - Err(e) => return Err(syn::Error::new(Span::call_site(), &e)), - }; - - Ok(quote!( - #sp_phragmen_imports - )) + } } struct CompactSolutionDef { diff --git a/primitives/npos-elections/src/tests.rs b/primitives/npos-elections/src/tests.rs index 47d619339b..08923c6949 100644 --- a/primitives/npos-elections/src/tests.rs +++ b/primitives/npos-elections/src/tests.rs @@ -17,8 +17,6 @@ //! Tests for npos-elections. -#![cfg(test)] - use crate::mock::*; use crate::{ seq_phragmen, balance_solution, build_support_map, is_score_better, helpers::*, @@ -772,10 +770,12 @@ fn score_comparison_large_value() { mod compact { use codec::{Decode, Encode}; - use crate::{generate_compact_solution_type, VoteWeight}; - use super::{AccountId}; + use super::AccountId; // these need to come from the same dev-dependency `sp-npos-elections`, not from the crate. - use sp_npos_elections::{Assignment, StakedAssignment, Error as PhragmenError, ExtendedBalance}; + use crate::{ + generate_compact_solution_type, VoteWeight, Assignment, StakedAssignment, + Error as PhragmenError, ExtendedBalance, + }; use sp_std::{convert::{TryInto, TryFrom}, fmt::Debug}; use sp_arithmetic::Percent; -- GitLab From 6c16d15302d30c6d368882568a2e9b536da4a5b0 Mon Sep 17 00:00:00 2001 From: s3krit Date: Sat, 20 Jun 2020 13:31:12 +0200 Subject: [PATCH 213/280] Don't autolabel insubstantial PRs 'pleasereview' (#6447) --- .github/workflows/auto-label-prs.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml index cfa4f302fe..f0b8e9b343 100644 --- a/.github/workflows/auto-label-prs.yml +++ b/.github/workflows/auto-label-prs.yml @@ -1,4 +1,4 @@ -name: Label new PRs +name: Label PRs on: pull_request: types: [opened,ready_for_review] @@ -7,14 +7,15 @@ jobs: label-new-prs: runs-on: ubuntu-latest steps: - - name: Label new drafts + - name: Label drafts uses: andymckay/labeler@master if: github.event.pull_request.draft == true with: add-labels: 'A3-inprogress' - - name: Label new PRs + remove-labels: 'A0-pleasereview' + - name: Label PRs uses: andymckay/labeler@master - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && ! contains(github.event.pull_request.labels.*.name, 'A2-insubstantial') with: add-labels: 'A0-pleasereview' remove-labels: 'A3-inprogress' -- GitLab From ef2a6c1c047f7afc1587006ddadcf16edf29d402 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Sun, 21 Jun 2020 13:34:19 +0300 Subject: [PATCH 214/280] change everything to transaction (#6440) --- client/network/src/protocol.rs | 121 +++++++++++++++++---------------- client/network/src/service.rs | 18 ++--- client/service/src/builder.rs | 8 +-- 3 files changed, 74 insertions(+), 73 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 9bec906787..90076552a7 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -72,15 +72,15 @@ pub use generic_proto::LegacyConnectionKillError; const REQUEST_TIMEOUT_SEC: u64 = 40; /// Interval at which we perform time based maintenance const TICK_TIMEOUT: time::Duration = time::Duration::from_millis(1100); -/// Interval at which we propagate extrinsics; +/// Interval at which we propagate transactions; const PROPAGATE_TIMEOUT: time::Duration = time::Duration::from_millis(2900); /// Maximim number of known block hashes to keep for a peer. const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead -/// Maximim number of known extrinsic hashes to keep for a peer. +/// Maximim number of known transaction hashes to keep for a peer. /// /// This should be approx. 2 blocks full of transactions for the network to function properly. -const MAX_KNOWN_EXTRINSICS: usize = 10240; // ~300kb per peer + overhead. +const MAX_KNOWN_TRANSACTIONS: usize = 10240; // ~300kb per peer + overhead. /// Maximim number of transaction validation request we keep at any moment. const MAX_PENDING_TRANSACTIONS: usize = 8192; @@ -106,25 +106,25 @@ mod rep { pub const TIMEOUT: Rep = Rep::new(-(1 << 10), "Request timeout"); /// Reputation change when we are a light client and a peer is behind us. pub const PEER_BEHIND_US_LIGHT: Rep = Rep::new(-(1 << 8), "Useless for a light peer"); - /// Reputation change when a peer sends us any extrinsic. + /// Reputation change when a peer sends us any transaction. /// - /// This forces node to verify it, thus the negative value here. Once extrinsic is verified, - /// reputation change should be refunded with `ANY_EXTRINSIC_REFUND` - pub const ANY_EXTRINSIC: Rep = Rep::new(-(1 << 4), "Any extrinsic"); - /// Reputation change when a peer sends us any extrinsic that is not invalid. - pub const ANY_EXTRINSIC_REFUND: Rep = Rep::new(1 << 4, "Any extrinsic (refund)"); - /// Reputation change when a peer sends us an extrinsic that we didn't know about. - pub const GOOD_EXTRINSIC: Rep = Rep::new(1 << 7, "Good extrinsic"); - /// Reputation change when a peer sends us a bad extrinsic. - pub const BAD_EXTRINSIC: Rep = Rep::new(-(1 << 12), "Bad extrinsic"); + /// This forces node to verify it, thus the negative value here. Once transaction is verified, + /// reputation change should be refunded with `ANY_TRANSACTION_REFUND` + pub const ANY_TRANSACTION: Rep = Rep::new(-(1 << 4), "Any transaction"); + /// Reputation change when a peer sends us any transaction that is not invalid. + pub const ANY_TRANSACTION_REFUND: Rep = Rep::new(1 << 4, "Any transaction (refund)"); + /// Reputation change when a peer sends us an transaction that we didn't know about. + pub const GOOD_TRANSACTION: Rep = Rep::new(1 << 7, "Good transaction"); + /// Reputation change when a peer sends us a bad transaction. + pub const BAD_TRANSACTION: Rep = Rep::new(-(1 << 12), "Bad transaction"); /// We sent an RPC query to the given node, but it failed. pub const RPC_FAILED: Rep = Rep::new(-(1 << 12), "Remote call failed"); /// We received a message that failed to decode. pub const BAD_MESSAGE: Rep = Rep::new(-(1 << 12), "Bad message"); /// We received an unexpected response. pub const UNEXPECTED_RESPONSE: Rep = Rep::new_fatal("Unexpected response packet"); - /// We received an unexpected extrinsic packet. - pub const UNEXPECTED_EXTRINSICS: Rep = Rep::new_fatal("Unexpected extrinsics packet"); + /// We received an unexpected transaction packet. + pub const UNEXPECTED_TRANSACTIONS: Rep = Rep::new_fatal("Unexpected transactions packet"); /// We received an unexpected light node request. pub const UNEXPECTED_REQUEST: Rep = Rep::new_fatal("Unexpected block request packet"); /// Peer has different genesis. @@ -145,7 +145,7 @@ struct Metrics { fork_targets: Gauge, finality_proofs: GaugeVec, justifications: GaugeVec, - propagated_extrinsics: Counter, + propagated_transactions: Counter, } impl Metrics { @@ -191,8 +191,8 @@ impl Metrics { )?; register(g, r)? }, - propagated_extrinsics: register(Counter::new( - "sync_propagated_extrinsics", + propagated_transactions: register(Counter::new( + "sync_propagated_transactions", "Number of transactions propagated to at least one peer", )?, r)?, }) @@ -221,11 +221,11 @@ impl Future for PendingTransaction { pub struct Protocol { /// Interval at which we call `tick`. tick_timeout: Pin + Send>>, - /// Interval at which we call `propagate_extrinsics`. + /// Interval at which we call `propagate_transactions`. propagate_timeout: Pin + Send>>, /// Pending list of messages to return from `poll` as a priority. pending_messages: VecDeque>, - /// Pending extrinsic verification tasks. + /// Pending transactions verification tasks. pending_transactions: FuturesUnordered, config: ProtocolConfig, genesis_hash: B::Hash, @@ -280,7 +280,7 @@ struct Peer { /// Requests we are no longer interested in. obsolete_requests: HashMap, /// Holds a set of transactions known to this peer. - known_extrinsics: LruHashSet, + known_transactions: LruHashSet, /// Holds a set of blocks known to this peer. known_blocks: LruHashSet, /// Request counter, @@ -601,7 +601,7 @@ impl Protocol { return outcome; }, GenericMessage::Transactions(m) => - self.on_extrinsics(who, m), + self.on_transactions(who, m), GenericMessage::RemoteCallRequest(request) => self.on_remote_call_request(who, request), GenericMessage::RemoteCallResponse(_) => warn!(target: "sub-libp2p", "Received unexpected RemoteCallResponse"), @@ -720,8 +720,8 @@ impl Protocol { // Print some diagnostics. if let Some(peer) = self.context_data.peers.get(&who) { debug!(target: "sync", "Clogged peer {} (protocol_version: {:?}; roles: {:?}; \ - known_extrinsics: {:?}; known_blocks: {:?}; best_hash: {:?}; best_number: {:?})", - who, peer.info.protocol_version, peer.info.roles, peer.known_extrinsics, peer.known_blocks, + known_transactions: {:?}; known_blocks: {:?}; best_hash: {:?}; best_number: {:?})", + who, peer.info.protocol_version, peer.info.roles, peer.known_transactions, peer.known_blocks, peer.info.best_hash, peer.info.best_number); } else { debug!(target: "sync", "Peer clogged before being properly connected"); @@ -1048,7 +1048,7 @@ impl Protocol { let peer = Peer { info, block_request: None, - known_extrinsics: LruHashSet::new(NonZeroUsize::new(MAX_KNOWN_EXTRINSICS) + known_transactions: LruHashSet::new(NonZeroUsize::new(MAX_KNOWN_TRANSACTIONS) .expect("Constant is nonzero")), known_blocks: LruHashSet::new(NonZeroUsize::new(MAX_KNOWN_BLOCKS) .expect("Constant is nonzero")), @@ -1137,28 +1137,29 @@ impl Protocol { .map(|(peer_id, peer)| (peer_id, peer.info.roles)) } - /// Called when peer sends us new extrinsics - fn on_extrinsics( + /// Called when peer sends us new transactions + fn on_transactions( &mut self, who: PeerId, - extrinsics: message::Transactions + transactions: message::Transactions ) { - // sending extrinsic to light node is considered a bad behavior + // sending transaction to light node is considered a bad behavior if !self.config.roles.is_full() { - trace!(target: "sync", "Peer {} is trying to send extrinsic to the light node", who); + trace!(target: "sync", "Peer {} is trying to send transactions to the light node", who); self.behaviour.disconnect_peer(&who); - self.peerset_handle.report_peer(who, rep::UNEXPECTED_EXTRINSICS); + self.peerset_handle.report_peer(who, rep::UNEXPECTED_TRANSACTIONS); return; } - // Accept extrinsics only when fully synced + // Accept transactions only when fully synced if self.sync.status().state != SyncState::Idle { - trace!(target: "sync", "{} Ignoring extrinsics while syncing", who); + trace!(target: "sync", "{} Ignoring transactions while syncing", who); return; } - trace!(target: "sync", "Received {} extrinsics from {}", extrinsics.len(), who); + + trace!(target: "sync", "Received {} transactions from {}", transactions.len(), who); if let Some(ref mut peer) = self.context_data.peers.get_mut(&who) { - for t in extrinsics { + for t in transactions { if self.pending_transactions.len() > MAX_PENDING_TRANSACTIONS { debug!( target: "sync", @@ -1169,9 +1170,9 @@ impl Protocol { } let hash = self.transaction_pool.hash_of(&t); - peer.known_extrinsics.insert(hash); + peer.known_transactions.insert(hash); - self.peerset_handle.report_peer(who.clone(), rep::ANY_EXTRINSIC); + self.peerset_handle.report_peer(who.clone(), rep::ANY_TRANSACTION); self.pending_transactions.push(PendingTransaction { peer_id: who.clone(), @@ -1181,45 +1182,45 @@ impl Protocol { } } - fn on_handle_extrinsic_import(&mut self, who: PeerId, import: TransactionImport) { + fn on_handle_transaction_import(&mut self, who: PeerId, import: TransactionImport) { match import { - TransactionImport::KnownGood => self.peerset_handle.report_peer(who, rep::ANY_EXTRINSIC_REFUND), - TransactionImport::NewGood => self.peerset_handle.report_peer(who, rep::GOOD_EXTRINSIC), - TransactionImport::Bad => self.peerset_handle.report_peer(who, rep::BAD_EXTRINSIC), + TransactionImport::KnownGood => self.peerset_handle.report_peer(who, rep::ANY_TRANSACTION_REFUND), + TransactionImport::NewGood => self.peerset_handle.report_peer(who, rep::GOOD_TRANSACTION), + TransactionImport::Bad => self.peerset_handle.report_peer(who, rep::BAD_TRANSACTION), TransactionImport::None => {}, } } - /// Propagate one extrinsic. - pub fn propagate_extrinsic( + /// Propagate one transaction. + pub fn propagate_transaction( &mut self, hash: &H, ) { - debug!(target: "sync", "Propagating extrinsic [{:?}]", hash); + debug!(target: "sync", "Propagating transaction [{:?}]", hash); // Accept transactions only when fully synced if self.sync.status().state != SyncState::Idle { return; } - if let Some(extrinsic) = self.transaction_pool.transaction(hash) { - let propagated_to = self.do_propagate_extrinsics(&[(hash.clone(), extrinsic)]); + if let Some(transaction) = self.transaction_pool.transaction(hash) { + let propagated_to = self.do_propagate_transactions(&[(hash.clone(), transaction)]); self.transaction_pool.on_broadcasted(propagated_to); } } - fn do_propagate_extrinsics( + fn do_propagate_transactions( &mut self, - extrinsics: &[(H, B::Extrinsic)], + transactions: &[(H, B::Extrinsic)], ) -> HashMap> { let mut propagated_to = HashMap::new(); for (who, peer) in self.context_data.peers.iter_mut() { - // never send extrinsics to the light node + // never send transactions to the light node if !peer.info.roles.is_full() { continue; } - let (hashes, to_send): (Vec<_>, Vec<_>) = extrinsics + let (hashes, to_send): (Vec<_>, Vec<_>) = transactions .iter() - .filter(|&(ref hash, _)| peer.known_extrinsics.insert(hash.clone())) + .filter(|&(ref hash, _)| peer.known_transactions.insert(hash.clone())) .cloned() .unzip(); @@ -1244,22 +1245,22 @@ impl Protocol { if propagated_to.len() > 0 { if let Some(ref metrics) = self.metrics { - metrics.propagated_extrinsics.inc(); + metrics.propagated_transactions.inc(); } } propagated_to } - /// Call when we must propagate ready extrinsics to peers. - pub fn propagate_extrinsics(&mut self) { - debug!(target: "sync", "Propagating extrinsics"); + /// Call when we must propagate ready transactions to peers. + pub fn propagate_transactions(&mut self) { + debug!(target: "sync", "Propagating transactions"); // Accept transactions only when fully synced if self.sync.status().state != SyncState::Idle { return; } - let extrinsics = self.transaction_pool.transactions(); - let propagated_to = self.do_propagate_extrinsics(&extrinsics); + let transactions = self.transaction_pool.transactions(); + let propagated_to = self.do_propagate_transactions(&transactions); self.transaction_pool.on_broadcasted(propagated_to); } @@ -1983,7 +1984,7 @@ impl NetworkBehaviour for Protocol { } while let Poll::Ready(Some(())) = self.propagate_timeout.poll_next_unpin(cx) { - self.propagate_extrinsics(); + self.propagate_transactions(); } for (id, mut r) in self.sync.block_requests() { @@ -2011,7 +2012,7 @@ impl NetworkBehaviour for Protocol { self.pending_messages.push_back(event); } if let Poll::Ready(Some((peer_id, result))) = self.pending_transactions.poll_next_unpin(cx) { - self.on_handle_extrinsic_import(peer_id, result); + self.on_handle_transaction_import(peer_id, result); } if let Some(message) = self.pending_messages.pop_front() { return Poll::Ready(NetworkBehaviourAction::GenerateEvent(message)); @@ -2050,7 +2051,7 @@ impl NetworkBehaviour for Protocol { } Some(Fallback::Transactions) => { if let Ok(m) = message::Transactions::decode(&mut message.as_ref()) { - self.on_extrinsics(peer_id, m); + self.on_transactions(peer_id, m); } else { warn!(target: "sub-libp2p", "Failed to decode transactions list"); } diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 90fffc8a37..93560a6c0b 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -587,15 +587,15 @@ impl NetworkService { /// All transactions will be fetched from the `TransactionPool` that was passed at /// initialization as part of the configuration and propagated to peers. pub fn trigger_repropagate(&self) { - let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateExtrinsics); + let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateTransactions); } /// You must call when new transaction is imported by the transaction pool. /// /// This transaction will be fetched from the `TransactionPool` that was passed at /// initialization as part of the configuration and propagated to peers. - pub fn propagate_extrinsic(&self, hash: H) { - let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateExtrinsic(hash)); + pub fn propagate_transaction(&self, hash: H) { + let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateTransaction(hash)); } /// Make sure an important block is propagated to peers. @@ -798,8 +798,8 @@ impl NetworkStateInfo for NetworkService /// /// Each entry corresponds to a method of `NetworkService`. enum ServiceToWorkerMsg { - PropagateExtrinsic(H), - PropagateExtrinsics, + PropagateTransaction(H), + PropagateTransactions, RequestJustification(B::Hash, NumberFor), AnnounceBlock(B::Hash, Vec), GetValue(record::Key), @@ -1119,10 +1119,10 @@ impl Future for NetworkWorker { this.network_service.user_protocol_mut().announce_block(hash, data), ServiceToWorkerMsg::RequestJustification(hash, number) => this.network_service.user_protocol_mut().request_justification(&hash, number), - ServiceToWorkerMsg::PropagateExtrinsic(hash) => - this.network_service.user_protocol_mut().propagate_extrinsic(&hash), - ServiceToWorkerMsg::PropagateExtrinsics => - this.network_service.user_protocol_mut().propagate_extrinsics(), + ServiceToWorkerMsg::PropagateTransaction(hash) => + this.network_service.user_protocol_mut().propagate_transaction(&hash), + ServiceToWorkerMsg::PropagateTransactions => + this.network_service.user_protocol_mut().propagate_transactions(), ServiceToWorkerMsg::GetValue(key) => this.network_service.get_value(&key), ServiceToWorkerMsg::PutValue(key, value) => diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 23d736d98b..f492c5d494 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -1067,7 +1067,7 @@ ServiceBuilder< spawn_handle.spawn( "on-transaction-imported", - extrinsic_notifications(transaction_pool.clone(), network.clone()), + transaction_notifications(transaction_pool.clone(), network.clone()), ); // Prometheus metrics. @@ -1245,7 +1245,7 @@ ServiceBuilder< } } -async fn extrinsic_notifications( +async fn transaction_notifications( transaction_pool: Arc, network: Arc::Hash>> ) @@ -1253,10 +1253,10 @@ async fn extrinsic_notifications( TBl: BlockT, TExPool: MaintainedTransactionPool::Hash>, { - // extrinsic notifications + // transaction notifications transaction_pool.import_notification_stream() .for_each(move |hash| { - network.propagate_extrinsic(hash); + network.propagate_transaction(hash); let status = transaction_pool.status(); telemetry!(SUBSTRATE_INFO; "txpool.import"; "ready" => status.ready, -- GitLab From 41970e7ea56d59d45861d65490a329fe216df74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:34:38 +0100 Subject: [PATCH 215/280] node: spawn block authoring and grandpa voter as blocking tasks (#6446) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * service: add spawner for essential tasks * node: spawn block authoring and grandpa voter as blocking tasks * Apply suggestions from code review Co-authored-by: Bastian Köcher --- bin/node-template/node/src/service.rs | 4 +- bin/node/cli/src/service.rs | 6 +-- client/service/src/lib.rs | 17 +++++++- client/service/src/task_manager.rs | 59 +++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index e8578ab5b5..e330c17b24 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -142,7 +142,7 @@ pub fn new_full(config: Configuration) -> Result Result> + Send + Unpin + S /// The task name is a `&'static str` as opposed to a `String`. The reason for that is that /// in order to avoid memory consumption issues with the Prometheus metrics, the set of /// possible task names has to be bounded. + #[deprecated(note = "Use `spawn_task_handle().spawn() instead.")] fn spawn_task(&self, name: &'static str, task: impl Future + Send + 'static); /// Spawns a task in the background that runs the future passed as /// parameter. The given task is considered essential, i.e. if it errors we /// trigger a service exit. + #[deprecated(note = "Use `spawn_essential_task_handle().spawn() instead.")] fn spawn_essential_task(&self, name: &'static str, task: impl Future + Send + 'static); + /// Returns a handle for spawning essential tasks. Any task spawned through this handle is + /// considered essential, i.e. if it errors we trigger a service exit. + fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle; + /// Returns a handle for spawning tasks. fn spawn_task_handle(&self) -> SpawnTaskHandle; @@ -269,13 +275,20 @@ where let _ = essential_failed.send(()); }); - let _ = self.spawn_task(name, essential_task); + let _ = self.spawn_task_handle().spawn(name, essential_task); } fn spawn_task_handle(&self) -> SpawnTaskHandle { self.task_manager.spawn_handle() } + fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle { + SpawnEssentialTaskHandle::new( + self.essential_failed_tx.clone(), + self.task_manager.spawn_handle(), + ) + } + fn rpc_query(&self, mem: &RpcSession, request: &str) -> Pin> + Send>> { Box::pin( self.rpc_handlers.handle_request(request, mem.metadata.clone()) diff --git a/client/service/src/task_manager.rs b/client/service/src/task_manager.rs index 9cd92538e3..5a400f70df 100644 --- a/client/service/src/task_manager.rs +++ b/client/service/src/task_manager.rs @@ -28,6 +28,7 @@ use prometheus_endpoint::{ CounterVec, HistogramOpts, HistogramVec, Opts, Registry, U64 }; use sc_client_api::CloneableSpawn; +use sp_utils::mpsc::TracingUnboundedSender; use crate::config::TaskType; mod prometheus_future; @@ -149,6 +150,64 @@ impl futures01::future::Executor for SpawnTaskHandle { } } +/// A wrapper over `SpawnTaskHandle` that will notify a receiver whenever any +/// task spawned through it fails. The service should be on the receiver side +/// and will shut itself down whenever it receives any message, i.e. an +/// essential task has failed. +pub struct SpawnEssentialTaskHandle { + essential_failed_tx: TracingUnboundedSender<()>, + inner: SpawnTaskHandle, +} + +impl SpawnEssentialTaskHandle { + /// Creates a new `SpawnEssentialTaskHandle`. + pub fn new( + essential_failed_tx: TracingUnboundedSender<()>, + spawn_task_handle: SpawnTaskHandle, + ) -> SpawnEssentialTaskHandle { + SpawnEssentialTaskHandle { + essential_failed_tx, + inner: spawn_task_handle, + } + } + + /// Spawns the given task with the given name. + /// + /// See also [`SpawnTaskHandle::spawn`]. + pub fn spawn(&self, name: &'static str, task: impl Future + Send + 'static) { + self.spawn_inner(name, task, TaskType::Async) + } + + /// Spawns the blocking task with the given name. + /// + /// See also [`SpawnTaskHandle::spawn_blocking`]. + pub fn spawn_blocking( + &self, + name: &'static str, + task: impl Future + Send + 'static, + ) { + self.spawn_inner(name, task, TaskType::Blocking) + } + + fn spawn_inner( + &self, + name: &'static str, + task: impl Future + Send + 'static, + task_type: TaskType, + ) { + use futures::sink::SinkExt; + let mut essential_failed = self.essential_failed_tx.clone(); + let essential_task = std::panic::AssertUnwindSafe(task) + .catch_unwind() + .map(move |_| { + log::error!("Essential task `{}` failed. Shutting down service.", name); + let _ = essential_failed.send(()); + }); + + let _ = self.inner.spawn_inner(name, essential_task, task_type); + } +} + /// Helper struct to manage background/async tasks in Service. pub struct TaskManager { /// A future that resolves when the service has exited, this is useful to -- GitLab From a5bcfedc9e6764ad9d186027ff0c5b3d639032f8 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Sun, 21 Jun 2020 12:34:53 +0200 Subject: [PATCH 216/280] pallet-atomic-swap: generialized swap action (#6421) * pallet-atomic-swap: generialized swap action * Bump spec_version * Fix weight calculation * Remove unnecessary type aliases --- bin/node/runtime/src/lib.rs | 2 +- frame/atomic-swap/src/lib.rs | 145 +++++++++++++++++++++++---------- frame/atomic-swap/src/tests.rs | 10 ++- 3 files changed, 109 insertions(+), 48 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index cf3d262298..cf1b0de8f7 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -97,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 253, + spec_version: 254, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/frame/atomic-swap/src/lib.rs b/frame/atomic-swap/src/lib.rs index 8686138c2b..56aa67310f 100644 --- a/frame/atomic-swap/src/lib.rs +++ b/frame/atomic-swap/src/lib.rs @@ -42,10 +42,10 @@ mod tests; -use sp_std::prelude::*; +use sp_std::{prelude::*, marker::PhantomData, ops::{Deref, DerefMut}}; use sp_io::hashing::blake2_256; use frame_support::{ - decl_module, decl_storage, decl_event, decl_error, ensure, + Parameter, decl_module, decl_storage, decl_event, decl_error, ensure, traits::{Get, Currency, ReservableCurrency, BalanceStatus}, weights::Weight, dispatch::DispatchResult, @@ -55,37 +55,98 @@ use codec::{Encode, Decode}; use sp_runtime::RuntimeDebug; /// Pending atomic swap operation. -#[derive(Clone, RuntimeDebug, Eq, PartialEq, Encode, Decode)] -pub struct PendingSwap { +#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode)] +pub struct PendingSwap { /// Source of the swap. - pub source: AccountId, - /// Balance value of the swap. - pub balance: Balance, + pub source: T::AccountId, + /// Action of this swap. + pub action: T::SwapAction, /// End block of the lock. - pub end_block: BlockNumber, + pub end_block: T::BlockNumber, } -/// Balance type from the pallet's point of view. -pub type BalanceFor = <::Currency as Currency<::AccountId>>::Balance; +/// Hashed proof type. +pub type HashedProof = [u8; 32]; -/// AccountId type from the pallet's point of view. -pub type AccountIdFor = ::AccountId; +/// Definition of a pending atomic swap action. It contains the following three phrases: +/// +/// - **Reserve**: reserve the resources needed for a swap. This is to make sure that **Claim** +/// succeeds with best efforts. +/// - **Claim**: claim any resources reserved in the first phrase. +/// - **Cancel**: cancel any resources reserved in the first phrase. +pub trait SwapAction { + /// Reserve the resources needed for the swap, from the given `source`. The reservation is + /// allowed to fail. If that is the case, the the full swap creation operation is cancelled. + fn reserve(&self, source: &T::AccountId) -> DispatchResult; + /// Claim the reserved resources, with `source` and `target`. Returns whether the claim + /// succeeds. + fn claim(&self, source: &T::AccountId, target: &T::AccountId) -> bool; + /// Weight for executing the operation. + fn weight(&self) -> Weight; + /// Cancel the resources reserved in `source`. + fn cancel(&self, source: &T::AccountId); +} -/// BlockNumber type from the pallet's point of view. -pub type BlockNumberFor = ::BlockNumber; +/// A swap action that only allows transferring balances. +#[derive(Clone, RuntimeDebug, Eq, PartialEq, Encode, Decode)] +pub struct BalanceSwapAction> { + value: ::AccountId>>::Balance, + _marker: PhantomData, +} -/// PendingSwap type from the pallet's point of view. -pub type PendingSwapFor = PendingSwap, BalanceFor, BlockNumberFor>; +impl BalanceSwapAction where + C: ReservableCurrency, +{ + /// Create a new swap action value of balance. + pub fn new(value: ::AccountId>>::Balance) -> Self { + Self { value, _marker: PhantomData } + } +} -/// Hashed proof type. -pub type HashedProof = [u8; 32]; +impl Deref for BalanceSwapAction where + C: ReservableCurrency, +{ + type Target = ::AccountId>>::Balance; + + fn deref(&self) -> &Self::Target { + &self.value + } +} + +impl DerefMut for BalanceSwapAction where + C: ReservableCurrency, +{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.value + } +} + +impl SwapAction for BalanceSwapAction where + C: ReservableCurrency, +{ + fn reserve(&self, source: &T::AccountId) -> DispatchResult { + C::reserve(&source, self.value) + } + + fn claim(&self, source: &T::AccountId, target: &T::AccountId) -> bool { + C::repatriate_reserved(source, target, self.value, BalanceStatus::Free).is_ok() + } + + fn weight(&self) -> Weight { + T::DbWeight::get().reads_writes(1, 1) + } + + fn cancel(&self, source: &T::AccountId) { + C::unreserve(source, self.value); + } +} /// Atomic swap's pallet configuration trait. pub trait Trait: frame_system::Trait { /// The overarching event type. type Event: From> + Into<::Event>; - /// The currency mechanism. - type Currency: ReservableCurrency; + /// Swap action. + type SwapAction: SwapAction + Parameter; /// Limit of proof size. /// /// Atomic swap is only atomic if once the proof is revealed, both parties can submit the proofs @@ -103,7 +164,7 @@ decl_storage! { trait Store for Module as AtomicSwap { pub PendingSwaps: double_map hasher(twox_64_concat) T::AccountId, hasher(blake2_128_concat) HashedProof - => Option>; + => Option>; } } @@ -121,6 +182,8 @@ decl_error! { AlreadyClaimed, /// Swap does not exist. NotExist, + /// Claim action mismatch. + ClaimActionMismatch, /// Duration has not yet passed for the swap to be cancelled. DurationNotPassed, } @@ -129,14 +192,13 @@ decl_error! { decl_event!( /// Event of atomic swap pallet. pub enum Event where - Balance = BalanceFor, - AccountId = AccountIdFor, - PendingSwap = PendingSwapFor, + AccountId = ::AccountId, + PendingSwap = PendingSwap, { /// Swap created. NewSwap(AccountId, HashedProof, PendingSwap), /// Swap claimed. The last parameter indicates whether the execution succeeds. - SwapClaimed(AccountId, HashedProof, Balance, bool), + SwapClaimed(AccountId, HashedProof, bool), /// Swap cancelled. SwapCancelled(AccountId, HashedProof), } @@ -164,10 +226,10 @@ decl_module! { #[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)] fn create_swap( origin, - target: AccountIdFor, + target: T::AccountId, hashed_proof: HashedProof, - balance: BalanceFor, - duration: BlockNumberFor, + action: T::SwapAction, + duration: T::BlockNumber, ) { let source = ensure_signed(origin)?; ensure!( @@ -175,11 +237,11 @@ decl_module! { Error::::AlreadyExist ); - T::Currency::reserve(&source, balance)?; + action.reserve(&source)?; let swap = PendingSwap { source, - balance, + action, end_block: frame_system::Module::::block_number() + duration, }; PendingSwaps::::insert(target.clone(), hashed_proof.clone(), swap.clone()); @@ -194,13 +256,17 @@ decl_module! { /// The dispatch origin for this call must be _Signed_. /// /// - `proof`: Revealed proof of the claim. - #[weight = T::DbWeight::get().reads_writes(2, 2) + /// - `action`: Action defined in the swap, it must match the entry in blockchain. Otherwise + /// the operation fails. This is used for weight calculation. + #[weight = T::DbWeight::get().reads_writes(1, 1) .saturating_add(40_000_000) .saturating_add((proof.len() as Weight).saturating_mul(100)) + .saturating_add(action.weight()) ] fn claim_swap( origin, proof: Vec, + action: T::SwapAction, ) -> DispatchResult { ensure!( proof.len() <= T::ProofLimit::get() as usize, @@ -212,18 +278,14 @@ decl_module! { let swap = PendingSwaps::::get(&target, hashed_proof) .ok_or(Error::::InvalidProof)?; + ensure!(swap.action == action, Error::::ClaimActionMismatch); - let succeeded = T::Currency::repatriate_reserved( - &swap.source, - &target, - swap.balance, - BalanceStatus::Free, - ).is_ok(); + let succeeded = swap.action.claim(&swap.source, &target); PendingSwaps::::remove(target.clone(), hashed_proof.clone()); Self::deposit_event( - RawEvent::SwapClaimed(target, hashed_proof, swap.balance, succeeded) + RawEvent::SwapClaimed(target, hashed_proof, succeeded) ); Ok(()) @@ -238,7 +300,7 @@ decl_module! { #[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)] fn cancel_swap( origin, - target: AccountIdFor, + target: T::AccountId, hashed_proof: HashedProof, ) { let source = ensure_signed(origin)?; @@ -254,10 +316,7 @@ decl_module! { Error::::DurationNotPassed, ); - T::Currency::unreserve( - &swap.source, - swap.balance, - ); + swap.action.cancel(&swap.source); PendingSwaps::::remove(&target, hashed_proof.clone()); Self::deposit_event( diff --git a/frame/atomic-swap/src/tests.rs b/frame/atomic-swap/src/tests.rs index 72db841de1..d04ffab205 100644 --- a/frame/atomic-swap/src/tests.rs +++ b/frame/atomic-swap/src/tests.rs @@ -21,7 +21,7 @@ impl_outer_origin! { // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of pallets we want to use. -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, Debug, PartialEq)] pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; @@ -71,7 +71,7 @@ parameter_types! { } impl Trait for Test { type Event = (); - type Currency = Balances; + type SwapAction = BalanceSwapAction; type ProofLimit = ProofLimit; } type System = frame_system::Module; @@ -109,7 +109,7 @@ fn two_party_successful_swap() { Origin::signed(A), B, hashed_proof.clone(), - 50, + BalanceSwapAction::new(50), 1000, ).unwrap(); @@ -123,7 +123,7 @@ fn two_party_successful_swap() { Origin::signed(B), A, hashed_proof.clone(), - 75, + BalanceSwapAction::new(75), 1000, ).unwrap(); @@ -136,6 +136,7 @@ fn two_party_successful_swap() { AtomicSwap::claim_swap( Origin::signed(A), proof.to_vec(), + BalanceSwapAction::new(75), ).unwrap(); assert_eq!(Balances::free_balance(A), 100 + 75); @@ -147,6 +148,7 @@ fn two_party_successful_swap() { AtomicSwap::claim_swap( Origin::signed(B), proof.to_vec(), + BalanceSwapAction::new(50), ).unwrap(); assert_eq!(Balances::free_balance(A), 100 - 50); -- GitLab From 6f86bdd897ce06c0169dcbd2454dc7587cb8461f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 21 Jun 2020 12:39:15 +0200 Subject: [PATCH 217/280] Fix issues with `Operational` transactions validity and prioritization. (#6435) * Fix weight limit for operational transactions. * Include BlockExecutionWeight. --- frame/system/src/lib.rs | 71 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index db6b528bcf..8eec6a2c37 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -1395,8 +1395,10 @@ impl CheckWeight where info: &DispatchInfoOf, ) -> Result<(), TransactionValidityError> { match info.class { - // Mandatory and Operational transactions does not - DispatchClass::Mandatory | DispatchClass::Operational => Ok(()), + // Mandatory transactions are included in a block unconditionally, so + // we don't verify weight. + DispatchClass::Mandatory => Ok(()), + // Normal transactions must not exceed `MaximumExtrinsicWeight`. DispatchClass::Normal => { let maximum_weight = T::MaximumExtrinsicWeight::get(); let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); @@ -1405,7 +1407,22 @@ impl CheckWeight where } else { Ok(()) } - } + }, + // For operational transactions we make sure it doesn't exceed + // the space alloted for `Operational` class. + DispatchClass::Operational => { + let maximum_weight = T::MaximumBlockWeight::get(); + let operational_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; + let operational_limit = + operational_limit.saturating_sub(T::BlockExecutionWeight::get()); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > operational_limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + }, } } @@ -1484,9 +1501,11 @@ impl CheckWeight where fn get_priority(info: &DispatchInfoOf) -> TransactionPriority { match info.class { DispatchClass::Normal => info.weight.into(), - DispatchClass::Operational => Bounded::max_value(), + // Don't use up the whole priority space, to allow things like `tip` + // to be taken into account as well. + DispatchClass::Operational => TransactionPriority::max_value() / 2, // Mandatory extrinsics are only for inherents; never transactions. - DispatchClass::Mandatory => Bounded::min_value(), + DispatchClass::Mandatory => TransactionPriority::min_value(), } } @@ -2452,6 +2471,42 @@ pub(crate) mod tests { }); } + #[test] + fn operational_extrinsic_limited_by_operational_space_limit() { + new_test_ext().execute_with(|| { + let operational_limit = CheckWeight::::get_dispatch_limit_ratio( + DispatchClass::Operational + ) * ::MaximumBlockWeight::get(); + let base_weight = ::ExtrinsicBaseWeight::get(); + let block_base = ::BlockExecutionWeight::get(); + + let weight = operational_limit - base_weight - block_base; + let okay = DispatchInfo { + weight, + class: DispatchClass::Operational, + ..Default::default() + }; + let max = DispatchInfo { + weight: weight + 1, + class: DispatchClass::Operational, + ..Default::default() + }; + let len = 0_usize; + + assert_eq!( + CheckWeight::::do_validate(&okay, len), + Ok(ValidTransaction { + priority: CheckWeight::::get_priority(&okay), + ..Default::default() + }) + ); + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); + }); + } + #[test] fn register_extra_weight_unchecked_doesnt_care_about_limits() { new_test_ext().execute_with(|| { @@ -2479,6 +2534,8 @@ pub(crate) mod tests { assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); assert_eq!(::MaximumBlockWeight::get(), 1024); assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); + // Checking single extrinsic should not take current block weight into account. + assert_eq!(CheckWeight::::check_extrinsic_weight(&rest_operational), Ok(())); }); } @@ -2514,6 +2571,8 @@ pub(crate) mod tests { assert_ok!(CheckWeight::::do_pre_dispatch(&dispatch_operational, len)); // Not too much though assert_noop!(CheckWeight::::do_pre_dispatch(&dispatch_operational, len), InvalidTransaction::ExhaustsResources); + // Even with full block, validity of single transaction should be correct. + assert_eq!(CheckWeight::::check_extrinsic_weight(&dispatch_operational), Ok(())); }); } @@ -2559,7 +2618,7 @@ pub(crate) mod tests { .validate(&1, CALL, &op, len) .unwrap() .priority; - assert_eq!(priority, u64::max_value()); + assert_eq!(priority, u64::max_value() / 2); }) } -- GitLab From 3bf25c2c25afe523c5481d0792713aa816dd649a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 22 Jun 2020 13:29:35 +0200 Subject: [PATCH 218/280] `pallet-staking`: Expose missing consts (#6456) * `pallet-staking`: Expose missing consts * Apply suggestions from code review Co-authored-by: Nikolay Volf Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update the source docs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Nikolay Volf Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- frame/staking/src/lib.rs | 45 ++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index aca68bd706..63b427a5ab 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -865,9 +865,10 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// Number of eras that staked funds must remain bonded for. type BondingDuration: Get; - /// Number of eras that slashes are deferred by, after computation. This should be less than the - /// bonding duration. Set to 0 if slashes should be applied immediately, without opportunity for - /// intervention. + /// Number of eras that slashes are deferred by, after computation. + /// + /// This should be less than the bonding duration. Set to 0 if slashes + /// should be applied immediately, without opportunity for intervention. type SlashDeferDuration: Get; /// The origin which can cancel a deferred slash. Root can always do this. @@ -884,6 +885,7 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { type NextNewSession: EstimateNextNewSession; /// The number of blocks before the end of the era from which election submissions are allowed. + /// /// Setting this to zero will disable the offchain compute and only on-chain seq-phragmen will /// be used. /// @@ -894,14 +896,15 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// The overarching call type. type Call: Dispatchable + From> + IsSubType, Self> + Clone; - /// Maximum number of balancing iterations to run in the offchain submission. If set to 0, - /// balance_solution will not be executed at all. + /// Maximum number of balancing iterations to run in the offchain submission. + /// + /// If set to 0, balance_solution will not be executed at all. type MaxIterations: Get; /// The threshold of improvement that should be provided for a new solution to be accepted. type MinSolutionScoreBump: Get; - /// The maximum number of nominator rewarded for each validator. + /// The maximum number of nominators rewarded for each validator. /// /// For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim /// their reward. This used to limit the i/o cost for the nominator payout. @@ -1275,6 +1278,36 @@ decl_module! { /// Number of eras that staked funds must remain bonded for. const BondingDuration: EraIndex = T::BondingDuration::get(); + /// Number of eras that slashes are deferred by, after computation. + /// + /// This should be less than the bonding duration. + /// Set to 0 if slashes should be applied immediately, without opportunity for + /// intervention. + const SlashDeferDuration: EraIndex = T::SlashDeferDuration::get(); + + /// The number of blocks before the end of the era from which election submissions are allowed. + /// + /// Setting this to zero will disable the offchain compute and only on-chain seq-phragmen will + /// be used. + /// + /// This is bounded by being within the last session. Hence, setting it to a value more than the + /// length of a session will be pointless. + const ElectionLookahead: T::BlockNumber = T::ElectionLookahead::get(); + + /// Maximum number of balancing iterations to run in the offchain submission. + /// + /// If set to 0, balance_solution will not be executed at all. + const MaxIterations: u32 = T::MaxIterations::get(); + + /// The threshold of improvement that should be provided for a new solution to be accepted. + const MinSolutionScoreBump: Perbill = T::MinSolutionScoreBump::get(); + + /// The maximum number of nominators rewarded for each validator. + /// + /// For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim + /// their reward. This used to limit the i/o cost for the nominator payout. + const MaxNominatorRewardedPerValidator: u32 = T::MaxNominatorRewardedPerValidator::get(); + type Error = Error; fn deposit_event() = default; -- GitLab From 8329dbd4e50997ae714a5da2877b82530b5bb3c5 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 22 Jun 2020 18:15:47 +0200 Subject: [PATCH 219/280] update collective events docs to be consistent with changes (#6463) --- frame/collective/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 4551f4917a..2be0241243 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -165,11 +165,11 @@ decl_event! { Approved(Hash), /// A motion was not approved by the required threshold. Disapproved(Hash), - /// A motion was executed; `bool` is true if returned without error. + /// A motion was executed; result will be `Ok` if it returned without error. Executed(Hash, DispatchResult), - /// A single member did some action; `bool` is true if returned without error. + /// A single member did some action; result will be `Ok` if it returned without error. MemberExecuted(Hash, DispatchResult), - /// A proposal was closed after its duration was up. + /// A proposal was closed because its threshold was reached or after its duration was up. Closed(Hash, MemberCount, MemberCount), } } @@ -188,7 +188,7 @@ decl_error! { DuplicateVote, /// Members are already initialized! AlreadyInitialized, - /// The close call is made too early, before the end of the voting. + /// The close call was made too early, before the end of the voting. TooEarly, /// There can only be a maximum of `MaxProposals` active proposals. TooManyProposals, -- GitLab From 94b3812fb90e50fe30d38c461affb0deb3ad8169 Mon Sep 17 00:00:00 2001 From: s3krit Date: Mon, 22 Jun 2020 18:47:31 +0200 Subject: [PATCH 220/280] [CI] Don't tag PRs on companion job cancels (#6470) --- .github/workflows/polkadot-companion-labels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/polkadot-companion-labels.yml b/.github/workflows/polkadot-companion-labels.yml index dd00e72d6c..20aaa98a23 100644 --- a/.github/workflows/polkadot-companion-labels.yml +++ b/.github/workflows/polkadot-companion-labels.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Monitor the status of the gitlab-check-companion-build job - uses: s3krit/await-status-action@4528ebbdf6e29bbec77c41caad1b2dec148ba894 + uses: s3krit/await-status-action@v1.0.1 id: 'check-companion-status' with: authToken: ${{ secrets.GITHUB_TOKEN }} @@ -17,6 +17,8 @@ jobs: contexts: 'continuous-integration/gitlab-check-polkadot-companion-build' timeout: 1800 notPresentTimeout: 3600 # It can take quite a while before the job starts... + failedStates: failure + interruptedStates: error # Error = job was probably cancelled. We don't want to label the PR in that case - name: Label success uses: andymckay/labeler@master if: steps.check-companion-status.outputs.result == 'success' -- GitLab From 50eb257608ff141e32954b087a1ef64458f021b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 22 Jun 2020 19:41:37 +0100 Subject: [PATCH 221/280] network: remove unused variable (#6460) --- client/network/src/protocol/sync.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index 781d410fff..c3e87ca19a 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -651,7 +651,6 @@ impl ChainSync { let blocks = &mut self.blocks; let attrs = &self.required_block_attributes; let fork_targets = &mut self.fork_targets; - let mut have_requests = false; let last_finalized = self.client.info().finalized_number; let best_queued = self.best_queued_number; let client = &self.client; @@ -681,7 +680,6 @@ impl ChainSync { peer.common_number, req, ); - have_requests = true; Some((id, req)) } else if let Some((hash, req)) = fork_sync_request( id, @@ -697,7 +695,6 @@ impl ChainSync { ) { trace!(target: "sync", "Downloading fork {:?} from {}", hash, id); peer.state = PeerSyncState::DownloadingStale(hash); - have_requests = true; Some((id, req)) } else { None -- GitLab From 19826b979b1874883837a7b3e30470f655a2a8e6 Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Tue, 23 Jun 2020 10:51:35 +0200 Subject: [PATCH 222/280] Avoid panic on dropping a `sc_network::service::out_events::Receiver`. (#6458) * Avoid panic on dropping a `Receiver`. * CI --- client/network/src/service/out_events.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/network/src/service/out_events.rs b/client/network/src/service/out_events.rs index 4a631601a6..1b86a5fa43 100644 --- a/client/network/src/service/out_events.rs +++ b/client/network/src/service/out_events.rs @@ -35,7 +35,7 @@ use crate::Event; use super::maybe_utf8_bytes_to_string; -use futures::{prelude::*, channel::mpsc, ready}; +use futures::{prelude::*, channel::mpsc, ready, stream::FusedStream}; use parking_lot::Mutex; use prometheus_endpoint::{register, CounterVec, GaugeVec, Opts, PrometheusError, Registry, U64}; use std::{ @@ -119,8 +119,10 @@ impl fmt::Debug for Receiver { impl Drop for Receiver { fn drop(&mut self) { - // Empty the list to properly decrease the metrics. - while let Some(Some(_)) = self.next().now_or_never() {} + if !self.inner.is_terminated() { + // Empty the list to properly decrease the metrics. + while let Some(Some(_)) = self.next().now_or_never() {} + } } } -- GitLab From 5a102f7c984a7e7c169cf2b74df24e35a20710a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 23 Jun 2020 11:17:53 +0200 Subject: [PATCH 223/280] Implement nested storage transactions (#6269) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add transactional storage functionality to OverlayChanges A collection already has a natural None state. No need to wrap it with an option. * Add storage transactions runtime interface * Add frame support for transactions * Fix committed typo * Rename 'changes' variable to 'overlay' * Fix renaming change * Fixed strange line break * Rename clear to clear_where * Add comment regarding delete value on mutation * Add comment which changes are covered by a transaction * Do force the arg to with_transaction return a Result * Use rust doc comments on every documentable place * Fix wording of insert_diry doc * Improve doc on start_transaction * Rename value to overlayed in close_transaction * Inline negation * Improve wording of close_transaction comments * Get rid of an expect by using get_or_insert_with * Remove trailing whitespace * Rename should to expected in tests * Rolling back a transaction must mark the overlay as dirty * Protect client initiated storage tx from being droped by runtime * Review nits * Return Err when entering or exiting runtime fails * Documentation fixup * Remove close type * Move enter/exit runtime to excute_aux in the state-machine * Rename Discard -> Rollback * Move child changeset creation to constructor * Move child spawning into the closure * Apply suggestions from code review Co-authored-by: Bastian Köcher * Fixup for code suggestion * Unify re-exports * Rename overlay_changes to mod.rs and move into subdir * Change proof wording * Adapt a new test from master to storage-tx * Suggestions from the latest round of review * Fix warning message Co-authored-by: Bastian Köcher --- Cargo.lock | 28 +- frame/support/src/storage/mod.rs | 27 + .../support/test/tests/storage_transaction.rs | 159 ++++ .../api/proc-macro/src/impl_runtime_apis.rs | 13 +- primitives/externalities/src/lib.rs | 23 + primitives/io/src/lib.rs | 40 + primitives/runtime-interface/test/src/lib.rs | 1 - primitives/state-machine/Cargo.toml | 3 + primitives/state-machine/src/basic.rs | 12 + .../state-machine/src/changes_trie/build.rs | 41 +- primitives/state-machine/src/ext.rs | 48 +- primitives/state-machine/src/lib.rs | 41 +- .../src/overlayed_changes/changeset.rs | 752 ++++++++++++++++++ .../mod.rs} | 719 ++++++----------- primitives/state-machine/src/read_only.rs | 12 + primitives/state-machine/src/testing.rs | 6 +- 16 files changed, 1388 insertions(+), 537 deletions(-) create mode 100644 frame/support/test/tests/storage_transaction.rs create mode 100644 primitives/state-machine/src/overlayed_changes/changeset.rs rename primitives/state-machine/src/{overlayed_changes.rs => overlayed_changes/mod.rs} (50%) diff --git a/Cargo.lock b/Cargo.lock index 7597682395..930cb554c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -819,7 +819,7 @@ dependencies = [ "clap", "criterion-plot 0.3.1", "csv", - "itertools", + "itertools 0.8.2", "lazy_static", "libc", "num-traits 0.2.11", @@ -846,7 +846,7 @@ dependencies = [ "clap", "criterion-plot 0.4.1", "csv", - "itertools", + "itertools 0.8.2", "lazy_static", "num-traits 0.2.11", "oorandom", @@ -868,7 +868,7 @@ checksum = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" dependencies = [ "byteorder", "cast", - "itertools", + "itertools 0.8.2", ] [[package]] @@ -878,7 +878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545" dependencies = [ "cast", - "itertools", + "itertools 0.8.2", ] [[package]] @@ -2294,6 +2294,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.5" @@ -5186,7 +5195,7 @@ checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" dependencies = [ "bytes 0.5.4", "heck", - "itertools", + "itertools 0.8.2", "log", "multimap", "petgraph", @@ -5203,7 +5212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", - "itertools", + "itertools 0.8.2", "proc-macro2", "quote 1.0.6", "syn 1.0.17", @@ -7828,11 +7837,14 @@ version = "0.8.0-rc3" dependencies = [ "hash-db", "hex-literal", + "itertools 0.9.0", "log", "num-traits 0.2.11", "parity-scale-codec", "parking_lot 0.10.2", + "pretty_assertions", "rand 0.7.3", + "smallvec 1.4.0", "sp-core", "sp-externalities", "sp-panic-handler", @@ -8072,7 +8084,7 @@ dependencies = [ "hex", "hex-literal", "hyper 0.12.35", - "itertools", + "itertools 0.8.2", "jsonrpc-core-client", "libp2p", "node-primitives", @@ -8301,7 +8313,7 @@ dependencies = [ "build-helper", "cargo_metadata", "fs2", - "itertools", + "itertools 0.8.2", "tempfile", "toml", "walkdir", diff --git a/frame/support/src/storage/mod.rs b/frame/support/src/storage/mod.rs index 6d0ef91ce1..c2d7ceef0f 100644 --- a/frame/support/src/storage/mod.rs +++ b/frame/support/src/storage/mod.rs @@ -29,6 +29,33 @@ pub mod child; pub mod generator; pub mod migration; +/// Describes whether a storage transaction should be committed or rolled back. +pub enum TransactionOutcome { + /// Transaction should be committed. + Commit(T), + /// Transaction should be rolled back. + Rollback(T), +} + +/// Execute the supplied function in a new storage transaction. +/// +/// All changes to storage performed by the supplied function are discarded if the returned +/// outcome is `TransactionOutcome::Rollback`. +/// +/// Transactions can be nested to any depth. Commits happen to the parent transaction. +pub fn with_transaction(f: impl FnOnce() -> TransactionOutcome) -> R { + use sp_io::storage::{ + start_transaction, commit_transaction, rollback_transaction, + }; + use TransactionOutcome::*; + + start_transaction(); + match f() { + Commit(res) => { commit_transaction(); res }, + Rollback(res) => { rollback_transaction(); res }, + } +} + /// A trait for working with macro-generated storage values under the substrate storage API. /// /// Details on implementation can be found at diff --git a/frame/support/test/tests/storage_transaction.rs b/frame/support/test/tests/storage_transaction.rs new file mode 100644 index 0000000000..bf6c70966b --- /dev/null +++ b/frame/support/test/tests/storage_transaction.rs @@ -0,0 +1,159 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode, EncodeLike}; +use frame_support::{ + StorageMap, StorageValue, storage::{with_transaction, TransactionOutcome::*}, +}; +use sp_io::TestExternalities; + +pub trait Trait { + type Origin; + type BlockNumber: Encode + Decode + EncodeLike + Default + Clone; +} + +frame_support::decl_module! { + pub struct Module for enum Call where origin: T::Origin {} +} + +frame_support::decl_storage!{ + trait Store for Module as StorageTransactions { + pub Value: u32; + pub Map: map hasher(twox_64_concat) String => u32; + } +} + + +#[test] +fn storage_transaction_basic_commit() { + TestExternalities::default().execute_with(|| { + + assert_eq!(Value::get(), 0); + assert!(!Map::contains_key("val0")); + + with_transaction(|| { + Value::set(99); + Map::insert("val0", 99); + assert_eq!(Value::get(), 99); + assert_eq!(Map::get("val0"), 99); + Commit(()) + }); + + assert_eq!(Value::get(), 99); + assert_eq!(Map::get("val0"), 99); + }); +} + +#[test] +fn storage_transaction_basic_rollback() { + TestExternalities::default().execute_with(|| { + + assert_eq!(Value::get(), 0); + assert_eq!(Map::get("val0"), 0); + + with_transaction(|| { + Value::set(99); + Map::insert("val0", 99); + assert_eq!(Value::get(), 99); + assert_eq!(Map::get("val0"), 99); + Rollback(()) + }); + + assert_eq!(Value::get(), 0); + assert_eq!(Map::get("val0"), 0); + }); +} + +#[test] +fn storage_transaction_rollback_then_commit() { + TestExternalities::default().execute_with(|| { + Value::set(1); + Map::insert("val1", 1); + + with_transaction(|| { + Value::set(2); + Map::insert("val1", 2); + Map::insert("val2", 2); + + with_transaction(|| { + Value::set(3); + Map::insert("val1", 3); + Map::insert("val2", 3); + Map::insert("val3", 3); + + assert_eq!(Value::get(), 3); + assert_eq!(Map::get("val1"), 3); + assert_eq!(Map::get("val2"), 3); + assert_eq!(Map::get("val3"), 3); + + Rollback(()) + }); + + assert_eq!(Value::get(), 2); + assert_eq!(Map::get("val1"), 2); + assert_eq!(Map::get("val2"), 2); + assert_eq!(Map::get("val3"), 0); + + Commit(()) + }); + + assert_eq!(Value::get(), 2); + assert_eq!(Map::get("val1"), 2); + assert_eq!(Map::get("val2"), 2); + assert_eq!(Map::get("val3"), 0); + }); +} + +#[test] +fn storage_transaction_commit_then_rollback() { + TestExternalities::default().execute_with(|| { + Value::set(1); + Map::insert("val1", 1); + + with_transaction(|| { + Value::set(2); + Map::insert("val1", 2); + Map::insert("val2", 2); + + with_transaction(|| { + Value::set(3); + Map::insert("val1", 3); + Map::insert("val2", 3); + Map::insert("val3", 3); + + assert_eq!(Value::get(), 3); + assert_eq!(Map::get("val1"), 3); + assert_eq!(Map::get("val2"), 3); + assert_eq!(Map::get("val3"), 3); + + Commit(()) + }); + + assert_eq!(Value::get(), 3); + assert_eq!(Map::get("val1"), 3); + assert_eq!(Map::get("val2"), 3); + assert_eq!(Map::get("val3"), 3); + + Rollback(()) + }); + + assert_eq!(Value::get(), 1); + assert_eq!(Map::get("val1"), 1); + assert_eq!(Map::get("val2"), 0); + assert_eq!(Map::get("val3"), 0); + }); +} diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index b999b9eefd..8f9927cadc 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -260,6 +260,7 @@ fn generate_runtime_api_base_structures() -> Result { &self, map_call: F, ) -> std::result::Result where Self: Sized { + self.changes.borrow_mut().start_transaction(); *self.commit_on_success.borrow_mut() = false; let res = map_call(self); *self.commit_on_success.borrow_mut() = true; @@ -369,6 +370,9 @@ fn generate_runtime_api_base_structures() -> Result { &self, call_api_at: F, ) -> std::result::Result<#crate_::NativeOrEncoded, E> { + if *self.commit_on_success.borrow() { + self.changes.borrow_mut().start_transaction(); + } let res = call_api_at( &self.call, self, @@ -384,11 +388,16 @@ fn generate_runtime_api_base_structures() -> Result { } fn commit_on_ok(&self, res: &std::result::Result) { + let proof = "\ + We only close a transaction when we opened one ourself. + Other parts of the runtime that make use of transactions (state-machine) + also balance their transactions. The runtime cannot close client initiated + transactions. qed"; if *self.commit_on_success.borrow() { if res.is_err() { - self.changes.borrow_mut().discard_prospective(); + self.changes.borrow_mut().rollback_transaction().expect(proof); } else { - self.changes.borrow_mut().commit_prospective(); + self.changes.borrow_mut().commit_transaction().expect(proof); } } } diff --git a/primitives/externalities/src/lib.rs b/primitives/externalities/src/lib.rs index cfb1d0878a..210fe5b4ef 100644 --- a/primitives/externalities/src/lib.rs +++ b/primitives/externalities/src/lib.rs @@ -195,6 +195,29 @@ pub trait Externalities: ExtensionStore { /// The returned hash is defined by the `Block` and is SCALE encoded. fn storage_changes_root(&mut self, parent: &[u8]) -> Result>, ()>; + /// Start a new nested transaction. + /// + /// This allows to either commit or roll back all changes made after this call to the + /// top changes or the default child changes. For every transaction there cam be a + /// matching call to either `storage_rollback_transaction` or `storage_commit_transaction`. + /// Any transactions that are still open after returning from runtime are committed + /// automatically. + /// + /// Changes made without any open transaction are committed immediately. + fn storage_start_transaction(&mut self); + + /// Rollback the last transaction started by `storage_start_transaction`. + /// + /// Any changes made during that storage transaction are discarded. Returns an error when + /// no transaction is open that can be closed. + fn storage_rollback_transaction(&mut self) -> Result<(), ()>; + + /// Commit the last transaction started by `storage_start_transaction`. + /// + /// Any changes made during that storage transaction are committed. Returns an error when + /// no transaction is open that can be closed. + fn storage_commit_transaction(&mut self) -> Result<(), ()>; + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /// Benchmarking related functionality and shouldn't be used anywhere else! /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index 1d5e01bdff..c75c8e67cc 100644 --- a/primitives/io/src/lib.rs +++ b/primitives/io/src/lib.rs @@ -155,6 +155,46 @@ pub trait Storage { fn next_key(&mut self, key: &[u8]) -> Option> { self.next_storage_key(&key) } + + /// Start a new nested transaction. + /// + /// This allows to either commit or roll back all changes that are made after this call. + /// For every transaction there must be a matching call to either `rollback_transaction` + /// or `commit_transaction`. This is also effective for all values manipulated using the + /// `DefaultChildStorage` API. + /// + /// # Warning + /// + /// This is a low level API that is potentially dangerous as it can easily result + /// in unbalanced transactions. For example, FRAME users should use high level storage + /// abstractions. + fn start_transaction(&mut self) { + self.storage_start_transaction(); + } + + /// Rollback the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are discarded. + /// + /// # Panics + /// + /// Will panic if there is no open transaction. + fn rollback_transaction(&mut self) { + self.storage_rollback_transaction() + .expect("No open transaction that can be rolled back."); + } + + /// Commit the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are committed. + /// + /// # Panics + /// + /// Will panic if there is no open transaction. + fn commit_transaction(&mut self) { + self.storage_commit_transaction() + .expect("No open transaction that can be committed."); + } } /// Interface for accessing the child storage for default child trie, diff --git a/primitives/runtime-interface/test/src/lib.rs b/primitives/runtime-interface/test/src/lib.rs index 06bc4e8ed8..109caab606 100644 --- a/primitives/runtime-interface/test/src/lib.rs +++ b/primitives/runtime-interface/test/src/lib.rs @@ -55,7 +55,6 @@ fn call_wasm_method_with_result( &mut ext_ext, sp_core::traits::MissingHostFunctions::Disallow, ).map_err(|e| format!("Failed to execute `{}`: {}", method, e))?; - Ok(ext) } diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index 77b9e304d4..29c8676f7e 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -25,10 +25,13 @@ codec = { package = "parity-scale-codec", version = "1.3.1" } num-traits = "0.2.8" rand = "0.7.2" sp-externalities = { version = "0.8.0-rc3", path = "../externalities" } +itertools = "0.9" +smallvec = "1.4" [dev-dependencies] hex-literal = "0.2.1" sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } +pretty_assertions = "0.6.1" [features] default = [] diff --git a/primitives/state-machine/src/basic.rs b/primitives/state-machine/src/basic.rs index 917e41f33d..dbb4c6c2b8 100644 --- a/primitives/state-machine/src/basic.rs +++ b/primitives/state-machine/src/basic.rs @@ -307,6 +307,18 @@ impl Externalities for BasicExternalities { Ok(None) } + fn storage_start_transaction(&mut self) { + unimplemented!("Transactions are not supported by BasicExternalities"); + } + + fn storage_rollback_transaction(&mut self) -> Result<(), ()> { + unimplemented!("Transactions are not supported by BasicExternalities"); + } + + fn storage_commit_transaction(&mut self) -> Result<(), ()> { + unimplemented!("Transactions are not supported by BasicExternalities"); + } + fn wipe(&mut self) {} fn commit(&mut self) {} diff --git a/primitives/state-machine/src/changes_trie/build.rs b/primitives/state-machine/src/changes_trie/build.rs index f9698f1a31..bf910e2c4f 100644 --- a/primitives/state-machine/src/changes_trie/build.rs +++ b/primitives/state-machine/src/changes_trie/build.rs @@ -25,7 +25,7 @@ use num_traits::One; use crate::{ StorageKey, backend::Backend, - overlayed_changes::OverlayedChanges, + overlayed_changes::{OverlayedChanges, OverlayedValue}, trie_backend_essence::TrieBackendEssence, changes_trie::{ AnchorBlockId, ConfigurationRange, Storage, BlockNumber, @@ -43,7 +43,7 @@ pub(crate) fn prepare_input<'a, B, H, Number>( backend: &'a B, storage: &'a dyn Storage, config: ConfigurationRange<'a, Number>, - changes: &'a OverlayedChanges, + overlay: &'a OverlayedChanges, parent: &'a AnchorBlockId, ) -> Result<( impl Iterator> + 'a, @@ -60,7 +60,7 @@ pub(crate) fn prepare_input<'a, B, H, Number>( let (extrinsics_input, children_extrinsics_input) = prepare_extrinsics_input( backend, &number, - changes, + overlay, )?; let (digest_input, mut children_digest_input, digest_input_blocks) = prepare_digest_input::( parent, @@ -96,7 +96,7 @@ pub(crate) fn prepare_input<'a, B, H, Number>( fn prepare_extrinsics_input<'a, B, H, Number>( backend: &'a B, block: &Number, - changes: &'a OverlayedChanges, + overlay: &'a OverlayedChanges, ) -> Result<( impl Iterator> + 'a, BTreeMap, impl Iterator> + 'a>, @@ -108,20 +108,21 @@ fn prepare_extrinsics_input<'a, B, H, Number>( { let mut children_result = BTreeMap::new(); - for child_info in changes.child_infos() { + for (child_changes, child_info) in overlay.children() { let child_index = ChildIndex:: { block: block.clone(), storage_key: child_info.prefixed_storage_key(), }; let iter = prepare_extrinsics_input_inner( - backend, block, changes, - Some(child_info.clone()) + backend, block, overlay, + Some(child_info.clone()), + child_changes, )?; children_result.insert(child_index, iter); } - let top = prepare_extrinsics_input_inner(backend, block, changes, None)?; + let top = prepare_extrinsics_input_inner(backend, block, overlay, None, overlay.changes())?; Ok((top, children_result)) } @@ -129,40 +130,38 @@ fn prepare_extrinsics_input<'a, B, H, Number>( fn prepare_extrinsics_input_inner<'a, B, H, Number>( backend: &'a B, block: &Number, - changes: &'a OverlayedChanges, + overlay: &'a OverlayedChanges, child_info: Option, + changes: impl Iterator ) -> Result> + 'a, String> where B: Backend, H: Hasher, Number: BlockNumber, { - changes.changes(child_info.as_ref()) - .filter(|( _, v)| v.extrinsics().is_some()) + changes + .filter(|( _, v)| v.extrinsics().next().is_some()) .try_fold(BTreeMap::new(), |mut map: BTreeMap<&[u8], (ExtrinsicIndex, Vec)>, (k, v)| { match map.entry(k) { Entry::Vacant(entry) => { // ignore temporary values (values that have null value at the end of operation // AND are not in storage at the beginning of operation if let Some(child_info) = child_info.as_ref() { - if !changes.child_storage(child_info, k).map(|v| v.is_some()).unwrap_or_default() { + if !overlay.child_storage(child_info, k).map(|v| v.is_some()).unwrap_or_default() { if !backend.exists_child_storage(&child_info, k) .map_err(|e| format!("{}", e))? { return Ok(map); } } } else { - if !changes.storage(k).map(|v| v.is_some()).unwrap_or_default() { + if !overlay.storage(k).map(|v| v.is_some()).unwrap_or_default() { if !backend.exists_storage(k).map_err(|e| format!("{}", e))? { return Ok(map); } } }; - let extrinsics = v.extrinsics() - .expect("filtered by filter() call above; qed") - .cloned() - .collect(); + let extrinsics = v.extrinsics().cloned().collect(); entry.insert((ExtrinsicIndex { block: block.clone(), key: k.to_vec(), @@ -173,9 +172,7 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>( // AND we are checking it before insertion let extrinsics = &mut entry.get_mut().1; extrinsics.extend( - v.extrinsics() - .expect("filtered by filter() call above; qed") - .cloned() + v.extrinsics().cloned() ); extrinsics.sort_unstable(); }, @@ -404,6 +401,8 @@ mod test { let mut changes = OverlayedChanges::default(); changes.set_collect_extrinsics(true); + changes.start_transaction(); + changes.set_extrinsic_index(1); changes.set_storage(vec![101], Some(vec![203])); @@ -411,7 +410,7 @@ mod test { changes.set_storage(vec![100], Some(vec![202])); changes.set_child_storage(&child_info_1, vec![100], Some(vec![202])); - changes.commit_prospective(); + changes.commit_transaction().unwrap(); changes.set_extrinsic_index(0); changes.set_storage(vec![100], Some(vec![0])); diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index 7e805250e7..2cd63cde97 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -37,6 +37,10 @@ use std::{error, fmt, any::{Any, TypeId}}; use log::{warn, trace}; const EXT_NOT_ALLOWED_TO_FAIL: &str = "Externalities not allowed to fail within runtime"; +const BENCHMARKING_FN: &str = "\ + This is a special fn only for benchmarking where a database commit happens from the runtime. + For that reason client started transactions before calling into runtime are not allowed. + Without client transactions the loop condition garantuees the success of the tx close."; /// Errors that can occur when interacting with the externalities. #[derive(Debug, Copy, Clone)] @@ -147,7 +151,7 @@ where self.backend.pairs().iter() .map(|&(ref k, ref v)| (k.to_vec(), Some(v.to_vec()))) - .chain(self.overlay.changes(None).map(|(k, v)| (k.clone(), v.value().cloned()))) + .chain(self.overlay.changes().map(|(k, v)| (k.clone(), v.value().cloned()))) .collect::>() .into_iter() .filter_map(|(k, maybe_val)| maybe_val.map(|val| (k, val))) @@ -477,15 +481,14 @@ where ); root.encode() } else { + let root = if let Some((changes, info)) = self.overlay.child_changes(storage_key) { + let delta = changes.map(|(k, v)| (k.as_ref(), v.value().map(AsRef::as_ref))); + Some(self.backend.child_storage_root(info, delta)) + } else { + None + }; - if let Some(child_info) = self.overlay.default_child_info(storage_key) { - let (root, is_empty, _) = { - let delta = self.overlay.changes(Some(child_info)) - .map(|(k, v)| (k.as_ref(), v.value().map(AsRef::as_ref))); - - self.backend.child_storage_root(child_info, delta) - }; - + if let Some((root, is_empty, _)) = root { let root = root.encode(); // We store update in the overlay in order to be able to use 'self.storage_transaction' // cache. This is brittle as it rely on Ext only querying the trie backend for @@ -547,20 +550,37 @@ where root.map(|r| r.map(|o| o.encode())) } + fn storage_start_transaction(&mut self) { + self.overlay.start_transaction() + } + + fn storage_rollback_transaction(&mut self) -> Result<(), ()> { + self.mark_dirty(); + self.overlay.rollback_transaction().map_err(|_| ()) + } + + fn storage_commit_transaction(&mut self) -> Result<(), ()> { + self.overlay.commit_transaction().map_err(|_| ()) + } + fn wipe(&mut self) { - self.overlay.discard_prospective(); + for _ in 0..self.overlay.transaction_depth() { + self.overlay.rollback_transaction().expect(BENCHMARKING_FN); + } self.overlay.drain_storage_changes( &self.backend, None, Default::default(), self.storage_transaction_cache, ).expect(EXT_NOT_ALLOWED_TO_FAIL); - self.storage_transaction_cache.reset(); - self.backend.wipe().expect(EXT_NOT_ALLOWED_TO_FAIL) + self.backend.wipe().expect(EXT_NOT_ALLOWED_TO_FAIL); + self.mark_dirty(); } fn commit(&mut self) { - self.overlay.commit_prospective(); + for _ in 0..self.overlay.transaction_depth() { + self.overlay.commit_transaction().expect(BENCHMARKING_FN); + } let changes = self.overlay.drain_storage_changes( &self.backend, None, @@ -571,7 +591,7 @@ where changes.transaction_storage_root, changes.transaction, ).expect(EXT_NOT_ALLOWED_TO_FAIL); - self.storage_transaction_cache.reset(); + self.mark_dirty(); } } diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index b863d155e7..e5e48bc47c 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -79,6 +79,10 @@ pub use in_memory_backend::new_in_mem; pub use stats::{UsageInfo, UsageUnit, StateMachineStats}; pub use sp_core::traits::CloneableSpawn; +const PROOF_CLOSE_TRANSACTION: &str = "\ + Closing a transaction that was started in this function. Client initiated transactions + are protected from being closed by the runtime. qed"; + type CallResult = Result, E>; /// Default handler of the execution manager. @@ -297,6 +301,8 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where None => &mut cache, }; + self.overlay.enter_runtime().expect("StateMachine is never called from the runtime; qed"); + let mut ext = Ext::new( self.overlay, self.offchain_overlay, @@ -324,6 +330,9 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where native_call, ); + self.overlay.exit_runtime() + .expect("Runtime is not able to call this function in the overlay; qed"); + trace!( target: "state", "{:04x}: Return. Native={:?}, Result={:?}", id, @@ -347,11 +356,11 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where CallResult, ) -> CallResult { - let pending_changes = self.overlay.clone_pending(); + self.overlay.start_transaction(); let (result, was_native) = self.execute_aux(true, native_call.take()); if was_native { - self.overlay.replace_pending(pending_changes); + self.overlay.rollback_transaction().expect(PROOF_CLOSE_TRANSACTION); let (wasm_result, _) = self.execute_aux( false, native_call, @@ -366,6 +375,7 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where on_consensus_failure(wasm_result, result) } } else { + self.overlay.commit_transaction().expect(PROOF_CLOSE_TRANSACTION); result } } @@ -378,16 +388,17 @@ impl<'a, B, H, N, Exec> StateMachine<'a, B, H, N, Exec> where R: Decode + Encode + PartialEq, NC: FnOnce() -> result::Result + UnwindSafe, { - let pending_changes = self.overlay.clone_pending(); + self.overlay.start_transaction(); let (result, was_native) = self.execute_aux( true, native_call.take(), ); if !was_native || result.is_ok() { + self.overlay.commit_transaction().expect(PROOF_CLOSE_TRANSACTION); result } else { - self.overlay.replace_pending(pending_changes); + self.overlay.rollback_transaction().expect(PROOF_CLOSE_TRANSACTION); let (wasm_result, _) = self.execute_aux( false, native_call, @@ -977,7 +988,7 @@ mod tests { let mut overlay = OverlayedChanges::default(); overlay.set_storage(b"aba".to_vec(), Some(b"1312".to_vec())); overlay.set_storage(b"bab".to_vec(), Some(b"228".to_vec())); - overlay.commit_prospective(); + overlay.start_transaction(); overlay.set_storage(b"abd".to_vec(), Some(b"69".to_vec())); overlay.set_storage(b"bbd".to_vec(), Some(b"42".to_vec())); @@ -994,10 +1005,10 @@ mod tests { ); ext.clear_prefix(b"ab"); } - overlay.commit_prospective(); + overlay.commit_transaction().unwrap(); assert_eq!( - overlay.changes(None).map(|(k, v)| (k.clone(), v.value().cloned())) + overlay.changes().map(|(k, v)| (k.clone(), v.value().cloned())) .collect::>(), map![ b"abc".to_vec() => None.into(), @@ -1083,7 +1094,7 @@ mod tests { Some(vec![reference_data[0].clone()].encode()), ); } - overlay.commit_prospective(); + overlay.start_transaction(); { let mut ext = Ext::new( &mut overlay, @@ -1102,7 +1113,7 @@ mod tests { Some(reference_data.encode()), ); } - overlay.discard_prospective(); + overlay.rollback_transaction().unwrap(); { let ext = Ext::new( &mut overlay, @@ -1145,7 +1156,7 @@ mod tests { ext.clear_storage(key.as_slice()); ext.storage_append(key.clone(), Item::InitializationItem.encode()); } - overlay.commit_prospective(); + overlay.start_transaction(); // For example, first transaction resulted in panic during block building { @@ -1170,7 +1181,7 @@ mod tests { Some(vec![Item::InitializationItem, Item::DiscardedItem].encode()), ); } - overlay.discard_prospective(); + overlay.rollback_transaction().unwrap(); // Then we apply next transaction which is valid this time. { @@ -1196,7 +1207,7 @@ mod tests { ); } - overlay.commit_prospective(); + overlay.start_transaction(); // Then only initlaization item and second (commited) item should persist. { @@ -1317,9 +1328,11 @@ mod tests { let backend = state.as_trie_backend().unwrap(); let mut overlay = OverlayedChanges::default(); + overlay.start_transaction(); overlay.set_storage(b"ccc".to_vec(), Some(b"".to_vec())); assert_eq!(overlay.storage(b"ccc"), Some(Some(&[][..]))); - overlay.commit_prospective(); + overlay.commit_transaction().unwrap(); + overlay.start_transaction(); assert_eq!(overlay.storage(b"ccc"), Some(Some(&[][..]))); assert_eq!(overlay.storage(b"bbb"), None); @@ -1339,7 +1352,7 @@ mod tests { ext.clear_storage(b"ccc"); assert_eq!(ext.storage(b"ccc"), None); } - overlay.commit_prospective(); + overlay.commit_transaction().unwrap(); assert_eq!(overlay.storage(b"ccc"), Some(None)); } } diff --git a/primitives/state-machine/src/overlayed_changes/changeset.rs b/primitives/state-machine/src/overlayed_changes/changeset.rs new file mode 100644 index 0000000000..fe43c0ea99 --- /dev/null +++ b/primitives/state-machine/src/overlayed_changes/changeset.rs @@ -0,0 +1,752 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License + +//! Houses the code that implements the transactional overlay storage. + +use super::{StorageKey, StorageValue}; + +use itertools::Itertools; +use std::collections::{HashSet, BTreeMap, BTreeSet}; +use smallvec::SmallVec; +use log::warn; + +const PROOF_OVERLAY_NON_EMPTY: &str = "\ + An OverlayValue is always created with at least one transaction and dropped as soon + as the last transaction is removed; qed"; + +type DirtyKeysSets = SmallVec<[HashSet; 5]>; +type Transactions = SmallVec<[InnerValue; 5]>; + +/// Error returned when trying to commit or rollback while no transaction is open or +/// when the runtime is trying to close a transaction started by the client. +#[derive(Debug)] +#[cfg_attr(test, derive(PartialEq))] +pub struct NoOpenTransaction; + +/// Error when calling `enter_runtime` when already being in runtime execution mode. +#[derive(Debug)] +#[cfg_attr(test, derive(PartialEq))] +pub struct AlreadyInRuntime; + +/// Error when calling `exit_runtime` when not being in runtime exection mdde. +#[derive(Debug)] +#[cfg_attr(test, derive(PartialEq))] +pub struct NotInRuntime; + +/// Describes in which mode the node is currently executing. +#[derive(Debug, Clone, Copy)] +pub enum ExecutionMode { + /// Exeuting in client mode: Removal of all transactions possible. + Client, + /// Executing in runtime mode: Transactions started by the client are protected. + Runtime, +} + +#[derive(Debug, Default, Clone)] +#[cfg_attr(test, derive(PartialEq))] +struct InnerValue { + /// Current value. None if value has been deleted. + value: Option, + /// The set of extrinsic indices where the values has been changed. + /// Is filled only if runtime has announced changes trie support. + extrinsics: BTreeSet, +} + +/// An overlay that contains all versions of a value for a specific key. +#[derive(Debug, Default, Clone)] +#[cfg_attr(test, derive(PartialEq))] +pub struct OverlayedValue { + /// The individual versions of that value. + /// One entry per transactions during that the value was actually written. + transactions: Transactions, +} + +/// Holds a set of changes with the ability modify them using nested transactions. +#[derive(Debug, Default, Clone)] +pub struct OverlayedChangeSet { + /// Stores the changes that this overlay constitutes. + changes: BTreeMap, + /// Stores which keys are dirty per transaction. Needed in order to determine which + /// values to merge into the parent transaction on commit. The length of this vector + /// therefore determines how many nested transactions are currently open (depth). + dirty_keys: DirtyKeysSets, + /// The number of how many transactions beginning from the first transactions are started + /// by the client. Those transactions are protected against close (commit, rollback) + /// when in runtime mode. + num_client_transactions: usize, + /// Determines whether the node is using the overlay from the client or the runtime. + execution_mode: ExecutionMode, +} + +impl Default for ExecutionMode { + fn default() -> Self { + Self::Client + } +} + +impl OverlayedValue { + /// The value as seen by the current transaction. + pub fn value(&self) -> Option<&StorageValue> { + self.transactions.last().expect(PROOF_OVERLAY_NON_EMPTY).value.as_ref() + } + + /// Unique list of extrinsic indices which modified the value. + pub fn extrinsics(&self) -> impl Iterator { + self.transactions.iter().flat_map(|t| t.extrinsics.iter()).unique() + } + + /// Mutable reference to the most recent version. + fn value_mut(&mut self) -> &mut Option { + &mut self.transactions.last_mut().expect(PROOF_OVERLAY_NON_EMPTY).value + } + + /// Remove the last version and return it. + fn pop_transaction(&mut self) -> InnerValue { + self.transactions.pop().expect(PROOF_OVERLAY_NON_EMPTY) + } + + /// Mutable reference to the set which holds the indices for the **current transaction only**. + fn transaction_extrinsics_mut(&mut self) -> &mut BTreeSet { + &mut self.transactions.last_mut().expect(PROOF_OVERLAY_NON_EMPTY).extrinsics + } + + /// Writes a new version of a value. + /// + /// This makes sure that the old version is not overwritten and can be properly + /// rolled back when required. + fn set( + &mut self, + value: Option, + first_write_in_tx: bool, + at_extrinsic: Option, + ) { + if first_write_in_tx || self.transactions.is_empty() { + self.transactions.push(InnerValue { + value, + .. Default::default() + }); + } else { + *self.value_mut() = value; + } + + if let Some(extrinsic) = at_extrinsic { + self.transaction_extrinsics_mut().insert(extrinsic); + } + } +} + +/// Inserts a key into the dirty set. +/// +/// Returns true iff we are currently have at least one open transaction and if this +/// is the first write to the given key that transaction. +fn insert_dirty(set: &mut DirtyKeysSets, key: StorageKey) -> bool { + set.last_mut().map(|dk| dk.insert(key)).unwrap_or_default() +} + +impl OverlayedChangeSet { + /// Create a new changeset at the same transaction state but without any contents. + /// + /// This changeset might be created when there are already open transactions. + /// We need to catch up here so that the child is at the same transaction depth. + pub fn spawn_child(&self) -> Self { + use std::iter::repeat; + Self { + dirty_keys: repeat(HashSet::new()).take(self.transaction_depth()).collect(), + num_client_transactions: self.num_client_transactions, + execution_mode: self.execution_mode, + .. Default::default() + } + } + + /// True if no changes at all are contained in the change set. + pub fn is_empty(&self) -> bool { + self.changes.is_empty() + } + + /// Get an optional reference to the value stored for the specified key. + pub fn get(&self, key: &[u8]) -> Option<&OverlayedValue> { + self.changes.get(key) + } + + /// Set a new value for the specified key. + /// + /// Can be rolled back or committed when called inside a transaction. + pub fn set( + &mut self, + key: StorageKey, + value: Option, + at_extrinsic: Option, + ) { + let overlayed = self.changes.entry(key.clone()).or_default(); + overlayed.set(value, insert_dirty(&mut self.dirty_keys, key), at_extrinsic); + } + + /// Get a mutable reference for a value. + /// + /// Can be rolled back or committed when called inside a transaction. + #[must_use = "A change was registered, so this value MUST be modified."] + pub fn modify( + &mut self, + key: StorageKey, + init: impl Fn() -> StorageValue, + at_extrinsic: Option, + ) -> &mut Option { + let overlayed = self.changes.entry(key.clone()).or_default(); + let first_write_in_tx = insert_dirty(&mut self.dirty_keys, key); + let clone_into_new_tx = if let Some(tx) = overlayed.transactions.last() { + if first_write_in_tx { + Some(tx.value.clone()) + } else { + None + } + } else { + Some(Some(init())) + }; + + if let Some(cloned) = clone_into_new_tx { + overlayed.set(cloned, first_write_in_tx, at_extrinsic); + } + overlayed.value_mut() + } + + /// Set all values to deleted which are matched by the predicate. + /// + /// Can be rolled back or committed when called inside a transaction. + pub fn clear_where( + &mut self, + predicate: impl Fn(&[u8], &OverlayedValue) -> bool, + at_extrinsic: Option, + ) { + for (key, val) in self.changes.iter_mut().filter(|(k, v)| predicate(k, v)) { + val.set(None, insert_dirty(&mut self.dirty_keys, key.to_owned()), at_extrinsic); + } + } + + /// Get a list of all changes as seen by current transaction. + pub fn changes(&self) -> impl Iterator { + self.changes.iter() + } + + /// Get the change that is next to the supplied key. + pub fn next_change(&self, key: &[u8]) -> Option<(&[u8], &OverlayedValue)> { + use std::ops::Bound; + let range = (Bound::Excluded(key), Bound::Unbounded); + self.changes.range::<[u8], _>(range).next().map(|(k, v)| (&k[..], v)) + } + + /// Consume this changeset and return all committed changes. + /// + /// Panics: + /// Panics if there are open transactions: `transaction_depth() > 0` + pub fn drain_commited(self) -> impl Iterator)> { + assert!(self.transaction_depth() == 0, "Drain is not allowed with open transactions."); + self.changes.into_iter().map(|(k, mut v)| (k, v.pop_transaction().value)) + } + + /// Returns the current nesting depth of the transaction stack. + /// + /// A value of zero means that no transaction is open and changes are committed on write. + pub fn transaction_depth(&self) -> usize { + self.dirty_keys.len() + } + + /// Call this before transfering control to the runtime. + /// + /// This protects all existing transactions from being removed by the runtime. + /// Calling this while already inside the runtime will return an error. + pub fn enter_runtime(&mut self) -> Result<(), AlreadyInRuntime> { + if let ExecutionMode::Runtime = self.execution_mode { + return Err(AlreadyInRuntime); + } + self.execution_mode = ExecutionMode::Runtime; + self.num_client_transactions = self.transaction_depth(); + Ok(()) + } + + /// Call this when control returns from the runtime. + /// + /// This commits all dangling transaction left open by the runtime. + /// Calling this while already outside the runtime will return an error. + pub fn exit_runtime(&mut self) -> Result<(), NotInRuntime> { + if let ExecutionMode::Client = self.execution_mode { + return Err(NotInRuntime); + } + self.execution_mode = ExecutionMode::Client; + if self.has_open_runtime_transactions() { + warn!( + "{} storage transactions are left open by the runtime. Those will be rolled back.", + self.transaction_depth() - self.num_client_transactions, + ); + } + while self.has_open_runtime_transactions() { + self.rollback_transaction() + .expect("The loop condition checks that the transaction depth is > 0; qed"); + } + Ok(()) + } + + /// Start a new nested transaction. + /// + /// This allows to either commit or roll back all changes that were made while this + /// transaction was open. Any transaction must be closed by either `commit_transaction` + /// or `rollback_transaction` before this overlay can be converted into storage changes. + /// + /// Changes made without any open transaction are committed immediately. + pub fn start_transaction(&mut self) { + self.dirty_keys.push(Default::default()); + } + + /// Rollback the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are discarded. Returns an error if + /// there is no open transaction that can be rolled back. + pub fn rollback_transaction(&mut self) -> Result<(), NoOpenTransaction> { + self.close_transaction(true) + } + + /// Commit the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are committed. Returns an error if + /// there is no open transaction that can be committed. + pub fn commit_transaction(&mut self) -> Result<(), NoOpenTransaction> { + self.close_transaction(false) + } + + fn close_transaction(&mut self, rollback: bool) -> Result<(), NoOpenTransaction> { + // runtime is not allowed to close transactions started by the client + if let ExecutionMode::Runtime = self.execution_mode { + if !self.has_open_runtime_transactions() { + return Err(NoOpenTransaction) + } + } + + for key in self.dirty_keys.pop().ok_or(NoOpenTransaction)? { + let overlayed = self.changes.get_mut(&key).expect("\ + A write to an OverlayedValue is recorded in the dirty key set. Before an + OverlayedValue is removed, its containing dirty set is removed. This + function is only called for keys that are in the dirty set. qed\ + "); + + if rollback { + overlayed.pop_transaction(); + + // We need to remove the key as an `OverlayValue` with no transactions + // violates its invariant of always having at least one transaction. + if overlayed.transactions.is_empty() { + self.changes.remove(&key); + } + } else { + let has_predecessor = if let Some(dirty_keys) = self.dirty_keys.last_mut() { + // Not the last tx: Did the previous tx write to this key? + !dirty_keys.insert(key) + } else { + // Last tx: Is there already a value in the committed set? + // Check against one rather than empty because the current tx is still + // in the list as it is popped later in this function. + overlayed.transactions.len() > 1 + }; + + // We only need to merge if there is an pre-existing value. It may be a value from + // the previous transaction or a value committed without any open transaction. + if has_predecessor { + let dropped_tx = overlayed.pop_transaction(); + *overlayed.value_mut() = dropped_tx.value; + overlayed.transaction_extrinsics_mut().extend(dropped_tx.extrinsics); + } + } + } + + Ok(()) + } + + fn has_open_runtime_transactions(&self) -> bool { + self.transaction_depth() > self.num_client_transactions + } +} + +#[cfg(test)] +mod test { + use super::*; + use pretty_assertions::assert_eq; + + type Changes<'a> = Vec<(&'a [u8], (Option<&'a [u8]>, Vec))>; + type Drained<'a> = Vec<(&'a [u8], Option<&'a [u8]>)>; + + fn assert_changes(is: &OverlayedChangeSet, expected: &Changes) { + let is: Changes = is.changes().map(|(k, v)| { + (k.as_ref(), (v.value().map(AsRef::as_ref), v.extrinsics().cloned().collect())) + }).collect(); + assert_eq!(&is, expected); + } + + fn assert_drained_changes(is: OverlayedChangeSet, expected: Changes) { + let is = is.drain_commited().collect::>(); + let expected = expected + .iter() + .map(|(k, v)| (k.to_vec(), v.0.map(From::from))).collect::>(); + assert_eq!(is, expected); + } + + fn assert_drained(is: OverlayedChangeSet, expected: Drained) { + let is = is.drain_commited().collect::>(); + let expected = expected + .iter() + .map(|(k, v)| (k.to_vec(), v.map(From::from))).collect::>(); + assert_eq!(is, expected); + } + + #[test] + fn no_transaction_works() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(1)); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(2)); + changeset.set(b"key0".to_vec(), Some(b"val0-1".to_vec()), Some(9)); + + assert_drained(changeset, vec![ + (b"key0", Some(b"val0-1")), + (b"key1", Some(b"val1")), + ]); + } + + #[test] + fn transaction_works() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + + // no transaction: committed on set + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(1)); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(1)); + changeset.set(b"key0".to_vec(), Some(b"val0-1".to_vec()), Some(10)); + + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 1); + + // we will commit that later + changeset.set(b"key42".to_vec(), Some(b"val42".to_vec()), Some(42)); + changeset.set(b"key99".to_vec(), Some(b"val99".to_vec()), Some(99)); + + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 2); + + // we will roll that back + changeset.set(b"key42".to_vec(), Some(b"val42-rolled".to_vec()), Some(421)); + changeset.set(b"key7".to_vec(), Some(b"val7-rolled".to_vec()), Some(77)); + changeset.set(b"key0".to_vec(), Some(b"val0-rolled".to_vec()), Some(1000)); + changeset.set(b"key5".to_vec(), Some(b"val5-rolled".to_vec()), None); + + // changes contain all changes not only the commmited ones. + let all_changes: Changes = vec![ + (b"key0", (Some(b"val0-rolled"), vec![1, 10, 1000])), + (b"key1", (Some(b"val1"), vec![1])), + (b"key42", (Some(b"val42-rolled"), vec![42, 421])), + (b"key5", (Some(b"val5-rolled"), vec![])), + (b"key7", (Some(b"val7-rolled"), vec![77])), + (b"key99", (Some(b"val99"), vec![99])), + ]; + assert_changes(&changeset, &all_changes); + + // this should be no-op + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 3); + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 4); + changeset.rollback_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 3); + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 2); + assert_changes(&changeset, &all_changes); + + // roll back our first transactions that actually contains something + changeset.rollback_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 1); + + let rolled_back: Changes = vec![ + (b"key0", (Some(b"val0-1"), vec![1, 10])), + (b"key1", (Some(b"val1"), vec![1])), + (b"key42", (Some(b"val42"), vec![42])), + (b"key99", (Some(b"val99"), vec![99])), + ]; + assert_changes(&changeset, &rolled_back); + + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 0); + assert_changes(&changeset, &rolled_back); + + assert_drained_changes(changeset, rolled_back); + } + + #[test] + fn transaction_commit_then_rollback_works() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(1)); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(1)); + changeset.set(b"key0".to_vec(), Some(b"val0-1".to_vec()), Some(10)); + + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 1); + + changeset.set(b"key42".to_vec(), Some(b"val42".to_vec()), Some(42)); + changeset.set(b"key99".to_vec(), Some(b"val99".to_vec()), Some(99)); + + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 2); + + changeset.set(b"key42".to_vec(), Some(b"val42-rolled".to_vec()), Some(421)); + changeset.set(b"key7".to_vec(), Some(b"val7-rolled".to_vec()), Some(77)); + changeset.set(b"key0".to_vec(), Some(b"val0-rolled".to_vec()), Some(1000)); + changeset.set(b"key5".to_vec(), Some(b"val5-rolled".to_vec()), None); + + let all_changes: Changes = vec![ + (b"key0", (Some(b"val0-rolled"), vec![1, 10, 1000])), + (b"key1", (Some(b"val1"), vec![1])), + (b"key42", (Some(b"val42-rolled"), vec![42, 421])), + (b"key5", (Some(b"val5-rolled"), vec![])), + (b"key7", (Some(b"val7-rolled"), vec![77])), + (b"key99", (Some(b"val99"), vec![99])), + ]; + assert_changes(&changeset, &all_changes); + + // this should be no-op + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 3); + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 4); + changeset.rollback_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 3); + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 2); + assert_changes(&changeset, &all_changes); + + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 1); + + assert_changes(&changeset, &all_changes); + + changeset.rollback_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 0); + + let rolled_back: Changes = vec![ + (b"key0", (Some(b"val0-1"), vec![1, 10])), + (b"key1", (Some(b"val1"), vec![1])), + ]; + assert_changes(&changeset, &rolled_back); + + assert_drained_changes(changeset, rolled_back); + } + + #[test] + fn modify_works() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + let init = || b"valinit".to_vec(); + + // committed set + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(0)); + changeset.set(b"key1".to_vec(), None, Some(1)); + let val = changeset.modify(b"key3".to_vec(), init, Some(3)); + assert_eq!(val, &Some(b"valinit".to_vec())); + val.as_mut().unwrap().extend_from_slice(b"-modified"); + + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 1); + changeset.start_transaction(); + assert_eq!(changeset.transaction_depth(), 2); + + // non existing value -> init value should be returned + let val = changeset.modify(b"key2".to_vec(), init, Some(2)); + assert_eq!(val, &Some(b"valinit".to_vec())); + val.as_mut().unwrap().extend_from_slice(b"-modified"); + + // existing value should be returned by modify + let val = changeset.modify(b"key0".to_vec(), init, Some(10)); + assert_eq!(val, &Some(b"val0".to_vec())); + val.as_mut().unwrap().extend_from_slice(b"-modified"); + + // should work for deleted keys + let val = changeset.modify(b"key1".to_vec(), init, Some(20)); + assert_eq!(val, &None); + *val = Some(b"deleted-modified".to_vec()); + + let all_changes: Changes = vec![ + (b"key0", (Some(b"val0-modified"), vec![0, 10])), + (b"key1", (Some(b"deleted-modified"), vec![1, 20])), + (b"key2", (Some(b"valinit-modified"), vec![2])), + (b"key3", (Some(b"valinit-modified"), vec![3])), + ]; + assert_changes(&changeset, &all_changes); + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 1); + assert_changes(&changeset, &all_changes); + + changeset.rollback_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 0); + let rolled_back: Changes = vec![ + (b"key0", (Some(b"val0"), vec![0])), + (b"key1", (None, vec![1])), + (b"key3", (Some(b"valinit-modified"), vec![3])), + ]; + assert_changes(&changeset, &rolled_back); + assert_drained_changes(changeset, rolled_back); + } + + #[test] + fn clear_works() { + let mut changeset = OverlayedChangeSet::default(); + + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(1)); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(2)); + changeset.set(b"del1".to_vec(), Some(b"delval1".to_vec()), Some(3)); + changeset.set(b"del2".to_vec(), Some(b"delval2".to_vec()), Some(4)); + + changeset.start_transaction(); + + changeset.clear_where(|k, _| k.starts_with(b"del"), Some(5)); + + assert_changes(&changeset, &vec![ + (b"del1", (None, vec![3, 5])), + (b"del2", (None, vec![4, 5])), + (b"key0", (Some(b"val0"), vec![1])), + (b"key1", (Some(b"val1"), vec![2])), + ]); + + changeset.rollback_transaction().unwrap(); + + assert_changes(&changeset, &vec![ + (b"del1", (Some(b"delval1"), vec![3])), + (b"del2", (Some(b"delval2"), vec![4])), + (b"key0", (Some(b"val0"), vec![1])), + (b"key1", (Some(b"val1"), vec![2])), + ]); + } + + #[test] + fn next_change_works() { + let mut changeset = OverlayedChangeSet::default(); + + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(0)); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(1)); + changeset.set(b"key2".to_vec(), Some(b"val2".to_vec()), Some(2)); + + changeset.start_transaction(); + + changeset.set(b"key3".to_vec(), Some(b"val3".to_vec()), Some(3)); + changeset.set(b"key4".to_vec(), Some(b"val4".to_vec()), Some(4)); + changeset.set(b"key11".to_vec(), Some(b"val11".to_vec()), Some(11)); + + assert_eq!(changeset.next_change(b"key0").unwrap().0, b"key1"); + assert_eq!(changeset.next_change(b"key0").unwrap().1.value(), Some(&b"val1".to_vec())); + assert_eq!(changeset.next_change(b"key1").unwrap().0, b"key11"); + assert_eq!(changeset.next_change(b"key1").unwrap().1.value(), Some(&b"val11".to_vec())); + assert_eq!(changeset.next_change(b"key11").unwrap().0, b"key2"); + assert_eq!(changeset.next_change(b"key11").unwrap().1.value(), Some(&b"val2".to_vec())); + assert_eq!(changeset.next_change(b"key2").unwrap().0, b"key3"); + assert_eq!(changeset.next_change(b"key2").unwrap().1.value(), Some(&b"val3".to_vec())); + assert_eq!(changeset.next_change(b"key3").unwrap().0, b"key4"); + assert_eq!(changeset.next_change(b"key3").unwrap().1.value(), Some(&b"val4".to_vec())); + assert_eq!(changeset.next_change(b"key4"), None); + + changeset.rollback_transaction().unwrap(); + + assert_eq!(changeset.next_change(b"key0").unwrap().0, b"key1"); + assert_eq!(changeset.next_change(b"key0").unwrap().1.value(), Some(&b"val1".to_vec())); + assert_eq!(changeset.next_change(b"key1").unwrap().0, b"key2"); + assert_eq!(changeset.next_change(b"key1").unwrap().1.value(), Some(&b"val2".to_vec())); + assert_eq!(changeset.next_change(b"key11").unwrap().0, b"key2"); + assert_eq!(changeset.next_change(b"key11").unwrap().1.value(), Some(&b"val2".to_vec())); + assert_eq!(changeset.next_change(b"key2"), None); + assert_eq!(changeset.next_change(b"key3"), None); + assert_eq!(changeset.next_change(b"key4"), None); + + } + + #[test] + fn no_open_tx_commit_errors() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + assert_eq!(changeset.commit_transaction(), Err(NoOpenTransaction)); + } + + #[test] + fn no_open_tx_rollback_errors() { + let mut changeset = OverlayedChangeSet::default(); + assert_eq!(changeset.transaction_depth(), 0); + assert_eq!(changeset.rollback_transaction(), Err(NoOpenTransaction)); + } + + #[test] + fn unbalanced_transactions_errors() { + let mut changeset = OverlayedChangeSet::default(); + changeset.start_transaction(); + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.commit_transaction(), Err(NoOpenTransaction)); + } + + #[test] + #[should_panic] + fn drain_with_open_transaction_panics() { + let mut changeset = OverlayedChangeSet::default(); + changeset.start_transaction(); + let _ = changeset.drain_commited(); + } + + #[test] + fn runtime_cannot_close_client_tx() { + let mut changeset = OverlayedChangeSet::default(); + changeset.start_transaction(); + changeset.enter_runtime().unwrap(); + changeset.start_transaction(); + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.commit_transaction(), Err(NoOpenTransaction)); + assert_eq!(changeset.rollback_transaction(), Err(NoOpenTransaction)); + } + + #[test] + fn exit_runtime_closes_runtime_tx() { + let mut changeset = OverlayedChangeSet::default(); + + changeset.start_transaction(); + + changeset.set(b"key0".to_vec(), Some(b"val0".to_vec()), Some(1)); + + changeset.enter_runtime().unwrap(); + changeset.start_transaction(); + changeset.set(b"key1".to_vec(), Some(b"val1".to_vec()), Some(2)); + changeset.exit_runtime().unwrap(); + + changeset.commit_transaction().unwrap(); + assert_eq!(changeset.transaction_depth(), 0); + + assert_drained(changeset, vec![ + (b"key0", Some(b"val0")), + ]); + } + + #[test] + fn enter_exit_runtime_fails_when_already_in_requested_mode() { + let mut changeset = OverlayedChangeSet::default(); + + assert_eq!(changeset.exit_runtime(), Err(NotInRuntime)); + assert_eq!(changeset.enter_runtime(), Ok(())); + assert_eq!(changeset.enter_runtime(), Err(AlreadyInRuntime)); + assert_eq!(changeset.exit_runtime(), Ok(())); + assert_eq!(changeset.exit_runtime(), Err(NotInRuntime)); + } +} diff --git a/primitives/state-machine/src/overlayed_changes.rs b/primitives/state-machine/src/overlayed_changes/mod.rs similarity index 50% rename from primitives/state-machine/src/overlayed_changes.rs rename to primitives/state-machine/src/overlayed_changes/mod.rs index b0259c2b85..9a2b1c4197 100644 --- a/primitives/state-machine/src/overlayed_changes.rs +++ b/primitives/state-machine/src/overlayed_changes/mod.rs @@ -17,6 +17,8 @@ //! The overlayed changes to state. +mod changeset; + use crate::{ backend::Backend, ChangesTrieTransaction, changes_trie::{ @@ -25,14 +27,16 @@ use crate::{ }, stats::StateMachineStats, }; +use self::changeset::OverlayedChangeSet; -use std::{mem, ops, collections::{HashMap, BTreeMap, BTreeSet}}; +use std::collections::HashMap; use codec::{Decode, Encode}; -use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo, ChildType}; +use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo}; use sp_core::offchain::storage::OffchainOverlayedChanges; - use hash_db::Hasher; +pub use self::changeset::{OverlayedValue, NoOpenTransaction, AlreadyInRuntime, NotInRuntime}; + /// Storage key. pub type StorageKey = Vec; @@ -45,43 +49,21 @@ pub type StorageCollection = Vec<(StorageKey, Option)>; /// In memory arrays of storage values for multiple child tries. pub type ChildStorageCollection = Vec<(StorageKey, StorageCollection)>; -/// The overlayed changes to state to be queried on top of the backend. +/// The set of changes that are overlaid onto the backend. /// -/// A transaction shares all prospective changes within an inner overlay -/// that can be cleared. +/// It allows changes to be modified using nestable transactions. #[derive(Debug, Default, Clone)] pub struct OverlayedChanges { - /// Changes that are not yet committed. - prospective: OverlayedChangeSet, - /// Committed changes. - committed: OverlayedChangeSet, + /// Top level storage changes. + top: OverlayedChangeSet, + /// Child storage changes. The map key is the child storage key without the common prefix. + children: HashMap, /// True if extrinsics stats must be collected. collect_extrinsics: bool, /// Collect statistic on this execution. stats: StateMachineStats, } -/// The storage value, used inside OverlayedChanges. -#[derive(Debug, Default, Clone)] -#[cfg_attr(test, derive(PartialEq))] -pub struct OverlayedValue { - /// Current value. None if value has been deleted. - value: Option, - /// The set of extrinsic indices where the values has been changed. - /// Is filled only if runtime has announced changes trie support. - extrinsics: Option>, -} - -/// Prospective or committed overlayed change set. -#[derive(Debug, Default, Clone)] -#[cfg_attr(test, derive(PartialEq))] -pub struct OverlayedChangeSet { - /// Top level storage changes. - top: BTreeMap, - /// Child storage changes. The map key is the child storage key without the common prefix. - children_default: HashMap, ChildInfo)>, -} - /// A storage changes structure that can be generated by the data collected in [`OverlayedChanges`]. /// /// This contains all the changes to the storage and transactions to apply theses changes to the @@ -174,45 +156,10 @@ impl Default for StorageChanges } } -#[cfg(test)] -impl std::iter::FromIterator<(StorageKey, OverlayedValue)> for OverlayedChangeSet { - fn from_iter>(iter: T) -> Self { - Self { - top: iter.into_iter().collect(), - children_default: Default::default(), - } - } -} - -impl OverlayedValue { - /// The most recent value contained in this overlay. - pub fn value(&self) -> Option<&StorageValue> { - self.value.as_ref() - } - - /// List of indices of extrinsics which modified the value using this overlay. - pub fn extrinsics(&self) -> Option> { - self.extrinsics.as_ref().map(|v| v.iter()) - } -} - -impl OverlayedChangeSet { - /// Whether the change set is empty. - pub fn is_empty(&self) -> bool { - self.top.is_empty() && self.children_default.is_empty() - } - - /// Clear the change set. - pub fn clear(&mut self) { - self.top.clear(); - self.children_default.clear(); - } -} - impl OverlayedChanges { - /// Whether the overlayed changes are empty. + /// Whether no changes are contained in the top nor in any of the child changes. pub fn is_empty(&self) -> bool { - self.prospective.is_empty() && self.committed.is_empty() + self.top.is_empty() && self.children.is_empty() } /// Ask to collect/not to collect extrinsics indices where key(s) has been changed. @@ -224,326 +171,241 @@ impl OverlayedChanges { /// to the backend); Some(None) if the key has been deleted. Some(Some(...)) for a key whose /// value has been set. pub fn storage(&self, key: &[u8]) -> Option> { - self.prospective.top.get(key) - .or_else(|| self.committed.top.get(key)) - .map(|x| { - let size_read = x.value.as_ref().map(|x| x.len() as u64).unwrap_or(0); - self.stats.tally_read_modified(size_read); - x.value.as_ref().map(AsRef::as_ref) - }) - } - - /// Returns mutable reference to current changed value (prospective). - /// If there is no value in the overlay, the default callback is used to initiate - /// the value. - /// Warning this function register a change, so the mutable reference MUST be modified. + self.top.get(key).map(|x| { + let value = x.value(); + let size_read = value.map(|x| x.len() as u64).unwrap_or(0); + self.stats.tally_read_modified(size_read); + value.map(AsRef::as_ref) + }) + } + + /// Returns mutable reference to current value. + /// If there is no value in the overlay, the given callback is used to initiate the value. + /// Warning this function registers a change, so the mutable reference MUST be modified. + /// + /// Can be rolled back or committed when called inside a transaction. #[must_use = "A change was registered, so this value MUST be modified."] pub fn value_mut_or_insert_with( &mut self, key: &[u8], init: impl Fn() -> StorageValue, ) -> &mut StorageValue { - let extrinsic_index = self.extrinsic_index(); - let committed = &self.committed.top; - - let mut entry = self.prospective.top.entry(key.to_vec()) - .or_insert_with(|| { - if let Some(overlay_state) = committed.get(key).cloned() { - overlay_state - } else { - OverlayedValue { value: Some(init()), ..Default::default() } - } - }); - - //if was deleted initialise back with empty vec - if entry.value.is_none() { - entry.value = Some(Default::default()); - } - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - entry.value.as_mut().expect("Initialized above; qed") + let value = self.top.modify(key.to_owned(), init, self.extrinsic_index()); + + // if the value was deleted initialise it back with an empty vec + value.get_or_insert_with(StorageValue::default) } /// Returns a double-Option: None if the key is unknown (i.e. and the query should be referred /// to the backend); Some(None) if the key has been deleted. Some(Some(...)) for a key whose /// value has been set. pub fn child_storage(&self, child_info: &ChildInfo, key: &[u8]) -> Option> { - if let Some(map) = self.prospective.children_default.get(child_info.storage_key()) { - if let Some(val) = map.0.get(key) { - let size_read = val.value.as_ref().map(|x| x.len() as u64).unwrap_or(0); - self.stats.tally_read_modified(size_read); - return Some(val.value.as_ref().map(AsRef::as_ref)); - } - } - - if let Some(map) = self.committed.children_default.get(child_info.storage_key()) { - if let Some(val) = map.0.get(key) { - let size_read = val.value.as_ref().map(|x| x.len() as u64).unwrap_or(0); - self.stats.tally_read_modified(size_read); - return Some(val.value.as_ref().map(AsRef::as_ref)); - } - } - - None + let map = self.children.get(child_info.storage_key())?; + let value = map.0.get(key)?.value(); + let size_read = value.map(|x| x.len() as u64).unwrap_or(0); + self.stats.tally_read_modified(size_read); + Some(value.map(AsRef::as_ref)) } - /// Inserts the given key-value pair into the prospective change set. + /// Set a new value for the specified key. /// - /// `None` can be used to delete a value specified by the given key. + /// Can be rolled back or committed when called inside a transaction. pub(crate) fn set_storage(&mut self, key: StorageKey, val: Option) { let size_write = val.as_ref().map(|x| x.len() as u64).unwrap_or(0); self.stats.tally_write_overlay(size_write); - let extrinsic_index = self.extrinsic_index(); - let entry = self.prospective.top.entry(key).or_default(); - entry.value = val; - - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } + self.top.set(key, val, self.extrinsic_index()); } - /// Inserts the given key-value pair into the prospective child change set. + /// Set a new value for the specified key and child. /// /// `None` can be used to delete a value specified by the given key. + /// + /// Can be rolled back or committed when called inside a transaction. pub(crate) fn set_child_storage( &mut self, child_info: &ChildInfo, key: StorageKey, val: Option, ) { + let extrinsic_index = self.extrinsic_index(); let size_write = val.as_ref().map(|x| x.len() as u64).unwrap_or(0); self.stats.tally_write_overlay(size_write); - let extrinsic_index = self.extrinsic_index(); let storage_key = child_info.storage_key().to_vec(); - let map_entry = self.prospective.children_default.entry(storage_key) - .or_insert_with(|| (Default::default(), child_info.to_owned())); - let updatable = map_entry.1.try_update(child_info); + let top = &self.top; + let (changeset, info) = self.children.entry(storage_key).or_insert_with(|| + ( + top.spawn_child(), + child_info.to_owned() + ) + ); + let updatable = info.try_update(child_info); debug_assert!(updatable); - - let entry = map_entry.0.entry(key).or_default(); - entry.value = val; - - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } + changeset.set(key, val, extrinsic_index); } /// Clear child storage of given storage key. /// - /// NOTE that this doesn't take place immediately but written into the prospective - /// change set, and still can be reverted by [`discard_prospective`]. - /// - /// [`discard_prospective`]: #method.discard_prospective + /// Can be rolled back or committed when called inside a transaction. pub(crate) fn clear_child_storage( &mut self, child_info: &ChildInfo, ) { let extrinsic_index = self.extrinsic_index(); - let storage_key = child_info.storage_key(); - let map_entry = self.prospective.children_default.entry(storage_key.to_vec()) - .or_insert_with(|| (Default::default(), child_info.to_owned())); - let updatable = map_entry.1.try_update(child_info); + let storage_key = child_info.storage_key().to_vec(); + let top = &self.top; + let (changeset, info) = self.children.entry(storage_key).or_insert_with(|| + ( + top.spawn_child(), + child_info.to_owned() + ) + ); + let updatable = info.try_update(child_info); debug_assert!(updatable); - - map_entry.0.values_mut().for_each(|e| { - if let Some(extrinsic) = extrinsic_index { - e.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - - e.value = None; - }); - - if let Some((committed_map, _child_info)) = self.committed.children_default.get(storage_key) { - for (key, value) in committed_map.iter() { - if !map_entry.0.contains_key(key) { - map_entry.0.insert(key.clone(), OverlayedValue { - value: None, - extrinsics: extrinsic_index.map(|i| { - let mut e = value.extrinsics.clone() - .unwrap_or_else(|| BTreeSet::default()); - e.insert(i); - e - }), - }); - } - } - } + changeset.clear_where(|_, _| true, extrinsic_index); } /// Removes all key-value pairs which keys share the given prefix. /// - /// NOTE that this doesn't take place immediately but written into the prospective - /// change set, and still can be reverted by [`discard_prospective`]. - /// - /// [`discard_prospective`]: #method.discard_prospective + /// Can be rolled back or committed when called inside a transaction. pub(crate) fn clear_prefix(&mut self, prefix: &[u8]) { - let extrinsic_index = self.extrinsic_index(); - - // Iterate over all prospective and mark all keys that share - // the given prefix as removed (None). - for (key, entry) in self.prospective.top.iter_mut() { - if key.starts_with(prefix) { - entry.value = None; - - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - } - } - - // Then do the same with keys from committed changes. - // NOTE that we are making changes in the prospective change set. - for key in self.committed.top.keys() { - if key.starts_with(prefix) { - let entry = self.prospective.top.entry(key.clone()).or_default(); - entry.value = None; - - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - } - } + self.top.clear_where(|key, _| key.starts_with(prefix), self.extrinsic_index()); } + /// Removes all key-value pairs which keys share the given prefix. + /// + /// Can be rolled back or committed when called inside a transaction pub(crate) fn clear_child_prefix( &mut self, child_info: &ChildInfo, prefix: &[u8], ) { let extrinsic_index = self.extrinsic_index(); - let storage_key = child_info.storage_key(); - let map_entry = self.prospective.children_default.entry(storage_key.to_vec()) - .or_insert_with(|| (Default::default(), child_info.to_owned())); - let updatable = map_entry.1.try_update(child_info); + let storage_key = child_info.storage_key().to_vec(); + let top = &self.top; + let (changeset, info) = self.children.entry(storage_key).or_insert_with(|| + ( + top.spawn_child(), + child_info.to_owned() + ) + ); + let updatable = info.try_update(child_info); debug_assert!(updatable); + changeset.clear_where(|key, _| key.starts_with(prefix), extrinsic_index); + } + + /// Returns the current nesting depth of the transaction stack. + /// + /// A value of zero means that no transaction is open and changes are committed on write. + pub fn transaction_depth(&self) -> usize { + // The top changeset and all child changesets transact in lockstep and are + // therefore always at the same transaction depth. + self.top.transaction_depth() + } + + /// Start a new nested transaction. + /// + /// This allows to either commit or roll back all changes that where made while this + /// transaction was open. Any transaction must be closed by either `rollback_transaction` or + /// `commit_transaction` before this overlay can be converted into storage changes. + /// + /// Changes made without any open transaction are committed immediatly. + pub fn start_transaction(&mut self) { + self.top.start_transaction(); + for (_, (changeset, _)) in self.children.iter_mut() { + changeset.start_transaction(); + } + } - for (key, entry) in map_entry.0.iter_mut() { - if key.starts_with(prefix) { - entry.value = None; + /// Rollback the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are discarded. Returns an error if + /// there is no open transaction that can be rolled back. + pub fn rollback_transaction(&mut self) -> Result<(), NoOpenTransaction> { + self.top.rollback_transaction()?; + self.children.retain(|_, (changeset, _)| { + changeset.rollback_transaction() + .expect("Top and children changesets are started in lockstep; qed"); + !changeset.is_empty() + }); + Ok(()) + } - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - } + /// Commit the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are committed. Returns an error if there + /// is no open transaction that can be committed. + pub fn commit_transaction(&mut self) -> Result<(), NoOpenTransaction> { + self.top.commit_transaction()?; + for (_, (changeset, _)) in self.children.iter_mut() { + changeset.commit_transaction() + .expect("Top and children changesets are started in lockstep; qed"); } + Ok(()) + } - if let Some((child_committed, _child_info)) = self.committed.children_default.get(storage_key) { - // Then do the same with keys from committed changes. - // NOTE that we are making changes in the prospective change set. - for key in child_committed.keys() { - if key.starts_with(prefix) { - let entry = map_entry.0.entry(key.clone()).or_default(); - entry.value = None; - - if let Some(extrinsic) = extrinsic_index { - entry.extrinsics.get_or_insert_with(Default::default) - .insert(extrinsic); - } - } - } + /// Call this before transfering control to the runtime. + /// + /// This protects all existing transactions from being removed by the runtime. + /// Calling this while already inside the runtime will return an error. + pub fn enter_runtime(&mut self) -> Result<(), AlreadyInRuntime> { + self.top.enter_runtime()?; + for (_, (changeset, _)) in self.children.iter_mut() { + changeset.enter_runtime() + .expect("Top and children changesets are entering runtime in lockstep; qed") } + Ok(()) } - /// Discard prospective changes to state. - pub fn discard_prospective(&mut self) { - self.prospective.clear(); - } - - /// Commit prospective changes to state. - pub fn commit_prospective(&mut self) { - if self.committed.is_empty() { - mem::swap(&mut self.prospective, &mut self.committed); - } else { - let top_to_commit = mem::replace(&mut self.prospective.top, BTreeMap::new()); - for (key, val) in top_to_commit.into_iter() { - let entry = self.committed.top.entry(key).or_default(); - entry.value = val.value; - - if let Some(prospective_extrinsics) = val.extrinsics { - entry.extrinsics.get_or_insert_with(Default::default) - .extend(prospective_extrinsics); - } - } - for (storage_key, (map, child_info)) in self.prospective.children_default.drain() { - let child_content = self.committed.children_default.entry(storage_key) - .or_insert_with(|| (Default::default(), child_info)); - // No update to child info at this point (will be needed for deletion). - for (key, val) in map.into_iter() { - let entry = child_content.0.entry(key).or_default(); - entry.value = val.value; - - if let Some(prospective_extrinsics) = val.extrinsics { - entry.extrinsics.get_or_insert_with(Default::default) - .extend(prospective_extrinsics); - } - } - } + /// Call this when control returns from the runtime. + /// + /// This commits all dangling transaction left open by the runtime. + /// Calling this while outside the runtime will return an error. + pub fn exit_runtime(&mut self) -> Result<(), NotInRuntime> { + self.top.exit_runtime()?; + for (_, (changeset, _)) in self.children.iter_mut() { + changeset.exit_runtime() + .expect("Top and children changesets are entering runtime in lockstep; qed"); } + Ok(()) } - /// Consume `OverlayedChanges` and take committed set. + /// Consume all changes (top + children) and return them. + /// + /// After calling this function no more changes are contained in this changeset. /// /// Panics: - /// Will panic if there are any uncommitted prospective changes. + /// Panics if `transaction_depth() > 0` fn drain_committed(&mut self) -> ( impl Iterator)>, impl Iterator)>, ChildInfo))>, ) { - assert!(self.prospective.is_empty()); + use std::mem::take; ( - std::mem::take(&mut self.committed.top) - .into_iter() - .map(|(k, v)| (k, v.value)), - std::mem::take(&mut self.committed.children_default) - .into_iter() - .map(|(sk, (v, ci))| (sk, (v.into_iter().map(|(k, v)| (k, v.value)), ci))), + take(&mut self.top).drain_commited(), + take(&mut self.children).into_iter() + .map(|(key, (val, info))| ( + key, + (val.drain_commited(), info) + ) + ), ) } - /// Get an iterator over all pending and committed child tries in the overlay. - pub fn child_infos(&self) -> impl IntoIterator { - self.committed.children_default.iter() - .chain(self.prospective.children_default.iter()) - .map(|(_, v)| &v.1).collect::>() - } - - /// Get an iterator over all pending and committed changes. - /// - /// Supplying `None` for `child_info` will only return changes that are in the top - /// trie. Specifying some `child_info` will return only the changes in that - /// child trie. - pub fn changes(&self, child_info: Option<&ChildInfo>) - -> impl Iterator - { - let (committed, prospective) = if let Some(child_info) = child_info { - match child_info.child_type() { - ChildType::ParentKeyId => ( - self.committed.children_default.get(child_info.storage_key()).map(|c| &c.0), - self.prospective.children_default.get(child_info.storage_key()).map(|c| &c.0), - ), - } - } else { - (Some(&self.committed.top), Some(&self.prospective.top)) - }; - committed.into_iter().flatten().chain(prospective.into_iter().flatten()) + /// Get an iterator over all child changes as seen by the current transaction. + pub fn children(&self) + -> impl Iterator, &ChildInfo)> { + self.children.iter().map(|(_, v)| (v.0.changes(), &v.1)) } - /// Return a clone of the currently pending changes. - pub fn clone_pending(&self) -> OverlayedChangeSet { - self.prospective.clone() + /// Get an iterator over all top changes as been by the current transaction. + pub fn changes(&self) -> impl Iterator { + self.top.changes() } - /// Replace the currently pending changes. - pub fn replace_pending(&mut self, pending: OverlayedChangeSet) { - self.prospective = pending; + /// Get an optional iterator over all child changes stored under the supplied key. + pub fn child_changes(&self, key: &[u8]) + -> Option<(impl Iterator, &ChildInfo)> { + self.children.get(key).map(|(overlay, info)| (overlay.changes(), info)) } /// Convert this instance with all changes into a [`StorageChanges`] instance. @@ -607,10 +469,7 @@ impl OverlayedChanges { /// Inserts storage entry responsible for current extrinsic index. #[cfg(test)] pub(crate) fn set_extrinsic_index(&mut self, extrinsic_index: u32) { - self.prospective.top.insert(EXTRINSIC_INDEX.to_vec(), OverlayedValue { - value: Some(extrinsic_index.encode()), - extrinsics: None, - }); + self.top.set(EXTRINSIC_INDEX.to_vec(), Some(extrinsic_index.encode()), None); } /// Returns current extrinsic index to use in changes trie construction. @@ -629,7 +488,8 @@ impl OverlayedChanges { } } - /// Generate the storage root using `backend` and all changes from `prospective` and `committed`. + /// Generate the storage root using `backend` and all changes + /// as seen by the current transaction. /// /// Returns the storage root and caches storage transaction in the given `cache`. pub fn storage_root>( @@ -639,35 +499,13 @@ impl OverlayedChanges { ) -> H::Out where H::Out: Ord + Encode, { - let child_storage_keys = self.prospective.children_default.keys() - .chain(self.committed.children_default.keys()); - let child_delta_iter = child_storage_keys.map(|storage_key| - ( - self.default_child_info(storage_key) - .expect("child info initialized in either committed or prospective"), - self.committed.children_default.get(storage_key) - .into_iter() - .flat_map(|(map, _)| - map.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) - ) - .chain( - self.prospective.children_default.get(storage_key) - .into_iter() - .flat_map(|(map, _)| - map.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) - ) - ), - ) - ); + let delta = self.changes().map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))); + let child_delta = self.children() + .map(|(changes, info)| (info, changes.map( + |(k, v)| (&k[..], v.value().map(|v| &v[..])) + ))); - // compute and memoize - let delta = self.committed - .top - .iter() - .map(|(k, v)| (&k[..], v.value().map(|v| &v[..]))) - .chain(self.prospective.top.iter().map(|(k, v)| (&k[..], v.value().map(|v| &v[..])))); - - let (root, transaction) = backend.full_storage_root(delta, child_delta_iter); + let (root, transaction) = backend.full_storage_root(delta, child_delta); cache.transaction = Some(transaction); cache.transaction_storage_root = Some(root); @@ -704,41 +542,10 @@ impl OverlayedChanges { }) } - /// Get child info for a storage key. - /// Take the latest value so prospective first. - pub fn default_child_info(&self, storage_key: &[u8]) -> Option<&ChildInfo> { - if let Some((_, ci)) = self.prospective.children_default.get(storage_key) { - return Some(&ci); - } - if let Some((_, ci)) = self.committed.children_default.get(storage_key) { - return Some(&ci); - } - None - } - /// Returns the next (in lexicographic order) storage key in the overlayed alongside its value. /// If no value is next then `None` is returned. pub fn next_storage_key_change(&self, key: &[u8]) -> Option<(&[u8], &OverlayedValue)> { - let range = (ops::Bound::Excluded(key), ops::Bound::Unbounded); - - let next_prospective_key = self.prospective.top - .range::<[u8], _>(range) - .next() - .map(|(k, v)| (&k[..], v)); - - let next_committed_key = self.committed.top - .range::<[u8], _>(range) - .next() - .map(|(k, v)| (&k[..], v)); - - match (next_committed_key, next_prospective_key) { - // Committed is strictly less than prospective - (Some(committed_key), Some(prospective_key)) if committed_key.0 < prospective_key.0 => - Some(committed_key), - (committed_key, None) => committed_key, - // Prospective key is less or equal to committed or committed doesn't exist - (_, prospective_key) => prospective_key, - } + self.top.next_change(key) } /// Returns the next (in lexicographic order) child storage key in the overlayed alongside its @@ -748,48 +555,32 @@ impl OverlayedChanges { storage_key: &[u8], key: &[u8] ) -> Option<(&[u8], &OverlayedValue)> { - let range = (ops::Bound::Excluded(key), ops::Bound::Unbounded); - - let next_prospective_key = self.prospective.children_default.get(storage_key) - .and_then(|(map, _)| map.range::<[u8], _>(range).next().map(|(k, v)| (&k[..], v))); - - let next_committed_key = self.committed.children_default.get(storage_key) - .and_then(|(map, _)| map.range::<[u8], _>(range).next().map(|(k, v)| (&k[..], v))); - - match (next_committed_key, next_prospective_key) { - // Committed is strictly less than prospective - (Some(committed_key), Some(prospective_key)) if committed_key.0 < prospective_key.0 => - Some(committed_key), - (committed_key, None) => committed_key, - // Prospective key is less or equal to committed or committed doesn't exist - (_, prospective_key) => prospective_key, - } - } -} - -#[cfg(test)] -impl From> for OverlayedValue { - fn from(value: Option) -> OverlayedValue { - OverlayedValue { value, ..Default::default() } + self.children + .get(storage_key) + .and_then(|(overlay, _)| + overlay.next_change(key) + ) } } #[cfg(test)] mod tests { use hex_literal::hex; - use sp_core::{ - Blake2Hasher, traits::Externalities, storage::well_known_keys::EXTRINSIC_INDEX, - }; + use sp_core::{Blake2Hasher, traits::Externalities}; use crate::InMemoryBackend; use crate::ext::Ext; use super::*; + use std::collections::BTreeMap; - fn strip_extrinsic_index(map: &BTreeMap) - -> BTreeMap - { - let mut clone = map.clone(); - clone.remove(&EXTRINSIC_INDEX.to_vec()); - clone + fn assert_extrinsics( + overlay: &OverlayedChangeSet, + key: impl AsRef<[u8]>, + expected: Vec, + ) { + assert_eq!( + overlay.get(key.as_ref()).unwrap().extrinsics().cloned().collect::>(), + expected + ) } #[test] @@ -800,23 +591,28 @@ mod tests { assert!(overlayed.storage(&key).is_none()); + overlayed.start_transaction(); + overlayed.set_storage(key.clone(), Some(vec![1, 2, 3])); assert_eq!(overlayed.storage(&key).unwrap(), Some(&[1, 2, 3][..])); - overlayed.commit_prospective(); + overlayed.commit_transaction().unwrap(); + assert_eq!(overlayed.storage(&key).unwrap(), Some(&[1, 2, 3][..])); + overlayed.start_transaction(); + overlayed.set_storage(key.clone(), Some(vec![])); assert_eq!(overlayed.storage(&key).unwrap(), Some(&[][..])); overlayed.set_storage(key.clone(), None); assert!(overlayed.storage(&key).unwrap().is_none()); - overlayed.discard_prospective(); + overlayed.rollback_transaction().unwrap(); + assert_eq!(overlayed.storage(&key).unwrap(), Some(&[1, 2, 3][..])); overlayed.set_storage(key.clone(), None); - overlayed.commit_prospective(); assert!(overlayed.storage(&key).unwrap().is_none()); } @@ -829,18 +625,18 @@ mod tests { (b"doug".to_vec(), b"notadog".to_vec()), ].into_iter().collect(); let backend = InMemoryBackend::::from(initial); - let mut overlay = OverlayedChanges { - committed: vec![ - (b"dog".to_vec(), Some(b"puppy".to_vec()).into()), - (b"dogglesworth".to_vec(), Some(b"catYYY".to_vec()).into()), - (b"doug".to_vec(), Some(vec![]).into()), - ].into_iter().collect(), - prospective: vec![ - (b"dogglesworth".to_vec(), Some(b"cat".to_vec()).into()), - (b"doug".to_vec(), None.into()), - ].into_iter().collect(), - ..Default::default() - }; + let mut overlay = OverlayedChanges::default(); + overlay.set_collect_extrinsics(false); + + overlay.start_transaction(); + overlay.set_storage(b"dog".to_vec(), Some(b"puppy".to_vec())); + overlay.set_storage(b"dogglesworth".to_vec(), Some(b"catYYY".to_vec())); + overlay.set_storage(b"doug".to_vec(), Some(vec![])); + overlay.commit_transaction().unwrap(); + + overlay.start_transaction(); + overlay.set_storage(b"dogglesworth".to_vec(), Some(b"cat".to_vec())); + overlay.set_storage(b"doug".to_vec(), None); let mut offchain_overlay = Default::default(); let mut cache = StorageTransactionCache::default(); @@ -862,6 +658,8 @@ mod tests { let mut overlay = OverlayedChanges::default(); overlay.set_collect_extrinsics(true); + overlay.start_transaction(); + overlay.set_storage(vec![100], Some(vec![101])); overlay.set_extrinsic_index(0); @@ -873,17 +671,11 @@ mod tests { overlay.set_extrinsic_index(2); overlay.set_storage(vec![1], Some(vec![6])); - assert_eq!(strip_extrinsic_index(&overlay.prospective.top), - vec![ - (vec![1], OverlayedValue { value: Some(vec![6]), - extrinsics: Some(vec![0, 2].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![4]), - extrinsics: Some(vec![1].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), - extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), - ].into_iter().collect()); + assert_extrinsics(&overlay.top, vec![1], vec![0, 2]); + assert_extrinsics(&overlay.top, vec![3], vec![1]); + assert_extrinsics(&overlay.top, vec![100], vec![NO_EXTRINSIC_INDEX]); - overlay.commit_prospective(); + overlay.start_transaction(); overlay.set_extrinsic_index(3); overlay.set_storage(vec![3], Some(vec![7])); @@ -891,75 +683,53 @@ mod tests { overlay.set_extrinsic_index(4); overlay.set_storage(vec![1], Some(vec![8])); - assert_eq!(strip_extrinsic_index(&overlay.committed.top), - vec![ - (vec![1], OverlayedValue { value: Some(vec![6]), - extrinsics: Some(vec![0, 2].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![4]), - extrinsics: Some(vec![1].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), - extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), - ].into_iter().collect()); - - assert_eq!(strip_extrinsic_index(&overlay.prospective.top), - vec![ - (vec![1], OverlayedValue { value: Some(vec![8]), - extrinsics: Some(vec![4].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![7]), - extrinsics: Some(vec![3].into_iter().collect()) }), - ].into_iter().collect()); - - overlay.commit_prospective(); - - assert_eq!(strip_extrinsic_index(&overlay.committed.top), - vec![ - (vec![1], OverlayedValue { value: Some(vec![8]), - extrinsics: Some(vec![0, 2, 4].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![7]), - extrinsics: Some(vec![1, 3].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), - extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), - ].into_iter().collect()); - - assert_eq!(overlay.prospective, - Default::default()); + assert_extrinsics(&overlay.top, vec![1], vec![0, 2, 4]); + assert_extrinsics(&overlay.top, vec![3], vec![1, 3]); + assert_extrinsics(&overlay.top, vec![100], vec![NO_EXTRINSIC_INDEX]); + + overlay.rollback_transaction().unwrap(); + + assert_extrinsics(&overlay.top, vec![1], vec![0, 2]); + assert_extrinsics(&overlay.top, vec![3], vec![1]); + assert_extrinsics(&overlay.top, vec![100], vec![NO_EXTRINSIC_INDEX]); } #[test] fn next_storage_key_change_works() { let mut overlay = OverlayedChanges::default(); + overlay.start_transaction(); overlay.set_storage(vec![20], Some(vec![20])); overlay.set_storage(vec![30], Some(vec![30])); overlay.set_storage(vec![40], Some(vec![40])); - overlay.commit_prospective(); + overlay.commit_transaction().unwrap(); overlay.set_storage(vec![10], Some(vec![10])); overlay.set_storage(vec![30], None); // next_prospective < next_committed let next_to_5 = overlay.next_storage_key_change(&[5]).unwrap(); assert_eq!(next_to_5.0.to_vec(), vec![10]); - assert_eq!(next_to_5.1.value, Some(vec![10])); + assert_eq!(next_to_5.1.value(), Some(&vec![10])); // next_committed < next_prospective let next_to_10 = overlay.next_storage_key_change(&[10]).unwrap(); assert_eq!(next_to_10.0.to_vec(), vec![20]); - assert_eq!(next_to_10.1.value, Some(vec![20])); + assert_eq!(next_to_10.1.value(), Some(&vec![20])); // next_committed == next_prospective let next_to_20 = overlay.next_storage_key_change(&[20]).unwrap(); assert_eq!(next_to_20.0.to_vec(), vec![30]); - assert_eq!(next_to_20.1.value, None); + assert_eq!(next_to_20.1.value(), None); // next_committed, no next_prospective let next_to_30 = overlay.next_storage_key_change(&[30]).unwrap(); assert_eq!(next_to_30.0.to_vec(), vec![40]); - assert_eq!(next_to_30.1.value, Some(vec![40])); + assert_eq!(next_to_30.1.value(), Some(&vec![40])); overlay.set_storage(vec![50], Some(vec![50])); // next_prospective, no next_committed let next_to_40 = overlay.next_storage_key_change(&[40]).unwrap(); assert_eq!(next_to_40.0.to_vec(), vec![50]); - assert_eq!(next_to_40.1.value, Some(vec![50])); + assert_eq!(next_to_40.1.value(), Some(&vec![50])); } #[test] @@ -968,37 +738,38 @@ mod tests { let child_info = &child_info; let child = child_info.storage_key(); let mut overlay = OverlayedChanges::default(); + overlay.start_transaction(); overlay.set_child_storage(child_info, vec![20], Some(vec![20])); overlay.set_child_storage(child_info, vec![30], Some(vec![30])); overlay.set_child_storage(child_info, vec![40], Some(vec![40])); - overlay.commit_prospective(); + overlay.commit_transaction().unwrap(); overlay.set_child_storage(child_info, vec![10], Some(vec![10])); overlay.set_child_storage(child_info, vec![30], None); // next_prospective < next_committed let next_to_5 = overlay.next_child_storage_key_change(child, &[5]).unwrap(); assert_eq!(next_to_5.0.to_vec(), vec![10]); - assert_eq!(next_to_5.1.value, Some(vec![10])); + assert_eq!(next_to_5.1.value(), Some(&vec![10])); // next_committed < next_prospective let next_to_10 = overlay.next_child_storage_key_change(child, &[10]).unwrap(); assert_eq!(next_to_10.0.to_vec(), vec![20]); - assert_eq!(next_to_10.1.value, Some(vec![20])); + assert_eq!(next_to_10.1.value(), Some(&vec![20])); // next_committed == next_prospective let next_to_20 = overlay.next_child_storage_key_change(child, &[20]).unwrap(); assert_eq!(next_to_20.0.to_vec(), vec![30]); - assert_eq!(next_to_20.1.value, None); + assert_eq!(next_to_20.1.value(), None); // next_committed, no next_prospective let next_to_30 = overlay.next_child_storage_key_change(child, &[30]).unwrap(); assert_eq!(next_to_30.0.to_vec(), vec![40]); - assert_eq!(next_to_30.1.value, Some(vec![40])); + assert_eq!(next_to_30.1.value(), Some(&vec![40])); overlay.set_child_storage(child_info, vec![50], Some(vec![50])); // next_prospective, no next_committed let next_to_40 = overlay.next_child_storage_key_change(child, &[40]).unwrap(); assert_eq!(next_to_40.0.to_vec(), vec![50]); - assert_eq!(next_to_40.1.value, Some(vec![50])); + assert_eq!(next_to_40.1.value(), Some(&vec![50])); } } diff --git a/primitives/state-machine/src/read_only.rs b/primitives/state-machine/src/read_only.rs index 817282f8e7..2a5d7fda36 100644 --- a/primitives/state-machine/src/read_only.rs +++ b/primitives/state-machine/src/read_only.rs @@ -170,6 +170,18 @@ impl<'a, H: Hasher, B: 'a + Backend> Externalities for ReadOnlyExternalities< unimplemented!("storage_changes_root is not supported in ReadOnlyExternalities") } + fn storage_start_transaction(&mut self) { + unimplemented!("Transactions are not supported by ReadOnlyExternalities"); + } + + fn storage_rollback_transaction(&mut self) -> Result<(), ()> { + unimplemented!("Transactions are not supported by ReadOnlyExternalities"); + } + + fn storage_commit_transaction(&mut self) -> Result<(), ()> { + unimplemented!("Transactions are not supported by ReadOnlyExternalities"); + } + fn wipe(&mut self) {} fn commit(&mut self) {} diff --git a/primitives/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs index 90da547983..cccb044f7e 100644 --- a/primitives/state-machine/src/testing.rs +++ b/primitives/state-machine/src/testing.rs @@ -153,15 +153,15 @@ impl TestExternalities /// Return a new backend with all pending value. pub fn commit_all(&self) -> InMemoryBackend { - let top: Vec<_> = self.overlay.changes(None) + let top: Vec<_> = self.overlay.changes() .map(|(k, v)| (k.clone(), v.value().cloned())) .collect(); let mut transaction = vec![(None, top)]; - for child_info in self.overlay.child_infos() { + for (child_changes, child_info) in self.overlay.children() { transaction.push(( Some(child_info.clone()), - self.overlay.changes(Some(child_info)) + child_changes .map(|(k, v)| (k.clone(), v.value().cloned())) .collect(), )) -- GitLab From fed834c81ca3577dd5bffe426141b9b363f7abdc Mon Sep 17 00:00:00 2001 From: pscott <30843220+pscott@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:09:47 +0200 Subject: [PATCH 224/280] Optimize offchain worker api by re-using http-client (#6454) * Fix typo in offchain's docs * Use Self keyword in AsyncApi::new() * Move httpclient to be part of OffchainWorkers to optimize block import * Fix compilation errors for tests * Add wrapper struct for HyperClient * Use lazy_static share SharedClient amongst OffchainWorkers. Remove the need to raise the fd limit * Revert "Use lazy_static share SharedClient amongst OffchainWorkers. Remove the need to raise the fd limit" This reverts commit 7af97498a2383b5d7405e27823db8fd97245da41. * Add lazy_static for tests --- Cargo.lock | 2 +- client/offchain/Cargo.toml | 2 +- client/offchain/src/api.rs | 11 +++++--- client/offchain/src/api/http.rs | 37 +++++++++++++++++++-------- client/offchain/src/api/http_dummy.rs | 12 ++++++++- client/offchain/src/lib.rs | 7 ++++- 6 files changed, 53 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 930cb554c7..4ffae8d562 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6573,12 +6573,12 @@ version = "2.0.0-rc3" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", - "fdlimit", "fnv", "futures 0.3.4", "futures-timer 3.0.2", "hyper 0.13.4", "hyper-rustls", + "lazy_static", "log", "num_cpus", "parity-scale-codec", diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index a9cd8c4dea..819d6ac3a5 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -37,12 +37,12 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" -fdlimit = "0.1.4" sc-client-db = { version = "0.8.0-rc3", default-features = true, path = "../db/" } sc-transaction-pool = { version = "2.0.0-rc3", path = "../../client/transaction-pool" } sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } tokio = "0.2" +lazy_static = "1.4.0" [features] default = [] diff --git a/client/offchain/src/api.rs b/client/offchain/src/api.rs index a7f4ecbc58..0aa5d4ad78 100644 --- a/client/offchain/src/api.rs +++ b/client/offchain/src/api.rs @@ -31,6 +31,7 @@ use sp_core::offchain::{ OpaqueNetworkState, OpaquePeerId, OpaqueMultiaddr, StorageKind, }; pub use sp_offchain::STORAGE_PREFIX; +pub use http::SharedClient; #[cfg(not(target_os = "unknown"))] mod http; @@ -260,8 +261,9 @@ impl AsyncApi { db: S, network_state: Arc, is_validator: bool, - ) -> (Api, AsyncApi) { - let (http_api, http_worker) = http::http(); + shared_client: SharedClient, + ) -> (Api, Self) { + let (http_api, http_worker) = http::http(shared_client); let api = Api { db, @@ -270,7 +272,7 @@ impl AsyncApi { http: http_api, }; - let async_api = AsyncApi { + let async_api = Self { http: Some(http_worker), }; @@ -308,11 +310,14 @@ mod tests { let _ = env_logger::try_init(); let db = LocalStorage::new_test(); let mock = Arc::new(MockNetworkStateInfo()); + let shared_client = SharedClient::new(); + AsyncApi::new( db, mock, false, + shared_client, ) } diff --git a/client/offchain/src/api/http.rs b/client/offchain/src/api/http.rs index 91a673872f..1f542b7c11 100644 --- a/client/offchain/src/api/http.rs +++ b/client/offchain/src/api/http.rs @@ -33,9 +33,22 @@ use log::error; use sp_core::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError}; use std::{convert::TryFrom, fmt, io::Read as _, pin::Pin, task::{Context, Poll}}; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender, TracingUnboundedReceiver}; +use std::sync::Arc; +use hyper::{Client as HyperClient, Body, client}; +use hyper_rustls::HttpsConnector; + +/// Wrapper struct used for keeping the hyper_rustls client running. +#[derive(Clone)] +pub struct SharedClient(Arc, Body>>); + +impl SharedClient { + pub fn new() -> Self { + Self(Arc::new(HyperClient::builder().build(HttpsConnector::new()))) + } +} /// Creates a pair of [`HttpApi`] and [`HttpWorker`]. -pub fn http() -> (HttpApi, HttpWorker) { +pub fn http(shared_client: SharedClient) -> (HttpApi, HttpWorker) { let (to_worker, from_api) = tracing_unbounded("mpsc_ocw_to_worker"); let (to_api, from_worker) = tracing_unbounded("mpsc_ocw_to_api"); @@ -51,7 +64,7 @@ pub fn http() -> (HttpApi, HttpWorker) { let engine = HttpWorker { to_api, from_api, - http_client: hyper::Client::builder().build(hyper_rustls::HttpsConnector::new()), + http_client: shared_client.0, requests: Vec::new(), }; @@ -551,7 +564,7 @@ pub struct HttpWorker { /// Used to receive messages from the `HttpApi`. from_api: TracingUnboundedReceiver, /// The engine that runs HTTP requests. - http_client: hyper::Client, hyper::Body>, + http_client: Arc, Body>>, /// HTTP requests that are being worked on by the engine. requests: Vec<(HttpRequestId, HttpWorkerRequest)>, } @@ -685,21 +698,23 @@ impl fmt::Debug for HttpWorkerRequest { mod tests { use core::convert::Infallible; use crate::api::timestamp; - use super::http; + use super::{http, SharedClient}; use sp_core::offchain::{HttpError, HttpRequestId, HttpRequestStatus, Duration}; use futures::future; + use lazy_static::lazy_static; + + // Using lazy_static to avoid spawning lots of different SharedClients, + // as spawning a SharedClient is CPU-intensive and opens lots of fds. + lazy_static! { + static ref SHARED_CLIENT: SharedClient = SharedClient::new(); + } // Returns an `HttpApi` whose worker is ran in the background, and a `SocketAddr` to an HTTP // server that runs in the background as well. macro_rules! build_api_server { () => {{ - // We spawn quite a bit of HTTP servers here due to how async API - // works for offchain workers, so be sure to raise the FD limit - // (particularly useful for macOS where the default soft limit may - // not be enough). - fdlimit::raise_fd_limit(); - - let (api, worker) = http(); + let hyper_client = SHARED_CLIENT.clone(); + let (api, worker) = http(hyper_client.clone()); let (addr_tx, addr_rx) = std::sync::mpsc::channel(); std::thread::spawn(move || { diff --git a/client/offchain/src/api/http_dummy.rs b/client/offchain/src/api/http_dummy.rs index 5ff77a1068..1c83325c93 100644 --- a/client/offchain/src/api/http_dummy.rs +++ b/client/offchain/src/api/http_dummy.rs @@ -19,8 +19,18 @@ use sp_core::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError}; use std::{future::Future, pin::Pin, task::Context, task::Poll}; +/// Wrapper struct (wrapping nothing in case of http_dummy) used for keeping the hyper_rustls client running. +#[derive(Clone)] +pub struct SharedClient; + +impl SharedClient { + pub fn new() -> Self { + Self + } +} + /// Creates a pair of [`HttpApi`] and [`HttpWorker`]. -pub fn http() -> (HttpApi, HttpWorker) { +pub fn http(_: SharedClient) -> (HttpApi, HttpWorker) { (HttpApi, HttpWorker) } diff --git a/client/offchain/src/lib.rs b/client/offchain/src/lib.rs index a1ea16a72e..7c90065746 100644 --- a/client/offchain/src/lib.rs +++ b/client/offchain/src/lib.rs @@ -19,7 +19,7 @@ //! The offchain workers is a special function of the runtime that //! gets executed after block is imported. During execution //! it's able to asynchronously submit extrinsics that will either -//! be propagated to other nodes added to the next block +//! be propagated to other nodes or added to the next block //! produced by the node as unsigned transactions. //! //! Offchain workers can be used for computation-heavy tasks @@ -46,6 +46,7 @@ use sp_runtime::{generic::BlockId, traits::{self, Header}}; use futures::{prelude::*, future::ready}; mod api; +use api::SharedClient; pub use sp_offchain::{OffchainWorkerApi, STORAGE_PREFIX}; @@ -55,16 +56,19 @@ pub struct OffchainWorkers { db: Storage, _block: PhantomData, thread_pool: Mutex, + shared_client: SharedClient, } impl OffchainWorkers { /// Creates new `OffchainWorkers`. pub fn new(client: Arc, db: Storage) -> Self { + let shared_client = SharedClient::new(); Self { client, db, _block: PhantomData, thread_pool: Mutex::new(ThreadPool::new(num_cpus::get())), + shared_client, } } } @@ -120,6 +124,7 @@ impl OffchainWorkers< self.db.clone(), network_state.clone(), is_validator, + self.shared_client.clone(), ); debug!("Spawning offchain workers at {:?}", at); let header = header.clone(); -- GitLab From cf7432a5ebef122ab685e0b9256a15c722661116 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Tue, 23 Jun 2020 12:42:28 +0200 Subject: [PATCH 225/280] Remove lingering runtime upgrades (#6476) * Remove lingering runtime upgrades * remove unused warnings * remove tests --- frame/democracy/src/lib.rs | 17 ------- frame/democracy/src/tests.rs | 1 - frame/democracy/src/tests/migration.rs | 45 ------------------ frame/indices/src/lib.rs | 12 +---- frame/multisig/src/lib.rs | 11 ----- frame/staking/src/lib.rs | 28 ++---------- frame/transaction-payment/src/lib.rs | 63 -------------------------- 7 files changed, 4 insertions(+), 173 deletions(-) delete mode 100644 frame/democracy/src/tests/migration.rs diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 841281c125..79cc136d45 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -160,7 +160,6 @@ use sp_runtime::{ use codec::{Encode, Decode, Input}; use frame_support::{ decl_module, decl_storage, decl_event, decl_error, ensure, Parameter, - storage::IterableStorageMap, weights::{Weight, DispatchClass}, traits::{ Currency, ReservableCurrency, LockableCurrency, WithdrawReason, LockIdentifier, Get, @@ -602,22 +601,6 @@ decl_module! { fn deposit_event() = default; - fn on_runtime_upgrade() -> Weight { - if let None = StorageVersion::get() { - StorageVersion::put(Releases::V1); - - DepositOf::::translate::< - (BalanceOf, Vec), _ - >(|_, (balance, accounts)| { - Some((accounts, balance)) - }); - - T::MaximumBlockWeight::get() - } else { - T::DbWeight::get().reads(1) - } - } - /// Propose a sensitive action to be taken. /// /// The dispatch origin of this call must be _Signed_ and the sender must diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index c1bab3c021..b92f4bd076 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -42,7 +42,6 @@ mod preimage; mod public_proposals; mod scheduling; mod voting; -mod migration; mod decoders; const AYE: Vote = Vote { aye: true, conviction: Conviction::None }; diff --git a/frame/democracy/src/tests/migration.rs b/frame/democracy/src/tests/migration.rs deleted file mode 100644 index cab8f7f5c9..0000000000 --- a/frame/democracy/src/tests/migration.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Substrate. If not, see . - -//! The tests for migration. - -use super::*; -use frame_support::{storage::migration, Hashable, traits::OnRuntimeUpgrade}; -use substrate_test_utils::assert_eq_uvec; - -#[test] -fn migration() { - new_test_ext().execute_with(|| { - for i in 0..3 { - let k = i.twox_64_concat(); - let v: (BalanceOf, Vec) = (i * 1000, vec![i]); - migration::put_storage_value(b"Democracy", b"DepositOf", &k, v); - } - StorageVersion::kill(); - - Democracy::on_runtime_upgrade(); - - assert_eq!(StorageVersion::get(), Some(Releases::V1)); - assert_eq_uvec!( - DepositOf::::iter().collect::>(), - vec![ - (0, (vec![0u64], >::from(0u32))), - (1, (vec![1u64], >::from(1000u32))), - (2, (vec![2u64], >::from(2000u32))), - ] - ); - }) -} diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 048a5b9936..e58112403f 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -26,7 +26,7 @@ use sp_runtime::traits::{ StaticLookup, Member, LookupError, Zero, Saturating, AtLeast32Bit }; use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure}; -use frame_support::dispatch::{DispatchResult, Weight}; +use frame_support::dispatch::DispatchResult; use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved}; use frame_support::weights::constants::WEIGHT_PER_MICROS; use frame_system::{ensure_signed, ensure_root}; @@ -104,16 +104,6 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin, system = frame_system { fn deposit_event() = default; - fn on_runtime_upgrade() -> Weight { - use frame_support::migration::{StorageIterator, put_storage_value}; - for (key, value) in StorageIterator::< - (T::AccountId, BalanceOf) - >::new(b"Indices", b"Accounts").drain() { - put_storage_value(b"Indices", b"Accounts", &key, (value.0, value.1, false)); - } - 1_000_000_000 - } - /// Assign an previously unassigned index. /// /// Payment: `Deposit` is reserved from the sender account. diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs index fc7a6c25b3..bcea34f9b3 100644 --- a/frame/multisig/src/lib.rs +++ b/frame/multisig/src/lib.rs @@ -235,17 +235,6 @@ decl_module! { /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; - fn on_runtime_upgrade() -> Weight { - // Utility.Multisigs -> Multisig.Multisigs - use frame_support::migration::{StorageIterator, put_storage_value}; - for (key, value) in StorageIterator::< - Multisig, T::AccountId> - >::new(b"Utility", b"Multisigs").drain() { - put_storage_value(b"Multisig", b"Multisigs", &key, value); - } - 1_000_000_000 - } - /// Immediately dispatch a multi-signature call using a single approval from the caller. /// /// The dispatch origin for this call must be _Signed_. diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 63b427a5ab..de61b25483 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1278,9 +1278,9 @@ decl_module! { /// Number of eras that staked funds must remain bonded for. const BondingDuration: EraIndex = T::BondingDuration::get(); - /// Number of eras that slashes are deferred by, after computation. + /// Number of eras that slashes are deferred by, after computation. /// - /// This should be less than the bonding duration. + /// This should be less than the bonding duration. /// Set to 0 if slashes should be applied immediately, without opportunity for /// intervention. const SlashDeferDuration: EraIndex = T::SlashDeferDuration::get(); @@ -1294,7 +1294,7 @@ decl_module! { /// length of a session will be pointless. const ElectionLookahead: T::BlockNumber = T::ElectionLookahead::get(); - /// Maximum number of balancing iterations to run in the offchain submission. + /// Maximum number of balancing iterations to run in the offchain submission. /// /// If set to 0, balance_solution will not be executed at all. const MaxIterations: u32 = T::MaxIterations::get(); @@ -1312,28 +1312,6 @@ decl_module! { fn deposit_event() = default; - fn on_runtime_upgrade() -> Weight { - #[allow(dead_code)] - mod inner { - pub struct Module(sp_std::marker::PhantomData); - frame_support::decl_storage! { - trait Store for Module as Staking { - pub MigrateEra: Option; - } - } - } - - if let Releases::V3_0_0 = StorageVersion::get() { - StorageVersion::put(Releases::V4_0_0); - inner::MigrateEra::kill(); - - T::DbWeight::get().reads_writes(1, 1) - } else { - T::DbWeight::get().reads(1) - } - } - - /// sets `ElectionStatus` to `Open(now)` where `now` is the block number at which the /// election window has opened, if we are at the last session and less blocks than /// `T::ElectionLookahead` is remaining until the next new session schedule. The offchain diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 31d0cfb20d..4d920f8ec5 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -230,38 +230,6 @@ decl_module! { ).unwrap(), ); } - - fn on_runtime_upgrade() -> Weight { - use frame_support::migration::take_storage_value; - use sp_std::convert::TryInto; - use frame_support::debug::native::error; - - type OldMultiplier = sp_runtime::FixedI128; - type OldInner = ::Inner; - type Inner = ::Inner; - - if let Releases::V1Ancient = StorageVersion::get() { - StorageVersion::put(Releases::V2); - - if let Some(old) = take_storage_value::( - b"TransactionPayment", - b"NextFeeMultiplier", - &[], - ) { - let inner = old.into_inner(); - let new_inner = >::try_into(inner) - .unwrap_or_default(); - let new = Multiplier::from_inner(new_inner); - NextFeeMultiplier::put(new); - T::DbWeight::get().reads_writes(1, 1) - } else { - error!("transaction-payment migration failed."); - T::DbWeight::get().reads(1) - } - } else { - T::DbWeight::get().reads(1) - } - } } } @@ -740,37 +708,6 @@ mod tests { PostDispatchInfo { actual_weight: None, } } - #[test] - fn migration_to_v2_works() { - use sp_runtime::FixedI128; - use frame_support::traits::OnRuntimeUpgrade; - - let with_old_multiplier = |mul: FixedI128, expected: FixedU128| { - ExtBuilder::default().build().execute_with(|| { - frame_support::migration::put_storage_value( - b"TransactionPayment", - b"NextFeeMultiplier", - &[], - mul, - ); - - assert_eq!(StorageVersion::get(), Releases::V1Ancient); - - TransactionPayment::on_runtime_upgrade(); - - assert_eq!(StorageVersion::get(), Releases::V2); - assert_eq!(NextFeeMultiplier::get(), expected); - }) - }; - - with_old_multiplier(FixedI128::saturating_from_integer(-1), FixedU128::zero()); - with_old_multiplier(FixedI128::saturating_from_rational(-1, 2), FixedU128::zero()); - with_old_multiplier( - FixedI128::saturating_from_rational(1, 2), - FixedU128::saturating_from_rational(1, 2), - ); - } - #[test] fn signed_extension_transaction_payment_work() { ExtBuilder::default() -- GitLab From 6221146c42ec20288880aab4fd39941920a3151f Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Tue, 23 Jun 2020 12:47:13 +0200 Subject: [PATCH 226/280] impl Debug for sc_service::Configuration (#6400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit Forked at: d735e4d0b5378c227f81a5127a1d4544de112fd8 No parent branch. * Make sc_service::Configuration derive Debug * Replace task_executor fn's input by proper TaskExecutor type (cleaner) * impl From for TaskExecutor * Update client/cli/src/runner.rs * Add some doc, examples and tests * Replace Deref by fn spawn as suggested Co-authored-by: Bastian Köcher --- client/chain-spec/src/lib.rs | 6 +++ client/cli/src/config.rs | 9 ++-- client/cli/src/lib.rs | 7 +-- client/cli/src/runner.rs | 26 +++++----- client/db/src/lib.rs | 2 +- client/service/src/config.rs | 76 ++++++++++++++++++++++++++++-- client/service/src/lib.rs | 4 +- client/service/src/task_manager.rs | 15 +++--- client/service/test/src/lib.rs | 44 ++++++++++------- primitives/database/src/lib.rs | 6 +++ utils/browser/src/lib.rs | 3 +- 11 files changed, 139 insertions(+), 59 deletions(-) diff --git a/client/chain-spec/src/lib.rs b/client/chain-spec/src/lib.rs index 6fb2694261..66bce2b136 100644 --- a/client/chain-spec/src/lib.rs +++ b/client/chain-spec/src/lib.rs @@ -158,3 +158,9 @@ pub trait ChainSpec: BuildStorage + Send { /// This will be used as storage at genesis. fn set_storage(&mut self, storage: Storage); } + +impl std::fmt::Debug for dyn ChainSpec { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "ChainSpec(name = {:?}, id = {:?})", self.name(), self.id()) + } +} diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index 2c3cfe8419..0ff2d96b4c 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -28,15 +28,12 @@ use names::{Generator, Name}; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_service::config::{ BasePath, Configuration, DatabaseConfig, ExtTransport, KeystoreConfig, NetworkConfiguration, - NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods, TaskType, - TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod, + NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods, + TaskExecutor, TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod, }; use sc_service::{ChainSpec, TracingReceiver}; -use std::future::Future; use std::net::SocketAddr; use std::path::PathBuf; -use std::pin::Pin; -use std::sync::Arc; /// The maximum number of characters for a node name. pub(crate) const NODE_NAME_MAX_LENGTH: usize = 32; @@ -409,7 +406,7 @@ pub trait CliConfiguration: Sized { fn create_configuration( &self, cli: &C, - task_executor: Arc + Send>>, TaskType) + Send + Sync>, + task_executor: TaskExecutor, ) -> Result { let is_dev = self.is_dev()?; let chain_id = self.chain_id(is_dev)?; diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index 1acd5ee604..9623b08bfb 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -37,11 +37,8 @@ use log::info; pub use params::*; use regex::Regex; pub use runner::*; -use sc_service::{ChainSpec, Configuration, TaskType}; -use std::future::Future; +use sc_service::{ChainSpec, Configuration, TaskExecutor}; use std::io::Write; -use std::pin::Pin; -use std::sync::Arc; pub use structopt; use structopt::{ clap::{self, AppSettings}, @@ -199,7 +196,7 @@ pub trait SubstrateCli: Sized { fn create_configuration( &self, command: &T, - task_executor: Arc + Send>>, TaskType) + Send + Sync>, + task_executor: TaskExecutor, ) -> error::Result { command.create_configuration(self, task_executor) } diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index b068af0166..51ea2d2186 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -29,7 +29,7 @@ use sc_service::{AbstractService, Configuration, Role, ServiceBuilderCommand, Ta use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use sp_utils::metrics::{TOKIO_THREADS_ALIVE, TOKIO_THREADS_TOTAL}; use sp_version::RuntimeVersion; -use std::{fmt::Debug, marker::PhantomData, str::FromStr, sync::Arc}; +use std::{fmt::Debug, marker::PhantomData, str::FromStr}; #[cfg(target_family = "unix")] async fn main(func: F) -> std::result::Result<(), Box> @@ -119,23 +119,21 @@ impl Runner { let tokio_runtime = build_runtime()?; let runtime_handle = tokio_runtime.handle().clone(); - let task_executor = Arc::new( - move |fut, task_type| { - match task_type { - TaskType::Async => { runtime_handle.spawn(fut); } - TaskType::Blocking => { - runtime_handle.spawn( async move { - // `spawn_blocking` is looking for the current runtime, and as such has to be called - // from within `spawn`. - tokio::task::spawn_blocking(move || futures::executor::block_on(fut)) - }); - } + let task_executor = move |fut, task_type| { + match task_type { + TaskType::Async => { runtime_handle.spawn(fut); } + TaskType::Blocking => { + runtime_handle.spawn(async move { + // `spawn_blocking` is looking for the current runtime, and as such has to + // be called from within `spawn`. + tokio::task::spawn_blocking(move || futures::executor::block_on(fut)) + }); } } - ); + }; Ok(Runner { - config: command.create_configuration(cli, task_executor)?, + config: command.create_configuration(cli, task_executor.into())?, tokio_runtime, phantom: PhantomData, }) diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 3bae234567..b4f4892a04 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -271,7 +271,7 @@ pub struct DatabaseSettings { } /// Where to find the database.. -#[derive(Clone)] +#[derive(Debug, Clone)] pub enum DatabaseSettingsSrc { /// Load a RocksDB database from a given path. Recommended for most uses. RocksDb { diff --git a/client/service/src/config.rs b/client/service/src/config.rs index b79831d57b..618cd19692 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -34,6 +34,7 @@ use prometheus_endpoint::Registry; use tempfile::TempDir; /// Service configuration. +#[derive(Debug)] pub struct Configuration { /// Implementation name pub impl_name: &'static str, @@ -42,7 +43,7 @@ pub struct Configuration { /// Node role. pub role: Role, /// How to spawn background tasks. Mandatory, otherwise creating a `Service` will error. - pub task_executor: Arc + Send>>, TaskType) + Send + Sync>, + pub task_executor: TaskExecutor, /// Extrinsic pool configuration. pub transaction_pool: TransactionPoolOptions, /// Network configuration. @@ -120,7 +121,7 @@ pub enum TaskType { } /// Configuration of the client keystore. -#[derive(Clone)] +#[derive(Debug, Clone)] pub enum KeystoreConfig { /// Keystore at a path on-disk. Recommended for native nodes. Path { @@ -143,7 +144,7 @@ impl KeystoreConfig { } } /// Configuration of the database of the client. -#[derive(Clone, Default)] +#[derive(Debug, Clone, Default)] pub struct OffchainWorkerConfig { /// If this is allowed. pub enabled: bool, @@ -152,7 +153,7 @@ pub struct OffchainWorkerConfig { } /// Configuration of the Prometheus endpoint. -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct PrometheusConfig { /// Port to use. pub port: SocketAddr, @@ -199,6 +200,7 @@ impl Default for RpcMethods { } /// The base path that is used for everything that needs to be write on disk to run a node. +#[derive(Debug)] pub enum BasePath { /// A temporary directory is used as base path and will be deleted when dropped. #[cfg(not(target_os = "unknown"))] @@ -253,3 +255,69 @@ impl std::convert::From for BasePath { BasePath::new(path) } } + +type TaskExecutorInner = Arc + Send>>, TaskType) + Send + Sync>; + +/// Callable object that execute tasks. +/// +/// This struct can be created easily using `Into`. +/// +/// # Examples +/// +/// ## Using tokio +/// +/// ``` +/// # use sc_service::TaskExecutor; +/// # mod tokio { pub mod runtime { +/// # #[derive(Clone)] +/// # pub struct Runtime; +/// # impl Runtime { +/// # pub fn new() -> Result { Ok(Runtime) } +/// # pub fn handle(&self) -> &Self { &self } +/// # pub fn spawn(&self, _: std::pin::Pin + Send>>) {} +/// # } +/// # } } +/// use tokio::runtime::Runtime; +/// +/// let runtime = Runtime::new().unwrap(); +/// let handle = runtime.handle().clone(); +/// let task_executor: TaskExecutor = (move |future, _task_type| { +/// handle.spawn(future); +/// }).into(); +/// ``` +/// +/// ## Using async-std +/// +/// ``` +/// # use sc_service::TaskExecutor; +/// # mod async_std { pub mod task { +/// # pub fn spawn(_: std::pin::Pin + Send>>) {} +/// # } } +/// let task_executor: TaskExecutor = (|future, _task_type| { +/// async_std::task::spawn(future); +/// }).into(); +/// ``` +#[derive(Clone)] +pub struct TaskExecutor(TaskExecutorInner); + +impl std::fmt::Debug for TaskExecutor { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "TaskExecutor") + } +} + +impl std::convert::From for TaskExecutor +where + F: Fn(Pin + Send>>, TaskType) + Send + Sync + 'static, +{ + fn from(x: F) -> Self { + Self(Arc::new(x)) + } +} + +impl TaskExecutor { + /// Spawns a new asynchronous task. + pub fn spawn(&self, future: Pin + Send>>, task_type: TaskType) { + self.0(future, task_type) + } +} diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index bfd048c759..036c957773 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -65,7 +65,9 @@ pub use self::builder::{ ServiceBuilder, ServiceBuilderCommand, TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor, RpcExtensionBuilder, }; -pub use config::{BasePath, Configuration, DatabaseConfig, PruningMode, Role, RpcMethods, TaskType}; +pub use config::{ + BasePath, Configuration, DatabaseConfig, PruningMode, Role, RpcMethods, TaskExecutor, TaskType, +}; pub use sc_chain_spec::{ ChainSpec, GenericChainSpec, Properties, RuntimeGenesis, Extension as ChainSpecExtension, NoExtension, ChainType, diff --git a/client/service/src/task_manager.rs b/client/service/src/task_manager.rs index 5a400f70df..544d76fc47 100644 --- a/client/service/src/task_manager.rs +++ b/client/service/src/task_manager.rs @@ -13,7 +13,7 @@ //! Substrate service tasks management module. -use std::{panic, pin::Pin, result::Result, sync::Arc}; +use std::{panic, result::Result}; use exit_future::Signal; use log::debug; use futures::{ @@ -29,18 +29,15 @@ use prometheus_endpoint::{ }; use sc_client_api::CloneableSpawn; use sp_utils::mpsc::TracingUnboundedSender; -use crate::config::TaskType; +use crate::config::{TaskExecutor, TaskType}; mod prometheus_future; -/// Type alias for service task executor (usually runtime). -pub type ServiceTaskExecutor = Arc + Send>>, TaskType) + Send + Sync>; - /// An handle for spawning tasks in the service. #[derive(Clone)] pub struct SpawnTaskHandle { on_exit: exit_future::Exit, - executor: ServiceTaskExecutor, + executor: TaskExecutor, metrics: Option, } @@ -113,7 +110,7 @@ impl SpawnTaskHandle { } }; - (self.executor)(Box::pin(future), task_type); + self.executor.spawn(Box::pin(future), task_type); } } @@ -216,7 +213,7 @@ pub struct TaskManager { /// A signal that makes the exit future above resolve, fired on service drop. signal: Option, /// How to spawn background tasks. - executor: ServiceTaskExecutor, + executor: TaskExecutor, /// Prometheus metric where to report the polling times. metrics: Option, } @@ -225,7 +222,7 @@ impl TaskManager { /// If a Prometheus registry is passed, it will be used to report statistics about the /// service tasks. pub(super) fn new( - executor: ServiceTaskExecutor, + executor: TaskExecutor, prometheus_registry: Option<&Registry> ) -> Result { let (signal, on_exit) = exit_future::signal(); diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index c440b118d5..441680e20c 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -38,7 +38,7 @@ use sc_service::{ RuntimeGenesis, Role, Error, - TaskType, + TaskExecutor, }; use sp_blockchain::HeaderBackend; use sc_network::{multiaddr, Multiaddr}; @@ -142,7 +142,7 @@ fn node_config, role: Role, - task_executor: Arc + Send>>, TaskType) + Send + Sync>, + task_executor: TaskExecutor, key_seed: Option, base_port: u16, root: &TempDir, @@ -256,17 +256,19 @@ impl TestNet where authorities: impl Iterator Result<(F, U), Error>)> ) { let executor = self.runtime.executor(); + let task_executor: TaskExecutor = { + let executor = executor.clone(); + (move |fut: Pin + Send>>, _| { + executor.spawn(fut.unit_error().compat()); + }).into() + }; for (key, authority) in authorities { - let task_executor = { - let executor = executor.clone(); - Arc::new(move |fut: Pin + Send>>, _| executor.spawn(fut.unit_error().compat())) - }; let node_config = node_config( self.nodes, &self.chain_spec, Role::Authority { sentry_nodes: Vec::new() }, - task_executor, + task_executor.clone(), Some(key), self.base_port, &temp, @@ -282,11 +284,15 @@ impl TestNet where } for full in full { - let task_executor = { - let executor = executor.clone(); - Arc::new(move |fut: Pin + Send>>, _| executor.spawn(fut.unit_error().compat())) - }; - let node_config = node_config(self.nodes, &self.chain_spec, Role::Full, task_executor, None, self.base_port, &temp); + let node_config = node_config( + self.nodes, + &self.chain_spec, + Role::Full, + task_executor.clone(), + None, + self.base_port, + &temp, + ); let addr = node_config.network.listen_addresses.iter().next().unwrap().clone(); let (service, user_data) = full(node_config).expect("Error creating test node service"); let service = SyncService::from(service); @@ -298,11 +304,15 @@ impl TestNet where } for light in light { - let task_executor = { - let executor = executor.clone(); - Arc::new(move |fut: Pin + Send>>, _| executor.spawn(fut.unit_error().compat())) - }; - let node_config = node_config(self.nodes, &self.chain_spec, Role::Light, task_executor, None, self.base_port, &temp); + let node_config = node_config( + self.nodes, + &self.chain_spec, + Role::Light, + task_executor.clone(), + None, + self.base_port, + &temp, + ); let addr = node_config.network.listen_addresses.iter().next().unwrap().clone(); let service = SyncService::from(light(node_config).expect("Error creating test node service")); diff --git a/primitives/database/src/lib.rs b/primitives/database/src/lib.rs index bc4c11f60a..1fb7b15666 100644 --- a/primitives/database/src/lib.rs +++ b/primitives/database/src/lib.rs @@ -165,6 +165,12 @@ pub trait Database: Send + Sync { } } +impl std::fmt::Debug for dyn Database { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "Database") + } +} + /// Call `f` with the value previously stored against `key` and return the result, or `None` if /// `key` is not currently in the database. /// diff --git a/utils/browser/src/lib.rs b/utils/browser/src/lib.rs index e804af6094..badb029bfe 100644 --- a/utils/browser/src/lib.rs +++ b/utils/browser/src/lib.rs @@ -17,7 +17,6 @@ use futures01::sync::mpsc as mpsc01; use log::{debug, info}; -use std::sync::Arc; use sc_network::config::TransportConfig; use sc_service::{ AbstractService, RpcSession, Role, Configuration, @@ -64,7 +63,7 @@ where network, telemetry_endpoints: chain_spec.telemetry_endpoints().clone(), chain_spec: Box::new(chain_spec), - task_executor: Arc::new(move |fut, _| wasm_bindgen_futures::spawn_local(fut)), + task_executor: (|fut, _| wasm_bindgen_futures::spawn_local(fut)).into(), telemetry_external_transport: Some(transport), role: Role::Light, database: { -- GitLab From c771821cae2dcb5a8808a19fae8122c0b9ae8499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 23 Jun 2020 13:46:16 +0200 Subject: [PATCH 227/280] Fix `sp-api` handling of multiple arguments (#6484) With the switch to `decode_all_with_depth_limit` we silently broken support for functions with multiple arguments. The old generated code tried to decode each parameter separately, which does not play well with `decode_all`. This pr adds a test to ensure that this does not happen again and fixes the bug by decoding everything at once by wrapping it into tuples. --- .../api/proc-macro/src/impl_runtime_apis.rs | 19 ++++++++----------- primitives/api/test/tests/runtime_calls.rs | 11 +++++++++++ test-utils/runtime/src/lib.rs | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index 8f9927cadc..4b5c1c4706 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -34,7 +34,7 @@ use syn::{ fold::{self, Fold}, parse_quote, }; -use std::{collections::HashSet, iter}; +use std::collections::HashSet; /// Unique identifier used to make the hidden includes unique for this macro. const HIDDEN_INCLUDES_ID: &str = "IMPL_RUNTIME_APIS"; @@ -71,10 +71,8 @@ fn generate_impl_call( let params = extract_parameter_names_types_and_borrows(signature, AllowSelfRefInParameters::No)?; let c = generate_crate_access(HIDDEN_INCLUDES_ID); - let c_iter = iter::repeat(&c); let fn_name = &signature.ident; - let fn_name_str = iter::repeat(fn_name.to_string()); - let input = iter::repeat(input); + let fn_name_str = fn_name.to_string(); let pnames = params.iter().map(|v| &v.0); let pnames2 = params.iter().map(|v| &v.0); let ptypes = params.iter().map(|v| &v.1); @@ -82,15 +80,14 @@ fn generate_impl_call( Ok( quote!( - #( - let #pnames : #ptypes = match #c_iter::DecodeLimit::decode_all_with_depth_limit( - #c_iter::MAX_EXTRINSIC_DEPTH, - &mut #input + let (#( #pnames ),*) : ( #( #ptypes ),* ) = + match #c::DecodeLimit::decode_all_with_depth_limit( + #c::MAX_EXTRINSIC_DEPTH, + &mut #input, ) { - Ok(input) => input, + Ok(res) => res, Err(e) => panic!("Bad input data provided to {}: {}", #fn_name_str, e.what()), }; - )* #[allow(deprecated)] <#runtime as #impl_trait>::#fn_name(#( #pborrow #pnames2 ),*) @@ -138,7 +135,7 @@ fn generate_impl_calls( /// Generate the dispatch function that is used in native to call into the runtime. fn generate_dispatch_function(impls: &[ItemImpl]) -> Result { - let data = Ident::new("data", Span::call_site()); + let data = Ident::new("__sp_api__input_data", Span::call_site()); let c = generate_crate_access(HIDDEN_INCLUDES_ID); let impl_calls = generate_impl_calls(impls, &data)? .into_iter() diff --git a/primitives/api/test/tests/runtime_calls.rs b/primitives/api/test/tests/runtime_calls.rs index 555104446a..6717ab7a3b 100644 --- a/primitives/api/test/tests/runtime_calls.rs +++ b/primitives/api/test/tests/runtime_calls.rs @@ -207,3 +207,14 @@ fn record_proof_works() { &runtime_code, ).expect("Executes block while using the proof backend"); } + +#[test] +fn call_runtime_api_with_multiple_arguments() { + let client = TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::Both).build(); + + let data = vec![1, 2, 4, 5, 6, 7, 8, 8, 10, 12]; + let block_id = BlockId::Number(client.chain_info().best_number); + client.runtime_api() + .test_multiple_arguments(&block_id, data.clone(), data.clone(), data.len() as u32) + .unwrap(); +} diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index eaac618b44..1d376a0940 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -313,6 +313,9 @@ cfg_if! { fn test_ecdsa_crypto() -> (ecdsa::AppSignature, ecdsa::AppPublic); /// Run various tests against storage. fn test_storage(); + /// Test that ensures that we can call a function that takes multiple + /// arguments. + fn test_multiple_arguments(data: Vec, other: Vec, num: u32); } } } else { @@ -359,6 +362,9 @@ cfg_if! { fn test_ecdsa_crypto() -> (ecdsa::AppSignature, ecdsa::AppPublic); /// Run various tests against storage. fn test_storage(); + /// Test that ensures that we can call a function that takes multiple + /// arguments. + fn test_multiple_arguments(data: Vec, other: Vec, num: u32); } } } @@ -641,6 +647,11 @@ cfg_if! { test_read_storage(); test_read_child_storage(); } + + fn test_multiple_arguments(data: Vec, other: Vec, num: u32) { + assert_eq!(&data[..], &other[..]); + assert_eq!(data.len(), num as usize); + } } impl sp_consensus_aura::AuraApi for Runtime { @@ -862,6 +873,11 @@ cfg_if! { test_read_storage(); test_read_child_storage(); } + + fn test_multiple_arguments(data: Vec, other: Vec, num: u32) { + assert_eq!(&data[..], &other[..]); + assert_eq!(data.len(), num as usize); + } } impl sp_consensus_aura::AuraApi for Runtime { -- GitLab From ad7b5ef7f2131eadceb1f89a69381cd359ef1eb9 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 23 Jun 2020 16:50:33 +0200 Subject: [PATCH 228/280] Fix the browser node and ensure it doesn't colour the informant output (#6457) * Fix browser informant * Fix documentation * Add an informant_output_format function to the cli config * Wrap informant output format in an option * Revert batch verifier * Remove wasm-timer from primitives io cargo lock * Drop informant_output_format function * derive debug for output format --- Cargo.lock | 1 + client/cli/src/config.rs | 1 + client/informant/src/lib.rs | 29 ++++++++++-- client/service/src/builder.rs | 46 +------------------ client/service/src/config.rs | 2 + client/service/test/src/lib.rs | 1 + primitives/consensus/common/Cargo.toml | 1 + .../consensus/common/src/import_queue.rs | 2 +- .../consensus/common/src/offline_tracker.rs | 3 +- utils/browser/src/lib.rs | 4 ++ 10 files changed, 40 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ffae8d562..64524d8c52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7442,6 +7442,7 @@ dependencies = [ "sp-utils", "sp-version", "substrate-prometheus-endpoint", + "wasm-timer", ] [[package]] diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index 0ff2d96b4c..598acd0ab9 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -474,6 +474,7 @@ pub trait CliConfiguration: Sized { announce_block: self.announce_block()?, role, base_path: Some(base_path), + informant_output_format: Default::default(), }) } diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs index 6a8acbadc3..d56afcf335 100644 --- a/client/informant/src/lib.rs +++ b/client/informant/src/lib.rs @@ -34,14 +34,37 @@ use parking_lot::Mutex; mod display; /// The format to print telemetry output in. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct OutputFormat { - /// Enable color output in logs. + /// Enable color output in logs. True by default. pub enable_color: bool, - /// Add a prefix before every log line + /// Defines the informant's prefix for the logs. An empty string by default. + /// + /// By default substrate will show logs without a prefix. Example: + /// + /// ```text + /// 2020-05-28 15:11:06 ✨ Imported #2 (0xc21c…2ca8) + /// 2020-05-28 15:11:07 💤 Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 + /// ``` + /// + /// But you can define a prefix by setting this string. This will output: + /// + /// ```text + /// 2020-05-28 15:11:06 ✨ [Prefix] Imported #2 (0xc21c…2ca8) + /// 2020-05-28 15:11:07 💤 [Prefix] Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 + /// ``` pub prefix: String, } +impl Default for OutputFormat { + fn default() -> Self { + Self { + enable_color: true, + prefix: String::new(), + } + } +} + /// Marker trait for a type that implements `TransactionPool` and `MallocSizeOf` on `not(target_os = "unknown")`. #[cfg(target_os = "unknown")] pub trait TransactionPoolAndMaybeMallogSizeOf: TransactionPool {} diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index f492c5d494..eebc825b21 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -102,7 +102,6 @@ pub struct ServiceBuilder>>, marker: PhantomData<(TBl, TRtApi)>, block_announce_validator_builder: Option) -> Box + Send> + Send>>, - informant_prefix: String, } /// A utility trait for building an RPC extension given a `DenyUnsafe` instance. @@ -366,7 +365,6 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { rpc_extensions_builder: Box::new(|_| ()), remote_backend: None, block_announce_validator_builder: None, - informant_prefix: Default::default(), marker: PhantomData, }) } @@ -450,7 +448,6 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> { rpc_extensions_builder: Box::new(|_| ()), remote_backend: Some(remote_blockchain), block_announce_validator_builder: None, - informant_prefix: Default::default(), marker: PhantomData, }) } @@ -545,7 +542,6 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -591,7 +587,6 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -630,7 +625,6 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -697,7 +691,6 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -754,7 +747,6 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -792,7 +784,6 @@ impl rpc_extensions_builder: Box::new(rpc_extensions_builder), remote_backend: self.remote_backend, block_announce_validator_builder: self.block_announce_validator_builder, - informant_prefix: self.informant_prefix, marker: self.marker, }) } @@ -838,43 +829,9 @@ impl rpc_extensions_builder: self.rpc_extensions_builder, remote_backend: self.remote_backend, block_announce_validator_builder: Some(Box::new(block_announce_validator_builder)), - informant_prefix: self.informant_prefix, marker: self.marker, }) } - - /// Defines the informant's prefix for the logs. An empty string by default. - /// - /// By default substrate will show logs without a prefix. Example: - /// - /// ```text - /// 2020-05-28 15:11:06 ✨ Imported #2 (0xc21c…2ca8) - /// 2020-05-28 15:11:07 💤 Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 - /// ``` - /// - /// But you can define a prefix by using this function. Example: - /// - /// ```rust,ignore - /// service.with_informant_prefix("[Prefix] ".to_string()); - /// ``` - /// - /// This will output: - /// - /// ```text - /// 2020-05-28 15:11:06 ✨ [Prefix] Imported #2 (0xc21c…2ca8) - /// 2020-05-28 15:11:07 💤 [Prefix] Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0 - /// ``` - pub fn with_informant_prefix( - self, - informant_prefix: String, - ) -> Result, Error> - where TSc: Clone, TFchr: Clone { - Ok(ServiceBuilder { - informant_prefix: informant_prefix, - ..self - }) - } } /// Implemented on `ServiceBuilder`. Allows running block commands, such as import/export/validate @@ -990,7 +947,6 @@ ServiceBuilder< rpc_extensions_builder, remote_backend, block_announce_validator_builder, - informant_prefix, } = self; sp_session::generate_initial_session_keys( @@ -1142,7 +1098,7 @@ ServiceBuilder< client.clone(), network_status_sinks.clone(), transaction_pool.clone(), - sc_informant::OutputFormat { enable_color: true, prefix: informant_prefix }, + config.informant_output_format, )); Ok(Service { diff --git a/client/service/src/config.rs b/client/service/src/config.rs index 618cd19692..fb4dbc666a 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -109,6 +109,8 @@ pub struct Configuration { pub announce_block: bool, /// Base path of the configuration pub base_path: Option, + /// Configuration of the output format that the informant uses. + pub informant_output_format: sc_informant::OutputFormat, } /// Type for tasks spawned by the executor. diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 441680e20c..4ff89f5319 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -212,6 +212,7 @@ fn node_config, Transaction r => return Ok(r), // Any other successful result means that the block is already imported. } - let started = std::time::Instant::now(); + let started = wasm_timer::Instant::now(); let (mut import_block, maybe_keys) = verifier.verify(block_origin, header, justification, block.body) .map_err(|msg| { if let Some(ref peer) = peer { diff --git a/primitives/consensus/common/src/offline_tracker.rs b/primitives/consensus/common/src/offline_tracker.rs index 9269640ffc..b96498041f 100644 --- a/primitives/consensus/common/src/offline_tracker.rs +++ b/primitives/consensus/common/src/offline_tracker.rs @@ -18,7 +18,8 @@ //! Tracks offline validators. use std::collections::HashMap; -use std::time::{Instant, Duration}; +use std::time::Duration; +use wasm_timer::Instant; // time before we report a validator. const REPORT_TIME: Duration = Duration::from_secs(60 * 5); diff --git a/utils/browser/src/lib.rs b/utils/browser/src/lib.rs index badb029bfe..799fe9788c 100644 --- a/utils/browser/src/lib.rs +++ b/utils/browser/src/lib.rs @@ -98,6 +98,10 @@ where max_runtime_instances: 8, announce_block: true, base_path: None, + informant_output_format: sc_informant::OutputFormat { + enable_color: false, + prefix: String::new(), + }, }; Ok(config) -- GitLab From 8baaa18f58515c2687cd66553c63799872d91655 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Tue, 23 Jun 2020 17:09:01 +0200 Subject: [PATCH 229/280] bound some missing bound for elevated trait (#6487) --- frame/balances/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index e882bdf349..f7ccb86e60 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -862,8 +862,8 @@ impl, I: Instance> frame_system::Trait for ElevatedTrait { type BlockHashCount = T::BlockHashCount; type MaximumBlockWeight = T::MaximumBlockWeight; type DbWeight = T::DbWeight; - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); + type BlockExecutionWeight = T::BlockExecutionWeight; + type ExtrinsicBaseWeight = T::ExtrinsicBaseWeight; type MaximumExtrinsicWeight = T::MaximumBlockWeight; type MaximumBlockLength = T::MaximumBlockLength; type AvailableBlockRatio = T::AvailableBlockRatio; -- GitLab From 034055a092bd376c3b7252b58f1777de70dfad59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 23 Jun 2020 17:25:19 +0200 Subject: [PATCH 230/280] `pallet-scheduler`: Check that `when` is not in the past (#6480) * `pallet-scheduler`: Check that `when` is not in the past * Break some lines --- frame/scheduler/src/lib.rs | 109 +++++++++++++++++++++++++++++------- frame/support/src/traits.rs | 2 +- 2 files changed, 89 insertions(+), 22 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 18b4eef0a8..6b47e62587 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -119,6 +119,8 @@ decl_error! { FailedToSchedule, /// Failed to cancel a scheduled call FailedToCancel, + /// Given target block number is in the past. + TargetBlockNumberInPast, } } @@ -145,7 +147,7 @@ decl_module! { call: Box<::Call>, ) { ensure_root(origin)?; - let _ = Self::do_schedule(when, maybe_periodic, priority, *call); + Self::do_schedule(when, maybe_periodic, priority, *call)?; } /// Cancel an anonymously scheduled task. @@ -294,7 +296,11 @@ impl Module { maybe_periodic: Option>, priority: schedule::Priority, call: ::Call - ) -> TaskAddress { + ) -> Result, DispatchError> { + if when <= frame_system::Module::::block_number() { + return Err(Error::::TargetBlockNumberInPast.into()) + } + // sanitize maybe_periodic let maybe_periodic = maybe_periodic .filter(|p| p.1 > 1 && !p.0.is_zero()) @@ -304,7 +310,8 @@ impl Module { Agenda::::append(when, s); let index = Agenda::::decode_len(when).unwrap_or(1) as u32 - 1; Self::deposit_event(RawEvent::Scheduled(when, index)); - (when, index) + + Ok((when, index)) } fn do_cancel((when, index): TaskAddress) -> Result<(), DispatchError> { @@ -331,6 +338,10 @@ impl Module { return Err(Error::::FailedToSchedule)? } + if when <= frame_system::Module::::block_number() { + return Err(Error::::TargetBlockNumberInPast.into()) + } + // sanitize maybe_periodic let maybe_periodic = maybe_periodic .filter(|p| p.1 > 1 && !p.0.is_zero()) @@ -343,6 +354,7 @@ impl Module { let address = (when, index); Lookup::::insert(&id, &address); Self::deposit_event(RawEvent::Scheduled(when, index)); + Ok(address) } @@ -366,7 +378,7 @@ impl schedule::Anon::Call> for Module maybe_periodic: Option>, priority: schedule::Priority, call: ::Call - ) -> Self::Address { + ) -> Result { Self::do_schedule(when, maybe_periodic, priority, call) } @@ -399,8 +411,7 @@ mod tests { use frame_support::{ impl_outer_event, impl_outer_origin, impl_outer_dispatch, parameter_types, assert_ok, - traits::{OnInitialize, OnFinalize, Filter}, - weights::constants::RocksDbWeight, + assert_err, traits::{OnInitialize, OnFinalize, Filter}, weights::constants::RocksDbWeight, }; use sp_core::H256; // The testing primitives are very useful for avoiding having to work with signatures @@ -551,7 +562,7 @@ mod tests { new_test_ext().execute_with(|| { let call = Call::Logger(logger::Call::log(42, 1000)); assert!(!::BaseCallFilter::filter(&call)); - Scheduler::do_schedule(4, None, 127, call); + let _ = Scheduler::do_schedule(4, None, 127, call); run_to_block(3); assert!(logger::log().is_empty()); run_to_block(4); @@ -565,7 +576,7 @@ mod tests { fn periodic_scheduling_works() { new_test_ext().execute_with(|| { // at #4, every 3 blocks, 3 times. - Scheduler::do_schedule(4, Some((3, 3)), 127, Call::Logger(logger::Call::log(42, 1000))); + let _ = Scheduler::do_schedule(4, Some((3, 3)), 127, Call::Logger(logger::Call::log(42, 1000))); run_to_block(3); assert!(logger::log().is_empty()); run_to_block(4); @@ -588,7 +599,7 @@ mod tests { new_test_ext().execute_with(|| { // at #4. Scheduler::do_schedule_named(1u32.encode(), 4, None, 127, Call::Logger(logger::Call::log(69, 1000))).unwrap(); - let i = Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(42, 1000))); + let i = Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(42, 1000))).unwrap(); run_to_block(3); assert!(logger::log().is_empty()); assert_ok!(Scheduler::do_cancel_named(1u32.encode())); @@ -621,8 +632,8 @@ mod tests { #[test] fn scheduler_respects_weight_limits() { new_test_ext().execute_with(|| { - Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); - Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); // 69 and 42 do not fit together run_to_block(4); assert_eq!(logger::log(), vec![42u32]); @@ -634,8 +645,8 @@ mod tests { #[test] fn scheduler_respects_hard_deadlines_more() { new_test_ext().execute_with(|| { - Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); - Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); // With base weights, 69 and 42 should not fit together, but do because of hard deadlines run_to_block(4); assert_eq!(logger::log(), vec![42u32, 69u32]); @@ -645,8 +656,8 @@ mod tests { #[test] fn scheduler_respects_priority_ordering() { new_test_ext().execute_with(|| { - Scheduler::do_schedule(4, None, 1, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); - Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 1, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule(4, None, 0, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); run_to_block(4); assert_eq!(logger::log(), vec![69u32, 42u32]); }); @@ -655,9 +666,24 @@ mod tests { #[test] fn scheduler_respects_priority_ordering_with_soft_deadlines() { new_test_ext().execute_with(|| { - Scheduler::do_schedule(4, None, 255, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))); - Scheduler::do_schedule(4, None, 127, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); - Scheduler::do_schedule(4, None, 126, Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule( + 4, + None, + 255, + Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3)), + ); + let _ = Scheduler::do_schedule( + 4, + None, + 127, + Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2)), + ); + let _ = Scheduler::do_schedule( + 4, + None, + 126, + Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2)), + ); // 2600 does not fit with 69 or 42, but has higher priority, so will go through run_to_block(4); @@ -679,11 +705,27 @@ mod tests { // Named assert_ok!(Scheduler::do_schedule_named(1u32.encode(), 1, None, 255, Call::Logger(logger::Call::log(3, MaximumSchedulerWeight::get() / 3)))); // Anon Periodic - Scheduler::do_schedule(1, Some((1000, 3)), 128, Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3))); + let _ = Scheduler::do_schedule( + 1, + Some((1000, 3)), + 128, + Call::Logger(logger::Call::log(42, MaximumSchedulerWeight::get() / 3)), + ); // Anon - Scheduler::do_schedule(1, None, 127, Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2))); + let _ = Scheduler::do_schedule( + 1, + None, + 127, + Call::Logger(logger::Call::log(69, MaximumSchedulerWeight::get() / 2)), + ); // Named Periodic - assert_ok!(Scheduler::do_schedule_named(2u32.encode(), 1, Some((1000, 3)), 126, Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2)))); + assert_ok!(Scheduler::do_schedule_named( + 2u32.encode(), + 1, + Some((1000, 3)), + 126, + Call::Logger(logger::Call::log(2600, MaximumSchedulerWeight::get() / 2)), + )); // Will include the named periodic only let actual_weight = Scheduler::on_initialize(1); @@ -727,4 +769,29 @@ mod tests { assert!(logger::log().is_empty()); }); } + + #[test] + fn fails_to_schedule_task_in_the_past() { + new_test_ext().execute_with(|| { + run_to_block(3); + + let call = Box::new(Call::Logger(logger::Call::log(69, 1000))); + let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000))); + + assert_err!( + Scheduler::schedule_named(Origin::root(), 1u32.encode(), 2, None, 127, call), + Error::::TargetBlockNumberInPast, + ); + + assert_err!( + Scheduler::schedule(Origin::root(), 2, None, 127, call2.clone()), + Error::::TargetBlockNumberInPast, + ); + + assert_err!( + Scheduler::schedule(Origin::root(), 3, None, 127, call2), + Error::::TargetBlockNumberInPast, + ); + }); + } } diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 9a2dbf2b29..625f216b1b 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -1501,7 +1501,7 @@ pub mod schedule { maybe_periodic: Option>, priority: Priority, call: Call - ) -> Self::Address; + ) -> Result; /// Cancel a scheduled task. If periodic, then it will cancel all further instances of that, /// also. -- GitLab From 4c03656ac128b22ae813617727386541a1c10be8 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 23 Jun 2020 17:25:42 +0200 Subject: [PATCH 231/280] client/network/service: Add primary dimension to connection metrics (#6472) * client/network/service: Add primary dimension to connection metrics Two nodes can be interconnected via one or more connections. The first of those connections is called the primary connection. This commit adds another dimension to the `sub_libp2p_connections_{closed,opened}_total` metrics to differentiate primary and non-primary connections being opened / closed. By intuition more than one connection between two nodes is rare. Tracking the fact whether a connection is primary or not will help prove or disprove this intuition. * .maintain/monitoring: Ensure to sum over all connections_closed variants * client/network/service: Rename is_primary to is_first * client/network/service: Split by metric name with two additional metrics * Revert ".maintain/monitoring: Ensure to sum over all connections_closed variants" This reverts commit 2d2f93e414440b9fc9e8f7fae6fe48bd95af6b8f. * client/network/service: Remove labels from distinct metrics --- client/network/src/service.rs | 58 ++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 93560a6c0b..8cce3367f7 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -854,6 +854,8 @@ struct Metrics { // This list is ordered alphabetically connections_closed_total: CounterVec, connections_opened_total: CounterVec, + distinct_peers_connections_closed_total: Counter, + distinct_peers_connections_opened_total: Counter, import_queue_blocks_submitted: Counter, import_queue_finality_proofs_submitted: Counter, import_queue_justifications_submitted: Counter, @@ -889,17 +891,25 @@ impl Metrics { connections_closed_total: register(CounterVec::new( Opts::new( "sub_libp2p_connections_closed_total", - "Total number of connections closed, by reason and direction" + "Total number of connections closed, by direction and reason" ), &["direction", "reason"] )?, registry)?, connections_opened_total: register(CounterVec::new( Opts::new( "sub_libp2p_connections_opened_total", - "Total number of connections opened" + "Total number of connections opened by direction" ), &["direction"] )?, registry)?, + distinct_peers_connections_closed_total: register(Counter::new( + "sub_libp2p_distinct_peers_connections_closed_total", + "Total number of connections closed with distinct peers" + )?, registry)?, + distinct_peers_connections_opened_total: register(Counter::new( + "sub_libp2p_distinct_peers_connections_opened_total", + "Total number of connections opened with distinct peers" + )?, registry)?, import_queue_blocks_submitted: register(Counter::new( "import_queue_blocks_submitted", "Number of blocks submitted to the import queue.", @@ -1214,40 +1224,44 @@ impl Future for NetworkWorker { } this.event_streams.send(ev); }, - Poll::Ready(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { + Poll::Ready(SwarmEvent::ConnectionEstablished { peer_id, endpoint, num_established }) => { trace!(target: "sub-libp2p", "Libp2p => Connected({:?})", peer_id); + if let Some(metrics) = this.metrics.as_ref() { - match endpoint { - ConnectedPoint::Dialer { .. } => - metrics.connections_opened_total.with_label_values(&["out"]).inc(), - ConnectedPoint::Listener { .. } => - metrics.connections_opened_total.with_label_values(&["in"]).inc(), + let direction = match endpoint { + ConnectedPoint::Dialer { .. } => "out", + ConnectedPoint::Listener { .. } => "in", + }; + metrics.connections_opened_total.with_label_values(&[direction]).inc(); + + if num_established.get() == 1 { + metrics.distinct_peers_connections_opened_total.inc(); } } }, - Poll::Ready(SwarmEvent::ConnectionClosed { peer_id, cause, endpoint, .. }) => { + Poll::Ready(SwarmEvent::ConnectionClosed { peer_id, cause, endpoint, num_established }) => { trace!(target: "sub-libp2p", "Libp2p => Disconnected({:?}, {:?})", peer_id, cause); if let Some(metrics) = this.metrics.as_ref() { - let dir = match endpoint { + let direction = match endpoint { ConnectedPoint::Dialer { .. } => "out", ConnectedPoint::Listener { .. } => "in", }; - - match cause { - ConnectionError::IO(_) => - metrics.connections_closed_total.with_label_values(&[dir, "transport-error"]).inc(), + let reason = match cause { + ConnectionError::IO(_) => "transport-error", ConnectionError::Handler(NodeHandlerWrapperError::Handler(EitherError::A(EitherError::A( EitherError::A(EitherError::A(EitherError::B( - EitherError::A(PingFailure::Timeout)))))))) => - metrics.connections_closed_total.with_label_values(&[dir, "ping-timeout"]).inc(), + EitherError::A(PingFailure::Timeout)))))))) => "ping-timeout", ConnectionError::Handler(NodeHandlerWrapperError::Handler(EitherError::A(EitherError::A( EitherError::A(EitherError::A(EitherError::A( - EitherError::B(LegacyConnectionKillError)))))))) => - metrics.connections_closed_total.with_label_values(&[dir, "force-closed"]).inc(), - ConnectionError::Handler(NodeHandlerWrapperError::Handler(_)) => - metrics.connections_closed_total.with_label_values(&[dir, "protocol-error"]).inc(), - ConnectionError::Handler(NodeHandlerWrapperError::KeepAliveTimeout) => - metrics.connections_closed_total.with_label_values(&[dir, "keep-alive-timeout"]).inc(), + EitherError::B(LegacyConnectionKillError)))))))) => "force-closed", + ConnectionError::Handler(NodeHandlerWrapperError::Handler(_)) => "protocol-error", + ConnectionError::Handler(NodeHandlerWrapperError::KeepAliveTimeout) => "keep-alive-timeout", + }; + metrics.connections_closed_total.with_label_values(&[direction, reason]).inc(); + + // `num_established` represents the number of *remaining* connections. + if num_established == 0 { + metrics.distinct_peers_connections_closed_total.inc(); } } }, -- GitLab From d59281fa594df991cf94c4ac32a41de6eea26549 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Tue, 23 Jun 2020 17:26:00 +0200 Subject: [PATCH 232/280] Ensure the listen addresses are consistent with the transport (#6436) * Initial commit Forked at: 0c42cedaac0b1bf3a608031ee3e494b51bfaa0fe No parent branch. * Ensure the listen addresses are consistent with the transport * Update client/network/src/error.rs * Update client/network/src/service.rs * Better implementation * Fix bad previous impl * add boot_nodes * reserved nodes * test boot nodes * reserved nodes tests * add public_addresses and make specific error type * Update client/network/src/error.rs Co-authored-by: Pierre Krieger Co-authored-by: Pierre Krieger --- client/network/src/error.rs | 15 +++- client/network/src/service.rs | 55 +++++++++++++ client/network/src/service/tests.rs | 118 ++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+), 1 deletion(-) diff --git a/client/network/src/error.rs b/client/network/src/error.rs index fed7a331da..b87e495983 100644 --- a/client/network/src/error.rs +++ b/client/network/src/error.rs @@ -18,6 +18,7 @@ //! Substrate network possible errors. +use crate::config::TransportConfig; use libp2p::{PeerId, Multiaddr}; use std::fmt; @@ -48,7 +49,18 @@ pub enum Error { second_id: PeerId, }, /// Prometheus metrics error. - Prometheus(prometheus_endpoint::PrometheusError) + Prometheus(prometheus_endpoint::PrometheusError), + /// The network addresses are invalid because they don't match the transport. + #[display( + fmt = "The following addresses are invalid because they don't match the transport: {:?}", + addresses, + )] + AddressesForAnotherTransport { + /// Transport used. + transport: TransportConfig, + /// The invalid addresses. + addresses: Vec, + }, } // Make `Debug` use the `Display` implementation. @@ -65,6 +77,7 @@ impl std::error::Error for Error { Error::Client(ref err) => Some(err), Error::DuplicateBootnode { .. } => None, Error::Prometheus(ref err) => Some(err), + Error::AddressesForAnotherTransport { .. } => None, } } } diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 8cce3367f7..2ef6b7bc21 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -107,6 +107,24 @@ impl NetworkWorker { /// for the network processing to advance. From it, you can extract a `NetworkService` using /// `worker.service()`. The `NetworkService` can be shared through the codebase. pub fn new(params: Params) -> Result, Error> { + // Ensure the listen addresses are consistent with the transport. + ensure_addresses_consistent_with_transport( + params.network_config.listen_addresses.iter(), + ¶ms.network_config.transport, + )?; + ensure_addresses_consistent_with_transport( + params.network_config.boot_nodes.iter().map(|x| &x.multiaddr), + ¶ms.network_config.transport, + )?; + ensure_addresses_consistent_with_transport( + params.network_config.reserved_nodes.iter().map(|x| &x.multiaddr), + ¶ms.network_config.transport, + )?; + ensure_addresses_consistent_with_transport( + params.network_config.public_addresses.iter(), + ¶ms.network_config.transport, + )?; + let (to_worker, from_worker) = tracing_unbounded("mpsc_network_worker"); if let Some(path) = params.network_config.net_config_path { @@ -1469,3 +1487,40 @@ impl<'a, B: BlockT, H: ExHashT> Link for NetworkLink<'a, B, H> { } } } + +fn ensure_addresses_consistent_with_transport<'a>( + addresses: impl Iterator, + transport: &TransportConfig, +) -> Result<(), Error> { + if matches!(transport, TransportConfig::MemoryOnly) { + let addresses: Vec<_> = addresses + .filter(|x| x.iter() + .any(|y| !matches!(y, libp2p::core::multiaddr::Protocol::Memory(_))) + ) + .cloned() + .collect(); + + if !addresses.is_empty() { + return Err(Error::AddressesForAnotherTransport { + transport: transport.clone(), + addresses, + }); + } + } else { + let addresses: Vec<_> = addresses + .filter(|x| x.iter() + .any(|y| matches!(y, libp2p::core::multiaddr::Protocol::Memory(_))) + ) + .cloned() + .collect(); + + if !addresses.is_empty() { + return Err(Error::AddressesForAnotherTransport { + transport: transport.clone(), + addresses, + }); + } + } + + Ok(()) +} diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index b2a91af5bd..c027c3be73 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -18,6 +18,7 @@ use crate::{config, Event, NetworkService, NetworkWorker}; +use libp2p::PeerId; use futures::prelude::*; use sp_runtime::traits::{Block as BlockT, Header as _}; use std::{sync::Arc, time::Duration}; @@ -138,6 +139,7 @@ fn build_nodes_one_proto() let (node2, events_stream2) = build_test_full_node(config::NetworkConfiguration { notifications_protocols: vec![(ENGINE_ID, From::from(&b"/foo"[..]))], + listen_addresses: vec![], reserved_nodes: vec![config::MultiaddrWithPeerId { multiaddr: listen_addr, peer_id: node1.local_peer_id().clone(), @@ -342,3 +344,119 @@ fn lots_of_incoming_peers_works() { future::join_all(background_tasks_to_wait).await }); } + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_listen_addresses_consistent_with_transport_memory() { + let listen_addr = config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)]; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + transport: config::TransportConfig::MemoryOnly, + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_listen_addresses_consistent_with_transport_not_memory() { + let listen_addr = config::build_multiaddr![Memory(rand::random::())]; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_boot_node_addresses_consistent_with_transport_memory() { + let listen_addr = config::build_multiaddr![Memory(rand::random::())]; + let boot_node = config::MultiaddrWithPeerId { + multiaddr: config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)], + peer_id: PeerId::random(), + }; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + transport: config::TransportConfig::MemoryOnly, + boot_nodes: vec![boot_node], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_boot_node_addresses_consistent_with_transport_not_memory() { + let listen_addr = config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)]; + let boot_node = config::MultiaddrWithPeerId { + multiaddr: config::build_multiaddr![Memory(rand::random::())], + peer_id: PeerId::random(), + }; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + boot_nodes: vec![boot_node], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_reserved_node_addresses_consistent_with_transport_memory() { + let listen_addr = config::build_multiaddr![Memory(rand::random::())]; + let reserved_node = config::MultiaddrWithPeerId { + multiaddr: config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)], + peer_id: PeerId::random(), + }; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + transport: config::TransportConfig::MemoryOnly, + reserved_nodes: vec![reserved_node], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_reserved_node_addresses_consistent_with_transport_not_memory() { + let listen_addr = config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)]; + let reserved_node = config::MultiaddrWithPeerId { + multiaddr: config::build_multiaddr![Memory(rand::random::())], + peer_id: PeerId::random(), + }; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + reserved_nodes: vec![reserved_node], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_public_addresses_consistent_with_transport_memory() { + let listen_addr = config::build_multiaddr![Memory(rand::random::())]; + let public_address = config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)]; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + transport: config::TransportConfig::MemoryOnly, + public_addresses: vec![public_address], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} + +#[test] +#[should_panic(expected = "don't match the transport")] +fn ensure_public_addresses_consistent_with_transport_not_memory() { + let listen_addr = config::build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(0_u16)]; + let public_address = config::build_multiaddr![Memory(rand::random::())]; + + let _ = build_test_full_node(config::NetworkConfiguration { + listen_addresses: vec![listen_addr.clone()], + public_addresses: vec![public_address], + .. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None) + }); +} -- GitLab From 9a9b248bfd489b8d6d4ee25eac0031630723c876 Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Tue, 23 Jun 2020 19:06:07 +0200 Subject: [PATCH 233/280] pallet-contracts: migrate to nested storage transaction mechanism (#6382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a simple direct storage access module * WIP * Completely migrate to the transactional system. * Format * Fix wasm compilation * Get rid of account_db module * Make deposit event eager * Make restore_to eager * It almost compiles. * Make it compile. * Make the tests compile * Get rid of account_db * Drop the result. * Backport the book keeping. * Fix all remaining tests. * Make it compile for std * Remove a stale TODO marker * Remove another stale TODO * Add proof for `terminate` * Remove a stale comment. * Make restoration diverging. * Remove redudnant trait: `ComputeDispatchFee` * Update frame/contracts/src/exec.rs Co-authored-by: Alexander Theißen * Introduce proper errors into the storage module. * Adds comments for contract storage module. * Inline `ExecutionContext::terminate`. * Restore_to should not let sacrifice itself if the contract present on the stack. * Inline `transfer` function * Update doc - add "if succeeded" * Adapt to TransactionOutcome changes * Updates the docs for `ext_restore_to` * Add a proper assert. * Update frame/contracts/src/wasm/runtime.rs Co-authored-by: Alexander Theißen Co-authored-by: Alexander Theißen Co-authored-by: Alexander Theißen --- Cargo.lock | 1 + frame/contracts/Cargo.toml | 1 + frame/contracts/fixtures/restoration.wat | 6 +- frame/contracts/src/account_db.rs | 450 --------------------- frame/contracts/src/exec.rs | 495 +++++++++++------------ frame/contracts/src/lib.rs | 148 +------ frame/contracts/src/rent.rs | 91 ++++- frame/contracts/src/storage.rs | 195 +++++++++ frame/contracts/src/tests.rs | 150 ++++--- frame/contracts/src/wasm/mod.rs | 20 +- frame/contracts/src/wasm/runtime.rs | 40 +- 11 files changed, 661 insertions(+), 936 deletions(-) delete mode 100644 frame/contracts/src/account_db.rs create mode 100644 frame/contracts/src/storage.rs diff --git a/Cargo.lock b/Cargo.lock index 64524d8c52..08e5102d34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4009,6 +4009,7 @@ dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "parity-wasm 0.41.0", + "pretty_assertions", "pwasm-utils", "serde", "sp-core", diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index b2ba8d014a..57c278a3fb 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -31,6 +31,7 @@ pallet-transaction-payment = { version = "2.0.0-rc3", default-features = false, wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" +pretty_assertions = "0.6.1" pallet-balances = { version = "2.0.0-rc3", path = "../balances" } pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } pallet-randomness-collective-flip = { version = "2.0.0-rc3", path = "../randomness-collective-flip" } diff --git a/frame/contracts/fixtures/restoration.wat b/frame/contracts/fixtures/restoration.wat index 4e11f97d5a..225fdde817 100644 --- a/frame/contracts/fixtures/restoration.wat +++ b/frame/contracts/fixtures/restoration.wat @@ -1,6 +1,10 @@ (module (import "env" "ext_set_storage" (func $ext_set_storage (param i32 i32 i32))) - (import "env" "ext_restore_to" (func $ext_restore_to (param i32 i32 i32 i32 i32 i32 i32 i32))) + (import "env" "ext_restore_to" + (func $ext_restore_to + (param i32 i32 i32 i32 i32 i32 i32 i32) + ) + ) (import "env" "memory" (memory 1 1)) (func (export "call") diff --git a/frame/contracts/src/account_db.rs b/frame/contracts/src/account_db.rs deleted file mode 100644 index 5e1b0c34b5..0000000000 --- a/frame/contracts/src/account_db.rs +++ /dev/null @@ -1,450 +0,0 @@ -// Copyright 2018-2020 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Substrate. If not, see . - -//! Auxiliaries to help with managing partial changes to accounts state. - -use super::{ - AliveContractInfo, BalanceOf, CodeHash, ContractInfo, ContractInfoOf, Trait, TrieId, - TrieIdGenerator, -}; -use crate::exec::StorageKey; -use sp_std::cell::RefCell; -use sp_std::collections::btree_map::{BTreeMap, Entry}; -use sp_std::prelude::*; -use sp_io::hashing::blake2_256; -use sp_runtime::traits::{Bounded, Zero}; -use frame_support::traits::{Currency, Imbalance, SignedImbalance}; -use frame_support::{storage::child, StorageMap}; -use frame_system; - -// Note: we don't provide Option because we can't create -// the trie_id in the overlay, thus we provide an overlay on the fields -// specifically. -pub struct ChangeEntry { - /// If Some(_), then the account balance is modified to the value. If None and `reset` is false, - /// the balance unmodified. If None and `reset` is true, the balance is reset to 0. - balance: Option>, - /// If Some(_), then a contract is instantiated with the code hash. If None and `reset` is false, - /// then the contract code is unmodified. If None and `reset` is true, the contract is deleted. - code_hash: Option>, - /// If Some(_), then the rent allowance is set to the value. If None and `reset` is false, then - /// the rent allowance is unmodified. If None and `reset` is true, the contract is deleted. - rent_allowance: Option>, - storage: BTreeMap>>, - /// If true, indicates that the existing contract and all its storage entries should be removed - /// and replaced with the fields on this change entry. Otherwise, the fields on this change - /// entry are updates merged into the existing contract info and storage. - reset: bool, -} - -impl ChangeEntry { - fn balance(&self) -> Option> { - self.balance.or_else(|| { - if self.reset { - Some(>::zero()) - } else { - None - } - }) - } - - fn code_hash(&self) -> Option>> { - if self.reset { - Some(self.code_hash) - } else { - self.code_hash.map(Some) - } - } - - fn rent_allowance(&self) -> Option>> { - if self.reset { - Some(self.rent_allowance) - } else { - self.rent_allowance.map(Some) - } - } - - fn storage(&self, location: &StorageKey) -> Option>> { - let value = self.storage.get(location).cloned(); - if self.reset { - Some(value.unwrap_or(None)) - } else { - value - } - } -} - -// Cannot derive(Default) since it erroneously bounds T by Default. -impl Default for ChangeEntry { - fn default() -> Self { - ChangeEntry { - rent_allowance: Default::default(), - balance: Default::default(), - code_hash: Default::default(), - storage: Default::default(), - reset: false, - } - } -} - -pub type ChangeSet = BTreeMap<::AccountId, ChangeEntry>; - -pub trait AccountDb { - /// Account is used when overlayed otherwise trie_id must be provided. - /// This is for performance reason. - /// - /// Trie id is None iff account doesn't have an associated trie id in >. - /// Because DirectAccountDb bypass the lookup for this association. - fn get_storage( - &self, - account: &T::AccountId, - trie_id: Option<&TrieId>, - location: &StorageKey, - ) -> Option>; - /// If account has an alive contract then return the code hash associated. - fn get_code_hash(&self, account: &T::AccountId) -> Option>; - /// If account has an alive contract then return the rent allowance associated. - fn get_rent_allowance(&self, account: &T::AccountId) -> Option>; - /// Returns false iff account has no alive contract nor tombstone. - fn contract_exists(&self, account: &T::AccountId) -> bool; - fn get_balance(&self, account: &T::AccountId) -> BalanceOf; - - fn commit(&mut self, change_set: ChangeSet); -} - -pub struct DirectAccountDb; -impl AccountDb for DirectAccountDb { - fn get_storage( - &self, - _account: &T::AccountId, - trie_id: Option<&TrieId>, - location: &StorageKey, - ) -> Option> { - trie_id - .and_then(|id| child::get_raw(&crate::child_trie_info(&id[..]), &blake2_256(location))) - } - fn get_code_hash(&self, account: &T::AccountId) -> Option> { - >::get(account).and_then(|i| i.as_alive().map(|i| i.code_hash)) - } - fn get_rent_allowance(&self, account: &T::AccountId) -> Option> { - >::get(account).and_then(|i| i.as_alive().map(|i| i.rent_allowance)) - } - fn contract_exists(&self, account: &T::AccountId) -> bool { - >::contains_key(account) - } - fn get_balance(&self, account: &T::AccountId) -> BalanceOf { - T::Currency::free_balance(account) - } - fn commit(&mut self, s: ChangeSet) { - let mut total_imbalance = SignedImbalance::zero(); - for (address, changed) in s.into_iter() { - if let Some(balance) = changed.balance() { - let imbalance = T::Currency::make_free_balance_be(&address, balance); - total_imbalance = total_imbalance.merge(imbalance); - } - - if changed.code_hash().is_some() - || changed.rent_allowance().is_some() - || !changed.storage.is_empty() - || changed.reset - { - let old_info = match >::get(&address) { - Some(ContractInfo::Alive(alive)) => Some(alive), - None => None, - // Cannot commit changes to tombstone contract - Some(ContractInfo::Tombstone(_)) => continue, - }; - - let mut new_info = match (changed.reset, old_info.clone(), changed.code_hash) { - // Existing contract is being modified. - (false, Some(info), _) => info, - // Existing contract is being removed. - (true, Some(info), None) => { - child::kill_storage(&info.child_trie_info()); - >::remove(&address); - continue; - } - // Existing contract is being replaced by a new one. - (true, Some(info), Some(code_hash)) => { - child::kill_storage(&info.child_trie_info()); - AliveContractInfo:: { - code_hash, - storage_size: 0, - empty_pair_count: 0, - total_pair_count: 0, - trie_id: ::TrieIdGenerator::trie_id(&address), - deduct_block: >::block_number(), - rent_allowance: >::max_value(), - last_write: None, - } - } - // New contract is being instantiated. - (_, None, Some(code_hash)) => AliveContractInfo:: { - code_hash, - storage_size: 0, - empty_pair_count: 0, - total_pair_count: 0, - trie_id: ::TrieIdGenerator::trie_id(&address), - deduct_block: >::block_number(), - rent_allowance: >::max_value(), - last_write: None, - }, - // There is no existing at the address nor a new one to be instantiated. - (_, None, None) => continue, - }; - - if let Some(rent_allowance) = changed.rent_allowance { - new_info.rent_allowance = rent_allowance; - } - - if let Some(code_hash) = changed.code_hash { - new_info.code_hash = code_hash; - } - - if !changed.storage.is_empty() { - new_info.last_write = Some(>::block_number()); - } - - // NB: this call allocates internally. To keep allocations to the minimum we cache - // the child trie info here. - let child_trie_info = new_info.child_trie_info(); - - // Here we iterate over all storage key-value pairs that were changed throughout the - // execution of a contract and apply them to the substrate storage. - for (key, opt_new_value) in changed.storage.into_iter() { - let hashed_key = blake2_256(&key); - - // In order to correctly update the book keeping we need to fetch the previous - // value of the key-value pair. - // - // It might be a bit more clean if we had an API that supported getting the size - // of the value without going through the loading of it. But at the moment of - // writing, there is no such API. - // - // That's not a show stopper in any case, since the performance cost is - // dominated by the trie traversal anyway. - let opt_prev_value = child::get_raw(&child_trie_info, &hashed_key); - - // Update the total number of KV pairs and the number of empty pairs. - match (&opt_prev_value, &opt_new_value) { - (Some(prev_value), None) => { - new_info.total_pair_count -= 1; - if prev_value.is_empty() { - new_info.empty_pair_count -= 1; - } - }, - (None, Some(new_value)) => { - new_info.total_pair_count += 1; - if new_value.is_empty() { - new_info.empty_pair_count += 1; - } - }, - (Some(prev_value), Some(new_value)) => { - if prev_value.is_empty() { - new_info.empty_pair_count -= 1; - } - if new_value.is_empty() { - new_info.empty_pair_count += 1; - } - } - (None, None) => {} - } - - // Update the total storage size. - let prev_value_len = opt_prev_value - .as_ref() - .map(|old_value| old_value.len() as u32) - .unwrap_or(0); - let new_value_len = opt_new_value - .as_ref() - .map(|new_value| new_value.len() as u32) - .unwrap_or(0); - new_info.storage_size = new_info - .storage_size - .saturating_add(new_value_len) - .saturating_sub(prev_value_len); - - // Finally, perform the change on the storage. - match opt_new_value { - Some(new_value) => child::put_raw(&child_trie_info, &hashed_key, &new_value[..]), - None => child::kill(&child_trie_info, &hashed_key), - } - } - - if old_info - .map(|old_info| old_info != new_info) - .unwrap_or(true) - { - >::insert(&address, ContractInfo::Alive(new_info)); - } - } - } - - match total_imbalance { - // If we've detected a positive imbalance as a result of our contract-level machinations - // then it's indicative of a buggy contracts system. - // Panicking is far from ideal as it opens up a DoS attack on block validators, however - // it's a less bad option than allowing arbitrary value to be created. - SignedImbalance::Positive(ref p) if !p.peek().is_zero() => { - panic!("contract subsystem resulting in positive imbalance!") - } - _ => {} - } - } -} - -pub struct OverlayAccountDb<'a, T: Trait + 'a> { - local: RefCell>, - underlying: &'a dyn AccountDb, -} -impl<'a, T: Trait> OverlayAccountDb<'a, T> { - pub fn new(underlying: &'a dyn AccountDb) -> OverlayAccountDb<'a, T> { - OverlayAccountDb { - local: RefCell::new(ChangeSet::new()), - underlying, - } - } - - pub fn into_change_set(self) -> ChangeSet { - self.local.into_inner() - } - - pub fn set_storage( - &mut self, - account: &T::AccountId, - location: StorageKey, - value: Option>, - ) { - self.local - .borrow_mut() - .entry(account.clone()) - .or_insert(Default::default()) - .storage - .insert(location, value); - } - - /// Return an error if contract already exists (either if it is alive or tombstone) - pub fn instantiate_contract( - &mut self, - account: &T::AccountId, - code_hash: CodeHash, - ) -> Result<(), &'static str> { - if self.contract_exists(account) { - return Err("Alive contract or tombstone already exists"); - } - - let mut local = self.local.borrow_mut(); - let contract = local.entry(account.clone()).or_default(); - - contract.code_hash = Some(code_hash); - contract.rent_allowance = Some(>::max_value()); - - Ok(()) - } - - /// Mark a contract as deleted. - pub fn destroy_contract(&mut self, account: &T::AccountId) { - let mut local = self.local.borrow_mut(); - local.insert( - account.clone(), - ChangeEntry { - reset: true, - ..Default::default() - }, - ); - } - - /// Assume contract exists - pub fn set_rent_allowance(&mut self, account: &T::AccountId, rent_allowance: BalanceOf) { - self.local - .borrow_mut() - .entry(account.clone()) - .or_insert(Default::default()) - .rent_allowance = Some(rent_allowance); - } - pub fn set_balance(&mut self, account: &T::AccountId, balance: BalanceOf) { - self.local - .borrow_mut() - .entry(account.clone()) - .or_insert(Default::default()) - .balance = Some(balance); - } -} - -impl<'a, T: Trait> AccountDb for OverlayAccountDb<'a, T> { - fn get_storage( - &self, - account: &T::AccountId, - trie_id: Option<&TrieId>, - location: &StorageKey, - ) -> Option> { - self.local - .borrow() - .get(account) - .and_then(|changes| changes.storage(location)) - .unwrap_or_else(|| self.underlying.get_storage(account, trie_id, location)) - } - fn get_code_hash(&self, account: &T::AccountId) -> Option> { - self.local - .borrow() - .get(account) - .and_then(|changes| changes.code_hash()) - .unwrap_or_else(|| self.underlying.get_code_hash(account)) - } - fn get_rent_allowance(&self, account: &T::AccountId) -> Option> { - self.local - .borrow() - .get(account) - .and_then(|changes| changes.rent_allowance()) - .unwrap_or_else(|| self.underlying.get_rent_allowance(account)) - } - fn contract_exists(&self, account: &T::AccountId) -> bool { - self.local - .borrow() - .get(account) - .and_then(|changes| changes.code_hash().map(|code_hash| code_hash.is_some())) - .unwrap_or_else(|| self.underlying.contract_exists(account)) - } - fn get_balance(&self, account: &T::AccountId) -> BalanceOf { - self.local - .borrow() - .get(account) - .and_then(|changes| changes.balance()) - .unwrap_or_else(|| self.underlying.get_balance(account)) - } - fn commit(&mut self, s: ChangeSet) { - let mut local = self.local.borrow_mut(); - - for (address, changed) in s.into_iter() { - match local.entry(address) { - Entry::Occupied(e) => { - let mut value = e.into_mut(); - if changed.reset { - *value = changed; - } else { - value.balance = changed.balance.or(value.balance); - value.code_hash = changed.code_hash.or(value.code_hash); - value.rent_allowance = changed.rent_allowance.or(value.rent_allowance); - value.storage.extend(changed.storage.into_iter()); - } - } - Entry::Vacant(e) => { - e.insert(changed); - } - } - } - } -} diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 9cc1c50260..ff0d4d9dc0 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -15,16 +15,16 @@ // along with Substrate. If not, see . use super::{CodeHash, Config, ContractAddressFor, Event, RawEvent, Trait, - TrieId, BalanceOf, ContractInfo}; -use crate::account_db::{AccountDb, DirectAccountDb, OverlayAccountDb}; + TrieId, BalanceOf, ContractInfo, TrieIdGenerator}; use crate::gas::{Gas, GasMeter, Token}; use crate::rent; +use crate::storage; use sp_std::prelude::*; -use sp_runtime::traits::{Bounded, CheckedAdd, CheckedSub, Zero}; +use sp_runtime::traits::{Bounded, Zero}; use frame_support::{ storage::unhashed, dispatch::DispatchError, - traits::{WithdrawReason, Currency, Time, Randomness}, + traits::{ExistenceRequirement, Currency, Time, Randomness}, }; pub type AccountIdOf = ::AccountId; @@ -105,8 +105,8 @@ pub trait Ext { fn get_storage(&self, key: &StorageKey) -> Option>; /// Sets the storage entry by the given key to the specified value. If `value` is `None` then - /// the storage entry is deleted. Returns an Err if the value size is too large. - fn set_storage(&mut self, key: StorageKey, value: Option>) -> Result<(), &'static str>; + /// the storage entry is deleted. + fn set_storage(&mut self, key: StorageKey, value: Option>); /// Instantiate a contract from the given code. /// @@ -129,6 +129,12 @@ pub trait Ext { ) -> Result<(), DispatchError>; /// Transfer all funds to `beneficiary` and delete the contract. + /// + /// Since this function removes the self contract eagerly, if succeeded, no further actions should + /// be performed on this `Ext` instance. + /// + /// This function will fail if the same contract is present on the contract + /// call stack. fn terminate( &mut self, beneficiary: &AccountIdOf, @@ -147,14 +153,20 @@ pub trait Ext { /// Notes a call dispatch. fn note_dispatch_call(&mut self, call: CallOf); - /// Notes a restoration request. - fn note_restore_to( + /// Restores the given destination contract sacrificing the current one. + /// + /// Since this function removes the self contract eagerly, if succeeded, no further actions should + /// be performed on this `Ext` instance. + /// + /// This function will fail if the same contract is present + /// on the contract call stack. + fn restore_to( &mut self, dest: AccountIdOf, code_hash: CodeHash, rent_allowance: BalanceOf, delta: Vec, - ); + ) -> Result<(), &'static str>; /// Returns a reference to the account id of the caller. fn caller(&self) -> &AccountIdOf; @@ -264,38 +276,18 @@ impl Token for ExecFeeToken { #[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq, Clone))] #[derive(sp_runtime::RuntimeDebug)] pub enum DeferredAction { - DepositEvent { - /// A list of topics this event will be deposited with. - topics: Vec, - /// The event to deposit. - event: Event, - }, DispatchRuntimeCall { /// The account id of the contract who dispatched this call. origin: T::AccountId, /// The call to dispatch. call: ::Call, }, - RestoreTo { - /// The account id of the contract which is removed during the restoration and transfers - /// its storage to the restored contract. - donor: T::AccountId, - /// The account id of the restored contract. - dest: T::AccountId, - /// The code hash of the restored contract. - code_hash: CodeHash, - /// The initial rent allowance to set. - rent_allowance: BalanceOf, - /// The keys to delete upon restoration. - delta: Vec, - }, } pub struct ExecutionContext<'a, T: Trait + 'a, V, L> { pub caller: Option<&'a ExecutionContext<'a, T, V, L>>, pub self_account: T::AccountId, pub self_trie_id: Option, - pub overlay: OverlayAccountDb<'a, T>, pub depth: usize, pub deferred: Vec>, pub config: &'a Config, @@ -320,7 +312,6 @@ where caller: None, self_trie_id: None, self_account: origin, - overlay: OverlayAccountDb::::new(&DirectAccountDb), depth: 0, deferred: Vec::new(), config: &cfg, @@ -338,7 +329,6 @@ where caller: Some(self), self_trie_id: trie_id, self_account: dest, - overlay: OverlayAccountDb::new(&self.overlay), depth: self.depth + 1, deferred: Vec::new(), config: self.config, @@ -349,23 +339,6 @@ where } } - /// Transfer balance to `dest` without calling any contract code. - pub fn transfer( - &mut self, - dest: T::AccountId, - value: BalanceOf, - gas_meter: &mut GasMeter - ) -> Result<(), DispatchError> { - transfer( - gas_meter, - TransferCause::Call, - &self.self_account.clone(), - &dest, - value, - self, - ) - } - /// Make a call to the specified address, optionally transferring some funds. pub fn call( &mut self, @@ -424,8 +397,8 @@ where // If code_hash is not none, then the destination account is a live contract, otherwise // it is a regular account since tombstone accounts have already been rejected. - match nested.overlay.get_code_hash(&dest) { - Some(dest_code_hash) => { + match storage::code_hash::(&dest) { + Ok(dest_code_hash) => { let executable = try_or_exec_error!( nested.loader.load_main(&dest_code_hash), input_data @@ -437,10 +410,9 @@ where input_data, gas_meter, )?; - Ok(output) } - None => Ok(ExecReturnValue { status: STATUS_SUCCESS, data: Vec::new() }), + Err(storage::ContractAbsentError) => Ok(ExecReturnValue { status: STATUS_SUCCESS, data: Vec::new() }), } }) } @@ -477,11 +449,20 @@ where ); // TrieId has not been generated yet and storage is empty since contract is new. - let dest_trie_id = None; + // + // Generate it now. + let dest_trie_id = ::TrieIdGenerator::trie_id(&dest); - let output = self.with_nested_context(dest.clone(), dest_trie_id, |nested| { + let output = self.with_nested_context(dest.clone(), Some(dest_trie_id), |nested| { try_or_exec_error!( - nested.overlay.instantiate_contract(&dest, code_hash.clone()), + storage::place_contract::( + &dest, + nested + .self_trie_id + .clone() + .expect("the nested context always has to have self_trie_id"), + code_hash.clone() + ), input_data ); @@ -512,7 +493,7 @@ where )?; // Error out if insufficient remaining balance. - if nested.overlay.get_balance(&dest) < nested.config.existential_deposit { + if T::Currency::free_balance(&dest) < nested.config.existential_deposit { return Err(ExecError { reason: "insufficient remaining balance".into(), buffer: output.data, @@ -520,10 +501,7 @@ where } // Deposit an instantiation event. - nested.deferred.push(DeferredAction::DepositEvent { - event: RawEvent::Instantiated(caller.clone(), dest.clone()), - topics: Vec::new(), - }); + deposit_event::(vec![], RawEvent::Instantiated(caller.clone(), dest.clone())); Ok(output) })?; @@ -531,32 +509,6 @@ where Ok((dest, output)) } - pub fn terminate( - &mut self, - beneficiary: &T::AccountId, - gas_meter: &mut GasMeter, - ) -> Result<(), DispatchError> { - let self_id = self.self_account.clone(); - let value = self.overlay.get_balance(&self_id); - if let Some(caller) = self.caller { - if caller.is_live(&self_id) { - return Err(DispatchError::Other( - "Cannot terminate a contract that is present on the call stack", - )); - } - } - transfer( - gas_meter, - TransferCause::Terminate, - &self_id, - beneficiary, - value, - self, - )?; - self.overlay.destroy_contract(&self_id); - Ok(()) - } - fn new_call_context<'b>( &'b mut self, caller: T::AccountId, @@ -573,21 +525,26 @@ where } } + /// Execute the given closure within a nested execution context. fn with_nested_context(&mut self, dest: T::AccountId, trie_id: Option, func: F) -> ExecResult where F: FnOnce(&mut ExecutionContext) -> ExecResult { - let (output, change_set, deferred) = { + use frame_support::storage::TransactionOutcome::*; + let (output, deferred) = { let mut nested = self.nested(dest, trie_id); - let output = func(&mut nested)?; - (output, nested.overlay.into_change_set(), nested.deferred) + let output = frame_support::storage::with_transaction(|| { + let output = func(&mut nested); + match output { + Ok(ref rv) if rv.is_success() => Commit(output), + _ => Rollback(output), + } + })?; + (output, nested.deferred) }; - if output.is_success() { - self.overlay.commit(change_set); self.deferred.extend(deferred); } - Ok(output) } @@ -676,48 +633,27 @@ fn transfer<'a, T: Trait, V: Vm, L: Loader>( Err("not enough gas to pay transfer fee")? } - // We allow balance to go below the existential deposit here: - let from_balance = ctx.overlay.get_balance(transactor); - let new_from_balance = match from_balance.checked_sub(&value) { - Some(b) => b, - None => Err("balance too low to send value")?, - }; - let to_balance = ctx.overlay.get_balance(dest); - if to_balance.is_zero() && value < ctx.config.existential_deposit { - Err("value too low to create account")? - } - // Only ext_terminate is allowed to bring the sender below the existential deposit - let required_balance = match cause { - Terminate => 0.into(), - _ => ctx.config.existential_deposit - }; - - T::Currency::ensure_can_withdraw( - transactor, - value, - WithdrawReason::Transfer.into(), - new_from_balance.checked_sub(&required_balance) - .ok_or("brings sender below existential deposit")?, - )?; - - let new_to_balance = match to_balance.checked_add(&value) { - Some(b) => b, - None => Err("destination balance too high to receive value")?, + let existence_requirement = match cause { + Terminate => ExistenceRequirement::AllowDeath, + _ => ExistenceRequirement::KeepAlive, }; - - if transactor != dest { - ctx.overlay.set_balance(transactor, new_from_balance); - ctx.overlay.set_balance(dest, new_to_balance); - ctx.deferred.push(DeferredAction::DepositEvent { - event: RawEvent::Transfer(transactor.clone(), dest.clone(), value), - topics: Vec::new(), - }); - } + T::Currency::transfer(transactor, dest, value, existence_requirement)?; Ok(()) } +/// A context that is active within a call. +/// +/// This context has some invariants that must be held at all times. Specifically: +///`ctx` always points to a context of an alive contract. That implies that it has an existent +/// `self_trie_id`. +/// +/// Be advised that there are brief time spans where these invariants could be invalidated. +/// For example, when a contract requests self-termination the contract is removed eagerly. That +/// implies that the control won't be returned to the contract anymore, but there is still some code +/// on the path of the return from that call context. Therefore, care must be taken in these +/// situations. struct CallContext<'a, 'b: 'a, T: Trait + 'b, V: Vm + 'b, L: Loader> { ctx: &'a mut ExecutionContext<'b, T, V, L>, caller: T::AccountId, @@ -735,20 +671,32 @@ where type T = T; fn get_storage(&self, key: &StorageKey) -> Option> { - self.ctx.overlay.get_storage(&self.ctx.self_account, self.ctx.self_trie_id.as_ref(), key) + let trie_id = self.ctx.self_trie_id.as_ref().expect( + "`ctx.self_trie_id` points to an alive contract within the `CallContext`;\ + it cannot be `None`;\ + expect can't fail;\ + qed", + ); + storage::read_contract_storage(trie_id, key) } - fn set_storage(&mut self, key: StorageKey, value: Option>) -> Result<(), &'static str> { - if let Some(ref value) = value { - if self.max_value_size() < value.len() as u32 { - return Err("value size exceeds maximum"); - } + fn set_storage(&mut self, key: StorageKey, value: Option>) { + let trie_id = self.ctx.self_trie_id.as_ref().expect( + "`ctx.self_trie_id` points to an alive contract within the `CallContext`;\ + it cannot be `None`;\ + expect can't fail;\ + qed", + ); + if let Err(storage::ContractAbsentError) = + storage::write_contract_storage::(&self.ctx.self_account, trie_id, &key, value) + { + panic!( + "the contract must be in the alive state within the `CallContext`;\ + the contract cannot be absent in storage; + write_contract_storage cannot return `None`; + qed" + ); } - - self.ctx - .overlay - .set_storage(&self.ctx.self_account, key, value); - Ok(()) } fn instantiate( @@ -767,7 +715,14 @@ where value: BalanceOf, gas_meter: &mut GasMeter, ) -> Result<(), DispatchError> { - self.ctx.transfer(to.clone(), value, gas_meter) + transfer( + gas_meter, + TransferCause::Call, + &self.ctx.self_account.clone(), + &to, + value, + self.ctx, + ) } fn terminate( @@ -775,7 +730,30 @@ where beneficiary: &AccountIdOf, gas_meter: &mut GasMeter, ) -> Result<(), DispatchError> { - self.ctx.terminate(beneficiary, gas_meter) + let self_id = self.ctx.self_account.clone(); + let value = T::Currency::free_balance(&self_id); + if let Some(caller_ctx) = self.ctx.caller { + if caller_ctx.is_live(&self_id) { + return Err(DispatchError::Other( + "Cannot terminate a contract that is present on the call stack", + )); + } + } + transfer( + gas_meter, + TransferCause::Terminate, + &self_id, + beneficiary, + value, + self.ctx, + )?; + let self_trie_id = self.ctx.self_trie_id.as_ref().expect( + "this function is only invoked by in the context of a contract;\ + a contract has a trie id;\ + this can't be None; qed", + ); + storage::destroy_contract::(&self_id, self_trie_id); + Ok(()) } fn call( @@ -795,20 +773,40 @@ where }); } - fn note_restore_to( + fn restore_to( &mut self, dest: AccountIdOf, code_hash: CodeHash, rent_allowance: BalanceOf, delta: Vec, - ) { - self.ctx.deferred.push(DeferredAction::RestoreTo { - donor: self.ctx.self_account.clone(), - dest, - code_hash, + ) -> Result<(), &'static str> { + if let Some(caller_ctx) = self.ctx.caller { + if caller_ctx.is_live(&self.ctx.self_account) { + return Err( + "Cannot perform restoration of a contract that is present on the call stack", + ); + } + } + + let result = crate::rent::restore_to::( + self.ctx.self_account.clone(), + dest.clone(), + code_hash.clone(), rent_allowance, delta, - }); + ); + if let Ok(_) = result { + deposit_event::( + vec![], + RawEvent::Restored( + self.ctx.self_account.clone(), + dest, + code_hash, + rent_allowance, + ), + ); + } + result } fn address(&self) -> &T::AccountId { @@ -820,7 +818,7 @@ where } fn balance(&self) -> BalanceOf { - self.ctx.overlay.get_balance(&self.ctx.self_account) + T::Currency::free_balance(&self.ctx.self_account) } fn value_transferred(&self) -> BalanceOf { @@ -844,18 +842,25 @@ where } fn deposit_event(&mut self, topics: Vec, data: Vec) { - self.ctx.deferred.push(DeferredAction::DepositEvent { + deposit_event::( topics, - event: RawEvent::ContractExecution(self.ctx.self_account.clone(), data), - }); + RawEvent::ContractExecution(self.ctx.self_account.clone(), data) + ); } fn set_rent_allowance(&mut self, rent_allowance: BalanceOf) { - self.ctx.overlay.set_rent_allowance(&self.ctx.self_account, rent_allowance) + if let Err(storage::ContractAbsentError) = + storage::set_rent_allowance::(&self.ctx.self_account, rent_allowance) + { + panic!( + "`self_account` points to an alive contract within the `CallContext`; + set_rent_allowance cannot return `Err`; qed" + ); + } } fn rent_allowance(&self) -> BalanceOf { - self.ctx.overlay.get_rent_allowance(&self.ctx.self_account) + storage::rent_allowance::(&self.ctx.self_account) .unwrap_or(>::max_value()) // Must never be triggered actually } @@ -877,30 +882,37 @@ where } } +fn deposit_event( + topics: Vec, + event: Event, +) { + >::deposit_event_indexed( + &*topics, + ::Event::from(event).into(), + ) +} + /// These tests exercise the executive layer. /// /// In these tests the VM/loader are mocked. Instead of dealing with wasm bytecode they use simple closures. /// This allows you to tackle executive logic more thoroughly without writing a /// wasm VM code. -/// -/// Because it's the executive layer: -/// -/// - no gas meter setup and teardown logic. All balances are *AFTER* gas purchase. -/// - executive layer doesn't alter any storage! #[cfg(test)] mod tests { use super::{ - BalanceOf, ExecFeeToken, ExecutionContext, Ext, Loader, TransferFeeKind, TransferFeeToken, - Vm, ExecResult, RawEvent, DeferredAction, + BalanceOf, Event, ExecFeeToken, ExecResult, ExecutionContext, Ext, Loader, + RawEvent, TransferFeeKind, TransferFeeToken, Vm, }; use crate::{ - account_db::AccountDb, gas::GasMeter, tests::{ExtBuilder, Test}, + gas::GasMeter, tests::{ExtBuilder, Test, MetaEvent}, exec::{ExecReturnValue, ExecError, STATUS_SUCCESS}, CodeHash, Config, gas::Gas, + storage, }; - use std::{cell::RefCell, rc::Rc, collections::HashMap, marker::PhantomData}; - use assert_matches::assert_matches; + use crate::tests::test_utils::{place_contract, set_balance, get_balance}; use sp_runtime::DispatchError; + use assert_matches::assert_matches; + use std::{cell::RefCell, collections::HashMap, marker::PhantomData, rc::Rc}; const ALICE: u64 = 1; const BOB: u64 = 2; @@ -908,19 +920,14 @@ mod tests { const GAS_LIMIT: Gas = 10_000_000_000; - impl<'a, T, V, L> ExecutionContext<'a, T, V, L> - where T: crate::Trait - { - fn events(&self) -> Vec> { - self.deferred - .iter() - .filter(|action| match *action { - DeferredAction::DepositEvent { .. } => true, - _ => false, - }) - .cloned() - .collect() - } + fn events() -> Vec> { + >::events() + .into_iter() + .filter_map(|meta| match meta.event { + MetaEvent::contracts(contract_event) => Some(contract_event), + _ => None, + }) + .collect() } struct MockCtx<'a> { @@ -1029,7 +1036,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, exec_ch).unwrap(); + place_contract(&BOB, exec_ch); assert_matches!( ctx.call(BOB, value, &mut gas_meter, data), @@ -1051,8 +1058,8 @@ mod tests { let loader = MockLoader::empty(); let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 0); + set_balance(&origin, 100); + set_balance(&dest, 0); let mut gas_meter = GasMeter::::new(GAS_LIMIT); @@ -1072,7 +1079,7 @@ mod tests { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); + set_balance(&origin, 100); let mut gas_meter = GasMeter::::new(GAS_LIMIT); @@ -1097,8 +1104,8 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 0); + set_balance(&origin, 100); + set_balance(&dest, 0); let output = ctx.call( dest, @@ -1108,15 +1115,15 @@ mod tests { ).unwrap(); assert!(output.is_success()); - assert_eq!(ctx.overlay.get_balance(&origin), 45); - assert_eq!(ctx.overlay.get_balance(&dest), 55); + assert_eq!(get_balance(&origin), 45); + assert_eq!(get_balance(&dest), 55); }); } #[test] fn changes_are_reverted_on_failing_call() { - // This test verifies that a contract is able to transfer - // some funds to another account. + // This test verifies that changes are reverted on a call which fails (or equally, returns + // a non-zero status code). let origin = ALICE; let dest = BOB; @@ -1129,9 +1136,9 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, return_ch).unwrap(); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 0); + place_contract(&BOB, return_ch); + set_balance(&origin, 100); + set_balance(&dest, 0); let output = ctx.call( dest, @@ -1141,8 +1148,8 @@ mod tests { ).unwrap(); assert!(!output.is_success()); - assert_eq!(ctx.overlay.get_balance(&origin), 100); - assert_eq!(ctx.overlay.get_balance(&dest), 0); + assert_eq!(get_balance(&origin), 100); + assert_eq!(get_balance(&dest), 0); }); } @@ -1159,8 +1166,8 @@ mod tests { let loader = MockLoader::empty(); let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 0); + set_balance(&origin, 100); + set_balance(&dest, 0); let mut gas_meter = GasMeter::::new(GAS_LIMIT); @@ -1184,8 +1191,8 @@ mod tests { let loader = MockLoader::empty(); let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 15); + set_balance(&origin, 100); + set_balance(&dest, 15); let mut gas_meter = GasMeter::::new(GAS_LIMIT); @@ -1212,8 +1219,8 @@ mod tests { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 100); - ctx.overlay.set_balance(&dest, 15); + set_balance(&origin, 100); + set_balance(&dest, 15); let mut gas_meter = GasMeter::::new(GAS_LIMIT); @@ -1244,7 +1251,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.set_balance(&origin, 0); + set_balance(&origin, 0); let result = ctx.call( dest, @@ -1256,12 +1263,12 @@ mod tests { assert_matches!( result, Err(ExecError { - reason: DispatchError::Other("balance too low to send value"), + reason: DispatchError::Module { message: Some("InsufficientBalance"), .. }, buffer: _, }) ); - assert_eq!(ctx.overlay.get_balance(&origin), 0); - assert_eq!(ctx.overlay.get_balance(&dest), 0); + assert_eq!(get_balance(&origin), 0); + assert_eq!(get_balance(&dest), 0); }); } @@ -1281,7 +1288,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, return_ch).unwrap(); + place_contract(&BOB, return_ch); let result = ctx.call( dest, @@ -1312,7 +1319,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, return_ch).unwrap(); + place_contract(&BOB, return_ch); let result = ctx.call( dest, @@ -1340,7 +1347,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, input_data_ch).unwrap(); + place_contract(&BOB, input_data_ch); let result = ctx.call( BOB, @@ -1366,7 +1373,7 @@ mod tests { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 100); + set_balance(&ALICE, 100); let result = ctx.instantiate( 1, @@ -1414,8 +1421,8 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&BOB, 1); - ctx.overlay.instantiate_contract(&BOB, recurse_ch).unwrap(); + set_balance(&BOB, 1); + place_contract(&BOB, recurse_ch); let result = ctx.call( BOB, @@ -1460,8 +1467,8 @@ mod tests { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(origin, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&dest, bob_ch).unwrap(); - ctx.overlay.instantiate_contract(&CHARLIE, charlie_ch).unwrap(); + place_contract(&dest, bob_ch); + place_contract(&CHARLIE, charlie_ch); let result = ctx.call( dest, @@ -1501,8 +1508,8 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.instantiate_contract(&BOB, bob_ch).unwrap(); - ctx.overlay.instantiate_contract(&CHARLIE, charlie_ch).unwrap(); + place_contract(&BOB, bob_ch); + place_contract(&CHARLIE, charlie_ch); let result = ctx.call( BOB, @@ -1550,7 +1557,7 @@ mod tests { ExtBuilder::default().existential_deposit(15).build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 1000); + set_balance(&ALICE, 1000); let instantiated_contract_address = assert_matches!( ctx.instantiate( @@ -1564,16 +1571,9 @@ mod tests { // Check that the newly created account has the expected code hash and // there are instantiation event. - assert_eq!(ctx.overlay.get_code_hash(&instantiated_contract_address).unwrap(), dummy_ch); - assert_eq!(&ctx.events(), &[ - DeferredAction::DepositEvent { - event: RawEvent::Transfer(ALICE, instantiated_contract_address, 100), - topics: Vec::new(), - }, - DeferredAction::DepositEvent { - event: RawEvent::Instantiated(ALICE, instantiated_contract_address), - topics: Vec::new(), - } + assert_eq!(storage::code_hash::(&instantiated_contract_address).unwrap(), dummy_ch); + assert_eq!(&events(), &[ + RawEvent::Instantiated(ALICE, instantiated_contract_address) ]); }); } @@ -1590,7 +1590,7 @@ mod tests { ExtBuilder::default().existential_deposit(15).build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 1000); + set_balance(&ALICE, 1000); let instantiated_contract_address = assert_matches!( ctx.instantiate( @@ -1603,8 +1603,8 @@ mod tests { ); // Check that the account has not been created. - assert!(ctx.overlay.get_code_hash(&instantiated_contract_address).is_none()); - assert!(ctx.events().is_empty()); + assert!(storage::code_hash::(&instantiated_contract_address).is_err()); + assert!(events().is_empty()); }); } @@ -1635,9 +1635,9 @@ mod tests { ExtBuilder::default().existential_deposit(15).build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 1000); - ctx.overlay.set_balance(&BOB, 100); - ctx.overlay.instantiate_contract(&BOB, instantiator_ch).unwrap(); + set_balance(&ALICE, 1000); + set_balance(&BOB, 100); + place_contract(&BOB, instantiator_ch); assert_matches!( ctx.call(BOB, 20, &mut GasMeter::::new(GAS_LIMIT), vec![]), @@ -1648,20 +1648,9 @@ mod tests { // Check that the newly created account has the expected code hash and // there are instantiation event. - assert_eq!(ctx.overlay.get_code_hash(&instantiated_contract_address).unwrap(), dummy_ch); - assert_eq!(&ctx.events(), &[ - DeferredAction::DepositEvent { - event: RawEvent::Transfer(ALICE, BOB, 20), - topics: Vec::new(), - }, - DeferredAction::DepositEvent { - event: RawEvent::Transfer(BOB, instantiated_contract_address, 15), - topics: Vec::new(), - }, - DeferredAction::DepositEvent { - event: RawEvent::Instantiated(BOB, instantiated_contract_address), - topics: Vec::new(), - }, + assert_eq!(storage::code_hash::(&instantiated_contract_address).unwrap(), dummy_ch); + assert_eq!(&events(), &[ + RawEvent::Instantiated(BOB, instantiated_contract_address) ]); }); } @@ -1695,9 +1684,9 @@ mod tests { ExtBuilder::default().existential_deposit(15).build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 1000); - ctx.overlay.set_balance(&BOB, 100); - ctx.overlay.instantiate_contract(&BOB, instantiator_ch).unwrap(); + set_balance(&ALICE, 1000); + set_balance(&BOB, 100); + place_contract(&BOB, instantiator_ch); assert_matches!( ctx.call(BOB, 20, &mut GasMeter::::new(GAS_LIMIT), vec![]), @@ -1706,12 +1695,7 @@ mod tests { // The contract wasn't instantiated so we don't expect to see an instantiation // event here. - assert_eq!(&ctx.events(), &[ - DeferredAction::DepositEvent { - event: RawEvent::Transfer(ALICE, BOB, 20), - topics: Vec::new(), - }, - ]); + assert_eq!(&events(), &[]); }); } @@ -1732,7 +1716,7 @@ mod tests { .execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - ctx.overlay.set_balance(&ALICE, 1000); + set_balance(&ALICE, 1000); assert_matches!( ctx.instantiate( @@ -1748,7 +1732,7 @@ mod tests { ); assert_eq!( - &ctx.events(), + &events(), &[] ); }); @@ -1768,8 +1752,7 @@ mod tests { ExtBuilder::default().build().execute_with(|| { let cfg = Config::preload(); let mut ctx = ExecutionContext::top_level(ALICE, &cfg, &vm, &loader); - - ctx.overlay.set_balance(&ALICE, 100); + set_balance(&ALICE, 100); let result = ctx.instantiate( 1, diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 245c95a4fa..c12029a856 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -81,8 +81,7 @@ #[macro_use] mod gas; - -mod account_db; +mod storage; mod exec; mod wasm; mod rent; @@ -91,7 +90,6 @@ mod rent; mod tests; use crate::exec::ExecutionContext; -use crate::account_db::{AccountDb, DirectAccountDb}; use crate::wasm::{WasmLoader, WasmVm}; pub use crate::gas::{Gas, GasMeter}; @@ -102,7 +100,6 @@ use serde::{Serialize, Deserialize}; use sp_core::crypto::UncheckedFrom; use sp_std::{prelude::*, marker::PhantomData, fmt::Debug}; use codec::{Codec, Encode, Decode}; -use sp_io::hashing::blake2_256; use sp_runtime::{ traits::{ Hash, StaticLookup, Zero, MaybeSerializeDeserialize, Member, @@ -114,7 +111,7 @@ use frame_support::dispatch::{ }; use frame_support::{ Parameter, decl_module, decl_event, decl_storage, decl_error, - parameter_types, IsSubType, storage::child::{self, ChildInfo}, + parameter_types, IsSubType, storage::child::ChildInfo, }; use frame_support::traits::{OnUnbalanced, Currency, Get, Time, Randomness}; use frame_support::weights::GetDispatchInfo; @@ -129,11 +126,6 @@ pub trait ContractAddressFor { fn contract_address_for(code_hash: &CodeHash, data: &[u8], origin: &AccountId) -> AccountId; } -/// A function that returns the fee for dispatching a `Call`. -pub trait ComputeDispatchFee { - fn compute_dispatch_fee(call: &Call) -> Balance; -} - /// Information for managing an account and its sub trie abstraction. /// This is the required info to cache for an account #[derive(Encode, Decode, RuntimeDebug)] @@ -255,6 +247,12 @@ where } } +impl From> for ContractInfo { + fn from(alive_info: AliveContractInfo) -> Self { + Self::Alive(alive_info) + } +} + /// Get a trie id (trie id must be unique and collision resistant depending upon its context). /// Note that it is different than encode because trie id should be collision resistant /// (being a proper unique identifier). @@ -612,12 +610,7 @@ impl Module { .get_alive() .ok_or(ContractAccessError::IsTombstone)?; - let maybe_value = AccountDb::::get_storage( - &DirectAccountDb, - &address, - Some(&contract_info.trie_id), - &key, - ); + let maybe_value = storage::read_contract_storage(&contract_info.trie_id, &key); Ok(maybe_value) } @@ -636,7 +629,7 @@ impl Module { fn execute_wasm( origin: T::AccountId, gas_meter: &mut GasMeter, - func: impl FnOnce(&mut ExecutionContext, &mut GasMeter) -> ExecResult + func: impl FnOnce(&mut ExecutionContext, &mut GasMeter) -> ExecResult, ) -> ExecResult { let cfg = Config::preload(); let vm = WasmVm::new(&cfg.schedule); @@ -645,22 +638,10 @@ impl Module { let result = func(&mut ctx, gas_meter); - if result.as_ref().map(|output| output.is_success()).unwrap_or(false) { - // Commit all changes that made it thus far into the persistent storage. - DirectAccountDb.commit(ctx.overlay.into_change_set()); - } - // Execute deferred actions. ctx.deferred.into_iter().for_each(|deferred| { use self::exec::DeferredAction::*; match deferred { - DepositEvent { - topics, - event, - } => >::deposit_event_indexed( - &*topics, - ::Event::from(event).into(), - ), DispatchRuntimeCall { origin: who, call, @@ -674,112 +655,11 @@ impl Module { gas_meter.refund(post_info.calc_unspent(&info)); Self::deposit_event(RawEvent::Dispatched(who, result.is_ok())); } - RestoreTo { - donor, - dest, - code_hash, - rent_allowance, - delta, - } => { - let result = Self::restore_to( - donor.clone(), dest.clone(), code_hash.clone(), rent_allowance.clone(), delta - ); - Self::deposit_event( - RawEvent::Restored(donor, dest, code_hash, rent_allowance, result.is_ok()) - ); - } } }); result } - - fn restore_to( - origin: T::AccountId, - dest: T::AccountId, - code_hash: CodeHash, - rent_allowance: BalanceOf, - delta: Vec, - ) -> DispatchResult { - let mut origin_contract = >::get(&origin) - .and_then(|c| c.get_alive()) - .ok_or(Error::::InvalidSourceContract)?; - - let current_block = >::block_number(); - - if origin_contract.last_write == Some(current_block) { - Err(Error::::InvalidContractOrigin)? - } - - let dest_tombstone = >::get(&dest) - .and_then(|c| c.get_tombstone()) - .ok_or(Error::::InvalidDestinationContract)?; - - let last_write = if !delta.is_empty() { - Some(current_block) - } else { - origin_contract.last_write - }; - - let key_values_taken = delta.iter() - .filter_map(|key| { - child::get_raw( - &origin_contract.child_trie_info(), - &blake2_256(key), - ).map(|value| { - child::kill( - &origin_contract.child_trie_info(), - &blake2_256(key), - ); - - (key, value) - }) - }) - .collect::>(); - - let tombstone = >::new( - // This operation is cheap enough because last_write (delta not included) - // is not this block as it has been checked earlier. - &child::root( - &origin_contract.child_trie_info(), - )[..], - code_hash, - ); - - if tombstone != dest_tombstone { - for (key, value) in key_values_taken { - child::put_raw( - &origin_contract.child_trie_info(), - &blake2_256(key), - &value, - ); - } - - return Err(Error::::InvalidTombstone.into()); - } - - origin_contract.storage_size -= key_values_taken.iter() - .map(|(_, value)| value.len() as u32) - .sum::(); - - >::remove(&origin); - >::insert(&dest, ContractInfo::Alive(RawAliveContractInfo { - trie_id: origin_contract.trie_id, - storage_size: origin_contract.storage_size, - empty_pair_count: origin_contract.empty_pair_count, - total_pair_count: origin_contract.total_pair_count, - code_hash, - rent_allowance, - deduct_block: current_block, - last_write, - })); - - let origin_free_balance = T::Currency::free_balance(&origin); - T::Currency::make_free_balance_be(&origin, >::zero()); - T::Currency::deposit_creating(&dest, origin_free_balance); - - Ok(()) - } } decl_event! { @@ -789,9 +669,6 @@ decl_event! { ::AccountId, ::Hash { - /// Transfer happened `from` to `to` with given `value` as part of a `call` or `instantiate`. - Transfer(AccountId, AccountId, Balance), - /// Contract deployed by address at the specified address. Instantiated(AccountId, AccountId), @@ -803,7 +680,7 @@ decl_event! { /// - `tombstone`: `bool`: True if the evicted contract left behind a tombstone. Evicted(AccountId, bool), - /// Restoration for a contract has been initiated. + /// Restoration for a contract has been successful. /// /// # Params /// @@ -811,8 +688,7 @@ decl_event! { /// - `dest`: `AccountId`: Account ID of the restored contract /// - `code_hash`: `Hash`: Code hash of the restored contract /// - `rent_allowance: `Balance`: Rent allowance of the restored contract - /// - `success`: `bool`: True if the restoration was successful - Restored(AccountId, AccountId, Hash, Balance, bool), + Restored(AccountId, AccountId, Hash, Balance), /// Code with the specified hash has been stored. CodeStored(Hash), diff --git a/frame/contracts/src/rent.rs b/frame/contracts/src/rent.rs index 1d8f474627..6afd85aa8e 100644 --- a/frame/contracts/src/rent.rs +++ b/frame/contracts/src/rent.rs @@ -18,8 +18,10 @@ use crate::{ AliveContractInfo, BalanceOf, ContractInfo, ContractInfoOf, Module, RawEvent, - TombstoneContractInfo, Trait, + TombstoneContractInfo, Trait, CodeHash, }; +use sp_std::prelude::*; +use sp_io::hashing::blake2_256; use frame_support::storage::child; use frame_support::traits::{Currency, ExistenceRequirement, Get, OnUnbalanced, WithdrawReason}; use frame_support::StorageMap; @@ -396,3 +398,90 @@ pub fn compute_rent_projection( current_block_number + blocks_left, )) } + +/// Restores the destination account using the origin as prototype. +/// +/// The restoration will be performed iff: +/// - origin exists and is alive, +/// - the origin's storage is not written in the current block +/// - the restored account has tombstone +/// - the tombstone matches the hash of the origin storage root, and code hash. +/// +/// Upon succesful restoration, `origin` will be destroyed, all its funds are transferred to +/// the restored account. The restored account will inherit the last write block and its last +/// deduct block will be set to the current block. +pub fn restore_to( + origin: T::AccountId, + dest: T::AccountId, + code_hash: CodeHash, + rent_allowance: BalanceOf, + delta: Vec, +) -> Result<(), &'static str> { + let mut origin_contract = >::get(&origin) + .and_then(|c| c.get_alive()) + .ok_or("Cannot restore from inexisting or tombstone contract")?; + + let child_trie_info = origin_contract.child_trie_info(); + + let current_block = >::block_number(); + + if origin_contract.last_write == Some(current_block) { + return Err("Origin TrieId written in the current block"); + } + + let dest_tombstone = >::get(&dest) + .and_then(|c| c.get_tombstone()) + .ok_or("Cannot restore to inexisting or alive contract")?; + + let last_write = if !delta.is_empty() { + Some(current_block) + } else { + origin_contract.last_write + }; + + let key_values_taken = delta.iter() + .filter_map(|key| { + child::get_raw(&child_trie_info, &blake2_256(key)).map(|value| { + child::kill(&child_trie_info, &blake2_256(key)); + (key, value) + }) + }) + .collect::>(); + + let tombstone = >::new( + // This operation is cheap enough because last_write (delta not included) + // is not this block as it has been checked earlier. + &child::root(&child_trie_info)[..], + code_hash, + ); + + if tombstone != dest_tombstone { + for (key, value) in key_values_taken { + child::put_raw(&child_trie_info, &blake2_256(key), &value); + } + + return Err("Tombstones don't match"); + } + + origin_contract.storage_size -= key_values_taken.iter() + .map(|(_, value)| value.len() as u32) + .sum::(); + + >::remove(&origin); + >::insert(&dest, ContractInfo::Alive(AliveContractInfo:: { + trie_id: origin_contract.trie_id, + storage_size: origin_contract.storage_size, + empty_pair_count: origin_contract.empty_pair_count, + total_pair_count: origin_contract.total_pair_count, + code_hash, + rent_allowance, + deduct_block: current_block, + last_write, + })); + + let origin_free_balance = T::Currency::free_balance(&origin); + T::Currency::make_free_balance_be(&origin, >::zero()); + T::Currency::deposit_creating(&dest, origin_free_balance); + + Ok(()) +} diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs new file mode 100644 index 0000000000..4c5ad892a9 --- /dev/null +++ b/frame/contracts/src/storage.rs @@ -0,0 +1,195 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! This module contains routines for accessing and altering a contract related state. + +use crate::{ + exec::{AccountIdOf, StorageKey}, + AliveContractInfo, BalanceOf, CodeHash, ContractInfo, ContractInfoOf, Trait, TrieId, +}; +use sp_std::prelude::*; +use sp_io::hashing::blake2_256; +use sp_runtime::traits::Bounded; +use frame_support::{storage::child, StorageMap}; + +/// An error that means that the account requested either doesn't exist or represents a tombstone +/// account. +#[cfg_attr(test, derive(PartialEq, Eq, Debug))] +pub struct ContractAbsentError; + +/// Reads a storage kv pair of a contract. +/// +/// The read is performed from the `trie_id` only. The `address` is not necessary. If the contract +/// doesn't store under the given `key` `None` is returned. +pub fn read_contract_storage(trie_id: &TrieId, key: &StorageKey) -> Option> { + child::get_raw(&crate::child_trie_info(&trie_id), &blake2_256(key)) +} + +/// Update a storage entry into a contract's kv storage. +/// +/// If the `opt_new_value` is `None` then the kv pair is removed. +/// +/// This function also updates the bookkeeping info such as: number of total non-empty pairs a +/// contract owns, the last block the storage was written to, etc. That's why, in contrast to +/// `read_contract_storage`, this function also requires the `account` ID. +/// +/// If the contract specified by the id `account` doesn't exist `Err` is returned.` +pub fn write_contract_storage( + account: &AccountIdOf, + trie_id: &TrieId, + key: &StorageKey, + opt_new_value: Option>, +) -> Result<(), ContractAbsentError> { + let mut new_info = match >::get(account) { + Some(ContractInfo::Alive(alive)) => alive, + None | Some(ContractInfo::Tombstone(_)) => return Err(ContractAbsentError), + }; + + let hashed_key = blake2_256(key); + let child_trie_info = &crate::child_trie_info(&trie_id); + + // In order to correctly update the book keeping we need to fetch the previous + // value of the key-value pair. + // + // It might be a bit more clean if we had an API that supported getting the size + // of the value without going through the loading of it. But at the moment of + // writing, there is no such API. + // + // That's not a show stopper in any case, since the performance cost is + // dominated by the trie traversal anyway. + let opt_prev_value = child::get_raw(&child_trie_info, &hashed_key); + + // Update the total number of KV pairs and the number of empty pairs. + match (&opt_prev_value, &opt_new_value) { + (Some(prev_value), None) => { + new_info.total_pair_count -= 1; + if prev_value.is_empty() { + new_info.empty_pair_count -= 1; + } + }, + (None, Some(new_value)) => { + new_info.total_pair_count += 1; + if new_value.is_empty() { + new_info.empty_pair_count += 1; + } + }, + (Some(prev_value), Some(new_value)) => { + if prev_value.is_empty() { + new_info.empty_pair_count -= 1; + } + if new_value.is_empty() { + new_info.empty_pair_count += 1; + } + } + (None, None) => {} + } + + // Update the total storage size. + let prev_value_len = opt_prev_value + .as_ref() + .map(|old_value| old_value.len() as u32) + .unwrap_or(0); + let new_value_len = opt_new_value + .as_ref() + .map(|new_value| new_value.len() as u32) + .unwrap_or(0); + new_info.storage_size = new_info + .storage_size + .saturating_add(new_value_len) + .saturating_sub(prev_value_len); + + new_info.last_write = Some(>::block_number()); + >::insert(&account, ContractInfo::Alive(new_info)); + + // Finally, perform the change on the storage. + match opt_new_value { + Some(new_value) => child::put_raw(&child_trie_info, &hashed_key, &new_value[..]), + None => child::kill(&child_trie_info, &hashed_key), + } + + Ok(()) +} + +/// Returns the rent allowance set for the contract give by the account id. +pub fn rent_allowance( + account: &AccountIdOf, +) -> Result, ContractAbsentError> { + >::get(account) + .and_then(|i| i.as_alive().map(|i| i.rent_allowance)) + .ok_or(ContractAbsentError) +} + +/// Set the rent allowance for the contract given by the account id. +/// +/// Returns `Err` if the contract doesn't exist or is a tombstone. +pub fn set_rent_allowance( + account: &AccountIdOf, + rent_allowance: BalanceOf, +) -> Result<(), ContractAbsentError> { + >::mutate(account, |maybe_contract_info| match maybe_contract_info { + Some(ContractInfo::Alive(ref mut alive_info)) => { + alive_info.rent_allowance = rent_allowance; + Ok(()) + } + _ => Err(ContractAbsentError), + }) +} + +/// Returns the code hash of the contract specified by `account` ID. +pub fn code_hash(account: &AccountIdOf) -> Result, ContractAbsentError> { + >::get(account) + .and_then(|i| i.as_alive().map(|i| i.code_hash)) + .ok_or(ContractAbsentError) +} + +/// Creates a new contract descriptor in the storage with the given code hash at the given address. +/// +/// Returns `Err` if there is already a contract (or a tombstone) exists at the given address. +pub fn place_contract( + account: &AccountIdOf, + trie_id: TrieId, + ch: CodeHash, +) -> Result<(), &'static str> { + >::mutate(account, |maybe_contract_info| { + if maybe_contract_info.is_some() { + return Err("Alive contract or tombstone already exists"); + } + + *maybe_contract_info = Some( + AliveContractInfo:: { + code_hash: ch, + storage_size: 0, + trie_id, + deduct_block: >::block_number(), + rent_allowance: >::max_value(), + empty_pair_count: 0, + total_pair_count: 0, + last_write: None, + } + .into(), + ); + + Ok(()) + }) +} + +/// Removes the contract and all the storage associated with it. +/// +/// This function doesn't affect the account. +pub fn destroy_contract(address: &AccountIdOf, trie_id: &TrieId) { + >::remove(address); + child::kill_storage(&crate::child_trie_info(&trie_id)); +} diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index a98fdf2d25..df6afa8ac5 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -16,9 +16,7 @@ use crate::{ BalanceOf, ContractAddressFor, ContractInfo, ContractInfoOf, GenesisConfig, Module, - RawAliveContractInfo, RawEvent, Trait, TrieId, Schedule, TrieIdGenerator, - account_db::{AccountDb, DirectAccountDb, OverlayAccountDb}, - gas::Gas, + RawAliveContractInfo, RawEvent, Trait, TrieId, Schedule, TrieIdGenerator, gas::Gas, }; use assert_matches::assert_matches; use hex_literal::*; @@ -64,6 +62,34 @@ impl_outer_dispatch! { } } +pub mod test_utils { + use super::{Test, Balances}; + use crate::{ContractInfoOf, TrieIdGenerator, CodeHash}; + use crate::storage::{write_contract_storage, read_contract_storage}; + use crate::exec::StorageKey; + use frame_support::{StorageMap, traits::Currency}; + + pub fn set_storage(addr: &u64, key: &StorageKey, value: Option>) { + let contract_info = >::get(&addr).unwrap().get_alive().unwrap(); + write_contract_storage::(&1, &contract_info.trie_id, key, value).unwrap(); + } + pub fn get_storage(addr: &u64, key: &StorageKey) -> Option> { + let contract_info = >::get(&addr).unwrap().get_alive().unwrap(); + read_contract_storage(&contract_info.trie_id, key) + } + pub fn place_contract(address: &u64, code_hash: CodeHash) { + let trie_id = ::TrieIdGenerator::trie_id(address); + crate::storage::place_contract::(&address, trie_id, code_hash).unwrap() + } + pub fn set_balance(who: &u64, amount: u64) { + let imbalance = Balances::deposit_creating(who, amount); + drop(imbalance); + } + pub fn get_balance(who: &u64) -> u64 { + Balances::free_balance(who) + } +} + thread_local! { static EXISTENTIAL_DEPOSIT: RefCell = RefCell::new(0); } @@ -280,6 +306,8 @@ fn returns_base_call_cost() { #[test] fn account_removal_does_not_remove_storage() { + use self::test_utils::{set_storage, get_storage}; + ExtBuilder::default().existential_deposit(100).build().execute_with(|| { let trie_id1 = ::TrieIdGenerator::trie_id(&1); let trie_id2 = ::TrieIdGenerator::trie_id(&2); @@ -288,8 +316,7 @@ fn account_removal_does_not_remove_storage() { // Set up two accounts with free balance above the existential threshold. { - let _ = Balances::deposit_creating(&1, 110); - ContractInfoOf::::insert(1, &ContractInfo::Alive(RawAliveContractInfo { + let alice_contract_info = ContractInfo::Alive(RawAliveContractInfo { trie_id: trie_id1.clone(), storage_size: 0, empty_pair_count: 0, @@ -298,15 +325,13 @@ fn account_removal_does_not_remove_storage() { code_hash: H256::repeat_byte(1), rent_allowance: 40, last_write: None, - })); + }); + let _ = Balances::deposit_creating(&ALICE, 110); + ContractInfoOf::::insert(ALICE, &alice_contract_info); + set_storage(&ALICE, &key1, Some(b"1".to_vec())); + set_storage(&ALICE, &key2, Some(b"2".to_vec())); - let mut overlay = OverlayAccountDb::::new(&DirectAccountDb); - overlay.set_storage(&1, key1.clone(), Some(b"1".to_vec())); - overlay.set_storage(&1, key2.clone(), Some(b"2".to_vec())); - DirectAccountDb.commit(overlay.into_change_set()); - - let _ = Balances::deposit_creating(&2, 110); - ContractInfoOf::::insert(2, &ContractInfo::Alive(RawAliveContractInfo { + let bob_contract_info = ContractInfo::Alive(RawAliveContractInfo { trie_id: trie_id2.clone(), storage_size: 0, empty_pair_count: 0, @@ -315,40 +340,39 @@ fn account_removal_does_not_remove_storage() { code_hash: H256::repeat_byte(2), rent_allowance: 40, last_write: None, - })); - - let mut overlay = OverlayAccountDb::::new(&DirectAccountDb); - overlay.set_storage(&2, key1.clone(), Some(b"3".to_vec())); - overlay.set_storage(&2, key2.clone(), Some(b"4".to_vec())); - DirectAccountDb.commit(overlay.into_change_set()); + }); + let _ = Balances::deposit_creating(&BOB, 110); + ContractInfoOf::::insert(BOB, &bob_contract_info); + set_storage(&BOB, &key1, Some(b"3".to_vec())); + set_storage(&BOB, &key2, Some(b"4".to_vec())); } - // Transfer funds from account 1 of such amount that after this transfer - // the balance of account 1 will be below the existential threshold. + // Transfer funds from ALICE account of such amount that after this transfer + // the balance of the ALICE account will be below the existential threshold. // // This does not remove the contract storage as we are not notified about a // account removal. This cannot happen in reality because a contract can only // remove itself by `ext_terminate`. There is no external event that can remove // the account appart from that. - assert_ok!(Balances::transfer(Origin::signed(1), 2, 20)); + assert_ok!(Balances::transfer(Origin::signed(ALICE), BOB, 20)); // Verify that no entries are removed. { assert_eq!( - >::get_storage(&DirectAccountDb, &1, Some(&trie_id1), key1), + get_storage(&ALICE, key1), Some(b"1".to_vec()) ); assert_eq!( - >::get_storage(&DirectAccountDb, &1, Some(&trie_id1), key2), + get_storage(&ALICE, key2), Some(b"2".to_vec()) ); assert_eq!( - >::get_storage(&DirectAccountDb, &2, Some(&trie_id2), key1), + get_storage(&BOB, key1), Some(b"3".to_vec()) ); assert_eq!( - >::get_storage(&DirectAccountDb, &2, Some(&trie_id2), key2), + get_storage(&BOB, key2), Some(b"4".to_vec()) ); } @@ -376,7 +400,7 @@ fn instantiate_and_call_and_deposit_event() { vec![], ); - assert_eq!(System::events(), vec![ + pretty_assertions::assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), @@ -406,7 +430,9 @@ fn instantiate_and_call_and_deposit_event() { }, EventRecord { phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + event: MetaEvent::balances( + pallet_balances::RawEvent::Transfer(ALICE, BOB, 100) + ), topics: vec![], }, EventRecord { @@ -479,7 +505,7 @@ fn dispatch_call() { vec![], )); - assert_eq!(System::events(), vec![ + pretty_assertions::assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), @@ -509,7 +535,9 @@ fn dispatch_call() { }, EventRecord { phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + event: MetaEvent::balances( + pallet_balances::RawEvent::Transfer(ALICE, BOB, 100) + ), topics: vec![], }, EventRecord { @@ -606,7 +634,7 @@ fn dispatch_call_not_dispatched_after_top_level_transaction_failure() { ), "contract trapped during execution" ); - assert_eq!(System::events(), vec![ + pretty_assertions::assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), @@ -636,7 +664,9 @@ fn dispatch_call_not_dispatched_after_top_level_transaction_failure() { }, EventRecord { phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(ALICE, BOB, 100)), + event: MetaEvent::balances( + pallet_balances::RawEvent::Transfer(ALICE, BOB, 100) + ), topics: vec![], }, EventRecord { @@ -1323,9 +1353,6 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: // Advance 4 blocks, to the 5th. initialize_block(5); - // Preserve `BOB`'s code hash for later introspection. - let bob_code_hash = ContractInfoOf::::get(BOB).unwrap() - .get_alive().unwrap().code_hash; // Call `BOB`, which makes it pay rent. Since the rent allowance is set to 0 // we expect that it will get removed leaving tombstone. assert_err_ignore_postinfo!( @@ -1367,17 +1394,25 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: // Perform a call to `DJANGO`. This should either perform restoration successfully or // fail depending on the test parameters. - assert_ok!(Contracts::call( - Origin::signed(ALICE), - DJANGO, - 0, - GAS_LIMIT, - vec![], - )); + let perform_the_restoration = || { + Contracts::call( + Origin::signed(ALICE), + DJANGO, + 0, + GAS_LIMIT, + vec![], + ) + }; if test_different_storage || test_restore_to_with_dirty_storage { // Parametrization of the test imply restoration failure. Check that `DJANGO` aka // restoration contract is still in place and also that `BOB` doesn't exist. + + assert_err_ignore_postinfo!( + perform_the_restoration(), + "contract trapped during execution" + ); + assert!(ContractInfoOf::::get(BOB).unwrap().get_tombstone().is_some()); let django_contract = ContractInfoOf::::get(DJANGO).unwrap() .get_alive().unwrap(); @@ -1386,18 +1421,10 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: assert_eq!(django_contract.deduct_block, System::block_number()); match (test_different_storage, test_restore_to_with_dirty_storage) { (true, false) => { - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts( - RawEvent::Restored(DJANGO, BOB, bob_code_hash, 50, false) - ), - topics: vec![], - }, - ]); + assert_eq!(System::events(), vec![]); } (_, true) => { - assert_eq!(System::events(), vec![ + pretty_assertions::assert_eq!(System::events(), vec![ EventRecord { phase: Phase::Initialization, event: MetaEvent::contracts(RawEvent::Evicted(BOB, true)), @@ -1425,7 +1452,9 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: }, EventRecord { phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Transfer(CHARLIE, DJANGO, 30_000)), + event: MetaEvent::balances( + pallet_balances::RawEvent::Transfer(CHARLIE, DJANGO, 30_000) + ), topics: vec![], }, EventRecord { @@ -1433,22 +1462,13 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: event: MetaEvent::contracts(RawEvent::Instantiated(CHARLIE, DJANGO)), topics: vec![], }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Restored( - DJANGO, - BOB, - bob_code_hash, - 50, - false, - )), - topics: vec![], - }, ]); } _ => unreachable!(), } } else { + assert_ok!(perform_the_restoration()); + // Here we expect that the restoration is succeeded. Check that the restoration // contract `DJANGO` ceased to exist and that `BOB` returned back. println!("{:?}", ContractInfoOf::::get(BOB)); @@ -1468,7 +1488,7 @@ fn restoration(test_different_storage: bool, test_restore_to_with_dirty_storage: EventRecord { phase: Phase::Initialization, event: MetaEvent::contracts( - RawEvent::Restored(DJANGO, BOB, bob_contract.code_hash, 50, true) + RawEvent::Restored(DJANGO, BOB, bob_contract.code_hash, 50) ), topics: vec![], }, diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index cb69cd689b..890915a793 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -229,11 +229,8 @@ mod tests { fn get_storage(&self, key: &StorageKey) -> Option> { self.storage.get(key).cloned() } - fn set_storage(&mut self, key: StorageKey, value: Option>) - -> Result<(), &'static str> - { + fn set_storage(&mut self, key: StorageKey, value: Option>) { *self.storage.entry(key).or_insert(Vec::new()) = value.unwrap_or(Vec::new()); - Ok(()) } fn instantiate( &mut self, @@ -304,19 +301,20 @@ mod tests { fn note_dispatch_call(&mut self, call: Call) { self.dispatches.push(DispatchEntry(call)); } - fn note_restore_to( + fn restore_to( &mut self, dest: u64, code_hash: H256, rent_allowance: u64, delta: Vec, - ) { + ) -> Result<(), &'static str> { self.restores.push(RestoreEntry { dest, code_hash, rent_allowance, delta, }); + Ok(()) } fn caller(&self) -> &u64 { &42 @@ -386,9 +384,7 @@ mod tests { fn get_storage(&self, key: &[u8; 32]) -> Option> { (**self).get_storage(key) } - fn set_storage(&mut self, key: [u8; 32], value: Option>) - -> Result<(), &'static str> - { + fn set_storage(&mut self, key: [u8; 32], value: Option>) { (**self).set_storage(key, value) } fn instantiate( @@ -427,14 +423,14 @@ mod tests { fn note_dispatch_call(&mut self, call: Call) { (**self).note_dispatch_call(call) } - fn note_restore_to( + fn restore_to( &mut self, dest: u64, code_hash: H256, rent_allowance: u64, delta: Vec, - ) { - (**self).note_restore_to( + ) -> Result<(), &'static str> { + (**self).restore_to( dest, code_hash, rent_allowance, diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index f87f5d1ef5..b393898835 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -51,6 +51,8 @@ enum SpecialTrap { /// Signals that a trap was generated in response to a succesful call to the /// `ext_terminate` host function. Termination, + /// Signals that a trap was generated because of a successful restoration. + Restoration, } /// Can only be used for one call. @@ -100,6 +102,12 @@ pub(crate) fn to_execution_result( data: Vec::new(), }) }, + Some(SpecialTrap::Restoration) => { + return Ok(ExecReturnValue { + status: STATUS_SUCCESS, + data: Vec::new(), + }) + } Some(SpecialTrap::OutOfGas) => { return Err(ExecError { reason: "ran out of gas during contract execution".into(), @@ -387,7 +395,7 @@ define_env!(Env, , let mut key: StorageKey = [0; 32]; read_sandbox_memory_into_buf(ctx, key_ptr, &mut key)?; let value = Some(read_sandbox_memory(ctx, value_ptr, value_len)?); - ctx.ext.set_storage(key, value).map_err(|_| sp_sandbox::HostError)?; + ctx.ext.set_storage(key, value); Ok(()) }, @@ -399,7 +407,7 @@ define_env!(Env, , ext_clear_storage(ctx, key_ptr: u32) => { let mut key: StorageKey = [0; 32]; read_sandbox_memory_into_buf(ctx, key_ptr, &mut key)?; - ctx.ext.set_storage(key, None).map_err(|_| sp_sandbox::HostError)?; + ctx.ext.set_storage(key, None); Ok(()) }, @@ -799,17 +807,18 @@ define_env!(Env, , Ok(()) }, - // Record a request to restore the caller contract to the specified contract. + // Try to restore the given destination contract sacrificing the caller. // - // At the finalization stage, i.e. when all changes from the extrinsic that invoked this - // contract are committed, this function will compute a tombstone hash from the caller's - // storage and the given code hash and if the hash matches the hash found in the tombstone at - // the specified address - kill the caller contract and restore the destination contract and set - // the specified `rent_allowance`. All caller's funds are transferred to the destination. + // This function will compute a tombstone hash from the caller's storage and the given code hash + // and if the hash matches the hash found in the tombstone at the specified address - kill + // the caller contract and restore the destination contract and set the specified `rent_allowance`. + // All caller's funds are transfered to the destination. // - // This function doesn't perform restoration right away but defers it to the end of the - // transaction. If there is no tombstone in the destination address or if the hashes don't match - // then restoration is cancelled and no changes are made. + // If there is no tombstone at the destination address, the hashes don't match or this contract + // instance is already present on the contract call stack, a trap is generated. + // + // Otherwise, the destination contract is restored. This function is diverging and stops execution + // even on success. // // `dest_ptr`, `dest_len` - the pointer and the length of a buffer that encodes `T::AccountId` // with the address of the to be restored contract. @@ -857,14 +866,15 @@ define_env!(Env, , delta }; - ctx.ext.note_restore_to( + if let Ok(()) = ctx.ext.restore_to( dest, code_hash, rent_allowance, delta, - ); - - Ok(()) + ) { + ctx.special_trap = Some(SpecialTrap::Restoration); + } + Err(sp_sandbox::HostError) }, // Returns the size of the scratch buffer. -- GitLab From 971e52fb70cc3f615da471436469c04b1b99bb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 24 Jun 2020 12:52:49 +0200 Subject: [PATCH 234/280] seal: Refactor ext_gas_price (#6478) * seal: Refactor ext_gas_price * Remove seals dependency on pallet_transaction_payment * Add weight as an argument to ext_gas_price * Fixed documentation nits from review * Do not use unchecked math even in test code --- Cargo.lock | 1 - bin/node/runtime/src/lib.rs | 2 ++ frame/contracts/Cargo.toml | 2 -- frame/contracts/src/exec.rs | 14 +++++------- frame/contracts/src/lib.rs | 17 ++++++++++---- frame/contracts/src/tests.rs | 12 +++------- frame/contracts/src/wasm/mod.rs | 13 ++++++----- frame/contracts/src/wasm/runtime.rs | 8 ++++--- frame/transaction-payment/src/lib.rs | 33 +++++++++++++--------------- 9 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08e5102d34..c1ea4a479c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4006,7 +4006,6 @@ dependencies = [ "pallet-contracts-primitives", "pallet-randomness-collective-flip", "pallet-timestamp", - "pallet-transaction-payment", "parity-scale-codec", "parity-wasm 0.41.0", "pretty_assertions", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index cf1b0de8f7..5acaafcab4 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -581,6 +581,7 @@ parameter_types! { impl pallet_contracts::Trait for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; + type Currency = Balances; type Call = Call; type Event = Event; type DetermineContractAddress = pallet_contracts::SimpleAddressDeterminer; @@ -594,6 +595,7 @@ impl pallet_contracts::Trait for Runtime { type SurchargeReward = SurchargeReward; type MaxDepth = pallet_contracts::DefaultMaxDepth; type MaxValueSize = pallet_contracts::DefaultMaxValueSize; + type WeightPrice = pallet_transaction_payment::Module; } impl pallet_sudo::Trait for Runtime { diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 57c278a3fb..2dee486fcf 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -25,7 +25,6 @@ sp-sandbox = { version = "0.8.0-rc3", default-features = false, path = "../../pr frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "common" } -pallet-transaction-payment = { version = "2.0.0-rc3", default-features = false, path = "../transaction-payment" } [dev-dependencies] wabt = "0.9.2" @@ -52,5 +51,4 @@ std = [ "pwasm-utils/std", "wasmi-validation/std", "pallet-contracts-primitives/std", - "pallet-transaction-payment/std", ] diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index ff0d4d9dc0..ba3619195d 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -21,10 +21,11 @@ use crate::rent; use crate::storage; use sp_std::prelude::*; -use sp_runtime::traits::{Bounded, Zero}; +use sp_runtime::traits::{Bounded, Zero, Convert}; use frame_support::{ storage::unhashed, dispatch::DispatchError, traits::{ExistenceRequirement, Currency, Time, Randomness}, + weights::Weight, }; pub type AccountIdOf = ::AccountId; @@ -216,8 +217,8 @@ pub trait Ext { /// Returns `None` if the value doesn't exist. fn get_runtime_storage(&self, key: &[u8]) -> Option>; - /// Returns the price of one weight unit. - fn get_weight_price(&self) -> BalanceOf; + /// Returns the price for the specified amount of weight. + fn get_weight_price(&self, weight: Weight) -> BalanceOf; } /// Loader is a companion of the `Vm` trait. It loads an appropriate abstract @@ -874,11 +875,8 @@ where unhashed::get_raw(&key) } - fn get_weight_price(&self) -> BalanceOf { - use pallet_transaction_payment::Module as Payment; - use sp_runtime::SaturatedConversion; - let price = Payment::::weight_to_fee_with_adjustment::(1); - price.saturated_into() + fn get_weight_price(&self, weight: Weight) -> BalanceOf { + T::WeightPrice::convert(weight) } } diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index c12029a856..63de1ee164 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -102,7 +102,7 @@ use sp_std::{prelude::*, marker::PhantomData, fmt::Debug}; use codec::{Codec, Encode, Decode}; use sp_runtime::{ traits::{ - Hash, StaticLookup, Zero, MaybeSerializeDeserialize, Member, + Hash, StaticLookup, Zero, MaybeSerializeDeserialize, Member, Convert, }, RuntimeDebug, }; @@ -117,6 +117,7 @@ use frame_support::traits::{OnUnbalanced, Currency, Get, Time, Randomness}; use frame_support::weights::GetDispatchInfo; use frame_system::{self as system, ensure_signed, RawOrigin, ensure_root}; use pallet_contracts_primitives::{RentProjection, ContractAccessError}; +use frame_support::weights::Weight; pub type CodeHash = ::Hash; pub type TrieId = Vec; @@ -289,9 +290,10 @@ where } } -pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; +pub type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; pub type NegativeImbalanceOf = - <::Currency as Currency<::AccountId>>::NegativeImbalance; + <::Currency as Currency<::AccountId>>::NegativeImbalance; parameter_types! { /// A reasonable default value for [`Trait::SignedClaimedHandicap`]. @@ -312,10 +314,13 @@ parameter_types! { pub const DefaultMaxValueSize: u32 = 16_384; } -pub trait Trait: frame_system::Trait + pallet_transaction_payment::Trait { +pub trait Trait: frame_system::Trait { type Time: Time; type Randomness: Randomness; + /// The currency in which fees are paid and contract balances are held. + type Currency: Currency; + /// The outer call dispatch type. type Call: Parameter + @@ -371,6 +376,10 @@ pub trait Trait: frame_system::Trait + pallet_transaction_payment::Trait { /// The maximum size of a storage value in bytes. type MaxValueSize: Get; + + /// Used to answer contracts's queries regarding the current weight price. This is **not** + /// used to calculate the actual fee and is only for informational purposes. + type WeightPrice: Convert>; } /// Simple contract address determiner. diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index df6afa8ac5..ae81a83be7 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -30,7 +30,7 @@ use frame_support::{ assert_ok, assert_err_ignore_postinfo, impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types, StorageMap, StorageValue, traits::{Currency, Get}, - weights::{Weight, PostDispatchInfo, IdentityFee}, + weights::{Weight, PostDispatchInfo}, }; use std::cell::RefCell; use frame_system::{self as system, EventRecord, Phase}; @@ -169,17 +169,10 @@ impl Convert> for Test { } } -impl pallet_transaction_payment::Trait for Test { - type Currency = Balances; - type OnTransactionPayment = (); - type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee>; - type FeeMultiplierUpdate = (); -} - impl Trait for Test { type Time = Timestamp; type Randomness = Randomness; + type Currency = Balances; type Call = Call; type DetermineContractAddress = DummyContractAddressFor; type Event = MetaEvent; @@ -193,6 +186,7 @@ impl Trait for Test { type SurchargeReward = SurchargeReward; type MaxDepth = MaxDepth; type MaxValueSize = MaxValueSize; + type WeightPrice = Self; } type Balances = pallet_balances::Module; diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 890915a793..a4814a1b22 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -162,6 +162,7 @@ mod tests { use hex_literal::hex; use assert_matches::assert_matches; use sp_runtime::DispatchError; + use frame_support::weights::Weight; const GAS_LIMIT: Gas = 10_000_000_000; @@ -373,8 +374,8 @@ mod tests { ) ) } - fn get_weight_price(&self) -> BalanceOf { - 1312_u32.into() + fn get_weight_price(&self, weight: Weight) -> BalanceOf { + BalanceOf::::from(1312_u32).saturating_mul(weight.into()) } } @@ -479,8 +480,8 @@ mod tests { fn get_runtime_storage(&self, key: &[u8]) -> Option> { (**self).get_runtime_storage(key) } - fn get_weight_price(&self) -> BalanceOf { - (**self).get_weight_price() + fn get_weight_price(&self, weight: Weight) -> BalanceOf { + (**self).get_weight_price(weight) } } @@ -1056,7 +1057,7 @@ mod tests { const CODE_GAS_PRICE: &str = r#" (module - (import "env" "ext_gas_price" (func $ext_gas_price)) + (import "env" "ext_gas_price" (func $ext_gas_price (param i64))) (import "env" "ext_scratch_size" (func $ext_scratch_size (result i32))) (import "env" "ext_scratch_read" (func $ext_scratch_read (param i32 i32 i32))) (import "env" "memory" (memory 1 1)) @@ -1072,7 +1073,7 @@ mod tests { (func (export "call") ;; This stores the gas price in the scratch buffer - (call $ext_gas_price) + (call $ext_gas_price (i64.const 1)) ;; assert $ext_scratch_size == 8 (call $assert diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index b393898835..8c4d1bfb99 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -696,12 +696,14 @@ define_env!(Env, , Ok(()) }, - // Stores the gas price for the current transaction into the scratch buffer. + // Stores the price for the specified amount of gas in scratch buffer. // // The data is encoded as T::Balance. The current contents of the scratch buffer are overwritten. - ext_gas_price(ctx) => { + // It is recommended to avoid specifying very small values for `gas` as the prices for a single + // gas can be smaller than one. + ext_gas_price(ctx, gas: u64) => { ctx.scratch_buf.clear(); - ctx.ext.get_weight_price().encode_to(&mut ctx.scratch_buf); + ctx.ext.get_weight_price(gas).encode_to(&mut ctx.scratch_buf); Ok(()) }, diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index 4d920f8ec5..b993a85da3 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -51,7 +51,7 @@ use sp_runtime::{ }, traits::{ Zero, Saturating, SignedExtension, SaturatedConversion, Convert, Dispatchable, - DispatchInfoOf, PostDispatchInfoOf, UniqueSaturatedFrom, UniqueSaturatedInto, + DispatchInfoOf, PostDispatchInfoOf, }, }; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; @@ -340,23 +340,6 @@ impl Module where tip } } -} - -impl Module { - /// Compute the fee for the specified weight. - /// - /// This fee is already adjusted by the per block fee adjustment factor and is therefore the - /// share that the weight contributes to the overall fee of a transaction. - /// - /// This function is generic in order to supply the contracts module with a way to calculate the - /// gas price. The contracts module is not able to put the necessary `BalanceOf` constraints - /// on its trait. This function is not to be used by this module. - pub fn weight_to_fee_with_adjustment(weight: Weight) -> Balance where - Balance: UniqueSaturatedFrom - { - let fee: u128 = Self::weight_to_fee(weight).unique_saturated_into(); - Balance::unique_saturated_from(NextFeeMultiplier::get().saturating_mul_acc_int(fee)) - } fn weight_to_fee(weight: Weight) -> BalanceOf { // cap the weight to the maximum defined in runtime, otherwise it will be the @@ -366,6 +349,20 @@ impl Module { } } +impl Convert> for Module where + T: Trait, + BalanceOf: FixedPointOperand, +{ + /// Compute the fee for the specified weight. + /// + /// This fee is already adjusted by the per block fee adjustment factor and is therefore the + /// share that the weight contributes to the overall fee of a transaction. It is mainly + /// for informational purposes and not used in the actual fee calculation. + fn convert(weight: Weight) -> BalanceOf { + NextFeeMultiplier::get().saturating_mul_int(Self::weight_to_fee(weight)) + } +} + /// Require the transactor pay for themselves and maybe include a tip to gain additional priority /// in the queue. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -- GitLab From 19b4b70e7c7cf966cb5f5669a5e153485943095a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 24 Jun 2020 13:53:40 +0200 Subject: [PATCH 235/280] seal: Remove ext_dispatch_call and ext_get_runtime_storage (#6464) Those are way too hard to audit and make only sense with specific chains. They shouldn't be in the core API. --- bin/node/runtime/src/lib.rs | 1 - frame/contracts/fixtures/dispatch_call.wat | 14 - .../fixtures/dispatch_call_then_trap.wat | 15 - .../fixtures/get_runtime_storage.wat | 74 ----- frame/contracts/fixtures/restoration.wat | 4 +- frame/contracts/fixtures/set_rent.wat | 19 +- frame/contracts/src/exec.rs | 48 +--- frame/contracts/src/lib.rs | 44 +-- frame/contracts/src/tests.rs | 260 ------------------ frame/contracts/src/wasm/mod.rs | 144 ---------- frame/contracts/src/wasm/runtime.rs | 54 ---- 11 files changed, 28 insertions(+), 649 deletions(-) delete mode 100644 frame/contracts/fixtures/dispatch_call.wat delete mode 100644 frame/contracts/fixtures/dispatch_call_then_trap.wat delete mode 100644 frame/contracts/fixtures/get_runtime_storage.wat diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 5acaafcab4..90bb63874e 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -582,7 +582,6 @@ impl pallet_contracts::Trait for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; - type Call = Call; type Event = Event; type DetermineContractAddress = pallet_contracts::SimpleAddressDeterminer; type TrieIdGenerator = pallet_contracts::TrieIdFromParentCounter; diff --git a/frame/contracts/fixtures/dispatch_call.wat b/frame/contracts/fixtures/dispatch_call.wat deleted file mode 100644 index db0995bd6c..0000000000 --- a/frame/contracts/fixtures/dispatch_call.wat +++ /dev/null @@ -1,14 +0,0 @@ -(module - (import "env" "ext_dispatch_call" (func $ext_dispatch_call (param i32 i32))) - (import "env" "memory" (memory 1 1)) - - (func (export "call") - (call $ext_dispatch_call - (i32.const 8) ;; Pointer to the start of encoded call buffer - (i32.const 11) ;; Length of the buffer - ) - ) - (func (export "deploy")) - - (data (i32.const 8) "\00\00\03\00\00\00\00\00\00\00\C8") -) diff --git a/frame/contracts/fixtures/dispatch_call_then_trap.wat b/frame/contracts/fixtures/dispatch_call_then_trap.wat deleted file mode 100644 index ce949d6823..0000000000 --- a/frame/contracts/fixtures/dispatch_call_then_trap.wat +++ /dev/null @@ -1,15 +0,0 @@ -(module - (import "env" "ext_dispatch_call" (func $ext_dispatch_call (param i32 i32))) - (import "env" "memory" (memory 1 1)) - - (func (export "call") - (call $ext_dispatch_call - (i32.const 8) ;; Pointer to the start of encoded call buffer - (i32.const 11) ;; Length of the buffer - ) - (unreachable) ;; trap so that the top level transaction fails - ) - (func (export "deploy")) - - (data (i32.const 8) "\00\00\03\00\00\00\00\00\00\00\C8") -) diff --git a/frame/contracts/fixtures/get_runtime_storage.wat b/frame/contracts/fixtures/get_runtime_storage.wat deleted file mode 100644 index 6148f1c408..0000000000 --- a/frame/contracts/fixtures/get_runtime_storage.wat +++ /dev/null @@ -1,74 +0,0 @@ -(module - (import "env" "ext_get_runtime_storage" - (func $ext_get_runtime_storage (param i32 i32) (result i32)) - ) - (import "env" "ext_scratch_size" (func $ext_scratch_size (result i32))) - (import "env" "ext_scratch_read" (func $ext_scratch_read (param i32 i32 i32))) - (import "env" "ext_scratch_write" (func $ext_scratch_write (param i32 i32))) - (import "env" "memory" (memory 1 1)) - - (func (export "deploy")) - - (func $assert (param i32) - (block $ok - (br_if $ok - (get_local 0) - ) - (unreachable) - ) - ) - - (func $call (export "call") - ;; Load runtime storage for the first key and assert that it exists. - (call $assert - (i32.eq - (call $ext_get_runtime_storage - (i32.const 16) - (i32.const 4) - ) - (i32.const 0) - ) - ) - - ;; assert $ext_scratch_size == 4 - (call $assert - (i32.eq - (call $ext_scratch_size) - (i32.const 4) - ) - ) - - ;; copy contents of the scratch buffer into the contract's memory. - (call $ext_scratch_read - (i32.const 4) ;; Pointer in memory to the place where to copy. - (i32.const 0) ;; Offset from the start of the scratch buffer. - (i32.const 4) ;; Count of bytes to copy. - ) - - ;; assert that contents of the buffer is equal to the i32 value of 0x14144020. - (call $assert - (i32.eq - (i32.load - (i32.const 4) - ) - (i32.const 0x14144020) - ) - ) - - ;; Load the second key and assert that it doesn't exist. - (call $assert - (i32.eq - (call $ext_get_runtime_storage - (i32.const 20) - (i32.const 4) - ) - (i32.const 1) - ) - ) - ) - - ;; The first key, 4 bytes long. - (data (i32.const 16) "\01\02\03\04") - ;; The second key, 4 bytes long. - (data (i32.const 20) "\02\03\04\05") -) diff --git a/frame/contracts/fixtures/restoration.wat b/frame/contracts/fixtures/restoration.wat index 225fdde817..07e11e9d38 100644 --- a/frame/contracts/fixtures/restoration.wat +++ b/frame/contracts/fixtures/restoration.wat @@ -51,8 +51,8 @@ ;; Code hash of SET_RENT (data (i32.const 264) - "\c2\1c\41\10\a5\22\d8\59\1c\4c\77\35\dd\2d\bf\a1" - "\13\0b\50\93\76\9b\92\31\97\b7\c5\74\26\aa\38\2a" + "\ab\d6\58\65\1e\83\6e\4a\18\0d\f2\6d\bc\42\ba\e9" + "\3d\64\76\e5\30\5b\33\46\bb\4d\43\99\38\21\ee\32" ) ;; Rent allowance diff --git a/frame/contracts/fixtures/set_rent.wat b/frame/contracts/fixtures/set_rent.wat index d1affa0d74..3e6bd491bc 100644 --- a/frame/contracts/fixtures/set_rent.wat +++ b/frame/contracts/fixtures/set_rent.wat @@ -1,5 +1,5 @@ (module - (import "env" "ext_dispatch_call" (func $ext_dispatch_call (param i32 i32))) + (import "env" "ext_transfer" (func $ext_transfer (param i32 i32 i32 i32) (result i32))) (import "env" "ext_set_storage" (func $ext_set_storage (param i32 i32 i32))) (import "env" "ext_clear_storage" (func $ext_clear_storage (param i32))) (import "env" "ext_set_rent_allowance" (func $ext_set_rent_allowance (param i32 i32))) @@ -23,11 +23,13 @@ ) ) - ;; transfer 50 to ALICE + ;; transfer 50 to CHARLIE (func $call_2 - (call $ext_dispatch_call - (i32.const 68) - (i32.const 11) + (call $assert + (i32.eq + (call $ext_transfer (i32.const 68) (i32.const 8) (i32.const 76) (i32.const 8)) + (i32.const 0) + ) ) ) @@ -96,6 +98,9 @@ ;; Encoding of 10 in balance (data (i32.const 0) "\28") - ;; Encoding of call transfer 50 to CHARLIE - (data (i32.const 68) "\00\00\03\00\00\00\00\00\00\00\C8") + ;; encoding of Charlies's account id + (data (i32.const 68) "\03") + + ;; encoding of 50 balance + (data (i32.const 76) "\32") ) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index ba3619195d..4e68aac615 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -29,7 +29,6 @@ use frame_support::{ }; pub type AccountIdOf = ::AccountId; -pub type CallOf = ::Call; pub type MomentOf = <::Time as Time>::Moment; pub type SeedOf = ::Hash; pub type BlockNumberOf = ::BlockNumber; @@ -151,9 +150,6 @@ pub trait Ext { input_data: Vec, ) -> ExecResult; - /// Notes a call dispatch. - fn note_dispatch_call(&mut self, call: CallOf); - /// Restores the given destination contract sacrificing the current one. /// /// Since this function removes the self contract eagerly, if succeeded, no further actions should @@ -274,23 +270,11 @@ impl Token for ExecFeeToken { } } -#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq, Clone))] -#[derive(sp_runtime::RuntimeDebug)] -pub enum DeferredAction { - DispatchRuntimeCall { - /// The account id of the contract who dispatched this call. - origin: T::AccountId, - /// The call to dispatch. - call: ::Call, - }, -} - pub struct ExecutionContext<'a, T: Trait + 'a, V, L> { pub caller: Option<&'a ExecutionContext<'a, T, V, L>>, pub self_account: T::AccountId, pub self_trie_id: Option, pub depth: usize, - pub deferred: Vec>, pub config: &'a Config, pub vm: &'a V, pub loader: &'a L, @@ -314,7 +298,6 @@ where self_trie_id: None, self_account: origin, depth: 0, - deferred: Vec::new(), config: &cfg, vm: &vm, loader: &loader, @@ -331,7 +314,6 @@ where self_trie_id: trie_id, self_account: dest, depth: self.depth + 1, - deferred: Vec::new(), config: self.config, vm: self.vm, loader: self.loader, @@ -532,21 +514,14 @@ where where F: FnOnce(&mut ExecutionContext) -> ExecResult { use frame_support::storage::TransactionOutcome::*; - let (output, deferred) = { - let mut nested = self.nested(dest, trie_id); - let output = frame_support::storage::with_transaction(|| { - let output = func(&mut nested); - match output { - Ok(ref rv) if rv.is_success() => Commit(output), - _ => Rollback(output), - } - })?; - (output, nested.deferred) - }; - if output.is_success() { - self.deferred.extend(deferred); - } - Ok(output) + let mut nested = self.nested(dest, trie_id); + frame_support::storage::with_transaction(|| { + let output = func(&mut nested); + match output { + Ok(ref rv) if rv.is_success() => Commit(output), + _ => Rollback(output), + } + }) } /// Returns whether a contract, identified by address, is currently live in the execution @@ -767,13 +742,6 @@ where self.ctx.call(to.clone(), value, gas_meter, input_data) } - fn note_dispatch_call(&mut self, call: CallOf) { - self.ctx.deferred.push(DeferredAction::DispatchRuntimeCall { - origin: self.ctx.self_account.clone(), - call, - }); - } - fn restore_to( &mut self, dest: AccountIdOf, diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 63de1ee164..4db77a078e 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -106,16 +106,13 @@ use sp_runtime::{ }, RuntimeDebug, }; -use frame_support::dispatch::{ - PostDispatchInfo, DispatchResult, Dispatchable, DispatchResultWithPostInfo -}; use frame_support::{ - Parameter, decl_module, decl_event, decl_storage, decl_error, - parameter_types, IsSubType, storage::child::ChildInfo, + decl_module, decl_event, decl_storage, decl_error, + parameter_types, storage::child::ChildInfo, + dispatch::{DispatchResult, DispatchResultWithPostInfo}, + traits::{OnUnbalanced, Currency, Get, Time, Randomness}, }; -use frame_support::traits::{OnUnbalanced, Currency, Get, Time, Randomness}; -use frame_support::weights::GetDispatchInfo; -use frame_system::{self as system, ensure_signed, RawOrigin, ensure_root}; +use frame_system::{self as system, ensure_signed, ensure_root}; use pallet_contracts_primitives::{RentProjection, ContractAccessError}; use frame_support::weights::Weight; @@ -321,12 +318,6 @@ pub trait Trait: frame_system::Trait { /// The currency in which fees are paid and contract balances are held. type Currency: Currency; - /// The outer call dispatch type. - type Call: - Parameter + - Dispatchable::Origin> + - IsSubType, Self> + GetDispatchInfo; - /// The overarching event type. type Event: From> + Into<::Event>; @@ -644,30 +635,7 @@ impl Module { let vm = WasmVm::new(&cfg.schedule); let loader = WasmLoader::new(&cfg.schedule); let mut ctx = ExecutionContext::top_level(origin.clone(), &cfg, &vm, &loader); - - let result = func(&mut ctx, gas_meter); - - // Execute deferred actions. - ctx.deferred.into_iter().for_each(|deferred| { - use self::exec::DeferredAction::*; - match deferred { - DispatchRuntimeCall { - origin: who, - call, - } => { - let info = call.get_dispatch_info(); - let result = call.dispatch(RawOrigin::Signed(who.clone()).into()); - let post_info = match result { - Ok(post_info) => post_info, - Err(err) => err.post_info, - }; - gas_meter.refund(post_info.calc_unspent(&info)); - Self::deposit_event(RawEvent::Dispatched(who, result.is_ok())); - } - } - }); - - result + func(&mut ctx, gas_meter) } } diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index ae81a83be7..5303375e01 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -173,7 +173,6 @@ impl Trait for Test { type Time = Timestamp; type Randomness = Randomness; type Currency = Balances; - type Call = Call; type DetermineContractAddress = DummyContractAddressFor; type Event = MetaEvent; type TrieIdGenerator = DummyTrieIdGenerator; @@ -446,233 +445,6 @@ fn instantiate_and_call_and_deposit_event() { }); } -#[test] -fn dispatch_call() { - // This test can fail due to the encoding changes. In case it becomes too annoying - // let's rewrite so as we use this module controlled call or we serialize it in runtime. - let encoded = Encode::encode(&Call::Balances(pallet_balances::Call::transfer(CHARLIE, 50))); - assert_eq!(&encoded[..], &hex!("00000300000000000000C8")[..]); - - let (wasm, code_hash) = compile_module::("dispatch_call").unwrap(); - - ExtBuilder::default() - .existential_deposit(50) - .build() - .execute_with(|| { - let _ = Balances::deposit_creating(&ALICE, 1_000_000); - - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Let's keep this assert even though it's redundant. If you ever need to update the - // wasm source this test will fail and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - ]); - - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, // newly created account - 0, - GAS_LIMIT, - vec![], - )); - - pretty_assertions::assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Transfer(ALICE, BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), - topics: vec![], - }, - - // Dispatching the call. - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(CHARLIE)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(CHARLIE, 50) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Transfer(BOB, CHARLIE, 50) - ), - topics: vec![], - }, - - // Event emitted as a result of dispatch. - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Dispatched(BOB, true)), - topics: vec![], - } - ]); - }); -} - -#[test] -fn dispatch_call_not_dispatched_after_top_level_transaction_failure() { - // This test can fail due to the encoding changes. In case it becomes too annoying - // let's rewrite so as we use this module controlled call or we serialize it in runtime. - let encoded = Encode::encode(&Call::Balances(pallet_balances::Call::transfer(CHARLIE, 50))); - assert_eq!(&encoded[..], &hex!("00000300000000000000C8")[..]); - - let (wasm, code_hash) = compile_module::("dispatch_call_then_trap").unwrap(); - - ExtBuilder::default() - .existential_deposit(50) - .build() - .execute_with(|| { - let _ = Balances::deposit_creating(&ALICE, 1_000_000); - - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - - // Let's keep this assert even though it's redundant. If you ever need to update the - // wasm source this test will fail and will show you the actual hash. - assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - ]); - - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - - // Call the newly instantiated contract. The contract is expected to dispatch a call - // and then trap. - assert_err_ignore_postinfo!( - Contracts::call( - Origin::signed(ALICE), - BOB, // newly created account - 0, - GAS_LIMIT, - vec![], - ), - "contract trapped during execution" - ); - pretty_assertions::assert_eq!(System::events(), vec![ - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(1)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances(pallet_balances::RawEvent::Endowed(1, 1_000_000)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::CodeStored(code_hash.into())), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::system(frame_system::RawEvent::NewAccount(BOB)), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Endowed(BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::balances( - pallet_balances::RawEvent::Transfer(ALICE, BOB, 100) - ), - topics: vec![], - }, - EventRecord { - phase: Phase::Initialization, - event: MetaEvent::contracts(RawEvent::Instantiated(ALICE, BOB)), - topics: vec![], - }, - // ABSENCE of events which would be caused by dispatched Balances::transfer call - ]); - }); -} - #[test] fn run_out_of_gas() { let (wasm, code_hash) = compile_module::("run_out_of_gas").unwrap(); @@ -1773,38 +1545,6 @@ fn cannot_self_destruct_in_constructor() { }); } -#[test] -fn get_runtime_storage() { - let (wasm, code_hash) = compile_module::("get_runtime_storage").unwrap(); - ExtBuilder::default() - .existential_deposit(50) - .build() - .execute_with(|| { - let _ = Balances::deposit_creating(&ALICE, 1_000_000); - - frame_support::storage::unhashed::put_raw( - &[1, 2, 3, 4], - 0x14144020u32.to_le_bytes().to_vec().as_ref() - ); - - assert_ok!(Contracts::put_code(Origin::signed(ALICE), wasm)); - assert_ok!(Contracts::instantiate( - Origin::signed(ALICE), - 100, - GAS_LIMIT, - code_hash.into(), - vec![], - )); - assert_ok!(Contracts::call( - Origin::signed(ALICE), - BOB, - 0, - GAS_LIMIT, - vec![], - )); - }); -} - #[test] fn crypto_hashes() { let (wasm, code_hash) = compile_module::("crypto_hashes").unwrap(); diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index a4814a1b22..3d2f5b154f 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -206,7 +206,6 @@ mod tests { instantiates: Vec, terminations: Vec, transfers: Vec, - dispatches: Vec, restores: Vec, // (topics, data) events: Vec<(Vec, Vec)>, @@ -299,9 +298,6 @@ mod tests { }); Ok(()) } - fn note_dispatch_call(&mut self, call: Call) { - self.dispatches.push(DispatchEntry(call)); - } fn restore_to( &mut self, dest: u64, @@ -421,9 +417,6 @@ mod tests { ) -> ExecResult { (**self).call(to, value, gas_meter, input_data) } - fn note_dispatch_call(&mut self, call: Call) { - (**self).note_dispatch_call(call) - } fn restore_to( &mut self, dest: u64, @@ -1238,44 +1231,6 @@ mod tests { ).unwrap(); } - const CODE_DISPATCH_CALL: &str = r#" -(module - (import "env" "ext_dispatch_call" (func $ext_dispatch_call (param i32 i32))) - (import "env" "memory" (memory 1 1)) - - (func (export "call") - (call $ext_dispatch_call - (i32.const 8) ;; Pointer to the start of encoded call buffer - (i32.const 13) ;; Length of the buffer - ) - ) - (func (export "deploy")) - - (data (i32.const 8) "\00\01\2A\00\00\00\00\00\00\00\E5\14\00") -) -"#; - - #[test] - fn dispatch_call() { - // This test can fail due to the encoding changes. In case it becomes too annoying - // let's rewrite so as we use this module controlled call or we serialize it in runtime. - - let mut mock_ext = MockExt::default(); - let _ = execute( - CODE_DISPATCH_CALL, - vec![], - &mut mock_ext, - &mut GasMeter::new(GAS_LIMIT), - ).unwrap(); - - assert_eq!( - &mock_ext.dispatches, - &[DispatchEntry( - Call::Balances(pallet_balances::Call::set_balance(42, 1337, 0)), - )] - ); - } - const CODE_RETURN_FROM_START_FN: &str = r#" (module (import "env" "ext_return" (func $ext_return (param i32 i32))) @@ -1883,103 +1838,4 @@ mod tests { assert_eq!(output, ExecReturnValue { status: 17, data: hex!("5566778899").to_vec() }); assert!(!output.is_success()); } - - const CODE_GET_RUNTIME_STORAGE: &str = r#" -(module - (import "env" "ext_get_runtime_storage" - (func $ext_get_runtime_storage (param i32 i32) (result i32)) - ) - (import "env" "ext_scratch_size" (func $ext_scratch_size (result i32))) - (import "env" "ext_scratch_read" (func $ext_scratch_read (param i32 i32 i32))) - (import "env" "ext_scratch_write" (func $ext_scratch_write (param i32 i32))) - (import "env" "memory" (memory 1 1)) - - (func (export "deploy")) - - (func $assert (param i32) - (block $ok - (br_if $ok - (get_local 0) - ) - (unreachable) - ) - ) - - (func $call (export "call") - ;; Load runtime storage for the first key and assert that it exists. - (call $assert - (i32.eq - (call $ext_get_runtime_storage - (i32.const 16) - (i32.const 4) - ) - (i32.const 0) - ) - ) - - ;; assert $ext_scratch_size == 4 - (call $assert - (i32.eq - (call $ext_scratch_size) - (i32.const 4) - ) - ) - - ;; copy contents of the scratch buffer into the contract's memory. - (call $ext_scratch_read - (i32.const 4) ;; Pointer in memory to the place where to copy. - (i32.const 0) ;; Offset from the start of the scratch buffer. - (i32.const 4) ;; Count of bytes to copy. - ) - - ;; assert that contents of the buffer is equal to the i32 value of 0x14144020. - (call $assert - (i32.eq - (i32.load - (i32.const 4) - ) - (i32.const 0x14144020) - ) - ) - - ;; Load the second key and assert that it doesn't exist. - (call $assert - (i32.eq - (call $ext_get_runtime_storage - (i32.const 20) - (i32.const 4) - ) - (i32.const 1) - ) - ) - ) - - ;; The first key, 4 bytes long. - (data (i32.const 16) "\01\02\03\04") - ;; The second key, 4 bytes long. - (data (i32.const 20) "\02\03\04\05") -) -"#; - - #[test] - fn get_runtime_storage() { - let mut gas_meter = GasMeter::new(GAS_LIMIT); - let mock_ext = MockExt::default(); - - // "\01\02\03\04" - Some(0x14144020) - // "\02\03\04\05" - None - *mock_ext.runtime_storage_keys.borrow_mut() = [ - ([1, 2, 3, 4].to_vec(), Some(0x14144020u32.to_le_bytes().to_vec())), - ([2, 3, 4, 5].to_vec().to_vec(), None), - ] - .iter() - .cloned() - .collect(); - let _ = execute( - CODE_GET_RUNTIME_STORAGE, - vec![], - mock_ext, - &mut gas_meter, - ).unwrap(); - } } diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 8c4d1bfb99..7b64117cd2 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -32,7 +32,6 @@ use sp_io::hashing::{ blake2_128, sha2_256, }; -use frame_support::weights::GetDispatchInfo; /// The value returned from ext_call and ext_instantiate contract external functions if the call or /// instantiation traps. This value is chosen as if the execution does not trap, the return value @@ -162,8 +161,6 @@ pub enum RuntimeToken { /// The given number of bytes is read from the sandbox memory and /// is returned as the return data buffer of the call. ReturnData(u32), - /// Dispatched a call with the given weight. - DispatchWithWeight(Gas), /// (topic_count, data_bytes): A buffer of the given size is posted as an event indexed with the /// given number of topics. DepositEvent(u32, u32), @@ -204,7 +201,6 @@ impl Token for RuntimeToken { data_and_topics_cost.checked_add(metadata.event_base_cost) ) }, - DispatchWithWeight(gas) => gas.checked_add(metadata.dispatch_base_cost), }; value.unwrap_or_else(|| Bounded::max_value()) @@ -785,30 +781,6 @@ define_env!(Env, , Ok(()) }, - // Decodes the given buffer as a `T::Call` and adds it to the list - // of to-be-dispatched calls. - // - // All calls made it to the top-level context will be dispatched before - // finishing the execution of the calling extrinsic. - ext_dispatch_call(ctx, call_ptr: u32, call_len: u32) => { - let call: <::T as Trait>::Call = - read_sandbox_memory_as(ctx, call_ptr, call_len)?; - - // We already deducted the len costs when reading from the sandbox. - // Bill on the actual weight of the dispatched call. - let info = call.get_dispatch_info(); - charge_gas( - &mut ctx.gas_meter, - ctx.schedule, - &mut ctx.special_trap, - RuntimeToken::DispatchWithWeight(info.weight) - )?; - - ctx.ext.note_dispatch_call(call); - - Ok(()) - }, - // Try to restore the given destination contract sacrificing the caller. // // This function will compute a tombstone hash from the caller's storage and the given code hash @@ -1005,32 +977,6 @@ define_env!(Env, , Ok(()) }, - // Retrieve the value under the given key from the **runtime** storage and return 0. - // If there is no entry under the given key then this function will return 1 and - // clear the scratch buffer. - // - // - key_ptr: the pointer into the linear memory where the requested value is placed. - // - key_len: the length of the key in bytes. - ext_get_runtime_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { - // Steal the scratch buffer so that we hopefully save an allocation for the `key_buf`. - read_sandbox_memory_into_scratch(ctx, key_ptr, key_len)?; - let key_buf = mem::replace(&mut ctx.scratch_buf, Vec::new()); - - match ctx.ext.get_runtime_storage(&key_buf) { - Some(value_buf) => { - // The given value exists. - ctx.scratch_buf = value_buf; - Ok(0) - } - None => { - // Put back the `key_buf` and allow its allocation to be reused. - ctx.scratch_buf = key_buf; - ctx.scratch_buf.clear(); - Ok(1) - } - } - }, - // Computes the SHA2 256-bit hash on the given input buffer. // // Returns the result directly into the given output buffer. -- GitLab From 357279d9554b8bd996055683aa84ea9d5fadd477 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Wed, 24 Jun 2020 15:32:50 +0200 Subject: [PATCH 236/280] Generic Normalize impl for arithmetic and npos-elections (#6374) * add normalize * better api for normalize * Some grumbles * Update primitives/arithmetic/src/lib.rs Co-authored-by: Guillaume Thiolliere * More great review grumbles * Way better doc for everything. * Some improvement * Update primitives/arithmetic/src/lib.rs Co-authored-by: Bernhard Schuster Co-authored-by: Guillaume Thiolliere Co-authored-by: Bernhard Schuster --- frame/staking/fuzzer/src/submit_solution.rs | 17 +- frame/staking/src/offchain_election.rs | 3 +- frame/staking/src/testing_utils.rs | 7 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 + primitives/arithmetic/fuzzer/src/normalize.rs | 62 +++ .../fuzzer/src/per_thing_rational.rs | 2 +- primitives/arithmetic/src/lib.rs | 364 ++++++++++++++++- primitives/arithmetic/src/per_things.rs | 11 +- primitives/arithmetic/src/traits.rs | 2 +- primitives/npos-elections/benches/phragmen.rs | 4 +- primitives/npos-elections/src/helpers.rs | 57 ++- primitives/npos-elections/src/lib.rs | 114 +++--- primitives/npos-elections/src/tests.rs | 366 +++++++++++------- primitives/runtime/src/lib.rs | 2 +- test-utils/src/lib.rs | 2 +- 15 files changed, 790 insertions(+), 227 deletions(-) create mode 100644 primitives/arithmetic/fuzzer/src/normalize.rs diff --git a/frame/staking/fuzzer/src/submit_solution.rs b/frame/staking/fuzzer/src/submit_solution.rs index 7094c7ed88..7293cf2389 100644 --- a/frame/staking/fuzzer/src/submit_solution.rs +++ b/frame/staking/fuzzer/src/submit_solution.rs @@ -44,7 +44,9 @@ enum Mode { } pub fn new_test_ext(iterations: u32) -> sp_io::TestExternalities { - let mut ext: sp_io::TestExternalities = frame_system::GenesisConfig::default().build_storage::().map(Into::into) + let mut ext: sp_io::TestExternalities = frame_system::GenesisConfig::default() + .build_storage::() + .map(Into::into) .expect("Failed to create test externalities."); let (offchain, offchain_state) = TestOffchainExt::new(); @@ -70,26 +72,29 @@ fn main() { loop { fuzz!(|data: (u32, u32, u32, u32, u32)| { let (mut num_validators, mut num_nominators, mut edge_per_voter, mut to_elect, mode_u32) = data; + // always run with 5 iterations. let mut ext = new_test_ext(5); let mode: Mode = unsafe { std::mem::transmute(mode_u32) }; num_validators = to_range(num_validators, 50, 1000); num_nominators = to_range(num_nominators, 50, 2000); edge_per_voter = to_range(edge_per_voter, 1, 16); to_elect = to_range(to_elect, 20, num_validators); + let do_reduce = true; - println!("+++ instance with params {} / {} / {} / {:?}({}) / {}", + println!("+++ instance with params {} / {} / {} / {} / {:?}({})", num_nominators, num_validators, edge_per_voter, + to_elect, mode, mode_u32, - to_elect, ); ext.execute_with(|| { // initial setup init_active_era(); + assert_ok!(create_validators_with_nominators_for_era::( num_validators, num_nominators, @@ -97,11 +102,11 @@ fn main() { true, None, )); + >::put(ElectionStatus::Open(1)); assert!(>::create_stakers_snapshot().0); - let origin = RawOrigin::Signed(create_funded_user::("fuzzer", 0, 100)); - println!("++ Chain setup done."); + let origin = RawOrigin::Signed(create_funded_user::("fuzzer", 0, 100)); // stuff to submit let (winners, compact, score, size) = match mode { @@ -141,8 +146,6 @@ fn main() { } }; - println!("++ Submission ready. Score = {:?}", score); - // must have chosen correct number of winners. assert_eq!(winners.len() as u32, >::validator_count()); diff --git a/frame/staking/src/offchain_election.rs b/frame/staking/src/offchain_election.rs index 23453e0524..79f3a5c2d9 100644 --- a/frame/staking/src/offchain_election.rs +++ b/frame/staking/src/offchain_election.rs @@ -203,7 +203,8 @@ pub fn prepare_submission( } // Convert back to ratio assignment. This takes less space. - let low_accuracy_assignment = sp_npos_elections::assignment_staked_to_ratio(staked); + let low_accuracy_assignment = sp_npos_elections::assignment_staked_to_ratio_normalized(staked) + .map_err(|e| OffchainElectionError::from(e))?; // convert back to staked to compute the score in the receiver's accuracy. This can be done // nicer, for now we do it as such since this code is not time-critical. This ensure that the diff --git a/frame/staking/src/testing_utils.rs b/frame/staking/src/testing_utils.rs index 86d137ac30..a73073bb1f 100644 --- a/frame/staking/src/testing_utils.rs +++ b/frame/staking/src/testing_utils.rs @@ -201,11 +201,8 @@ pub fn get_weak_solution( }; // convert back to ratio assignment. This takes less space. - let low_accuracy_assignment: Vec> = - staked_assignments - .into_iter() - .map(|sa| sa.into_assignment(true)) - .collect(); + let low_accuracy_assignment = assignment_staked_to_ratio_normalized(staked_assignments) + .expect("Failed to normalize"); // re-calculate score based on what the chain will decode. let score = { diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index a37ab876ef..b6bbe3d8a6 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -24,6 +24,10 @@ num-traits = "0.2" name = "biguint" path = "src/biguint.rs" +[[bin]] +name = "normalize" +path = "src/normalize.rs" + [[bin]] name = "per_thing_rational" path = "src/per_thing_rational.rs" diff --git a/primitives/arithmetic/fuzzer/src/normalize.rs b/primitives/arithmetic/fuzzer/src/normalize.rs new file mode 100644 index 0000000000..34c4ef9cb0 --- /dev/null +++ b/primitives/arithmetic/fuzzer/src/normalize.rs @@ -0,0 +1,62 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +//! # Running +//! Running this fuzzer can be done with `cargo hfuzz run normalize`. `honggfuzz` CLI options can +//! be used by setting `HFUZZ_RUN_ARGS`, such as `-n 4` to use 4 threads. +//! +//! # Debugging a panic +//! Once a panic is found, it can be debugged with +//! `cargo hfuzz run-debug normalize hfuzz_workspace/normalize/*.fuzz`. + +use honggfuzz::fuzz; +use sp_arithmetic::Normalizable; +use std::convert::TryInto; + +fn main() { + let sum_limit = u32::max_value() as u128; + let len_limit: usize = u32::max_value().try_into().unwrap(); + + loop { + fuzz!(|data: (Vec, u32)| { + let (data, norm) = data; + if data.len() == 0 { return; } + let pre_sum: u128 = data.iter().map(|x| *x as u128).sum(); + + let normalized = data.normalize(norm); + // error cases. + if pre_sum > sum_limit || data.len() > len_limit { + assert!(normalized.is_err()) + } else { + if let Ok(normalized) = normalized { + // if sum goes beyond u128, panic. + let sum: u128 = normalized.iter().map(|x| *x as u128).sum(); + + // if this function returns Ok(), then it will ALWAYS be accurate. + assert_eq!( + sum, + norm as u128, + "sums don't match {:?}, {}", + normalized, + norm, + ); + } + } + }) + } +} diff --git a/primitives/arithmetic/fuzzer/src/per_thing_rational.rs b/primitives/arithmetic/fuzzer/src/per_thing_rational.rs index 0820a35100..fc22eacc9e 100644 --- a/primitives/arithmetic/fuzzer/src/per_thing_rational.rs +++ b/primitives/arithmetic/fuzzer/src/per_thing_rational.rs @@ -114,7 +114,7 @@ fn main() { } } -fn assert_per_thing_equal_error(a: T, b: T, err: u128) { +fn assert_per_thing_equal_error(a: P, b: P, err: u128) { let a_abs = a.deconstruct().saturated_into::(); let b_abs = b.deconstruct().saturated_into::(); let diff = a_abs.max(b_abs) - a_abs.min(b_abs); diff --git a/primitives/arithmetic/src/lib.rs b/primitives/arithmetic/src/lib.rs index 9fdfe4b5e1..5c0d2baa51 100644 --- a/primitives/arithmetic/src/lib.rs +++ b/primitives/arithmetic/src/lib.rs @@ -41,10 +41,11 @@ mod fixed_point; mod rational128; pub use fixed_point::{FixedPointNumber, FixedPointOperand, FixedI64, FixedI128, FixedU128}; -pub use per_things::{PerThing, InnerOf, Percent, PerU16, Permill, Perbill, Perquintill}; +pub use per_things::{PerThing, InnerOf, UpperOf, Percent, PerU16, Permill, Perbill, Perquintill}; pub use rational128::Rational128; -use sp_std::cmp::Ordering; +use sp_std::{prelude::*, cmp::Ordering, fmt::Debug, convert::TryInto}; +use traits::{BaseArithmetic, One, Zero, SaturatedConversion, Unsigned}; /// Trait for comparing two numbers with an threshold. /// @@ -85,8 +86,365 @@ where } } +/// A collection-like object that is made of values of type `T` and can normalize its individual +/// values around a centric point. +/// +/// Note that the order of items in the collection may affect the result. +pub trait Normalizable { + /// Normalize self around `targeted_sum`. + /// + /// Only returns `Ok` if the new sum of results is guaranteed to be equal to `targeted_sum`. + /// Else, returns an error explaining why it failed to do so. + fn normalize(&self, targeted_sum: T) -> Result, &'static str>; +} + +macro_rules! impl_normalize_for_numeric { + ($($numeric:ty),*) => { + $( + impl Normalizable<$numeric> for Vec<$numeric> { + fn normalize(&self, targeted_sum: $numeric) -> Result, &'static str> { + normalize(self.as_ref(), targeted_sum) + } + } + )* + }; +} + +impl_normalize_for_numeric!(u8, u16, u32, u64, u128); + +impl Normalizable

for Vec

{ + fn normalize(&self, targeted_sum: P) -> Result, &'static str> { + let inners = self.iter().map(|p| p.clone().deconstruct().into()).collect::>(); + let normalized = normalize(inners.as_ref(), targeted_sum.deconstruct().into())?; + Ok(normalized.into_iter().map(|i: UpperOf

| P::from_parts(i.saturated_into())).collect()) + } +} + + +/// Normalize `input` so that the sum of all elements reaches `targeted_sum`. +/// +/// This implementation is currently in a balanced position between being performant and accurate. +/// +/// 1. We prefer storing original indices, and sorting the `input` only once. This will save the +/// cost of sorting per round at the cost of a little bit of memory. +/// 2. The granularity of increment/decrements is determined by the number of elements in `input` +/// and their sum difference with `targeted_sum`, namely `diff = diff(sum(input), target_sum)`. +/// This value is then distributed into `per_round = diff / input.len()` and `leftover = diff % +/// round`. First, per_round is applied to all elements of input, and then we move to leftover, +/// in which case we add/subtract 1 by 1 until `leftover` is depleted. +/// +/// When the sum is less than the target, the above approach always holds. In this case, then each +/// individual element is also less than target. Thus, by adding `per_round` to each item, neither +/// of them can overflow the numeric bound of `T`. In fact, neither of the can go beyond +/// `target_sum`*. +/// +/// If sum is more than target, there is small twist. The subtraction of `per_round` +/// form each element might go below zero. In this case, we saturate and add the error to the +/// `leftover` value. This ensures that the result will always stay accurate, yet it might cause the +/// execution to become increasingly slow, since leftovers are applied one by one. +/// +/// All in all, the complicated case above is rare to happen in all substrate use cases, hence we +/// opt for it due to its simplicity. +/// +/// This function will return an error is if length of `input` cannot fit in `T`, or if `sum(input)` +/// cannot fit inside `T`. +/// +/// * This proof is used in the implementation as well. +pub fn normalize(input: &[T], targeted_sum: T) -> Result, &'static str> + where T: Clone + Copy + Ord + BaseArithmetic + Unsigned + Debug, +{ + // compute sum and return error if failed. + let mut sum = T::zero(); + for t in input.iter() { + sum = sum.checked_add(t).ok_or("sum of input cannot fit in `T`")?; + } + + // convert count and return error if failed. + let count = input.len(); + let count_t: T = count.try_into().map_err(|_| "length of `inputs` cannot fit in `T`")?; + + // Nothing to do here. + if count.is_zero() { + return Ok(Vec::::new()); + } + + let diff = targeted_sum.max(sum) - targeted_sum.min(sum); + if diff.is_zero() { + return Ok(input.to_vec()); + } + + let needs_bump = targeted_sum > sum; + let per_round = diff / count_t; + let mut leftover = diff % count_t; + + // sort output once based on diff. This will require more data transfer and saving original + // index, but we sort only twice instead: once now and once at the very end. + let mut output_with_idx = input.iter().cloned().enumerate().collect::>(); + output_with_idx.sort_unstable_by_key(|x| x.1); + + if needs_bump { + // must increase the values a bit. Bump from the min element. Index of minimum is now zero + // because we did a sort. If at any point the min goes greater or equal the `max_threshold`, + // we move to the next minimum. + let mut min_index = 0; + // at this threshold we move to next index. + let threshold = targeted_sum / count_t; + + if !per_round.is_zero() { + for _ in 0..count { + output_with_idx[min_index].1 = output_with_idx[min_index].1 + .checked_add(&per_round) + .expect("Proof provided in the module doc; qed."); + if output_with_idx[min_index].1 >= threshold { + min_index += 1; + min_index = min_index % count; + } + } + } + + // continue with the previous min_index + while !leftover.is_zero() { + output_with_idx[min_index].1 = output_with_idx[min_index].1 + .checked_add(&T::one()) + .expect("Proof provided in the module doc; qed."); + if output_with_idx[min_index].1 >= threshold { + min_index += 1; + min_index = min_index % count; + } + leftover -= One::one() + } + } else { + // must decrease the stakes a bit. decrement from the max element. index of maximum is now + // last. if at any point the max goes less or equal the `min_threshold`, we move to the next + // maximum. + let mut max_index = count - 1; + // at this threshold we move to next index. + let threshold = output_with_idx + .first() + .expect("length of input is greater than zero; it must have a first; qed") + .1; + + if !per_round.is_zero() { + for _ in 0..count { + output_with_idx[max_index].1 = output_with_idx[max_index].1 + .checked_sub(&per_round) + .unwrap_or_else(|| { + let remainder = per_round - output_with_idx[max_index].1; + leftover += remainder; + output_with_idx[max_index].1.saturating_sub(per_round) + }); + if output_with_idx[max_index].1 <= threshold { + max_index = max_index.checked_sub(1).unwrap_or(count - 1); + } + } + } + + // continue with the previous max_index + while !leftover.is_zero() { + if let Some(next) = output_with_idx[max_index].1.checked_sub(&One::one()) { + output_with_idx[max_index].1 = next; + if output_with_idx[max_index].1 <= threshold { + max_index = max_index.checked_sub(1).unwrap_or(count - 1); + } + leftover -= One::one() + } else { + max_index = max_index.checked_sub(1).unwrap_or(count - 1); + } + } + } + + debug_assert_eq!( + output_with_idx.iter().fold(T::zero(), |acc, (_, x)| acc + *x), + targeted_sum, + "sum({:?}) != {:?}", + output_with_idx, + targeted_sum, + ); + + // sort again based on the original index. + output_with_idx.sort_unstable_by_key(|x| x.0); + Ok(output_with_idx.into_iter().map(|(_, t)| t).collect()) +} + +#[cfg(test)] +mod normalize_tests { + use super::*; + + #[test] + fn work_for_all_types() { + macro_rules! test_for { + ($type:ty) => { + assert_eq!( + normalize(vec![8 as $type, 9, 7, 10].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + } + } + // it should work for all types as long as the length of vector can be converted to T. + test_for!(u128); + test_for!(u64); + test_for!(u32); + test_for!(u16); + test_for!(u8); + } + + #[test] + fn fails_on_if_input_sum_large() { + assert!(normalize(vec![1u8; 255].as_ref(), 10).is_ok()); + assert_eq!( + normalize(vec![1u8; 256].as_ref(), 10), + Err("sum of input cannot fit in `T`"), + ); + } + + #[test] + fn does_not_fail_on_subtraction_overflow() { + assert_eq!( + normalize(vec![1u8, 100, 100].as_ref(), 10).unwrap(), + vec![1, 9, 0], + ); + assert_eq!( + normalize(vec![1u8, 8, 9].as_ref(), 1).unwrap(), + vec![0, 1, 0], + ); + } + + #[test] + fn works_for_vec() { + assert_eq!(vec![8u32, 9, 7, 10].normalize(40).unwrap(), vec![10u32, 10, 10, 10]); + } + + #[test] + fn works_for_per_thing() { + assert_eq!( + vec![ + Perbill::from_percent(33), + Perbill::from_percent(33), + Perbill::from_percent(33) + ].normalize(Perbill::one()).unwrap(), + vec![ + Perbill::from_parts(333333334), + Perbill::from_parts(333333333), + Perbill::from_parts(333333333), + ] + ); + + assert_eq!( + vec![ + Perbill::from_percent(20), + Perbill::from_percent(15), + Perbill::from_percent(30) + ].normalize(Perbill::one()).unwrap(), + vec![ + Perbill::from_parts(316666668), + Perbill::from_parts(383333332), + Perbill::from_parts(300000000), + ] + ); + } + + #[test] + fn can_work_for_peru16() { + // Peru16 is a rather special case; since inner type is exactly the same as capacity, we + // could have a situation where the sum cannot be calculated in the inner type. Calculating + // using the upper type of the per_thing should assure this to be okay. + assert_eq!( + vec![ + PerU16::from_percent(40), + PerU16::from_percent(40), + PerU16::from_percent(40), + ].normalize(PerU16::one()).unwrap(), + vec![ + PerU16::from_parts(21845), // 33% + PerU16::from_parts(21845), // 33% + PerU16::from_parts(21845), // 33% + ] + ); + } + + #[test] + fn normalize_works_all_le() { + assert_eq!( + normalize(vec![8u32, 9, 7, 10].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + + assert_eq!( + normalize(vec![7u32, 7, 7, 7].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + + assert_eq!( + normalize(vec![7u32, 7, 7, 10].as_ref(), 40).unwrap(), + vec![11, 11, 8, 10], + ); + + assert_eq!( + normalize(vec![7u32, 8, 7, 10].as_ref(), 40).unwrap(), + vec![11, 8, 11, 10], + ); + + assert_eq!( + normalize(vec![7u32, 7, 8, 10].as_ref(), 40).unwrap(), + vec![11, 11, 8, 10], + ); + } + + #[test] + fn normalize_works_some_ge() { + assert_eq!( + normalize(vec![8u32, 11, 9, 10].as_ref(), 40).unwrap(), + vec![10, 11, 9, 10], + ); + } + + #[test] + fn always_inc_min() { + assert_eq!( + normalize(vec![10u32, 7, 10, 10].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + assert_eq!( + normalize(vec![10u32, 10, 7, 10].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + assert_eq!( + normalize(vec![10u32, 10, 10, 7].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + } + + #[test] + fn normalize_works_all_ge() { + assert_eq!( + normalize(vec![12u32, 11, 13, 10].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + + assert_eq!( + normalize(vec![13u32, 13, 13, 13].as_ref(), 40).unwrap(), + vec![10, 10, 10, 10], + ); + + assert_eq!( + normalize(vec![13u32, 13, 13, 10].as_ref(), 40).unwrap(), + vec![12, 9, 9, 10], + ); + + assert_eq!( + normalize(vec![13u32, 12, 13, 10].as_ref(), 40).unwrap(), + vec![9, 12, 9, 10], + ); + + assert_eq!( + normalize(vec![13u32, 13, 12, 10].as_ref(), 40).unwrap(), + vec![9, 9, 12, 10], + ); + } +} + #[cfg(test)] -mod tests { +mod threshold_compare_tests { use super::*; use crate::traits::Saturating; use sp_std::cmp::Ordering; diff --git a/primitives/arithmetic/src/per_things.rs b/primitives/arithmetic/src/per_things.rs index 50b87d5076..521f4d1074 100644 --- a/primitives/arithmetic/src/per_things.rs +++ b/primitives/arithmetic/src/per_things.rs @@ -21,24 +21,29 @@ use serde::{Serialize, Deserialize}; use sp_std::{ops, fmt, prelude::*, convert::TryInto}; use codec::{Encode, CompactAs}; use crate::traits::{ - SaturatedConversion, UniqueSaturatedInto, Saturating, BaseArithmetic, Bounded, Zero, + SaturatedConversion, UniqueSaturatedInto, Saturating, BaseArithmetic, Bounded, Zero, Unsigned, }; use sp_debug_derive::RuntimeDebug; /// Get the inner type of a `PerThing`. pub type InnerOf

=

::Inner; +/// Get the upper type of a `PerThing`. +pub type UpperOf

=

::Upper; + /// Something that implements a fixed point ration with an arbitrary granularity `X`, as _parts per /// `X`_. pub trait PerThing: Sized + Saturating + Copy + Default + Eq + PartialEq + Ord + PartialOrd + Bounded + fmt::Debug { /// The data type used to build this per-thingy. - type Inner: BaseArithmetic + Copy + fmt::Debug; + type Inner: BaseArithmetic + Unsigned + Copy + fmt::Debug; /// A data type larger than `Self::Inner`, used to avoid overflow in some computations. /// It must be able to compute `ACCURACY^2`. - type Upper: BaseArithmetic + Copy + From + TryInto + fmt::Debug; + type Upper: + BaseArithmetic + Copy + From + TryInto + + UniqueSaturatedInto + Unsigned + fmt::Debug; /// The accuracy of this type. const ACCURACY: Self::Inner; diff --git a/primitives/arithmetic/src/traits.rs b/primitives/arithmetic/src/traits.rs index 3921d253da..29b8e419ef 100644 --- a/primitives/arithmetic/src/traits.rs +++ b/primitives/arithmetic/src/traits.rs @@ -22,7 +22,7 @@ use codec::HasCompact; pub use integer_sqrt::IntegerSquareRoot; pub use num_traits::{ Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, CheckedNeg, - CheckedShl, CheckedShr, checked_pow, Signed + CheckedShl, CheckedShr, checked_pow, Signed, Unsigned, }; use sp_std::ops::{ Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, diff --git a/primitives/npos-elections/benches/phragmen.rs b/primitives/npos-elections/benches/phragmen.rs index 7e46b9dce1..e2385665bf 100644 --- a/primitives/npos-elections/benches/phragmen.rs +++ b/primitives/npos-elections/benches/phragmen.rs @@ -59,8 +59,8 @@ mod bench_closure_and_slice { } /// Converts a vector of ratio assignments into ones with absolute budget value. - pub fn assignment_ratio_to_staked_slice( - ratio: Vec>, + pub fn assignment_ratio_to_staked_slice( + ratio: Vec>, stakes: &[VoteWeight], ) -> Vec> where diff --git a/primitives/npos-elections/src/helpers.rs b/primitives/npos-elections/src/helpers.rs index 1c96300c66..063eac70c5 100644 --- a/primitives/npos-elections/src/helpers.rs +++ b/primitives/npos-elections/src/helpers.rs @@ -17,37 +17,72 @@ //! Helper methods for npos-elections. -use crate::{Assignment, ExtendedBalance, VoteWeight, IdentifierT, StakedAssignment, WithApprovalOf}; -use sp_arithmetic::PerThing; +use crate::{Assignment, ExtendedBalance, VoteWeight, IdentifierT, StakedAssignment, WithApprovalOf, Error}; +use sp_arithmetic::{PerThing, InnerOf}; use sp_std::prelude::*; /// Converts a vector of ratio assignments into ones with absolute budget value. -pub fn assignment_ratio_to_staked( - ratio: Vec>, +/// +/// Note that this will NOT attempt at normalizing the result. +pub fn assignment_ratio_to_staked( + ratio: Vec>, stake_of: FS, ) -> Vec> where for<'r> FS: Fn(&'r A) -> VoteWeight, - T: sp_std::ops::Mul, - ExtendedBalance: From<::Inner>, + P: sp_std::ops::Mul, + ExtendedBalance: From>, { ratio .into_iter() .map(|a| { let stake = stake_of(&a.who); - a.into_staked(stake.into(), true) + a.into_staked(stake.into()) }) .collect() } +/// Same as [`assignment_ratio_to_staked`] and try and do normalization. +pub fn assignment_ratio_to_staked_normalized( + ratio: Vec>, + stake_of: FS, +) -> Result>, Error> +where + for<'r> FS: Fn(&'r A) -> VoteWeight, + P: sp_std::ops::Mul, + ExtendedBalance: From>, +{ + let mut staked = assignment_ratio_to_staked(ratio, &stake_of); + staked.iter_mut().map(|a| + a.try_normalize(stake_of(&a.who).into()).map_err(|err| Error::ArithmeticError(err)) + ).collect::>()?; + Ok(staked) +} + /// Converts a vector of staked assignments into ones with ratio values. -pub fn assignment_staked_to_ratio( +/// +/// Note that this will NOT attempt at normalizing the result. +pub fn assignment_staked_to_ratio( + staked: Vec>, +) -> Vec> +where + ExtendedBalance: From>, +{ + staked.into_iter().map(|a| a.into_assignment()).collect() +} + +/// Same as [`assignment_staked_to_ratio`] and try and do normalization. +pub fn assignment_staked_to_ratio_normalized( staked: Vec>, -) -> Vec> +) -> Result>, Error> where - ExtendedBalance: From<::Inner>, + ExtendedBalance: From>, { - staked.into_iter().map(|a| a.into_assignment(true)).collect() + let mut ratio = staked.into_iter().map(|a| a.into_assignment()).collect::>(); + ratio.iter_mut().map(|a| + a.try_normalize().map_err(|err| Error::ArithmeticError(err)) + ).collect::>()?; + Ok(ratio) } /// consumes a vector of winners with backing stake to just winners. diff --git a/primitives/npos-elections/src/lib.rs b/primitives/npos-elections/src/lib.rs index 72eddf9a1d..592ed3b717 100644 --- a/primitives/npos-elections/src/lib.rs +++ b/primitives/npos-elections/src/lib.rs @@ -30,7 +30,7 @@ use sp_std::{prelude::*, collections::btree_map::BTreeMap, fmt::Debug, cmp::Ordering, convert::TryFrom}; use sp_arithmetic::{ - PerThing, Rational128, ThresholdOrd, + PerThing, Rational128, ThresholdOrd, InnerOf, Normalizable, helpers_128bit::multiply_by_rational, traits::{Zero, Saturating, Bounded, SaturatedConversion}, }; @@ -84,6 +84,8 @@ pub enum Error { CompactTargetOverflow, /// One of the index functions returned none. CompactInvalidIndex, + /// An error occurred in some arithmetic operation. + ArithmeticError(&'static str), } /// A type which is used in the API of this crate as a numeric weight of a vote, most often the @@ -155,16 +157,16 @@ pub struct ElectionResult { /// A voter's stake assignment among a set of targets, represented as ratios. #[derive(Debug, Clone, Default)] #[cfg_attr(feature = "std", derive(PartialEq, Eq, Encode, Decode))] -pub struct Assignment { +pub struct Assignment { /// Voter's identifier. pub who: AccountId, /// The distribution of the voter's stake. - pub distribution: Vec<(AccountId, T)>, + pub distribution: Vec<(AccountId, P)>, } -impl Assignment +impl Assignment where - ExtendedBalance: From<::Inner>, + ExtendedBalance: From>, { /// Convert from a ratio assignment into one with absolute values aka. [`StakedAssignment`]. /// @@ -173,50 +175,49 @@ where /// distribution's sum is exactly equal to the total budget, by adding or subtracting the /// remainder from the last distribution. /// - /// If an edge ratio is [`Bounded::max_value()`], it is dropped. This edge can never mean + /// If an edge ratio is [`Bounded::min_value()`], it is dropped. This edge can never mean /// anything useful. - pub fn into_staked(self, stake: ExtendedBalance, fill: bool) -> StakedAssignment + pub fn into_staked(self, stake: ExtendedBalance) -> StakedAssignment where - T: sp_std::ops::Mul, + P: sp_std::ops::Mul, { - let mut sum: ExtendedBalance = Bounded::min_value(); - let mut distribution = self - .distribution + let distribution = self.distribution .into_iter() .filter_map(|(target, p)| { // if this ratio is zero, then skip it. - if p == Bounded::min_value() { + if p.is_zero() { None } else { // NOTE: this mul impl will always round to the nearest number, so we might both // overflow and underflow. let distribution_stake = p * stake; - // defensive only. We assume that balance cannot exceed extended balance. - sum = sum.saturating_add(distribution_stake); Some((target, distribution_stake)) } }) .collect::>(); - if fill { - // NOTE: we can do this better. - // https://revs.runtime-revolution.com/getting-100-with-rounded-percentages-273ffa70252b - if let Some(leftover) = stake.checked_sub(sum) { - if let Some(last) = distribution.last_mut() { - last.1 = last.1.saturating_add(leftover); - } - } else if let Some(excess) = sum.checked_sub(stake) { - if let Some(last) = distribution.last_mut() { - last.1 = last.1.saturating_sub(excess); - } - } - } - StakedAssignment { who: self.who, distribution, } } + + /// Try and normalize this assignment. + /// + /// If `Ok(())` is returned, then the assignment MUST have been successfully normalized to 100%. + pub fn try_normalize(&mut self) -> Result<(), &'static str> { + self.distribution + .iter() + .map(|(_, p)| *p) + .collect::>() + .normalize(P::one()) + .map(|normalized_ratios| + self.distribution + .iter_mut() + .zip(normalized_ratios) + .for_each(|((_, old), corrected)| { *old = corrected; }) + ) + } } /// A voter's stake assignment among a set of targets, represented as absolute values in the scale @@ -243,42 +244,23 @@ impl StakedAssignment { /// /// If an edge stake is so small that it cannot be represented in `T`, it is ignored. This edge /// can never be re-created and does not mean anything useful anymore. - pub fn into_assignment(self, fill: bool) -> Assignment + pub fn into_assignment(self) -> Assignment where - ExtendedBalance: From<::Inner>, + ExtendedBalance: From>, + AccountId: IdentifierT, { - let accuracy: u128 = T::ACCURACY.saturated_into(); - let mut sum: u128 = Zero::zero(); - let stake = self.distribution.iter().map(|x| x.1).sum(); - let mut distribution = self - .distribution + let stake = self.total(); + let distribution = self.distribution .into_iter() .filter_map(|(target, w)| { - let per_thing = T::from_rational_approximation(w, stake); + let per_thing = P::from_rational_approximation(w, stake); if per_thing == Bounded::min_value() { None } else { - sum += per_thing.clone().deconstruct().saturated_into(); Some((target, per_thing)) } }) - .collect::>(); - - if fill { - if let Some(leftover) = accuracy.checked_sub(sum) { - if let Some(last) = distribution.last_mut() { - last.1 = last.1.saturating_add( - T::from_parts(leftover.saturated_into()) - ); - } - } else if let Some(excess) = sum.checked_sub(accuracy) { - if let Some(last) = distribution.last_mut() { - last.1 = last.1.saturating_sub( - T::from_parts(excess.saturated_into()) - ); - } - } - } + .collect::>(); Assignment { who: self.who, @@ -286,6 +268,30 @@ impl StakedAssignment { } } + /// Try and normalize this assignment. + /// + /// If `Ok(())` is returned, then the assignment MUST have been successfully normalized to + /// `stake`. + /// + /// NOTE: current implementation of `.normalize` is almost safe to `expect()` upon. The only + /// error case is when the input cannot fit in `T`, or the sum of input cannot fit in `T`. + /// Sadly, both of these are dependent upon the implementation of `VoteLimit`, i.e. the limit + /// of edges per voter which is enforced from upstream. Hence, at this crate, we prefer + /// returning a result and a use the name prefix `try_`. + pub fn try_normalize(&mut self, stake: ExtendedBalance) -> Result<(), &'static str> { + self.distribution + .iter() + .map(|(_, ref weight)| *weight) + .collect::>() + .normalize(stake) + .map(|normalized_weights| + self.distribution + .iter_mut() + .zip(normalized_weights.into_iter()) + .for_each(|((_, weight), corrected)| { *weight = corrected; }) + ) + } + /// Get the total stake of this assignment (aka voter budget). pub fn total(&self) -> ExtendedBalance { self.distribution.iter().fold(Zero::zero(), |a, b| a.saturating_add(b.1)) diff --git a/primitives/npos-elections/src/tests.rs b/primitives/npos-elections/src/tests.rs index 08923c6949..80c742117d 100644 --- a/primitives/npos-elections/src/tests.rs +++ b/primitives/npos-elections/src/tests.rs @@ -588,184 +588,276 @@ fn self_votes_should_be_kept() { ); } -#[test] -fn assignment_convert_works() { - let staked = StakedAssignment { - who: 1 as AccountId, - distribution: vec![ - (20, 100 as ExtendedBalance), - (30, 25), - ], - }; - - let assignment = staked.clone().into_assignment(true); - assert_eq!( - assignment, - Assignment { - who: 1, +mod assignment_convert_normalize { + use super::*; + #[test] + fn assignment_convert_works() { + let staked = StakedAssignment { + who: 1 as AccountId, distribution: vec![ - (20, Perbill::from_percent(80)), - (30, Perbill::from_percent(20)), - ] - } - ); - - assert_eq!( - assignment.into_staked(125, true), - staked, - ); -} - -#[test] -fn score_comparison_is_lexicographical_no_epsilon() { - let epsilon = Perbill::zero(); - // only better in the fist parameter, worse in the other two ✅ - assert_eq!( - is_score_better([12, 10, 35], [10, 20, 30], epsilon), - true, - ); - - // worse in the first, better in the other two ❌ - assert_eq!( - is_score_better([9, 30, 10], [10, 20, 30], epsilon), - false, - ); - - // equal in the first, the second one dictates. - assert_eq!( - is_score_better([10, 25, 40], [10, 20, 30], epsilon), - true, - ); - - // equal in the first two, the last one dictates. - assert_eq!( - is_score_better([10, 20, 40], [10, 20, 30], epsilon), - false, - ); -} + (20, 100 as ExtendedBalance), + (30, 25), + ], + }; -#[test] -fn score_comparison_with_epsilon() { - let epsilon = Perbill::from_percent(1); + let assignment = staked.clone().into_assignment(); + assert_eq!( + assignment, + Assignment { + who: 1, + distribution: vec![ + (20, Perbill::from_percent(80)), + (30, Perbill::from_percent(20)), + ] + } + ); - { - // no more than 1 percent (10) better in the first param. assert_eq!( - is_score_better([1009, 5000, 100000], [1000, 5000, 100000], epsilon), - false, + assignment.into_staked(125), + staked, ); + } - // now equal, still not better. + #[test] + fn assignment_convert_will_not_normalize() { assert_eq!( - is_score_better([1010, 5000, 100000], [1000, 5000, 100000], epsilon), - false, + Assignment { + who: 1, + distribution: vec![ + (2, Perbill::from_percent(33)), + (3, Perbill::from_percent(66)), + ] + }.into_staked(100), + StakedAssignment { + who: 1, + distribution: vec![ + (2, 33), + (3, 66), + // sum is not 100! + ], + }, ); - // now it is. assert_eq!( - is_score_better([1011, 5000, 100000], [1000, 5000, 100000], epsilon), - true, + StakedAssignment { + who: 1, + distribution: vec![ + (2, 333_333_333_333_333), + (3, 333_333_333_333_333), + (4, 666_666_666_666_333), + ], + }.into_assignment(), + Assignment { + who: 1, + distribution: vec![ + (2, Perbill::from_parts(250000000)), + (3, Perbill::from_parts(250000000)), + (4, Perbill::from_parts(499999999)), + // sum is not 100%! + ] + }, + ) + } + + #[test] + fn assignment_can_normalize() { + let mut a = Assignment { + who: 1, + distribution: vec![ + (2, Perbill::from_parts(330000000)), + (3, Perbill::from_parts(660000000)), + // sum is not 100%! + ] + }; + a.try_normalize().unwrap(); + assert_eq!( + a, + Assignment { + who: 1, + distribution: vec![ + (2, Perbill::from_parts(340000000)), + (3, Perbill::from_parts(660000000)), + ] + }, ); } - { - // First score score is epsilon better, but first score is no longer `ge`. Then this is - // still not a good solution. + #[test] + fn staked_assignment_can_normalize() { + let mut a = StakedAssignment { + who: 1, + distribution: vec![ + (2, 33), + (3, 66), + ] + }; + a.try_normalize(100).unwrap(); assert_eq!( - is_score_better([999, 6000, 100000], [1000, 5000, 100000], epsilon), - false, + a, + StakedAssignment { + who: 1, + distribution: vec![ + (2, 34), + (3, 66), + ] + }, ); } +} - { - // first score is equal or better, but not epsilon. Then second one is the determinant. +mod score { + use super::*; + #[test] + fn score_comparison_is_lexicographical_no_epsilon() { + let epsilon = Perbill::zero(); + // only better in the fist parameter, worse in the other two ✅ assert_eq!( - is_score_better([1005, 5000, 100000], [1000, 5000, 100000], epsilon), - false, + is_score_better([12, 10, 35], [10, 20, 30], epsilon), + true, ); + // worse in the first, better in the other two ❌ assert_eq!( - is_score_better([1005, 5050, 100000], [1000, 5000, 100000], epsilon), + is_score_better([9, 30, 10], [10, 20, 30], epsilon), false, ); + // equal in the first, the second one dictates. assert_eq!( - is_score_better([1005, 5051, 100000], [1000, 5000, 100000], epsilon), + is_score_better([10, 25, 40], [10, 20, 30], epsilon), true, ); - } - { - // first score and second are equal or less than epsilon more, third is determinant. + // equal in the first two, the last one dictates. assert_eq!( - is_score_better([1005, 5025, 100000], [1000, 5000, 100000], epsilon), + is_score_better([10, 20, 40], [10, 20, 30], epsilon), false, ); + } + + #[test] + fn score_comparison_with_epsilon() { + let epsilon = Perbill::from_percent(1); + + { + // no more than 1 percent (10) better in the first param. + assert_eq!( + is_score_better([1009, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + // now equal, still not better. + assert_eq!( + is_score_better([1010, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + // now it is. + assert_eq!( + is_score_better([1011, 5000, 100000], [1000, 5000, 100000], epsilon), + true, + ); + } + + { + // First score score is epsilon better, but first score is no longer `ge`. Then this is + // still not a good solution. + assert_eq!( + is_score_better([999, 6000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + } + + { + // first score is equal or better, but not epsilon. Then second one is the determinant. + assert_eq!( + is_score_better([1005, 5000, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5050, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5051, 100000], [1000, 5000, 100000], epsilon), + true, + ); + } + + { + // first score and second are equal or less than epsilon more, third is determinant. + assert_eq!( + is_score_better([1005, 5025, 100000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5025, 99_000], [1000, 5000, 100000], epsilon), + false, + ); + + assert_eq!( + is_score_better([1005, 5025, 98_999], [1000, 5000, 100000], epsilon), + true, + ); + } + } + + #[test] + fn score_comparison_large_value() { + // some random value taken from eras in kusama. + let initial = [12488167277027543u128, 5559266368032409496, 118749283262079244270992278287436446]; + // this claim is 0.04090% better in the third component. It should be accepted as better if + // epsilon is smaller than 5/10_0000 + let claim = [12488167277027543u128, 5559266368032409496, 118700736389524721358337889258988054]; assert_eq!( - is_score_better([1005, 5025, 99_000], [1000, 5000, 100000], epsilon), - false, + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(1u32, 10_000), + ), + true, ); assert_eq!( - is_score_better([1005, 5025, 98_999], [1000, 5000, 100000], epsilon), + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(2u32, 10_000), + ), true, ); - } -} - -#[test] -fn score_comparison_large_value() { - // some random value taken from eras in kusama. - let initial = [12488167277027543u128, 5559266368032409496, 118749283262079244270992278287436446]; - // this claim is 0.04090% better in the third component. It should be accepted as better if - // epsilon is smaller than 5/10_0000 - let claim = [12488167277027543u128, 5559266368032409496, 118700736389524721358337889258988054]; - - assert_eq!( - is_score_better( - claim.clone(), - initial.clone(), - Perbill::from_rational_approximation(1u32, 10_000), - ), - true, - ); - - assert_eq!( - is_score_better( - claim.clone(), - initial.clone(), - Perbill::from_rational_approximation(2u32, 10_000), - ), - true, - ); - assert_eq!( - is_score_better( - claim.clone(), - initial.clone(), - Perbill::from_rational_approximation(3u32, 10_000), - ), - true, - ); + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(3u32, 10_000), + ), + true, + ); - assert_eq!( - is_score_better( - claim.clone(), - initial.clone(), - Perbill::from_rational_approximation(4u32, 10_000), - ), - true, - ); + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(4u32, 10_000), + ), + true, + ); - assert_eq!( - is_score_better( - claim.clone(), - initial.clone(), - Perbill::from_rational_approximation(5u32, 10_000), - ), - false, - ); + assert_eq!( + is_score_better( + claim.clone(), + initial.clone(), + Perbill::from_rational_approximation(5u32, 10_000), + ), + false, + ); + } } mod compact { diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index a8a518fd7b..881ba3d724 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -71,7 +71,7 @@ pub use sp_core::RuntimeDebug; /// Re-export top-level arithmetic stuff. pub use sp_arithmetic::{ - PerThing, traits::SaturatedConversion, Perquintill, Perbill, Permill, Percent, PerU16, + PerThing, traits::SaturatedConversion, Perquintill, Perbill, Permill, Percent, PerU16, InnerOf, Rational128, FixedI64, FixedI128, FixedU128, FixedPointNumber, FixedPointOperand, }; /// Re-export 128 bit helpers. diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index e600ab9fce..8163460df7 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -38,7 +38,7 @@ /// ``` #[macro_export] macro_rules! assert_eq_uvec { - ( $x:expr, $y:expr ) => { + ( $x:expr, $y:expr $(,)? ) => { $crate::__assert_eq_uvec!($x, $y); $crate::__assert_eq_uvec!($y, $x); } -- GitLab From d17396cebe11dce352aeeaac0b2645354cb2b328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Wed, 24 Jun 2020 17:01:42 +0200 Subject: [PATCH 237/280] Extract frame_system SignedExtensions into separate files. (#6474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Split the code. * Restructure. * Split tests. * Self-review. * Break lines. * Move tests out. * Rename CheckEra -> CheckMortality but keep backwards compatibility * Update frame/system/src/extensions/check_mortality.rs * Don't rename the IDENTIFIER for now. Co-authored-by: Bastian Köcher --- frame/system/src/extensions/check_genesis.rs | 58 + .../system/src/extensions/check_mortality.rs | 124 ++ frame/system/src/extensions/check_nonce.rs | 145 ++ .../src/extensions/check_spec_version.rs | 58 + .../system/src/extensions/check_tx_version.rs | 58 + frame/system/src/extensions/check_weight.rs | 644 +++++++ frame/system/src/extensions/mod.rs | 24 + frame/system/src/lib.rs | 1484 +---------------- frame/system/src/mock.rs | 124 ++ frame/system/src/offchain.rs | 2 +- frame/system/src/tests.rs | 424 +++++ frame/system/src/weights.rs | 76 + 12 files changed, 1757 insertions(+), 1464 deletions(-) create mode 100644 frame/system/src/extensions/check_genesis.rs create mode 100644 frame/system/src/extensions/check_mortality.rs create mode 100644 frame/system/src/extensions/check_nonce.rs create mode 100644 frame/system/src/extensions/check_spec_version.rs create mode 100644 frame/system/src/extensions/check_tx_version.rs create mode 100644 frame/system/src/extensions/check_weight.rs create mode 100644 frame/system/src/extensions/mod.rs create mode 100644 frame/system/src/mock.rs create mode 100644 frame/system/src/tests.rs create mode 100644 frame/system/src/weights.rs diff --git a/frame/system/src/extensions/check_genesis.rs b/frame/system/src/extensions/check_genesis.rs new file mode 100644 index 0000000000..d0a346519c --- /dev/null +++ b/frame/system/src/extensions/check_genesis.rs @@ -0,0 +1,58 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode}; +use crate::{Trait, Module}; +use sp_runtime::{ + traits::{SignedExtension, Zero}, + transaction_validity::TransactionValidityError, +}; + +/// Genesis hash check to provide replay protection between different networks. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct CheckGenesis(sp_std::marker::PhantomData); + +impl sp_std::fmt::Debug for CheckGenesis { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckGenesis") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl CheckGenesis { + /// Creates new `SignedExtension` to check genesis hash. + pub fn new() -> Self { + Self(sp_std::marker::PhantomData) + } +} + +impl SignedExtension for CheckGenesis { + type AccountId = T::AccountId; + type Call = ::Call; + type AdditionalSigned = T::Hash; + type Pre = (); + const IDENTIFIER: &'static str = "CheckGenesis"; + + fn additional_signed(&self) -> Result { + Ok(>::block_hash(T::BlockNumber::zero())) + } +} diff --git a/frame/system/src/extensions/check_mortality.rs b/frame/system/src/extensions/check_mortality.rs new file mode 100644 index 0000000000..cc7496df9a --- /dev/null +++ b/frame/system/src/extensions/check_mortality.rs @@ -0,0 +1,124 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode}; +use crate::{Trait, Module, BlockHash}; +use frame_support::StorageMap; +use sp_runtime::{ + generic::Era, + traits::{SignedExtension, DispatchInfoOf, SaturatedConversion}, + transaction_validity::{ + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, + }, +}; + +/// Check for transaction mortality. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct CheckMortality(Era, sp_std::marker::PhantomData); + +impl CheckMortality { + /// utility constructor. Used only in client/factory code. + pub fn from(era: Era) -> Self { + Self(era, sp_std::marker::PhantomData) + } +} + +impl sp_std::fmt::Debug for CheckMortality { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckMortality({:?})", self.0) + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl SignedExtension for CheckMortality { + type AccountId = T::AccountId; + type Call = T::Call; + type AdditionalSigned = T::Hash; + type Pre = (); + // TODO [#6483] rename to CheckMortality + const IDENTIFIER: &'static str = "CheckEra"; + + fn validate( + &self, + _who: &Self::AccountId, + _call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, + ) -> TransactionValidity { + let current_u64 = >::block_number().saturated_into::(); + let valid_till = self.0.death(current_u64); + Ok(ValidTransaction { + longevity: valid_till.saturating_sub(current_u64), + ..Default::default() + }) + } + + fn additional_signed(&self) -> Result { + let current_u64 = >::block_number().saturated_into::(); + let n = self.0.birth(current_u64).saturated_into::(); + if !>::contains_key(n) { + Err(InvalidTransaction::AncientBirthBlock.into()) + } else { + Ok(>::block_hash(n)) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::{Test, new_test_ext, System, CALL}; + use frame_support::weights::{DispatchClass, DispatchInfo, Pays}; + use sp_core::H256; + + #[test] + fn signed_ext_check_era_should_work() { + new_test_ext().execute_with(|| { + // future + assert_eq!( + CheckMortality::::from(Era::mortal(4, 2)).additional_signed().err().unwrap(), + InvalidTransaction::AncientBirthBlock.into(), + ); + + // correct + System::set_block_number(13); + >::insert(12, H256::repeat_byte(1)); + assert!(CheckMortality::::from(Era::mortal(4, 12)).additional_signed().is_ok()); + }) + } + + #[test] + fn signed_ext_check_era_should_change_longevity() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes }; + let len = 0_usize; + let ext = ( + crate::CheckWeight::::default(), + CheckMortality::::from(Era::mortal(16, 256)), + ); + System::set_block_number(17); + >::insert(16, H256::repeat_byte(1)); + + assert_eq!(ext.validate(&1, CALL, &normal, len).unwrap().longevity, 15); + }) + } +} diff --git a/frame/system/src/extensions/check_nonce.rs b/frame/system/src/extensions/check_nonce.rs new file mode 100644 index 0000000000..1af3a1210a --- /dev/null +++ b/frame/system/src/extensions/check_nonce.rs @@ -0,0 +1,145 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode}; +use crate::Trait; +use frame_support::{ + weights::DispatchInfo, + StorageMap, +}; +use sp_runtime::{ + traits::{SignedExtension, DispatchInfoOf, Dispatchable, One}, + transaction_validity::{ + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, + TransactionLongevity, TransactionPriority, + }, +}; +use sp_std::vec; + +/// Nonce check and increment to give replay protection for transactions. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct CheckNonce(#[codec(compact)] T::Index); + +impl CheckNonce { + /// utility constructor. Used only in client/factory code. + pub fn from(nonce: T::Index) -> Self { + Self(nonce) + } +} + +impl sp_std::fmt::Debug for CheckNonce { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckNonce({})", self.0) + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl SignedExtension for CheckNonce where + T::Call: Dispatchable +{ + type AccountId = T::AccountId; + type Call = T::Call; + type AdditionalSigned = (); + type Pre = (); + const IDENTIFIER: &'static str = "CheckNonce"; + + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } + + fn pre_dispatch( + self, + who: &Self::AccountId, + _call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, + ) -> Result<(), TransactionValidityError> { + let mut account = crate::Account::::get(who); + if self.0 != account.nonce { + return Err( + if self.0 < account.nonce { + InvalidTransaction::Stale + } else { + InvalidTransaction::Future + }.into() + ) + } + account.nonce += T::Index::one(); + crate::Account::::insert(who, account); + Ok(()) + } + + fn validate( + &self, + who: &Self::AccountId, + _call: &Self::Call, + info: &DispatchInfoOf, + _len: usize, + ) -> TransactionValidity { + // check index + let account = crate::Account::::get(who); + if self.0 < account.nonce { + return InvalidTransaction::Stale.into() + } + + let provides = vec![Encode::encode(&(who, self.0))]; + let requires = if account.nonce < self.0 { + vec![Encode::encode(&(who, self.0 - One::one()))] + } else { + vec![] + }; + + Ok(ValidTransaction { + priority: info.weight as TransactionPriority, + requires, + provides, + longevity: TransactionLongevity::max_value(), + propagate: true, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::{Test, new_test_ext, CALL}; + + #[test] + fn signed_ext_check_nonce_works() { + new_test_ext().execute_with(|| { + crate::Account::::insert(1, crate::AccountInfo { + nonce: 1, + refcount: 0, + data: 0, + }); + let info = DispatchInfo::default(); + let len = 0_usize; + // stale + assert!(CheckNonce::(0).validate(&1, CALL, &info, len).is_err()); + assert!(CheckNonce::(0).pre_dispatch(&1, CALL, &info, len).is_err()); + // correct + assert!(CheckNonce::(1).validate(&1, CALL, &info, len).is_ok()); + assert!(CheckNonce::(1).pre_dispatch(&1, CALL, &info, len).is_ok()); + // future + assert!(CheckNonce::(5).validate(&1, CALL, &info, len).is_ok()); + assert!(CheckNonce::(5).pre_dispatch(&1, CALL, &info, len).is_err()); + }) + } +} diff --git a/frame/system/src/extensions/check_spec_version.rs b/frame/system/src/extensions/check_spec_version.rs new file mode 100644 index 0000000000..8dc4d8d9ce --- /dev/null +++ b/frame/system/src/extensions/check_spec_version.rs @@ -0,0 +1,58 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{Trait, Module}; +use codec::{Encode, Decode}; +use sp_runtime::{ + traits::SignedExtension, + transaction_validity::TransactionValidityError, +}; + +/// Ensure the runtime version registered in the transaction is the same as at present. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct CheckSpecVersion(sp_std::marker::PhantomData); + +impl sp_std::fmt::Debug for CheckSpecVersion { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckSpecVersion") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl CheckSpecVersion { + /// Create new `SignedExtension` to check runtime version. + pub fn new() -> Self { + Self(sp_std::marker::PhantomData) + } +} + +impl SignedExtension for CheckSpecVersion { + type AccountId = T::AccountId; + type Call = ::Call; + type AdditionalSigned = u32; + type Pre = (); + const IDENTIFIER: &'static str = "CheckSpecVersion"; + + fn additional_signed(&self) -> Result { + Ok(>::runtime_version().spec_version) + } +} diff --git a/frame/system/src/extensions/check_tx_version.rs b/frame/system/src/extensions/check_tx_version.rs new file mode 100644 index 0000000000..ee6f334936 --- /dev/null +++ b/frame/system/src/extensions/check_tx_version.rs @@ -0,0 +1,58 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{Trait, Module}; +use codec::{Encode, Decode}; +use sp_runtime::{ + traits::SignedExtension, + transaction_validity::TransactionValidityError, +}; + +/// Ensure the transaction version registered in the transaction is the same as at present. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct CheckTxVersion(sp_std::marker::PhantomData); + +impl sp_std::fmt::Debug for CheckTxVersion { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckTxVersion") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl CheckTxVersion { + /// Create new `SignedExtension` to check transaction version. + pub fn new() -> Self { + Self(sp_std::marker::PhantomData) + } +} + +impl SignedExtension for CheckTxVersion { + type AccountId = T::AccountId; + type Call = ::Call; + type AdditionalSigned = u32; + type Pre = (); + const IDENTIFIER: &'static str = "CheckTxVersion"; + + fn additional_signed(&self) -> Result { + Ok(>::runtime_version().transaction_version) + } +} diff --git a/frame/system/src/extensions/check_weight.rs b/frame/system/src/extensions/check_weight.rs new file mode 100644 index 0000000000..d52138b1e3 --- /dev/null +++ b/frame/system/src/extensions/check_weight.rs @@ -0,0 +1,644 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{Trait, Module}; +use codec::{Encode, Decode}; +use sp_runtime::{ + traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Printable}, + transaction_validity::{ + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, + TransactionPriority, + }, + Perbill, DispatchResult, +}; +use frame_support::{ + traits::{Get}, + weights::{PostDispatchInfo, DispatchInfo, DispatchClass}, + StorageValue, +}; + +/// Block resource (weight) limit check. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)] +pub struct CheckWeight(sp_std::marker::PhantomData); + +impl CheckWeight where + T::Call: Dispatchable +{ + /// Get the quota ratio of each dispatch class type. This indicates that all operational and mandatory + /// dispatches can use the full capacity of any resource, while user-triggered ones can consume + /// a portion. + fn get_dispatch_limit_ratio(class: DispatchClass) -> Perbill { + match class { + DispatchClass::Operational | DispatchClass::Mandatory + => ::one(), + DispatchClass::Normal => T::AvailableBlockRatio::get(), + } + } + + /// Checks if the current extrinsic does not exceed `MaximumExtrinsicWeight` limit. + fn check_extrinsic_weight( + info: &DispatchInfoOf, + ) -> Result<(), TransactionValidityError> { + match info.class { + // Mandatory transactions are included in a block unconditionally, so + // we don't verify weight. + DispatchClass::Mandatory => Ok(()), + // Normal transactions must not exceed `MaximumExtrinsicWeight`. + DispatchClass::Normal => { + let maximum_weight = T::MaximumExtrinsicWeight::get(); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > maximum_weight { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + }, + // For operational transactions we make sure it doesn't exceed + // the space alloted for `Operational` class. + DispatchClass::Operational => { + let maximum_weight = T::MaximumBlockWeight::get(); + let operational_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; + let operational_limit = + operational_limit.saturating_sub(T::BlockExecutionWeight::get()); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > operational_limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + }, + } + } + + /// Checks if the current extrinsic can fit into the block with respect to block weight limits. + /// + /// Upon successes, it returns the new block weight as a `Result`. + fn check_block_weight( + info: &DispatchInfoOf, + ) -> Result { + let maximum_weight = T::MaximumBlockWeight::get(); + let mut all_weight = Module::::block_weight(); + match info.class { + // If we have a dispatch that must be included in the block, it ignores all the limits. + DispatchClass::Mandatory => { + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + all_weight.add(extrinsic_weight, DispatchClass::Mandatory); + Ok(all_weight) + }, + // If we have a normal dispatch, we follow all the normal rules and limits. + DispatchClass::Normal => { + let normal_limit = Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; + let extrinsic_weight = info.weight.checked_add(T::ExtrinsicBaseWeight::get()) + .ok_or(InvalidTransaction::ExhaustsResources)?; + all_weight.checked_add(extrinsic_weight, DispatchClass::Normal) + .map_err(|_| InvalidTransaction::ExhaustsResources)?; + if all_weight.get(DispatchClass::Normal) > normal_limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(all_weight) + } + }, + // If we have an operational dispatch, allow it if we have not used our full + // "operational space" (independent of existing fullness). + DispatchClass::Operational => { + let operational_limit = Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; + let normal_limit = Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; + let operational_space = operational_limit.saturating_sub(normal_limit); + + let extrinsic_weight = info.weight.checked_add(T::ExtrinsicBaseWeight::get()) + .ok_or(InvalidTransaction::ExhaustsResources)?; + all_weight.checked_add(extrinsic_weight, DispatchClass::Operational) + .map_err(|_| InvalidTransaction::ExhaustsResources)?; + + // If it would fit in normally, its okay + if all_weight.total() <= maximum_weight || + // If we have not used our operational space + all_weight.get(DispatchClass::Operational) <= operational_space { + Ok(all_weight) + } else { + Err(InvalidTransaction::ExhaustsResources.into()) + } + } + } + } + + /// Checks if the current extrinsic can fit into the block with respect to block length limits. + /// + /// Upon successes, it returns the new block length as a `Result`. + fn check_block_length( + info: &DispatchInfoOf, + len: usize, + ) -> Result { + let current_len = Module::::all_extrinsics_len(); + let maximum_len = T::MaximumBlockLength::get(); + let limit = Self::get_dispatch_limit_ratio(info.class) * maximum_len; + let added_len = len as u32; + let next_len = current_len.saturating_add(added_len); + if next_len > limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(next_len) + } + } + + /// get the priority of an extrinsic denoted by `info`. + fn get_priority(info: &DispatchInfoOf) -> TransactionPriority { + match info.class { + DispatchClass::Normal => info.weight.into(), + // Don't use up the whole priority space, to allow things like `tip` + // to be taken into account as well. + DispatchClass::Operational => TransactionPriority::max_value() / 2, + // Mandatory extrinsics are only for inherents; never transactions. + DispatchClass::Mandatory => TransactionPriority::min_value(), + } + } + + /// Creates new `SignedExtension` to check weight of the extrinsic. + pub fn new() -> Self { + Self(Default::default()) + } + + /// Do the pre-dispatch checks. This can be applied to both signed and unsigned. + /// + /// It checks and notes the new weight and length. + fn do_pre_dispatch( + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + let next_len = Self::check_block_length(info, len)?; + let next_weight = Self::check_block_weight(info)?; + Self::check_extrinsic_weight(info)?; + + crate::AllExtrinsicsLen::put(next_len); + crate::BlockWeight::put(next_weight); + Ok(()) + } + + /// Do the validate checks. This can be applied to both signed and unsigned. + /// + /// It only checks that the block weight and length limit will not exceed. + fn do_validate( + info: &DispatchInfoOf, + len: usize, + ) -> TransactionValidity { + // ignore the next length. If they return `Ok`, then it is below the limit. + let _ = Self::check_block_length(info, len)?; + // during validation we skip block limit check. Since the `validate_transaction` + // call runs on an empty block anyway, by this we prevent `on_initialize` weight + // consumption from causing false negatives. + Self::check_extrinsic_weight(info)?; + + Ok(ValidTransaction { priority: Self::get_priority(info), ..Default::default() }) + } +} + +impl SignedExtension for CheckWeight where + T::Call: Dispatchable +{ + type AccountId = T::AccountId; + type Call = T::Call; + type AdditionalSigned = (); + type Pre = (); + const IDENTIFIER: &'static str = "CheckWeight"; + + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } + + fn pre_dispatch( + self, + _who: &Self::AccountId, + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + if info.class == DispatchClass::Mandatory { + Err(InvalidTransaction::MandatoryDispatch)? + } + Self::do_pre_dispatch(info, len) + } + + fn validate( + &self, + _who: &Self::AccountId, + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> TransactionValidity { + if info.class == DispatchClass::Mandatory { + Err(InvalidTransaction::MandatoryDispatch)? + } + Self::do_validate(info, len) + } + + fn pre_dispatch_unsigned( + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + Self::do_pre_dispatch(info, len) + } + + fn validate_unsigned( + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> TransactionValidity { + Self::do_validate(info, len) + } + + fn post_dispatch( + _pre: Self::Pre, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + _len: usize, + result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + // Since mandatory dispatched do not get validated for being overweight, we are sensitive + // to them actually being useful. Block producers are thus not allowed to include mandatory + // extrinsics that result in error. + if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { + "Bad mandantory".print(); + e.print(); + + Err(InvalidTransaction::BadMandatory)? + } + + let unspent = post_info.calc_unspent(info); + if unspent > 0 { + crate::BlockWeight::mutate(|current_weight| { + current_weight.sub(unspent, info.class); + }) + } + + Ok(()) + } +} + +impl sp_std::fmt::Debug for CheckWeight { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckWeight") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{BlockWeight, AllExtrinsicsLen}; + use crate::mock::{Test, CALL, new_test_ext, System}; + use sp_std::marker::PhantomData; + use frame_support::{assert_ok, assert_noop}; + use frame_support::weights::{Weight, Pays}; + + fn normal_weight_limit() -> Weight { + ::AvailableBlockRatio::get() * ::MaximumBlockWeight::get() + } + + fn normal_length_limit() -> u32 { + ::AvailableBlockRatio::get() * ::MaximumBlockLength::get() + } + + #[test] + fn mandatory_extrinsic_doesnt_care_about_limits() { + fn check(call: impl FnOnce(&DispatchInfo, usize)) { + new_test_ext().execute_with(|| { + let max = DispatchInfo { + weight: Weight::max_value(), + class: DispatchClass::Mandatory, + ..Default::default() + }; + let len = 0_usize; + + call(&max, len); + }); + } + + check(|max, len| { + assert_ok!(CheckWeight::::do_pre_dispatch(max, len)); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); + }); + check(|max, len| { + assert_ok!(CheckWeight::::do_validate(max, len)); + }); + } + + #[test] + fn normal_extrinsic_limited_by_maximum_extrinsic_weight() { + new_test_ext().execute_with(|| { + let max = DispatchInfo { + weight: ::MaximumExtrinsicWeight::get() + 1, + class: DispatchClass::Normal, + ..Default::default() + }; + let len = 0_usize; + + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); + }); + } + + #[test] + fn operational_extrinsic_limited_by_operational_space_limit() { + new_test_ext().execute_with(|| { + let operational_limit = CheckWeight::::get_dispatch_limit_ratio( + DispatchClass::Operational + ) * ::MaximumBlockWeight::get(); + let base_weight = ::ExtrinsicBaseWeight::get(); + let block_base = ::BlockExecutionWeight::get(); + + let weight = operational_limit - base_weight - block_base; + let okay = DispatchInfo { + weight, + class: DispatchClass::Operational, + ..Default::default() + }; + let max = DispatchInfo { + weight: weight + 1, + class: DispatchClass::Operational, + ..Default::default() + }; + let len = 0_usize; + + assert_eq!( + CheckWeight::::do_validate(&okay, len), + Ok(ValidTransaction { + priority: CheckWeight::::get_priority(&okay), + ..Default::default() + }) + ); + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); + }); + } + + #[test] + fn register_extra_weight_unchecked_doesnt_care_about_limits() { + new_test_ext().execute_with(|| { + System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Normal); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); + }); + } + + #[test] + fn full_block_with_normal_and_operational() { + new_test_ext().execute_with(|| { + // Max block is 1024 + // Max normal is 768 (75%) + // 10 is taken for block execution weight + // So normal extrinsic can be 758 weight (-5 for base extrinsic weight) + // And Operational can be 256 to produce a full block (-5 for base) + let max_normal = DispatchInfo { weight: 753, ..Default::default() }; + let rest_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; + + let len = 0_usize; + + assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); + assert_eq!(System::block_weight().total(), 768); + assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); + assert_eq!(::MaximumBlockWeight::get(), 1024); + assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); + // Checking single extrinsic should not take current block weight into account. + assert_eq!(CheckWeight::::check_extrinsic_weight(&rest_operational), Ok(())); + }); + } + + #[test] + fn dispatch_order_does_not_effect_weight_logic() { + new_test_ext().execute_with(|| { + // We switch the order of `full_block_with_normal_and_operational` + let max_normal = DispatchInfo { weight: 753, ..Default::default() }; + let rest_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; + + let len = 0_usize; + + assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); + // Extra 15 here from block execution + base extrinsic weight + assert_eq!(System::block_weight().total(), 266); + assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); + assert_eq!(::MaximumBlockWeight::get(), 1024); + assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); + }); + } + + #[test] + fn operational_works_on_full_block() { + new_test_ext().execute_with(|| { + // An on_initialize takes up the whole block! (Every time!) + System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Mandatory); + let dispatch_normal = DispatchInfo { weight: 251, class: DispatchClass::Normal, ..Default::default() }; + let dispatch_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; + let len = 0_usize; + + assert_noop!( + CheckWeight::::do_pre_dispatch(&dispatch_normal, len), + InvalidTransaction::ExhaustsResources + ); + // Thank goodness we can still do an operational transaction to possibly save the blockchain. + assert_ok!(CheckWeight::::do_pre_dispatch(&dispatch_operational, len)); + // Not too much though + assert_noop!( + CheckWeight::::do_pre_dispatch(&dispatch_operational, len), + InvalidTransaction::ExhaustsResources + ); + // Even with full block, validity of single transaction should be correct. + assert_eq!(CheckWeight::::check_extrinsic_weight(&dispatch_operational), Ok(())); + }); + } + + #[test] + fn signed_ext_check_weight_works_operational_tx() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo { weight: 100, ..Default::default() }; + let op = DispatchInfo { weight: 100, class: DispatchClass::Operational, pays_fee: Pays::Yes }; + let len = 0_usize; + let normal_limit = normal_weight_limit(); + + // given almost full block + BlockWeight::mutate(|current_weight| { + current_weight.put(normal_limit, DispatchClass::Normal) + }); + // will not fit. + assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &normal, len).is_err()); + // will fit. + assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &op, len).is_ok()); + + // likewise for length limit. + let len = 100_usize; + AllExtrinsicsLen::put(normal_length_limit()); + assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &normal, len).is_err()); + assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &op, len).is_ok()); + }) + } + + #[test] + fn signed_ext() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes }; + let op = DispatchInfo { weight: 100, class: DispatchClass::Operational, pays_fee: Pays::Yes }; + let len = 0_usize; + + let priority = CheckWeight::(PhantomData) + .validate(&1, CALL, &normal, len) + .unwrap() + .priority; + assert_eq!(priority, 100); + + let priority = CheckWeight::(PhantomData) + .validate(&1, CALL, &op, len) + .unwrap() + .priority; + assert_eq!(priority, u64::max_value() / 2); + }) + } + + #[test] + fn signed_ext_check_weight_block_size_works() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo::default(); + let normal_limit = normal_weight_limit() as usize; + let reset_check_weight = |tx, s, f| { + AllExtrinsicsLen::put(0); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, tx, s); + if f { assert!(r.is_err()) } else { assert!(r.is_ok()) } + }; + + reset_check_weight(&normal, normal_limit - 1, false); + reset_check_weight(&normal, normal_limit, false); + reset_check_weight(&normal, normal_limit + 1, true); + + // Operational ones don't have this limit. + let op = DispatchInfo { weight: 0, class: DispatchClass::Operational, pays_fee: Pays::Yes }; + reset_check_weight(&op, normal_limit, false); + reset_check_weight(&op, normal_limit + 100, false); + reset_check_weight(&op, 1024, false); + reset_check_weight(&op, 1025, true); + }) + } + + + #[test] + fn signed_ext_check_weight_works_normal_tx() { + new_test_ext().execute_with(|| { + let normal_limit = normal_weight_limit(); + let small = DispatchInfo { weight: 100, ..Default::default() }; + let medium = DispatchInfo { + weight: normal_limit - ::ExtrinsicBaseWeight::get(), + ..Default::default() + }; + let big = DispatchInfo { + weight: normal_limit - ::ExtrinsicBaseWeight::get() + 1, + ..Default::default() + }; + let len = 0_usize; + + let reset_check_weight = |i, f, s| { + BlockWeight::mutate(|current_weight| { + current_weight.put(s, DispatchClass::Normal) + }); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, i, len); + if f { assert!(r.is_err()) } else { assert!(r.is_ok()) } + }; + + reset_check_weight(&small, false, 0); + reset_check_weight(&medium, false, 0); + reset_check_weight(&big, true, 1); + }) + } + + #[test] + fn signed_ext_check_weight_refund_works() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = DispatchInfo { weight: 512, ..Default::default() }; + let post_info = PostDispatchInfo { actual_weight: Some(128), }; + let len = 0_usize; + + // We allow 75% for normal transaction, so we put 25% - extrinsic base weight + BlockWeight::mutate(|current_weight| { + current_weight.put(256 - ::ExtrinsicBaseWeight::get(), DispatchClass::Normal) + }); + + let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); + assert_eq!(BlockWeight::get().total(), info.weight + 256); + + assert!( + CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())) + .is_ok() + ); + assert_eq!( + BlockWeight::get().total(), + post_info.actual_weight.unwrap() + 256, + ); + }) + } + + #[test] + fn signed_ext_check_weight_actual_weight_higher_than_max_is_capped() { + new_test_ext().execute_with(|| { + let info = DispatchInfo { weight: 512, ..Default::default() }; + let post_info = PostDispatchInfo { actual_weight: Some(700), }; + let len = 0_usize; + + BlockWeight::mutate(|current_weight| { + current_weight.put(128, DispatchClass::Normal) + }); + + let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); + assert_eq!( + BlockWeight::get().total(), + info.weight + 128 + ::ExtrinsicBaseWeight::get(), + ); + + assert!( + CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())) + .is_ok() + ); + assert_eq!( + BlockWeight::get().total(), + info.weight + 128 + ::ExtrinsicBaseWeight::get(), + ); + }) + } + + #[test] + fn zero_weight_extrinsic_still_has_base_weight() { + new_test_ext().execute_with(|| { + let free = DispatchInfo { weight: 0, ..Default::default() }; + let len = 0_usize; + + // Initial weight from `BlockExecutionWeight` + assert_eq!(System::block_weight().total(), ::BlockExecutionWeight::get()); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &free, len); + assert!(r.is_ok()); + assert_eq!( + System::block_weight().total(), + ::ExtrinsicBaseWeight::get() + ::BlockExecutionWeight::get() + ); + }) + } +} diff --git a/frame/system/src/extensions/mod.rs b/frame/system/src/extensions/mod.rs new file mode 100644 index 0000000000..ff61353e2d --- /dev/null +++ b/frame/system/src/extensions/mod.rs @@ -0,0 +1,24 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub mod check_genesis; +pub mod check_mortality; +pub mod check_nonce; +pub mod check_spec_version; +pub mod check_tx_version; +pub mod check_weight; + diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 8eec6a2c37..18723fff29 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -102,17 +102,12 @@ use sp_std::marker::PhantomData; use sp_std::fmt::Debug; use sp_version::RuntimeVersion; use sp_runtime::{ - RuntimeDebug, Perbill, DispatchError, DispatchResult, Either, - generic::{self, Era}, - transaction_validity::{ - ValidTransaction, TransactionPriority, TransactionLongevity, TransactionValidityError, - InvalidTransaction, TransactionValidity, - }, + RuntimeDebug, Perbill, DispatchError, Either, generic, traits::{ - self, CheckEqual, AtLeast32Bit, Zero, SignedExtension, Lookup, LookupError, - SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, SaturatedConversion, + self, CheckEqual, AtLeast32Bit, Zero, Lookup, LookupError, + SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded, - Dispatchable, DispatchInfoOf, PostDispatchInfoOf, Printable, + Dispatchable, }, offchain::storage_lock::BlockNumberProvider, }; @@ -126,7 +121,7 @@ use frame_support::{ StoredMap, EnsureOrigin, OriginTrait, Filter, }, weights::{ - Weight, RuntimeDbWeight, DispatchInfo, PostDispatchInfo, DispatchClass, + Weight, RuntimeDbWeight, DispatchInfo, DispatchClass, extract_actual_weight, }, dispatch::DispatchResultWithPostInfo, @@ -137,6 +132,21 @@ use codec::{Encode, Decode, FullCodec, EncodeLike}; use sp_io::TestExternalities; pub mod offchain; +#[cfg(test)] +pub(crate) mod mock; + +mod extensions; +mod weights; +#[cfg(test)] +mod tests; + +pub use extensions::{ + check_mortality::CheckMortality, check_genesis::CheckGenesis, check_nonce::CheckNonce, + check_spec_version::CheckSpecVersion, check_tx_version::CheckTxVersion, + check_weight::CheckWeight, +}; +// Backward compatible re-export. +pub use extensions::check_mortality::CheckMortality as CheckEra; /// Compute the trie root of a list of extrinsics. pub fn extrinsics_root(extrinsics: &[E]) -> H::Output { @@ -372,60 +382,6 @@ impl From for LastRuntimeUpgradeInfo { } } -/// An object to track the currently used extrinsic weight in a block. -#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)] -pub struct ExtrinsicsWeight { - normal: Weight, - operational: Weight, -} - -impl ExtrinsicsWeight { - /// Returns the total weight consumed by all extrinsics in the block. - pub fn total(&self) -> Weight { - self.normal.saturating_add(self.operational) - } - - /// Add some weight of a specific dispatch class, saturating at the numeric bounds of `Weight`. - pub fn add(&mut self, weight: Weight, class: DispatchClass) { - let value = self.get_mut(class); - *value = value.saturating_add(weight); - } - - /// Try to add some weight of a specific dispatch class, returning Err(()) if overflow would occur. - pub fn checked_add(&mut self, weight: Weight, class: DispatchClass) -> Result<(), ()> { - let value = self.get_mut(class); - *value = value.checked_add(weight).ok_or(())?; - Ok(()) - } - - /// Subtract some weight of a specific dispatch class, saturating at the numeric bounds of `Weight`. - pub fn sub(&mut self, weight: Weight, class: DispatchClass) { - let value = self.get_mut(class); - *value = value.saturating_sub(weight); - } - - /// Get the current weight of a specific dispatch class. - pub fn get(&self, class: DispatchClass) -> Weight { - match class { - DispatchClass::Operational => self.operational, - DispatchClass::Normal | DispatchClass::Mandatory => self.normal, - } - } - - /// Get a mutable reference to the current weight of a specific dispatch class. - fn get_mut(&mut self, class: DispatchClass) -> &mut Weight { - match class { - DispatchClass::Operational => &mut self.operational, - DispatchClass::Normal | DispatchClass::Mandatory => &mut self.normal, - } - } - - /// Set the weight of a specific dispatch class. - pub fn put(&mut self, new: Weight, class: DispatchClass) { - *self.get_mut(class) = new; - } -} - decl_storage! { trait Store for Module as System { /// The full account information for a particular account ID. @@ -436,7 +392,7 @@ decl_storage! { ExtrinsicCount: Option; /// The current weight for the block. - BlockWeight get(fn block_weight): ExtrinsicsWeight; + BlockWeight get(fn block_weight): weights::ExtrinsicsWeight; /// Total length (in bytes) for all extrinsics put together, for the current block. AllExtrinsicsLen: Option; @@ -1372,360 +1328,6 @@ pub fn split_inner(option: Option, splitter: impl FnOnce(T) -> (R, S } } -/// resource limit check. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckWeight(PhantomData); - -impl CheckWeight where - T::Call: Dispatchable -{ - /// Get the quota ratio of each dispatch class type. This indicates that all operational and mandatory - /// dispatches can use the full capacity of any resource, while user-triggered ones can consume - /// a portion. - fn get_dispatch_limit_ratio(class: DispatchClass) -> Perbill { - match class { - DispatchClass::Operational | DispatchClass::Mandatory - => ::one(), - DispatchClass::Normal => T::AvailableBlockRatio::get(), - } - } - - /// Checks if the current extrinsic does not exceed `MaximumExtrinsicWeight` limit. - fn check_extrinsic_weight( - info: &DispatchInfoOf, - ) -> Result<(), TransactionValidityError> { - match info.class { - // Mandatory transactions are included in a block unconditionally, so - // we don't verify weight. - DispatchClass::Mandatory => Ok(()), - // Normal transactions must not exceed `MaximumExtrinsicWeight`. - DispatchClass::Normal => { - let maximum_weight = T::MaximumExtrinsicWeight::get(); - let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); - if extrinsic_weight > maximum_weight { - Err(InvalidTransaction::ExhaustsResources.into()) - } else { - Ok(()) - } - }, - // For operational transactions we make sure it doesn't exceed - // the space alloted for `Operational` class. - DispatchClass::Operational => { - let maximum_weight = T::MaximumBlockWeight::get(); - let operational_limit = - Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; - let operational_limit = - operational_limit.saturating_sub(T::BlockExecutionWeight::get()); - let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); - if extrinsic_weight > operational_limit { - Err(InvalidTransaction::ExhaustsResources.into()) - } else { - Ok(()) - } - }, - } - } - - /// Checks if the current extrinsic can fit into the block with respect to block weight limits. - /// - /// Upon successes, it returns the new block weight as a `Result`. - fn check_block_weight( - info: &DispatchInfoOf, - ) -> Result { - let maximum_weight = T::MaximumBlockWeight::get(); - let mut all_weight = Module::::block_weight(); - match info.class { - // If we have a dispatch that must be included in the block, it ignores all the limits. - DispatchClass::Mandatory => { - let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); - all_weight.add(extrinsic_weight, DispatchClass::Mandatory); - Ok(all_weight) - }, - // If we have a normal dispatch, we follow all the normal rules and limits. - DispatchClass::Normal => { - let normal_limit = Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; - let extrinsic_weight = info.weight.checked_add(T::ExtrinsicBaseWeight::get()) - .ok_or(InvalidTransaction::ExhaustsResources)?; - all_weight.checked_add(extrinsic_weight, DispatchClass::Normal) - .map_err(|_| InvalidTransaction::ExhaustsResources)?; - if all_weight.get(DispatchClass::Normal) > normal_limit { - Err(InvalidTransaction::ExhaustsResources.into()) - } else { - Ok(all_weight) - } - }, - // If we have an operational dispatch, allow it if we have not used our full - // "operational space" (independent of existing fullness). - DispatchClass::Operational => { - let operational_limit = Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; - let normal_limit = Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; - let operational_space = operational_limit.saturating_sub(normal_limit); - - let extrinsic_weight = info.weight.checked_add(T::ExtrinsicBaseWeight::get()) - .ok_or(InvalidTransaction::ExhaustsResources)?; - all_weight.checked_add(extrinsic_weight, DispatchClass::Operational) - .map_err(|_| InvalidTransaction::ExhaustsResources)?; - - // If it would fit in normally, its okay - if all_weight.total() <= maximum_weight || - // If we have not used our operational space - all_weight.get(DispatchClass::Operational) <= operational_space { - Ok(all_weight) - } else { - Err(InvalidTransaction::ExhaustsResources.into()) - } - } - } - } - - /// Checks if the current extrinsic can fit into the block with respect to block length limits. - /// - /// Upon successes, it returns the new block length as a `Result`. - fn check_block_length( - info: &DispatchInfoOf, - len: usize, - ) -> Result { - let current_len = Module::::all_extrinsics_len(); - let maximum_len = T::MaximumBlockLength::get(); - let limit = Self::get_dispatch_limit_ratio(info.class) * maximum_len; - let added_len = len as u32; - let next_len = current_len.saturating_add(added_len); - if next_len > limit { - Err(InvalidTransaction::ExhaustsResources.into()) - } else { - Ok(next_len) - } - } - - /// get the priority of an extrinsic denoted by `info`. - fn get_priority(info: &DispatchInfoOf) -> TransactionPriority { - match info.class { - DispatchClass::Normal => info.weight.into(), - // Don't use up the whole priority space, to allow things like `tip` - // to be taken into account as well. - DispatchClass::Operational => TransactionPriority::max_value() / 2, - // Mandatory extrinsics are only for inherents; never transactions. - DispatchClass::Mandatory => TransactionPriority::min_value(), - } - } - - /// Creates new `SignedExtension` to check weight of the extrinsic. - pub fn new() -> Self { - Self(PhantomData) - } - - /// Do the pre-dispatch checks. This can be applied to both signed and unsigned. - /// - /// It checks and notes the new weight and length. - fn do_pre_dispatch( - info: &DispatchInfoOf, - len: usize, - ) -> Result<(), TransactionValidityError> { - let next_len = Self::check_block_length(info, len)?; - let next_weight = Self::check_block_weight(info)?; - Self::check_extrinsic_weight(info)?; - - AllExtrinsicsLen::put(next_len); - BlockWeight::put(next_weight); - Ok(()) - } - - /// Do the validate checks. This can be applied to both signed and unsigned. - /// - /// It only checks that the block weight and length limit will not exceed. - fn do_validate( - info: &DispatchInfoOf, - len: usize, - ) -> TransactionValidity { - // ignore the next length. If they return `Ok`, then it is below the limit. - let _ = Self::check_block_length(info, len)?; - // during validation we skip block limit check. Since the `validate_transaction` - // call runs on an empty block anyway, by this we prevent `on_initialize` weight - // consumption from causing false negatives. - Self::check_extrinsic_weight(info)?; - - Ok(ValidTransaction { priority: Self::get_priority(info), ..Default::default() }) - } -} - -impl SignedExtension for CheckWeight where - T::Call: Dispatchable -{ - type AccountId = T::AccountId; - type Call = T::Call; - type AdditionalSigned = (); - type Pre = (); - const IDENTIFIER: &'static str = "CheckWeight"; - - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } - - fn pre_dispatch( - self, - _who: &Self::AccountId, - _call: &Self::Call, - info: &DispatchInfoOf, - len: usize, - ) -> Result<(), TransactionValidityError> { - if info.class == DispatchClass::Mandatory { - Err(InvalidTransaction::MandatoryDispatch)? - } - Self::do_pre_dispatch(info, len) - } - - fn validate( - &self, - _who: &Self::AccountId, - _call: &Self::Call, - info: &DispatchInfoOf, - len: usize, - ) -> TransactionValidity { - if info.class == DispatchClass::Mandatory { - Err(InvalidTransaction::MandatoryDispatch)? - } - Self::do_validate(info, len) - } - - fn pre_dispatch_unsigned( - _call: &Self::Call, - info: &DispatchInfoOf, - len: usize, - ) -> Result<(), TransactionValidityError> { - Self::do_pre_dispatch(info, len) - } - - fn validate_unsigned( - _call: &Self::Call, - info: &DispatchInfoOf, - len: usize, - ) -> TransactionValidity { - Self::do_validate(info, len) - } - - fn post_dispatch( - _pre: Self::Pre, - info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, - _len: usize, - result: &DispatchResult, - ) -> Result<(), TransactionValidityError> { - // Since mandatory dispatched do not get validated for being overweight, we are sensitive - // to them actually being useful. Block producers are thus not allowed to include mandatory - // extrinsics that result in error. - if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { - "Bad mandantory".print(); - e.print(); - - Err(InvalidTransaction::BadMandatory)? - } - - let unspent = post_info.calc_unspent(info); - if unspent > 0 { - BlockWeight::mutate(|current_weight| { - current_weight.sub(unspent, info.class); - }) - } - - Ok(()) - } -} - -impl Debug for CheckWeight { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckWeight") - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -/// Nonce check and increment to give replay protection for transactions. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckNonce(#[codec(compact)] T::Index); - -impl CheckNonce { - /// utility constructor. Used only in client/factory code. - pub fn from(nonce: T::Index) -> Self { - Self(nonce) - } -} - -impl Debug for CheckNonce { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckNonce({})", self.0) - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -impl SignedExtension for CheckNonce where - T::Call: Dispatchable -{ - type AccountId = T::AccountId; - type Call = T::Call; - type AdditionalSigned = (); - type Pre = (); - const IDENTIFIER: &'static str = "CheckNonce"; - - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } - - fn pre_dispatch( - self, - who: &Self::AccountId, - _call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> Result<(), TransactionValidityError> { - let mut account = Account::::get(who); - if self.0 != account.nonce { - return Err( - if self.0 < account.nonce { - InvalidTransaction::Stale - } else { - InvalidTransaction::Future - }.into() - ) - } - account.nonce += T::Index::one(); - Account::::insert(who, account); - Ok(()) - } - - fn validate( - &self, - who: &Self::AccountId, - _call: &Self::Call, - info: &DispatchInfoOf, - _len: usize, - ) -> TransactionValidity { - // check index - let account = Account::::get(who); - if self.0 < account.nonce { - return InvalidTransaction::Stale.into() - } - - let provides = vec![Encode::encode(&(who, self.0))]; - let requires = if account.nonce < self.0 { - vec![Encode::encode(&(who, self.0 - One::one()))] - } else { - vec![] - }; - - Ok(ValidTransaction { - priority: info.weight as TransactionPriority, - requires, - provides, - longevity: TransactionLongevity::max_value(), - propagate: true, - }) - } -} impl IsDeadAccount for Module { fn is_dead_account(who: &T::AccountId) -> bool { @@ -1733,167 +1335,6 @@ impl IsDeadAccount for Module { } } -/// Check for transaction mortality. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckEra(Era, sp_std::marker::PhantomData); - -impl CheckEra { - /// utility constructor. Used only in client/factory code. - pub fn from(era: Era) -> Self { - Self(era, sp_std::marker::PhantomData) - } -} - -impl Debug for CheckEra { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckEra({:?})", self.0) - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -impl SignedExtension for CheckEra { - type AccountId = T::AccountId; - type Call = T::Call; - type AdditionalSigned = T::Hash; - type Pre = (); - const IDENTIFIER: &'static str = "CheckEra"; - - fn validate( - &self, - _who: &Self::AccountId, - _call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> TransactionValidity { - let current_u64 = >::block_number().saturated_into::(); - let valid_till = self.0.death(current_u64); - Ok(ValidTransaction { - longevity: valid_till.saturating_sub(current_u64), - ..Default::default() - }) - } - - fn additional_signed(&self) -> Result { - let current_u64 = >::block_number().saturated_into::(); - let n = self.0.birth(current_u64).saturated_into::(); - if !>::contains_key(n) { - Err(InvalidTransaction::AncientBirthBlock.into()) - } else { - Ok(>::block_hash(n)) - } - } -} - -/// Nonce check and increment to give replay protection for transactions. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckGenesis(sp_std::marker::PhantomData); - -impl Debug for CheckGenesis { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckGenesis") - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -impl CheckGenesis { - /// Creates new `SignedExtension` to check genesis hash. - pub fn new() -> Self { - Self(sp_std::marker::PhantomData) - } -} - -impl SignedExtension for CheckGenesis { - type AccountId = T::AccountId; - type Call = ::Call; - type AdditionalSigned = T::Hash; - type Pre = (); - const IDENTIFIER: &'static str = "CheckGenesis"; - - fn additional_signed(&self) -> Result { - Ok(>::block_hash(T::BlockNumber::zero())) - } -} - -/// Ensure the transaction version registered in the transaction is the same as at present. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckTxVersion(sp_std::marker::PhantomData); - -impl Debug for CheckTxVersion { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckTxVersion") - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -impl CheckTxVersion { - /// Create new `SignedExtension` to check transaction version. - pub fn new() -> Self { - Self(sp_std::marker::PhantomData) - } -} - -impl SignedExtension for CheckTxVersion { - type AccountId = T::AccountId; - type Call = ::Call; - type AdditionalSigned = u32; - type Pre = (); - const IDENTIFIER: &'static str = "CheckTxVersion"; - - fn additional_signed(&self) -> Result { - Ok(>::runtime_version().transaction_version) - } -} - -/// Ensure the runtime version registered in the transaction is the same as at present. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckSpecVersion(sp_std::marker::PhantomData); - -impl Debug for CheckSpecVersion { - #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "CheckSpecVersion") - } - - #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - Ok(()) - } -} - -impl CheckSpecVersion { - /// Create new `SignedExtension` to check runtime version. - pub fn new() -> Self { - Self(sp_std::marker::PhantomData) - } -} - -impl SignedExtension for CheckSpecVersion { - type AccountId = T::AccountId; - type Call = ::Call; - type AdditionalSigned = u32; - type Pre = (); - const IDENTIFIER: &'static str = "CheckSpecVersion"; - - fn additional_signed(&self) -> Result { - Ok(>::runtime_version().spec_version) - } -} - pub struct ChainContext(sp_std::marker::PhantomData); impl Default for ChainContext { fn default() -> Self { @@ -1909,886 +1350,3 @@ impl Lookup for ChainContext { ::lookup(s) } } - -#[cfg(test)] -pub(crate) mod tests { - use super::*; - use sp_std::cell::RefCell; - use sp_core::H256; - use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError}; - use frame_support::{ - impl_outer_origin, parameter_types, assert_ok, assert_noop, - weights::{WithPostDispatchInfo, Pays}, - }; - - impl_outer_origin! { - pub enum Origin for Test where system = super {} - } - - #[derive(Clone, Eq, PartialEq, Debug)] - pub struct Test; - - parameter_types! { - pub const BlockHashCount: u64 = 10; - pub const MaximumBlockWeight: Weight = 1024; - pub const MaximumExtrinsicWeight: Weight = 768; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); - pub const MaximumBlockLength: u32 = 1024; - pub Version: RuntimeVersion = RuntimeVersion { - spec_name: sp_version::create_runtime_str!("test"), - impl_name: sp_version::create_runtime_str!("system-test"), - authoring_version: 1, - spec_version: 1, - impl_version: 1, - apis: sp_version::create_apis_vec!([]), - transaction_version: 1, - }; - pub const BlockExecutionWeight: Weight = 10; - pub const ExtrinsicBaseWeight: Weight = 5; - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 10, - write: 100, - }; - } - - thread_local!{ - pub static KILLED: RefCell> = RefCell::new(vec![]); - } - - pub struct RecordKilled; - impl OnKilledAccount for RecordKilled { - fn on_killed_account(who: &u64) { KILLED.with(|r| r.borrow_mut().push(*who)) } - } - - #[derive(Debug, codec::Encode, codec::Decode)] - pub struct Call; - - impl Dispatchable for Call { - type Origin = Origin; - type Trait = (); - type Info = DispatchInfo; - type PostInfo = PostDispatchInfo; - fn dispatch(self, _origin: Self::Origin) - -> sp_runtime::DispatchResultWithInfo { - panic!("Do not use dummy implementation for dispatch."); - } - } - - impl Trait for Test { - type BaseCallFilter = (); - type Origin = Origin; - type Call = Call; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = DbWeight; - type BlockExecutionWeight = BlockExecutionWeight; - type ExtrinsicBaseWeight = ExtrinsicBaseWeight; - type MaximumExtrinsicWeight = MaximumExtrinsicWeight; - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; - type Version = Version; - type ModuleToIndex = (); - type AccountData = u32; - type OnNewAccount = (); - type OnKilledAccount = RecordKilled; - } - - type System = Module; - type SysEvent = ::Event; - - const CALL: &::Call = &Call; - - fn new_test_ext() -> sp_io::TestExternalities { - let mut ext: sp_io::TestExternalities = GenesisConfig::default().build_storage::().unwrap().into(); - // Add to each test the initial weight of a block - ext.execute_with(|| System::register_extra_weight_unchecked(::BlockExecutionWeight::get(), DispatchClass::Mandatory)); - ext - } - - fn normal_weight_limit() -> Weight { - ::AvailableBlockRatio::get() * ::MaximumBlockWeight::get() - } - - fn normal_length_limit() -> u32 { - ::AvailableBlockRatio::get() * ::MaximumBlockLength::get() - } - - #[test] - fn origin_works() { - let o = Origin::from(RawOrigin::::Signed(1u64)); - let x: Result, Origin> = o.into(); - assert_eq!(x.unwrap(), RawOrigin::::Signed(1u64)); - } - - #[test] - fn stored_map_works() { - new_test_ext().execute_with(|| { - System::insert(&0, 42); - assert!(System::allow_death(&0)); - - System::inc_ref(&0); - assert!(!System::allow_death(&0)); - - System::insert(&0, 69); - assert!(!System::allow_death(&0)); - - System::dec_ref(&0); - assert!(System::allow_death(&0)); - - assert!(KILLED.with(|r| r.borrow().is_empty())); - System::kill_account(&0); - assert_eq!(KILLED.with(|r| r.borrow().clone()), vec![0u64]); - }); - } - - #[test] - fn deposit_event_should_work() { - new_test_ext().execute_with(|| { - System::initialize( - &1, - &[0u8; 32].into(), - &[0u8; 32].into(), - &Default::default(), - InitKind::Full, - ); - System::note_finished_extrinsics(); - System::deposit_event(SysEvent::CodeUpdated); - System::finalize(); - assert_eq!( - System::events(), - vec![ - EventRecord { - phase: Phase::Finalization, - event: SysEvent::CodeUpdated, - topics: vec![], - } - ] - ); - - System::initialize( - &2, - &[0u8; 32].into(), - &[0u8; 32].into(), - &Default::default(), - InitKind::Full, - ); - System::deposit_event(SysEvent::NewAccount(32)); - System::note_finished_initialize(); - System::deposit_event(SysEvent::KilledAccount(42)); - System::note_applied_extrinsic(&Ok(().into()), Default::default()); - System::note_applied_extrinsic( - &Err(DispatchError::BadOrigin.into()), - Default::default() - ); - System::note_finished_extrinsics(); - System::deposit_event(SysEvent::NewAccount(3)); - System::finalize(); - assert_eq!( - System::events(), - vec![ - EventRecord { - phase: Phase::Initialization, - event: SysEvent::NewAccount(32), - topics: vec![], - }, - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: SysEvent::KilledAccount(42), - topics: vec![] - }, - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: SysEvent::ExtrinsicSuccess(Default::default()), - topics: vec![] - }, - EventRecord { - phase: Phase::ApplyExtrinsic(1), - event: SysEvent::ExtrinsicFailed( - DispatchError::BadOrigin.into(), - Default::default() - ), - topics: vec![] - }, - EventRecord { - phase: Phase::Finalization, - event: SysEvent::NewAccount(3), - topics: vec![] - }, - ] - ); - }); - } - - #[test] - fn deposit_event_uses_actual_weight() { - new_test_ext().execute_with(|| { - System::initialize( - &1, - &[0u8; 32].into(), - &[0u8; 32].into(), - &Default::default(), - InitKind::Full, - ); - System::note_finished_initialize(); - - let pre_info = DispatchInfo { - weight: 1000, - .. Default::default() - }; - System::note_applied_extrinsic( - &Ok(Some(300).into()), - pre_info, - ); - System::note_applied_extrinsic( - &Ok(Some(1000).into()), - pre_info, - ); - System::note_applied_extrinsic( - // values over the pre info should be capped at pre dispatch value - &Ok(Some(1200).into()), - pre_info, - ); - System::note_applied_extrinsic( - &Err(DispatchError::BadOrigin.with_weight(999)), - pre_info, - ); - - assert_eq!( - System::events(), - vec![ - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: SysEvent::ExtrinsicSuccess( - DispatchInfo { - weight: 300, - .. Default::default() - }, - ), - topics: vec![] - }, - EventRecord { - phase: Phase::ApplyExtrinsic(1), - event: SysEvent::ExtrinsicSuccess( - DispatchInfo { - weight: 1000, - .. Default::default() - }, - ), - topics: vec![] - }, - EventRecord { - phase: Phase::ApplyExtrinsic(2), - event: SysEvent::ExtrinsicSuccess( - DispatchInfo { - weight: 1000, - .. Default::default() - }, - ), - topics: vec![] - }, - EventRecord { - phase: Phase::ApplyExtrinsic(3), - event: SysEvent::ExtrinsicFailed( - DispatchError::BadOrigin.into(), - DispatchInfo { - weight: 999, - .. Default::default() - }, - ), - topics: vec![] - }, - ] - ); - }); - } - - #[test] - fn deposit_event_topics() { - new_test_ext().execute_with(|| { - const BLOCK_NUMBER: u64 = 1; - - System::initialize( - &BLOCK_NUMBER, - &[0u8; 32].into(), - &[0u8; 32].into(), - &Default::default(), - InitKind::Full, - ); - System::note_finished_extrinsics(); - - let topics = vec![ - H256::repeat_byte(1), - H256::repeat_byte(2), - H256::repeat_byte(3), - ]; - - // We deposit a few events with different sets of topics. - System::deposit_event_indexed(&topics[0..3], SysEvent::NewAccount(1)); - System::deposit_event_indexed(&topics[0..1], SysEvent::NewAccount(2)); - System::deposit_event_indexed(&topics[1..2], SysEvent::NewAccount(3)); - - System::finalize(); - - // Check that topics are reflected in the event record. - assert_eq!( - System::events(), - vec![ - EventRecord { - phase: Phase::Finalization, - event: SysEvent::NewAccount(1), - topics: topics[0..3].to_vec(), - }, - EventRecord { - phase: Phase::Finalization, - event: SysEvent::NewAccount(2), - topics: topics[0..1].to_vec(), - }, - EventRecord { - phase: Phase::Finalization, - event: SysEvent::NewAccount(3), - topics: topics[1..2].to_vec(), - } - ] - ); - - // Check that the topic-events mapping reflects the deposited topics. - // Note that these are indexes of the events. - assert_eq!( - System::event_topics(&topics[0]), - vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 1)], - ); - assert_eq!( - System::event_topics(&topics[1]), - vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 2)], - ); - assert_eq!( - System::event_topics(&topics[2]), - vec![(BLOCK_NUMBER, 0)], - ); - }); - } - - #[test] - fn prunes_block_hash_mappings() { - new_test_ext().execute_with(|| { - // simulate import of 15 blocks - for n in 1..=15 { - System::initialize( - &n, - &[n as u8 - 1; 32].into(), - &[0u8; 32].into(), - &Default::default(), - InitKind::Full, - ); - - System::finalize(); - } - - // first 5 block hashes are pruned - for n in 0..5 { - assert_eq!( - System::block_hash(n), - H256::zero(), - ); - } - - // the remaining 10 are kept - for n in 5..15 { - assert_eq!( - System::block_hash(n), - [n as u8; 32].into(), - ); - } - }) - } - - #[test] - fn signed_ext_check_nonce_works() { - new_test_ext().execute_with(|| { - Account::::insert(1, AccountInfo { nonce: 1, refcount: 0, data: 0 }); - let info = DispatchInfo::default(); - let len = 0_usize; - // stale - assert!(CheckNonce::(0).validate(&1, CALL, &info, len).is_err()); - assert!(CheckNonce::(0).pre_dispatch(&1, CALL, &info, len).is_err()); - // correct - assert!(CheckNonce::(1).validate(&1, CALL, &info, len).is_ok()); - assert!(CheckNonce::(1).pre_dispatch(&1, CALL, &info, len).is_ok()); - // future - assert!(CheckNonce::(5).validate(&1, CALL, &info, len).is_ok()); - assert!(CheckNonce::(5).pre_dispatch(&1, CALL, &info, len).is_err()); - }) - } - - #[test] - fn signed_ext_check_weight_works_normal_tx() { - new_test_ext().execute_with(|| { - let normal_limit = normal_weight_limit(); - let small = DispatchInfo { weight: 100, ..Default::default() }; - let medium = DispatchInfo { - weight: normal_limit - ::ExtrinsicBaseWeight::get(), - ..Default::default() - }; - let big = DispatchInfo { - weight: normal_limit - ::ExtrinsicBaseWeight::get() + 1, - ..Default::default() - }; - let len = 0_usize; - - let reset_check_weight = |i, f, s| { - BlockWeight::mutate(|current_weight| { - current_weight.put(s, DispatchClass::Normal) - }); - let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, i, len); - if f { assert!(r.is_err()) } else { assert!(r.is_ok()) } - }; - - reset_check_weight(&small, false, 0); - reset_check_weight(&medium, false, 0); - reset_check_weight(&big, true, 1); - }) - } - - #[test] - fn signed_ext_check_weight_refund_works() { - new_test_ext().execute_with(|| { - // This is half of the max block weight - let info = DispatchInfo { weight: 512, ..Default::default() }; - let post_info = PostDispatchInfo { actual_weight: Some(128), }; - let len = 0_usize; - - // We allow 75% for normal transaction, so we put 25% - extrinsic base weight - BlockWeight::mutate(|current_weight| { - current_weight.put(256 - ::ExtrinsicBaseWeight::get(), DispatchClass::Normal) - }); - - let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); - assert_eq!(BlockWeight::get().total(), info.weight + 256); - - assert!( - CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())) - .is_ok() - ); - assert_eq!( - BlockWeight::get().total(), - post_info.actual_weight.unwrap() + 256, - ); - }) - } - - #[test] - fn signed_ext_check_weight_actual_weight_higher_than_max_is_capped() { - new_test_ext().execute_with(|| { - let info = DispatchInfo { weight: 512, ..Default::default() }; - let post_info = PostDispatchInfo { actual_weight: Some(700), }; - let len = 0_usize; - - BlockWeight::mutate(|current_weight| { - current_weight.put(128, DispatchClass::Normal) - }); - - let pre = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap(); - assert_eq!( - BlockWeight::get().total(), - info.weight + 128 + ::ExtrinsicBaseWeight::get(), - ); - - assert!( - CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())) - .is_ok() - ); - assert_eq!( - BlockWeight::get().total(), - info.weight + 128 + ::ExtrinsicBaseWeight::get(), - ); - }) - } - - #[test] - fn zero_weight_extrinsic_still_has_base_weight() { - new_test_ext().execute_with(|| { - let free = DispatchInfo { weight: 0, ..Default::default() }; - let len = 0_usize; - - // Initial weight from `BlockExecutionWeight` - assert_eq!(System::block_weight().total(), ::BlockExecutionWeight::get()); - let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &free, len); - assert!(r.is_ok()); - assert_eq!( - System::block_weight().total(), - ::ExtrinsicBaseWeight::get() + ::BlockExecutionWeight::get() - ); - }) - } - - #[test] - fn mandatory_extrinsic_doesnt_care_about_limits() { - fn check(call: impl FnOnce(&DispatchInfo, usize)) { - new_test_ext().execute_with(|| { - let max = DispatchInfo { - weight: Weight::max_value(), - class: DispatchClass::Mandatory, - ..Default::default() - }; - let len = 0_usize; - - call(&max, len); - }); - } - - check(|max, len| { - assert_ok!(CheckWeight::::do_pre_dispatch(max, len)); - assert_eq!(System::block_weight().total(), Weight::max_value()); - assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); - }); - check(|max, len| { - assert_ok!(CheckWeight::::do_validate(max, len)); - }); - } - - #[test] - fn normal_extrinsic_limited_by_maximum_extrinsic_weight() { - new_test_ext().execute_with(|| { - let max = DispatchInfo { - weight: MaximumExtrinsicWeight::get() + 1, - class: DispatchClass::Normal, - ..Default::default() - }; - let len = 0_usize; - - assert_noop!( - CheckWeight::::do_validate(&max, len), - InvalidTransaction::ExhaustsResources - ); - }); - } - - #[test] - fn operational_extrinsic_limited_by_operational_space_limit() { - new_test_ext().execute_with(|| { - let operational_limit = CheckWeight::::get_dispatch_limit_ratio( - DispatchClass::Operational - ) * ::MaximumBlockWeight::get(); - let base_weight = ::ExtrinsicBaseWeight::get(); - let block_base = ::BlockExecutionWeight::get(); - - let weight = operational_limit - base_weight - block_base; - let okay = DispatchInfo { - weight, - class: DispatchClass::Operational, - ..Default::default() - }; - let max = DispatchInfo { - weight: weight + 1, - class: DispatchClass::Operational, - ..Default::default() - }; - let len = 0_usize; - - assert_eq!( - CheckWeight::::do_validate(&okay, len), - Ok(ValidTransaction { - priority: CheckWeight::::get_priority(&okay), - ..Default::default() - }) - ); - assert_noop!( - CheckWeight::::do_validate(&max, len), - InvalidTransaction::ExhaustsResources - ); - }); - } - - #[test] - fn register_extra_weight_unchecked_doesnt_care_about_limits() { - new_test_ext().execute_with(|| { - System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Normal); - assert_eq!(System::block_weight().total(), Weight::max_value()); - assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); - }); - } - - #[test] - fn full_block_with_normal_and_operational() { - new_test_ext().execute_with(|| { - // Max block is 1024 - // Max normal is 768 (75%) - // 10 is taken for block execution weight - // So normal extrinsic can be 758 weight (-5 for base extrinsic weight) - // And Operational can be 256 to produce a full block (-5 for base) - let max_normal = DispatchInfo { weight: 753, ..Default::default() }; - let rest_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; - - let len = 0_usize; - - assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); - assert_eq!(System::block_weight().total(), 768); - assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); - assert_eq!(::MaximumBlockWeight::get(), 1024); - assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); - // Checking single extrinsic should not take current block weight into account. - assert_eq!(CheckWeight::::check_extrinsic_weight(&rest_operational), Ok(())); - }); - } - - #[test] - fn dispatch_order_does_not_effect_weight_logic() { - new_test_ext().execute_with(|| { - // We switch the order of `full_block_with_normal_and_operational` - let max_normal = DispatchInfo { weight: 753, ..Default::default() }; - let rest_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; - - let len = 0_usize; - - assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); - // Extra 15 here from block execution + base extrinsic weight - assert_eq!(System::block_weight().total(), 266); - assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); - assert_eq!(::MaximumBlockWeight::get(), 1024); - assert_eq!(System::block_weight().total(), ::MaximumBlockWeight::get()); - }); - } - - #[test] - fn operational_works_on_full_block() { - new_test_ext().execute_with(|| { - // An on_initialize takes up the whole block! (Every time!) - System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Mandatory); - let dispatch_normal = DispatchInfo { weight: 251, class: DispatchClass::Normal, ..Default::default() }; - let dispatch_operational = DispatchInfo { weight: 251, class: DispatchClass::Operational, ..Default::default() }; - let len = 0_usize; - - assert_noop!(CheckWeight::::do_pre_dispatch(&dispatch_normal, len), InvalidTransaction::ExhaustsResources); - // Thank goodness we can still do an operational transaction to possibly save the blockchain. - assert_ok!(CheckWeight::::do_pre_dispatch(&dispatch_operational, len)); - // Not too much though - assert_noop!(CheckWeight::::do_pre_dispatch(&dispatch_operational, len), InvalidTransaction::ExhaustsResources); - // Even with full block, validity of single transaction should be correct. - assert_eq!(CheckWeight::::check_extrinsic_weight(&dispatch_operational), Ok(())); - }); - } - - #[test] - fn signed_ext_check_weight_works_operational_tx() { - new_test_ext().execute_with(|| { - let normal = DispatchInfo { weight: 100, ..Default::default() }; - let op = DispatchInfo { weight: 100, class: DispatchClass::Operational, pays_fee: Pays::Yes }; - let len = 0_usize; - let normal_limit = normal_weight_limit(); - - // given almost full block - BlockWeight::mutate(|current_weight| { - current_weight.put(normal_limit, DispatchClass::Normal) - }); - // will not fit. - assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &normal, len).is_err()); - // will fit. - assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &op, len).is_ok()); - - // likewise for length limit. - let len = 100_usize; - AllExtrinsicsLen::put(normal_length_limit()); - assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &normal, len).is_err()); - assert!(CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &op, len).is_ok()); - }) - } - - #[test] - fn signed_ext() { - new_test_ext().execute_with(|| { - let normal = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes }; - let op = DispatchInfo { weight: 100, class: DispatchClass::Operational, pays_fee: Pays::Yes }; - let len = 0_usize; - - let priority = CheckWeight::(PhantomData) - .validate(&1, CALL, &normal, len) - .unwrap() - .priority; - assert_eq!(priority, 100); - - let priority = CheckWeight::(PhantomData) - .validate(&1, CALL, &op, len) - .unwrap() - .priority; - assert_eq!(priority, u64::max_value() / 2); - }) - } - - #[test] - fn signed_ext_check_weight_block_size_works() { - new_test_ext().execute_with(|| { - let normal = DispatchInfo::default(); - let normal_limit = normal_weight_limit() as usize; - let reset_check_weight = |tx, s, f| { - AllExtrinsicsLen::put(0); - let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, tx, s); - if f { assert!(r.is_err()) } else { assert!(r.is_ok()) } - }; - - reset_check_weight(&normal, normal_limit - 1, false); - reset_check_weight(&normal, normal_limit, false); - reset_check_weight(&normal, normal_limit + 1, true); - - // Operational ones don't have this limit. - let op = DispatchInfo { weight: 0, class: DispatchClass::Operational, pays_fee: Pays::Yes }; - reset_check_weight(&op, normal_limit, false); - reset_check_weight(&op, normal_limit + 100, false); - reset_check_weight(&op, 1024, false); - reset_check_weight(&op, 1025, true); - }) - } - - #[test] - fn signed_ext_check_era_should_work() { - new_test_ext().execute_with(|| { - // future - assert_eq!( - CheckEra::::from(Era::mortal(4, 2)).additional_signed().err().unwrap(), - InvalidTransaction::AncientBirthBlock.into(), - ); - - // correct - System::set_block_number(13); - >::insert(12, H256::repeat_byte(1)); - assert!(CheckEra::::from(Era::mortal(4, 12)).additional_signed().is_ok()); - }) - } - - #[test] - fn signed_ext_check_era_should_change_longevity() { - new_test_ext().execute_with(|| { - let normal = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes }; - let len = 0_usize; - let ext = ( - CheckWeight::(PhantomData), - CheckEra::::from(Era::mortal(16, 256)), - ); - System::set_block_number(17); - >::insert(16, H256::repeat_byte(1)); - - assert_eq!(ext.validate(&1, CALL, &normal, len).unwrap().longevity, 15); - }) - } - - - #[test] - fn set_code_checks_works() { - struct CallInWasm(Vec); - - impl sp_core::traits::CallInWasm for CallInWasm { - fn call_in_wasm( - &self, - _: &[u8], - _: Option>, - _: &str, - _: &[u8], - _: &mut dyn sp_externalities::Externalities, - _: sp_core::traits::MissingHostFunctions, - ) -> Result, String> { - Ok(self.0.clone()) - } - } - - let test_data = vec![ - ("test", 1, 2, Err(Error::::SpecVersionNeedsToIncrease)), - ("test", 1, 1, Err(Error::::SpecVersionNeedsToIncrease)), - ("test2", 1, 1, Err(Error::::InvalidSpecName)), - ("test", 2, 1, Ok(())), - ("test", 0, 1, Err(Error::::SpecVersionNeedsToIncrease)), - ("test", 1, 0, Err(Error::::SpecVersionNeedsToIncrease)), - ]; - - for (spec_name, spec_version, impl_version, expected) in test_data.into_iter() { - let version = RuntimeVersion { - spec_name: spec_name.into(), - spec_version, - impl_version, - ..Default::default() - }; - let call_in_wasm = CallInWasm(version.encode()); - - let mut ext = new_test_ext(); - ext.register_extension(sp_core::traits::CallInWasmExt::new(call_in_wasm)); - ext.execute_with(|| { - let res = System::set_code( - RawOrigin::Root.into(), - vec![1, 2, 3, 4], - ); - - assert_eq!(expected.map_err(DispatchError::from), res); - }); - } - } - - #[test] - fn set_code_with_real_wasm_blob() { - let executor = substrate_test_runtime_client::new_native_executor(); - let mut ext = new_test_ext(); - ext.register_extension(sp_core::traits::CallInWasmExt::new(executor)); - ext.execute_with(|| { - System::set_block_number(1); - System::set_code( - RawOrigin::Root.into(), - substrate_test_runtime_client::runtime::WASM_BINARY.to_vec(), - ).unwrap(); - - assert_eq!( - System::events(), - vec![EventRecord { - phase: Phase::Initialization, - event: SysEvent::CodeUpdated, - topics: vec![], - }], - ); - }); - } - - #[test] - fn runtime_upgraded_with_set_storage() { - let executor = substrate_test_runtime_client::new_native_executor(); - let mut ext = new_test_ext(); - ext.register_extension(sp_core::traits::CallInWasmExt::new(executor)); - ext.execute_with(|| { - System::set_storage( - RawOrigin::Root.into(), - vec![( - well_known_keys::CODE.to_vec(), - substrate_test_runtime_client::runtime::WASM_BINARY.to_vec() - )], - ).unwrap(); - }); - } - - #[test] - fn events_not_emitted_during_genesis() { - new_test_ext().execute_with(|| { - // Block Number is zero at genesis - assert!(System::block_number().is_zero()); - System::on_created_account(Default::default()); - assert!(System::events().is_empty()); - // Events will be emitted starting on block 1 - System::set_block_number(1); - System::on_created_account(Default::default()); - assert!(System::events().len() == 1); - }); - } - - #[test] - fn ensure_one_of_works() { - fn ensure_root_or_signed(o: RawOrigin) -> Result, Origin> { - EnsureOneOf::, EnsureSigned>::try_origin(o.into()) - } - - assert_eq!(ensure_root_or_signed(RawOrigin::Root).unwrap(), Either::Left(())); - assert_eq!(ensure_root_or_signed(RawOrigin::Signed(0)).unwrap(), Either::Right(0)); - assert!(ensure_root_or_signed(RawOrigin::None).is_err()) - } -} diff --git a/frame/system/src/mock.rs b/frame/system/src/mock.rs new file mode 100644 index 0000000000..0484b34ba3 --- /dev/null +++ b/frame/system/src/mock.rs @@ -0,0 +1,124 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::*; +use sp_std::cell::RefCell; +use sp_core::H256; +use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + testing::Header, +}; +use frame_support::{ + impl_outer_origin, parameter_types, + weights::PostDispatchInfo, +}; + +impl_outer_origin! { + pub enum Origin for Test where system = super {} +} + +#[derive(Clone, Eq, PartialEq, Debug, Default)] +pub struct Test; + +parameter_types! { + pub const BlockHashCount: u64 = 10; + pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumExtrinsicWeight: Weight = 768; + pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); + pub const MaximumBlockLength: u32 = 1024; + pub Version: RuntimeVersion = RuntimeVersion { + spec_name: sp_version::create_runtime_str!("test"), + impl_name: sp_version::create_runtime_str!("system-test"), + authoring_version: 1, + spec_version: 1, + impl_version: 1, + apis: sp_version::create_apis_vec!([]), + transaction_version: 1, + }; + pub const BlockExecutionWeight: Weight = 10; + pub const ExtrinsicBaseWeight: Weight = 5; + pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 10, + write: 100, + }; +} + +thread_local!{ + pub static KILLED: RefCell> = RefCell::new(vec![]); +} + +pub struct RecordKilled; +impl OnKilledAccount for RecordKilled { + fn on_killed_account(who: &u64) { KILLED.with(|r| r.borrow_mut().push(*who)) } +} + +#[derive(Debug, codec::Encode, codec::Decode)] +pub struct Call; + +impl Dispatchable for Call { + type Origin = Origin; + type Trait = (); + type Info = DispatchInfo; + type PostInfo = PostDispatchInfo; + fn dispatch(self, _origin: Self::Origin) + -> sp_runtime::DispatchResultWithInfo { + panic!("Do not use dummy implementation for dispatch."); + } +} + +impl Trait for Test { + type BaseCallFilter = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type MaximumBlockWeight = MaximumBlockWeight; + type DbWeight = DbWeight; + type BlockExecutionWeight = BlockExecutionWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + type MaximumExtrinsicWeight = MaximumExtrinsicWeight; + type AvailableBlockRatio = AvailableBlockRatio; + type MaximumBlockLength = MaximumBlockLength; + type Version = Version; + type ModuleToIndex = (); + type AccountData = u32; + type OnNewAccount = (); + type OnKilledAccount = RecordKilled; +} + +pub type System = Module; +pub type SysEvent = ::Event; + +pub const CALL: &::Call = &Call; + +/// Create new externalities for `System` module tests. +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut ext: sp_io::TestExternalities = GenesisConfig::default().build_storage::().unwrap().into(); + // Add to each test the initial weight of a block + ext.execute_with(|| System::register_extra_weight_unchecked( + ::BlockExecutionWeight::get(), + DispatchClass::Mandatory + )); + ext +} diff --git a/frame/system/src/offchain.rs b/frame/system/src/offchain.rs index 42699362a3..1290ca6378 100644 --- a/frame/system/src/offchain.rs +++ b/frame/system/src/offchain.rs @@ -638,7 +638,7 @@ pub trait SignedPayload: Encode { mod tests { use super::*; use codec::Decode; - use crate::tests::{Test as TestRuntime, Call}; + use crate::mock::{Test as TestRuntime, Call}; use sp_core::offchain::{testing, TransactionPoolExt}; use sp_runtime::testing::{UintAuthorityId, TestSignature, TestXt}; diff --git a/frame/system/src/tests.rs b/frame/system/src/tests.rs new file mode 100644 index 0000000000..2f93dc858f --- /dev/null +++ b/frame/system/src/tests.rs @@ -0,0 +1,424 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::*; +use mock::{*, Origin}; +use sp_core::H256; +use sp_runtime::DispatchError; +use frame_support::weights::WithPostDispatchInfo; + +#[test] +fn origin_works() { + let o = Origin::from(RawOrigin::::Signed(1u64)); + let x: Result, Origin> = o.into(); + assert_eq!(x.unwrap(), RawOrigin::::Signed(1u64)); +} + +#[test] +fn stored_map_works() { + new_test_ext().execute_with(|| { + System::insert(&0, 42); + assert!(System::allow_death(&0)); + + System::inc_ref(&0); + assert!(!System::allow_death(&0)); + + System::insert(&0, 69); + assert!(!System::allow_death(&0)); + + System::dec_ref(&0); + assert!(System::allow_death(&0)); + + assert!(KILLED.with(|r| r.borrow().is_empty())); + System::kill_account(&0); + assert_eq!(KILLED.with(|r| r.borrow().clone()), vec![0u64]); + }); +} + +#[test] +fn deposit_event_should_work() { + new_test_ext().execute_with(|| { + System::initialize( + &1, + &[0u8; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + System::note_finished_extrinsics(); + System::deposit_event(SysEvent::CodeUpdated); + System::finalize(); + assert_eq!( + System::events(), + vec![ + EventRecord { + phase: Phase::Finalization, + event: SysEvent::CodeUpdated, + topics: vec![], + } + ] + ); + + System::initialize( + &2, + &[0u8; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + System::deposit_event(SysEvent::NewAccount(32)); + System::note_finished_initialize(); + System::deposit_event(SysEvent::KilledAccount(42)); + System::note_applied_extrinsic(&Ok(().into()), Default::default()); + System::note_applied_extrinsic( + &Err(DispatchError::BadOrigin.into()), + Default::default() + ); + System::note_finished_extrinsics(); + System::deposit_event(SysEvent::NewAccount(3)); + System::finalize(); + assert_eq!( + System::events(), + vec![ + EventRecord { + phase: Phase::Initialization, + event: SysEvent::NewAccount(32), + topics: vec![], + }, + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::KilledAccount(42), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::ExtrinsicSuccess(Default::default()), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(1), + event: SysEvent::ExtrinsicFailed( + DispatchError::BadOrigin.into(), + Default::default() + ), + topics: vec![] + }, + EventRecord { + phase: Phase::Finalization, + event: SysEvent::NewAccount(3), + topics: vec![] + }, + ] + ); + }); +} + +#[test] +fn deposit_event_uses_actual_weight() { + new_test_ext().execute_with(|| { + System::initialize( + &1, + &[0u8; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + System::note_finished_initialize(); + + let pre_info = DispatchInfo { + weight: 1000, + .. Default::default() + }; + System::note_applied_extrinsic( + &Ok(Some(300).into()), + pre_info, + ); + System::note_applied_extrinsic( + &Ok(Some(1000).into()), + pre_info, + ); + System::note_applied_extrinsic( + // values over the pre info should be capped at pre dispatch value + &Ok(Some(1200).into()), + pre_info, + ); + System::note_applied_extrinsic( + &Err(DispatchError::BadOrigin.with_weight(999)), + pre_info, + ); + + assert_eq!( + System::events(), + vec![ + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 300, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(1), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 1000, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(2), + event: SysEvent::ExtrinsicSuccess( + DispatchInfo { + weight: 1000, + .. Default::default() + }, + ), + topics: vec![] + }, + EventRecord { + phase: Phase::ApplyExtrinsic(3), + event: SysEvent::ExtrinsicFailed( + DispatchError::BadOrigin.into(), + DispatchInfo { + weight: 999, + .. Default::default() + }, + ), + topics: vec![] + }, + ] + ); + }); +} + +#[test] +fn deposit_event_topics() { + new_test_ext().execute_with(|| { + const BLOCK_NUMBER: u64 = 1; + + System::initialize( + &BLOCK_NUMBER, + &[0u8; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + System::note_finished_extrinsics(); + + let topics = vec![ + H256::repeat_byte(1), + H256::repeat_byte(2), + H256::repeat_byte(3), + ]; + + // We deposit a few events with different sets of topics. + System::deposit_event_indexed(&topics[0..3], SysEvent::NewAccount(1)); + System::deposit_event_indexed(&topics[0..1], SysEvent::NewAccount(2)); + System::deposit_event_indexed(&topics[1..2], SysEvent::NewAccount(3)); + + System::finalize(); + + // Check that topics are reflected in the event record. + assert_eq!( + System::events(), + vec![ + EventRecord { + phase: Phase::Finalization, + event: SysEvent::NewAccount(1), + topics: topics[0..3].to_vec(), + }, + EventRecord { + phase: Phase::Finalization, + event: SysEvent::NewAccount(2), + topics: topics[0..1].to_vec(), + }, + EventRecord { + phase: Phase::Finalization, + event: SysEvent::NewAccount(3), + topics: topics[1..2].to_vec(), + } + ] + ); + + // Check that the topic-events mapping reflects the deposited topics. + // Note that these are indexes of the events. + assert_eq!( + System::event_topics(&topics[0]), + vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 1)], + ); + assert_eq!( + System::event_topics(&topics[1]), + vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 2)], + ); + assert_eq!( + System::event_topics(&topics[2]), + vec![(BLOCK_NUMBER, 0)], + ); + }); +} + +#[test] +fn prunes_block_hash_mappings() { + new_test_ext().execute_with(|| { + // simulate import of 15 blocks + for n in 1..=15 { + System::initialize( + &n, + &[n as u8 - 1; 32].into(), + &[0u8; 32].into(), + &Default::default(), + InitKind::Full, + ); + + System::finalize(); + } + + // first 5 block hashes are pruned + for n in 0..5 { + assert_eq!( + System::block_hash(n), + H256::zero(), + ); + } + + // the remaining 10 are kept + for n in 5..15 { + assert_eq!( + System::block_hash(n), + [n as u8; 32].into(), + ); + } + }) +} + +#[test] +fn set_code_checks_works() { + struct CallInWasm(Vec); + + impl sp_core::traits::CallInWasm for CallInWasm { + fn call_in_wasm( + &self, + _: &[u8], + _: Option>, + _: &str, + _: &[u8], + _: &mut dyn sp_externalities::Externalities, + _: sp_core::traits::MissingHostFunctions, + ) -> Result, String> { + Ok(self.0.clone()) + } + } + + let test_data = vec![ + ("test", 1, 2, Err(Error::::SpecVersionNeedsToIncrease)), + ("test", 1, 1, Err(Error::::SpecVersionNeedsToIncrease)), + ("test2", 1, 1, Err(Error::::InvalidSpecName)), + ("test", 2, 1, Ok(())), + ("test", 0, 1, Err(Error::::SpecVersionNeedsToIncrease)), + ("test", 1, 0, Err(Error::::SpecVersionNeedsToIncrease)), + ]; + + for (spec_name, spec_version, impl_version, expected) in test_data.into_iter() { + let version = RuntimeVersion { + spec_name: spec_name.into(), + spec_version, + impl_version, + ..Default::default() + }; + let call_in_wasm = CallInWasm(version.encode()); + + let mut ext = new_test_ext(); + ext.register_extension(sp_core::traits::CallInWasmExt::new(call_in_wasm)); + ext.execute_with(|| { + let res = System::set_code( + RawOrigin::Root.into(), + vec![1, 2, 3, 4], + ); + + assert_eq!(expected.map_err(DispatchError::from), res); + }); + } +} + +#[test] +fn set_code_with_real_wasm_blob() { + let executor = substrate_test_runtime_client::new_native_executor(); + let mut ext = new_test_ext(); + ext.register_extension(sp_core::traits::CallInWasmExt::new(executor)); + ext.execute_with(|| { + System::set_block_number(1); + System::set_code( + RawOrigin::Root.into(), + substrate_test_runtime_client::runtime::WASM_BINARY.to_vec(), + ).unwrap(); + + assert_eq!( + System::events(), + vec![EventRecord { + phase: Phase::Initialization, + event: SysEvent::CodeUpdated, + topics: vec![], + }], + ); + }); +} + +#[test] +fn runtime_upgraded_with_set_storage() { + let executor = substrate_test_runtime_client::new_native_executor(); + let mut ext = new_test_ext(); + ext.register_extension(sp_core::traits::CallInWasmExt::new(executor)); + ext.execute_with(|| { + System::set_storage( + RawOrigin::Root.into(), + vec![( + well_known_keys::CODE.to_vec(), + substrate_test_runtime_client::runtime::WASM_BINARY.to_vec() + )], + ).unwrap(); + }); +} + +#[test] +fn events_not_emitted_during_genesis() { + new_test_ext().execute_with(|| { + // Block Number is zero at genesis + assert!(System::block_number().is_zero()); + System::on_created_account(Default::default()); + assert!(System::events().is_empty()); + // Events will be emitted starting on block 1 + System::set_block_number(1); + System::on_created_account(Default::default()); + assert!(System::events().len() == 1); + }); +} + +#[test] +fn ensure_one_of_works() { + fn ensure_root_or_signed(o: RawOrigin) -> Result, Origin> { + EnsureOneOf::, EnsureSigned>::try_origin(o.into()) + } + + assert_eq!(ensure_root_or_signed(RawOrigin::Root).unwrap(), Either::Left(())); + assert_eq!(ensure_root_or_signed(RawOrigin::Signed(0)).unwrap(), Either::Right(0)); + assert!(ensure_root_or_signed(RawOrigin::None).is_err()) +} diff --git a/frame/system/src/weights.rs b/frame/system/src/weights.rs new file mode 100644 index 0000000000..93295093c4 --- /dev/null +++ b/frame/system/src/weights.rs @@ -0,0 +1,76 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode}; +use frame_support::weights::{Weight, DispatchClass}; +use sp_runtime::RuntimeDebug; + +/// An object to track the currently used extrinsic weight in a block. +#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)] +pub struct ExtrinsicsWeight { + normal: Weight, + operational: Weight, +} + +impl ExtrinsicsWeight { + /// Returns the total weight consumed by all extrinsics in the block. + pub fn total(&self) -> Weight { + self.normal.saturating_add(self.operational) + } + + /// Add some weight of a specific dispatch class, saturating at the numeric bounds of `Weight`. + pub fn add(&mut self, weight: Weight, class: DispatchClass) { + let value = self.get_mut(class); + *value = value.saturating_add(weight); + } + + /// Try to add some weight of a specific dispatch class, returning Err(()) if overflow would + /// occur. + pub fn checked_add(&mut self, weight: Weight, class: DispatchClass) -> Result<(), ()> { + let value = self.get_mut(class); + *value = value.checked_add(weight).ok_or(())?; + Ok(()) + } + + /// Subtract some weight of a specific dispatch class, saturating at the numeric bounds of + /// `Weight`. + pub fn sub(&mut self, weight: Weight, class: DispatchClass) { + let value = self.get_mut(class); + *value = value.saturating_sub(weight); + } + + /// Get the current weight of a specific dispatch class. + pub fn get(&self, class: DispatchClass) -> Weight { + match class { + DispatchClass::Operational => self.operational, + DispatchClass::Normal | DispatchClass::Mandatory => self.normal, + } + } + + /// Get a mutable reference to the current weight of a specific dispatch class. + fn get_mut(&mut self, class: DispatchClass) -> &mut Weight { + match class { + DispatchClass::Operational => &mut self.operational, + DispatchClass::Normal | DispatchClass::Mandatory => &mut self.normal, + } + } + + /// Set the weight of a specific dispatch class. + pub fn put(&mut self, new: Weight, class: DispatchClass) { + *self.get_mut(class) = new; + } +} -- GitLab From e8378e84ab6355ffe3792b41b9de4481db9353f6 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Wed, 24 Jun 2020 17:24:05 +0200 Subject: [PATCH 238/280] Allow where clause in benchmarking (#6461) * WIP * handle where clause in benchmarking * doc * maybe better syntax * line width --- frame/benchmarking/src/lib.rs | 351 ++++++++++++++++++++------------ frame/benchmarking/src/tests.rs | 45 ++-- 2 files changed, 253 insertions(+), 143 deletions(-) diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index 47e83cffbc..7cbac3397a 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -85,6 +85,8 @@ pub use paste; /// Example: /// ```ignore /// benchmarks! { +/// where_clause { where T::A: From } // Optional line to give additional bound on `T`. +/// /// // common parameter; just one for this example. /// // will be `1`, `MAX_LENGTH` or any value inbetween /// _ { @@ -173,6 +175,7 @@ pub use paste; #[macro_export] macro_rules! benchmarks { ( + $( where_clause { where $( $where_ty:ty: $where_bound:path ),* $(,)? } )? _ { $( let $common:ident in $common_from:tt .. $common_to:expr => $common_instancer:expr; @@ -182,6 +185,7 @@ macro_rules! benchmarks { ) => { $crate::benchmarks_iter!( NO_INSTANCE + { $( $( $where_ty: $where_bound ),* )? } { $( { $common , $common_from , $common_to , $common_instancer } )* } ( ) $( $rest )* @@ -189,9 +193,11 @@ macro_rules! benchmarks { } } +/// Same as [`benchmarks`] but for instantiable module. #[macro_export] macro_rules! benchmarks_instance { ( + $( where_clause { where $( $where_ty:ty: $where_bound:path ),* $(,)? } )? _ { $( let $common:ident in $common_from:tt .. $common_to:expr => $common_instancer:expr; @@ -201,6 +207,7 @@ macro_rules! benchmarks_instance { ) => { $crate::benchmarks_iter!( INSTANCE + { $( $( $where_ty: $where_bound ),* )? } { $( { $common , $common_from , $common_to , $common_instancer } )* } ( ) $( $rest )* @@ -209,11 +216,12 @@ macro_rules! benchmarks_instance { } #[macro_export] -#[allow(missing_docs)] +#[doc(hidden)] macro_rules! benchmarks_iter { // mutation arm: ( $instance:ident + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* ) @@ -222,6 +230,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter! { $instance + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: $name ( $origin $( , $arg )* ) @@ -232,6 +241,7 @@ macro_rules! benchmarks_iter { // no instance mutation arm: ( NO_INSTANCE + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* ) @@ -240,6 +250,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter! { NO_INSTANCE + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: { @@ -254,6 +265,7 @@ macro_rules! benchmarks_iter { // instance mutation arm: ( INSTANCE + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* ) @@ -262,6 +274,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter! { INSTANCE + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: { @@ -276,6 +289,7 @@ macro_rules! benchmarks_iter { // iteration arm: ( $instance:ident + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: $eval:block @@ -285,29 +299,34 @@ macro_rules! benchmarks_iter { $crate::benchmark_backend! { $instance $name + { $( $where_clause )* } { $( $common )* } { } { $eval } { $( $code )* } $postcode } + + #[cfg(test)] + $crate::impl_benchmark_test!( { $( $where_clause )* } $instance $name ); + $crate::benchmarks_iter!( $instance + { $( $where_clause )* } { $( $common )* } ( $( $names )* $name ) $( $rest )* ); }; // iteration-exit arm - ( $instance:ident { $( $common:tt )* } ( $( $names:ident )* ) ) => { - $crate::selected_benchmark!( $instance $( $names ),* ); - $crate::impl_benchmark!( $instance $( $names ),* ); - #[cfg(test)] - $crate::impl_benchmark_tests!( $instance $( $names ),* ); + ( $instance:ident { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) ) => { + $crate::selected_benchmark!( { $( $where_clause)* } $instance $( $names ),* ); + $crate::impl_benchmark!( { $( $where_clause )* } $instance $( $names ),* ); }; // add verify block to _() format ( $instance:ident + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* ) @@ -315,6 +334,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter! { $instance + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: _ ( $origin $( , $arg )* ) @@ -325,6 +345,7 @@ macro_rules! benchmarks_iter { // add verify block to name() format ( $instance:ident + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* ) @@ -332,6 +353,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter! { $instance + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: $dispatch ( $origin $( , $arg )* ) @@ -342,6 +364,7 @@ macro_rules! benchmarks_iter { // add verify block to {} format ( $instance:ident + { $( $where_clause:tt )* } { $( $common:tt )* } ( $( $names:ident )* ) $name:ident { $( $code:tt )* }: $eval:block @@ -349,6 +372,7 @@ macro_rules! benchmarks_iter { ) => { $crate::benchmarks_iter!( $instance + { $( $where_clause )* } { $( $common )* } ( $( $names )* ) $name { $( $code )* }: $eval @@ -359,10 +383,12 @@ macro_rules! benchmarks_iter { } #[macro_export] -#[allow(missing_docs)] +#[doc(hidden)] macro_rules! benchmark_backend { // parsing arms ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( $common:tt )* } { $( PRE { $( $pre_parsed:tt )* } )* @@ -371,13 +397,15 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { $( $common )* } { + $instance $name { $( $where_clause )* } { $( $common )* } { $( PRE { $( $pre_parsed )* } )* PRE { $pre_id , $pre_ty , $pre_ex } } { $eval } { $( $rest )* } $postcode } }; ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( $common:tt )* } { $( $parsed:tt )* @@ -386,7 +414,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { $( $common )* } { + $instance $name { $( $where_clause )* } { $( $common )* } { $( $parsed )* PARAM { $param , $param_from , $param_to , $param_instancer } } { $eval } { $( $rest )* } $postcode @@ -394,6 +422,8 @@ macro_rules! benchmark_backend { }; // mutation arm to look after defaulting to a common param ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* } { $( $parsed:tt )* @@ -402,7 +432,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { + $instance $name { $( $where_clause )* } { $( { $common , $common_from , $common_to , $common_instancer } )* } { $( $parsed )* @@ -417,6 +447,8 @@ macro_rules! benchmark_backend { }; // mutation arm to look after defaulting only the range to common param ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* } { $( $parsed:tt )* @@ -425,7 +457,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { + $instance $name { $( $where_clause )* } { $( { $common , $common_from , $common_to , $common_instancer } )* } { $( $parsed )* @@ -440,6 +472,8 @@ macro_rules! benchmark_backend { }; // mutation arm to look after a single tt for param_from. ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( $common:tt )* } { $( $parsed:tt )* @@ -448,7 +482,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { $( $common )* } { $( $parsed )* } { $eval } { + $instance $name { $( $where_clause )* } { $( $common )* } { $( $parsed )* } { $eval } { let $param in ( $param_from ) .. $param_to => $param_instancer; $( $rest )* } $postcode @@ -456,6 +490,8 @@ macro_rules! benchmark_backend { }; // mutation arm to look after the default tail of `=> ()` ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( $common:tt )* } { $( $parsed:tt )* @@ -464,7 +500,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { $( $common )* } { $( $parsed )* } { $eval } { + $instance $name { $( $where_clause )* } { $( $common )* } { $( $parsed )* } { $eval } { let $param in $param_from .. $param_to => (); $( $rest )* } $postcode @@ -472,6 +508,8 @@ macro_rules! benchmark_backend { }; // mutation arm to look after `let _ =` ($instance:ident $name:ident { + $( $where_clause:tt )* + } { $( $common:tt )* } { $( $parsed:tt )* @@ -480,7 +518,7 @@ macro_rules! benchmark_backend { $( $rest:tt )* } $postcode:block) => { $crate::benchmark_backend! { - $instance $name { $( $common )* } { $( $parsed )* } { $eval } { + $instance $name { $( $where_clause )* } { $( $common )* } { $( $parsed )* } { $eval } { let $pre_id : _ = $pre_ex; $( $rest )* } $postcode @@ -488,6 +526,8 @@ macro_rules! benchmark_backend { }; // no instance actioning arm (NO_INSTANCE $name:ident { + $( $where_clause:tt )* + } { $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* } { $( PRE { $pre_id:tt , $pre_ty:ty , $pre_ex:expr } )* @@ -496,7 +536,9 @@ macro_rules! benchmark_backend { #[allow(non_camel_case_types)] struct $name; #[allow(unused_variables)] - impl $crate::BenchmarkingSetup for $name { + impl $crate::BenchmarkingSetup for $name + where $( $where_clause )* + { fn components(&self) -> Vec<($crate::BenchmarkParameter, u32, u32)> { vec! [ $( @@ -513,7 +555,9 @@ macro_rules! benchmark_backend { )* $( // Prepare instance - let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1; + let $param = components.iter() + .find(|&c| c.0 == $crate::BenchmarkParameter::$param) + .unwrap().1; )* $( let $pre_id : $pre_ty = $pre_ex; @@ -532,7 +576,9 @@ macro_rules! benchmark_backend { )* $( // Prepare instance - let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1; + let $param = components.iter() + .find(|&c| c.0 == $crate::BenchmarkParameter::$param) + .unwrap().1; )* $( let $pre_id : $pre_ty = $pre_ex; @@ -546,6 +592,8 @@ macro_rules! benchmark_backend { }; // instance actioning arm (INSTANCE $name:ident { + $( $where_clause:tt )* + } { $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* } { $( PRE { $pre_id:tt , $pre_ty:ty , $pre_ex:expr } )* @@ -554,7 +602,9 @@ macro_rules! benchmark_backend { #[allow(non_camel_case_types)] struct $name; #[allow(unused_variables)] - impl, I: Instance> $crate::BenchmarkingSetupInstance for $name { + impl, I: Instance> $crate::BenchmarkingSetupInstance for $name + where $( $where_clause )* + { fn components(&self) -> Vec<($crate::BenchmarkParameter, u32, u32)> { vec! [ $( @@ -571,7 +621,9 @@ macro_rules! benchmark_backend { )* $( // Prepare instance - let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1; + let $param = components.iter() + .find(|&c| c.0 == $crate::BenchmarkParameter::$param) + .unwrap().1; )* $( let $pre_id : $pre_ty = $pre_ex; @@ -590,7 +642,9 @@ macro_rules! benchmark_backend { )* $( // Prepare instance - let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1; + let $param = components.iter() + .find(|&c| c.0 == $crate::BenchmarkParameter::$param) + .unwrap().1; )* $( let $pre_id : $pre_ty = $pre_ex; @@ -604,23 +658,25 @@ macro_rules! benchmark_backend { } } -/// Creates a `SelectedBenchmark` enum implementing `BenchmarkingSetup`. -/// -/// Every variant must implement [`BenchmarkingSetup`]. -/// -/// ```nocompile -/// -/// struct Transfer; -/// impl BenchmarkingSetup for Transfer { ... } -/// -/// struct SetBalance; -/// impl BenchmarkingSetup for SetBalance { ... } -/// -/// selected_benchmark!(Transfer, SetBalance); -/// ``` +// Creates a `SelectedBenchmark` enum implementing `BenchmarkingSetup`. +// +// Every variant must implement [`BenchmarkingSetup`]. +// +// ```nocompile +// +// struct Transfer; +// impl BenchmarkingSetup for Transfer { ... } +// +// struct SetBalance; +// impl BenchmarkingSetup for SetBalance { ... } +// +// selected_benchmark!(Transfer, SetBalance); +// ``` #[macro_export] +#[doc(hidden)] macro_rules! selected_benchmark { ( + { $( $where_clause:tt )* } NO_INSTANCE $( $bench:ident ),* ) => { // The list of available benchmarks for this pallet. @@ -630,7 +686,9 @@ macro_rules! selected_benchmark { } // Allow us to select a benchmark from the list of available benchmarks. - impl $crate::BenchmarkingSetup for SelectedBenchmark { + impl $crate::BenchmarkingSetup for SelectedBenchmark + where $( $where_clause )* + { fn components(&self) -> Vec<($crate::BenchmarkParameter, u32, u32)> { match self { $( Self::$bench => <$bench as $crate::BenchmarkingSetup>::components(&$bench), )* @@ -655,6 +713,7 @@ macro_rules! selected_benchmark { } }; ( + { $( $where_clause:tt )* } INSTANCE $( $bench:ident ),* ) => { // The list of available benchmarks for this pallet. @@ -664,7 +723,9 @@ macro_rules! selected_benchmark { } // Allow us to select a benchmark from the list of available benchmarks. - impl, I: Instance> $crate::BenchmarkingSetupInstance for SelectedBenchmark { + impl, I: Instance> $crate::BenchmarkingSetupInstance for SelectedBenchmark + where $( $where_clause )* + { fn components(&self) -> Vec<($crate::BenchmarkParameter, u32, u32)> { match self { $( Self::$bench => <$bench as $crate::BenchmarkingSetupInstance>::components(&$bench), )* @@ -691,12 +752,14 @@ macro_rules! selected_benchmark { } #[macro_export] +#[doc(hidden)] macro_rules! impl_benchmark { ( + { $( $where_clause:tt )* } NO_INSTANCE $( $name:ident ),* ) => { impl $crate::Benchmarking<$crate::BenchmarkResults> for Module - where T: frame_system::Trait + where T: frame_system::Trait, $( $where_clause )* { fn benchmarks() -> Vec<&'static [u8]> { vec![ $( stringify!($name).as_ref() ),* ] @@ -763,8 +826,11 @@ macro_rules! impl_benchmark { // Run the benchmark `repeat` times. for _ in 0..repeat { - // Set up the externalities environment for the setup we want to benchmark. - let closure_to_benchmark = >::instance(&selected_benchmark, &c)?; + // Set up the externalities environment for the setup we want to + // benchmark. + let closure_to_benchmark = < + SelectedBenchmark as $crate::BenchmarkingSetup + >::instance(&selected_benchmark, &c)?; // Set the block number to at least 1 so events are deposited. if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { @@ -776,12 +842,20 @@ macro_rules! impl_benchmark { $crate::benchmarking::commit_db(); // Time the extrinsic logic. - frame_support::debug::trace!(target: "benchmark", "Start Benchmark: {:?} {:?}", name, component_value); + frame_support::debug::trace!( + target: "benchmark", + "Start Benchmark: {:?} {:?}", name, component_value + ); + let start_extrinsic = $crate::benchmarking::current_time(); closure_to_benchmark()?; let finish_extrinsic = $crate::benchmarking::current_time(); let elapsed_extrinsic = finish_extrinsic - start_extrinsic; - frame_support::debug::trace!(target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic); + + frame_support::debug::trace!( + target: "benchmark", + "End Benchmark: {} ns", elapsed_extrinsic + ); // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); @@ -801,10 +875,12 @@ macro_rules! impl_benchmark { } }; ( + { $( $where_clause:tt )* } INSTANCE $( $name:ident ),* ) => { - impl, I: Instance> $crate::Benchmarking<$crate::BenchmarkResults> for Module - where T: frame_system::Trait + impl, I: Instance> $crate::Benchmarking<$crate::BenchmarkResults> + for Module + where T: frame_system::Trait, $( $where_clause )* { fn benchmarks() -> Vec<&'static [u8]> { vec![ $( stringify!($name).as_ref() ),* ] @@ -829,7 +905,9 @@ macro_rules! impl_benchmark { $crate::benchmarking::commit_db(); $crate::benchmarking::wipe_db(); - let components = >::components(&selected_benchmark); + let components = < + SelectedBenchmark as $crate::BenchmarkingSetupInstance + >::components(&selected_benchmark); let mut results: Vec<$crate::BenchmarkResults> = Vec::new(); // Default number of steps for a component. @@ -872,7 +950,9 @@ macro_rules! impl_benchmark { // Run the benchmark `repeat` times. for _ in 0..repeat { // Set up the externalities environment for the setup we want to benchmark. - let closure_to_benchmark = >::instance(&selected_benchmark, &c)?; + let closure_to_benchmark = < + SelectedBenchmark as $crate::BenchmarkingSetupInstance + >::instance(&selected_benchmark, &c)?; // Set the block number to at least 1 so events are deposited. if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { @@ -884,12 +964,20 @@ macro_rules! impl_benchmark { $crate::benchmarking::commit_db(); // Time the extrinsic logic. - frame_support::debug::trace!(target: "benchmark", "Start Benchmark: {:?} {:?}", name, component_value); + frame_support::debug::trace!( + target: "benchmark", + "Start Benchmark: {:?} {:?}", name, component_value + ); + let start_extrinsic = $crate::benchmarking::current_time(); closure_to_benchmark()?; let finish_extrinsic = $crate::benchmarking::current_time(); let elapsed_extrinsic = finish_extrinsic - start_extrinsic; - frame_support::debug::trace!(target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic); + + frame_support::debug::trace!( + target: "benchmark", + "End Benchmark: {} ns", elapsed_extrinsic + ); // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); @@ -910,108 +998,115 @@ macro_rules! impl_benchmark { } } -// This creates unit tests from the main benchmark macro. -// They run the benchmark using the `high` and `low` value for each component +// This creates a unit test for one benchmark of the main benchmark macro. +// It runs the benchmark using the `high` and `low` value for each component // and ensure that everything completes successfully. #[macro_export] -macro_rules! impl_benchmark_tests { +#[doc(hidden)] +macro_rules! impl_benchmark_test { ( + { $( $where_clause:tt )* } NO_INSTANCE - $( $name:ident ),* + $name:ident ) => { - $( - $crate::paste::item! { - fn [] () -> Result<(), &'static str> - where T: frame_system::Trait - { - let selected_benchmark = SelectedBenchmark::$name; - let components = >::components(&selected_benchmark); - - assert!( - components.len() != 0, - "You need to add components to your benchmark!", - ); - for (_, (name, low, high)) in components.iter().enumerate() { - // Test only the low and high value, assuming values in the middle won't break - for component_value in vec![low, high] { - // Select the max value for all the other components. - let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter() - .enumerate() - .map(|(_, (n, _, h))| - if n == name { - (*n, *component_value) - } else { - (*n, *h) - } - ) - .collect(); - - // Set up the verification state - let closure_to_verify = >::verify(&selected_benchmark, &c)?; - - // Set the block number to at least 1 so events are deposited. - if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { - frame_system::Module::::set_block_number(1.into()); - } + $crate::paste::item! { + fn [] () -> Result<(), &'static str> + where T: frame_system::Trait, $( $where_clause )* + { + let selected_benchmark = SelectedBenchmark::$name; + let components = < + SelectedBenchmark as $crate::BenchmarkingSetup + >::components(&selected_benchmark); + + assert!( + components.len() != 0, + "You need to add components to your benchmark!", + ); + for (_, (name, low, high)) in components.iter().enumerate() { + // Test only the low and high value, assuming values in the middle won't break + for component_value in vec![low, high] { + // Select the max value for all the other components. + let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter() + .enumerate() + .map(|(_, (n, _, h))| + if n == name { + (*n, *component_value) + } else { + (*n, *h) + } + ) + .collect(); - // Run verification - closure_to_verify()?; + // Set up the verification state + let closure_to_verify = < + SelectedBenchmark as $crate::BenchmarkingSetup + >::verify(&selected_benchmark, &c)?; - // Reset the state - $crate::benchmarking::wipe_db(); + // Set the block number to at least 1 so events are deposited. + if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { + frame_system::Module::::set_block_number(1.into()); } + + // Run verification + closure_to_verify()?; + + // Reset the state + $crate::benchmarking::wipe_db(); } - Ok(()) } + Ok(()) } - )* + } }; ( + { $( $where_clause:tt )* } INSTANCE - $( $name:ident ),* + $name:ident ) => { - $( - $crate::paste::item! { - fn [] () -> Result<(), &'static str> - where T: frame_system::Trait - { - let selected_benchmark = SelectedBenchmark::$name; - let components = >::components(&selected_benchmark); - - for (_, (name, low, high)) in components.iter().enumerate() { - // Test only the low and high value, assuming values in the middle won't break - for component_value in vec![low, high] { - // Select the max value for all the other components. - let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter() - .enumerate() - .map(|(_, (n, _, h))| - if n == name { - (*n, *component_value) - } else { - (*n, *h) - } - ) - .collect(); - - // Set up the verification state - let closure_to_verify = >::verify(&selected_benchmark, &c)?; - - // Set the block number to at least 1 so events are deposited. - if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { - frame_system::Module::::set_block_number(1.into()); - } + $crate::paste::item! { + fn [] () -> Result<(), &'static str> + where T: frame_system::Trait, $( $where_clause )* + { + let selected_benchmark = SelectedBenchmark::$name; + let components = < + SelectedBenchmark as $crate::BenchmarkingSetupInstance + >::components(&selected_benchmark); + + for (_, (name, low, high)) in components.iter().enumerate() { + // Test only the low and high value, assuming values in the middle won't break + for component_value in vec![low, high] { + // Select the max value for all the other components. + let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter() + .enumerate() + .map(|(_, (n, _, h))| + if n == name { + (*n, *component_value) + } else { + (*n, *h) + } + ) + .collect(); - // Run verification - closure_to_verify()?; + // Set up the verification state + let closure_to_verify = < + SelectedBenchmark as $crate::BenchmarkingSetupInstance + >::verify(&selected_benchmark, &c)?; - // Reset the state - $crate::benchmarking::wipe_db(); + // Set the block number to at least 1 so events are deposited. + if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { + frame_system::Module::::set_block_number(1.into()); } + + // Run verification + closure_to_verify()?; + + // Reset the state + $crate::benchmarking::wipe_db(); } - Ok(()) } + Ok(()) } - )* + } }; } diff --git a/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index 85e8bf5a5c..674d92eb85 100644 --- a/frame/benchmarking/src/tests.rs +++ b/frame/benchmarking/src/tests.rs @@ -30,13 +30,17 @@ use frame_support::{ use frame_system::{RawOrigin, ensure_signed, ensure_none}; decl_storage! { - trait Store for Module as Test { + trait Store for Module as Test where + ::OtherEvent: Into<::Event> + { Value get(fn value): Option; } } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where + origin: T::Origin, ::OtherEvent: Into<::Event> + { #[weight = 0] fn set_value(origin, n: u32) -> DispatchResult { let _sender = ensure_signed(origin)?; @@ -56,11 +60,16 @@ impl_outer_origin! { pub enum Origin for Test where system = frame_system {} } -pub trait Trait { +pub trait OtherTrait { + type OtherEvent; +} + +pub trait Trait: OtherTrait where Self::OtherEvent: Into { type Event; type BlockNumber; type AccountId: 'static + Default + Decode; - type Origin: From> + Into, Self::Origin>>; + type Origin: From> + + Into, Self::Origin>>; } #[derive(Clone, Eq, PartialEq)] @@ -100,6 +109,10 @@ impl Trait for Test { type AccountId = u64; } +impl OtherTrait for Test { + type OtherEvent = (); +} + // This function basically just builds a genesis storage key/value store according to // our desired mockup. fn new_test_ext() -> sp_io::TestExternalities { @@ -107,6 +120,8 @@ fn new_test_ext() -> sp_io::TestExternalities { } benchmarks!{ + where_clause { where ::OtherEvent: Into<::Event> } + _ { // Define a common range for `b`. let b in 1 .. 1000 => (); @@ -156,13 +171,13 @@ benchmarks!{ #[test] fn benchmarks_macro_works() { // Check benchmark creation for `set_value`. - let selected_benchmark = SelectedBenchmark::set_value; + let selected = SelectedBenchmark::set_value; - let components = >::components(&selected_benchmark); + let components = >::components(&selected); assert_eq!(components, vec![(BenchmarkParameter::b, 1, 1000)]); let closure = >::instance( - &selected_benchmark, + &selected, &[(BenchmarkParameter::b, 1)], ).expect("failed to create closure"); @@ -174,12 +189,12 @@ fn benchmarks_macro_works() { #[test] fn benchmarks_macro_rename_works() { // Check benchmark creation for `other_dummy`. - let selected_benchmark = SelectedBenchmark::other_name; - let components = >::components(&selected_benchmark); + let selected = SelectedBenchmark::other_name; + let components = >::components(&selected); assert_eq!(components, vec![(BenchmarkParameter::b, 1, 1000)]); let closure = >::instance( - &selected_benchmark, + &selected, &[(BenchmarkParameter::b, 1)], ).expect("failed to create closure"); @@ -190,13 +205,13 @@ fn benchmarks_macro_rename_works() { #[test] fn benchmarks_macro_works_for_non_dispatchable() { - let selected_benchmark = SelectedBenchmark::sort_vector; + let selected = SelectedBenchmark::sort_vector; - let components = >::components(&selected_benchmark); + let components = >::components(&selected); assert_eq!(components, vec![(BenchmarkParameter::x, 1, 10000)]); let closure = >::instance( - &selected_benchmark, + &selected, &[(BenchmarkParameter::x, 1)], ).expect("failed to create closure"); @@ -206,10 +221,10 @@ fn benchmarks_macro_works_for_non_dispatchable() { #[test] fn benchmarks_macro_verify_works() { // Check postcondition for benchmark `set_value` is valid. - let selected_benchmark = SelectedBenchmark::set_value; + let selected = SelectedBenchmark::set_value; let closure = >::verify( - &selected_benchmark, + &selected, &[(BenchmarkParameter::b, 1)], ).expect("failed to create closure"); -- GitLab From 5a85a43104f1c1b934ec43835492b2d36e84b18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 24 Jun 2020 16:42:27 +0100 Subject: [PATCH 239/280] client: fix print of slot duration on startup (#6495) --- client/consensus/slots/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/slots/src/lib.rs b/client/consensus/slots/src/lib.rs index 950f83fbce..7687d3114b 100644 --- a/client/consensus/slots/src/lib.rs +++ b/client/consensus/slots/src/lib.rs @@ -471,7 +471,7 @@ impl SlotDuration { info!( "⏱ Loaded block-time = {:?} milliseconds from genesis on first-launch", - genesis_slot_duration + genesis_slot_duration.slot_duration() ); genesis_slot_duration -- GitLab From 7f5dd736f42a408b62885669f7d76ef5baa13572 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Wed, 24 Jun 2020 21:03:55 +0200 Subject: [PATCH 240/280] Add DB Read/Write Tracking to Benchmarking Pipeline (#6386) * initial mockup * add and wipe * track writes * start to add to pipeline * return all reads/writes * Log reads and writes from bench db * causes panic * Allow multiple commits * commit before ending benchmark * doesn't work??? * fix * Update lib.rs * switch to struct for `BenchmarkResults` * add to output * fix test * line width * @kianenigma review * Add Whitelist to DB Tracking in Benchmarks Pipeline (#6405) * hardcoded whitelist * Add whitelist to pipeline * Remove whitelist pipeline from CLI, add to runtime * clean-up unused db initialized whitelist * Add regression analysis to DB Tracking (#6475) * Add selector * add tests * debug formatter for easy formula * Update client/db/src/bench.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: arkpar Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- Cargo.lock | 1 + bin/node/runtime/Cargo.toml | 1 + bin/node/runtime/src/lib.rs | 20 ++- client/db/src/bench.rs | 169 +++++++++++++++++++- frame/benchmarking/src/analysis.rs | 140 ++++++++++++---- frame/benchmarking/src/lib.rs | 56 ++++++- frame/benchmarking/src/utils.rs | 26 ++- primitives/externalities/src/lib.rs | 21 +++ primitives/runtime-interface/src/impls.rs | 4 + primitives/state-machine/src/backend.rs | 17 +- primitives/state-machine/src/basic.rs | 12 ++ primitives/state-machine/src/ext.rs | 13 ++ primitives/state-machine/src/read_only.rs | 12 ++ utils/frame/benchmarking-cli/src/command.rs | 39 +++-- 14 files changed, 471 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1ea4a479c..1520373790 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3518,6 +3518,7 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", + "hex-literal", "integer-sqrt", "node-primitives", "pallet-authority-discovery", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index b26b53cd6c..3614e4ca0d 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -18,6 +18,7 @@ codec = { package = "parity-scale-codec", version = "1.3.1", default-features = integer-sqrt = { version = "0.1.2" } serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" +hex-literal = "0.2.1" # primitives sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/authority-discovery" } diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 90bb63874e..8b6831b41e 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1075,8 +1075,26 @@ impl_runtime_apis! { impl pallet_offences_benchmarking::Trait for Runtime {} impl frame_system_benchmarking::Trait for Runtime {} + let whitelist: Vec> = vec![ + // Block Number + // frame_system::Number::::hashed_key().to_vec(), + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec(), + // Total Issuance + hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec(), + // Execution Phase + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec(), + // Event Count + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec(), + // System Events + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec(), + // Caller 0 Account + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec(), + // Treasury Account + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec(), + ]; + let mut batches = Vec::::new(); - let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat); + let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat, &whitelist); add_benchmark!(params, batches, b"balances", Balances); add_benchmark!(params, batches, b"collective", Council); diff --git a/client/db/src/bench.rs b/client/db/src/bench.rs index 99ce1edae0..c3bed3e24f 100644 --- a/client/db/src/bench.rs +++ b/client/db/src/bench.rs @@ -24,10 +24,10 @@ use std::collections::HashMap; use hash_db::{Prefix, Hasher}; use sp_trie::{MemoryDB, prefixed_key}; -use sp_core::storage::ChildInfo; +use sp_core::{storage::ChildInfo, hexdisplay::HexDisplay}; use sp_runtime::traits::{Block as BlockT, HashFor}; use sp_runtime::Storage; -use sp_state_machine::{DBValue, backend::Backend as StateBackend}; +use sp_state_machine::{DBValue, backend::Backend as StateBackend, StorageCollection}; use kvdb::{KeyValueDB, DBTransaction}; use crate::storage_cache::{CachingState, SharedCache, new_shared_cache}; @@ -50,6 +50,40 @@ impl sp_state_machine::Storage> for StorageDb { root: Cell, @@ -59,6 +93,9 @@ pub struct BenchmarkingState { genesis: HashMap, (Vec, i32)>, record: Cell>>, shared_cache: SharedCache, // shared cache is always empty + key_tracker: RefCell, KeyTracker>>, + read_write_tracker: RefCell, + whitelist: RefCell>>, } impl BenchmarkingState { @@ -76,8 +113,13 @@ impl BenchmarkingState { genesis_root: Default::default(), record: Default::default(), shared_cache: new_shared_cache(0, (1, 10)), + key_tracker: Default::default(), + read_write_tracker: Default::default(), + whitelist: Default::default(), }; + state.add_whitelist_to_tracker(); + state.reopen()?; let child_delta = genesis.children_default.iter().map(|(_storage_key, child_content)| ( &child_content.child_info, @@ -89,7 +131,7 @@ impl BenchmarkingState { ); state.genesis = transaction.clone().drain(); state.genesis_root = root.clone(); - state.commit(root, transaction)?; + state.commit(root, transaction, Vec::new())?; state.record.take(); Ok(state) } @@ -109,6 +151,86 @@ impl BenchmarkingState { )); Ok(()) } + + fn add_whitelist_to_tracker(&self) { + let mut key_tracker = self.key_tracker.borrow_mut(); + + let whitelisted = KeyTracker { + has_been_read: true, + has_been_written: true, + }; + + let whitelist = self.whitelist.borrow(); + + whitelist.iter().for_each(|key| { + key_tracker.insert(key.to_vec(), whitelisted); + }); + } + + fn wipe_tracker(&self) { + *self.key_tracker.borrow_mut() = HashMap::new(); + self.add_whitelist_to_tracker(); + *self.read_write_tracker.borrow_mut() = Default::default(); + } + + fn add_read_key(&self, key: &[u8]) { + log::trace!(target: "benchmark", "Read: {}", HexDisplay::from(&key)); + + let mut key_tracker = self.key_tracker.borrow_mut(); + let mut read_write_tracker = self.read_write_tracker.borrow_mut(); + + let maybe_tracker = key_tracker.get(key); + + let has_been_read = KeyTracker { + has_been_read: true, + has_been_written: false, + }; + + match maybe_tracker { + None => { + key_tracker.insert(key.to_vec(), has_been_read); + read_write_tracker.add_read(); + }, + Some(tracker) => { + if !tracker.has_been_read { + key_tracker.insert(key.to_vec(), has_been_read); + read_write_tracker.add_read(); + } else { + read_write_tracker.add_repeat_read(); + } + } + } + } + + fn add_write_key(&self, key: &[u8]) { + log::trace!(target: "benchmark", "Write: {}", HexDisplay::from(&key)); + + let mut key_tracker = self.key_tracker.borrow_mut(); + let mut read_write_tracker = self.read_write_tracker.borrow_mut(); + + let maybe_tracker = key_tracker.get(key); + + // If we have written to the key, we also consider that we have read from it. + let has_been_written = KeyTracker { + has_been_read: true, + has_been_written: true, + }; + + match maybe_tracker { + None => { + key_tracker.insert(key.to_vec(), has_been_written); + read_write_tracker.add_write(); + }, + Some(tracker) => { + if !tracker.has_been_written { + key_tracker.insert(key.to_vec(), has_been_written); + read_write_tracker.add_write(); + } else { + read_write_tracker.add_repeat_write(); + } + } + } + } } fn state_err() -> String { @@ -121,10 +243,12 @@ impl StateBackend> for BenchmarkingState { type TrieBackendStorage = as StateBackend>>::TrieBackendStorage; fn storage(&self, key: &[u8]) -> Result>, Self::Error> { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.storage(key) } fn storage_hash(&self, key: &[u8]) -> Result, Self::Error> { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.storage_hash(key) } @@ -133,10 +257,12 @@ impl StateBackend> for BenchmarkingState { child_info: &ChildInfo, key: &[u8], ) -> Result>, Self::Error> { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.child_storage(child_info, key) } fn exists_storage(&self, key: &[u8]) -> Result { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.exists_storage(key) } @@ -145,10 +271,12 @@ impl StateBackend> for BenchmarkingState { child_info: &ChildInfo, key: &[u8], ) -> Result { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.exists_child_storage(child_info, key) } fn next_storage_key(&self, key: &[u8]) -> Result>, Self::Error> { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.next_storage_key(key) } @@ -157,6 +285,7 @@ impl StateBackend> for BenchmarkingState { child_info: &ChildInfo, key: &[u8], ) -> Result>, Self::Error> { + self.add_read_key(key); self.state.borrow().as_ref().ok_or_else(state_err)?.next_child_storage_key(child_info, key) } @@ -230,8 +359,11 @@ impl StateBackend> for BenchmarkingState { None } - fn commit(&self, storage_root: as Hasher>::Out, mut transaction: Self::Transaction) - -> Result<(), Self::Error> + fn commit(&self, + storage_root: as Hasher>::Out, + mut transaction: Self::Transaction, + storage_changes: StorageCollection, + ) -> Result<(), Self::Error> { if let Some(db) = self.db.take() { let mut db_transaction = DBTransaction::new(); @@ -245,10 +377,17 @@ impl StateBackend> for BenchmarkingState { } keys.push(key); } - self.record.set(keys); + let mut record = self.record.take(); + record.extend(keys); + self.record.set(record); db.write(db_transaction).map_err(|_| String::from("Error committing transaction"))?; self.root.set(storage_root); - self.db.set(Some(db)) + self.db.set(Some(db)); + + // Track DB Writes + storage_changes.iter().for_each(|(key, _)| { + self.add_write_key(key); + }); } else { return Err("Trying to commit to a closed db".into()) } @@ -272,9 +411,25 @@ impl StateBackend> for BenchmarkingState { self.root.set(self.genesis_root.clone()); self.reopen()?; + self.wipe_tracker(); Ok(()) } + /// Get the key tracking information for the state db. + fn read_write_count(&self) -> (u32, u32, u32, u32) { + let count = *self.read_write_tracker.borrow_mut(); + (count.reads, count.repeat_reads, count.writes, count.repeat_writes) + } + + /// Reset the key tracking information for the state db. + fn reset_read_write_count(&self) { + self.wipe_tracker() + } + + fn set_whitelist(&self, new: Vec>) { + *self.whitelist.borrow_mut() = new; + } + fn register_overlay_stats(&mut self, stats: &sp_state_machine::StateMachineStats) { self.state.borrow_mut().as_mut().map(|s| s.register_overlay_stats(stats)); } diff --git a/frame/benchmarking/src/analysis.rs b/frame/benchmarking/src/analysis.rs index 0446430975..621f3a2941 100644 --- a/frame/benchmarking/src/analysis.rs +++ b/frame/benchmarking/src/analysis.rs @@ -29,24 +29,40 @@ pub struct Analysis { model: Option, } +pub enum BenchmarkSelector { + ExtrinsicTime, + StorageRootTime, + Reads, + Writes, +} + impl Analysis { - pub fn median_slopes(r: &Vec) -> Option { - let results = r[0].0.iter().enumerate().map(|(i, &(param, _))| { + pub fn median_slopes(r: &Vec, selector: BenchmarkSelector) -> Option { + let results = r[0].components.iter().enumerate().map(|(i, &(param, _))| { let mut counted = BTreeMap::, usize>::new(); - for (params, _, _) in r.iter() { - let mut p = params.iter().map(|x| x.1).collect::>(); + for result in r.iter() { + let mut p = result.components.iter().map(|x| x.1).collect::>(); p[i] = 0; *counted.entry(p).or_default() += 1; } let others: Vec = counted.iter().max_by_key(|i| i.1).expect("r is not empty; qed").0.clone(); let values = r.iter() .filter(|v| - v.0.iter() + v.components.iter() .map(|x| x.1) .zip(others.iter()) .enumerate() .all(|(j, (v1, v2))| j == i || v1 == *v2) - ).map(|(ps, v, _)| (ps[i].1, *v)) + ).map(|result| { + // Extract the data we are interested in analyzing + let data = match selector { + BenchmarkSelector::ExtrinsicTime => result.extrinsic_time, + BenchmarkSelector::StorageRootTime => result.storage_root_time, + BenchmarkSelector::Reads => result.reads.into(), + BenchmarkSelector::Writes => result.writes.into(), + }; + (result.components[i].1, data) + }) .collect::>(); (format!("{:?}", param), i, others, values) }).collect::>(); @@ -97,12 +113,18 @@ impl Analysis { }) } - pub fn min_squares_iqr(r: &Vec) -> Option { + pub fn min_squares_iqr(r: &Vec, selector: BenchmarkSelector) -> Option { let mut results = BTreeMap::, Vec>::new(); - for &(ref params, t, _) in r.iter() { - let p = params.iter().map(|x| x.1).collect::>(); - results.entry(p).or_default().push(t); + for result in r.iter() { + let p = result.components.iter().map(|x| x.1).collect::>(); + results.entry(p).or_default().push(match selector { + BenchmarkSelector::ExtrinsicTime => result.extrinsic_time, + BenchmarkSelector::StorageRootTime => result.storage_root_time, + BenchmarkSelector::Reads => result.reads.into(), + BenchmarkSelector::Writes => result.writes.into(), + }) } + for (_, rs) in results.iter_mut() { rs.sort(); let ql = rs.len() / 4; @@ -111,7 +133,7 @@ impl Analysis { let mut data = vec![("Y", results.iter().flat_map(|x| x.1.iter().map(|v| *v as f64)).collect())]; - let names = r[0].0.iter().map(|x| format!("{:?}", x.0)).collect::>(); + let names = r[0].components.iter().map(|x| format!("{:?}", x.0)).collect::>(); data.extend(names.iter() .enumerate() .map(|(i, p)| ( @@ -217,40 +239,88 @@ impl std::fmt::Display for Analysis { } } +impl std::fmt::Debug for Analysis { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{}", self.base)?; + for (&m, n) in self.slopes.iter().zip(self.names.iter()) { + write!(f, " + ({} * {})", m, n)?; + } + write!(f,"") + } +} + #[cfg(test)] mod tests { use super::*; use crate::BenchmarkParameter; + fn benchmark_result( + components: Vec<(BenchmarkParameter, u32)>, + extrinsic_time: u128, + storage_root_time: u128, + reads: u32, + writes: u32, + ) -> BenchmarkResults { + BenchmarkResults { + components, + extrinsic_time, + storage_root_time, + reads, + repeat_reads: 0, + writes, + repeat_writes: 0, + } + } + #[test] fn analysis_median_slopes_should_work() { - let a = Analysis::median_slopes(&vec![ - (vec![(BenchmarkParameter::n, 1), (BenchmarkParameter::m, 5)], 11_500_000, 0), - (vec![(BenchmarkParameter::n, 2), (BenchmarkParameter::m, 5)], 12_500_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 5)], 13_500_000, 0), - (vec![(BenchmarkParameter::n, 4), (BenchmarkParameter::m, 5)], 14_500_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 1)], 13_100_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 3)], 13_300_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 7)], 13_700_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 10)], 14_000_000, 0), - ]).unwrap(); - assert_eq!(a.base, 10_000_000); - assert_eq!(a.slopes, vec![1_000_000, 100_000]); + let data = vec![ + benchmark_result(vec![(BenchmarkParameter::n, 1), (BenchmarkParameter::m, 5)], 11_500_000, 0, 3, 10), + benchmark_result(vec![(BenchmarkParameter::n, 2), (BenchmarkParameter::m, 5)], 12_500_000, 0, 4, 10), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 5)], 13_500_000, 0, 5, 10), + benchmark_result(vec![(BenchmarkParameter::n, 4), (BenchmarkParameter::m, 5)], 14_500_000, 0, 6, 10), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 1)], 13_100_000, 0, 5, 2), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 3)], 13_300_000, 0, 5, 6), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 7)], 13_700_000, 0, 5, 14), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 10)], 14_000_000, 0, 5, 20), + ]; + + let extrinsic_time = Analysis::median_slopes(&data, BenchmarkSelector::ExtrinsicTime).unwrap(); + assert_eq!(extrinsic_time.base, 10_000_000); + assert_eq!(extrinsic_time.slopes, vec![1_000_000, 100_000]); + + let reads = Analysis::median_slopes(&data, BenchmarkSelector::Reads).unwrap(); + assert_eq!(reads.base, 2); + assert_eq!(reads.slopes, vec![1, 0]); + + let writes = Analysis::median_slopes(&data, BenchmarkSelector::Writes).unwrap(); + assert_eq!(writes.base, 0); + assert_eq!(writes.slopes, vec![0, 2]); } #[test] fn analysis_median_min_squares_should_work() { - let a = Analysis::min_squares_iqr(&vec![ - (vec![(BenchmarkParameter::n, 1), (BenchmarkParameter::m, 5)], 11_500_000, 0), - (vec![(BenchmarkParameter::n, 2), (BenchmarkParameter::m, 5)], 12_500_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 5)], 13_500_000, 0), - (vec![(BenchmarkParameter::n, 4), (BenchmarkParameter::m, 5)], 14_500_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 1)], 13_100_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 3)], 13_300_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 7)], 13_700_000, 0), - (vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 10)], 14_000_000, 0), - ]).unwrap(); - assert_eq!(a.base, 10_000_000); - assert_eq!(a.slopes, vec![1_000_000, 100_000]); + let data = vec![ + benchmark_result(vec![(BenchmarkParameter::n, 1), (BenchmarkParameter::m, 5)], 11_500_000, 0, 3, 10), + benchmark_result(vec![(BenchmarkParameter::n, 2), (BenchmarkParameter::m, 5)], 12_500_000, 0, 4, 10), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 5)], 13_500_000, 0, 5, 10), + benchmark_result(vec![(BenchmarkParameter::n, 4), (BenchmarkParameter::m, 5)], 14_500_000, 0, 6, 10), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 1)], 13_100_000, 0, 5, 2), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 3)], 13_300_000, 0, 5, 6), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 7)], 13_700_000, 0, 5, 14), + benchmark_result(vec![(BenchmarkParameter::n, 3), (BenchmarkParameter::m, 10)], 14_000_000, 0, 5, 20), + ]; + + let extrinsic_time = Analysis::min_squares_iqr(&data, BenchmarkSelector::ExtrinsicTime).unwrap(); + assert_eq!(extrinsic_time.base, 10_000_000); + assert_eq!(extrinsic_time.slopes, vec![1_000_000, 100_000]); + + let reads = Analysis::min_squares_iqr(&data, BenchmarkSelector::Reads).unwrap(); + assert_eq!(reads.base, 2); + assert_eq!(reads.slopes, vec![1, 0]); + + let writes = Analysis::min_squares_iqr(&data, BenchmarkSelector::Writes).unwrap(); + assert_eq!(writes.base, 0); + assert_eq!(writes.slopes, vec![0, 2]); } } diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index 7cbac3397a..7a7848305a 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -26,7 +26,7 @@ mod analysis; pub use utils::*; #[cfg(feature = "std")] -pub use analysis::Analysis; +pub use analysis::{Analysis, BenchmarkSelector}; #[doc(hidden)] pub use sp_io::storage::root as storage_root; pub use sp_runtime::traits::Zero; @@ -771,6 +771,7 @@ macro_rules! impl_benchmark { highest_range_values: &[u32], steps: &[u32], repeat: u32, + whitelist: &[Vec] ) -> Result, &'static str> { // Map the input to the selected benchmark. let extrinsic = sp_std::str::from_utf8(extrinsic) @@ -780,6 +781,9 @@ macro_rules! impl_benchmark { _ => return Err("Could not find extrinsic."), }; + // Add whitelist to DB + $crate::benchmarking::set_whitelist(whitelist.to_vec()); + // Warm up the DB $crate::benchmarking::commit_db(); $crate::benchmarking::wipe_db(); @@ -841,6 +845,9 @@ macro_rules! impl_benchmark { // This will enable worst case scenario for reading from the database. $crate::benchmarking::commit_db(); + // Reset the read/write counter so we don't count operations in the setup process. + $crate::benchmarking::reset_read_write_count(); + // Time the extrinsic logic. frame_support::debug::trace!( target: "benchmark", @@ -851,11 +858,17 @@ macro_rules! impl_benchmark { closure_to_benchmark()?; let finish_extrinsic = $crate::benchmarking::current_time(); let elapsed_extrinsic = finish_extrinsic - start_extrinsic; - + // Commit the changes to get proper write count + $crate::benchmarking::commit_db(); frame_support::debug::trace!( target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic ); + let read_write_count = $crate::benchmarking::read_write_count(); + frame_support::debug::trace!( + target: "benchmark", + "Read/Write Count {:?}", read_write_count + ); // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); @@ -863,7 +876,15 @@ macro_rules! impl_benchmark { let finish_storage_root = $crate::benchmarking::current_time(); let elapsed_storage_root = finish_storage_root - start_storage_root; - results.push((c.clone(), elapsed_extrinsic, elapsed_storage_root)); + results.push($crate::BenchmarkResults { + components: c.clone(), + extrinsic_time: elapsed_extrinsic, + storage_root_time: elapsed_storage_root, + reads: read_write_count.0, + repeat_reads: read_write_count.1, + writes: read_write_count.2, + repeat_writes: read_write_count.3, + }); // Wipe the DB back to the genesis state. $crate::benchmarking::wipe_db(); @@ -892,6 +913,7 @@ macro_rules! impl_benchmark { highest_range_values: &[u32], steps: &[u32], repeat: u32, + whitelist: &[Vec] ) -> Result, &'static str> { // Map the input to the selected benchmark. let extrinsic = sp_std::str::from_utf8(extrinsic) @@ -901,6 +923,9 @@ macro_rules! impl_benchmark { _ => return Err("Could not find extrinsic."), }; + // Add whitelist to DB + $crate::benchmarking::set_whitelist(whitelist.to_vec()); + // Warm up the DB $crate::benchmarking::commit_db(); $crate::benchmarking::wipe_db(); @@ -963,6 +988,9 @@ macro_rules! impl_benchmark { // This will enable worst case scenario for reading from the database. $crate::benchmarking::commit_db(); + // Reset the read/write counter so we don't count operations in the setup process. + $crate::benchmarking::reset_read_write_count(); + // Time the extrinsic logic. frame_support::debug::trace!( target: "benchmark", @@ -973,11 +1001,17 @@ macro_rules! impl_benchmark { closure_to_benchmark()?; let finish_extrinsic = $crate::benchmarking::current_time(); let elapsed_extrinsic = finish_extrinsic - start_extrinsic; - + // Commit the changes to get proper write count + $crate::benchmarking::commit_db(); frame_support::debug::trace!( target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic ); + let read_write_count = $crate::benchmarking::read_write_count(); + frame_support::debug::trace!( + target: "benchmark", + "Read/Write Count {:?}", read_write_count + ); // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); @@ -985,7 +1019,15 @@ macro_rules! impl_benchmark { let finish_storage_root = $crate::benchmarking::current_time(); let elapsed_storage_root = finish_storage_root - start_storage_root; - results.push((c.clone(), elapsed_extrinsic, elapsed_storage_root)); + results.push($crate::BenchmarkResults { + components: c.clone(), + extrinsic_time: elapsed_extrinsic, + storage_root_time: elapsed_storage_root, + reads: read_write_count.0, + repeat_reads: read_write_count.1, + writes: read_write_count.2, + repeat_writes: read_write_count.3, + }); // Wipe the DB back to the genesis state. $crate::benchmarking::wipe_db(); @@ -1139,7 +1181,7 @@ macro_rules! impl_benchmark_test { #[macro_export] macro_rules! add_benchmark { ( $params:ident, $batches:ident, $name:literal, $( $location:tt )* ) => ( - let (pallet, benchmark, lowest_range_values, highest_range_values, steps, repeat) = $params; + let (pallet, benchmark, lowest_range_values, highest_range_values, steps, repeat, whitelist) = $params; if &pallet[..] == &$name[..] || &pallet[..] == &b"*"[..] { if &pallet[..] == &b"*"[..] || &benchmark[..] == &b"*"[..] { for benchmark in $( $location )*::benchmarks().into_iter() { @@ -1150,6 +1192,7 @@ macro_rules! add_benchmark { &highest_range_values[..], &steps[..], repeat, + whitelist, )?, pallet: $name.to_vec(), benchmark: benchmark.to_vec(), @@ -1163,6 +1206,7 @@ macro_rules! add_benchmark { &highest_range_values[..], &steps[..], repeat, + whitelist, )?, pallet: $name.to_vec(), benchmark: benchmark.clone(), diff --git a/frame/benchmarking/src/utils.rs b/frame/benchmarking/src/utils.rs index 31ec3783cc..7f9d912110 100644 --- a/frame/benchmarking/src/utils.rs +++ b/frame/benchmarking/src/utils.rs @@ -44,7 +44,16 @@ pub struct BenchmarkBatch { /// Results from running benchmarks on a FRAME pallet. /// Contains duration of the function call in nanoseconds along with the benchmark parameters /// used for that benchmark result. -pub type BenchmarkResults = (Vec<(BenchmarkParameter, u32)>, u128, u128); +#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)] +pub struct BenchmarkResults { + pub components: Vec<(BenchmarkParameter, u32)>, + pub extrinsic_time: u128, + pub storage_root_time: u128, + pub reads: u32, + pub repeat_reads: u32, + pub writes: u32, + pub repeat_writes: u32, +} sp_api::decl_runtime_apis! { /// Runtime api for benchmarking a FRAME runtime. @@ -83,6 +92,20 @@ pub trait Benchmarking { fn commit_db(&mut self) { self.commit() } + + /// Get the read/write count + fn read_write_count(&self) -> (u32, u32, u32, u32) { + self.read_write_count() + } + + /// Reset the read/write count + fn reset_read_write_count(&mut self) { + self.reset_read_write_count() + } + + fn set_whitelist(&mut self, new: Vec>) { + self.set_whitelist(new) + } } /// The pallet benchmarking trait. @@ -106,6 +129,7 @@ pub trait Benchmarking { highest_range_values: &[u32], steps: &[u32], repeat: u32, + whitelist: &[Vec] ) -> Result, &'static str>; } diff --git a/primitives/externalities/src/lib.rs b/primitives/externalities/src/lib.rs index 210fe5b4ef..8e14186719 100644 --- a/primitives/externalities/src/lib.rs +++ b/primitives/externalities/src/lib.rs @@ -233,6 +233,27 @@ pub trait Externalities: ExtensionStore { /// /// Commits all changes to the database and clears all caches. fn commit(&mut self); + + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// Benchmarking related functionality and shouldn't be used anywhere else! + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// + /// Gets the current read/write count for the benchmarking process. + fn read_write_count(&self) -> (u32, u32, u32, u32); + + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// Benchmarking related functionality and shouldn't be used anywhere else! + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// + /// Resets read/write count for the benchmarking process. + fn reset_read_write_count(&mut self); + + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// Benchmarking related functionality and shouldn't be used anywhere else! + /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /// + /// Adds new storage keys to the DB tracking whitelist. + fn set_whitelist(&mut self, new: Vec>); } /// Extension for the [`Externalities`] trait. diff --git a/primitives/runtime-interface/src/impls.rs b/primitives/runtime-interface/src/impls.rs index 217316c3dd..259d3517f0 100644 --- a/primitives/runtime-interface/src/impls.rs +++ b/primitives/runtime-interface/src/impls.rs @@ -365,6 +365,10 @@ impl PassBy for Option { type PassBy = Codec; } +impl PassBy for (u32, u32, u32, u32) { + type PassBy = Codec; +} + /// Implement `PassBy` with `Inner` for the given fixed sized hash types. macro_rules! for_primitive_types { { $( $hash:ident $n:expr ),* $(,)? } => { diff --git a/primitives/state-machine/src/backend.rs b/primitives/state-machine/src/backend.rs index 20a3ab7500..9ec03c4d1e 100644 --- a/primitives/state-machine/src/backend.rs +++ b/primitives/state-machine/src/backend.rs @@ -212,7 +212,22 @@ pub trait Backend: std::fmt::Debug { } /// Commit given transaction to storage. - fn commit(&self, _: H::Out, _: Self::Transaction) -> Result<(), Self::Error> { + fn commit(&self, _: H::Out, _: Self::Transaction, _: StorageCollection) -> Result<(), Self::Error> { + unimplemented!() + } + + /// Get the read/write count of the db + fn read_write_count(&self) -> (u32, u32, u32, u32) { + unimplemented!() + } + + /// Get the read/write count of the db + fn reset_read_write_count(&self) { + unimplemented!() + } + + /// Update the whitelist for tracking db reads/writes + fn set_whitelist(&self, _: Vec>) { unimplemented!() } } diff --git a/primitives/state-machine/src/basic.rs b/primitives/state-machine/src/basic.rs index dbb4c6c2b8..6f1d2a4b5a 100644 --- a/primitives/state-machine/src/basic.rs +++ b/primitives/state-machine/src/basic.rs @@ -322,6 +322,18 @@ impl Externalities for BasicExternalities { fn wipe(&mut self) {} fn commit(&mut self) {} + + fn read_write_count(&self) -> (u32, u32, u32, u32) { + unimplemented!("read_write_count is not supported in Basic") + } + + fn reset_read_write_count(&mut self) { + unimplemented!("reset_read_write_count is not supported in Basic") + } + + fn set_whitelist(&mut self, _: Vec>) { + unimplemented!("set_whitelist is not supported in Basic") + } } impl sp_externalities::ExtensionStore for BasicExternalities { diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index 2cd63cde97..e25a08adb0 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -590,9 +590,22 @@ where self.backend.commit( changes.transaction_storage_root, changes.transaction, + changes.main_storage_changes, ).expect(EXT_NOT_ALLOWED_TO_FAIL); self.mark_dirty(); } + + fn read_write_count(&self) -> (u32, u32, u32, u32) { + self.backend.read_write_count() + } + + fn reset_read_write_count(&mut self) { + self.backend.reset_read_write_count() + } + + fn set_whitelist(&mut self, new: Vec>) { + self.backend.set_whitelist(new) + } } diff --git a/primitives/state-machine/src/read_only.rs b/primitives/state-machine/src/read_only.rs index 2a5d7fda36..b8a35ced1e 100644 --- a/primitives/state-machine/src/read_only.rs +++ b/primitives/state-machine/src/read_only.rs @@ -185,6 +185,18 @@ impl<'a, H: Hasher, B: 'a + Backend> Externalities for ReadOnlyExternalities< fn wipe(&mut self) {} fn commit(&mut self) {} + + fn read_write_count(&self) -> (u32, u32, u32, u32) { + unimplemented!("read_write_count is not supported in ReadOnlyExternalities") + } + + fn reset_read_write_count(&mut self) { + unimplemented!("reset_read_write_count is not supported in ReadOnlyExternalities") + } + + fn set_whitelist(&mut self, _: Vec>) { + unimplemented!("set_whitelist is not supported in ReadOnlyExternalities") + } } impl<'a, H: Hasher, B: 'a + Backend> sp_externalities::ExtensionStore for ReadOnlyExternalities<'a, H, B> { diff --git a/utils/frame/benchmarking-cli/src/command.rs b/utils/frame/benchmarking-cli/src/command.rs index f867d75d2a..7f55672885 100644 --- a/utils/frame/benchmarking-cli/src/command.rs +++ b/utils/frame/benchmarking-cli/src/command.rs @@ -17,7 +17,7 @@ use crate::BenchmarkCmd; use codec::{Decode, Encode}; -use frame_benchmarking::{Analysis, BenchmarkBatch}; +use frame_benchmarking::{Analysis, BenchmarkBatch, BenchmarkSelector}; use sc_cli::{SharedParams, CliConfiguration, ExecutionStrategy, Result}; use sc_client_db::BenchmarkingState; use sc_executor::NativeExecutor; @@ -107,15 +107,22 @@ impl BenchmarkCmd { if self.raw_data { // Print the table header - batch.results[0].0.iter().for_each(|param| print!("{:?},", param.0)); + batch.results[0].components.iter().for_each(|param| print!("{:?},", param.0)); - print!("extrinsic_time,storage_root_time\n"); + print!("extrinsic_time,storage_root_time,reads,repeat_reads,writes,repeat_writes\n"); // Print the values batch.results.iter().for_each(|result| { - let parameters = &result.0; + let parameters = &result.components; parameters.iter().for_each(|param| print!("{:?},", param.1)); // Print extrinsic time and storage root time - print!("{:?},{:?}\n", result.1, result.2); + print!("{:?},{:?},{:?},{:?},{:?},{:?}\n", + result.extrinsic_time, + result.storage_root_time, + result.reads, + result.repeat_reads, + result.writes, + result.repeat_writes, + ); }); println!(); @@ -123,13 +130,27 @@ impl BenchmarkCmd { // Conduct analysis. if !self.no_median_slopes { - if let Some(analysis) = Analysis::median_slopes(&batch.results) { - println!("Median Slopes Analysis\n========\n{}", analysis); + println!("Median Slopes Analysis\n========"); + if let Some(analysis) = Analysis::median_slopes(&batch.results, BenchmarkSelector::ExtrinsicTime) { + println!("-- Extrinsic Time --\n{}", analysis); + } + if let Some(analysis) = Analysis::median_slopes(&batch.results, BenchmarkSelector::Reads) { + println!("Reads = {:?}", analysis); + } + if let Some(analysis) = Analysis::median_slopes(&batch.results, BenchmarkSelector::Writes) { + println!("Writes = {:?}", analysis); } } if !self.no_min_squares { - if let Some(analysis) = Analysis::min_squares_iqr(&batch.results) { - println!("Min Squares Analysis\n========\n{}", analysis); + println!("Min Squares Analysis\n========"); + if let Some(analysis) = Analysis::min_squares_iqr(&batch.results, BenchmarkSelector::ExtrinsicTime) { + println!("-- Extrinsic Time --\n{}", analysis); + } + if let Some(analysis) = Analysis::min_squares_iqr(&batch.results, BenchmarkSelector::Reads) { + println!("Reads = {:?}", analysis); + } + if let Some(analysis) = Analysis::min_squares_iqr(&batch.results, BenchmarkSelector::Writes) { + println!("Writes = {:?}", analysis); } } }, -- GitLab From efab94e606293b329726c834456cd7f00e54bc41 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 25 Jun 2020 10:19:05 +0200 Subject: [PATCH 241/280] Update CODEOWNERS (#6489) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update CODEOWNERS * Cleanup CODEOWNERS * Remove myself as a code owner I don’t work on consensus anymore. * Update CODEOWNERS Co-authored-by: Sergei Shulepov Co-authored-by: Demi M. Obenour Co-authored-by: Nikolay Volf --- docs/CODEOWNERS | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS index 2e1557b4ea..2fb85a4ba1 100644 --- a/docs/CODEOWNERS +++ b/docs/CODEOWNERS @@ -18,15 +18,7 @@ # are more recognizable on GitHub, you can use them for mentioning unlike an email. # - The latest matching rule, if multiple, takes precedence. -# Wasm execution and the wasm side of Substrate Runtime Interface -/client/executor/ @pepyakin -/primitives/io/ @pepyakin @NikVolf - -# Crypto, execution extensions, etc. -/primitives/core/ @NikVolf - # Block production -/primitives/authorship/ @NikVolf /client/basic-authorship/ @NikVolf # Sandboxing capability of Substrate Runtime @@ -48,22 +40,21 @@ /primitives/rpc/ @tomusdrw # GRANDPA, BABE, consensus stuff -/frame/babe/ @andresilva @DemiMarie-parity +/frame/babe/ @andresilva /frame/grandpa/ @andresilva /client/finality-grandpa/ @andresilva -/client/consensus/babe/ @andresilva @DemiMarie-parity -/client/consensus/slots/ @andresilva @DemiMarie-parity +/client/consensus/babe/ @andresilva +/client/consensus/slots/ @andresilva /client/consensus/pow/ @sorpaas /primitives/consensus/pow/ @sorpaas # Contracts /frame/contracts/ @pepyakin -/frame/contracts/src/wasm/runtime.rs @Robbepop # EVM /frame/evm/ @sorpaas -# NPoS and Governance and Phragmén +# NPoS and election /frame/staking/ @kianenigma /frame/elections/ @kianenigma /frame/elections-phragmen/ @kianenigma @@ -72,14 +63,8 @@ # Fixed point arithmetic /primitives/sp-arithmetic/ @kianenigma -# End to end testing of substrate node -/bin/node/executor/ @kianenigma - # Transaction weight stuff -/frame/support/src/weights.rs @kianenigma - -# Support crates -/frame/support/ @kianenigma +/frame/support/src/weights.rs @shawntabrizi # Authority discovery /client/authority-discovery/ @mxinden -- GitLab From 9f51ec74b2114c09ca86c4417644be39c5c53895 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 25 Jun 2020 10:22:30 +0200 Subject: [PATCH 242/280] Panic on invalid unsigned election solution. (#6485) * Panic on invalid * Fix return * Fix refund --- frame/staking/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index de61b25483..15bdbfc9d2 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -2194,18 +2194,20 @@ decl_module! { size: ElectionSize, ) -> DispatchResultWithPostInfo { ensure_none(origin)?; - Self::check_and_replace_solution( + let adjustments = Self::check_and_replace_solution( winners, compact, ElectionCompute::Unsigned, score, era, size, - ) - // TODO: instead of returning an error, panic. This makes the entire produced block - // invalid. - // This ensures that block authors will not ever try and submit a solution which is not - // an improvement, since they will lose their authoring points/rewards. + ).expect( + "An unsigned solution can only be submitted by validators; A validator should \ + always produce correct solutions, else this block should not be imported, thus \ + effectively depriving the validators from their authoring reward. Hence, this panic + is expected." + ); + Ok(adjustments) } } } -- GitLab From 73318f426dc392352060c59e4b896eaae2af58ac Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 25 Jun 2020 10:48:30 +0200 Subject: [PATCH 243/280] Import hex_literal into runtime only for benchmarks. (#6502) --- bin/node/runtime/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 3614e4ca0d..6db4057e8c 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -18,7 +18,7 @@ codec = { package = "parity-scale-codec", version = "1.3.1", default-features = integer-sqrt = { version = "0.1.2" } serde = { version = "1.0.102", optional = true } static_assertions = "1.1.0" -hex-literal = "0.2.1" +hex-literal = { version = "0.2.1", optional = true } # primitives sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/authority-discovery" } @@ -168,4 +168,5 @@ runtime-benchmarks = [ "pallet-offences-benchmarking", "pallet-session-benchmarking", "frame-system-benchmarking", + "hex-literal", ] -- GitLab From 41014434bb40482d62fbbbef066438983d55183c Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 25 Jun 2020 11:25:28 +0200 Subject: [PATCH 244/280] .maintain/sentry-node: Remove UI and update Prometheus target (#6473) Remove burden on user to build polkadot-js apps Docker image locally in order to get started. Update Prometheus config fixing target name. --- .maintain/sentry-node/docker-compose.yml | 5 ----- .maintain/sentry-node/prometheus/prometheus.yml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.maintain/sentry-node/docker-compose.yml b/.maintain/sentry-node/docker-compose.yml index 235f2c4963..2af9449853 100644 --- a/.maintain/sentry-node/docker-compose.yml +++ b/.maintain/sentry-node/docker-compose.yml @@ -131,11 +131,6 @@ services: - "sub-authority-discovery=trace" - "--prometheus-external" - ui: - image: polkadot-js/apps - ports: - - "3000:80" - prometheus: image: prom/prometheus networks: diff --git a/.maintain/sentry-node/prometheus/prometheus.yml b/.maintain/sentry-node/prometheus/prometheus.yml index 831b84ba0b..547d4bea57 100644 --- a/.maintain/sentry-node/prometheus/prometheus.yml +++ b/.maintain/sentry-node/prometheus/prometheus.yml @@ -2,7 +2,7 @@ global: scrape_interval: 15s scrape_configs: - - job_name: 'substrate_validator-a' + - job_name: 'substrate-nodes' static_configs: - targets: ['validator-a:9615'] labels: -- GitLab From a2a2776b46001c6ec154262f008136379af70818 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 25 Jun 2020 11:27:37 +0200 Subject: [PATCH 245/280] Staking Payout Creates Controller (#6496) * payout creates controller * update benchmarks * oops * fix session benchmarks * Update weights * fix line width --- frame/session/benchmarking/src/lib.rs | 4 ++-- frame/staking/src/benchmarking.rs | 32 ++++++++++++++++++++++++--- frame/staking/src/lib.rs | 8 ++++--- frame/staking/src/testing_utils.rs | 15 +++++++++++++ frame/staking/src/tests.rs | 30 +++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/frame/session/benchmarking/src/lib.rs b/frame/session/benchmarking/src/lib.rs index 04b7d55602..0df4dcfbd9 100644 --- a/frame/session/benchmarking/src/lib.rs +++ b/frame/session/benchmarking/src/lib.rs @@ -45,7 +45,7 @@ benchmarks! { set_keys { let n in 1 .. MAX_NOMINATIONS as u32; - let v_stash = create_validator_with_nominators::(n, MAX_NOMINATIONS as u32)?; + let v_stash = create_validator_with_nominators::(n, MAX_NOMINATIONS as u32, false)?; let v_controller = pallet_staking::Module::::bonded(&v_stash).ok_or("not stash")?; let keys = T::Keys::default(); let proof: Vec = vec![0,1,2,3]; @@ -53,7 +53,7 @@ benchmarks! { purge_keys { let n in 1 .. MAX_NOMINATIONS as u32; - let v_stash = create_validator_with_nominators::(n, MAX_NOMINATIONS as u32)?; + let v_stash = create_validator_with_nominators::(n, MAX_NOMINATIONS as u32, false)?; let v_controller = pallet_staking::Module::::bonded(&v_stash).ok_or("not stash")?; let keys = T::Keys::default(); let proof: Vec = vec![0,1,2,3]; diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index 1dfa621033..b2035c22b6 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -47,7 +47,11 @@ fn add_slashing_spans(who: &T::AccountId, spans: u32) { // This function generates one validator being nominated by n nominators, and returns the validator // stash account. It also starts an era and creates pending payouts. -pub fn create_validator_with_nominators(n: u32, upper_bound: u32) -> Result { +pub fn create_validator_with_nominators( + n: u32, + upper_bound: u32, + dead: bool, +) -> Result { let mut points_total = 0; let mut points_individual = Vec::new(); @@ -65,7 +69,11 @@ pub fn create_validator_with_nominators(n: u32, upper_bound: u32) -> R // Give the validator n nominators, but keep total users in the system the same. for i in 0 .. upper_bound { - let (_n_stash, n_controller) = create_stash_controller::(u32::max_value() - i, 100)?; + let (_n_stash, n_controller) = if !dead { + create_stash_controller::(u32::max_value() - i, 100)? + } else { + create_stash_and_dead_controller::(u32::max_value() - i, 100)? + }; if i < n { Staking::::nominate(RawOrigin::Signed(n_controller.clone()).into(), vec![stash_lookup.clone()])?; } @@ -271,7 +279,8 @@ benchmarks! { payout_stakers { let n in 1 .. T::MaxNominatorRewardedPerValidator::get() as u32; - let validator = create_validator_with_nominators::(n, T::MaxNominatorRewardedPerValidator::get() as u32)?; + let validator = create_validator_with_nominators::(n, T::MaxNominatorRewardedPerValidator::get() as u32, true)?; + let current_era = CurrentEra::get().unwrap(); let caller = account("caller", 0, SEED); let balance_before = T::Currency::free_balance(&validator); @@ -282,6 +291,20 @@ benchmarks! { assert!(balance_before < balance_after); } + payout_stakers_alive_controller { + let n in 1 .. T::MaxNominatorRewardedPerValidator::get() as u32; + let validator = create_validator_with_nominators::(n, T::MaxNominatorRewardedPerValidator::get() as u32, false)?; + + let current_era = CurrentEra::get().unwrap(); + let caller = account("caller", 0, SEED); + let balance_before = T::Currency::free_balance(&validator); + }: payout_stakers(RawOrigin::Signed(caller), validator.clone(), current_era) + verify { + // Validator has been paid! + let balance_after = T::Currency::free_balance(&validator); + assert!(balance_before < balance_after); + } + rebond { let l in 1 .. MAX_UNLOCKING_CHUNKS as u32; let (_, controller) = create_stash_controller::(u, 100)?; @@ -630,6 +653,7 @@ mod tests { let validator_stash = create_validator_with_nominators::( n, ::MaxNominatorRewardedPerValidator::get() as u32, + false, ).unwrap(); let current_era = CurrentEra::get().unwrap(); @@ -650,6 +674,7 @@ mod tests { let validator_stash = create_validator_with_nominators::( n, ::MaxNominatorRewardedPerValidator::get() as u32, + false, ).unwrap(); // Add 20 slashing spans @@ -710,6 +735,7 @@ mod tests { assert_ok!(test_benchmark_force_unstake::()); assert_ok!(test_benchmark_cancel_deferred_slash::()); assert_ok!(test_benchmark_payout_stakers::()); + assert_ok!(test_benchmark_payout_stakers_alive_controller::()); assert_ok!(test_benchmark_rebond::()); assert_ok!(test_benchmark_set_history_depth::()); assert_ok!(test_benchmark_reap_stash::()); diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 15bdbfc9d2..029934d982 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1978,7 +1978,9 @@ decl_module! { /// - Contains a limited number of reads and writes. /// ----------- /// N is the Number of payouts for the validator (including the validator) - /// Base Weight: 110 + 54.2 * N µs (Median Slopes) + /// Base Weight: + /// - Reward Destination Staked: 110 + 54.2 * N µs (Median Slopes) + /// - Reward Destination Controller (Creating): 120 + 41.95 * N µs (Median Slopes) /// DB Weight: /// - Read: EraElectionStatus, CurrentEra, HistoryDepth, ErasValidatorReward, /// ErasStakersClipped, ErasRewardPoints, ErasValidatorPrefs (8 items) @@ -1986,7 +1988,7 @@ decl_module! { /// - Write Each: System Account, Locks, Ledger (3 items) /// # #[weight = - 110 * WEIGHT_PER_MICROS + 120 * WEIGHT_PER_MICROS + 54 * WEIGHT_PER_MICROS * Weight::from(T::MaxNominatorRewardedPerValidator::get()) + T::DbWeight::get().reads(7) + T::DbWeight::get().reads(5) * Weight::from(T::MaxNominatorRewardedPerValidator::get() + 1) @@ -2395,7 +2397,7 @@ impl Module { match dest { RewardDestination::Controller => Self::bonded(stash) .and_then(|controller| - T::Currency::deposit_into_existing(&controller, amount).ok() + Some(T::Currency::deposit_creating(&controller, amount)) ), RewardDestination::Stash => T::Currency::deposit_into_existing(stash, amount).ok(), diff --git a/frame/staking/src/testing_utils.rs b/frame/staking/src/testing_utils.rs index a73073bb1f..27a2575eb0 100644 --- a/frame/staking/src/testing_utils.rs +++ b/frame/staking/src/testing_utils.rs @@ -51,6 +51,21 @@ pub fn create_stash_controller(n: u32, balance_factor: u32) return Ok((stash, controller)) } +/// Create a stash and controller pair, where the controller is dead, and payouts go to controller. +/// This is used to test worst case payout scenarios. +pub fn create_stash_and_dead_controller(n: u32, balance_factor: u32) + -> Result<(T::AccountId, T::AccountId), &'static str> +{ + let stash = create_funded_user::("stash", n, balance_factor); + // controller has no funds + let controller = create_funded_user::("controller", n, 0); + let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); + let reward_destination = RewardDestination::Controller; + let amount = T::Currency::minimum_balance() * (balance_factor / 10).max(1).into(); + Staking::::bond(RawOrigin::Signed(stash.clone()).into(), controller_lookup, amount, reward_destination)?; + return Ok((stash, controller)) +} + /// create `max` validators. pub fn create_validators( max: u32, diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index eeac2c5c90..a3cfed9e2f 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -4501,3 +4501,33 @@ fn on_initialize_weight_is_correct() { assert_eq!(final_weight, Staking::on_initialize(System::block_number())); }); } + + +#[test] +fn payout_creates_controller() { + // Here we will test validator can set `max_nominators_payout` and it works. + // We also test that `payout_extra_nominators` works. + ExtBuilder::default().has_stakers(false).build_and_execute(|| { + let balance = 1000; + // Create three validators: + bond_validator(11, 10, balance); // Default(64) + + // Create a stash/controller pair + bond_nominator(1234, 1337, 100, vec![11]); + + // kill controller + assert_ok!(Balances::transfer(Origin::signed(1337), 1234, 100)); + assert_eq!(Balances::free_balance(1337), 0); + + mock::start_era(1); + Staking::reward_by_ids(vec![(11, 1)]); + // Compute total payout now for whole duration as other parameter won't change + let total_payout_0 = current_total_payout_for_duration(3 * 1000); + assert!(total_payout_0 > 100); // Test is meaningful if reward something + mock::start_era(2); + assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 1)); + + // Controller is created + assert!(Balances::free_balance(1337) > 0); + }) +} -- GitLab From 482c1bc741b775e87504d68f3ce4bdde55a7aca3 Mon Sep 17 00:00:00 2001 From: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com> Date: Thu, 25 Jun 2020 11:30:01 +0200 Subject: [PATCH 246/280] Include genesis hash in system.connected (#6498) * feat: Include genesis hash in system.connected message for telemetry * chore: Spread call arguments into multiline * chore: Removed commented code --- client/service/src/builder.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index eebc825b21..1fbf301f5b 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -46,7 +46,7 @@ use sc_network::NetworkService; use parking_lot::{Mutex, RwLock}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{ - Block as BlockT, NumberFor, SaturatedConversion, HashFor, + Block as BlockT, NumberFor, SaturatedConversion, HashFor, Zero, }; use sp_api::ProvideRuntimeApi; use sc_executor::{NativeExecutor, NativeExecutionDispatch, RuntimeInfo}; @@ -1070,8 +1070,17 @@ ServiceBuilder< // Telemetry let telemetry = config.telemetry_endpoints.clone().map(|endpoints| { + let genesis_hash = match client.block_hash(Zero::zero()) { + Ok(Some(hash)) => hash, + _ => Default::default(), + }; + let (telemetry, future) = build_telemetry( - &mut config, endpoints, telemetry_connection_sinks.clone(), network.clone() + &mut config, + endpoints, + telemetry_connection_sinks.clone(), + network.clone(), + genesis_hash, ); spawn_handle.spawn( @@ -1270,7 +1279,8 @@ fn build_telemetry( config: &mut Configuration, endpoints: sc_telemetry::TelemetryEndpoints, telemetry_connection_sinks: Arc>>>, - network: Arc::Hash>> + network: Arc::Hash>>, + genesis_hash: ::Hash, ) -> (sc_telemetry::Telemetry, Pin + Send>>) { let is_authority = config.role.is_authority(); let network_id = network.local_peer_id().to_base58(); @@ -1296,6 +1306,7 @@ fn build_telemetry( "version" => version, "config" => "", "chain" => chain_name.clone(), + "genesis_hash" => ?genesis_hash, "authority" => is_authority, "startup_time" => startup_time, "network_id" => network_id.clone() -- GitLab From 4be954a8463e6f33e0ec854c4b8bcd940af260fc Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Thu, 25 Jun 2020 11:30:20 +0200 Subject: [PATCH 247/280] Bound Unsigned when signed is not supported. (#6367) * bound unsigned when necessary * convert more type to AtLeast32BitUnsigned * Update primitives/arithmetic/src/traits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * doc refactor * line reorganize Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- frame/assets/src/lib.rs | 4 +- frame/balances/src/lib.rs | 6 +-- frame/generic-asset/src/lib.rs | 25 +++------- frame/im-online/src/lib.rs | 4 +- frame/staking/src/inflation.rs | 4 +- frame/staking/src/lib.rs | 8 +-- frame/support/src/traits.rs | 7 +-- frame/support/src/weights.rs | 6 +-- frame/system/src/lib.rs | 7 +-- frame/vesting/src/lib.rs | 6 +-- primitives/arithmetic/src/per_things.rs | 50 ++++++++++++------- primitives/arithmetic/src/traits.rs | 5 ++ primitives/runtime/src/curve.rs | 6 +-- primitives/runtime/src/generic/header.rs | 7 +-- .../runtime/src/offchain/storage_lock.rs | 4 +- primitives/runtime/src/traits.rs | 9 ++-- 16 files changed, 84 insertions(+), 74 deletions(-) diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index d428f435b6..159546ccb3 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -134,7 +134,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use frame_support::{Parameter, decl_module, decl_event, decl_storage, decl_error, ensure}; -use sp_runtime::traits::{Member, AtLeast32Bit, Zero, StaticLookup}; +use sp_runtime::traits::{Member, AtLeast32Bit, AtLeast32BitUnsigned, Zero, StaticLookup}; use frame_system::{self as system, ensure_signed}; use sp_runtime::traits::One; @@ -144,7 +144,7 @@ pub trait Trait: frame_system::Trait { type Event: From> + Into<::Event>; /// The units in which we record balances. - type Balance: Member + Parameter + AtLeast32Bit + Default + Copy; + type Balance: Member + Parameter + AtLeast32BitUnsigned + Default + Copy; /// The arithmetic type of asset identifier. type AssetId: Parameter + AtLeast32Bit + Default + Copy; diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index f7ccb86e60..62402c7863 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -170,7 +170,7 @@ use frame_support::{ use sp_runtime::{ RuntimeDebug, DispatchResult, DispatchError, traits::{ - Zero, AtLeast32Bit, StaticLookup, Member, CheckedAdd, CheckedSub, + Zero, AtLeast32BitUnsigned, StaticLookup, Member, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Saturating, Bounded, }, }; @@ -180,7 +180,7 @@ pub use self::imbalances::{PositiveImbalance, NegativeImbalance}; pub trait Subtrait: frame_system::Trait { /// The balance of an account. - type Balance: Parameter + Member + AtLeast32Bit + Codec + Default + Copy + + type Balance: Parameter + Member + AtLeast32BitUnsigned + Codec + Default + Copy + MaybeSerializeDeserialize + Debug; /// The minimum amount required to keep an account open. @@ -192,7 +192,7 @@ pub trait Subtrait: frame_system::Trait { pub trait Trait: frame_system::Trait { /// The balance of an account. - type Balance: Parameter + Member + AtLeast32Bit + Codec + Default + Copy + + type Balance: Parameter + Member + AtLeast32BitUnsigned + Codec + Default + Copy + MaybeSerializeDeserialize + Debug; /// Handler for the unbalanced reduction when removing a dust account. diff --git a/frame/generic-asset/src/lib.rs b/frame/generic-asset/src/lib.rs index 403d9f8444..7d24f89d70 100644 --- a/frame/generic-asset/src/lib.rs +++ b/frame/generic-asset/src/lib.rs @@ -157,7 +157,7 @@ use codec::{Decode, Encode, HasCompact, Input, Output, Error as CodecError}; use sp_runtime::{RuntimeDebug, DispatchResult, DispatchError}; use sp_runtime::traits::{ CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, One, Saturating, AtLeast32Bit, - Zero, Bounded, + Zero, Bounded, AtLeast32BitUnsigned }; use sp_std::prelude::*; @@ -165,8 +165,9 @@ use sp_std::{cmp, result, fmt::Debug}; use frame_support::{ decl_event, decl_module, decl_storage, ensure, decl_error, traits::{ - Currency, ExistenceRequirement, Imbalance, LockIdentifier, LockableCurrency, ReservableCurrency, - SignedImbalance, WithdrawReason, WithdrawReasons, TryDrop, BalanceStatus, + Currency, ExistenceRequirement, Imbalance, LockIdentifier, LockableCurrency, + ReservableCurrency, SignedImbalance, WithdrawReason, WithdrawReasons, TryDrop, + BalanceStatus, }, Parameter, StorageMap, }; @@ -178,25 +179,15 @@ mod tests; pub use self::imbalances::{NegativeImbalance, PositiveImbalance}; pub trait Trait: frame_system::Trait { - type Balance: Parameter - + Member - + AtLeast32Bit - + Default - + Copy - + MaybeSerializeDeserialize - + Debug; + type Balance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + Debug + + MaybeSerializeDeserialize; type AssetId: Parameter + Member + AtLeast32Bit + Default + Copy; type Event: From> + Into<::Event>; } pub trait Subtrait: frame_system::Trait { - type Balance: Parameter - + Member - + AtLeast32Bit - + Default - + Copy - + MaybeSerializeDeserialize - + Debug; + type Balance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + Debug + + MaybeSerializeDeserialize; type AssetId: Parameter + Member + AtLeast32Bit + Default + Copy; } diff --git a/frame/im-online/src/lib.rs b/frame/im-online/src/lib.rs index c1c93910ec..ddbbb52bd2 100644 --- a/frame/im-online/src/lib.rs +++ b/frame/im-online/src/lib.rs @@ -82,7 +82,7 @@ use pallet_session::historical::IdentificationTuple; use sp_runtime::{ offchain::storage::StorageValueRef, RuntimeDebug, - traits::{Convert, Member, Saturating, AtLeast32Bit}, Perbill, + traits::{Convert, Member, Saturating, AtLeast32BitUnsigned}, Perbill, transaction_validity::{ TransactionValidity, ValidTransaction, InvalidTransaction, TransactionSource, TransactionPriority, @@ -160,7 +160,7 @@ struct HeartbeatStatus { pub sent_at: BlockNumber, } -impl HeartbeatStatus { +impl HeartbeatStatus { /// Returns true if heartbeat has been recently sent. /// /// Parameters: diff --git a/frame/staking/src/inflation.rs b/frame/staking/src/inflation.rs index 04bfc98357..2161fe20af 100644 --- a/frame/staking/src/inflation.rs +++ b/frame/staking/src/inflation.rs @@ -20,7 +20,7 @@ //! The staking rate in NPoS is the total amount of tokens staked by nominators and validators, //! divided by the total token supply. -use sp_runtime::{Perbill, traits::AtLeast32Bit, curve::PiecewiseLinear}; +use sp_runtime::{Perbill, traits::AtLeast32BitUnsigned, curve::PiecewiseLinear}; /// The total payout to all validators (and their nominators) per era and maximum payout. /// @@ -34,7 +34,7 @@ pub fn compute_total_payout( npos_token_staked: N, total_tokens: N, era_duration: u64 -) -> (N, N) where N: AtLeast32Bit + Clone { +) -> (N, N) where N: AtLeast32BitUnsigned + Clone { // Milliseconds per year for the Julian year (365.25 days). const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 029934d982..fdf3460433 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -306,8 +306,8 @@ use sp_runtime::{ Percent, Perbill, PerU16, PerThing, RuntimeDebug, DispatchError, curve::PiecewiseLinear, traits::{ - Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, AtLeast32Bit, - Dispatchable, + Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, + AtLeast32BitUnsigned, Dispatchable, }, transaction_validity::{ TransactionValidityError, TransactionValidity, ValidTransaction, InvalidTransaction, @@ -493,7 +493,7 @@ pub struct StakingLedger { impl< AccountId, - Balance: HasCompact + Copy + Saturating + AtLeast32Bit, + Balance: HasCompact + Copy + Saturating + AtLeast32BitUnsigned, > StakingLedger { /// Remove entries from `unlocking` that are sufficiently old and reduce the /// total by the sum of their balances. @@ -544,7 +544,7 @@ impl< } impl StakingLedger where - Balance: AtLeast32Bit + Saturating + Copy, + Balance: AtLeast32BitUnsigned + Saturating + Copy, { /// Slash the validator for a given amount of balance. This can grow the value /// of the slash in the case that the validator has less than `minimum_balance` diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index 625f216b1b..f25ff67efb 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -25,7 +25,7 @@ use sp_core::u32_trait::Value as U32; use sp_runtime::{ RuntimeDebug, ConsensusEngineId, DispatchResult, DispatchError, traits::{ MaybeSerializeDeserialize, AtLeast32Bit, Saturating, TrailingZeroInput, Bounded, Zero, - BadOrigin + BadOrigin, AtLeast32BitUnsigned }, }; use crate::dispatch::Parameter; @@ -788,7 +788,7 @@ pub enum SignedImbalance>{ impl< P: Imbalance, N: Imbalance, - B: AtLeast32Bit + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default, + B: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default, > SignedImbalance { pub fn zero() -> Self { SignedImbalance::Positive(P::zero()) @@ -851,7 +851,8 @@ impl< /// Abstraction over a fungible assets system. pub trait Currency { /// The balance of an account. - type Balance: AtLeast32Bit + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default; + type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + + Default; /// The opaque token type for an imbalance. This is returned by unbalanced operations /// and must be dealt with. It may be dropped but cannot be cloned. diff --git a/frame/support/src/weights.rs b/frame/support/src/weights.rs index 810bd2fcb6..f614bc4706 100644 --- a/frame/support/src/weights.rs +++ b/frame/support/src/weights.rs @@ -136,7 +136,7 @@ use sp_runtime::{ }; use crate::dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, DispatchError}; use sp_runtime::traits::SaturatedConversion; -use sp_arithmetic::{Perbill, traits::{BaseArithmetic, Saturating}}; +use sp_arithmetic::{Perbill, traits::{BaseArithmetic, Saturating, Unsigned}}; use smallvec::{smallvec, SmallVec}; /// Re-export priority as type @@ -571,7 +571,7 @@ pub type WeightToFeeCoefficients = SmallVec<[WeightToFeeCoefficient; 4]>; /// An implementor should only implement the `polynomial` function. pub trait WeightToFeePolynomial { /// The type that is returned as result from polynomial evaluation. - type Balance: BaseArithmetic + From + Copy; + type Balance: BaseArithmetic + From + Copy + Unsigned; /// Returns a polynomial that describes the weight to fee conversion. /// @@ -611,7 +611,7 @@ pub trait WeightToFeePolynomial { pub struct IdentityFee(sp_std::marker::PhantomData); impl WeightToFeePolynomial for IdentityFee where - T: BaseArithmetic + From + Copy + T: BaseArithmetic + From + Copy + Unsigned { type Balance = T; diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 18723fff29..dc103b204d 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -107,7 +107,7 @@ use sp_runtime::{ self, CheckEqual, AtLeast32Bit, Zero, Lookup, LookupError, SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded, - Dispatchable, + Dispatchable, AtLeast32BitUnsigned }, offchain::storage_lock::BlockNumberProvider, }; @@ -181,8 +181,9 @@ pub trait Trait: 'static + Eq + Clone { /// The block number type used by the runtime. type BlockNumber: - Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + AtLeast32Bit - + Default + Bounded + Copy + sp_std::hash::Hash + sp_std::str::FromStr + MaybeMallocSizeOf; + Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + + AtLeast32BitUnsigned + Default + Bounded + Copy + sp_std::hash::Hash + + sp_std::str::FromStr + MaybeMallocSizeOf; /// The output of the `Hashing` function. type Hash: diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index 8308c84f91..5e11c8af95 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -51,7 +51,7 @@ use sp_std::prelude::*; use sp_std::fmt::Debug; use codec::{Encode, Decode}; use sp_runtime::{DispatchResult, RuntimeDebug, traits::{ - StaticLookup, Zero, AtLeast32Bit, MaybeSerializeDeserialize, Convert + StaticLookup, Zero, AtLeast32BitUnsigned, MaybeSerializeDeserialize, Convert }}; use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure}; use frame_support::traits::{ @@ -92,8 +92,8 @@ pub struct VestingInfo { } impl< - Balance: AtLeast32Bit + Copy, - BlockNumber: AtLeast32Bit + Copy, + Balance: AtLeast32BitUnsigned + Copy, + BlockNumber: AtLeast32BitUnsigned + Copy, > VestingInfo { /// Amount locked at block `n`. pub fn locked_at< diff --git a/primitives/arithmetic/src/per_things.rs b/primitives/arithmetic/src/per_things.rs index 521f4d1074..f809358446 100644 --- a/primitives/arithmetic/src/per_things.rs +++ b/primitives/arithmetic/src/per_things.rs @@ -94,7 +94,7 @@ pub trait PerThing: /// ``` fn mul_floor(self, b: N) -> N where N: Clone + From + UniqueSaturatedInto + ops::Rem + - ops::Div + ops::Mul + ops::Add + ops::Div + ops::Mul + ops::Add + Unsigned { overflow_prune_mul::(b, self.deconstruct(), Rounding::Down) } @@ -116,7 +116,7 @@ pub trait PerThing: /// ``` fn mul_ceil(self, b: N) -> N where N: Clone + From + UniqueSaturatedInto + ops::Rem + - ops::Div + ops::Mul + ops::Add + ops::Div + ops::Mul + ops::Add + Unsigned { overflow_prune_mul::(b, self.deconstruct(), Rounding::Up) } @@ -132,7 +132,8 @@ pub trait PerThing: /// ``` fn saturating_reciprocal_mul(self, b: N) -> N where N: Clone + From + UniqueSaturatedInto + ops::Rem + - ops::Div + ops::Mul + ops::Add + Saturating + ops::Div + ops::Mul + ops::Add + Saturating + + Unsigned { saturating_reciprocal_mul::(b, self.deconstruct(), Rounding::Nearest) } @@ -151,7 +152,8 @@ pub trait PerThing: /// ``` fn saturating_reciprocal_mul_floor(self, b: N) -> N where N: Clone + From + UniqueSaturatedInto + ops::Rem + - ops::Div + ops::Mul + ops::Add + Saturating + ops::Div + ops::Mul + ops::Add + Saturating + + Unsigned { saturating_reciprocal_mul::(b, self.deconstruct(), Rounding::Down) } @@ -170,7 +172,8 @@ pub trait PerThing: /// ``` fn saturating_reciprocal_mul_ceil(self, b: N) -> N where N: Clone + From + UniqueSaturatedInto + ops::Rem + - ops::Div + ops::Mul + ops::Add + Saturating + ops::Div + ops::Mul + ops::Add + Saturating + + Unsigned { saturating_reciprocal_mul::(b, self.deconstruct(), Rounding::Up) } @@ -198,14 +201,14 @@ pub trait PerThing: /// # fn main () { /// // 989/100 is technically closer to 99%. /// assert_eq!( - /// Percent::from_rational_approximation(989, 1000), + /// Percent::from_rational_approximation(989u64, 1000), /// Percent::from_parts(98), /// ); /// # } /// ``` fn from_rational_approximation(p: N, q: N) -> Self where N: Clone + Ord + From + TryInto + TryInto + - ops::Div + ops::Rem + ops::Add; + ops::Div + ops::Rem + ops::Add + Unsigned; } /// The rounding method to use. @@ -227,7 +230,7 @@ fn saturating_reciprocal_mul( ) -> N where N: Clone + From + UniqueSaturatedInto + ops::Div + ops::Mul + ops::Add + ops::Rem + Saturating, + Output=N> + ops::Add + ops::Rem + Saturating + Unsigned, P: PerThing, { let maximum: N = P::ACCURACY.into(); @@ -248,7 +251,7 @@ fn overflow_prune_mul( ) -> N where N: Clone + From + UniqueSaturatedInto + ops::Div + ops::Mul + ops::Add + ops::Rem, + Output=N> + ops::Add + ops::Rem + Unsigned, P: PerThing, { let maximum: N = P::ACCURACY.into(); @@ -274,7 +277,7 @@ fn rational_mul_correction( ) -> N where N: From + UniqueSaturatedInto + ops::Div + ops::Mul + ops::Add + ops::Rem, + Output=N> + ops::Add + ops::Rem + Unsigned, P: PerThing, { let numer_upper = P::Upper::from(numer); @@ -335,14 +338,15 @@ macro_rules! implement_per_thing { /// Build this type from a number of parts per thing. fn from_parts(parts: Self::Inner) -> Self { Self(parts.min($max)) } + /// NOTE: saturate to 0 or 1 if x is beyond `[0, 1]` #[cfg(feature = "std")] fn from_fraction(x: f64) -> Self { - Self::from_parts((x * $max as f64) as Self::Inner) + Self::from_parts((x.max(0.).min(1.) * $max as f64) as Self::Inner) } fn from_rational_approximation(p: N, q: N) -> Self where N: Clone + Ord + From + TryInto + TryInto - + ops::Div + ops::Rem + ops::Add + + ops::Div + ops::Rem + ops::Add + Unsigned { let div_ceil = |x: N, f: N| -> N { let mut o = x.clone() / f.clone(); @@ -445,7 +449,8 @@ macro_rules! implement_per_thing { pub fn from_rational_approximation(p: N, q: N) -> Self where N: Clone + Ord + From<$type> + TryInto<$type> + TryInto<$upper_type> + ops::Div + ops::Rem + - ops::Add { + ops::Add + Unsigned + { ::from_rational_approximation(p, q) } @@ -453,7 +458,8 @@ macro_rules! implement_per_thing { pub fn mul_floor(self, b: N) -> N where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem + ops::Div + ops::Mul + - ops::Add { + ops::Add + Unsigned + { PerThing::mul_floor(self, b) } @@ -461,7 +467,8 @@ macro_rules! implement_per_thing { pub fn mul_ceil(self, b: N) -> N where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem + ops::Div + ops::Mul + - ops::Add { + ops::Add + Unsigned + { PerThing::mul_ceil(self, b) } @@ -469,7 +476,8 @@ macro_rules! implement_per_thing { pub fn saturating_reciprocal_mul(self, b: N) -> N where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem + ops::Div + ops::Mul + ops::Add + - Saturating { + Saturating + Unsigned + { PerThing::saturating_reciprocal_mul(self, b) } @@ -477,7 +485,8 @@ macro_rules! implement_per_thing { pub fn saturating_reciprocal_mul_floor(self, b: N) -> N where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem + ops::Div + ops::Mul + ops::Add + - Saturating { + Saturating + Unsigned + { PerThing::saturating_reciprocal_mul_floor(self, b) } @@ -485,7 +494,8 @@ macro_rules! implement_per_thing { pub fn saturating_reciprocal_mul_ceil(self, b: N) -> N where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem + ops::Div + ops::Mul + ops::Add + - Saturating { + Saturating + Unsigned + { PerThing::saturating_reciprocal_mul_ceil(self, b) } } @@ -585,7 +595,7 @@ macro_rules! implement_per_thing { impl ops::Mul for $name where N: Clone + From<$type> + UniqueSaturatedInto<$type> + ops::Rem - + ops::Div + ops::Mul + ops::Add, + + ops::Div + ops::Mul + ops::Add + Unsigned, { type Output = N; fn mul(self, b: N) -> Self::Output { @@ -684,6 +694,8 @@ macro_rules! implement_per_thing { assert_eq!($name::from_fraction(0.0), $name::from_parts(Zero::zero())); assert_eq!($name::from_fraction(0.1), $name::from_parts($max / 10)); assert_eq!($name::from_fraction(1.0), $name::from_parts($max)); + assert_eq!($name::from_fraction(2.0), $name::from_parts($max)); + assert_eq!($name::from_fraction(-1.0), $name::from_parts(Zero::zero())); } macro_rules! u256ify { diff --git a/primitives/arithmetic/src/traits.rs b/primitives/arithmetic/src/traits.rs index 29b8e419ef..ce645cfe65 100644 --- a/primitives/arithmetic/src/traits.rs +++ b/primitives/arithmetic/src/traits.rs @@ -79,6 +79,11 @@ pub trait AtLeast32Bit: BaseArithmetic + From + From {} impl + From> AtLeast32Bit for T {} +/// A meta trait for arithmetic. Same as [`AtLeast32Bit `], but also bounded to be unsigned. +pub trait AtLeast32BitUnsigned: AtLeast32Bit + Unsigned {} + +impl AtLeast32BitUnsigned for T {} + /// Just like `From` except that if the source value is too big to fit into the destination type /// then it'll saturate the destination. pub trait UniqueSaturatedFrom: Sized { diff --git a/primitives/runtime/src/curve.rs b/primitives/runtime/src/curve.rs index be47b566e9..27eb89a769 100644 --- a/primitives/runtime/src/curve.rs +++ b/primitives/runtime/src/curve.rs @@ -17,7 +17,7 @@ //! Provides some utilities to define a piecewise linear function. -use crate::{Perbill, traits::{AtLeast32Bit, SaturatedConversion}}; +use crate::{Perbill, traits::{AtLeast32BitUnsigned, SaturatedConversion}}; use core::ops::Sub; /// Piecewise Linear function in [0, 1] -> [0, 1]. @@ -36,7 +36,7 @@ fn abs_sub + Clone>(a: N, b: N) -> N where { impl<'a> PiecewiseLinear<'a> { /// Compute `f(n/d)*d` with `n <= d`. This is useful to avoid loss of precision. pub fn calculate_for_fraction_times_denominator(&self, n: N, d: N) -> N where - N: AtLeast32Bit + Clone + N: AtLeast32BitUnsigned + Clone { let n = n.min(d.clone()); @@ -80,7 +80,7 @@ impl<'a> PiecewiseLinear<'a> { // This is guaranteed not to overflow on whatever values nor lose precision. // `q` must be superior to zero. fn multiply_by_rational_saturating(value: N, p: u32, q: u32) -> N - where N: AtLeast32Bit + Clone + where N: AtLeast32BitUnsigned + Clone { let q = q.max(1); diff --git a/primitives/runtime/src/generic/header.rs b/primitives/runtime/src/generic/header.rs index 24cceef2cd..e6c800e578 100644 --- a/primitives/runtime/src/generic/header.rs +++ b/primitives/runtime/src/generic/header.rs @@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize}; use crate::codec::{Decode, Encode, Codec, Input, Output, HasCompact, EncodeAsRef, Error}; use crate::traits::{ - self, Member, AtLeast32Bit, SimpleBitOps, Hash as HashT, + self, Member, AtLeast32BitUnsigned, SimpleBitOps, Hash as HashT, MaybeSerializeDeserialize, MaybeSerialize, MaybeDisplay, MaybeMallocSizeOf, }; @@ -123,7 +123,7 @@ impl codec::EncodeLike for Header where impl traits::Header for Header where Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + MaybeDisplay + - AtLeast32Bit + Codec + Copy + Into + TryFrom + sp_std::str::FromStr + + AtLeast32BitUnsigned + Codec + Copy + Into + TryFrom + sp_std::str::FromStr + MaybeMallocSizeOf, Hash: HashT, Hash::Output: Default + sp_std::hash::Hash + Copy + Member + Ord + @@ -171,7 +171,8 @@ impl traits::Header for Header where } impl Header where - Number: Member + sp_std::hash::Hash + Copy + MaybeDisplay + AtLeast32Bit + Codec + Into + TryFrom, + Number: Member + sp_std::hash::Hash + Copy + MaybeDisplay + AtLeast32BitUnsigned + Codec + + Into + TryFrom, Hash: HashT, Hash::Output: Default + sp_std::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec, { diff --git a/primitives/runtime/src/offchain/storage_lock.rs b/primitives/runtime/src/offchain/storage_lock.rs index 4718d2e3dd..9d4e671db6 100644 --- a/primitives/runtime/src/offchain/storage_lock.rs +++ b/primitives/runtime/src/offchain/storage_lock.rs @@ -61,7 +61,7 @@ //! ``` use crate::offchain::storage::StorageValueRef; -use crate::traits::AtLeast32Bit; +use crate::traits::AtLeast32BitUnsigned; use codec::{Codec, Decode, Encode}; use sp_core::offchain::{Duration, Timestamp}; use sp_io::offchain; @@ -430,7 +430,7 @@ where /// used with [`BlockAndTime`](BlockAndTime). pub trait BlockNumberProvider { /// Type of `BlockNumber` to provide. - type BlockNumber: Codec + Clone + Ord + Eq + AtLeast32Bit; + type BlockNumber: Codec + Clone + Ord + Eq + AtLeast32BitUnsigned; /// Returns the current block number. /// /// Provides an abstraction over an arbitrary way of providing the diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index b1739269e6..4d2b1f062f 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -34,8 +34,8 @@ use crate::transaction_validity::{ }; use crate::generic::{Digest, DigestItem}; pub use sp_arithmetic::traits::{ - AtLeast32Bit, UniqueSaturatedInto, UniqueSaturatedFrom, Saturating, SaturatedConversion, - Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, + AtLeast32Bit, AtLeast32BitUnsigned, UniqueSaturatedInto, UniqueSaturatedFrom, Saturating, + SaturatedConversion, Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, CheckedShl, CheckedShr, IntegerSquareRoot }; use sp_application_crypto::AppKey; @@ -490,9 +490,8 @@ pub trait Header: MaybeMallocSizeOf + 'static { /// Header number. - type Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash - + Copy + MaybeDisplay + AtLeast32Bit + Codec + sp_std::str::FromStr - + MaybeMallocSizeOf; + type Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + Copy + + MaybeDisplay + AtLeast32BitUnsigned + Codec + sp_std::str::FromStr + MaybeMallocSizeOf; /// Header hash type type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> -- GitLab From a5f38dc479c0f0eaa84f2c44b56eac924b761343 Mon Sep 17 00:00:00 2001 From: Shaopeng Wang Date: Thu, 25 Jun 2020 21:33:47 +1200 Subject: [PATCH 248/280] Update stale docstring with 'EnsureOneOf' introduced. (#6501) * Update stale docstring with 'EnsureOneOf' introduced. * Apply review suggestions. --- frame/identity/src/lib.rs | 4 ++-- frame/membership/src/lib.rs | 12 ++++++++---- frame/nicks/src/lib.rs | 4 ++-- frame/scored-pool/src/lib.rs | 4 ++-- frame/staking/src/lib.rs | 2 +- frame/treasury/src/lib.rs | 6 +++++- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index d657e3d793..2768340403 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -622,7 +622,7 @@ decl_module! { /// Add a registrar to the system. /// - /// The dispatch origin for this call must be `RegistrarOrigin` or `Root`. + /// The dispatch origin for this call must be `T::RegistrarOrigin`. /// /// - `account`: the account of the registrar. /// @@ -1087,7 +1087,7 @@ decl_module! { /// `Slash`. Verification request deposits are not returned; they should be cancelled /// manually using `cancel_request`. /// - /// The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`. + /// The dispatch origin for this call must match `T::ForceOrigin`. /// /// - `target`: the account whose identity the judgement is upon. This must be an account /// with a registered identity. diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 62b1217c83..71b0902838 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -117,7 +117,7 @@ decl_module! { /// Add a member `who` to the set. /// - /// May only be called from `AddOrigin` or root. + /// May only be called from `T::AddOrigin`. #[weight = 50_000_000] pub fn add_member(origin, who: T::AccountId) { T::AddOrigin::ensure_origin(origin)?; @@ -134,7 +134,7 @@ decl_module! { /// Remove a member `who` from the set. /// - /// May only be called from `RemoveOrigin` or root. + /// May only be called from `T::RemoveOrigin`. #[weight = 50_000_000] pub fn remove_member(origin, who: T::AccountId) { T::RemoveOrigin::ensure_origin(origin)?; @@ -152,7 +152,7 @@ decl_module! { /// Swap out one member `remove` for another `add`. /// - /// May only be called from `SwapOrigin` or root. + /// May only be called from `T::SwapOrigin`. /// /// Prime membership is *not* passed from `remove` to `add`, if extant. #[weight = 50_000_000] @@ -181,7 +181,7 @@ decl_module! { /// Change the membership to a new set, disregarding the existing membership. Be nice and /// pass `members` pre-sorted. /// - /// May only be called from `ResetOrigin` or root. + /// May only be called from `T::ResetOrigin`. #[weight = 50_000_000] pub fn reset_members(origin, members: Vec) { T::ResetOrigin::ensure_origin(origin)?; @@ -231,6 +231,8 @@ decl_module! { } /// Set the prime member. Must be a current member. + /// + /// May only be called from `T::PrimeOrigin`. #[weight = 50_000_000] pub fn set_prime(origin, who: T::AccountId) { T::PrimeOrigin::ensure_origin(origin)?; @@ -240,6 +242,8 @@ decl_module! { } /// Remove the prime member if it exists. + /// + /// May only be called from `T::PrimeOrigin`. #[weight = 50_000_000] pub fn clear_prime(origin) { T::PrimeOrigin::ensure_origin(origin)?; diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 8a130da2ae..93c6081941 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -187,7 +187,7 @@ decl_module! { /// Fails if `who` has not been named. The deposit is dealt with through `T::Slashed` /// imbalance handler. /// - /// The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`. + /// The dispatch origin for this call must match `T::ForceOrigin`. /// /// # /// - O(1). @@ -213,7 +213,7 @@ decl_module! { /// /// No length checking is done on the name. /// - /// The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`. + /// The dispatch origin for this call must match `T::ForceOrigin`. /// /// # /// - O(1). diff --git a/frame/scored-pool/src/lib.rs b/frame/scored-pool/src/lib.rs index 5131a663e0..81ee92aeb4 100644 --- a/frame/scored-pool/src/lib.rs +++ b/frame/scored-pool/src/lib.rs @@ -308,7 +308,7 @@ decl_module! { /// Kick a member `who` from the set. /// - /// May only be called from `KickOrigin` or root. + /// May only be called from `T::KickOrigin`. /// /// The `index` parameter of this function must be set to /// the index of `dest` in the `Pool`. @@ -331,7 +331,7 @@ decl_module! { /// Score a member `who` with `score`. /// - /// May only be called from `ScoreOrigin` or root. + /// May only be called from `T::ScoreOrigin`. /// /// The `index` parameter of this function must be set to /// the index of the `dest` in the `Pool`. diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index fdf3460433..2a6e5b1a2d 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1928,7 +1928,7 @@ decl_module! { /// Cancel enactment of a deferred slash. /// - /// Can be called by either the root origin or the `T::SlashCancelOrigin`. + /// Can be called by the `T::SlashCancelOrigin`. /// /// Parameters: era and indices of the slashes for that era to kill. /// diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index 861a652e52..e67ace5475 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -316,7 +316,7 @@ decl_module! { /// The amount held on deposit per byte within the tip report reason. const TipReportDepositPerByte: BalanceOf = T::TipReportDepositPerByte::get(); - + /// The treasury's module id, used for deriving its sovereign account ID. const ModuleId: ModuleId = T::ModuleId::get(); @@ -355,6 +355,8 @@ decl_module! { /// Reject a proposed spend. The original deposit will be slashed. /// + /// May only be called from `T::RejectOrigin`. + /// /// # /// - Complexity: O(1) /// - DbReads: `Proposals`, `rejected proposer account` @@ -375,6 +377,8 @@ decl_module! { /// Approve a proposal. At a later time, the proposal will be allocated to the beneficiary /// and the original deposit will be returned. /// + /// May only be called from `T::ApproveOrigin`. + /// /// # /// - Complexity: O(1). /// - DbReads: `Proposals`, `Approvals` -- GitLab From 95747db3f8e145d5ff644f81b732cb852417926a Mon Sep 17 00:00:00 2001 From: s3krit Date: Thu, 25 Jun 2020 11:56:45 +0200 Subject: [PATCH 249/280] Add auth-label-issues.yml (#6488) --- .github/workflows/auto-label-issues.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/auto-label-issues.yml diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml new file mode 100644 index 0000000000..ce0bad59d1 --- /dev/null +++ b/.github/workflows/auto-label-issues.yml @@ -0,0 +1,17 @@ +# If the author of the issues is not a contributor to the project, label +# the issue with 'Z0-unconfirmed' + +name: Label New Issues +on: + issues: + types: [opened] + +jobs: + label-new-issues: + runs-on: ubuntu-latest + steps: + - name: Label drafts + uses: andymckay/labeler@master + if: github.event.issue.author_association == "NONE" + with: + add-labels: 'Z0-unconfirmed' -- GitLab From b3fac7b265c2ccfc28afab68ee6b72f564aa6d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 25 Jun 2020 15:03:29 +0200 Subject: [PATCH 250/280] Remove /self from mandatory rpc reviews. (#6507) --- docs/CODEOWNERS | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS index 2fb85a4ba1..b86846aefe 100644 --- a/docs/CODEOWNERS +++ b/docs/CODEOWNERS @@ -33,12 +33,6 @@ /client/offchain/ @tomusdrw /primitives/offchain/ @tomusdrw -# Everything that has RPC in it -/bin/node/rpc/ @tomusdrw -/bin/node/rpc-client/ @tomusdrw -/client/rpc/ @tomusdrw -/primitives/rpc/ @tomusdrw - # GRANDPA, BABE, consensus stuff /frame/babe/ @andresilva /frame/grandpa/ @andresilva @@ -54,7 +48,7 @@ # EVM /frame/evm/ @sorpaas -# NPoS and election +# NPoS and election /frame/staking/ @kianenigma /frame/elections/ @kianenigma /frame/elections-phragmen/ @kianenigma -- GitLab From f5a5937b1413e6d8a59003e2d0fe6f6efb0f1d46 Mon Sep 17 00:00:00 2001 From: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> Date: Thu, 25 Jun 2020 17:46:18 +0200 Subject: [PATCH 251/280] Change contract fees to MILLICENTS (#6509) --- bin/node/runtime/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 8b6831b41e..e3c9c2b95f 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -572,10 +572,10 @@ impl pallet_treasury::Trait for Runtime { } parameter_types! { - pub const TombstoneDeposit: Balance = 1 * DOLLARS; - pub const RentByteFee: Balance = 1 * DOLLARS; - pub const RentDepositOffset: Balance = 1000 * DOLLARS; - pub const SurchargeReward: Balance = 150 * DOLLARS; + pub const TombstoneDeposit: Balance = 16 * MILLICENTS; + pub const RentByteFee: Balance = 4 * MILLICENTS; + pub const RentDepositOffset: Balance = 1000 * MILLICENTS; + pub const SurchargeReward: Balance = 150 * MILLICENTS; } impl pallet_contracts::Trait for Runtime { -- GitLab From a1877dcc13ccc695ed16fc4ff36b45113d6ff048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Thu, 25 Jun 2020 22:52:05 +0200 Subject: [PATCH 252/280] Re-enter runtime after resetting overlay from runtime (#6513) This still assumes that the client did not start any transactions before calling into runtime. This is the case for benchmarking as long as either NativeWhenPossible or AlwaysWasm exection strategy is chosen. Using any other will result in a panic. --- primitives/state-machine/src/ext.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index e25a08adb0..cd4f83661b 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -575,6 +575,9 @@ where ).expect(EXT_NOT_ALLOWED_TO_FAIL); self.backend.wipe().expect(EXT_NOT_ALLOWED_TO_FAIL); self.mark_dirty(); + self.overlay + .enter_runtime() + .expect("We have reset the overlay above, so we can not be in the runtime; qed"); } fn commit(&mut self) { @@ -593,6 +596,9 @@ where changes.main_storage_changes, ).expect(EXT_NOT_ALLOWED_TO_FAIL); self.mark_dirty(); + self.overlay + .enter_runtime() + .expect("We have reset the overlay above, so we can not be in the runtime; qed"); } fn read_write_count(&self) -> (u32, u32, u32, u32) { -- GitLab From 00768a1f21a579c478fe5d4f51e1fa71f7db9fd4 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Thu, 25 Jun 2020 23:18:43 +0200 Subject: [PATCH 253/280] =?UTF-8?q?Releasing=20rc4=20=E2=80=93=20Rhinocero?= =?UTF-8?q?s=20(#6515)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Martin Pugh --- .maintain/gitlab/generate_changelog.sh | 11 +- .maintain/gitlab/lib.sh | 2 +- Cargo.lock | 364 +++++++++--------- bin/node-template/node/Cargo.toml | 40 +- bin/node-template/pallets/template/Cargo.toml | 12 +- bin/node-template/runtime/Cargo.toml | 48 +-- bin/node/bench/Cargo.toml | 20 +- bin/node/browser-testing/Cargo.toml | 6 +- bin/node/cli/Cargo.toml | 118 +++--- bin/node/executor/Cargo.toml | 50 +-- bin/node/inspect/Cargo.toml | 14 +- bin/node/primitives/Cargo.toml | 12 +- bin/node/rpc-client/Cargo.toml | 6 +- bin/node/rpc/Cargo.toml | 42 +- bin/node/runtime/Cargo.toml | 116 +++--- bin/node/testing/Cargo.toml | 68 ++-- bin/utils/chain-spec-builder/Cargo.toml | 10 +- bin/utils/subkey/Cargo.toml | 20 +- client/api/Cargo.toml | 44 +-- client/authority-discovery/Cargo.toml | 24 +- client/basic-authorship/Cargo.toml | 30 +- client/block-builder/Cargo.toml | 20 +- client/chain-spec/Cargo.toml | 14 +- client/chain-spec/derive/Cargo.toml | 2 +- client/cli/Cargo.toml | 32 +- client/consensus/aura/Cargo.toml | 50 +-- client/consensus/babe/Cargo.toml | 58 +-- client/consensus/babe/rpc/Cargo.toml | 30 +- client/consensus/common/Cargo.toml | 10 +- client/consensus/epochs/Cargo.toml | 10 +- client/consensus/manual-seal/Cargo.toml | 26 +- client/consensus/pow/Cargo.toml | 24 +- client/consensus/slots/Cargo.toml | 24 +- client/consensus/uncles/Cargo.toml | 14 +- client/db/Cargo.toml | 28 +- client/executor/Cargo.toml | 40 +- client/executor/common/Cargo.toml | 12 +- client/executor/runtime-test/Cargo.toml | 14 +- client/executor/wasmi/Cargo.toml | 12 +- client/executor/wasmtime/Cargo.toml | 12 +- client/finality-grandpa/Cargo.toml | 56 +-- client/finality-grandpa/rpc/Cargo.toml | 6 +- client/informant/Cargo.toml | 10 +- client/keystore/Cargo.toml | 6 +- client/light/Cargo.toml | 2 +- client/network-gossip/Cargo.toml | 8 +- client/network/Cargo.toml | 32 +- client/network/test/Cargo.toml | 26 +- client/offchain/Cargo.toml | 26 +- client/peerset/Cargo.toml | 4 +- client/proposer-metrics/Cargo.toml | 4 +- client/rpc-api/Cargo.toml | 14 +- client/rpc-servers/Cargo.toml | 4 +- client/rpc/Cargo.toml | 44 +-- client/service/Cargo.toml | 70 ++-- client/service/test/Cargo.toml | 42 +- client/state-db/Cargo.toml | 6 +- client/telemetry/Cargo.toml | 2 +- client/tracing/Cargo.toml | 4 +- client/transaction-pool/Cargo.toml | 32 +- client/transaction-pool/graph/Cargo.toml | 14 +- docs/CHANGELOG.md | 54 +++ frame/assets/Cargo.toml | 14 +- frame/atomic-swap/Cargo.toml | 16 +- frame/aura/Cargo.toml | 26 +- frame/authority-discovery/Cargo.toml | 22 +- frame/authorship/Cargo.toml | 18 +- frame/babe/Cargo.toml | 30 +- frame/balances/Cargo.toml | 18 +- frame/benchmark/Cargo.toml | 14 +- frame/benchmarking/Cargo.toml | 16 +- frame/collective/Cargo.toml | 18 +- frame/contracts/Cargo.toml | 24 +- frame/contracts/common/Cargo.toml | 6 +- frame/contracts/rpc/Cargo.toml | 16 +- frame/contracts/rpc/runtime-api/Cargo.toml | 10 +- frame/democracy/Cargo.toml | 24 +- frame/elections-phragmen/Cargo.toml | 22 +- frame/elections/Cargo.toml | 16 +- frame/evm/Cargo.toml | 18 +- frame/example-offchain-worker/Cargo.toml | 14 +- frame/example/Cargo.toml | 18 +- frame/executive/Cargo.toml | 26 +- frame/finality-tracker/Cargo.toml | 18 +- frame/generic-asset/Cargo.toml | 14 +- frame/grandpa/Cargo.toml | 38 +- frame/identity/Cargo.toml | 18 +- frame/im-online/Cargo.toml | 24 +- frame/indices/Cargo.toml | 20 +- frame/membership/Cargo.toml | 14 +- frame/metadata/Cargo.toml | 6 +- frame/multisig/Cargo.toml | 20 +- frame/nicks/Cargo.toml | 16 +- frame/offences/Cargo.toml | 18 +- frame/offences/benchmarking/Cargo.toml | 36 +- frame/proxy/Cargo.toml | 22 +- frame/randomness-collective-flip/Cargo.toml | 14 +- frame/recovery/Cargo.toml | 16 +- frame/scheduler/Cargo.toml | 16 +- frame/scored-pool/Cargo.toml | 16 +- frame/session/Cargo.toml | 24 +- frame/session/benchmarking/Cargo.toml | 26 +- frame/society/Cargo.toml | 16 +- frame/staking/Cargo.toml | 38 +- frame/staking/fuzzer/Cargo.toml | 26 +- frame/staking/reward-curve/Cargo.toml | 4 +- frame/sudo/Cargo.toml | 14 +- frame/support/Cargo.toml | 24 +- frame/support/procedural/Cargo.toml | 4 +- frame/support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 16 +- frame/system/Cargo.toml | 18 +- frame/system/benchmarking/Cargo.toml | 16 +- frame/system/rpc/runtime-api/Cargo.toml | 4 +- frame/timestamp/Cargo.toml | 22 +- frame/transaction-payment/Cargo.toml | 20 +- frame/transaction-payment/rpc/Cargo.toml | 14 +- .../rpc/runtime-api/Cargo.toml | 10 +- frame/treasury/Cargo.toml | 18 +- frame/utility/Cargo.toml | 20 +- frame/vesting/Cargo.toml | 20 +- primitives/allocator/Cargo.toml | 8 +- primitives/api/Cargo.toml | 16 +- primitives/api/proc-macro/Cargo.toml | 2 +- primitives/api/test/Cargo.toml | 22 +- primitives/application-crypto/Cargo.toml | 8 +- primitives/application-crypto/test/Cargo.toml | 12 +- primitives/arithmetic/Cargo.toml | 6 +- primitives/arithmetic/fuzzer/Cargo.toml | 4 +- primitives/authority-discovery/Cargo.toml | 10 +- primitives/authorship/Cargo.toml | 8 +- primitives/block-builder/Cargo.toml | 10 +- primitives/blockchain/Cargo.toml | 10 +- primitives/chain-spec/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 14 +- primitives/consensus/babe/Cargo.toml | 20 +- primitives/consensus/common/Cargo.toml | 20 +- primitives/consensus/pow/Cargo.toml | 10 +- primitives/consensus/vrf/Cargo.toml | 8 +- primitives/core/Cargo.toml | 14 +- primitives/database/Cargo.toml | 2 +- primitives/debug-derive/Cargo.toml | 2 +- primitives/externalities/Cargo.toml | 6 +- primitives/finality-grandpa/Cargo.toml | 12 +- primitives/finality-tracker/Cargo.toml | 6 +- primitives/inherents/Cargo.toml | 6 +- primitives/io/Cargo.toml | 18 +- primitives/keyring/Cargo.toml | 6 +- primitives/npos-elections/Cargo.toml | 12 +- primitives/npos-elections/compact/Cargo.toml | 2 +- primitives/npos-elections/fuzzer/Cargo.toml | 6 +- primitives/offchain/Cargo.toml | 10 +- primitives/panic-handler/Cargo.toml | 2 +- primitives/rpc/Cargo.toml | 4 +- primitives/runtime-interface/Cargo.toml | 20 +- .../runtime-interface/proc-macro/Cargo.toml | 2 +- .../test-wasm-deprecated/Cargo.toml | 10 +- .../runtime-interface/test-wasm/Cargo.toml | 10 +- primitives/runtime-interface/test/Cargo.toml | 18 +- primitives/runtime/Cargo.toml | 16 +- primitives/sandbox/Cargo.toml | 10 +- primitives/serializer/Cargo.toml | 2 +- primitives/session/Cargo.toml | 12 +- primitives/staking/Cargo.toml | 6 +- primitives/state-machine/Cargo.toml | 12 +- primitives/std/Cargo.toml | 2 +- primitives/storage/Cargo.toml | 6 +- primitives/test-primitives/Cargo.toml | 8 +- primitives/timestamp/Cargo.toml | 10 +- primitives/tracing/Cargo.toml | 2 +- primitives/transaction-pool/Cargo.toml | 10 +- primitives/trie/Cargo.toml | 8 +- primitives/utils/Cargo.toml | 2 +- primitives/version/Cargo.toml | 6 +- primitives/wasm-interface/Cargo.toml | 4 +- test-utils/Cargo.toml | 2 +- test-utils/client/Cargo.toml | 26 +- test-utils/runtime/Cargo.toml | 60 +-- test-utils/runtime/client/Cargo.toml | 26 +- .../runtime/transaction-pool/Cargo.toml | 12 +- utils/browser/Cargo.toml | 12 +- utils/build-script-utils/Cargo.toml | 2 +- utils/fork-tree/Cargo.toml | 2 +- utils/frame/benchmarking-cli/Cargo.toml | 20 +- utils/frame/rpc/support/Cargo.toml | 10 +- utils/frame/rpc/system/Cargo.toml | 24 +- utils/prometheus/Cargo.toml | 2 +- 188 files changed, 1876 insertions(+), 1823 deletions(-) diff --git a/.maintain/gitlab/generate_changelog.sh b/.maintain/gitlab/generate_changelog.sh index ba2a507e4c..b872d32443 100755 --- a/.maintain/gitlab/generate_changelog.sh +++ b/.maintain/gitlab/generate_changelog.sh @@ -19,18 +19,17 @@ while IFS= read -r line; do if has_label 'paritytech/substrate' "$pr_id" 'B0-silent'; then continue fi - if has_label 'paritytech/substrate' "$pr_id" 'B1-runtimenoteworthy'; then - runtime_changes="$runtime_changes + if has_label 'paritytech/substrate' "$pr_id" 'B3-apinoteworthy' ; then + api_changes="$api_changes $line" fi - if has_label 'paritytech/substrate' "$pr_id" 'B1-clientnoteworthy'; then + if has_label 'paritytech/substrate' "$pr_id" 'B5-clientnoteworthy'; then client_changes="$client_changes $line" fi - if has_label 'paritytech/substrate' "$pr_id" 'B1-apinoteworthy' ; then - api_changes="$api_changes + if has_label 'paritytech/substrate' "$pr_id" 'B7-runtimenoteworthy'; then + runtime_changes="$runtime_changes $line" - continue fi done <<< "$all_changes" diff --git a/.maintain/gitlab/lib.sh b/.maintain/gitlab/lib.sh index a7a83baaea..33477b52f5 100755 --- a/.maintain/gitlab/lib.sh +++ b/.maintain/gitlab/lib.sh @@ -5,7 +5,7 @@ api_base="https://api.github.com/repos" # Function to take 2 git tags/commits and get any lines from commit messages # that contain something that looks like a PR reference: e.g., (#1234) sanitised_git_logs(){ - git --no-pager log --pretty=format:"%s" "$1..$2" | + git --no-pager log --pretty=format:"%s" "$1...$2" | # Only find messages referencing a PR grep -E '\(#[0-9]+\)' | # Strip any asterisks diff --git a/Cargo.lock b/Cargo.lock index 1520373790..89b24d0826 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,7 +568,7 @@ dependencies = [ [[package]] name = "chain-spec-builder" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "ansi_term 0.12.1", "node-cli", @@ -1377,14 +1377,14 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -1400,7 +1400,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -1437,7 +1437,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-rc3" +version = "11.0.0-rc4" dependencies = [ "parity-scale-codec", "serde", @@ -1447,7 +1447,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "bitmask", "frame-metadata", @@ -1473,7 +1473,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1483,7 +1483,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -1503,7 +1503,7 @@ dependencies = [ [[package]] name = "frame-support-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "parity-scale-codec", @@ -1521,7 +1521,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.2.11", "frame-support", @@ -1539,7 +1539,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -3286,7 +3286,7 @@ dependencies = [ [[package]] name = "node-bench" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "fs_extra", @@ -3316,7 +3316,7 @@ dependencies = [ [[package]] name = "node-browser-testing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -3333,7 +3333,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "assert_cmd", "frame-benchmarking-cli", @@ -3407,7 +3407,7 @@ dependencies = [ [[package]] name = "node-executor" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.3.1", "frame-benchmarking", @@ -3441,7 +3441,7 @@ dependencies = [ [[package]] name = "node-inspect" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "log", @@ -3457,7 +3457,7 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-system", "parity-scale-codec", @@ -3470,7 +3470,7 @@ dependencies = [ [[package]] name = "node-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "jsonrpc-core", "node-primitives", @@ -3497,7 +3497,7 @@ dependencies = [ [[package]] name = "node-rpc-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "env_logger 0.7.1", "futures 0.1.29", @@ -3510,7 +3510,7 @@ dependencies = [ [[package]] name = "node-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-executive", @@ -3579,7 +3579,7 @@ dependencies = [ [[package]] name = "node-template" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "log", @@ -3608,7 +3608,7 @@ dependencies = [ [[package]] name = "node-template-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-executive", "frame-support", @@ -3640,7 +3640,7 @@ dependencies = [ [[package]] name = "node-testing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.3.1", "frame-support", @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "pallet-atomic-swap" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3872,7 +3872,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3894,7 +3894,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3912,7 +3912,7 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3928,7 +3928,7 @@ dependencies = [ [[package]] name = "pallet-babe" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -3950,7 +3950,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "pallet-benchmark" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -3980,7 +3980,7 @@ dependencies = [ [[package]] name = "pallet-collective" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -3997,7 +3997,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "assert_matches", "frame-support", @@ -4023,7 +4023,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -4032,7 +4032,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4051,7 +4051,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4062,7 +4062,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4082,7 +4082,7 @@ dependencies = [ [[package]] name = "pallet-elections" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4098,7 +4098,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4117,7 +4117,7 @@ dependencies = [ [[package]] name = "pallet-evm" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "evm", "frame-support", @@ -4137,7 +4137,7 @@ dependencies = [ [[package]] name = "pallet-example" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4153,7 +4153,7 @@ dependencies = [ [[package]] name = "pallet-example-offchain-worker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4168,7 +4168,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4185,7 +4185,7 @@ dependencies = [ [[package]] name = "pallet-generic-asset" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4199,7 +4199,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "finality-grandpa", "frame-support", @@ -4226,7 +4226,7 @@ dependencies = [ [[package]] name = "pallet-identity" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4243,7 +4243,7 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4262,7 +4262,7 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4279,7 +4279,7 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4293,7 +4293,7 @@ dependencies = [ [[package]] name = "pallet-multisig" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4309,7 +4309,7 @@ dependencies = [ [[package]] name = "pallet-nicks" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4324,7 +4324,7 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4365,7 +4365,7 @@ dependencies = [ [[package]] name = "pallet-proxy" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4382,7 +4382,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4396,7 +4396,7 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "enumflags2", "frame-support", @@ -4412,7 +4412,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4427,7 +4427,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4442,7 +4442,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4463,7 +4463,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4483,7 +4483,7 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4499,7 +4499,7 @@ dependencies = [ [[package]] name = "pallet-staking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4550,7 +4550,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4561,7 +4561,7 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4575,7 +4575,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4587,7 +4587,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4605,7 +4605,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -4623,7 +4623,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4640,7 +4640,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "parity-scale-codec", @@ -4653,7 +4653,7 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4669,7 +4669,7 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-benchmarking", "frame-support", @@ -4685,7 +4685,7 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5829,7 +5829,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "bytes 0.5.4", "derive_more", @@ -5859,7 +5859,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -5885,7 +5885,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5902,7 +5902,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5917,7 +5917,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5927,7 +5927,7 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5967,7 +5967,7 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "fnv", @@ -6005,7 +6005,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "blake2-rfc", "env_logger 0.7.1", @@ -6038,7 +6038,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6048,7 +6048,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6086,7 +6086,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "env_logger 0.7.1", @@ -6137,7 +6137,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -6165,7 +6165,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6177,7 +6177,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "derive_more", @@ -6207,7 +6207,7 @@ dependencies = [ [[package]] name = "sc-consensus-pow" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -6228,7 +6228,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -6250,7 +6250,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "log", "sc-client-api", @@ -6263,7 +6263,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "derive_more", @@ -6301,7 +6301,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "log", @@ -6317,7 +6317,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "log", "parity-scale-codec", @@ -6331,7 +6331,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "cranelift-codegen", @@ -6352,7 +6352,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "derive_more", @@ -6397,7 +6397,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "finality-grandpa", @@ -6414,7 +6414,7 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "ansi_term 0.12.1", "futures 0.3.4", @@ -6432,7 +6432,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "hex", @@ -6448,7 +6448,7 @@ dependencies = [ [[package]] name = "sc-light" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "hash-db", "lazy_static", @@ -6466,7 +6466,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "async-std", @@ -6526,7 +6526,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "async-std", "futures 0.3.4", @@ -6544,7 +6544,7 @@ dependencies = [ [[package]] name = "sc-network-test" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "env_logger 0.7.1", "futures 0.3.4", @@ -6570,7 +6570,7 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", @@ -6603,7 +6603,7 @@ dependencies = [ [[package]] name = "sc-peerset" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "libp2p", @@ -6616,7 +6616,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6624,7 +6624,7 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "assert_matches", "futures 0.1.29", @@ -6663,7 +6663,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -6686,7 +6686,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6701,7 +6701,7 @@ dependencies = [ [[package]] name = "sc-runtime-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sp-allocator", "sp-core", @@ -6714,7 +6714,7 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "directories", @@ -6780,7 +6780,7 @@ dependencies = [ [[package]] name = "sc-service-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "env_logger 0.7.1", "fdlimit", @@ -6816,7 +6816,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "env_logger 0.7.1", "log", @@ -6830,7 +6830,7 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "bytes 0.5.4", "futures 0.3.4", @@ -6851,7 +6851,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "erased-serde", "log", @@ -6868,7 +6868,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "assert_matches", "criterion 0.3.1", @@ -6891,7 +6891,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "assert_matches", "derive_more", @@ -7264,7 +7264,7 @@ dependencies = [ [[package]] name = "sp-allocator" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "log", @@ -7275,7 +7275,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "hash-db", "parity-scale-codec", @@ -7290,7 +7290,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7301,7 +7301,7 @@ dependencies = [ [[package]] name = "sp-api-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.3.1", "parity-scale-codec", @@ -7320,7 +7320,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "serde", @@ -7331,7 +7331,7 @@ dependencies = [ [[package]] name = "sp-application-crypto-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sp-api", "sp-application-crypto", @@ -7342,7 +7342,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.3.1", "integer-sqrt", @@ -7358,7 +7358,7 @@ dependencies = [ [[package]] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "honggfuzz", "num-bigint", @@ -7369,7 +7369,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -7380,7 +7380,7 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7390,7 +7390,7 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -7401,7 +7401,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "log", @@ -7416,7 +7416,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "serde", "serde_json", @@ -7424,7 +7424,7 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -7448,7 +7448,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -7461,7 +7461,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "merlin", "parity-scale-codec", @@ -7478,7 +7478,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -7489,7 +7489,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7500,7 +7500,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "base58", "blake2-rfc", @@ -7547,7 +7547,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7555,7 +7555,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -7564,7 +7564,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "environmental", "parity-scale-codec", @@ -7574,7 +7574,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "finality-grandpa", "log", @@ -7589,7 +7589,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7598,7 +7598,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "parity-scale-codec", @@ -7609,7 +7609,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "hash-db", @@ -7629,7 +7629,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "lazy_static", "sp-core", @@ -7639,7 +7639,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "rand 0.7.3", @@ -7653,7 +7653,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7674,7 +7674,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sp-api", "sp-core", @@ -7684,7 +7684,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "backtrace", "log", @@ -7692,7 +7692,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "serde", "serde_json", @@ -7701,7 +7701,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "either", "hash256-std-hasher", @@ -7724,7 +7724,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7744,7 +7744,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "Inflector", "proc-macro-crate", @@ -7755,7 +7755,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sc-executor", "sp-core", @@ -7770,7 +7770,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sp-core", "sp-io", @@ -7781,7 +7781,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "sp-core", "sp-io", @@ -7792,7 +7792,7 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "assert_matches", "parity-scale-codec", @@ -7806,7 +7806,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "serde", "serde_json", @@ -7814,7 +7814,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-api", @@ -7826,7 +7826,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7835,7 +7835,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "hash-db", "hex-literal", @@ -7858,11 +7858,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-rc3" +version = "2.0.0-rc4" [[package]] name = "sp-storage" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7873,7 +7873,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7885,7 +7885,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7898,7 +7898,7 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "log", "rental", @@ -7907,7 +7907,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -7922,7 +7922,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "criterion 0.2.11", "hash-db", @@ -7940,7 +7940,7 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "futures-core", @@ -7951,7 +7951,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7962,7 +7962,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8077,7 +8077,7 @@ dependencies = [ [[package]] name = "subkey" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "clap", "derive_more", @@ -8119,7 +8119,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "chrono", "clear_on_drop", @@ -8145,14 +8145,14 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-support" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", @@ -8168,7 +8168,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", @@ -8193,7 +8193,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-rc3" +version = "0.8.0-rc4" dependencies = [ "async-std", "derive_more", @@ -8206,7 +8206,7 @@ dependencies = [ [[package]] name = "substrate-test-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "hash-db", @@ -8227,7 +8227,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "cfg-if", "frame-executive", @@ -8270,7 +8270,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "futures 0.3.4", "parity-scale-codec", @@ -8290,7 +8290,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" dependencies = [ "derive_more", "futures 0.3.4", @@ -8305,7 +8305,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" [[package]] name = "substrate-wasm-builder" diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 52fc1b4f8d..6689062390 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -21,25 +21,25 @@ log = "0.4.8" structopt = "0.3.8" parking_lot = "0.10.0" -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli", features = ["wasmtime"] } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor", features = ["wasmtime"] } -sc-service = { version = "0.8.0-rc3", path = "../../../client/service", features = ["wasmtime"] } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } -sc-network = { version = "0.8.0-rc3", path = "../../../client/network" } -sc-consensus-aura = { version = "0.8.0-rc3", path = "../../../client/consensus/aura" } -sp-consensus-aura = { version = "0.8.0-rc3", path = "../../../primitives/consensus/aura" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } -sc-finality-grandpa = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa" } -sp-finality-grandpa = { version = "2.0.0-rc3", path = "../../../primitives/finality-grandpa" } -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc3"} +sc-cli = { version = "0.8.0-rc4", path = "../../../client/cli", features = ["wasmtime"] } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sc-executor = { version = "0.8.0-rc4", path = "../../../client/executor", features = ["wasmtime"] } +sc-service = { version = "0.8.0-rc4", path = "../../../client/service", features = ["wasmtime"] } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } +sc-network = { version = "0.8.0-rc4", path = "../../../client/network" } +sc-consensus-aura = { version = "0.8.0-rc4", path = "../../../client/consensus/aura" } +sp-consensus-aura = { version = "0.8.0-rc4", path = "../../../primitives/consensus/aura" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } +sc-finality-grandpa = { version = "0.8.0-rc4", path = "../../../client/finality-grandpa" } +sp-finality-grandpa = { version = "2.0.0-rc4", path = "../../../primitives/finality-grandpa" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc4"} -node-template-runtime = { version = "2.0.0-rc3", path = "../runtime" } +node-template-runtime = { version = "2.0.0-rc4", path = "../runtime" } [build-dependencies] -substrate-build-script-utils = { version = "2.0.0-rc3", path = "../../../utils/build-script-utils" } +substrate-build-script-utils = { version = "2.0.0-rc4", path = "../../../utils/build-script-utils" } diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index 714c9d93a9..442fb72030 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Anonymous'] edition = '2018' name = 'pallet-template' -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "Unlicense" homepage = "https://substrate.dev" repository = "https://github.com/paritytech/substrate/" @@ -16,27 +16,27 @@ codec = { package = "parity-scale-codec", version = "1.3.1", default-features = [dependencies.frame-support] default-features = false -version = "2.0.0-rc3" +version = "2.0.0-rc4" path = "../../../../frame/support" [dependencies.frame-system] default-features = false -version = "2.0.0-rc3" +version = "2.0.0-rc4" path = "../../../../frame/system" [dev-dependencies.sp-core] default-features = false -version = "2.0.0-rc3" +version = "2.0.0-rc4" path = "../../../../primitives/core" [dev-dependencies.sp-io] default-features = false -version = "2.0.0-rc3" +version = "2.0.0-rc4" path = "../../../../primitives/io" [dev-dependencies.sp-runtime] default-features = false -version = "2.0.0-rc3" +version = "2.0.0-rc4" path = "../../../../primitives/runtime" diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index 16bb0fe0cb..ea44c805d0 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-template-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,31 +13,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-rc3", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } -balances = { version = "2.0.0-rc3", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } -grandpa = { version = "2.0.0-rc3", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } -randomness-collective-flip = { version = "2.0.0-rc3", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } -sudo = { version = "2.0.0-rc3", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } -system = { version = "2.0.0-rc3", default-features = false, package = "frame-system", path = "../../../frame/system" } -timestamp = { version = "2.0.0-rc3", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } -transaction-payment = { version = "2.0.0-rc3", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } -frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/executive" } +aura = { version = "2.0.0-rc4", default-features = false, package = "pallet-aura", path = "../../../frame/aura" } +balances = { version = "2.0.0-rc4", default-features = false, package = "pallet-balances", path = "../../../frame/balances" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/support" } +grandpa = { version = "2.0.0-rc4", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" } +randomness-collective-flip = { version = "2.0.0-rc4", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" } +sudo = { version = "2.0.0-rc4", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" } +system = { version = "2.0.0-rc4", default-features = false, package = "frame-system", path = "../../../frame/system" } +timestamp = { version = "2.0.0-rc4", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" } +transaction-payment = { version = "2.0.0-rc4", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" } +frame-executive = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/executive" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/api" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc3"} -sp-consensus-aura = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/consensus/aura" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } -sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc3"} -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/io" } -sp-offchain = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/session" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/version" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/api" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc4"} +sp-consensus-aura = { version = "0.8.0-rc4", default-features = false, path = "../../../primitives/consensus/aura" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } +sp-inherents = { path = "../../../primitives/inherents", default-features = false, version = "2.0.0-rc4"} +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/io" } +sp-offchain = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +sp-session = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/session" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-transaction-pool = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/version" } -template = { version = "2.0.0-rc3", default-features = false, path = "../pallets/template", package = "pallet-template" } +template = { version = "2.0.0-rc4", default-features = false, path = "../pallets/template", package = "pallet-template" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 80b02f1bc9..ab156635ec 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-bench" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." edition = "2018" @@ -10,21 +10,21 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] log = "0.4.8" -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -node-testing = { version = "2.0.0-rc3", path = "../testing" } -node-runtime = { version = "2.0.0-rc3", path = "../runtime" } -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api/" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +node-testing = { version = "2.0.0-rc4", path = "../testing" } +node-runtime = { version = "2.0.0-rc4", path = "../runtime" } +sc-cli = { version = "0.8.0-rc4", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api/" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } serde = "1.0.101" serde_json = "1.0.41" structopt = "0.3" derive_more = "0.99.2" kvdb = "0.6" kvdb-rocksdb = "0.8" -sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-trie = { version = "2.0.0-rc4", path = "../../../primitives/trie" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index 9e31d734c3..d8710b0b4b 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-browser-testing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Tests for the in-browser light client." edition = "2018" @@ -17,5 +17,5 @@ wasm-bindgen-futures = "0.4.10" wasm-bindgen-test = "0.3.10" futures = "0.3.4" -node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc3"} -sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc3"} +node-cli = { path = "../cli", default-features = false, features = ["browser"] , version = "2.0.0-rc4"} +sc-rpc-api = { path = "../../../client/rpc-api" , version = "0.8.0-rc4"} diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 4e2c0151b7..6202c1af69 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Generic Substrate node implementation in Rust." build = "build.rs" @@ -46,76 +46,76 @@ tracing = "0.1.10" parking_lot = "0.10.0" # primitives -sp-authority-discovery = { version = "2.0.0-rc3", path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } -grandpa-primitives = { version = "2.0.0-rc3", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/timestamp" } -sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/finality-tracker" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +sp-authority-discovery = { version = "2.0.0-rc4", path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../../primitives/consensus/babe" } +grandpa-primitives = { version = "2.0.0-rc4", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/timestamp" } +sp-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/finality-tracker" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc4", path = "../../../primitives/keyring" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } # client dependencies -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } -sc-chain-spec = { version = "2.0.0-rc3", path = "../../../client/chain-spec" } -sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } -sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../client/transaction-pool" } -sc-network = { version = "0.8.0-rc3", path = "../../../client/network" } -sc-consensus-babe = { version = "0.8.0-rc3", path = "../../../client/consensus/babe" } -grandpa = { version = "0.8.0-rc3", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } -sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../../../client/db" } -sc-offchain = { version = "2.0.0-rc3", path = "../../../client/offchain" } -sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } -sc-basic-authorship = { version = "0.8.0-rc3", path = "../../../client/basic-authorship" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } -sc-tracing = { version = "2.0.0-rc3", path = "../../../client/tracing" } -sc-telemetry = { version = "2.0.0-rc3", path = "../../../client/telemetry" } -sc-authority-discovery = { version = "0.8.0-rc3", path = "../../../client/authority-discovery" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" } +sc-chain-spec = { version = "2.0.0-rc4", path = "../../../client/chain-spec" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../../../client/transaction-pool" } +sc-network = { version = "0.8.0-rc4", path = "../../../client/network" } +sc-consensus-babe = { version = "0.8.0-rc4", path = "../../../client/consensus/babe" } +grandpa = { version = "0.8.0-rc4", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" } +sc-client-db = { version = "0.8.0-rc4", default-features = false, path = "../../../client/db" } +sc-offchain = { version = "2.0.0-rc4", path = "../../../client/offchain" } +sc-rpc = { version = "2.0.0-rc4", path = "../../../client/rpc" } +sc-basic-authorship = { version = "0.8.0-rc4", path = "../../../client/basic-authorship" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../../client/service" } +sc-tracing = { version = "2.0.0-rc4", path = "../../../client/tracing" } +sc-telemetry = { version = "2.0.0-rc4", path = "../../../client/telemetry" } +sc-authority-discovery = { version = "0.8.0-rc4", path = "../../../client/authority-discovery" } # frame dependencies -pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/timestamp" } -pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } -frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } -pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/im-online" } -pallet-authority-discovery = { version = "2.0.0-rc3", path = "../../../frame/authority-discovery" } -pallet-staking = { version = "2.0.0-rc3", path = "../../../frame/staking" } -pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc4", path = "../../../frame/indices" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/timestamp" } +pallet-contracts = { version = "2.0.0-rc4", path = "../../../frame/contracts" } +frame-system = { version = "2.0.0-rc4", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc4", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../../../frame/transaction-payment" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/support" } +pallet-im-online = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/im-online" } +pallet-authority-discovery = { version = "2.0.0-rc4", path = "../../../frame/authority-discovery" } +pallet-staking = { version = "2.0.0-rc4", path = "../../../frame/staking" } +pallet-grandpa = { version = "2.0.0-rc4", path = "../../../frame/grandpa" } # node-specific dependencies -node-runtime = { version = "2.0.0-rc3", path = "../runtime" } -node-rpc = { version = "2.0.0-rc3", path = "../rpc" } -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -node-executor = { version = "2.0.0-rc3", path = "../executor" } +node-runtime = { version = "2.0.0-rc4", path = "../runtime" } +node-rpc = { version = "2.0.0-rc4", path = "../rpc" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +node-executor = { version = "2.0.0-rc4", path = "../executor" } # CLI-specific dependencies -sc-cli = { version = "0.8.0-rc3", optional = true, path = "../../../client/cli" } -frame-benchmarking-cli = { version = "2.0.0-rc3", optional = true, path = "../../../utils/frame/benchmarking-cli" } -node-inspect = { version = "0.8.0-rc3", optional = true, path = "../inspect" } +sc-cli = { version = "0.8.0-rc4", optional = true, path = "../../../client/cli" } +frame-benchmarking-cli = { version = "2.0.0-rc4", optional = true, path = "../../../utils/frame/benchmarking-cli" } +node-inspect = { version = "0.8.0-rc4", optional = true, path = "../inspect" } # WASM-specific dependencies wasm-bindgen = { version = "0.2.57", optional = true } wasm-bindgen-futures = { version = "0.4.7", optional = true } -browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc3"} +browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-rc4"} [target.'cfg(target_arch="x86_64")'.dependencies] -node-executor = { version = "2.0.0-rc3", path = "../executor", features = [ "wasmtime" ] } -sc-cli = { version = "0.8.0-rc3", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } +node-executor = { version = "2.0.0-rc4", path = "../executor", features = [ "wasmtime" ] } +sc-cli = { version = "0.8.0-rc4", optional = true, path = "../../../client/cli", features = [ "wasmtime" ] } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../../client/service", features = [ "wasmtime" ] } [dev-dependencies] -sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } -sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } -sc-consensus-babe = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../../client/consensus/epochs" } -sc-service-test = { version = "2.0.0-rc3", path = "../../../client/service/test" } +sc-keystore = { version = "2.0.0-rc4", path = "../../../client/keystore" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } +sc-consensus-babe = { version = "0.8.0-rc4", features = ["test-helpers"], path = "../../../client/consensus/babe" } +sc-consensus-epochs = { version = "0.8.0-rc4", path = "../../../client/consensus/epochs" } +sc-service-test = { version = "2.0.0-rc4", path = "../../../client/service/test" } futures = "0.3.4" tempfile = "3.1.0" assert_cmd = "1.0" @@ -126,12 +126,12 @@ platforms = "0.2.1" [build-dependencies] structopt = { version = "0.3.8", optional = true } -node-inspect = { version = "0.8.0-rc3", optional = true, path = "../inspect" } -frame-benchmarking-cli = { version = "2.0.0-rc3", optional = true, path = "../../../utils/frame/benchmarking-cli" } -substrate-build-script-utils = { version = "2.0.0-rc3", optional = true, path = "../../../utils/build-script-utils" } +node-inspect = { version = "0.8.0-rc4", optional = true, path = "../inspect" } +frame-benchmarking-cli = { version = "2.0.0-rc4", optional = true, path = "../../../utils/frame/benchmarking-cli" } +substrate-build-script-utils = { version = "2.0.0-rc4", optional = true, path = "../../../utils/build-script-utils" } [build-dependencies.sc-cli] -version = "0.8.0-rc3" +version = "0.8.0-rc4" package = "sc-cli" path = "../../../client/cli" optional = true diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index 2c5a5db281..900f0cad43 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-executor" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." edition = "2018" @@ -13,34 +13,34 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1" } -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -node-runtime = { version = "2.0.0-rc3", path = "../runtime" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } -sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +node-runtime = { version = "2.0.0-rc4", path = "../runtime" } +sc-executor = { version = "0.8.0-rc4", path = "../../../client/executor" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } +sp-trie = { version = "2.0.0-rc4", path = "../../../primitives/trie" } trie-root = "0.16.0" -frame-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/benchmarking" } +frame-benchmarking = { version = "2.0.0-rc4", path = "../../../frame/benchmarking" } [dev-dependencies] criterion = "0.3.0" -frame-support = { version = "2.0.0-rc3", path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } -node-testing = { version = "2.0.0-rc3", path = "../testing" } -pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } -pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc3", path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } -pallet-session = { version = "2.0.0-rc3", path = "../../../frame/session" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc3", path = "../../../frame/treasury" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } -substrate-test-client = { version = "2.0.0-rc3", path = "../../../test-utils/client" } +frame-support = { version = "2.0.0-rc4", path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc4", path = "../../../frame/system" } +node-testing = { version = "2.0.0-rc4", path = "../testing" } +pallet-balances = { version = "2.0.0-rc4", path = "../../../frame/balances" } +pallet-contracts = { version = "2.0.0-rc4", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc4", path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc4", path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc4", path = "../../../frame/indices" } +pallet-session = { version = "2.0.0-rc4", path = "../../../frame/session" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc4", path = "../../../frame/treasury" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../../primitives/application-crypto" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-externalities = { version = "0.8.0-rc4", path = "../../../primitives/externalities" } +substrate-test-client = { version = "2.0.0-rc4", path = "../../../test-utils/client" } wabt = "0.9.2" [features] diff --git a/bin/node/inspect/Cargo.toml b/bin/node/inspect/Cargo.toml index 91202191f1..e76f215a99 100644 --- a/bin/node/inspect/Cargo.toml +++ b/bin/node/inspect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-inspect" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,10 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.1" } derive_more = "0.99" log = "0.4.8" -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sc-cli = { version = "0.8.0-rc4", path = "../../../client/cli" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../../client/service" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } structopt = "0.3.8" diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index 75a8cbb332..0a66336046 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system" } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/system" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc3", path = "../../../primitives/serializer" } +sp-serializer = { version = "2.0.0-rc4", path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index ab4bc7a02d..2d21746f2a 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,5 +16,5 @@ futures = "0.1.29" hyper = "0.12.35" jsonrpc-core-client = { version = "14.2.0", default-features = false, features = ["http"] } log = "0.4.8" -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +sc-rpc = { version = "2.0.0-rc4", path = "../../../client/rpc" } diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 2bac8b6740..95d55fab64 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -11,24 +11,24 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" } jsonrpc-core = "14.2.0" -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -node-runtime = { version = "2.0.0-rc3", path = "../runtime" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -pallet-contracts-rpc = { version = "0.8.0-rc3", path = "../../../frame/contracts/rpc/" } -pallet-transaction-payment-rpc = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment/rpc/" } -substrate-frame-rpc-system = { version = "2.0.0-rc3", path = "../../../utils/frame/rpc/system" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } -sc-consensus-babe = { version = "0.8.0-rc3", path = "../../../client/consensus/babe" } -sc-consensus-babe-rpc = { version = "0.8.0-rc3", path = "../../../client/consensus/babe/rpc" } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } -sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } -sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../../client/consensus/epochs" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sc-finality-grandpa = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa" } -sc-finality-grandpa-rpc = { version = "0.8.0-rc3", path = "../../../client/finality-grandpa/rpc" } -sc-rpc-api = { version = "0.8.0-rc3", path = "../../../client/rpc-api" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +node-runtime = { version = "2.0.0-rc4", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +pallet-contracts-rpc = { version = "0.8.0-rc4", path = "../../../frame/contracts/rpc/" } +pallet-transaction-payment-rpc = { version = "2.0.0-rc4", path = "../../../frame/transaction-payment/rpc/" } +substrate-frame-rpc-system = { version = "2.0.0-rc4", path = "../../../utils/frame/rpc/system" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } +sc-consensus-babe = { version = "0.8.0-rc4", path = "../../../client/consensus/babe" } +sc-consensus-babe-rpc = { version = "0.8.0-rc4", path = "../../../client/consensus/babe/rpc" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../../primitives/consensus/babe" } +sc-keystore = { version = "2.0.0-rc4", path = "../../../client/keystore" } +sc-consensus-epochs = { version = "0.8.0-rc4", path = "../../../client/consensus/epochs" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sc-finality-grandpa = { version = "0.8.0-rc4", path = "../../../client/finality-grandpa" } +sc-finality-grandpa-rpc = { version = "0.8.0-rc4", path = "../../../client/finality-grandpa/rpc" } +sc-rpc-api = { version = "0.8.0-rc4", path = "../../../client/rpc-api" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../primitives/block-builder" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 6db4057e8c..568b1afb5e 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -21,70 +21,70 @@ static_assertions = "1.1.0" hex-literal = { version = "0.2.1", optional = true } # primitives -sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/authority-discovery" } -sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/consensus/babe" } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc3"} -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/inherents" } -node-primitives = { version = "2.0.0-rc3", default-features = false, path = "../primitives" } -sp-offchain = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/offchain" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/staking" } -sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../../primitives/keyring" } -sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/session" } -sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/transaction-pool" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/version" } +sp-authority-discovery = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/authority-discovery" } +sp-consensus-babe = { version = "0.8.0-rc4", default-features = false, path = "../../../primitives/consensus/babe" } +sp-block-builder = { path = "../../../primitives/block-builder", default-features = false, version = "2.0.0-rc4"} +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/inherents" } +node-primitives = { version = "2.0.0-rc4", default-features = false, path = "../primitives" } +sp-offchain = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/offchain" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/staking" } +sp-keyring = { version = "2.0.0-rc4", optional = true, path = "../../../primitives/keyring" } +sp-session = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/session" } +sp-transaction-pool = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/transaction-pool" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/version" } # frame dependencies -frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/executive" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system" } -frame-system-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system/benchmarking", optional = true } -frame-system-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } -pallet-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/authority-discovery" } -pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/authorship" } -pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/babe" } -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/balances" } -pallet-collective = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/collective" } -pallet-contracts = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/contracts" } -pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/contracts/common/" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc3", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } -pallet-democracy = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/democracy" } -pallet-elections-phragmen = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/elections-phragmen" } -pallet-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/finality-tracker" } -pallet-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/grandpa" } -pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/im-online" } -pallet-indices = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/indices" } -pallet-identity = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/identity" } -pallet-membership = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/membership" } -pallet-multisig = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/multisig" } -pallet-offences = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/offences" } -pallet-offences-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } -pallet-proxy = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/proxy" } -pallet-randomness-collective-flip = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/randomness-collective-flip" } -pallet-recovery = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/recovery" } -pallet-session = { version = "2.0.0-rc3", features = ["historical"], path = "../../../frame/session", default-features = false } -pallet-session-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/session/benchmarking", default-features = false, optional = true } -pallet-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/staking/reward-curve" } -pallet-scheduler = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/scheduler" } -pallet-society = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/society" } -pallet-sudo = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/sudo" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/timestamp" } -pallet-treasury = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/treasury" } -pallet-utility = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/utility" } -pallet-transaction-payment = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/transaction-payment" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } -pallet-vesting = { version = "2.0.0-rc3", default-features = false, path = "../../../frame/vesting" } +frame-executive = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/executive" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/system" } +frame-system-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/system/benchmarking", optional = true } +frame-system-rpc-runtime-api = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } +pallet-authority-discovery = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/authority-discovery" } +pallet-authorship = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/authorship" } +pallet-babe = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/babe" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/balances" } +pallet-collective = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/collective" } +pallet-contracts = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/contracts" } +pallet-contracts-primitives = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/contracts/common/" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc4", default-features = false, path = "../../../frame/contracts/rpc/runtime-api/" } +pallet-democracy = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/democracy" } +pallet-elections-phragmen = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/elections-phragmen" } +pallet-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/finality-tracker" } +pallet-grandpa = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/grandpa" } +pallet-im-online = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/im-online" } +pallet-indices = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/indices" } +pallet-identity = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/identity" } +pallet-membership = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/membership" } +pallet-multisig = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/multisig" } +pallet-offences = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/offences" } +pallet-offences-benchmarking = { version = "2.0.0-rc4", path = "../../../frame/offences/benchmarking", default-features = false, optional = true } +pallet-proxy = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/proxy" } +pallet-randomness-collective-flip = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/randomness-collective-flip" } +pallet-recovery = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/recovery" } +pallet-session = { version = "2.0.0-rc4", features = ["historical"], path = "../../../frame/session", default-features = false } +pallet-session-benchmarking = { version = "2.0.0-rc4", path = "../../../frame/session/benchmarking", default-features = false, optional = true } +pallet-staking = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/staking/reward-curve" } +pallet-scheduler = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/scheduler" } +pallet-society = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/society" } +pallet-sudo = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/sudo" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/timestamp" } +pallet-treasury = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/treasury" } +pallet-utility = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/utility" } +pallet-transaction-payment = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/transaction-payment" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" } +pallet-vesting = { version = "2.0.0-rc4", default-features = false, path = "../../../frame/vesting" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml index 6bf4abc03d..fbf369cc3b 100644 --- a/bin/node/testing/Cargo.toml +++ b/bin/node/testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-testing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." edition = "2018" @@ -13,40 +13,40 @@ publish = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } -sc-service = { version = "0.8.0-rc3", features = ["test-helpers", "db"], path = "../../../client/service" } -sc-client-db = { version = "0.8.0-rc3", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api/" } +pallet-balances = { version = "2.0.0-rc4", path = "../../../frame/balances" } +sc-service = { version = "0.8.0-rc4", features = ["test-helpers", "db"], path = "../../../client/service" } +sc-client-db = { version = "0.8.0-rc4", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api/" } codec = { package = "parity-scale-codec", version = "1.3.1" } -pallet-contracts = { version = "2.0.0-rc3", path = "../../../frame/contracts" } -pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } -pallet-indices = { version = "2.0.0-rc3", path = "../../../frame/indices" } -sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } -node-executor = { version = "2.0.0-rc3", path = "../executor" } -node-primitives = { version = "2.0.0-rc3", path = "../primitives" } -node-runtime = { version = "2.0.0-rc3", path = "../runtime" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } -frame-support = { version = "2.0.0-rc3", path = "../../../frame/support" } -pallet-session = { version = "2.0.0-rc3", path = "../../../frame/session" } -pallet-society = { version = "2.0.0-rc3", path = "../../../frame/society" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -pallet-staking = { version = "2.0.0-rc3", path = "../../../frame/staking" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor", features = ["wasmtime"] } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } -substrate-test-client = { version = "2.0.0-rc3", path = "../../../test-utils/client" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../../../frame/timestamp" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } -pallet-treasury = { version = "2.0.0-rc3", path = "../../../frame/treasury" } +pallet-contracts = { version = "2.0.0-rc4", path = "../../../frame/contracts" } +pallet-grandpa = { version = "2.0.0-rc4", path = "../../../frame/grandpa" } +pallet-indices = { version = "2.0.0-rc4", path = "../../../frame/indices" } +sp-keyring = { version = "2.0.0-rc4", path = "../../../primitives/keyring" } +node-executor = { version = "2.0.0-rc4", path = "../executor" } +node-primitives = { version = "2.0.0-rc4", path = "../primitives" } +node-runtime = { version = "2.0.0-rc4", path = "../runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } +frame-support = { version = "2.0.0-rc4", path = "../../../frame/support" } +pallet-session = { version = "2.0.0-rc4", path = "../../../frame/session" } +pallet-society = { version = "2.0.0-rc4", path = "../../../frame/society" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc4", path = "../../../frame/staking" } +sc-executor = { version = "0.8.0-rc4", path = "../../../client/executor", features = ["wasmtime"] } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +frame-system = { version = "2.0.0-rc4", path = "../../../frame/system" } +substrate-test-client = { version = "2.0.0-rc4", path = "../../../test-utils/client" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../../../frame/timestamp" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../../../frame/transaction-payment" } +pallet-treasury = { version = "2.0.0-rc4", path = "../../../frame/treasury" } wabt = "0.9.2" -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/finality-tracker" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/timestamp" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/timestamp" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../../client/block-builder" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -54,4 +54,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } +sc-cli = { version = "0.8.0-rc4", path = "../../../client/cli" } diff --git a/bin/utils/chain-spec-builder/Cargo.toml b/bin/utils/chain-spec-builder/Cargo.toml index 743a5f25c0..b633ffa966 100644 --- a/bin/utils/chain-spec-builder/Cargo.toml +++ b/bin/utils/chain-spec-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-spec-builder" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,9 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" -sc-keystore = { version = "2.0.0-rc3", path = "../../../client/keystore" } -sc-chain-spec = { version = "2.0.0-rc3", path = "../../../client/chain-spec" } -node-cli = { version = "2.0.0-rc3", path = "../../node/cli" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sc-keystore = { version = "2.0.0-rc4", path = "../../../client/keystore" } +sc-chain-spec = { version = "2.0.0-rc4", path = "../../../client/chain-spec" } +node-cli = { version = "2.0.0-rc4", path = "../../node/cli" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.8" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index fa570f5759..92fffe898f 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subkey" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,10 +12,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.1.29" -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -node-runtime = { version = "2.0.0-rc3", path = "../../node/runtime" } -node-primitives = { version = "2.0.0-rc3", path = "../../node/primitives" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +node-runtime = { version = "2.0.0-rc4", path = "../../node/runtime" } +node-primitives = { version = "2.0.0-rc4", path = "../../node/primitives" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } rand = "0.7.2" clap = "2.33.0" tiny-bip39 = "0.7" @@ -23,14 +23,14 @@ substrate-bip39 = "0.4.1" hex = "0.4.0" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.3.1" } -frame-system = { version = "2.0.0-rc3", path = "../../../frame/system" } -pallet-balances = { version = "2.0.0-rc3", path = "../../../frame/balances" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../../../frame/transaction-payment" } -pallet-grandpa = { version = "2.0.0-rc3", path = "../../../frame/grandpa" } +frame-system = { version = "2.0.0-rc4", path = "../../../frame/system" } +pallet-balances = { version = "2.0.0-rc4", path = "../../../frame/balances" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../../../frame/transaction-payment" } +pallet-grandpa = { version = "2.0.0-rc4", path = "../../../frame/grandpa" } rpassword = "4.0.1" itertools = "0.8.2" derive_more = { version = "0.99.2" } -sc-rpc = { version = "2.0.0-rc3", path = "../../../client/rpc" } +sc-rpc = { version = "2.0.0-rc4", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.2.0", features = ["http"] } hyper = "0.12.35" libp2p = { version = "0.19.1", default-features = false } diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml index 606c1c4813..a32623ffdb 100644 --- a/client/api/Cargo.toml +++ b/client/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,36 +14,36 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } derive_more = { version = "0.99.2" } -sc-executor = { version = "0.8.0-rc3", path = "../executor" } -sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } +sc-executor = { version = "0.8.0-rc4", path = "../executor" } +sp-externalities = { version = "0.8.0-rc4", path = "../../primitives/externalities" } fnv = { version = "1.0.6" } futures = { version = "0.3.1" } hash-db = { version = "0.15.2", default-features = false } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } hex-literal = { version = "0.2.1" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } kvdb = "0.6.0" log = { version = "0.4.8" } parking_lot = "0.10.0" lazy_static = "1.4.0" -sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } -sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } -sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } +sp-database = { version = "2.0.0-rc4", path = "../../primitives/database" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/version" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } +sp-trie = { version = "2.0.0-rc4", path = "../../primitives/trie" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc4", path = "../../utils/prometheus" } [dev-dependencies] kvdb-memorydb = "0.6.0" -sp-test-primitives = { version = "2.0.0-rc3", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } +sp-test-primitives = { version = "2.0.0-rc4", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../test-utils/runtime" } diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 114092ab31..84a37bd16c 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-authority-discovery" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -23,21 +23,21 @@ futures = "0.3.4" futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false, features = ["kad"] } log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} prost = "0.6.1" rand = "0.7.2" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } -sc-network = { version = "0.8.0-rc3", path = "../network" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sc-keystore = { version = "2.0.0-rc4", path = "../keystore" } +sc-network = { version = "0.8.0-rc4", path = "../network" } serde_json = "1.0.41" -sp-authority-discovery = { version = "2.0.0-rc3", path = "../../primitives/authority-discovery" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-authority-discovery = { version = "2.0.0-rc4", path = "../../primitives/authority-discovery" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } [dev-dependencies] env_logger = "0.7.0" quickcheck = "0.9.0" -sc-peerset = { version = "2.0.0-rc3", path = "../peerset" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client"} +sc-peerset = { version = "2.0.0-rc4", path = "../peerset" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client"} diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml index 6e3ec49ea7..b6a853a1a1 100644 --- a/client/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-basic-authorship" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,21 +16,21 @@ codec = { package = "parity-scale-codec", version = "1.3.1" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc3", path = "../../primitives/inherents" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } -sc-proposer-metrics = { version = "0.8.0-rc3", path = "../proposer-metrics" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc4", path = "../../primitives/inherents" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +sc-block-builder = { version = "0.8.0-rc4", path = "../block-builder" } +sc-proposer-metrics = { version = "0.8.0-rc4", path = "../proposer-metrics" } tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] } [dev-dependencies] -sc-transaction-pool = { version = "2.0.0-rc3", path = "../../client/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../../client/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } parking_lot = "0.10.0" diff --git a/client/block-builder/Cargo.toml b/client/block-builder/Cargo.toml index ce94526e0c..1e733355f7 100644 --- a/client/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-block-builder" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../primitives/block-builder" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } [dev-dependencies] substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } -sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } +sp-trie = { version = "2.0.0-rc4", path = "../../primitives/trie" } diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml index 669e7535dc..a3176deee5 100644 --- a/client/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,12 +12,12 @@ description = "Substrate chain configurations." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-chain-spec-derive = { version = "2.0.0-rc3", path = "./derive" } +sc-chain-spec-derive = { version = "2.0.0-rc4", path = "./derive" } impl-trait-for-tuples = "0.1.3" -sc-network = { version = "0.8.0-rc3", path = "../network" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-chain-spec = { version = "2.0.0-rc3", path = "../../primitives/chain-spec" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-chain-spec = { version = "2.0.0-rc4", path = "../../primitives/chain-spec" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index 6c1153941f..75a290dc98 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-chain-spec-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 7ffc27749b..616b4f3481 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-cli" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Substrate CLI interface." edition = "2018" @@ -24,23 +24,23 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] } futures = "0.3.4" fdlimit = "0.1.4" serde_json = "1.0.41" -sc-informant = { version = "0.8.0-rc3", path = "../informant" } -sp-panic-handler = { version = "2.0.0-rc3", path = "../../primitives/panic-handler" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../service" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } -substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc3"} -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +sc-informant = { version = "0.8.0-rc4", path = "../informant" } +sp-panic-handler = { version = "2.0.0-rc4", path = "../../primitives/panic-handler" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../service" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } +substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-rc4"} +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.8" -sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } +sc-tracing = { version = "2.0.0-rc4", path = "../tracing" } chrono = "0.4.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index 04bdc19fe4..d080fd39d0 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Aura consensus algorithm for substrate" edition = "2018" @@ -12,37 +12,37 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc3", path = "../../../primitives/consensus/aura" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc4", path = "../../../primitives/consensus/aura" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../primitives/block-builder" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../../client/block-builder" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.3.1" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sc-keystore = { version = "2.0.0-rc3", path = "../../keystore" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sc-keystore = { version = "2.0.0-rc4", path = "../../keystore" } log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } -sp-version = { version = "2.0.0-rc3", path = "../../../primitives/version" } -sc-consensus-slots = { version = "0.8.0-rc3", path = "../slots" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } +sp-version = { version = "2.0.0-rc4", path = "../../../primitives/version" } +sc-consensus-slots = { version = "0.8.0-rc4", path = "../slots" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-timestamp = { version = "2.0.0-rc4", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc4", path = "../../telemetry" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc4"} [dev-dependencies] -sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc3", path = "../../executor" } -sc-network = { version = "0.8.0-rc3", path = "../../network" } -sc-network-test = { version = "0.8.0-rc3", path = "../../network/test" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc4", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc4", path = "../../executor" } +sc-network = { version = "0.8.0-rc4", path = "../../network" } +sc-network-test = { version = "0.8.0-rc4", path = "../../network/test" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 4f8f4db264..46c67e8917 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "BABE consensus algorithm for substrate" edition = "2018" @@ -14,31 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../../primitives/consensus/babe" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" serde = { version = "1.0.104", features = ["derive"] } -sp-version = { version = "2.0.0-rc3", path = "../../../primitives/version" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } -sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } -sc-keystore = { version = "2.0.0-rc3", path = "../../keystore" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sc-consensus-epochs = { version = "0.8.0-rc3", path = "../epochs" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-consensus-vrf = { version = "0.8.0-rc3", path = "../../../primitives/consensus/vrf" } -sc-consensus-uncles = { version = "0.8.0-rc3", path = "../uncles" } -sc-consensus-slots = { version = "0.8.0-rc3", path = "../slots" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -fork-tree = { version = "2.0.0-rc3", path = "../../../utils/fork-tree" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} +sp-version = { version = "2.0.0-rc4", path = "../../../primitives/version" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sp-timestamp = { version = "2.0.0-rc4", path = "../../../primitives/timestamp" } +sc-telemetry = { version = "2.0.0-rc4", path = "../../telemetry" } +sc-keystore = { version = "2.0.0-rc4", path = "../../keystore" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sc-consensus-epochs = { version = "0.8.0-rc4", path = "../epochs" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../primitives/block-builder" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-consensus-vrf = { version = "0.8.0-rc4", path = "../../../primitives/consensus/vrf" } +sc-consensus-uncles = { version = "0.8.0-rc4", path = "../uncles" } +sc-consensus-slots = { version = "0.8.0-rc4", path = "../slots" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +fork-tree = { version = "2.0.0-rc4", path = "../../../utils/fork-tree" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc4"} futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" @@ -50,13 +50,13 @@ pdqselect = "0.1.0" derive_more = "0.99.2" [dev-dependencies] -sp-keyring = { version = "2.0.0-rc3", path = "../../../primitives/keyring" } -sc-executor = { version = "0.8.0-rc3", path = "../../executor" } -sc-network = { version = "0.8.0-rc3", path = "../../network" } -sc-network-test = { version = "0.8.0-rc3", path = "../../network/test" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../service" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } +sp-keyring = { version = "2.0.0-rc4", path = "../../../primitives/keyring" } +sc-executor = { version = "0.8.0-rc4", path = "../../executor" } +sc-network = { version = "0.8.0-rc4", path = "../../network" } +sc-network-test = { version = "0.8.0-rc4", path = "../../network/test" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../service" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../block-builder" } env_logger = "0.7.0" rand_chacha = "0.2.2" tempfile = "3.1.0" diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 401434cadb..03da64ff30 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-babe-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "RPC extensions for the BABE consensus algorithm" edition = "2018" @@ -12,27 +12,27 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-consensus-babe = { version = "0.8.0-rc3", path = "../" } -sc-rpc-api = { version = "0.8.0-rc3", path = "../../../rpc-api" } +sc-consensus-babe = { version = "0.8.0-rc4", path = "../" } +sc-rpc-api = { version = "0.8.0-rc4", path = "../../../rpc-api" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../../primitives/consensus/babe" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../../../primitives/consensus/babe" } serde = { version = "1.0.104", features=["derive"] } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.8.0-rc3", path = "../../epochs" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../../primitives/runtime" } +sc-consensus-epochs = { version = "0.8.0-rc4", path = "../../epochs" } futures = { version = "0.3.4", features = ["compat"] } derive_more = "0.99.2" -sp-api = { version = "2.0.0-rc3", path = "../../../../primitives/api" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../../primitives/application-crypto" } -sc-keystore = { version = "2.0.0-rc3", path = "../../../keystore" } +sp-api = { version = "2.0.0-rc4", path = "../../../../primitives/api" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc4", path = "../../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../../../primitives/application-crypto" } +sc-keystore = { version = "2.0.0-rc4", path = "../../../keystore" } [dev-dependencies] -sc-consensus = { version = "0.8.0-rc3", path = "../../../consensus/common" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../consensus/common" } serde_json = "1.0.50" -sp-keyring = { version = "2.0.0-rc3", path = "../../../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc4", path = "../../../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../../test-utils/runtime/client" } tempfile = "3.1.0" diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index bb1f88a8ce..72bb051a0d 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,7 +12,7 @@ description = "Collection of common consensus specific imlementations for Substr targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index 3911a59b72..22f8794974 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-epochs" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Generic epochs-based utilities for consensus" edition = "2018" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" -fork-tree = { version = "2.0.0-rc3", path = "../../../utils/fork-tree" } -sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc3"} -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sc-client-api = { path = "../../api" , version = "2.0.0-rc3"} +fork-tree = { version = "2.0.0-rc4", path = "../../../utils/fork-tree" } +sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0-rc4"} +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sc-client-api = { path = "../../api" , version = "2.0.0-rc4"} diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 0503fed54a..2da28b9ab9 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-manual-seal" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Manual sealing engine for Substrate" edition = "2018" @@ -22,20 +22,20 @@ parking_lot = "0.10.0" serde = { version = "1.0", features=["derive"] } assert_matches = "1.3.0" -sc-client-api = { path = "../../../client/api", version = "2.0.0-rc3" } -sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc3" } -sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc3" } -sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc3" } -sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc3" } -sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc3" } -sp-core = { path = "../../../primitives/core", version = "2.0.0-rc3" } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3" } +sc-client-api = { path = "../../../client/api", version = "2.0.0-rc4" } +sc-transaction-pool = { path = "../../transaction-pool", version = "2.0.0-rc4" } +sp-blockchain = { path = "../../../primitives/blockchain", version = "2.0.0-rc4" } +sp-consensus = { package = "sp-consensus", path = "../../../primitives/consensus/common", version = "0.8.0-rc4" } +sp-inherents = { path = "../../../primitives/inherents", version = "2.0.0-rc4" } +sp-runtime = { path = "../../../primitives/runtime", version = "2.0.0-rc4" } +sp-core = { path = "../../../primitives/core", version = "2.0.0-rc4" } +sp-transaction-pool = { path = "../../../primitives/transaction-pool", version = "2.0.0-rc4" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc4" } [dev-dependencies] -sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc3" } -substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc3" } -substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc3" } +sc-basic-authorship = { path = "../../basic-authorship", version = "0.8.0-rc4" } +substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0-rc4" } +substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0-rc4" } tokio = { version = "0.2", features = ["rt-core", "macros"] } env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml index cd8d4cab42..b0b142fd84 100644 --- a/client/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-pow" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "PoW consensus algorithm for substrate" edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../primitives/block-builder" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } -sp-consensus-pow = { version = "0.8.0-rc3", path = "../../../primitives/consensus/pow" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../primitives/block-builder" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sp-consensus-pow = { version = "0.8.0-rc4", path = "../../../primitives/consensus/pow" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } log = "0.4.8" futures = { version = "0.3.1", features = ["compat"] } -sp-timestamp = { version = "2.0.0-rc3", path = "../../../primitives/timestamp" } +sp-timestamp = { version = "2.0.0-rc4", path = "../../../primitives/timestamp" } derive_more = "0.99.2" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc4"} diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml index 25a137d214..80eb83cca5 100644 --- a/client/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-slots" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Generic slots-based utilities for consensus" edition = "2018" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../../primitives/application-crypto" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc3", path = "../../telemetry" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../../primitives/application-crypto" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc4", path = "../../telemetry" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } futures = "0.3.4" futures-timer = "3.0.1" parking_lot = "0.10.0" log = "0.4.8" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml index 0110b3a746..957e8e3c0b 100644 --- a/client/consensus/uncles/Cargo.toml +++ b/client/consensus/uncles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-consensus-uncles" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Generic uncle inclusion utilities for consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-authorship = { version = "2.0.0-rc3", path = "../../../primitives/authorship" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-inherents = { version = "2.0.0-rc3", path = "../../../primitives/inherents" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-authorship = { version = "2.0.0-rc4", path = "../../../primitives/authorship" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } log = "0.4.8" diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 22ca6e64aa..42cc60617a 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-client-db" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -23,22 +23,22 @@ parity-util-mem = { version = "0.6.1", default-features = false, features = ["st codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } blake2-rfc = "0.2.18" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sc-executor = { version = "0.8.0-rc3", path = "../executor" } -sc-state-db = { version = "0.8.0-rc3", path = "../state-db" } -sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sc-executor = { version = "0.8.0-rc4", path = "../executor" } +sc-state-db = { version = "0.8.0-rc4", path = "../state-db" } +sp-trie = { version = "2.0.0-rc4", path = "../../primitives/trie" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-database = { version = "2.0.0-rc4", path = "../../primitives/database" } parity-db = { version = "0.1.2", optional = true } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc4", path = "../../utils/prometheus" } [dev-dependencies] -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.9" kvdb-rocksdb = "0.8" diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml index f1499693f3..b12156aeb1 100644 --- a/client/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,22 +15,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.1" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } -sp-serializer = { version = "2.0.0-rc3", path = "../../primitives/serializer" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } -sp-panic-handler = { version = "2.0.0-rc3", path = "../../primitives/panic-handler" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-trie = { version = "2.0.0-rc4", path = "../../primitives/trie" } +sp-serializer = { version = "2.0.0-rc4", path = "../../primitives/serializer" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } +sp-panic-handler = { version = "2.0.0-rc4", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.41.0" lazy_static = "1.4.0" -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc3", path = "../../primitives/runtime-interface" } -sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } -sc-executor-common = { version = "0.8.0-rc3", path = "common" } -sc-executor-wasmi = { version = "0.8.0-rc3", path = "wasmi" } -sc-executor-wasmtime = { version = "0.8.0-rc3", path = "wasmtime", optional = true } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../../primitives/runtime-interface" } +sp-externalities = { version = "0.8.0-rc4", path = "../../primitives/externalities" } +sc-executor-common = { version = "0.8.0-rc4", path = "common" } +sc-executor-wasmi = { version = "0.8.0-rc4", path = "wasmi" } +sc-executor-wasmtime = { version = "0.8.0-rc4", path = "wasmtime", optional = true } parking_lot = "0.10.0" log = "0.4.8" libsecp256k1 = "0.3.4" @@ -39,13 +39,13 @@ libsecp256k1 = "0.3.4" assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" -sc-runtime-test = { version = "2.0.0-rc3", path = "runtime-test" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-runtime-test = { version = "2.0.0-rc4", path = "runtime-test" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../test-utils/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } test-case = "0.3.3" -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc3", path = "../../primitives/tracing" } -sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc4", path = "../../primitives/tracing" } +sc-tracing = { version = "2.0.0-rc4", path = "../tracing" } tracing = "0.1.14" [features] diff --git a/client/executor/common/Cargo.toml b/client/executor/common/Cargo.toml index a6ff79a067..970fc2ded3 100644 --- a/client/executor/common/Cargo.toml +++ b/client/executor/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-common" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,11 +18,11 @@ derive_more = "0.99.2" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.1" } wasmi = "0.6.2" -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } -sp-serializer = { version = "2.0.0-rc3", path = "../../../primitives/serializer" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc4", path = "../../../primitives/allocator" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../../../primitives/runtime-interface" } +sp-serializer = { version = "2.0.0-rc4", path = "../../../primitives/serializer" } [features] default = [] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index 917df5d573..c01a9428f4 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-runtime-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,12 +13,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/io" } -sp-sandbox = { version = "0.8.0-rc3", default-features = false, path = "../../../primitives/sandbox" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -sp-allocator = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/allocator" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/io" } +sp-sandbox = { version = "0.8.0-rc4", default-features = false, path = "../../../primitives/sandbox" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +sp-allocator = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/allocator" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/client/executor/wasmi/Cargo.toml b/client/executor/wasmi/Cargo.toml index f3c2ee2c67..6f5486a578 100644 --- a/client/executor/wasmi/Cargo.toml +++ b/client/executor/wasmi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmi" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,8 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4.8" wasmi = "0.6.2" codec = { package = "parity-scale-codec", version = "1.3.1" } -sc-executor-common = { version = "0.8.0-rc3", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc4", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc4", path = "../../../primitives/allocator" } diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index 6d008bcee6..26eddd1da6 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-executor-wasmtime" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,11 +16,11 @@ log = "0.4.8" scoped-tls = "1.0" parity-wasm = "0.41.0" codec = { package = "parity-scale-codec", version = "1.3.1" } -sc-executor-common = { version = "0.8.0-rc3", path = "../common" } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../../../primitives/wasm-interface" } -sp-runtime-interface = { version = "2.0.0-rc3", path = "../../../primitives/runtime-interface" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-allocator = { version = "2.0.0-rc3", path = "../../../primitives/allocator" } +sc-executor-common = { version = "0.8.0-rc4", path = "../common" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../../../primitives/wasm-interface" } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../../../primitives/runtime-interface" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-allocator = { version = "2.0.0-rc4", path = "../../../primitives/allocator" } wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.4" } wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.4" } wasmtime-environ = "0.16" diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index 29b9cdaeba..36b1d59b0c 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -fork-tree = { version = "2.0.0-rc3", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc4", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" @@ -23,38 +23,38 @@ parking_lot = "0.10.0" rand = "0.7.2" assert_matches = "1.3.0" parity-scale-codec = { version = "1.3.1", features = ["derive"] } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } -sp-arithmetic = { version = "2.0.0-rc3", path = "../../primitives/arithmetic" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc3", path = "../../client/consensus/common" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } -sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../primitives/application-crypto" } +sp-arithmetic = { version = "2.0.0-rc4", path = "../../primitives/arithmetic" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc4", path = "../../client/consensus/common" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } +sc-keystore = { version = "2.0.0-rc4", path = "../keystore" } serde_json = "1.0.41" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-inherents = { version = "2.0.0-rc3", path = "../../primitives/inherents" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sc-network-gossip = { version = "0.8.0-rc3", path = "../network-gossip" } -sp-finality-tracker = { version = "2.0.0-rc3", path = "../../primitives/finality-tracker" } -sp-finality-grandpa = { version = "2.0.0-rc3", path = "../../primitives/finality-grandpa" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} -sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-inherents = { version = "2.0.0-rc4", path = "../../primitives/inherents" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sc-network-gossip = { version = "0.8.0-rc4", path = "../network-gossip" } +sp-finality-tracker = { version = "2.0.0-rc4", path = "../../primitives/finality-tracker" } +sp-finality-grandpa = { version = "2.0.0-rc4", path = "../../primitives/finality-grandpa" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} +sc-block-builder = { version = "0.8.0-rc4", path = "../block-builder" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } pin-project = "0.4.6" [dev-dependencies] finality-grandpa = { version = "0.12.3", features = ["derive-codec", "test-helpers"] } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sc-network-test = { version = "0.8.0-rc3", path = "../network/test" } -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../primitives/consensus/babe" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sc-network-test = { version = "0.8.0-rc4", path = "../network/test" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../primitives/consensus/babe" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = { version = "0.2", features = ["rt-core"] } tempfile = "3.1.0" -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index d364e47b84..a7d8e64087 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-finality-grandpa-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "RPC extensions for the GRANDPA finality gadget" repository = "https://github.com/paritytech/substrate/" @@ -8,7 +8,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -sc-finality-grandpa = { version = "0.8.0-rc3", path = "../" } +sc-finality-grandpa = { version = "0.8.0-rc4", path = "../" } finality-grandpa = { version = "0.12.3", features = ["derive-codec"] } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" @@ -20,4 +20,4 @@ log = "0.4.8" derive_more = "0.99.2" [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml index 671535933b..d2df78537d 100644 --- a/client/informant/Cargo.toml +++ b/client/informant/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-informant" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Substrate informant." edition = "2018" @@ -17,10 +17,10 @@ futures = "0.3.4" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } wasm-timer = "0.2" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } sp-utils = { version = "2.0.0-rc2", path = "../../primitives/utils" } sp-transaction-pool = { version = "2.0.0-rc2", path = "../../primitives/transaction-pool" } parking_lot = "0.10.2" diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml index 47308dd692..585d3af521 100644 --- a/client/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-keystore" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../primitives/application-crypto" } hex = "0.4.0" merlin = { version = "2.0", default-features = false } parking_lot = "0.10.0" diff --git a/client/light/Cargo.toml b/client/light/Cargo.toml index 490da15364..ced9989c9e 100644 --- a/client/light/Cargo.toml +++ b/client/light/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "components for a light client" name = "sc-light" -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index 334a85035f..51e15e24ce 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Gossiping for the Substrate network protocol" name = "sc-network-gossip" -version = "0.8.0-rc3" +version = "0.8.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -19,12 +19,12 @@ futures-timer = "3.0.1" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" lru = "0.4.3" -sc-network = { version = "0.8.0-rc3", path = "../network" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } wasm-timer = "0.2" [dev-dependencies] async-std = "1.5" quickcheck = "0.9.0" rand = "0.7.2" -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 8467aa1154..f0ba362e48 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate network protocol" name = "sc-network" -version = "0.8.0-rc3" +version = "0.8.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -26,7 +26,7 @@ derive_more = "0.99.2" either = "1.5.3" erased-serde = "0.3.9" fnv = "1.0.6" -fork-tree = { version = "2.0.0-rc3", path = "../../utils/fork-tree" } +fork-tree = { version = "2.0.0-rc4", path = "../../utils/fork-tree" } futures = "0.3.4" futures-timer = "3.0.1" futures_codec = "0.3.3" @@ -39,23 +39,23 @@ lru = "0.4.0" nohash-hasher = "0.2.0" parking_lot = "0.10.0" pin-project = "0.4.6" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc3", path = "../../utils/prometheus" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0-rc4", path = "../../utils/prometheus" } prost = "0.6.1" rand = "0.7.2" -sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sc-peerset = { version = "2.0.0-rc3", path = "../peerset" } +sc-block-builder = { version = "0.8.0-rc4", path = "../block-builder" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sc-peerset = { version = "2.0.0-rc4", path = "../peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -sp-arithmetic = { version = "2.0.0-rc3", path = "../../primitives/arithmetic" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +sp-arithmetic = { version = "2.0.0-rc4", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } thiserror = "1" unsigned-varint = { version = "0.3.1", features = ["futures", "futures-codec"] } void = "1.0.2" @@ -74,10 +74,10 @@ env_logger = "0.7.0" libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -sp-test-primitives = { version = "2.0.0-rc3", path = "../../primitives/test-primitives" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } +sp-test-primitives = { version = "2.0.0-rc4", path = "../../primitives/test-primitives" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } tempfile = "3.1.0" [features] diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 27acabbb22..393887572c 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Integration tests for Substrate network protocol" name = "sc-network-test" -version = "0.8.0-rc3" +version = "0.8.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-network = { version = "0.8.0-rc3", path = "../" } +sc-network = { version = "0.8.0-rc4", path = "../" } log = "0.4.8" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" libp2p = { version = "0.19.1", default-features = false } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../../primitives/consensus/babe" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../block-builder" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../../primitives/consensus/babe" } env_logger = "0.7.0" -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../../test-utils/runtime" } tempfile = "3.1.0" -sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-service = { version = "0.8.0-rc4", default-features = false, features = ["test-helpers"], path = "../../service" } diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 819d6ac3a5..cd5a63a75c 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers" name = "sc-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,23 +13,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bytes = "0.5" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } fnv = "1.0.6" futures = "0.3.4" futures-timer = "3.0.1" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -sp-offchain = { version = "2.0.0-rc3", path = "../../primitives/offchain" } +sp-offchain = { version = "2.0.0-rc4", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } rand = "0.7.2" -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sc-keystore = { version = "2.0.0-rc4", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] hyper = "0.13.2" @@ -37,10 +37,10 @@ hyper-rustls = "0.20" [dev-dependencies] env_logger = "0.7.0" -sc-client-db = { version = "0.8.0-rc3", default-features = true, path = "../db/" } -sc-transaction-pool = { version = "2.0.0-rc3", path = "../../client/transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sc-client-db = { version = "0.8.0-rc4", default-features = true, path = "../db/" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../../client/transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } tokio = "0.2" lazy_static = "1.4.0" diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index 205260ad72..eb7f237548 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -3,7 +3,7 @@ description = "Connectivity manager based on reputation" homepage = "http://parity.io" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" name = "sc-peerset" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" repository = "https://github.com/paritytech/substrate/" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" libp2p = { version = "0.19.1", default-features = false } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils"} +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" wasm-timer = "0.2" diff --git a/client/proposer-metrics/Cargo.toml b/client/proposer-metrics/Cargo.toml index 5c960d1d78..b10336f340 100644 --- a/client/proposer-metrics/Cargo.toml +++ b/client/proposer-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-proposer-metrics" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -13,4 +13,4 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4.8" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index 3e3195b914..a991cf9afa 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-api" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -21,11 +21,11 @@ jsonrpc-derive = "14.2.1" jsonrpc-pubsub = "14.2.0" log = "0.4.8" parking_lot = "0.10.0" -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } -sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc3"} -sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc3"} +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } +sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-rc4"} +sp-chain-spec = { path = "../../primitives/chain-spec" , version = "2.0.0-rc4"} serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -sp-rpc = { version = "2.0.0-rc3", path = "../../primitives/rpc" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +sp-rpc = { version = "2.0.0-rc4", path = "../../primitives/rpc" } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index b1ec04f5e4..155729817d 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc-server" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,7 +17,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.2.0" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.2.0" } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 9cda4451c1..9568a4d44f 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -12,38 +12,38 @@ description = "Substrate Client RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-rpc-api = { version = "0.8.0-rc3", path = "../rpc-api" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } +sc-rpc-api = { version = "0.8.0-rc4", path = "../rpc-api" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.1" } futures = { version = "0.3.1", features = ["compat"] } jsonrpc-pubsub = "14.2.0" log = "0.4.8" -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.2.0" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } serde_json = "1.0.41" -sp-session = { version = "2.0.0-rc3", path = "../../primitives/session" } -sp-offchain = { version = "2.0.0-rc3", path = "../../primitives/offchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sp-rpc = { version = "2.0.0-rc3", path = "../../primitives/rpc" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sp-chain-spec = { version = "2.0.0-rc3", path = "../../primitives/chain-spec" } -sc-executor = { version = "0.8.0-rc3", path = "../executor" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../client/block-builder" } -sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } +sp-session = { version = "2.0.0-rc4", path = "../../primitives/session" } +sp-offchain = { version = "2.0.0-rc4", path = "../../primitives/offchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sp-rpc = { version = "2.0.0-rc4", path = "../../primitives/rpc" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sp-chain-spec = { version = "2.0.0-rc4", path = "../../primitives/chain-spec" } +sc-executor = { version = "0.8.0-rc4", path = "../executor" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../client/block-builder" } +sc-keystore = { version = "2.0.0-rc4", path = "../keystore" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.10.0" [dev-dependencies] assert_matches = "1.3.0" futures01 = { package = "futures", version = "0.1.29" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } tokio = "0.1.22" -sc-transaction-pool = { version = "2.0.0-rc3", path = "../transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../transaction-pool" } lazy_static = "1.4.0" diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 1740e6fad4..f63d3f183d 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -40,39 +40,39 @@ hash-db = "0.15.2" serde = "1.0.101" serde_json = "1.0.41" sysinfo = "0.13.3" -sc-keystore = { version = "2.0.0-rc3", path = "../keystore" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-trie = { version = "2.0.0-rc3", path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-session = { version = "2.0.0-rc3", path = "../../primitives/session" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sc-network = { version = "0.8.0-rc3", path = "../network" } -sc-chain-spec = { version = "2.0.0-rc3", path = "../chain-spec" } -sc-light = { version = "2.0.0-rc3", path = "../light" } -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" } +sc-keystore = { version = "2.0.0-rc4", path = "../keystore" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-trie = { version = "2.0.0-rc4", path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc4", path = "../../primitives/externalities" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-session = { version = "2.0.0-rc4", path = "../../primitives/session" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../primitives/application-crypto" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sc-network = { version = "0.8.0-rc4", path = "../network" } +sc-chain-spec = { version = "2.0.0-rc4", path = "../chain-spec" } +sc-light = { version = "2.0.0-rc4", path = "../light" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sc-client-db = { version = "0.8.0-rc4", default-features = false, path = "../db" } codec = { package = "parity-scale-codec", version = "1.3.1" } -sc-executor = { version = "0.8.0-rc3", path = "../executor" } -sc-transaction-pool = { version = "2.0.0-rc3", path = "../transaction-pool" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -sc-rpc-server = { version = "2.0.0-rc3", path = "../rpc-servers" } -sc-rpc = { version = "2.0.0-rc3", path = "../rpc" } -sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../primitives/block-builder" } +sc-executor = { version = "0.8.0-rc4", path = "../executor" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../transaction-pool" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +sc-rpc-server = { version = "2.0.0-rc4", path = "../rpc-servers" } +sc-rpc = { version = "2.0.0-rc4", path = "../rpc" } +sc-block-builder = { version = "0.8.0-rc4", path = "../block-builder" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../primitives/block-builder" } sc-informant = { version = "0.8.0-rc2", path = "../informant" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } -sc-offchain = { version = "2.0.0-rc3", path = "../offchain" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } +sc-offchain = { version = "2.0.0-rc4", path = "../offchain" } parity-multiaddr = { package = "parity-multiaddr", version = "0.7.3" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc3"} -sc-tracing = { version = "2.0.0-rc3", path = "../tracing" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" , version = "0.8.0-rc4"} +sc-tracing = { version = "2.0.0-rc4", path = "../tracing" } tracing = "0.1.10" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } @@ -88,7 +88,7 @@ tempfile = "3.1.0" directories = "2.0.2" [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } -sp-consensus-babe = { version = "0.8.0-rc3", path = "../../primitives/consensus/babe" } -grandpa = { version = "0.8.0-rc3", package = "sc-finality-grandpa", path = "../finality-grandpa" } -grandpa-primitives = { version = "2.0.0-rc3", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } +sp-consensus-babe = { version = "0.8.0-rc4", path = "../../primitives/consensus/babe" } +grandpa = { version = "0.8.0-rc4", package = "sc-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { version = "2.0.0-rc4", package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" } diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index 7d61e86708..6a886ebcba 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-service-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,25 +20,25 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.4" parking_lot = "0.10.0" -sc-light = { version = "2.0.0-rc3", path = "../../light" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } -sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } -sp-trie = { version = "2.0.0-rc3", path = "../../../primitives/trie" } -sp-storage = { version = "2.0.0-rc3", path = "../../../primitives/storage" } -sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../../db" } +sc-light = { version = "2.0.0-rc4", path = "../../light" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } +sp-externalities = { version = "0.8.0-rc4", path = "../../../primitives/externalities" } +sp-trie = { version = "2.0.0-rc4", path = "../../../primitives/trie" } +sp-storage = { version = "2.0.0-rc4", path = "../../../primitives/storage" } +sc-client-db = { version = "0.8.0-rc4", default-features = false, path = "../../db" } futures = { version = "0.3.1", features = ["compat"] } -sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../service" } -sc-network = { version = "0.8.0-rc3", path = "../../network" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -sc-client-api = { version = "2.0.0-rc3", path = "../../api" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../block-builder" } -sc-executor = { version = "0.8.0-rc3", path = "../../executor" } -sp-panic-handler = { version = "2.0.0-rc3", path = "../../../primitives/panic-handler" } +sc-service = { version = "0.8.0-rc4", default-features = false, features = ["test-helpers"], path = "../../service" } +sc-network = { version = "0.8.0-rc4", path = "../../network" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../../test-utils/runtime" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +sc-client-api = { version = "2.0.0-rc4", path = "../../api" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../block-builder" } +sc-executor = { version = "0.8.0-rc4", path = "../../executor" } +sp-panic-handler = { version = "2.0.0-rc4", path = "../../../primitives/panic-handler" } parity-scale-codec = "1.3.1" diff --git a/client/state-db/Cargo.toml b/client/state-db/Cargo.toml index ee9bbf7273..7cc8d41e76 100644 --- a/client/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-state-db" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = "0.10.0" log = "0.4.8" -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-util-mem-derive = "0.1.0" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index 13a1c81d15..95c430dad7 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-telemetry" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Telemetry utils" edition = "2018" diff --git a/client/tracing/Cargo.toml b/client/tracing/Cargo.toml index c4345648ef..c4564e5fe5 100644 --- a/client/tracing/Cargo.toml +++ b/client/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -22,7 +22,7 @@ slog = { version = "2.5.2", features = ["nested-values"] } tracing-core = "0.1.7" sp-tracing = { version = "2.0.0-rc2", path = "../../primitives/tracing" } -sc-telemetry = { version = "2.0.0-rc3", path = "../telemetry" } +sc-telemetry = { version = "2.0.0-rc4", path = "../telemetry" } [dev-dependencies] tracing = "0.1.10" diff --git a/client/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml index e837f40a34..bd271d8ba1 100644 --- a/client/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -20,23 +20,23 @@ intervalier = "0.4.0" log = "0.4.8" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parking_lot = "0.10.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc3"} -sc-client-api = { version = "2.0.0-rc3", path = "../api" } -sc-transaction-graph = { version = "2.0.0-rc3", path = "./graph" } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc3", path = "../../primitives/tracing" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../primitives/transaction-pool" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc3", path = "../../primitives/utils" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} +sc-client-api = { version = "2.0.0-rc4", path = "../api" } +sc-transaction-graph = { version = "2.0.0-rc4", path = "./graph" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc4", path = "../../primitives/tracing" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils" } wasm-timer = "0.2" [dev-dependencies] assert_matches = "1.3.0" hex = "0.4" -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -substrate-test-runtime-transaction-pool = { version = "2.0.0-rc3", path = "../../test-utils/runtime/transaction-pool" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } -sc-block-builder = { version = "0.8.0-rc3", path = "../block-builder" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +substrate-test-runtime-transaction-pool = { version = "2.0.0-rc4", path = "../../test-utils/runtime/transaction-pool" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } +sc-block-builder = { version = "0.8.0-rc4", path = "../block-builder" } diff --git a/client/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml index cb16af0f53..0a30b3a4c9 100644 --- a/client/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-transaction-graph" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -18,18 +18,18 @@ log = "0.4.8" parking_lot = "0.10.0" serde = { version = "1.0.101", features = ["derive"] } wasm-timer = "0.2" -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-utils = { version = "2.0.0-rc3", path = "../../../primitives/utils" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-utils = { version = "2.0.0-rc4", path = "../../../primitives/utils" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } linked-hash-map = "0.5.2" [dev-dependencies] assert_matches = "1.3.0" codec = { package = "parity-scale-codec", version = "1.3.1" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../../test-utils/runtime" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../../test-utils/runtime" } criterion = "0.3" [[bench]] diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6f55839881..78fc85acc6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,60 @@ The format is based on [Keep a Changelog]. ## Unreleased +## 2.0.0-rc3 -> 2.0.0-rc4 (Rhinoceros) + +Runtime +------- + +* Staking Payout Creates Controller (#6496) +* `pallet-scheduler`: Check that `when` is not in the past (#6480) +* Fix `sp-api` handling of multiple arguments (#6484) +* Fix issues with `Operational` transactions validity and prioritization. (#6435) +* pallet-atomic-swap: generialized swap action (#6421) +* Avoid multisig reentrancy (#6445) +* Root origin use no filter by default. Scheduler and Democracy dispatch without asserting BaseCallFilter (#6408) +* Scale and increase validator count (#6417) +* Pallet: Atomic Swap (#6349) +* Restrict remove_proxies (#6383) +* Stored call in multisig (#6319) +* Allow Sudo to do anything (#6375) +* vesting: Force Vested Transfer (#6368) +* Add events for balance reserve and unreserve functions (#6330) +* Introduce frozen indices. (#6307) + +Client +------ + +* client/network/service: Add primary dimension to connection metrics (#6472) +* Fix Babe secondary plain slots claiming (#6451) +* add network propagated metrics (#6438) +* client/authority-discovery: Compare PeerIds and not Multihashes (#6414) +* Update sync chain info on own block import (#6424) +* Remove --legacy-network-protocol CLI flag (#6411) +* Runtime interface to add support for tracing from wasm (#6381) +* Remove penalty on duplicate Status message (#6377) +* Fix the broken weight multiplier update function (#6334) +* client/authority-discovery: Don't add own address to priority group (#6370) +* Split the service initialisation up into seperate functions (#6332) +* Fix transaction pool event sending (#6341) +* Add a [prefix]_process_start_time_seconds metric (#6315) +* new crate sc-light (#6235) +* Allow adding a prefix to the informant (#6174) + +API +--- + +* seal: Remove ext_dispatch_call and ext_get_runtime_storage (#6464) +* seal: Refactor ext_gas_price (#6478) +* Implement nested storage transactions (#6269) +* Allow empty values in the storage (#6364) +* add system_dryRun (#6300) +* Introduce in-origin filtering (#6318) +* add extend_lock for StorageLock (#6323) +* Deprecate FunctionOf and remove its users (#6340) +* transaction-pool: expose blocking api for tx submission (#6325) + + ## 2.0.0-rc2 -> 2.0.0-rc3 Runtime diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index 33882671a4..4deb7b8a9b 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } # Needed for type-safe access to storage DB. -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml index ce32d8b783..829c40b675 100644 --- a/frame/atomic-swap/Cargo.toml +++ b/frame/atomic-swap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-atomic-swap" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index 5a60d23270..a648be5f10 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-aura" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,23 +12,23 @@ description = "FRAME AURA consensus pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -sp-consensus-aura = { version = "0.8.0-rc3", path = "../../primitives/consensus/aura", default-features = false } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../session" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +sp-consensus-aura = { version = "0.8.0-rc4", path = "../../primitives/consensus/aura", default-features = false } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/timestamp" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../timestamp" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } lazy_static = "1.4.0" parking_lot = "0.10.0" diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index e3c7a256a9..3270437ce8 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authority-discovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME pallet for authority discovery" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-authority-discovery = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authority-discovery" } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-authority-discovery = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/authority-discovery" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc3", features = ["historical" ], path = "../session", default-features = false } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc4", features = ["historical" ], path = "../session", default-features = false } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } [features] default = ["std"] diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index 9cc25b075d..08114eb401 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-authorship" -version = "2.0.0-rc3" +version = "2.0.0-rc4" description = "Block and Uncle Author tracking for the FRAME" authors = ["Parity Technologies "] edition = "2018" @@ -13,17 +13,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-authorship = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/authorship" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-authorship = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/authorship" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 5e9dcf7fb5..845acce5f2 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-babe" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,22 +14,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } -sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/vrf" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../timestamp" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/timestamp" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../session" } +sp-consensus-babe = { version = "0.8.0-rc4", default-features = false, path = "../../primitives/consensus/babe" } +sp-consensus-vrf = { version = "0.8.0-rc4", default-features = false, path = "../../primitives/consensus/vrf" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 02b5732e00..88c8657d47 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../transaction-payment" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../transaction-payment" } [features] default = ["std"] diff --git a/frame/benchmark/Cargo.toml b/frame/benchmark/Cargo.toml index 2821d52f5b..79d9a8d771 100644 --- a/frame/benchmark/Cargo.toml +++ b/frame/benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-benchmark" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,12 +14,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std"] diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index 5c6306ebbb..0823ec626c 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] linregress = "0.1" paste = "0.1" codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-api = { version = "2.0.0-rc3", path = "../../primitives/api", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc3", path = "../../primitives/runtime-interface", default-features = false } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime", default-features = false } -sp-std = { version = "2.0.0-rc3", path = "../../primitives/std", default-features = false } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-api = { version = "2.0.0-rc4", path = "../../primitives/api", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../../primitives/runtime-interface", default-features = false } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "2.0.0-rc4", path = "../../primitives/std", default-features = false } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io", default-features = false } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [features] default = [ "std" ] diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index 5517f3b03f..c1b2f01089 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-collective" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 2dee486fcf..348b8ff0e0 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ pwasm-utils = { version = "0.12.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } parity-wasm = { version = "0.41.0", default-features = false } wasmi-validation = { version = "0.3.0", default-features = false } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-sandbox = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/sandbox" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "common" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-sandbox = { version = "0.8.0-rc4", default-features = false, path = "../../primitives/sandbox" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-contracts-primitives = { version = "2.0.0-rc4", default-features = false, path = "common" } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" pretty_assertions = "0.6.1" -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } -pallet-randomness-collective-flip = { version = "2.0.0-rc3", path = "../randomness-collective-flip" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../timestamp" } +pallet-randomness-collective-flip = { version = "2.0.0-rc4", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/frame/contracts/common/Cargo.toml b/frame/contracts/common/Cargo.toml index 520b723933..e6e2bc653a 100644 --- a/frame/contracts/common/Cargo.toml +++ b/frame/contracts/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # This crate should not rely on any of the frame primitives. codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } [features] default = ["std"] diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index 75dc1bf3fb..35989a3490 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,14 +16,14 @@ codec = { package = "parity-scale-codec", version = "1.3.1" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc3", path = "../../../primitives/rpc" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc4", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -pallet-contracts-primitives = { version = "2.0.0-rc3", path = "../common" } -pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc3", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +pallet-contracts-primitives = { version = "2.0.0-rc4", path = "../common" } +pallet-contracts-rpc-runtime-api = { version = "0.8.0-rc4", path = "./runtime-api" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/contracts/rpc/runtime-api/Cargo.toml b/frame/contracts/rpc/runtime-api/Cargo.toml index 3596677316..e97003c44d 100644 --- a/frame/contracts/rpc/runtime-api/Cargo.toml +++ b/frame/contracts/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Runtime API definition required by Contracts RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } -pallet-contracts-primitives = { version = "2.0.0-rc3", default-features = false, path = "../../common" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/runtime" } +pallet-contracts-primitives = { version = "2.0.0-rc4", default-features = false, path = "../../common" } [features] default = ["std"] diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index fea378caca..9532be0e8e 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-scheduler = { version = "2.0.0-rc3", path = "../scheduler" } -sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } -substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-scheduler = { version = "2.0.0-rc4", path = "../scheduler" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } +substrate-test-utils = { version = "2.0.0-rc4", path = "../../test-utils" } hex-literal = "0.2.1" [features] diff --git a/frame/elections-phragmen/Cargo.toml b/frame/elections-phragmen/Cargo.toml index 08cdc5a98e..afbd53d3da 100644 --- a/frame/elections-phragmen/Cargo.toml +++ b/frame/elections-phragmen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections-phragmen" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-npos-elections = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/npos-elections" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +substrate-test-utils = { version = "2.0.0-rc4", path = "../../test-utils" } [features] default = ["std"] diff --git a/frame/elections/Cargo.toml b/frame/elections/Cargo.toml index d03ad4f056..b7914d66fd 100644 --- a/frame/elections/Cargo.toml +++ b/frame/elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-elections" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] hex-literal = "0.2.1" -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 1a6d691cde..8b030be4b7 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-evm" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../timestamp" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../balances" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } primitive-types = { version = "0.7.0", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.16", default-features = false } diff --git a/frame/example-offchain-worker/Cargo.toml b/frame/example-offchain-worker/Cargo.toml index f93ffcf9e4..50d398a512 100644 --- a/frame/example-offchain-worker/Cargo.toml +++ b/frame/example-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example-offchain-worker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -13,13 +13,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } lite-json = { version = "0.1", default-features = false } [features] diff --git a/frame/example/Cargo.toml b/frame/example/Cargo.toml index 597f2266c3..cf09a3d4b2 100644 --- a/frame/example/Cargo.toml +++ b/frame/example/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-example" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../balances" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index a922333eb9..52225d9824 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-executive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/tracing" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/tracing" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } [dev-dependencies] hex-literal = "0.2.1" -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } -pallet-indices = { version = "2.0.0-rc3", path = "../indices" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-transaction-payment = { version = "2.0.0-rc3", path = "../transaction-payment" } -sp-version = { version = "2.0.0-rc3", path = "../../primitives/version" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } +pallet-indices = { version = "2.0.0-rc4", path = "../indices" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-transaction-payment = { version = "2.0.0-rc4", path = "../transaction-payment" } +sp-version = { version = "2.0.0-rc4", path = "../../primitives/version" } [features] default = ["std"] diff --git a/frame/finality-tracker/Cargo.toml b/frame/finality-tracker/Cargo.toml index 497f4fdec7..f9922af84e 100644 --- a/frame/finality-tracker/Cargo.toml +++ b/frame/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-tracker" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/finality-tracker" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/generic-asset/Cargo.toml b/frame/generic-asset/Cargo.toml index cdac7a6d6d..f39a458378 100644 --- a/frame/generic-asset/Cargo.toml +++ b/frame/generic-asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-generic-asset" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Centrality Developers "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 1ec939c9bd..0f2477d50e 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,27 +14,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } -sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } -pallet-finality-tracker = { version = "2.0.0-rc3", default-features = false, path = "../finality-tracker" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-finality-grandpa = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/finality-grandpa" } +sp-session = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/session" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../session" } +pallet-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../finality-tracker" } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.12.3", features = ["derive-codec"] } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-offences = { version = "2.0.0-rc3", path = "../offences" } -pallet-staking = { version = "2.0.0-rc3", path = "../staking" } -pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-offences = { version = "2.0.0-rc4", path = "../offences" } +pallet-staking = { version = "2.0.0-rc4", path = "../staking" } +pallet-staking-reward-curve = { version = "2.0.0-rc4", path = "../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../timestamp" } [features] default = ["std"] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 0435d8c086..8dcfd5bd2d 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,16 +15,16 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index 2f89ff2cb2..7324342ec8 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-im-online" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,20 +12,20 @@ description = "FRAME's I'm online pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } +pallet-authorship = { version = "2.0.0-rc4", default-features = false, path = "../authorship" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../session" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../session" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [features] default = ["std", "pallet-session/historical"] diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index 2c856064e7..3ec8ea363b 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-indices" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-keyring = { version = "2.0.0-rc4", optional = true, path = "../../primitives/keyring" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index e0c94da308..5df5d4ad6e 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-membership" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/metadata/Cargo.toml b/frame/metadata/Cargo.toml index a8fb9eae5f..ae9cf736e9 100644 --- a/frame/metadata/Cargo.toml +++ b/frame/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-metadata" -version = "11.0.0-rc3" +version = "11.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml index 44ea4dc3e9..d0b79bf4e3 100644 --- a/frame/multisig/Cargo.toml +++ b/frame/multisig/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-multisig" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 544a0dc734..143e5b198e 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-nicks" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index 0b8b74c4a9..74487ba163 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ description = "FRAME offences pallet" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../balances" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } serde = { version = "1.0.101", optional = true } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/offences/benchmarking/Cargo.toml b/frame/offences/benchmarking/Cargo.toml index ad8520484e..b942a98baa 100644 --- a/frame/offences/benchmarking/Cargo.toml +++ b/frame/offences/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offences-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,27 +13,27 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } -pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../babe" } -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../../balances" } -pallet-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../grandpa" } -pallet-im-online = { version = "2.0.0-rc3", default-features = false, path = "../../im-online" } -pallet-offences = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../../session" } -pallet-staking = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/staking" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../system" } +pallet-babe = { version = "2.0.0-rc4", default-features = false, path = "../../babe" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../../balances" } +pallet-grandpa = { version = "2.0.0-rc4", default-features = false, path = "../../grandpa" } +pallet-im-online = { version = "2.0.0-rc4", default-features = false, path = "../../im-online" } +pallet-offences = { version = "2.0.0-rc4", default-features = false, features = ["runtime-benchmarks"], path = "../../offences" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../../session" } +pallet-staking = { version = "2.0.0-rc4", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/staking" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } [dev-dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } -pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc4", path = "../../staking/reward-curve" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../../timestamp" } serde = { version = "1.0.101" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-io = { version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index 215f362cc8..07e2abac31 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-proxy" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-utility = { version = "2.0.0-rc3", path = "../utility" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-utility = { version = "2.0.0-rc4", path = "../utility" } [features] default = ["std"] diff --git a/frame/randomness-collective-flip/Cargo.toml b/frame/randomness-collective-flip/Cargo.toml index 7e64539491..64324bc8c5 100644 --- a/frame/randomness-collective-flip/Cargo.toml +++ b/frame/randomness-collective-flip/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] safe-mix = { version = "1.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } [features] default = ["std"] diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 33f7b5e521..63f4d4dcdd 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-recovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 7db67bb3c1..43507bd364 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scheduler" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Unlicense" @@ -11,16 +11,16 @@ description = "FRAME example pallet" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core", default-features = false } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core", default-features = false } [features] default = ["std"] diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index d1e0a5d62e..05fc56fc65 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-scored-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index 38eef24bc6..c882df7115 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,20 +14,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../timestamp" } -sp-trie = { version = "2.0.0-rc3", optional = true, default-features = false, path = "../../primitives/trie" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-session = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/session" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../timestamp" } +sp-trie = { version = "2.0.0-rc4", optional = true, default-features = false, path = "../../primitives/trie" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../../primitives/application-crypto" } lazy_static = "1.4.0" [features] diff --git a/frame/session/benchmarking/Cargo.toml b/frame/session/benchmarking/Cargo.toml index b2c70c28d1..391b80237e 100644 --- a/frame/session/benchmarking/Cargo.toml +++ b/frame/session/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-session-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ description = "FRAME sessions pallet benchmarking" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } -pallet-staking = { version = "2.0.0-rc3", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } -pallet-session = { version = "2.0.0-rc3", default-features = false, path = "../../session" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../system" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../../benchmarking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../support" } +pallet-staking = { version = "2.0.0-rc4", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" } +pallet-session = { version = "2.0.0-rc4", default-features = false, path = "../../session" } [dev-dependencies] serde = { version = "1.0.101" } codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../../staking/reward-curve" } -sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } -pallet-balances = { version = "2.0.0-rc3", path = "../../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +pallet-staking-reward-curve = { version = "2.0.0-rc4", path = "../../staking/reward-curve" } +sp-io ={ version = "2.0.0-rc4", path = "../../../primitives/io" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../../timestamp" } +pallet-balances = { version = "2.0.0-rc4", path = "../../balances" } [features] default = ["std"] diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index eb28046d3f..67c4c32966 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-society" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,16 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } rand_chacha = { version = "0.2", default-features = false } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 45b2b42d97..144095cfa9 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,29 +15,29 @@ targets = ["x86_64-unknown-linux-gnu"] static_assertions = "1.1.0" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-npos-elections = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/npos-elections" } -sp-io ={ version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/staking" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-session = { version = "2.0.0-rc3", default-features = false, features = ["historical"], path = "../session" } -pallet-authorship = { version = "2.0.0-rc3", default-features = false, path = "../authorship" } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-npos-elections = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/npos-elections" } +sp-io ={ version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/staking" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-session = { version = "2.0.0-rc4", default-features = false, features = ["historical"], path = "../session" } +pallet-authorship = { version = "2.0.0-rc4", default-features = false, path = "../authorship" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } # Optional imports for benchmarking -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../timestamp" } -pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../staking/reward-curve" } -substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } -frame-benchmarking = { version = "2.0.0-rc3", path = "../benchmarking" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../timestamp" } +pallet-staking-reward-curve = { version = "2.0.0-rc4", path = "../staking/reward-curve" } +substrate-test-utils = { version = "2.0.0-rc4", path = "../../test-utils" } +frame-benchmarking = { version = "2.0.0-rc4", path = "../benchmarking" } rand_chacha = { version = "0.2" } parking_lot = "0.10.2" env_logger = "0.7.1" diff --git a/frame/staking/fuzzer/Cargo.toml b/frame/staking/fuzzer/Cargo.toml index 97d79ecad5..5cd0ae1180 100644 --- a/frame/staking/fuzzer/Cargo.toml +++ b/frame/staking/fuzzer/Cargo.toml @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] honggfuzz = "0.5" codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -pallet-staking = { version = "2.0.0-rc3", path = "..", features = ["runtime-benchmarks"] } -pallet-staking-reward-curve = { version = "2.0.0-rc3", path = "../reward-curve" } -pallet-session = { version = "2.0.0-rc3", path = "../../session" } -pallet-indices = { version = "2.0.0-rc3", path = "../../indices" } -pallet-balances = { version = "2.0.0-rc3", path = "../../balances" } -pallet-timestamp = { version = "2.0.0-rc3", path = "../../timestamp" } -frame-system = { version = "2.0.0-rc3", path = "../../system" } -frame-support = { version = "2.0.0-rc3", path = "../../support" } -sp-std = { version = "2.0.0-rc3", path = "../../../primitives/std" } -sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-npos-elections = { version = "2.0.0-rc3", path = "../../../primitives/npos-elections" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +pallet-staking = { version = "2.0.0-rc4", path = "..", features = ["runtime-benchmarks"] } +pallet-staking-reward-curve = { version = "2.0.0-rc4", path = "../reward-curve" } +pallet-session = { version = "2.0.0-rc4", path = "../../session" } +pallet-indices = { version = "2.0.0-rc4", path = "../../indices" } +pallet-balances = { version = "2.0.0-rc4", path = "../../balances" } +pallet-timestamp = { version = "2.0.0-rc4", path = "../../timestamp" } +frame-system = { version = "2.0.0-rc4", path = "../../system" } +frame-support = { version = "2.0.0-rc4", path = "../../support" } +sp-std = { version = "2.0.0-rc4", path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-rc4", path = "../../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-npos-elections = { version = "2.0.0-rc4", path = "../../../primitives/npos-elections" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } [[bin]] name = "submit_solution" diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index db4241b182..3d677c7456 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-staking-reward-curve" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -21,4 +21,4 @@ proc-macro2 = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index 1bdd2aab69..8bb5499770 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-sudo" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index e648eaf32d..596faf2639 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,25 +15,25 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -frame-metadata = { version = "11.0.0-rc3", default-features = false, path = "../metadata" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/tracing" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/arithmetic" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -frame-support-procedural = { version = "2.0.0-rc3", path = "./procedural" } +frame-metadata = { version = "11.0.0-rc4", default-features = false, path = "../metadata" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-tracing = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/tracing" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-arithmetic = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/arithmetic" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +frame-support-procedural = { version = "2.0.0-rc4", path = "./procedural" } paste = "0.1.6" once_cell = { version = "1", default-features = false, optional = true } -sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc4", optional = true, path = "../../primitives/state-machine" } bitmask = { version = "0.5.0", default-features = false } impl-trait-for-tuples = "0.1.3" smallvec = "1.4.0" [dev-dependencies] pretty_assertions = "0.6.1" -frame-system = { version = "2.0.0-rc3", path = "../system" } +frame-system = { version = "2.0.0-rc4", path = "../system" } [features] default = ["std"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 4e09aec190..593b2a1635 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -frame-support-procedural-tools = { version = "2.0.0-rc3", path = "./tools" } +frame-support-procedural-tools = { version = "2.0.0-rc4", path = "./tools" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full"] } diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index 0f9faa899e..a00dd97a66 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Proc macro helpers for procedural macros" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support-procedural-tools-derive = { version = "2.0.0-rc3", path = "./derive" } +frame-support-procedural-tools-derive = { version = "2.0.0-rc4", path = "./derive" } proc-macro2 = "1.0.6" quote = "1.0.3" syn = { version = "1.0.7", features = ["full", "visit"] } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index 191c27796b..3da66cf692 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index d6e7d7d633..682001564b 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-support-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,13 +14,13 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io", default-features = false } -sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../../primitives/state-machine" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/inherents" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } +sp-io ={ version = "2.0.0-rc4", path = "../../../primitives/io", default-features = false } +sp-state-machine = { version = "0.8.0-rc4", optional = true, path = "../../../primitives/state-machine" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/inherents" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } trybuild = "1.0.17" pretty_assertions = "0.6.1" rustversion = "1.0.0" diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index af3288a907..2173ea8cee 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io", default-features = false } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/version" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] criterion = "0.2.11" -sp-externalities = { version = "0.8.0-rc3", path = "../../primitives/externalities" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../test-utils/runtime/client" } +sp-externalities = { version = "0.8.0-rc4", path = "../../primitives/externalities" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../test-utils/runtime/client" } [features] default = ["std"] diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index b1636c21e5..c278bad150 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/runtime" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../../benchmarking" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../system" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../support" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/runtime" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../../benchmarking" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../system" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../support" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/core" } [dev-dependencies] serde = { version = "1.0.101" } -sp-io ={ version = "2.0.0-rc3", path = "../../../primitives/io" } +sp-io ={ version = "2.0.0-rc4", path = "../../../primitives/io" } [features] default = ["std"] diff --git a/frame/system/rpc/runtime-api/Cargo.toml b/frame/system/rpc/runtime-api/Cargo.toml index d919fd1b58..8d340ad7de 100644 --- a/frame/system/rpc/runtime-api/Cargo.toml +++ b/frame/system/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "Runtime API definition required by System RPC extensions." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } [features] diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 7d08164bdd..2c2ad68b96 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,19 +16,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io", optional = true } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/timestamp" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io", optional = true } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/timestamp" } impl-trait-for-tuples = "0.1.3" [dev-dependencies] -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index f7a15d962b..c1409c2675 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "./rpc/runtime-api" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc4", default-features = false, path = "./rpc/runtime-api" } smallvec = "1.4.0" [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index 22be6e700b..f26f604471 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,10 +16,10 @@ codec = { package = "parity-scale-codec", version = "1.3.1" } jsonrpc-core = "14.2.0" jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sp-rpc = { version = "2.0.0-rc3", path = "../../../primitives/rpc" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-rpc = { version = "2.0.0-rc4", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc3", path = "./runtime-api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc4", path = "./runtime-api" } diff --git a/frame/transaction-payment/rpc/runtime-api/Cargo.toml b/frame/transaction-payment/rpc/runtime-api/Cargo.toml index e63b94cb4b..2cd9977704 100644 --- a/frame/transaction-payment/rpc/runtime-api/Cargo.toml +++ b/frame/transaction-payment/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/api" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/api" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../../support" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../../support" } [dev-dependencies] serde_json = "1.0.41" diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 338a6f1dec..28f972d458 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-treasury" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -pallet-balances = { version = "2.0.0-rc3", default-features = false, path = "../balances" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +pallet-balances = { version = "2.0.0-rc4", default-features = false, path = "../balances" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io ={ version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } +sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } [features] default = ["std"] diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index f14274d709..e4dbfdfff7 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-utility" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } [features] default = ["std"] diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index a98a59acef..aa5f0731f2 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } enumflags2 = { version = "0.6.2" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../support" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../system" } -frame-benchmarking = { version = "2.0.0-rc3", default-features = false, path = "../benchmarking", optional = true } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../support" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" } +frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = "../benchmarking", optional = true } [dev-dependencies] -sp-io = { version = "2.0.0-rc3", path = "../../primitives/io" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -pallet-balances = { version = "2.0.0-rc3", path = "../balances" } -sp-storage = { version = "2.0.0-rc3", path = "../../primitives/storage" } +sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +pallet-balances = { version = "2.0.0-rc4", path = "../balances" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } hex-literal = "0.2.1" [features] diff --git a/primitives/allocator/Cargo.toml b/primitives/allocator/Cargo.toml index 872695758a..ba0aed9387 100644 --- a/primitives/allocator/Cargo.toml +++ b/primitives/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-allocator" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/sp-allocator" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc3", path = "../std", default-features = false } -sp-core = { version = "2.0.0-rc3", path = "../core", default-features = false } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc4", path = "../std", default-features = false } +sp-core = { version = "2.0.0-rc4", path = "../core", default-features = false } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../wasm-interface", default-features = false } log = { version = "0.4.8", optional = true } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index 46bd9164ac..8fe0a6d910 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,16 +13,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-api-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../version" } -sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } +sp-api-proc-macro = { version = "2.0.0-rc4", path = "proc-macro" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../version" } +sp-state-machine = { version = "0.8.0-rc4", optional = true, path = "../../primitives/state-machine" } hash-db = { version = "0.15.2", optional = true } [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc3", path = "../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc4", path = "../test-primitives" } [features] default = [ "std" ] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index 8f5e851fa6..fb426fde88 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index 04181d93f0..cf8f0ce47e 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-api-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,22 +12,22 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc3", path = "../" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -sp-version = { version = "2.0.0-rc3", path = "../../version" } -sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../blockchain" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } +sp-api = { version = "2.0.0-rc4", path = "../" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +sp-version = { version = "2.0.0-rc4", path = "../../version" } +sp-runtime = { version = "2.0.0-rc4", path = "../../runtime" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../blockchain" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.1" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } trybuild = "1.0.17" rustversion = "1.0.0" [dev-dependencies] criterion = "0.3.0" -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -sp-core = { version = "2.0.0-rc3", path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +sp-core = { version = "2.0.0-rc4", path = "../../core" } [[bench]] name = "bench" diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index 29f385a54a..8e9c922509 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" description = "Provides facilities for generating application specific crypto wrapper types." @@ -14,11 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } [features] default = [ "std" ] diff --git a/primitives/application-crypto/test/Cargo.toml b/primitives/application-crypto/test/Cargo.toml index 55148f7af2..d3b336d92a 100644 --- a/primitives/application-crypto/test/Cargo.toml +++ b/primitives/application-crypto/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-application-crypto-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" description = "Integration tests for application-crypto" @@ -13,8 +13,8 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../test-utils/runtime/client" } -sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../api" } -sp-application-crypto = { version = "2.0.0-rc3", path = "../" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../core" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../test-utils/runtime/client" } +sp-runtime = { version = "2.0.0-rc4", path = "../../runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../api" } +sp-application-crypto = { version = "2.0.0-rc4", path = "../" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index b4c655c968..c3bef60d1a 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-debug-derive = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/debug-derive" } +sp-debug-derive = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/debug-derive" } [dev-dependencies] rand = "0.7.2" diff --git a/primitives/arithmetic/fuzzer/Cargo.toml b/primitives/arithmetic/fuzzer/Cargo.toml index b6bbe3d8a6..c7e5485a19 100644 --- a/primitives/arithmetic/fuzzer/Cargo.toml +++ b/primitives/arithmetic/fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-arithmetic-fuzzer" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-arithmetic = { version = "2.0.0-rc3", path = ".." } +sp-arithmetic = { version = "2.0.0-rc4", path = ".." } honggfuzz = "0.5.49" primitive-types = "0.7.0" num-bigint = "0.2" diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index 584aef986a..79b8a832fb 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authority-discovery" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Authority discovery primitives" edition = "2018" @@ -12,11 +12,11 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", default-features = false, version = "1.3.1" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/authorship/Cargo.toml b/primitives/authorship/Cargo.toml index eb52ca3e0c..1c44b9aad7 100644 --- a/primitives/authorship/Cargo.toml +++ b/primitives/authorship/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-authorship" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Authorship primitives" edition = "2018" @@ -12,9 +12,9 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../inherents" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] diff --git a/primitives/block-builder/Cargo.toml b/primitives/block-builder/Cargo.toml index 8f8976949d..2b594640fd 100644 --- a/primitives/block-builder/Cargo.toml +++ b/primitives/block-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-block-builder" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "The block builder runtime api." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../inherents" } [features] default = [ "std" ] diff --git a/primitives/blockchain/Cargo.toml b/primitives/blockchain/Cargo.toml index b4c22a524a..956ae1a8fc 100644 --- a/primitives/blockchain/Cargo.toml +++ b/primitives/blockchain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-blockchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -18,7 +18,7 @@ lru = "0.4.0" parking_lot = "0.10.0" derive_more = "0.99.2" codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-consensus = { version = "0.8.0-rc3", path = "../consensus/common" } -sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } -sp-block-builder = { version = "2.0.0-rc3", path = "../block-builder" } -sp-state-machine = { version = "0.8.0-rc3", path = "../state-machine" } +sp-consensus = { version = "0.8.0-rc4", path = "../consensus/common" } +sp-runtime = { version = "2.0.0-rc4", path = "../runtime" } +sp-block-builder = { version = "2.0.0-rc4", path = "../block-builder" } +sp-state-machine = { version = "0.8.0-rc4", path = "../state-machine" } diff --git a/primitives/chain-spec/Cargo.toml b/primitives/chain-spec/Cargo.toml index 2ad9199d86..e091a59245 100644 --- a/primitives/chain-spec/Cargo.toml +++ b/primitives/chain-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-chain-spec" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index 24b82f4642..10c7f5a2de 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,13 +12,13 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../inherents" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../api" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../runtime" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../inherents" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 978b415dc5..3649230468 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-babe" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Primitives for BABE consensus" edition = "2018" @@ -12,17 +12,17 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } merlin = { version = "2.0", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } -sp-consensus = { version = "0.8.0-rc3", optional = true, path = "../common" } -sp-consensus-vrf = { version = "0.8.0-rc3", path = "../vrf", default-features = false } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../inherents" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } -sp-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../timestamp" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../std" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../api" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../core" } +sp-consensus = { version = "0.8.0-rc4", optional = true, path = "../common" } +sp-consensus-vrf = { version = "0.8.0-rc4", path = "../vrf", default-features = false } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../inherents" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../runtime" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../timestamp" } [features] default = ["std"] diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index 26fea37045..eff425e440 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,23 +17,23 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" libp2p = { version = "0.19.1", default-features = false } log = "0.4.8" -sp-core = { path= "../../core", version = "2.0.0-rc3"} -sp-inherents = { version = "2.0.0-rc3", path = "../../inherents" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +sp-core = { path= "../../core", version = "2.0.0-rc4"} +sp-inherents = { version = "2.0.0-rc4", path = "../../inherents" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "3.0.1" -sp-std = { version = "2.0.0-rc3", path = "../../std" } -sp-version = { version = "2.0.0-rc3", path = "../../version" } -sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } -sp-utils = { version = "2.0.0-rc3", path = "../../utils" } +sp-std = { version = "2.0.0-rc4", path = "../../std" } +sp-version = { version = "2.0.0-rc4", path = "../../version" } +sp-runtime = { version = "2.0.0-rc4", path = "../../runtime" } +sp-utils = { version = "2.0.0-rc4", path = "../../utils" } codec = { package = "parity-scale-codec", version = "1.3.1", features = ["derive"] } parking_lot = "0.10.0" serde = { version = "1.0", features = ["derive"] } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc3"} +prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc4"} wasm-timer = "0.2.4" [dev-dependencies] -sp-test-primitives = { version = "2.0.0-rc3", path = "../../test-primitives" } +sp-test-primitives = { version = "2.0.0-rc4", path = "../../test-primitives" } [features] default = [] diff --git a/primitives/consensus/pow/Cargo.toml b/primitives/consensus/pow/Cargo.toml index 9f9fedb76c..5e031235dc 100644 --- a/primitives/consensus/pow/Cargo.toml +++ b/primitives/consensus/pow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-pow" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Primitives for Aura consensus" edition = "2018" @@ -12,10 +12,10 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../api" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../api" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../runtime" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../core" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index 96006fc14c..3c89c05bb1 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-consensus-vrf" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Primitives for VRF based consensus" edition = "2018" @@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { version = "1.0.0", package = "parity-scale-codec", default-features = false } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } -sp-std = { version = "2.0.0-rc3", path = "../../std", default-features = false } -sp-core = { version = "2.0.0-rc3", path = "../../core", default-features = false } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../runtime" } +sp-std = { version = "2.0.0-rc4", path = "../../std", default-features = false } +sp-core = { version = "2.0.0-rc4", path = "../../core", default-features = false } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../runtime" } [features] default = ["std"] diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 3c37f57e70..33b4a7bc82 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-core" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } log = { version = "0.4.8", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } @@ -33,9 +33,9 @@ num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } -sp-debug-derive = { version = "2.0.0-rc3", path = "../debug-derive" } -sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } -sp-storage = { version = "2.0.0-rc3", default-features = false, path = "../storage" } +sp-debug-derive = { version = "2.0.0-rc4", path = "../debug-derive" } +sp-externalities = { version = "0.8.0-rc4", optional = true, path = "../externalities" } +sp-storage = { version = "2.0.0-rc4", default-features = false, path = "../storage" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } futures = { version = "0.3.1", optional = true } @@ -50,10 +50,10 @@ twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } merlin = { version = "2.0", default-features = false, optional = true } -sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../runtime-interface" } +sp-runtime-interface = { version = "2.0.0-rc4", default-features = false, path = "../runtime-interface" } [dev-dependencies] -sp-serializer = { version = "2.0.0-rc3", path = "../serializer" } +sp-serializer = { version = "2.0.0-rc4", path = "../serializer" } pretty_assertions = "0.6.1" hex-literal = "0.2.1" rand = "0.7.2" diff --git a/primitives/database/Cargo.toml b/primitives/database/Cargo.toml index 0b85975fed..41ced29a57 100644 --- a/primitives/database/Cargo.toml +++ b/primitives/database/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-database" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index bf58ddfd8f..fd63abcfa7 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-debug-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/externalities/Cargo.toml b/primitives/externalities/Cargo.toml index 3af61bbeb0..65c59e41e4 100644 --- a/primitives/externalities/Cargo.toml +++ b/primitives/externalities/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-externalities" -version = "0.8.0-rc3" +version = "0.8.0-rc4" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -13,7 +13,7 @@ documentation = "https://docs.rs/sp-externalities" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-storage = { version = "2.0.0-rc3", path = "../storage" } -sp-std = { version = "2.0.0-rc3", path = "../std" } +sp-storage = { version = "2.0.0-rc4", path = "../storage" } +sp-std = { version = "2.0.0-rc4", path = "../std" } environmental = { version = "1.1.1" } codec = { package = "parity-scale-codec", version = "1.3.1" } diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index 27315b0ff9..7e77e1253c 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,15 +14,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.12.3", default-features = false, features = ["derive-codec"] } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/finality-tracker/Cargo.toml b/primitives/finality-tracker/Cargo.toml index 60ed88c110..5cbd497bec 100644 --- a/primitives/finality-tracker/Cargo.toml +++ b/primitives/finality-tracker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } [features] default = ["std"] diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index 503aa29d29..3532e08da1 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-inherents" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,8 +15,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parking_lot = { version = "0.10.0", optional = true } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } derive_more = { version = "0.99.2", optional = true } diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index 8bb113b1f1..06df2cc5ed 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-io" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,15 +16,15 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } hash-db = { version = "0.15.2", default-features = false } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } libsecp256k1 = { version = "0.3.4", optional = true } -sp-state-machine = { version = "0.8.0-rc3", optional = true, path = "../../primitives/state-machine" } -sp-wasm-interface = { version = "2.0.0-rc3", path = "../../primitives/wasm-interface", default-features = false } -sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../runtime-interface" } -sp-trie = { version = "2.0.0-rc3", optional = true, path = "../../primitives/trie" } -sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } -sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../tracing" } +sp-state-machine = { version = "0.8.0-rc4", optional = true, path = "../../primitives/state-machine" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../../primitives/wasm-interface", default-features = false } +sp-runtime-interface = { version = "2.0.0-rc4", default-features = false, path = "../runtime-interface" } +sp-trie = { version = "2.0.0-rc4", optional = true, path = "../../primitives/trie" } +sp-externalities = { version = "0.8.0-rc4", optional = true, path = "../externalities" } +sp-tracing = { version = "2.0.0-rc4", default-features = false, path = "../tracing" } log = { version = "0.4.8", optional = true } futures = { version = "0.3.1", features = ["thread-pool"], optional = true } parking_lot = { version = "0.10.0", optional = true } diff --git a/primitives/keyring/Cargo.toml b/primitives/keyring/Cargo.toml index f94d3b14d9..abd7f3d3d5 100644 --- a/primitives/keyring/Cargo.toml +++ b/primitives/keyring/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-keyring" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc3", path = "../core" } -sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-core = { version = "2.0.0-rc4", path = "../core" } +sp-runtime = { version = "2.0.0-rc4", path = "../runtime" } lazy_static = "1.4.0" strum = { version = "0.16.0", features = ["derive"] } diff --git a/primitives/npos-elections/Cargo.toml b/primitives/npos-elections/Cargo.toml index 7982c8ce4d..0a55a3e895 100644 --- a/primitives/npos-elections/Cargo.toml +++ b/primitives/npos-elections/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-npos-elections" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-npos-elections-compact = { version = "2.0.0-rc3", path = "./compact" } -sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-npos-elections-compact = { version = "2.0.0-rc4", path = "./compact" } +sp-arithmetic = { version = "2.0.0-rc4", default-features = false, path = "../arithmetic" } [dev-dependencies] -substrate-test-utils = { version = "2.0.0-rc3", path = "../../test-utils" } +substrate-test-utils = { version = "2.0.0-rc4", path = "../../test-utils" } rand = "0.7.3" -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } [features] default = ["std"] diff --git a/primitives/npos-elections/compact/Cargo.toml b/primitives/npos-elections/compact/Cargo.toml index 9b4333e385..61d1990a3a 100644 --- a/primitives/npos-elections/compact/Cargo.toml +++ b/primitives/npos-elections/compact/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-npos-elections-compact" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/npos-elections/fuzzer/Cargo.toml b/primitives/npos-elections/fuzzer/Cargo.toml index 02be731592..b7c7dcab65 100644 --- a/primitives/npos-elections/fuzzer/Cargo.toml +++ b/primitives/npos-elections/fuzzer/Cargo.toml @@ -14,9 +14,9 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-npos-elections = { version = "2.0.0-rc3", path = ".." } -sp-std = { version = "2.0.0-rc3", path = "../../std" } -sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } +sp-npos-elections = { version = "2.0.0-rc4", path = ".." } +sp-std = { version = "2.0.0-rc4", path = "../../std" } +sp-runtime = { version = "2.0.0-rc4", path = "../../runtime" } honggfuzz = "0.5" rand = { version = "0.7.3", features = ["std", "small_rng"] } diff --git a/primitives/offchain/Cargo.toml b/primitives/offchain/Cargo.toml index e44a8e8551..44eb1bc0e1 100644 --- a/primitives/offchain/Cargo.toml +++ b/primitives/offchain/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Substrate offchain workers primitives" name = "sp-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } [dev-dependencies] -sp-state-machine = { version = "0.8.0-rc3", default-features = false, path = "../state-machine" } +sp-state-machine = { version = "0.8.0-rc4", default-features = false, path = "../state-machine" } [features] default = ["std"] diff --git a/primitives/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml index acdf7b7462..f350d317a0 100644 --- a/primitives/panic-handler/Cargo.toml +++ b/primitives/panic-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-panic-handler" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index 332649d266..86809803b4 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", features = ["derive"] } -sp-core = { version = "2.0.0-rc3", path = "../core" } +sp-core = { version = "2.0.0-rc4", path = "../core" } [dev-dependencies] serde_json = "1.0.41" diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index 12d070b47c..dc37c18629 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,20 +13,20 @@ documentation = "https://docs.rs/sp-runtime-interface/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-wasm-interface = { version = "2.0.0-rc3", path = "../wasm-interface", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-tracing = { version = "2.0.0-rc3", default-features = false, path = "../tracing" } -sp-runtime-interface-proc-macro = { version = "2.0.0-rc3", path = "proc-macro" } -sp-externalities = { version = "0.8.0-rc3", optional = true, path = "../externalities" } +sp-wasm-interface = { version = "2.0.0-rc4", path = "../wasm-interface", default-features = false } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-tracing = { version = "2.0.0-rc4", default-features = false, path = "../tracing" } +sp-runtime-interface-proc-macro = { version = "2.0.0-rc4", path = "proc-macro" } +sp-externalities = { version = "0.8.0-rc4", optional = true, path = "../externalities" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } static_assertions = "1.0.0" primitive-types = { version = "0.7.0", default-features = false } [dev-dependencies] -sp-runtime-interface-test-wasm = { version = "2.0.0-rc3", path = "test-wasm" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } -sp-core = { version = "2.0.0-rc3", path = "../core" } -sp-io = { version = "2.0.0-rc3", path = "../io" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc4", path = "test-wasm" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc4", path = "../core" } +sp-io = { version = "2.0.0-rc4", path = "../io" } rustversion = "1.0.0" trybuild = "1.0.23" diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index 67809c1ba2..dfb3840a08 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 8668282943..9ad22599ad 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc4", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index 304cc1e82e..7973f152bc 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test-wasm" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,10 +13,10 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc3", default-features = false, path = "../" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../io" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../core" } +sp-runtime-interface = { version = "2.0.0-rc4", default-features = false, path = "../" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../core" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner" } diff --git a/primitives/runtime-interface/test/Cargo.toml b/primitives/runtime-interface/test/Cargo.toml index a68a9b3c92..bdbe7ff902 100644 --- a/primitives/runtime-interface/test/Cargo.toml +++ b/primitives/runtime-interface/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime-interface-test" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ repository = "https://github.com/paritytech/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-runtime-interface = { version = "2.0.0-rc3", path = "../" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } -sp-runtime-interface-test-wasm = { version = "2.0.0-rc3", path = "../test-wasm" } -sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc3", path = "../test-wasm-deprecated" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } -sp-runtime = { version = "2.0.0-rc3", path = "../../runtime" } -sp-core = { version = "2.0.0-rc3", path = "../../core" } -sp-io = { version = "2.0.0-rc3", path = "../../io" } +sp-runtime-interface = { version = "2.0.0-rc4", path = "../" } +sc-executor = { version = "0.8.0-rc4", path = "../../../client/executor" } +sp-runtime-interface-test-wasm = { version = "2.0.0-rc4", path = "../test-wasm" } +sp-runtime-interface-test-wasm-deprecated = { version = "2.0.0-rc4", path = "../test-wasm-deprecated" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } +sp-runtime = { version = "2.0.0-rc4", path = "../../runtime" } +sp-core = { version = "2.0.0-rc4", path = "../../core" } +sp-io = { version = "2.0.0-rc4", path = "../../io" } tracing = "0.1.13" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index d3508c0e8b..9bc972646f 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -16,16 +16,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } -sp-arithmetic = { version = "2.0.0-rc3", default-features = false, path = "../arithmetic" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../io" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../application-crypto" } +sp-arithmetic = { version = "2.0.0-rc4", default-features = false, path = "../arithmetic" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../io" } log = { version = "0.4.8", optional = true } paste = "0.1.6" rand = { version = "0.7.2", optional = true } impl-trait-for-tuples = "0.1.3" -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../inherents" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } hash256-std-hasher = { version = "0.15.2", default-features = false } either = { version = "1.5", default-features = false } @@ -33,7 +33,7 @@ either = { version = "1.5", default-features = false } [dev-dependencies] serde_json = "1.0.41" rand = "0.7.2" -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } [features] bench = [] diff --git a/primitives/sandbox/Cargo.toml b/primitives/sandbox/Cargo.toml index dfd3a44053..9361f59d1d 100755 --- a/primitives/sandbox/Cargo.toml +++ b/primitives/sandbox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-sandbox" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,10 +13,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../io" } -sp-wasm-interface = { version = "2.0.0-rc3", default-features = false, path = "../wasm-interface" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../io" } +sp-wasm-interface = { version = "2.0.0-rc4", default-features = false, path = "../wasm-interface" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } [dev-dependencies] diff --git a/primitives/serializer/Cargo.toml b/primitives/serializer/Cargo.toml index d46de697fa..66f721602a 100644 --- a/primitives/serializer/Cargo.toml +++ b/primitives/serializer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-serializer" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index 4abcb80d24..3fdfbe8984 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-session" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-staking = { version = "2.0.0-rc3", default-features = false, path = "../staking" } -sp-runtime = { version = "2.0.0-rc3", optional = true, path = "../runtime" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-staking = { version = "2.0.0-rc4", default-features = false, path = "../staking" } +sp-runtime = { version = "2.0.0-rc4", optional = true, path = "../runtime" } [features] default = [ "std" ] diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index 7ec400d74a..ac14dde901 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-staking" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } [features] default = ["std"] diff --git a/primitives/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml index 29c8676f7e..2545f52760 100644 --- a/primitives/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-state-machine" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Substrate State Machine" edition = "2018" @@ -18,19 +18,19 @@ parking_lot = "0.10.0" hash-db = "0.15.2" trie-db = "0.21.0" trie-root = "0.16.0" -sp-trie = { version = "2.0.0-rc3", path = "../trie" } -sp-core = { version = "2.0.0-rc3", path = "../core" } -sp-panic-handler = { version = "2.0.0-rc3", path = "../panic-handler" } +sp-trie = { version = "2.0.0-rc4", path = "../trie" } +sp-core = { version = "2.0.0-rc4", path = "../core" } +sp-panic-handler = { version = "2.0.0-rc4", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.3.1" } num-traits = "0.2.8" rand = "0.7.2" -sp-externalities = { version = "0.8.0-rc3", path = "../externalities" } +sp-externalities = { version = "0.8.0-rc4", path = "../externalities" } itertools = "0.9" smallvec = "1.4" [dev-dependencies] hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../runtime" } pretty_assertions = "0.6.1" [features] diff --git a/primitives/std/Cargo.toml b/primitives/std/Cargo.toml index d3a242db4f..b184f7b8d9 100644 --- a/primitives/std/Cargo.toml +++ b/primitives/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-std" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/storage/Cargo.toml b/primitives/storage/Cargo.toml index 9d61cb8a4a..63b53bd926 100644 --- a/primitives/storage/Cargo.toml +++ b/primitives/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-storage" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" description = "Storage related primitives" @@ -13,11 +13,11 @@ documentation = "https://docs.rs/sp-storage/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } serde = { version = "1.0.101", optional = true, features = ["derive"] } impl-serde = { version = "0.2.3", optional = true } ref-cast = "1.0.0" -sp-debug-derive = { version = "2.0.0-rc3", path = "../debug-derive" } +sp-debug-derive = { version = "2.0.0-rc4", path = "../debug-derive" } [features] default = [ "std" ] diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index abc47f6f9a..8e14aeeb83 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-test-primitives" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../application-crypto" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../application-crypto" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } [features] diff --git a/primitives/timestamp/Cargo.toml b/primitives/timestamp/Cargo.toml index 5b2217f0f3..117d79bdbe 100644 --- a/primitives/timestamp/Cargo.toml +++ b/primitives/timestamp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,11 +12,11 @@ description = "Substrate core types and inherents for timestamps." targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../inherents" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../inherents" } impl-trait-for-tuples = "0.1.3" wasm-timer = { version = "0.2", optional = true } diff --git a/primitives/tracing/Cargo.toml b/primitives/tracing/Cargo.toml index e47d9859c9..30808a6c0e 100644 --- a/primitives/tracing/Cargo.toml +++ b/primitives/tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc4" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" diff --git a/primitives/transaction-pool/Cargo.toml b/primitives/transaction-pool/Cargo.toml index 6417ae8c29..a217bdef4a 100644 --- a/primitives/transaction-pool/Cargo.toml +++ b/primitives/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -19,10 +19,10 @@ derive_more = { version = "0.99.2", optional = true } futures = { version = "0.3.1", optional = true } log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", features = ["derive"], optional = true} -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../api" } -sp-blockchain = { version = "2.0.0-rc3", optional = true, path = "../blockchain" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } -sp-utils = { version = "2.0.0-rc3", default-features = false, path = "../utils" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../api" } +sp-blockchain = { version = "2.0.0-rc4", optional = true, path = "../blockchain" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } +sp-utils = { version = "2.0.0-rc4", default-features = false, path = "../utils" } [features] default = [ "std" ] diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index d99a3d1ae7..1ebc974bfb 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-trie" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] description = "Patricia trie stuff using a parity-scale-codec node format" repository = "https://github.com/paritytech/substrate/" @@ -18,19 +18,19 @@ harness = false [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.21.0", default-features = false } trie-root = { version = "0.16.0", default-features = false } memory-db = { version = "0.21.0", default-features = false } -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../core" } +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../core" } [dev-dependencies] trie-bench = "0.22.0" trie-standardmap = "0.15.2" criterion = "0.2.11" hex-literal = "0.2.1" -sp-runtime = { version = "2.0.0-rc3", path = "../runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../runtime" } [features] default = ["std"] diff --git a/primitives/utils/Cargo.toml b/primitives/utils/Cargo.toml index 9ae7beb1ff..96c7825515 100644 --- a/primitives/utils/Cargo.toml +++ b/primitives/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index 18357953d7..181b793bd5 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-version" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] impl-serde = { version = "0.2.3", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../std" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../runtime" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../std" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../runtime" } [features] default = ["std"] diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index c2e70ce1e4..8b32cde969 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sp-wasm-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] wasmi = { version = "0.6.2", optional = true } impl-trait-for-tuples = "0.1.2" -sp-std = { version = "2.0.0-rc3", path = "../std", default-features = false } +sp-std = { version = "2.0.0-rc4", path = "../std", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } [features] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 3d6914540a..f67f1560c1 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/test-utils/client/Cargo.toml b/test-utils/client/Cargo.toml index f5604ceb23..a9d8590f02 100644 --- a/test-utils/client/Cargo.toml +++ b/test-utils/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,18 +12,18 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc3", path = "../../client/api" } -sc-light = { version = "2.0.0-rc3", path = "../../client/light" } -sc-client-db = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../client/db" } -sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" } -sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" } -sc-consensus = { version = "0.8.0-rc3", path = "../../client/consensus/common" } -sc-service = { version = "0.8.0-rc3", default-features = false, features = ["test-helpers"], path = "../../client/service" } +sc-client-api = { version = "2.0.0-rc4", path = "../../client/api" } +sc-light = { version = "2.0.0-rc4", path = "../../client/light" } +sc-client-db = { version = "0.8.0-rc4", features = ["test-helpers"], path = "../../client/db" } +sp-consensus = { version = "0.8.0-rc4", path = "../../primitives/consensus/common" } +sc-executor = { version = "0.8.0-rc4", path = "../../client/executor" } +sc-consensus = { version = "0.8.0-rc4", path = "../../client/consensus/common" } +sc-service = { version = "0.8.0-rc4", default-features = false, features = ["test-helpers"], path = "../../client/service" } futures = "0.3.4" hash-db = "0.15.2" -sp-keyring = { version = "2.0.0-rc3", path = "../../primitives/keyring" } +sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } codec = { package = "parity-scale-codec", version = "1.3.1" } -sp-core = { version = "2.0.0-rc3", path = "../../primitives/core" } -sp-runtime = { version = "2.0.0-rc3", path = "../../primitives/runtime" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../primitives/blockchain" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../primitives/blockchain" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index e307522ead..71987da150 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" @@ -13,35 +13,35 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/application-crypto" } -sp-consensus-aura = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/aura" } -sp-consensus-babe = { version = "0.8.0-rc3", default-features = false, path = "../../primitives/consensus/babe" } -sp-block-builder = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/block-builder" } +sp-application-crypto = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/application-crypto" } +sp-consensus-aura = { version = "0.8.0-rc4", default-features = false, path = "../../primitives/consensus/aura" } +sp-consensus-babe = { version = "0.8.0-rc4", default-features = false, path = "../../primitives/consensus/babe" } +sp-block-builder = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -frame-executive = { version = "2.0.0-rc3", default-features = false, path = "../../frame/executive" } -sp-inherents = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/inherents" } -sp-keyring = { version = "2.0.0-rc3", optional = true, path = "../../primitives/keyring" } +frame-executive = { version = "2.0.0-rc4", default-features = false, path = "../../frame/executive" } +sp-inherents = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/inherents" } +sp-keyring = { version = "2.0.0-rc4", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.21.0", default-features = false } -sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc3"} -sp-core = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/core" } -sp-std = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/std" } -sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc3"} -sp-io = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/io" } -frame-support = { version = "2.0.0-rc3", default-features = false, path = "../../frame/support" } -sp-version = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/version" } -sp-session = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/session" } -sp-api = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/api" } -sp-runtime = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/runtime" } -pallet-babe = { version = "2.0.0-rc3", default-features = false, path = "../../frame/babe" } -frame-system = { version = "2.0.0-rc3", default-features = false, path = "../../frame/system" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc3", default-features = false, path = "../../frame/system/rpc/runtime-api" } -pallet-timestamp = { version = "2.0.0-rc3", default-features = false, path = "../../frame/timestamp" } -sp-finality-grandpa = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/finality-grandpa" } -sp-trie = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/trie" } -sp-transaction-pool = { version = "2.0.0-rc3", default-features = false, path = "../../primitives/transaction-pool" } +sp-offchain = { path = "../../primitives/offchain", default-features = false, version = "2.0.0-rc4"} +sp-core = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/core" } +sp-std = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/std" } +sp-runtime-interface = { path = "../../primitives/runtime-interface", default-features = false, version = "2.0.0-rc4"} +sp-io = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/io" } +frame-support = { version = "2.0.0-rc4", default-features = false, path = "../../frame/support" } +sp-version = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/version" } +sp-session = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/session" } +sp-api = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/api" } +sp-runtime = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/runtime" } +pallet-babe = { version = "2.0.0-rc4", default-features = false, path = "../../frame/babe" } +frame-system = { version = "2.0.0-rc4", default-features = false, path = "../../frame/system" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc4", default-features = false, path = "../../frame/system/rpc/runtime-api" } +pallet-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../frame/timestamp" } +sp-finality-grandpa = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/finality-grandpa" } +sp-trie = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/trie" } +sp-transaction-pool = { version = "2.0.0-rc4", default-features = false, path = "../../primitives/transaction-pool" } trie-db = { version = "0.21.0", default-features = false } parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.8.0-rc3", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } +sc-service = { version = "0.8.0-rc4", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" } # 3rd party cfg-if = "0.1.10" @@ -49,10 +49,10 @@ log = { version = "0.4.8", optional = true } serde = { version = "1.0.101", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.8.0-rc3", path = "../../client/block-builder" } -sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" } -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "./client" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../primitives/state-machine" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../client/block-builder" } +sc-executor = { version = "0.8.0-rc4", path = "../../client/executor" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "./client" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../primitives/state-machine" } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", path = "../../utils/wasm-builder-runner" } diff --git a/test-utils/runtime/client/Cargo.toml b/test-utils/runtime/client/Cargo.toml index 7a69f5ed22..09f2c3f152 100644 --- a/test-utils/runtime/client/Cargo.toml +++ b/test-utils/runtime/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-client" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,17 +12,17 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-light = { version = "2.0.0-rc3", path = "../../../client/light" } -sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" } -sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" } -substrate-test-client = { version = "2.0.0-rc3", path = "../../client" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -substrate-test-runtime = { version = "2.0.0-rc3", path = "../../runtime" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } +sc-light = { version = "2.0.0-rc4", path = "../../../client/light" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sc-block-builder = { version = "0.8.0-rc4", path = "../../../client/block-builder" } +substrate-test-client = { version = "2.0.0-rc4", path = "../../client" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +substrate-test-runtime = { version = "2.0.0-rc4", path = "../../runtime" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } codec = { package = "parity-scale-codec", version = "1.3.1" } -sc-client-api = { version = "2.0.0-rc3", path = "../../../client/api" } -sc-consensus = { version = "0.8.0-rc3", path = "../../../client/consensus/common" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" } +sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../../client/service" } futures = "0.3.4" diff --git a/test-utils/runtime/transaction-pool/Cargo.toml b/test-utils/runtime/transaction-pool/Cargo.toml index e5c93ef8ad..f29ae2b7bf 100644 --- a/test-utils/runtime/transaction-pool/Cargo.toml +++ b/test-utils/runtime/transaction-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-test-runtime-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,12 +12,12 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../client" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../client" } parking_lot = "0.10.0" codec = { package = "parity-scale-codec", version = "1.3.1" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../primitives/transaction-pool" } -sc-transaction-graph = { version = "2.0.0-rc3", path = "../../../client/transaction-pool/graph" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../primitives/blockchain" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } +sc-transaction-graph = { version = "2.0.0-rc4", path = "../../../client/transaction-pool/graph" } futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.99.2" diff --git a/utils/browser/Cargo.toml b/utils/browser/Cargo.toml index ee4634f0d1..ed02e8e2fa 100644 --- a/utils/browser/Cargo.toml +++ b/utils/browser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-browser-utils" -version = "0.8.0-rc3" +version = "0.8.0-rc4" authors = ["Parity Technologies "] description = "Utilities for creating a browser light-client." edition = "2018" @@ -22,11 +22,11 @@ js-sys = "0.3.34" wasm-bindgen = "0.2.57" wasm-bindgen-futures = "0.4.7" kvdb-web = "0.6" -sp-database = { version = "2.0.0-rc3", path = "../../primitives/database" } -sc-informant = { version = "0.8.0-rc3", path = "../../client/informant" } -sc-service = { version = "0.8.0-rc3", path = "../../client/service", default-features = false } -sc-network = { path = "../../client/network", version = "0.8.0-rc3"} -sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc3"} +sp-database = { version = "2.0.0-rc4", path = "../../primitives/database" } +sc-informant = { version = "0.8.0-rc4", path = "../../client/informant" } +sc-service = { version = "0.8.0-rc4", path = "../../client/service", default-features = false } +sc-network = { path = "../../client/network", version = "0.8.0-rc4"} +sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0-rc4"} # Imported just for the `no_cc` feature clear_on_drop = { version = "0.2.3", features = ["no_cc"] } diff --git a/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml index a1f31f83e8..9eada7bf82 100644 --- a/utils/build-script-utils/Cargo.toml +++ b/utils/build-script-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-build-script-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml index 6c8410ab76..a1aaea70b1 100644 --- a/utils/fork-tree/Cargo.toml +++ b/utils/fork-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fork-tree" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/utils/frame/benchmarking-cli/Cargo.toml b/utils/frame/benchmarking-cli/Cargo.toml index 364dc472cb..003b4d9c05 100644 --- a/utils/frame/benchmarking-cli/Cargo.toml +++ b/utils/frame/benchmarking-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frame-benchmarking-cli" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,15 +12,15 @@ description = "CLI for benchmarking FRAME" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-benchmarking = { version = "2.0.0-rc3", path = "../../../frame/benchmarking" } -sp-core = { version = "2.0.0-rc3", path = "../../../primitives/core" } -sc-service = { version = "0.8.0-rc3", default-features = false, path = "../../../client/service" } -sc-cli = { version = "0.8.0-rc3", path = "../../../client/cli" } -sc-client-db = { version = "0.8.0-rc3", path = "../../../client/db" } -sc-executor = { version = "0.8.0-rc3", path = "../../../client/executor" } -sp-externalities = { version = "0.8.0-rc3", path = "../../../primitives/externalities" } -sp-runtime = { version = "2.0.0-rc3", path = "../../../primitives/runtime" } -sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" } +frame-benchmarking = { version = "2.0.0-rc4", path = "../../../frame/benchmarking" } +sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../../client/service" } +sc-cli = { version = "0.8.0-rc4", path = "../../../client/cli" } +sc-client-db = { version = "0.8.0-rc4", path = "../../../client/db" } +sc-executor = { version = "0.8.0-rc4", path = "../../../client/executor" } +sp-externalities = { version = "0.8.0-rc4", path = "../../../primitives/externalities" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" } +sp-state-machine = { version = "0.8.0-rc4", path = "../../../primitives/state-machine" } structopt = "0.3.8" codec = { version = "1.3.1", package = "parity-scale-codec" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index d7e4259635..ec4d06c93c 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-support" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies ", "Andrew Dirksen "] edition = "2018" license = "Apache-2.0" @@ -17,10 +17,10 @@ jsonrpc-client-transports = { version = "14.2.0", default-features = false, feat jsonrpc-core = "14.2.0" codec = { package = "parity-scale-codec", version = "1.3.1" } serde = "1" -frame-support = { version = "2.0.0-rc3", path = "../../../../frame/support" } -sp-storage = { version = "2.0.0-rc3", path = "../../../../primitives/storage" } -sc-rpc-api = { version = "0.8.0-rc3", path = "../../../../client/rpc-api" } +frame-support = { version = "2.0.0-rc4", path = "../../../../frame/support" } +sp-storage = { version = "2.0.0-rc4", path = "../../../../primitives/storage" } +sc-rpc-api = { version = "0.8.0-rc4", path = "../../../../client/rpc-api" } [dev-dependencies] -frame-system = { version = "2.0.0-rc3", path = "../../../../frame/system" } +frame-system = { version = "2.0.0-rc4", path = "../../../../frame/system" } tokio = "0.2" diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index a03a08b3ff..1d655bcca3 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-frame-rpc-system" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,7 @@ description = "FRAME's system exposed over Substrate RPC" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sc-client-api = { version = "2.0.0-rc3", path = "../../../../client/api" } +sc-client-api = { version = "2.0.0-rc4", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "1.3.1" } futures = { version = "0.3.4", features = ["compat"] } jsonrpc-core = "14.2.0" @@ -20,16 +20,16 @@ jsonrpc-core-client = "14.2.0" jsonrpc-derive = "14.2.1" log = "0.4.8" serde = { version = "1.0.101", features = ["derive"] } -sp-runtime = { version = "2.0.0-rc3", path = "../../../../primitives/runtime" } -sp-api = { version = "2.0.0-rc3", path = "../../../../primitives/api" } -frame-system-rpc-runtime-api = { version = "2.0.0-rc3", path = "../../../../frame/system/rpc/runtime-api" } -sp-core = { version = "2.0.0-rc3", path = "../../../../primitives/core" } -sp-blockchain = { version = "2.0.0-rc3", path = "../../../../primitives/blockchain" } -sp-transaction-pool = { version = "2.0.0-rc3", path = "../../../../primitives/transaction-pool" } -sp-block-builder = { version = "2.0.0-rc3", path = "../../../../primitives/block-builder" } -sc-rpc-api = { version = "0.8.0-rc3", path = "../../../../client/rpc-api" } +sp-runtime = { version = "2.0.0-rc4", path = "../../../../primitives/runtime" } +sp-api = { version = "2.0.0-rc4", path = "../../../../primitives/api" } +frame-system-rpc-runtime-api = { version = "2.0.0-rc4", path = "../../../../frame/system/rpc/runtime-api" } +sp-core = { version = "2.0.0-rc4", path = "../../../../primitives/core" } +sp-blockchain = { version = "2.0.0-rc4", path = "../../../../primitives/blockchain" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../../primitives/transaction-pool" } +sp-block-builder = { version = "2.0.0-rc4", path = "../../../../primitives/block-builder" } +sc-rpc-api = { version = "0.8.0-rc4", path = "../../../../client/rpc-api" } [dev-dependencies] -substrate-test-runtime-client = { version = "2.0.0-rc3", path = "../../../../test-utils/runtime/client" } +substrate-test-runtime-client = { version = "2.0.0-rc4", path = "../../../../test-utils/runtime/client" } env_logger = "0.7.0" -sc-transaction-pool = { version = "2.0.0-rc3", path = "../../../../client/transaction-pool" } +sc-transaction-pool = { version = "2.0.0-rc4", path = "../../../../client/transaction-pool" } diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index c8dd98656b..322935a884 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Endpoint to expose Prometheus metrics" name = "substrate-prometheus-endpoint" -version = "0.8.0-rc3" +version = "0.8.0-rc4" license = "Apache-2.0" authors = ["Parity Technologies "] edition = "2018" -- GitLab From 77c4f859e87fdceaf545d9e867bcd0b5299fdf7e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 26 Jun 2020 10:05:24 +0200 Subject: [PATCH 254/280] Fix an extra semi-colon yielding a wrong error (#6520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix an extra semi-colon yielding a wrong error * Update client/cli/src/commands/run_cmd.rs Co-authored-by: Bastian Köcher --- client/cli/src/commands/run_cmd.rs | 2 +- client/cli/src/error.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index 16bae1ea96..690cb868c5 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -325,7 +325,7 @@ impl CliConfiguration for RunCmd { Error::Input(format!( "Invalid node name '{}'. Reason: {}. If unsure, use none.", name, msg - )); + )) })?; Ok(name) diff --git a/client/cli/src/error.rs b/client/cli/src/error.rs index 31f6e1c1ff..f091354be1 100644 --- a/client/cli/src/error.rs +++ b/client/cli/src/error.rs @@ -37,6 +37,7 @@ pub enum Error { Input(String), /// Invalid listen multiaddress #[display(fmt="Invalid listen multiaddress")] + #[from(ignore)] InvalidListenMultiaddress, /// Other uncategorized error. #[from(ignore)] -- GitLab From 93a6a53061b9ecb8660c291ab43d083cf51c1f89 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Fri, 26 Jun 2020 11:03:02 +0200 Subject: [PATCH 255/280] Refactor as_sub to make things clearer. (#6503) * Refactor as_sub to make things clearer. - `as_sub` becomes `as_alternative` - `as_sub_limited` becomes `as_derivative` - `as_alternative` and `as_derivative` generate a mutually exclusive set of accounts. * Test fix * Add test * Fix test * Remove `as_alternative`. * Docs. --- frame/proxy/src/tests.rs | 14 ++------- frame/utility/src/benchmarking.rs | 11 ++----- frame/utility/src/lib.rs | 49 ++++++++++--------------------- frame/utility/src/tests.rs | 12 ++++---- 4 files changed, 27 insertions(+), 59 deletions(-) diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index 72c9c0d577..63d5c9e575 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -201,19 +201,11 @@ fn filtering_works() { assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); - let sub_id = Utility::sub_account_id(1, 0); - Balances::mutate_account(&sub_id, |a| a.free = 1000); + let derivative_id = Utility::derivative_account_id(1, 0); + Balances::mutate_account(&derivative_id, |a| a.free = 1000); let inner = Box::new(Call::Balances(BalancesCall::transfer(6, 1))); - let call = Box::new(Call::Utility(UtilityCall::as_sub(0, inner.clone()))); - assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); - expect_event(RawEvent::ProxyExecuted(Ok(()))); - assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); - expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin))); - assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone())); - expect_event(RawEvent::ProxyExecuted(Ok(()))); - - let call = Box::new(Call::Utility(UtilityCall::as_limited_sub(0, inner.clone()))); + let call = Box::new(Call::Utility(UtilityCall::as_derivative(0, inner.clone()))); assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone())); expect_event(RawEvent::ProxyExecuted(Ok(()))); assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone())); diff --git a/frame/utility/src/benchmarking.rs b/frame/utility/src/benchmarking.rs index 27696404bf..8d98178957 100644 --- a/frame/utility/src/benchmarking.rs +++ b/frame/utility/src/benchmarking.rs @@ -38,13 +38,7 @@ benchmarks! { let caller = account("caller", 0, SEED); }: _(RawOrigin::Signed(caller), calls) - as_sub { - let u in 0 .. 1000; - let caller = account("caller", u, SEED); - let call = Box::new(frame_system::Call::remark(vec![]).into()); - }: _(RawOrigin::Signed(caller), u as u16, call) - - as_limited_sub { + as_derivative { let u in 0 .. 1000; let caller = account("caller", u, SEED); let call = Box::new(frame_system::Call::remark(vec![]).into()); @@ -61,8 +55,7 @@ mod tests { fn test_benchmarks() { new_test_ext().execute_with(|| { assert_ok!(test_benchmark_batch::()); - assert_ok!(test_benchmark_as_sub::()); - assert_ok!(test_benchmark_as_limited_sub::()); + assert_ok!(test_benchmark_as_derivative::()); }); } } diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index 3759a2afcd..47ca4f13e7 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -16,7 +16,7 @@ // limitations under the License. //! # Utility Module -//! A stateless module with helpers for dispatch management. +//! A stateless module with helpers for dispatch management which does no re-authentication. //! //! - [`utility::Trait`](./trait.Trait.html) //! - [`Call`](./enum.Call.html) @@ -29,10 +29,15 @@ //! corresponding `set_storage`s, for efficient multiple payouts with just a single signature //! verify, or in combination with one of the other two dispatch functionality. //! - Pseudonymal dispatch: A stateless operation, allowing a signed origin to execute a call from -//! an alternative signed origin. Each account has 2**16 possible "pseudonyms" (alternative +//! an alternative signed origin. Each account has 2 * 2**16 possible "pseudonyms" (alternative //! account IDs) and these can be stacked. This can be useful as a key management tool, where you //! need multiple distinct accounts (e.g. as controllers for many staking accounts), but where //! it's perfectly fine to have each of them controlled by the same underlying keypair. +//! Derivative accounts are, for the purposes of proxy filtering considered exactly the same as +//! the oigin and are thus hampered with the origin's filters. +//! +//! Since proxy filters are respected in all dispatches of this module, it should never need to be +//! filtered by any proxy. //! //! ## Interface //! @@ -42,7 +47,7 @@ //! * `batch` - Dispatch multiple calls from the sender's origin. //! //! #### For pseudonymal dispatch -//! * `as_sub` - Dispatch a call from a secondary ("sub") signed origin. +//! * `as_derivative` - Dispatch a call from a derivative signed origin. //! //! [`Call`]: ./enum.Call.html //! [`Trait`]: ./trait.Trait.html @@ -155,31 +160,6 @@ decl_module! { Self::deposit_event(Event::BatchCompleted); } - /// Send a call through an indexed pseudonym of the sender. - /// - /// NOTE: If you need to ensure that any account-based filtering is honored (i.e. because - /// you expect `proxy` to have been used prior in the call stack and you want it to apply to - /// any sub-accounts), then use `as_limited_sub` instead. - /// - /// The dispatch origin for this call must be _Signed_. - /// - /// # - /// - Base weight: 2.861 µs - /// - Plus the weight of the `call` - /// # - #[weight = ( - call.get_dispatch_info().weight.saturating_add(3_000_000), - call.get_dispatch_info().class, - )] - fn as_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { - let who = ensure_signed(origin)?; - - // This is a freshly authenticated new account, the origin restrictions doesn't apply. - let pseudonym = Self::sub_account_id(who, index); - call.dispatch(frame_system::RawOrigin::Signed(pseudonym).into()) - .map(|_| ()).map_err(|e| e.error) - } - /// Send a call through an indexed pseudonym of the sender. /// /// Filter from origin are passed along. The call will be dispatched with an origin which @@ -187,7 +167,10 @@ decl_module! { /// /// NOTE: If you need to ensure that any account-based filtering is not honored (i.e. /// because you expect `proxy` to have been used prior in the call stack and you do not want - /// the call restrictions to apply to any sub-accounts), then use `as_sub` instead. + /// the call restrictions to apply to any sub-accounts), then use `as_multi_threshold_1` + /// in the Multisig pallet instead. + /// + /// NOTE: Prior to version *12, this was called `as_limited_sub`. /// /// The dispatch origin for this call must be _Signed_. /// @@ -199,10 +182,10 @@ decl_module! { call.get_dispatch_info().weight.saturating_add(3_000_000), call.get_dispatch_info().class, )] - fn as_limited_sub(origin, index: u16, call: Box<::Call>) -> DispatchResult { + fn as_derivative(origin, index: u16, call: Box<::Call>) -> DispatchResult { let mut origin = origin; let who = ensure_signed(origin.clone())?; - let pseudonym = Self::sub_account_id(who, index); + let pseudonym = Self::derivative_account_id(who, index); origin.set_caller_from(frame_system::RawOrigin::Signed(pseudonym)); call.dispatch(origin).map(|_| ()).map_err(|e| e.error) } @@ -210,8 +193,8 @@ decl_module! { } impl Module { - /// Derive a sub-account ID from the owner account and the sub-account index. - pub fn sub_account_id(who: T::AccountId, index: u16) -> T::AccountId { + /// Derive a derivative account ID from the owner account and the sub-account index. + pub fn derivative_account_id(who: T::AccountId, index: u16) -> T::AccountId { let entropy = (b"modlpy/utilisuba", who, index).using_encoded(blake2_256); T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() } diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index e0f8426d28..c0a6499250 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -138,16 +138,16 @@ fn expect_event>(e: E) { } #[test] -fn as_sub_works() { +fn as_derivative_works() { new_test_ext().execute_with(|| { - let sub_1_0 = Utility::sub_account_id(1, 0); + let sub_1_0 = Utility::derivative_account_id(1, 0); assert_ok!(Balances::transfer(Origin::signed(1), sub_1_0, 5)); - assert_noop!(Utility::as_sub( + assert_noop!(Utility::as_derivative( Origin::signed(1), 1, Box::new(Call::Balances(BalancesCall::transfer(6, 3))), ), BalancesError::::InsufficientBalance); - assert_ok!(Utility::as_sub( + assert_ok!(Utility::as_derivative( Origin::signed(1), 0, Box::new(Call::Balances(BalancesCall::transfer(2, 3))), @@ -158,9 +158,9 @@ fn as_sub_works() { } #[test] -fn as_sub_filters() { +fn as_derivative_filters() { new_test_ext().execute_with(|| { - assert_noop!(Utility::as_sub( + assert_noop!(Utility::as_derivative( Origin::signed(1), 1, Box::new(Call::System(frame_system::Call::remark(vec![]))), -- GitLab From 397068219c7a43a743f3979947efec35a8e93536 Mon Sep 17 00:00:00 2001 From: s3krit Date: Fri, 26 Jun 2020 13:13:00 +0200 Subject: [PATCH 256/280] [CI] Fix warning in polkadot-companion-label action (#6514) --- .github/workflows/polkadot-companion-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/polkadot-companion-labels.yml b/.github/workflows/polkadot-companion-labels.yml index 20aaa98a23..27f743e1bd 100644 --- a/.github/workflows/polkadot-companion-labels.yml +++ b/.github/workflows/polkadot-companion-labels.yml @@ -17,7 +17,7 @@ jobs: contexts: 'continuous-integration/gitlab-check-polkadot-companion-build' timeout: 1800 notPresentTimeout: 3600 # It can take quite a while before the job starts... - failedStates: failure + failureStates: failure interruptedStates: error # Error = job was probably cancelled. We don't want to label the PR in that case - name: Label success uses: andymckay/labeler@master -- GitLab From 1a5ebf548590844faac6264a879b72b822a50173 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Fri, 26 Jun 2020 15:35:43 +0200 Subject: [PATCH 257/280] Remove @cecton from CODEOWNERS (#6524) * Initial commit Forked at: 397068219c7a43a743f3979947efec35a8e93536 Parent branch: origin/master * Remove @cecton from CODEOWNERS --- docs/CODEOWNERS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS index b86846aefe..d9342de399 100644 --- a/docs/CODEOWNERS +++ b/docs/CODEOWNERS @@ -66,7 +66,3 @@ # Prometheus endpoint /utils/prometheus/ @mxinden - -# CLI API -/client/cli @cecton -/client/cli-derive @cecton -- GitLab From 4cc4b76e361f55de8ae5dd2bae8226cacf4addcb Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Fri, 26 Jun 2020 15:36:03 +0200 Subject: [PATCH 258/280] Impl From for OpaqueExtrinsic (#6522) --- bin/node/cli/src/service.rs | 12 +++------ .../src/generic/unchecked_extrinsic.rs | 27 +++++++++++++++++++ primitives/runtime/src/lib.rs | 9 ++++++- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index afc9e23d68..3279490363 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -424,13 +424,12 @@ mod tests { use node_primitives::{Block, DigestItem, Signature}; use node_runtime::{BalancesCall, Call, UncheckedExtrinsic, Address}; use node_runtime::constants::{currency::CENTS, time::SLOT_DURATION}; - use codec::{Encode, Decode}; + use codec::Encode; use sp_core::{crypto::Pair as CryptoPair, H256}; use sp_runtime::{ generic::{BlockId, Era, Digest, SignedPayload}, traits::{Block as BlockT, Header as HeaderT}, traits::Verify, - OpaqueExtrinsic, }; use sp_timestamp; use sp_finality_tracker; @@ -605,16 +604,13 @@ mod tests { signer.sign(payload) }); let (function, extra, _) = raw_payload.deconstruct(); - let xt = UncheckedExtrinsic::new_signed( + index += 1; + UncheckedExtrinsic::new_signed( function, from.into(), signature.into(), extra, - ).encode(); - let v: Vec = Decode::decode(&mut xt.as_slice()).unwrap(); - - index += 1; - OpaqueExtrinsic(v) + ).into() }, ); } diff --git a/primitives/runtime/src/generic/unchecked_extrinsic.rs b/primitives/runtime/src/generic/unchecked_extrinsic.rs index 41ff2609fc..d16d404ddf 100644 --- a/primitives/runtime/src/generic/unchecked_extrinsic.rs +++ b/primitives/runtime/src/generic/unchecked_extrinsic.rs @@ -27,6 +27,7 @@ use crate::{ }, generic::CheckedExtrinsic, transaction_validity::{TransactionValidityError, InvalidTransaction}, + OpaqueExtrinsic, }; const TRANSACTION_VERSION: u8 = 4; @@ -316,6 +317,23 @@ where } } +impl From> + for OpaqueExtrinsic +where + Address: Encode, + Signature: Encode, + Call: Encode, + Extra: SignedExtension, +{ + fn from(extrinsic: UncheckedExtrinsic) -> Self { + OpaqueExtrinsic::from_bytes(extrinsic.encode().as_slice()) + .expect( + "both OpaqueExtrinsic and UncheckedExtrinsic have encoding that is compatible with \ + raw Vec encoding; qed" + ) + } +} + #[cfg(test)] mod tests { use super::*; @@ -424,4 +442,13 @@ mod tests { let as_vec: Vec = Decode::decode(&mut encoded.as_slice()).unwrap(); assert_eq!(as_vec.encode(), encoded); } + + #[test] + fn conversion_to_opaque() { + let ux = Ex::new_unsigned(vec![0u8; 0]); + let encoded = ux.encode(); + let opaque: OpaqueExtrinsic = ux.into(); + let opaque_encoded = opaque.encode(); + assert_eq!(opaque_encoded, encoded); + } } diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 881ba3d724..b27cb0c633 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -714,7 +714,14 @@ macro_rules! assert_eq_error_rate { /// Simple blob to hold an extrinsic without committing to its format and ensure it is serialized /// correctly. #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] -pub struct OpaqueExtrinsic(pub Vec); +pub struct OpaqueExtrinsic(Vec); + +impl OpaqueExtrinsic { + /// Convert an encoded extrinsic to an `OpaqueExtrinsic`. + pub fn from_bytes(mut bytes: &[u8]) -> Result { + OpaqueExtrinsic::decode(&mut bytes) + } +} #[cfg(feature = "std")] impl parity_util_mem::MallocSizeOf for OpaqueExtrinsic { -- GitLab From 67513a9adb5053a878ed0d04efcca3c2fa9bb856 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Sat, 27 Jun 2020 01:37:45 +1200 Subject: [PATCH 259/280] Implement Contains for pallet-membership (#6518) * implement Contains for pallet-membership * bump version --- bin/node/runtime/src/lib.rs | 2 +- frame/membership/src/lib.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e3c9c2b95f..c5c11fe577 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -98,7 +98,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 254, - impl_version: 0, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 71b0902838..c8563b52f8 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -26,7 +26,7 @@ use sp_std::prelude::*; use frame_support::{ decl_module, decl_storage, decl_event, decl_error, - traits::{ChangeMembers, InitializeMembers, EnsureOrigin}, + traits::{ChangeMembers, InitializeMembers, EnsureOrigin, Contains}, }; use frame_system::{self as system, ensure_signed}; @@ -264,6 +264,16 @@ impl, I: Instance> Module { } } +impl, I: Instance> Contains for Module { + fn sorted_members() -> Vec { + Self::members() + } + + fn count() -> usize { + Members::::decode_len().unwrap_or(0) + } +} + #[cfg(test)] mod tests { use super::*; -- GitLab From 11d2899793b27e4fe6695a7b3d9cd2962b536258 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 26 Jun 2020 16:48:11 +0200 Subject: [PATCH 260/280] Increase the limit for the maximum size of the telemetry name (#6523) * Increase the limit for the maximum size of the telemetry name * Fix test --- client/cli/src/commands/run_cmd.rs | 4 +++- client/cli/src/config.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index 690cb868c5..de5589196f 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -610,7 +610,9 @@ mod tests { #[test] fn tests_node_name_bad() { - assert!(is_node_name_valid("long names are not very cool for the ui").is_err()); + assert!(is_node_name_valid( + "very very long names are really not very cool for the ui at all, really they're not" + ).is_err()); assert!(is_node_name_valid("Dots.not.Ok").is_err()); assert!(is_node_name_valid("http://visit.me").is_err()); assert!(is_node_name_valid("https://visit.me").is_err()); diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs index 598acd0ab9..5563f46115 100644 --- a/client/cli/src/config.rs +++ b/client/cli/src/config.rs @@ -36,7 +36,7 @@ use std::net::SocketAddr; use std::path::PathBuf; /// The maximum number of characters for a node name. -pub(crate) const NODE_NAME_MAX_LENGTH: usize = 32; +pub(crate) const NODE_NAME_MAX_LENGTH: usize = 64; /// default sub directory to store network config pub(crate) const DEFAULT_NETWORK_CONFIG_PATH: &'static str = "network"; -- GitLab From 0a91a5f71224d05990b50d1aa1de5478fa31039e Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sun, 28 Jun 2020 19:53:58 +0200 Subject: [PATCH 261/280] Fix some broken benchmarks (#6528) --- frame/democracy/src/benchmarking.rs | 6 +++--- frame/multisig/src/benchmarking.rs | 5 ++--- frame/scheduler/src/benchmarking.rs | 13 +++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index d0bd732448..ba3b9a0b13 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -74,13 +74,13 @@ fn add_referendum(n: u32) -> Result { 0.into(), ); let referendum_index: ReferendumIndex = ReferendumCount::get() - 1; - let _ = T::Scheduler::schedule_named( + T::Scheduler::schedule_named( (DEMOCRACY_ID, referendum_index).encode(), - 0.into(), + 1.into(), None, 63, Call::enact_proposal(proposal_hash, referendum_index).into(), - ); + ).map_err(|_| "failed to schedule named")?; Ok(referendum_index) } diff --git a/frame/multisig/src/benchmarking.rs b/frame/multisig/src/benchmarking.rs index 9479c16cb2..8113d179cd 100644 --- a/frame/multisig/src/benchmarking.rs +++ b/frame/multisig/src/benchmarking.rs @@ -22,7 +22,7 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, account}; -use sp_runtime::traits::{Bounded, Saturating}; +use sp_runtime::traits::Bounded; use core::convert::TryInto; use crate::Module as Multisig; @@ -36,8 +36,7 @@ fn setup_multi(s: u32, z: u32) for i in 0 .. s { let signatory = account("signatory", i, SEED); // Give them some balance for a possible deposit - let deposit = T::DepositBase::get() + T::DepositFactor::get() * s.into(); - let balance = T::Currency::minimum_balance().saturating_mul(100.into()) + deposit; + let balance = BalanceOf::::max_value(); T::Currency::make_free_balance_be(&signatory, balance); signatories.push(signatory); } diff --git a/frame/scheduler/src/benchmarking.rs b/frame/scheduler/src/benchmarking.rs index 975c10e3b6..5c580b5525 100644 --- a/frame/scheduler/src/benchmarking.rs +++ b/frame/scheduler/src/benchmarking.rs @@ -29,6 +29,7 @@ use crate::Module as Scheduler; use frame_system::Module as System; const MAX_SCHEDULED: u32 = 50; +const BLOCK_NUMBER: u32 = 2; // Add `n` named items to the schedule fn fill_schedule (when: T::BlockNumber, n: u32) -> Result<(), &'static str> { @@ -55,7 +56,7 @@ benchmarks! { schedule { let s in 0 .. MAX_SCHEDULED; - let when = T::BlockNumber::one(); + let when = BLOCK_NUMBER.into(); let periodic = Some((T::BlockNumber::one(), 100)); let priority = 0; // Essentially a no-op call. @@ -72,7 +73,7 @@ benchmarks! { cancel { let s in 1 .. MAX_SCHEDULED; - let when: T::BlockNumber = 2.into(); + let when = BLOCK_NUMBER.into(); fill_schedule::(when, s)?; assert_eq!(Agenda::::get(when).len(), s as usize); @@ -92,7 +93,7 @@ benchmarks! { schedule_named { let s in 0 .. MAX_SCHEDULED; let id = s.encode(); - let when = T::BlockNumber::one(); + let when = BLOCK_NUMBER.into(); let periodic = Some((T::BlockNumber::one(), 100)); let priority = 0; // Essentially a no-op call. @@ -109,7 +110,7 @@ benchmarks! { cancel_named { let s in 1 .. MAX_SCHEDULED; - let when = T::BlockNumber::one(); + let when = BLOCK_NUMBER.into(); fill_schedule::(when, s)?; }: _(RawOrigin::Root, 0.encode()) @@ -127,9 +128,9 @@ benchmarks! { on_initialize { let s in 0 .. MAX_SCHEDULED; - let when = T::BlockNumber::one(); + let when = BLOCK_NUMBER.into(); fill_schedule::(when, s)?; - }: { Scheduler::::on_initialize(T::BlockNumber::one()); } + }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } verify { assert_eq!(System::::event_count(), s); // Next block should have all the schedules again -- GitLab From 99ee2d7f57c6cc6e307330ed6b7891e0179813d6 Mon Sep 17 00:00:00 2001 From: chenwei Date: Mon, 29 Jun 2020 02:17:15 +0800 Subject: [PATCH 262/280] Implement `()` for `Happened` (#6529) --- frame/support/src/traits.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index f25ff67efb..b36559c363 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -329,6 +329,10 @@ pub trait Happened { fn happened(t: &T); } +impl Happened for () { + fn happened(_: &T) {} +} + /// A shim for placing around a storage item in order to use it as a `StoredValue`. Ideally this /// wouldn't be needed as `StorageValue`s should blanket implement `StoredValue`s, however this /// would break the ability to have custom impls of `StoredValue`. The other workaround is to -- GitLab From a273b48a0f32e7f7a670d3698453e3249521865b Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Mon, 29 Jun 2020 15:59:32 +0200 Subject: [PATCH 263/280] Allow `retract_tip` on `tip_new` (#6511) * Allow `retract_tip` on `tip_new` * initial migration code * test migration * make pub * bump spec --- Cargo.lock | 1 + bin/node/runtime/src/lib.rs | 4 +- frame/treasury/Cargo.toml | 1 + frame/treasury/src/lib.rs | 97 ++++++++++++++++++++++++++++----- frame/treasury/src/tests.rs | 106 ++++++++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89b24d0826..0df37db5ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4665,6 +4665,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-storage", ] [[package]] diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index c5c11fe577..969e66653e 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -97,8 +97,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 254, - impl_version: 1, + spec_version: 255, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 28f972d458..dfab1aca43 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -25,6 +25,7 @@ frame-benchmarking = { version = "2.0.0-rc4", default-features = false, path = " [dev-dependencies] sp-io ={ version = "2.0.0-rc4", path = "../../primitives/io" } sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" } +sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" } [features] default = ["std"] diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index e67ace5475..bb139c4cc6 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -192,13 +192,17 @@ pub struct OpenTip< reason: Hash, /// The account to be tipped. who: AccountId, - /// The account who began this tip and the amount held on deposit. - finder: Option<(AccountId, Balance)>, + /// The account who began this tip. + finder: AccountId, + /// The amount held on deposit for this tip. + deposit: Balance, /// The block number at which this tip will close if `Some`. If `None`, then no closing is /// scheduled. closes: Option, /// The members who have voted for this tip. Sorted by AccountId. tips: Vec<(AccountId, Balance)>, + /// Whether this tip should result in the finder taking a fee. + finders_fee: bool, } decl_storage! { @@ -428,8 +432,15 @@ decl_module! { T::Currency::reserve(&finder, deposit)?; Reasons::::insert(&reason_hash, &reason); - let finder = Some((finder, deposit)); - let tip = OpenTip { reason: reason_hash, who, finder, closes: None, tips: vec![] }; + let tip = OpenTip { + reason: reason_hash, + who, + finder, + deposit, + closes: None, + tips: vec![], + finders_fee: true + }; Tips::::insert(&hash, tip); Self::deposit_event(RawEvent::NewTip(hash)); } @@ -457,12 +468,13 @@ decl_module! { fn retract_tip(origin, hash: T::Hash) { let who = ensure_signed(origin)?; let tip = Tips::::get(&hash).ok_or(Error::::UnknownTip)?; - let (finder, deposit) = tip.finder.ok_or(Error::::NotFinder)?; - ensure!(finder == who, Error::::NotFinder); + ensure!(tip.finder == who, Error::::NotFinder); Reasons::::remove(&tip.reason); Tips::::remove(&hash); - let _ = T::Currency::unreserve(&who, deposit); + if !tip.deposit.is_zero() { + let _ = T::Currency::unreserve(&who, tip.deposit); + } Self::deposit_event(RawEvent::TipRetracted(hash)); } @@ -501,8 +513,16 @@ decl_module! { Reasons::::insert(&reason_hash, &reason); Self::deposit_event(RawEvent::NewTip(hash.clone())); - let tips = vec![(tipper, tip_value)]; - let tip = OpenTip { reason: reason_hash, who, finder: None, closes: None, tips }; + let tips = vec![(tipper.clone(), tip_value)]; + let tip = OpenTip { + reason: reason_hash, + who, + finder: tipper, + deposit: Zero::zero(), + closes: None, + tips, + finders_fee: false, + }; Tips::::insert(&hash, tip); } @@ -667,15 +687,17 @@ impl Module { let treasury = Self::account_id(); let max_payout = Self::pot(); let mut payout = tips[tips.len() / 2].1.min(max_payout); - if let Some((finder, deposit)) = tip.finder { - let _ = T::Currency::unreserve(&finder, deposit); - if finder != tip.who { + if !tip.deposit.is_zero() { + let _ = T::Currency::unreserve(&tip.finder, tip.deposit); + } + if tip.finders_fee { + if tip.finder != tip.who { // pay out the finder's fee. let finders_fee = T::TipFindersFee::get() * payout; payout -= finders_fee; // this should go through given we checked it's at most the free balance, but still // we only make a best-effort. - let _ = T::Currency::transfer(&treasury, &finder, finders_fee, KeepAlive); + let _ = T::Currency::transfer(&treasury, &tip.finder, finders_fee, KeepAlive); } } // same as above: best-effort only. @@ -753,6 +775,55 @@ impl Module { // Must never be less than 0 but better be safe. .saturating_sub(T::Currency::minimum_balance()) } + + pub fn migrate_retract_tip_for_tip_new() { + /// An open tipping "motion". Retains all details of a tip including information on the finder + /// and the members who have voted. + #[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] + pub struct OldOpenTip< + AccountId: Parameter, + Balance: Parameter, + BlockNumber: Parameter, + Hash: Parameter, + > { + /// The hash of the reason for the tip. The reason should be a human-readable UTF-8 encoded string. A URL would be + /// sensible. + reason: Hash, + /// The account to be tipped. + who: AccountId, + /// The account who began this tip and the amount held on deposit. + finder: Option<(AccountId, Balance)>, + /// The block number at which this tip will close if `Some`. If `None`, then no closing is + /// scheduled. + closes: Option, + /// The members who have voted for this tip. Sorted by AccountId. + tips: Vec<(AccountId, Balance)>, + } + + use frame_support::{Twox64Concat, migration::StorageKeyIterator}; + + for (hash, old_tip) in StorageKeyIterator::< + T::Hash, + OldOpenTip, T::BlockNumber, T::Hash>, + Twox64Concat, + >::new(b"Treasury", b"Tips").drain() + { + let (finder, deposit, finders_fee) = match old_tip.finder { + Some((finder, deposit)) => (finder, deposit, true), + None => (T::AccountId::default(), Zero::zero(), false), + }; + let new_tip = OpenTip { + reason: old_tip.reason, + who: old_tip.who, + finder, + deposit, + closes: old_tip.closes, + tips: old_tip.tips, + finders_fee + }; + Tips::::insert(hash, new_tip) + } + } } impl OnUnbalanced> for Module { diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 027e52c1bf..68820ffd5d 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -293,6 +293,7 @@ fn close_tip_works() { #[test] fn retract_tip_works() { new_test_ext().execute_with(|| { + // with report awesome Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_ok!(Treasury::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3)); let h = tip_hash(); @@ -303,6 +304,17 @@ fn retract_tip_works() { assert_ok!(Treasury::retract_tip(Origin::signed(0), h.clone())); System::set_block_number(2); assert_noop!(Treasury::close_tip(Origin::signed(0), h.into()), Error::::UnknownTip); + + // with tip new + Balances::make_free_balance_be(&Treasury::account_id(), 101); + assert_ok!(Treasury::tip_new(Origin::signed(10), b"awesome.dot".to_vec(), 3, 10)); + let h = tip_hash(); + assert_ok!(Treasury::tip(Origin::signed(11), h.clone(), 10)); + assert_ok!(Treasury::tip(Origin::signed(12), h.clone(), 10)); + assert_noop!(Treasury::retract_tip(Origin::signed(0), h.clone()), Error::::NotFinder); + assert_ok!(Treasury::retract_tip(Origin::signed(10), h.clone())); + System::set_block_number(2); + assert_noop!(Treasury::close_tip(Origin::signed(10), h.into()), Error::::UnknownTip); }); } @@ -544,3 +556,97 @@ fn inexistent_account_works() { assert_eq!(Balances::free_balance(3), 99); // Balance of `3` has changed }); } + +#[test] +fn test_last_reward_migration() { + use sp_storage::Storage; + + let mut s = Storage::default(); + + #[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] + pub struct OldOpenTip< + AccountId: Parameter, + Balance: Parameter, + BlockNumber: Parameter, + Hash: Parameter, + > { + /// The hash of the reason for the tip. The reason should be a human-readable UTF-8 encoded string. A URL would be + /// sensible. + reason: Hash, + /// The account to be tipped. + who: AccountId, + /// The account who began this tip and the amount held on deposit. + finder: Option<(AccountId, Balance)>, + /// The block number at which this tip will close if `Some`. If `None`, then no closing is + /// scheduled. + closes: Option, + /// The members who have voted for this tip. Sorted by AccountId. + tips: Vec<(AccountId, Balance)>, + } + + let reason1 = BlakeTwo256::hash(b"reason1"); + let hash1 = BlakeTwo256::hash_of(&(reason1, 10u64)); + + let old_tip_finder = OldOpenTip:: { + reason: reason1, + who: 10, + finder: Some((20, 30)), + closes: Some(13), + tips: vec![(40, 50), (60, 70)] + }; + + let reason2 = BlakeTwo256::hash(b"reason2"); + let hash2 = BlakeTwo256::hash_of(&(reason2, 20u64)); + + let old_tip_no_finder = OldOpenTip:: { + reason: reason2, + who: 20, + finder: None, + closes: Some(13), + tips: vec![(40, 50), (60, 70)] + }; + + let data = vec![ + ( + Tips::::hashed_key_for(hash1), + old_tip_finder.encode().to_vec() + ), + ( + Tips::::hashed_key_for(hash2), + old_tip_no_finder.encode().to_vec() + ), + ]; + + s.top = data.into_iter().collect(); + sp_io::TestExternalities::new(s).execute_with(|| { + Treasury::migrate_retract_tip_for_tip_new(); + + // Test w/ finder + assert_eq!( + Tips::::get(hash1), + Some(OpenTip { + reason: reason1, + who: 10, + finder: 20, + deposit: 30, + closes: Some(13), + tips: vec![(40, 50), (60, 70)], + finders_fee: true, + }) + ); + + // Test w/o finder + assert_eq!( + Tips::::get(hash2), + Some(OpenTip { + reason: reason2, + who: 20, + finder: Default::default(), + deposit: 0, + closes: Some(13), + tips: vec![(40, 50), (60, 70)], + finders_fee: false, + }) + ); + }); +} -- GitLab From fd55c45a0a1fd705297e9a0888acdf277e1149a5 Mon Sep 17 00:00:00 2001 From: Toralf Wittner Date: Tue, 30 Jun 2020 10:02:51 +0200 Subject: [PATCH 264/280] Update to libp2p v0.20.1 (#6465) * Update to libp2p-0.20.0 * Update to `libp2p-0.20.1`. Co-authored-by: Pierre Krieger --- Cargo.lock | 426 +++++++++++++++---------- Cargo.toml | 2 +- bin/node/browser-testing/Cargo.toml | 2 +- bin/utils/subkey/Cargo.toml | 2 +- client/authority-discovery/Cargo.toml | 2 +- client/network-gossip/Cargo.toml | 2 +- client/network/Cargo.toml | 4 +- client/network/src/discovery.rs | 2 +- client/network/test/Cargo.toml | 2 +- client/peerset/Cargo.toml | 2 +- client/telemetry/Cargo.toml | 3 +- client/telemetry/src/worker.rs | 21 +- client/telemetry/src/worker/node.rs | 13 +- primitives/consensus/common/Cargo.toml | 2 +- 14 files changed, 291 insertions(+), 194 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0df37db5ed..8b0273d199 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,6 +16,26 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +[[package]] +name = "aead" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" +dependencies = [ + "aes-soft", + "aesni", + "block-cipher-trait", +] + [[package]] name = "aes-ctr" version = "0.3.0" @@ -28,6 +48,20 @@ dependencies = [ "stream-cipher", ] +[[package]] +name = "aes-gcm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" +dependencies = [ + "aead", + "aes", + "block-cipher-trait", + "ghash", + "subtle 2.2.2", + "zeroize", +] + [[package]] name = "aes-soft" version = "0.3.3" @@ -225,7 +259,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "rustls", "webpki", "webpki-roots 0.19.0", @@ -558,12 +592,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] -name = "chacha20-poly1305-aead" -version = "0.1.2" +name = "chacha20" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77d2058ba29594f69c75e8a9018e0485e3914ca5084e3613cd64529042f5423b" +checksum = "f6a7ae4c498f8447d86baef0fa0831909333f558866fabcb21600625ac5a31c7" dependencies = [ - "constant_time_eq", + "stream-cipher", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48901293601228db2131606f741db33561f7576b5d19c99cd66222380a7dc863" +dependencies = [ + "aead", + "chacha20", + "poly1305", + "stream-cipher", + "zeroize", ] [[package]] @@ -1251,7 +1299,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", ] [[package]] @@ -1329,7 +1377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" dependencies = [ "either", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 2.0.2", "log", "num-traits 0.2.11", @@ -1618,9 +1666,9 @@ checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" dependencies = [ "futures-channel", "futures-core", @@ -1633,9 +1681,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" dependencies = [ "futures-core", "futures-sink", @@ -1652,9 +1700,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" [[package]] name = "futures-core-preview" @@ -1679,7 +1727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "log", "parking_lot 0.9.0", @@ -1690,9 +1738,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" dependencies = [ "futures-core", "futures-task", @@ -1702,15 +1750,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" [[package]] name = "futures-macro" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1720,15 +1768,18 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" [[package]] name = "futures-task" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] [[package]] name = "futures-timer" @@ -1748,9 +1799,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ "futures 0.1.29", "futures-channel", @@ -1760,6 +1811,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1785,7 +1837,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", + "memchr", + "pin-project", +] + +[[package]] +name = "futures_codec" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" +dependencies = [ + "bytes 0.5.4", + "futures 0.3.5", "memchr", "pin-project", ] @@ -1839,6 +1903,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" +dependencies = [ + "polyval", +] + [[package]] name = "gimli" version = "0.20.0" @@ -2260,7 +2333,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 2.0.2", ] @@ -2531,7 +2604,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c7f36acb1841d4c701d30ae1f2cfd242e805991443f75f6935479ed3de64903" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "kvdb", "kvdb-memorydb", @@ -2596,12 +2669,12 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67" +checksum = "db81113df355dea9dddfcb01cd867555298dca29d915f25d1b1a0aad2e29338b" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "libp2p-core-derive", @@ -2619,7 +2692,7 @@ dependencies = [ "libp2p-websocket", "libp2p-yamux", "multihash", - "parity-multiaddr 0.9.0", + "parity-multiaddr 0.9.1", "parking_lot 0.10.2", "pin-project", "smallvec 1.4.0", @@ -2628,23 +2701,23 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.19.0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80a6000296bdbff540b6c00ef82108ef23aa68d195b9333823ea491562c338d7" +checksum = "3a0387b930c3d4c2533dc4893c1e0394185ddcc019846121b1b27491e45a2c08" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", "either", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", "log", "multihash", "multistream-select", - "parity-multiaddr 0.9.0", + "parity-multiaddr 0.9.1", "parking_lot 0.10.2", "pin-project", "prost", @@ -2655,7 +2728,7 @@ dependencies = [ "sha2", "smallvec 1.4.0", "thiserror", - "unsigned-varint", + "unsigned-varint 0.4.0", "void", "zeroize", ] @@ -2676,18 +2749,18 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", ] [[package]] name = "libp2p-identify" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6438ed8ca240c7635c9caa3be6c5258bc0058553ae97ba81737f04e5d33804f5" +checksum = "62f76075b170d908bae616f550ade410d9d27c013fa69042551dbfc757c7c094" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "libp2p-swarm", "log", @@ -2699,16 +2772,16 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d6c1d5100973527ae70d82687465b17049c1b717a7964de38b8e65000878ff" +checksum = "f7c819a5425b2eb3416d67e9c868c5c1e922b6658655e06b9eeafaa41304b876" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.4", "either", "fnv", - "futures 0.3.4", - "futures_codec", + "futures 0.3.5", + "futures_codec 0.4.1", "libp2p-core", "libp2p-swarm", "log", @@ -2719,22 +2792,22 @@ dependencies = [ "sha2", "smallvec 1.4.0", "uint", - "unsigned-varint", + "unsigned-varint 0.4.0", "void", "wasm-timer", ] [[package]] name = "libp2p-mdns" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b00163d13f705aae67c427bea0575f8aaf63da6524f9bd4a5a093b8bda0b38" +checksum = "7f55b2d4b80986e5bf158270ab23268ec0e7f644ece5436fbaabc5155472f357" dependencies = [ "async-std", "data-encoding", "dns-parser", "either", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "libp2p-swarm", @@ -2748,28 +2821,28 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ce63313ad4bce2d76e54c292a1293ea47a0ebbe16708f1513fa62184992f53" +checksum = "be7d913a4cd57de2013257ec73f07d77bfce390b370023e2d59083e5ca079864" dependencies = [ "bytes 0.5.4", "fnv", - "futures 0.3.4", - "futures_codec", + "futures 0.3.5", + "futures_codec 0.4.1", "libp2p-core", "log", "parking_lot 0.10.2", - "unsigned-varint", + "unsigned-varint 0.4.0", ] [[package]] name = "libp2p-noise" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84fd504e27b0eadd451e06b67694ef714bd8374044e7db339bb0cdb83755ddf4" +checksum = "a03db664653369f46ee03fcec483a378c20195089bb43a26cb9fb0058009ac88" dependencies = [ "curve25519-dalek", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "libp2p-core", "log", @@ -2785,11 +2858,11 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb3c4f9273313357d4977799aec69f581cfe9568854919c5b8066018ccf59f5" +checksum = "b8dedd34e35a9728d52d59ef36a218e411359a353f9011b2574b86ee790978f6" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "libp2p-swarm", "log", @@ -2800,13 +2873,13 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b73f0cc119c83a5b619d6d11074a319fdb4aa4daf8088ade00d511418566e28" +checksum = "c99b3c33e96bb402486d5b4f7cbeab14e66e6a2ed010abbb5bb032a05460bfda" dependencies = [ "aes-ctr", "ctr", - "futures 0.3.4", + "futures 0.3.5", "hmac", "js-sys", "lazy_static", @@ -2830,11 +2903,11 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a8101a0e0d5f04562137a476bf5f5423cd5bdab2f7e43a75909668e63cb102" +checksum = "ce53ff4d127cf8b39adf84dbd381ca32d49bd85788cee08e6669da2495993930" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", "rand 0.7.3", @@ -2845,12 +2918,12 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309f95fce9bec755eff5406f8b822fd3969990830c2b54f752e1fc181d5ace3e" +checksum = "9481500c5774c62e8c413e9535b3f33a0e3dbacf2da63b8d3056c686a9df4146" dependencies = [ "async-std", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "get_if_addrs", "ipnet", @@ -2865,7 +2938,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -2875,14 +2948,13 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "085fbe4c05c4116c2164ab4d5a521eb6e00516c444f61b3ee9f68c7b1e53580b" +checksum = "7e4440551bf6519e0a684cd859ea809aec6d798f686e0d6ed03a28c3e76849b8" dependencies = [ "async-tls", - "bytes 0.5.4", "either", - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "log", "quicksink", @@ -2896,11 +2968,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b305d3a8981e68f11c0e17f2d11d5c52fae95e0d7c283f9e462b5b2dab413b2" +checksum = "8da33e7b5f49c75c6a8afb0b8d1e229f5fa48be9f39bd14cdbc21459a02ac6fc" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p-core", "parking_lot 0.10.2", "thiserror", @@ -3197,7 +3269,7 @@ dependencies = [ "sha-1", "sha2", "sha3", - "unsigned-varint", + "unsigned-varint 0.3.3", ] [[package]] @@ -3208,16 +3280,16 @@ checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" [[package]] name = "multistream-select" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74cdcf7cfb3402881e15a1f95116cb033d69b33c83d481e1234777f5ef0c3d2c" +checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" dependencies = [ "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "log", "pin-project", "smallvec 1.4.0", - "unsigned-varint", + "unsigned-varint 0.4.0", ] [[package]] @@ -3318,7 +3390,7 @@ dependencies = [ name = "node-browser-testing" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "jsonrpc-core", "libp2p", @@ -3339,7 +3411,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-support", "frame-system", - "futures 0.3.4", + "futures 0.3.5", "hex-literal", "jsonrpc-core", "log", @@ -3581,7 +3653,7 @@ dependencies = [ name = "node-template" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "log", "node-template-runtime", "parking_lot 0.10.2", @@ -3646,7 +3718,7 @@ dependencies = [ "frame-support", "frame-system", "fs_extra", - "futures 0.3.4", + "futures 0.3.5", "log", "node-executor", "node-primitives", @@ -4731,15 +4803,15 @@ dependencies = [ "percent-encoding 2.1.0", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.3.3", "url 2.1.1", ] [[package]] name = "parity-multiaddr" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ca96399f4a01aa89c59220c4f52ac371940eb4e53e3ce990da796f364bdf69" +checksum = "cc20af3143a62c16e7c9e92ea5c6ae49f7d271d97d4d8fe73afc28f0514a3d0f" dependencies = [ "arrayref", "bs58", @@ -4749,7 +4821,7 @@ dependencies = [ "percent-encoding 2.1.0", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.4.0", "url 2.1.1", ] @@ -4765,7 +4837,7 @@ dependencies = [ "sha-1", "sha2", "sha3", - "unsigned-varint", + "unsigned-varint 0.3.3", ] [[package]] @@ -4977,18 +5049,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.9" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.9" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -5003,9 +5075,9 @@ checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" [[package]] name = "pin-utils" -version = "0.1.0-alpha.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" @@ -5037,6 +5109,25 @@ dependencies = [ "web-sys", ] +[[package]] +name = "poly1305" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5829f50f48e9ddb79f3f7c3097029d0caee30f8286accb241416df603b080b8" +dependencies = [ + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" +dependencies = [ + "cfg-if", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.6" @@ -5799,7 +5890,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "pin-project", "static_assertions", ] @@ -5835,7 +5926,7 @@ dependencies = [ "bytes 0.5.4", "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -5862,7 +5953,7 @@ dependencies = [ name = "sc-basic-authorship" version = "0.8.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -5936,7 +6027,7 @@ dependencies = [ "derive_more", "env_logger 0.7.1", "fdlimit", - "futures 0.3.4", + "futures 0.3.5", "lazy_static", "log", "names", @@ -5972,7 +6063,7 @@ version = "2.0.0-rc4" dependencies = [ "derive_more", "fnv", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "hex-literal", "kvdb", @@ -6053,7 +6144,7 @@ version = "0.8.0-rc4" dependencies = [ "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6092,7 +6183,7 @@ dependencies = [ "derive_more", "env_logger 0.7.1", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "merlin", @@ -6141,7 +6232,7 @@ name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6183,7 +6274,7 @@ dependencies = [ "assert_matches", "derive_more", "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6211,7 +6302,7 @@ name = "sc-consensus-pow" version = "0.8.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-scale-codec", "sc-client-api", @@ -6231,7 +6322,7 @@ dependencies = [ name = "sc-consensus-slots" version = "0.8.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6360,7 +6451,7 @@ dependencies = [ "env_logger 0.7.1", "finality-grandpa", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -6402,7 +6493,7 @@ version = "0.8.0-rc4" dependencies = [ "derive_more", "finality-grandpa", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6418,7 +6509,7 @@ name = "sc-informant" version = "0.8.0-rc4" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-util-mem", "parking_lot 0.10.2", @@ -6480,9 +6571,9 @@ dependencies = [ "erased-serde", "fnv", "fork-tree", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", - "futures_codec", + "futures_codec 0.3.4", "hex", "ip_network", "libp2p", @@ -6519,7 +6610,7 @@ dependencies = [ "substrate-test-runtime-client", "tempfile", "thiserror", - "unsigned-varint", + "unsigned-varint 0.3.3", "void", "wasm-timer", "zeroize", @@ -6530,7 +6621,7 @@ name = "sc-network-gossip" version = "0.8.0-rc4" dependencies = [ "async-std", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6548,7 +6639,7 @@ name = "sc-network-test" version = "0.8.0-rc4" dependencies = [ "env_logger 0.7.1", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6576,7 +6667,7 @@ dependencies = [ "bytes 0.5.4", "env_logger 0.7.1", "fnv", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "hyper 0.13.4", "hyper-rustls", @@ -6606,7 +6697,7 @@ dependencies = [ name = "sc-peerset" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "libp2p", "log", "rand 0.7.3", @@ -6629,7 +6720,7 @@ version = "2.0.0-rc4" dependencies = [ "assert_matches", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", @@ -6667,7 +6758,7 @@ name = "sc-rpc-api" version = "0.8.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6721,7 +6812,7 @@ dependencies = [ "directories", "exit-future", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "hash-db", "jsonrpc-pubsub", @@ -6786,7 +6877,7 @@ dependencies = [ "env_logger 0.7.1", "fdlimit", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "hex-literal", "log", "parity-scale-codec", @@ -6833,8 +6924,7 @@ dependencies = [ name = "sc-telemetry" version = "2.0.0-rc4" dependencies = [ - "bytes 0.5.4", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -6874,7 +6964,7 @@ dependencies = [ "assert_matches", "criterion 0.3.1", "derive_more", - "futures 0.3.4", + "futures 0.3.5", "linked-hash-map", "log", "parity-scale-codec", @@ -6896,7 +6986,7 @@ version = "2.0.0-rc4" dependencies = [ "assert_matches", "derive_more", - "futures 0.3.4", + "futures 0.3.5", "futures-diagnose", "hex", "intervalier", @@ -7101,12 +7191,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "sha2" version = "0.8.1" @@ -7215,13 +7299,13 @@ checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] name = "snow" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb767eee7d257ba202f0b9b08673bc13b22281632ef45267b19f13100accd2f" +checksum = "ce0f91be479494dd92e69d9971bd23ed27037dd1c94fcf558f6c6e74e6afa654" dependencies = [ - "arrayref", - "blake2-rfc", - "chacha20-poly1305-aead", + "aes-gcm", + "blake2", + "chacha20poly1305", "rand 0.7.3", "rand_core 0.5.1", "ring", @@ -7245,22 +7329,18 @@ dependencies = [ [[package]] name = "soketto" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" +checksum = "85457366ae0c6ce56bf05a958aef14cd38513c236568618edbcd9a8c52cb80b0" dependencies = [ - "base64 0.11.0", + "base64 0.12.0", "bytes 0.5.4", "flate2", - "futures 0.3.4", - "http 0.2.1", + "futures 0.3.5", "httparse", "log", "rand 0.7.3", - "sha1", - "smallvec 1.4.0", - "static_assertions", - "thiserror", + "sha-1", ] [[package]] @@ -7428,7 +7508,7 @@ name = "sp-consensus" version = "0.8.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "libp2p", "log", @@ -7509,7 +7589,7 @@ dependencies = [ "criterion 0.2.11", "derive_more", "ed25519-dalek", - "futures 0.3.4", + "futures 0.3.5", "hash-db", "hash256-std-hasher", "hex", @@ -7612,7 +7692,7 @@ dependencies = [ name = "sp-io" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "hash-db", "libsecp256k1", "log", @@ -7911,7 +7991,7 @@ name = "sp-transaction-pool" version = "2.0.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "log", "parity-scale-codec", "serde", @@ -7943,7 +8023,7 @@ dependencies = [ name = "sp-utils" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "futures-core", "futures-timer 3.0.2", "lazy_static", @@ -8127,7 +8207,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "futures 0.1.29", - "futures 0.3.4", + "futures 0.3.5", "futures-timer 3.0.2", "js-sys", "kvdb-web", @@ -8157,7 +8237,7 @@ version = "2.0.0-rc4" dependencies = [ "frame-support", "frame-system", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-client-transports", "jsonrpc-core", "parity-scale-codec", @@ -8173,7 +8253,7 @@ version = "2.0.0-rc4" dependencies = [ "env_logger 0.7.1", "frame-system-rpc-runtime-api", - "futures 0.3.4", + "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8209,7 +8289,7 @@ dependencies = [ name = "substrate-test-client" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "hash-db", "parity-scale-codec", "sc-client-api", @@ -8273,7 +8353,7 @@ dependencies = [ name = "substrate-test-runtime-client" version = "2.0.0-rc4" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "parity-scale-codec", "sc-block-builder", "sc-client-api", @@ -8294,7 +8374,7 @@ name = "substrate-test-runtime-transaction-pool" version = "2.0.0-rc4" dependencies = [ "derive_more", - "futures 0.3.4", + "futures 0.3.5", "parity-scale-codec", "parking_lot 0.10.2", "sc-transaction-graph", @@ -9153,6 +9233,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +[[package]] +name = "universal-hash" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" +dependencies = [ + "generic-array", + "subtle 2.2.2", +] + [[package]] name = "unsigned-varint" version = "0.3.3" @@ -9162,7 +9252,17 @@ dependencies = [ "bytes 0.5.4", "futures-io", "futures-util", - "futures_codec", + "futures_codec 0.3.4", +] + +[[package]] +name = "unsigned-varint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" +dependencies = [ + "bytes 0.5.4", + "futures_codec 0.4.1", ] [[package]] @@ -9396,7 +9496,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "js-sys", "parking_lot 0.9.0", "pin-utils", @@ -9636,11 +9736,11 @@ dependencies = [ [[package]] name = "yamux" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84300bb493cc878f3638b981c62b4632ec1a5c52daaa3036651e8c106d3b55ea" +checksum = "cd37e58a1256a0b328ce9c67d8b62ecdd02f4803ba443df478835cb1a41a637c" dependencies = [ - "futures 0.3.4", + "futures 0.3.5", "log", "nohash-hasher", "parking_lot 0.10.2", diff --git a/Cargo.toml b/Cargo.toml index d1c7339b99..ba146e55bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -206,7 +206,7 @@ blake2 = { opt-level = 3 } blake2-rfc = { opt-level = 3 } blake2b_simd = { opt-level = 3 } blake2s_simd = { opt-level = 3 } -chacha20-poly1305-aead = { opt-level = 3 } +chacha20poly1305 = { opt-level = 3 } cranelift-codegen = { opt-level = 3 } cranelift-wasm = { opt-level = 3 } crc32fast = { opt-level = 3 } diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml index d8710b0b4b..0fa2c4d51a 100644 --- a/bin/node/browser-testing/Cargo.toml +++ b/bin/node/browser-testing/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" [dependencies] futures-timer = "3.0.2" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } jsonrpc-core = "14.2.0" serde = "1.0.106" serde_json = "1.0.48" diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml index 92fffe898f..5ade94275e 100644 --- a/bin/utils/subkey/Cargo.toml +++ b/bin/utils/subkey/Cargo.toml @@ -33,7 +33,7 @@ derive_more = { version = "0.99.2" } sc-rpc = { version = "2.0.0-rc4", path = "../../../client/rpc" } jsonrpc-core-client = { version = "14.2.0", features = ["http"] } hyper = "0.12.35" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } serde_json = "1.0" [features] diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index 84a37bd16c..a3ff17d9e0 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", default-features = false, version = "1 derive_more = "0.99.2" futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.1", default-features = false, features = ["kad"] } +libp2p = { version = "0.20.1", default-features = false, features = ["kad"] } log = "0.4.8" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc4"} prost = "0.6.1" diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml index 51e15e24ce..aba5b49563 100644 --- a/client/network-gossip/Cargo.toml +++ b/client/network-gossip/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" futures-timer = "3.0.1" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } log = "0.4.8" lru = "0.4.3" sc-network = { version = "0.8.0-rc4", path = "../network" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index f0ba362e48..495895c740 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -63,7 +63,7 @@ wasm-timer = "0.2" zeroize = "1.0.0" [dependencies.libp2p] -version = "0.19.1" +version = "0.20.1" default-features = false features = ["identify", "kad", "mdns", "mplex", "noise", "ping", "tcp-async-std", "websocket", "yamux"] @@ -71,7 +71,7 @@ features = ["identify", "kad", "mdns", "mplex", "noise", "ping", "tcp-async-std" async-std = "1.5" assert_matches = "1.3" env_logger = "0.7.0" -libp2p = { version = "0.19.1", default-features = false, features = ["secio"] } +libp2p = { version = "0.20.1", default-features = false, features = ["secio"] } quickcheck = "0.9.0" rand = "0.7.2" sp-keyring = { version = "2.0.0-rc4", path = "../../primitives/keyring" } diff --git a/client/network/src/discovery.rs b/client/network/src/discovery.rs index 73a5916947..c48722c0f7 100644 --- a/client/network/src/discovery.rs +++ b/client/network/src/discovery.rs @@ -601,7 +601,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { Ok(ok) => { let results = ok.records .into_iter() - .map(|r| (r.key, r.value)) + .map(|r| (r.record.key, r.record.value)) .collect(); DiscoveryOut::ValueFound(results) diff --git a/client/network/test/Cargo.toml b/client/network/test/Cargo.toml index 393887572c..6527d093bd 100644 --- a/client/network/test/Cargo.toml +++ b/client/network/test/Cargo.toml @@ -19,7 +19,7 @@ parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" rand = "0.7.2" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } sc-consensus = { version = "0.8.0-rc4", path = "../../../client/consensus/common" } sc-client-api = { version = "2.0.0-rc4", path = "../../api" } diff --git a/client/peerset/Cargo.toml b/client/peerset/Cargo.toml index eb7f237548..bdec765eda 100644 --- a/client/peerset/Cargo.toml +++ b/client/peerset/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.4" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } sp-utils = { version = "2.0.0-rc4", path = "../../primitives/utils"} log = "0.4.8" serde_json = "1.0.41" diff --git a/client/telemetry/Cargo.toml b/client/telemetry/Cargo.toml index 95c430dad7..8d4aecc468 100644 --- a/client/telemetry/Cargo.toml +++ b/client/telemetry/Cargo.toml @@ -14,12 +14,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -bytes = "0.5" parking_lot = "0.10.0" futures = "0.3.4" futures-timer = "3.0.1" wasm-timer = "0.2.0" -libp2p = { version = "0.19.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] } +libp2p = { version = "0.20.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] } log = "0.4.8" pin-project = "0.4.6" rand = "0.7.2" diff --git a/client/telemetry/src/worker.rs b/client/telemetry/src/worker.rs index 68d4c4e209..e01ac62d12 100644 --- a/client/telemetry/src/worker.rs +++ b/client/telemetry/src/worker.rs @@ -28,7 +28,6 @@ //! events indicating what happened since the latest polling. //! -use bytes::BytesMut; use futures::{prelude::*, ready}; use libp2p::{core::transport::OptionalTransport, Multiaddr, Transport, wasm_ext}; use log::{trace, warn, error}; @@ -61,8 +60,8 @@ impl, I> StreamAndSink for T {} type WsTrans = libp2p::core::transport::boxed::Boxed< Pin, + Vec, + Item = Result, io::Error>, Error = io::Error > + Send>>, io::Error @@ -92,12 +91,12 @@ impl TelemetryWorker { libp2p::websocket::framed::WsConfig::new(inner) .and_then(|connec, _| { let connec = connec - .with(|item: BytesMut| { + .with(|item| { let item = libp2p::websocket::framed::OutgoingData::Binary(item); future::ready(Ok::<_, io::Error>(item)) }) .try_filter(|item| future::ready(item.is_data())) - .map_ok(|data| BytesMut::from(data.as_ref())); + .map_ok(|data| data.into_bytes()); future::ready(Ok::<_, io::Error>(connec)) }) }); @@ -189,7 +188,7 @@ impl TelemetryWorker { /// For some context, we put this object around the `wasm_ext::ExtTransport` in order to make sure /// that each telemetry message maps to one single call to `write` in the WASM FFI. #[pin_project::pin_project] -struct StreamSink(#[pin] T, Option); +struct StreamSink(#[pin] T, Option>); impl From for StreamSink { fn from(inner: T) -> StreamSink { @@ -198,15 +197,15 @@ impl From for StreamSink { } impl Stream for StreamSink { - type Item = Result; + type Item = Result, io::Error>; fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let this = self.project(); - let mut buf = [0; 128]; + let mut buf = vec![0; 128]; match ready!(AsyncRead::poll_read(this.0, cx, &mut buf)) { Ok(0) => Poll::Ready(None), Ok(n) => { - let buf: BytesMut = buf[..n].into(); + buf.truncate(n); Poll::Ready(Some(Ok(buf))) }, Err(err) => Poll::Ready(Some(Err(err))), @@ -232,7 +231,7 @@ impl StreamSink { } } -impl Sink for StreamSink { +impl Sink> for StreamSink { type Error = io::Error; fn poll_ready(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { @@ -240,7 +239,7 @@ impl Sink for StreamSink { Poll::Ready(Ok(())) } - fn start_send(self: Pin<&mut Self>, item: BytesMut) -> Result<(), Self::Error> { + fn start_send(self: Pin<&mut Self>, item: Vec) -> Result<(), Self::Error> { let this = self.project(); debug_assert!(this.1.is_none()); *this.1 = Some(item); diff --git a/client/telemetry/src/worker/node.rs b/client/telemetry/src/worker/node.rs index 6b1a0f62b1..eef7ca7e81 100644 --- a/client/telemetry/src/worker/node.rs +++ b/client/telemetry/src/worker/node.rs @@ -18,7 +18,6 @@ //! Contains the `Node` struct, which handles communications with a single telemetry endpoint. -use bytes::BytesMut; use futures::prelude::*; use futures_timer::Delay; use libp2p::Multiaddr; @@ -57,7 +56,7 @@ struct NodeSocketConnected { /// Where to send data. sink: TTrans::Output, /// Queue of packets to send. - pending: VecDeque, + pending: VecDeque>, /// If true, we need to flush the sink. need_flush: bool, /// A timeout for the socket to write data. @@ -103,15 +102,15 @@ impl Node { impl Node where TTrans: Clone + Unpin, TTrans::Dial: Unpin, - TTrans::Output: Sink - + Stream> + TTrans::Output: Sink, Error = TSinkErr> + + Stream, TSinkErr>> + Unpin, TSinkErr: fmt::Debug { /// Sends a WebSocket frame to the node. Returns an error if we are not connected to the node. /// /// After calling this method, you should call `poll` in order for it to be properly processed. - pub fn send_message(&mut self, payload: impl Into) -> Result<(), ()> { + pub fn send_message(&mut self, payload: impl Into>) -> Result<(), ()> { if let NodeSocket::Connected(NodeSocketConnected { pending, .. }) = &mut self.socket { if pending.len() <= MAX_PENDING { trace!(target: "telemetry", "Adding log entry to queue for {:?}", self.addr); @@ -203,8 +202,8 @@ fn gen_rand_reconnect_delay() -> Delay { } impl NodeSocketConnected -where TTrans::Output: Sink - + Stream> +where TTrans::Output: Sink, Error = TSinkErr> + + Stream, TSinkErr>> + Unpin { /// Processes the queue of messages for the connected socket. diff --git a/primitives/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml index eff425e440..39c47545c2 100644 --- a/primitives/consensus/common/Cargo.toml +++ b/primitives/consensus/common/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.2" -libp2p = { version = "0.19.1", default-features = false } +libp2p = { version = "0.20.1", default-features = false } log = "0.4.8" sp-core = { path= "../../core", version = "2.0.0-rc4"} sp-inherents = { version = "2.0.0-rc4", path = "../../inherents" } -- GitLab From 9dd12f98c5f349e3d71b9419f8104f4e5414ddaf Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Tue, 30 Jun 2020 10:10:18 +0200 Subject: [PATCH 265/280] Remove unecessary &mut in call argument (#6540) --- primitives/api/proc-macro/src/impl_runtime_apis.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index 4b5c1c4706..a4c35dcf42 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -83,7 +83,7 @@ fn generate_impl_call( let (#( #pnames ),*) : ( #( #ptypes ),* ) = match #c::DecodeLimit::decode_all_with_depth_limit( #c::MAX_EXTRINSIC_DEPTH, - &mut #input, + &#input, ) { Ok(res) => res, Err(e) => panic!("Bad input data provided to {}: {}", #fn_name_str, e.what()), -- GitLab From 0d0a84db85c71631c11fbf1bb4a996319654b9c3 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Tue, 30 Jun 2020 10:31:32 +0200 Subject: [PATCH 266/280] feat: Allocate ss58 address format to DataHighway (#6530) --- primitives/core/src/crypto.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index 9b84bd84ca..aa77345993 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -474,6 +474,8 @@ ss58_address_format!( (20, "stafi", "Stafi mainnet, standard account (*25519).") RobonomicsAccount => (32, "robonomics", "Any Robonomics network standard account (*25519).") + DataHighwayAccount => + (33, "datahighway", "DataHighway mainnet, standard account (*25519).") CentrifugeAccount => (36, "centrifuge", "Centrifuge Chain mainnet, standard account (*25519).") SubstrateAccount => -- GitLab From 4eaea348c9ea2568e486be475075d111971e85e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 30 Jun 2020 11:02:46 +0200 Subject: [PATCH 267/280] Fix tx-pool returning the same transaction multiple times (#6535) * Fix tx-pool returning the same transaction multiple times This fixes a bug that lead to returning the same transaction multiple times when iterating the `ready` iterator. Internally the transaction was kept in the `best` list and could be duplicated in that list be re-inserting it again. This `best` list is using a `TransactionRef` which internally uses a `insertion_id`. This `insertion_id` could lead to the same transaction being inserted multiple times into the `best` list. * Update client/transaction-pool/src/testing/pool.rs Co-authored-by: Nikolay Volf Co-authored-by: Nikolay Volf --- client/transaction-pool/graph/src/ready.rs | 24 ++++++++---------- client/transaction-pool/src/revalidation.rs | 8 +++--- client/transaction-pool/src/testing/pool.rs | 25 +++++++++++++++++++ test-utils/runtime/src/lib.rs | 14 +++++++++-- .../runtime/transaction-pool/src/lib.rs | 16 ++++++++---- 5 files changed, 63 insertions(+), 24 deletions(-) diff --git a/client/transaction-pool/graph/src/ready.rs b/client/transaction-pool/graph/src/ready.rs index 47289f26f0..b98512b05d 100644 --- a/client/transaction-pool/graph/src/ready.rs +++ b/client/transaction-pool/graph/src/ready.rs @@ -275,12 +275,7 @@ impl ReadyTransactions { ) -> Vec>> { let mut removed = vec![]; let mut ready = self.ready.write(); - loop { - let hash = match to_remove.pop() { - Some(hash) => hash, - None => return removed, - }; - + while let Some(hash) = to_remove.pop() { if let Some(mut tx) = ready.remove(&hash) { let invalidated = tx.transaction.transaction.provides .iter() @@ -319,6 +314,8 @@ impl ReadyTransactions { removed.push(tx.transaction.transaction); } } + + removed } /// Removes transactions that provide given tag. @@ -330,17 +327,16 @@ impl ReadyTransactions { let mut removed = vec![]; let mut to_remove = vec![tag]; - loop { - let tag = match to_remove.pop() { - Some(tag) => tag, - None => return removed, - }; - + while let Some(tag) = to_remove.pop() { let res = self.provided_tags.remove(&tag) - .and_then(|hash| self.ready.write().remove(&hash)); + .and_then(|hash| self.ready.write().remove(&hash)); if let Some(tx) = res { let unlocks = tx.unlocks; + + // Make sure we remove it from best txs + self.best.remove(&tx.transaction); + let tx = tx.transaction.transaction; // prune previous transactions as well @@ -403,6 +399,8 @@ impl ReadyTransactions { removed.push(tx); } } + + removed } /// Checks if the transaction is providing the same tags as other transactions. diff --git a/client/transaction-pool/src/revalidation.rs b/client/transaction-pool/src/revalidation.rs index cb49560662..af9a76c055 100644 --- a/client/transaction-pool/src/revalidation.rs +++ b/client/transaction-pool/src/revalidation.rs @@ -141,14 +141,14 @@ impl RevalidationWorker { // which they got into the pool while left > 0 { let first_block = match self.block_ordered.keys().next().cloned() { - Some(bn) => bn, - None => break, + Some(bn) => bn, + None => break, }; let mut block_drained = false; if let Some(extrinsics) = self.block_ordered.get_mut(&first_block) { let to_queue = extrinsics.iter().take(left).cloned().collect::>(); if to_queue.len() == extrinsics.len() { - block_drained = true; + block_drained = true; } else { for xt in &to_queue { extrinsics.remove(xt); @@ -159,7 +159,7 @@ impl RevalidationWorker { } if block_drained { - self.block_ordered.remove(&first_block); + self.block_ordered.remove(&first_block); } } diff --git a/client/transaction-pool/src/testing/pool.rs b/client/transaction-pool/src/testing/pool.rs index 61aba5efe3..5ad79a6f75 100644 --- a/client/transaction-pool/src/testing/pool.rs +++ b/client/transaction-pool/src/testing/pool.rs @@ -1066,3 +1066,28 @@ fn import_notification_to_pool_maintain_works() { block_on(pool.maintain(evt.into())); assert_eq!(pool.status().ready, 0); } + +// When we prune transactions, we need to make sure that we remove +#[test] +fn pruning_a_transaction_should_remove_it_from_best_transaction() { + let (pool, _guard, _notifier) = maintained_pool(); + + let xt1 = Extrinsic::IncludeData(Vec::new()); + + block_on(pool.submit_one(&BlockId::number(0), SOURCE, xt1.clone())).expect("1. Imported"); + let header = pool.api.push_block(1, vec![xt1.clone()]); + + // This will prune `xt1`. + block_on(pool.maintain(block_event(header))); + + // Submit the tx again. + block_on(pool.submit_one(&BlockId::number(1), SOURCE, xt1.clone())).expect("2. Imported"); + + let mut iterator = block_on(pool.ready_at(1)); + + assert_eq!(iterator.next().unwrap().data, xt1.clone()); + + // If the tx was not removed from the best txs, the tx would be + // returned a second time by the iterator. + assert!(iterator.next().is_none()); +} diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 1d376a0940..06054c1240 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -194,10 +194,20 @@ impl sp_runtime::traits::Dispatchable for Extrinsic { } impl Extrinsic { + /// Convert `&self` into `&Transfer`. + /// + /// Panics if this is no `Transfer` extrinsic. pub fn transfer(&self) -> &Transfer { + self.try_transfer().expect("cannot convert to transfer ref") + } + + /// Try to convert `&self` into `&Transfer`. + /// + /// Returns `None` if this is no `Transfer` extrinsic. + pub fn try_transfer(&self) -> Option<&Transfer> { match self { - Extrinsic::Transfer { ref transfer, .. } => transfer, - _ => panic!("cannot convert to transfer ref"), + Extrinsic::Transfer { ref transfer, .. } => Some(transfer), + _ => None, } } } diff --git a/test-utils/runtime/transaction-pool/src/lib.rs b/test-utils/runtime/transaction-pool/src/lib.rs index 5140cb8b92..17cecd394a 100644 --- a/test-utils/runtime/transaction-pool/src/lib.rs +++ b/test-utils/runtime/transaction-pool/src/lib.rs @@ -209,13 +209,19 @@ impl sc_transaction_graph::ChainApi for TestApi { ) -> Self::ValidationFuture { self.validation_requests.write().push(uxt.clone()); - let chain_nonce = self.chain.read().nonces.get(&uxt.transfer().from).cloned().unwrap_or(0); - let requires = if chain_nonce == uxt.transfer().nonce { - vec![] + let (requires, provides) = if let Some(transfer) = uxt.try_transfer() { + let chain_nonce = self.chain.read().nonces.get(&transfer.from).cloned().unwrap_or(0); + let requires = if chain_nonce == transfer.nonce { + vec![] + } else { + vec![vec![chain_nonce as u8]] + }; + let provides = vec![vec![transfer.nonce as u8]]; + + (requires, provides) } else { - vec![vec![chain_nonce as u8]] + (Vec::new(), vec![uxt.encode()]) }; - let provides = vec![vec![uxt.transfer().nonce as u8]]; if self.chain.read().invalid_hashes.contains(&self.hash_and_length(&uxt).0) { return futures::future::ready(Ok( -- GitLab From ec2ab7978a54e7f20af2f9ac12bde7719bb744fb Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 30 Jun 2020 12:00:42 +0200 Subject: [PATCH 268/280] Remove the service, replacing it with a struct of individual chain components (#6352) * WIP * Making progress * Almost ready * Get service tests compiling * Fix node screenshot * Line widths * Fix node cli tests * Fix node cli warning * ChainComponents -> ServiceComponents, fix tests * make spawn_handle public * Remove spawnnamed impl for taskmanager * Move the keep alive stuff to the task manager * Move the telemetry, base path, rpc keep_alive to the service builder * Make the task manager keep alive an internal detail * Rewrite the browser start_client future * Remove run_node etc * Revert my personal changes to browser-demo/build.sh * use |config| * Add a runtime_version function to SubstrateCli * Reexport role and runtime version from sc cli * Update Cargo.lock * runtime_version -> native_runtime_version * Pass chain spec to native_runtime_version for polkadot * Fix line widths * Traitify ServiceComponents Client --- bin/node-template/node/src/command.rs | 15 +- bin/node-template/node/src/service.rs | 48 +-- bin/node/cli/src/browser.rs | 8 +- bin/node/cli/src/chain_spec.rs | 12 +- bin/node/cli/src/command.rs | 15 +- bin/node/cli/src/service.rs | 371 +++++++++++--------- bin/node/testing/src/bench.rs | 2 +- client/api/src/client.rs | 3 + client/cli/src/lib.rs | 7 +- client/cli/src/runner.rs | 104 +----- client/finality-grandpa/src/light_import.rs | 2 +- client/service/src/builder.rs | 169 ++++----- client/service/src/client/client.rs | 11 +- client/service/src/lib.rs | 324 ++++------------- client/service/src/task_manager.rs | 62 +++- client/service/test/src/client/light.rs | 8 +- client/service/test/src/lib.rs | 211 +++++++---- test-utils/client/src/client_ext.rs | 1 + utils/browser/src/lib.rs | 43 +-- 19 files changed, 640 insertions(+), 776 deletions(-) diff --git a/bin/node-template/node/src/command.rs b/bin/node-template/node/src/command.rs index 18e1b22a53..4f2fd3aad6 100644 --- a/bin/node-template/node/src/command.rs +++ b/bin/node-template/node/src/command.rs @@ -18,7 +18,7 @@ use crate::chain_spec; use crate::cli::Cli; use crate::service; -use sc_cli::SubstrateCli; +use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; impl SubstrateCli for Cli { fn impl_name() -> &'static str { @@ -58,6 +58,10 @@ impl SubstrateCli for Cli { )?), }) } + + fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { + &node_template_runtime::VERSION + } } /// Parse and run command line arguments @@ -71,11 +75,10 @@ pub fn run() -> sc_cli::Result<()> { } None => { let runner = cli.create_runner(&cli.run)?; - runner.run_node( - service::new_light, - service::new_full, - node_template_runtime::VERSION - ) + runner.run_node_until_exit(|config| match config.role { + Role::Light => service::new_light(config), + _ => service::new_full(config), + }) } } } diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index e330c17b24..89bf159927 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -5,7 +5,10 @@ use std::time::Duration; use sc_client_api::ExecutorProvider; use sc_consensus::LongestChain; use node_template_runtime::{self, opaque::Block, RuntimeApi}; -use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder}; +use sc_service::{ + error::{Error as ServiceError}, Configuration, ServiceBuilder, ServiceComponents, + TaskManager, +}; use sp_inherents::InherentDataProviders; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; @@ -93,7 +96,7 @@ macro_rules! new_full_start { } /// Builds a new service for a full client. -pub fn new_full(config: Configuration) -> Result { +pub fn new_full(config: Configuration) -> Result { let role = config.role.clone(); let force_authoring = config.force_authoring; let name = config.network.node_name.clone(); @@ -105,7 +108,10 @@ pub fn new_full(config: Configuration) -> Result>; @@ -115,13 +121,12 @@ pub fn new_full(config: Configuration) -> Result Result( sc_consensus_aura::slot_duration(&*client)?, - client, + client.clone(), select_chain, block_import, proposer, - service.network(), + network.clone(), inherent_data_providers.clone(), force_authoring, - service.keystore(), + keystore.clone(), can_author_with, )?; // the AURA authoring task is considered essential, i.e. if it // fails we take down the service with it. - service.spawn_essential_task_handle().spawn_blocking("aura", aura); + task_manager.spawn_essential_handle().spawn_blocking("aura", aura); } // if the node isn't actively participating in consensus then it doesn't // need a keystore, regardless of which protocol we use below. let keystore = if role.is_authority() { - Some(service.keystore() as sp_core::traits::BareCryptoStorePtr) + Some(keystore.clone() as sp_core::traits::BareCryptoStorePtr) } else { None }; @@ -174,33 +179,33 @@ pub fn new_full(config: Configuration) -> Result Result { +pub fn new_light(config: Configuration) -> Result { let inherent_data_providers = InherentDataProviders::new(); ServiceBuilder::new_light::(config)? @@ -265,4 +270,5 @@ pub fn new_light(config: Configuration) -> Result, log_level: String) -> Result ChainSpec { #[cfg(test)] pub(crate) mod tests { use super::*; - use crate::service::{new_full, new_light}; + use crate::service::{new_full_base, new_light_base}; use sc_service_test; use sp_runtime::BuildStorage; @@ -430,8 +430,14 @@ pub(crate) mod tests { fn test_connectivity() { sc_service_test::connectivity( integration_test_config_with_two_authorities(), - |config| new_full(config), - |config| new_light(config), + |config| { + let (keep_alive, _, client, network, transaction_pool) = new_full_base(config,|_, _| ())?; + Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool)) + }, + |config| { + let (keep_alive, _, client, network, transaction_pool) = new_light_base(config)?; + Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool)) + } ); } diff --git a/bin/node/cli/src/command.rs b/bin/node/cli/src/command.rs index bd5483f2cd..b07e0cdc90 100644 --- a/bin/node/cli/src/command.rs +++ b/bin/node/cli/src/command.rs @@ -19,7 +19,7 @@ use crate::{chain_spec, service, Cli, Subcommand}; use node_executor::Executor; use node_runtime::{Block, RuntimeApi}; -use sc_cli::{Result, SubstrateCli}; +use sc_cli::{Result, SubstrateCli, RuntimeVersion, Role, ChainSpec}; impl SubstrateCli for Cli { fn impl_name() -> &'static str { @@ -61,6 +61,10 @@ impl SubstrateCli for Cli { )?), }) } + + fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { + &node_runtime::VERSION + } } /// Parse command line arguments into service configuration. @@ -70,11 +74,10 @@ pub fn run() -> Result<()> { match &cli.subcommand { None => { let runner = cli.create_runner(&cli.run)?; - runner.run_node( - service::new_light, - service::new_full, - node_runtime::VERSION - ) + runner.run_node_until_exit(|config| match config.role { + Role::Light => service::new_light(config), + _ => service::new_full(config), + }) } Some(Subcommand::Inspect(cmd)) => { let runner = cli.create_runner(cmd)?; diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index 3279490363..9707e3d8ca 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -29,10 +29,16 @@ use node_executor; use node_primitives::Block; use node_runtime::RuntimeApi; use sc_service::{ - AbstractService, ServiceBuilder, config::Configuration, error::{Error as ServiceError}, + ServiceBuilder, config::{Role, Configuration}, error::{Error as ServiceError}, + RpcHandlers, ServiceComponents, TaskManager, }; use sp_inherents::InherentDataProviders; use sc_consensus::LongestChain; +use sc_network::{Event, NetworkService}; +use sp_runtime::traits::Block as BlockT; +use futures::prelude::*; +use sc_client_api::ExecutorProvider; +use sp_core::traits::BareCryptoStorePtr; /// Starts a `ServiceBuilder` for a full service. /// @@ -147,183 +153,197 @@ macro_rules! new_full_start { }} } -/// Creates a full service from the configuration. -/// -/// We need to use a macro because the test suit doesn't work with an opaque service. It expects -/// concrete types instead. -macro_rules! new_full { - ($config:expr, $with_startup_data: expr) => {{ - use futures::prelude::*; - use sc_network::Event; - use sc_client_api::ExecutorProvider; - use sp_core::traits::BareCryptoStorePtr; - - let ( - role, - force_authoring, - name, - disable_grandpa, - ) = ( - $config.role.clone(), - $config.force_authoring, - $config.network.node_name.clone(), - $config.disable_grandpa, - ); +type FullClient = sc_service::TFullClient; +type FullBackend = sc_service::TFullBackend; +type GrandpaBlockImport = grandpa::GrandpaBlockImport< + FullBackend, Block, FullClient, sc_consensus::LongestChain +>; +type BabeBlockImport = sc_consensus_babe::BabeBlockImport; - let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = - new_full_start!($config); +/// Creates a full service from the configuration. +pub fn new_full_base( + config: Configuration, + with_startup_data: impl FnOnce(&BabeBlockImport, &sc_consensus_babe::BabeLink) +) -> Result<( + TaskManager, + InherentDataProviders, + Arc, Arc::Hash>>, + Arc, Block>> +), ServiceError> { + let ( + role, + force_authoring, + name, + disable_grandpa, + ) = ( + config.role.clone(), + config.force_authoring, + config.network.node_name.clone(), + config.disable_grandpa, + ); + + let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = + new_full_start!(config); + + let ServiceComponents { + client, transaction_pool, task_manager, keystore, network, select_chain, + prometheus_registry, telemetry_on_connect_sinks, .. + } = builder + .with_finality_proof_provider(|client, backend| { + // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider + let provider = client as Arc>; + Ok(Arc::new(grandpa::FinalityProofProvider::new(backend, provider)) as _) + })? + .build_full()?; - let service = builder - .with_finality_proof_provider(|client, backend| { - // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider - let provider = client as Arc>; - Ok(Arc::new(grandpa::FinalityProofProvider::new(backend, provider)) as _) - })? - .build_full()?; + let (block_import, grandpa_link, babe_link) = import_setup.take() + .expect("Link Half and Block Import are present for Full Services or setup failed before. qed"); - let (block_import, grandpa_link, babe_link) = import_setup.take() - .expect("Link Half and Block Import are present for Full Services or setup failed before. qed"); + let shared_voter_state = rpc_setup.take() + .expect("The SharedVoterState is present for Full Services or setup failed before. qed"); - let shared_voter_state = rpc_setup.take() - .expect("The SharedVoterState is present for Full Services or setup failed before. qed"); + (with_startup_data)(&block_import, &babe_link); - ($with_startup_data)(&block_import, &babe_link); + if let sc_service::config::Role::Authority { .. } = &role { + let proposer = sc_basic_authorship::ProposerFactory::new( + client.clone(), + transaction_pool.clone(), + prometheus_registry.as_ref(), + ); - if let sc_service::config::Role::Authority { .. } = &role { - let proposer = sc_basic_authorship::ProposerFactory::new( - service.client(), - service.transaction_pool(), - service.prometheus_registry().as_ref(), - ); + let select_chain = select_chain + .ok_or(sc_service::Error::SelectChainRequired)?; - let client = service.client(); - let select_chain = service.select_chain() - .ok_or(sc_service::Error::SelectChainRequired)?; + let can_author_with = + sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - let can_author_with = - sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); + let babe_config = sc_consensus_babe::BabeParams { + keystore: keystore.clone(), + client: client.clone(), + select_chain, + env: proposer, + block_import, + sync_oracle: network.clone(), + inherent_data_providers: inherent_data_providers.clone(), + force_authoring, + babe_link, + can_author_with, + }; - let babe_config = sc_consensus_babe::BabeParams { - keystore: service.keystore(), - client, - select_chain, - env: proposer, - block_import, - sync_oracle: service.network(), - inherent_data_providers: inherent_data_providers.clone(), - force_authoring, - babe_link, - can_author_with, - }; + let babe = sc_consensus_babe::start_babe(babe_config)?; + task_manager.spawn_essential_handle().spawn_blocking("babe-proposer", babe); + } - let babe = sc_consensus_babe::start_babe(babe_config)?; - service.spawn_essential_task_handle().spawn_blocking("babe-proposer", babe); - } - - // Spawn authority discovery module. - if matches!(role, sc_service::config::Role::Authority{..} | sc_service::config::Role::Sentry {..}) { - let (sentries, authority_discovery_role) = match role { - sc_service::config::Role::Authority { ref sentry_nodes } => ( - sentry_nodes.clone(), - sc_authority_discovery::Role::Authority ( - service.keystore(), - ), - ), - sc_service::config::Role::Sentry {..} => ( - vec![], - sc_authority_discovery::Role::Sentry, + // Spawn authority discovery module. + if matches!(role, Role::Authority{..} | Role::Sentry {..}) { + let (sentries, authority_discovery_role) = match role { + sc_service::config::Role::Authority { ref sentry_nodes } => ( + sentry_nodes.clone(), + sc_authority_discovery::Role::Authority ( + keystore.clone(), ), - _ => unreachable!("Due to outer matches! constraint; qed.") - }; + ), + sc_service::config::Role::Sentry {..} => ( + vec![], + sc_authority_discovery::Role::Sentry, + ), + _ => unreachable!("Due to outer matches! constraint; qed.") + }; - let network = service.network(); - let dht_event_stream = network.event_stream("authority-discovery").filter_map(|e| async move { match e { + let dht_event_stream = network.event_stream("authority-discovery") + .filter_map(|e| async move { match e { Event::Dht(e) => Some(e), _ => None, }}).boxed(); - let authority_discovery = sc_authority_discovery::AuthorityDiscovery::new( - service.client(), - network, - sentries, - dht_event_stream, - authority_discovery_role, - service.prometheus_registry(), - ); + let authority_discovery = sc_authority_discovery::AuthorityDiscovery::new( + client.clone(), + network.clone(), + sentries, + dht_event_stream, + authority_discovery_role, + prometheus_registry.clone(), + ); - service.spawn_task_handle().spawn("authority-discovery", authority_discovery); - } + task_manager.spawn_handle().spawn("authority-discovery", authority_discovery); + } - // if the node isn't actively participating in consensus then it doesn't - // need a keystore, regardless of which protocol we use below. - let keystore = if role.is_authority() { - Some(service.keystore() as BareCryptoStorePtr) - } else { - None - }; + // if the node isn't actively participating in consensus then it doesn't + // need a keystore, regardless of which protocol we use below. + let keystore = if role.is_authority() { + Some(keystore.clone() as BareCryptoStorePtr) + } else { + None + }; - let config = grandpa::Config { - // FIXME #1578 make this available through chainspec - gossip_duration: std::time::Duration::from_millis(333), - justification_period: 512, - name: Some(name), - observer_enabled: false, - keystore, - is_authority: role.is_network_authority(), - }; + let config = grandpa::Config { + // FIXME #1578 make this available through chainspec + gossip_duration: std::time::Duration::from_millis(333), + justification_period: 512, + name: Some(name), + observer_enabled: false, + keystore, + is_authority: role.is_network_authority(), + }; - let enable_grandpa = !disable_grandpa; - if enable_grandpa { - // start the full GRANDPA voter - // NOTE: non-authorities could run the GRANDPA observer protocol, but at - // this point the full voter should provide better guarantees of block - // and vote data availability than the observer. The observer has not - // been tested extensively yet and having most nodes in a network run it - // could lead to finality stalls. - let grandpa_config = grandpa::GrandpaParams { - config, - link: grandpa_link, - network: service.network(), - inherent_data_providers: inherent_data_providers.clone(), - telemetry_on_connect: Some(service.telemetry_on_connect_stream()), - voting_rule: grandpa::VotingRulesBuilder::default().build(), - prometheus_registry: service.prometheus_registry(), - shared_voter_state, - }; + let enable_grandpa = !disable_grandpa; + if enable_grandpa { + // start the full GRANDPA voter + // NOTE: non-authorities could run the GRANDPA observer protocol, but at + // this point the full voter should provide better guarantees of block + // and vote data availability than the observer. The observer has not + // been tested extensively yet and having most nodes in a network run it + // could lead to finality stalls. + let grandpa_config = grandpa::GrandpaParams { + config, + link: grandpa_link, + network: network.clone(), + inherent_data_providers: inherent_data_providers.clone(), + telemetry_on_connect: Some(telemetry_on_connect_sinks.on_connect_stream()), + voting_rule: grandpa::VotingRulesBuilder::default().build(), + prometheus_registry: prometheus_registry.clone(), + shared_voter_state, + }; - // the GRANDPA voter task is considered infallible, i.e. - // if it fails we take down the service with it. - service.spawn_essential_task_handle().spawn_blocking( - "grandpa-voter", - grandpa::run_grandpa_voter(grandpa_config)? - ); - } else { - grandpa::setup_disabled_grandpa( - service.client(), - &inherent_data_providers, - service.network(), - )?; - } + // the GRANDPA voter task is considered infallible, i.e. + // if it fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking( + "grandpa-voter", + grandpa::run_grandpa_voter(grandpa_config)? + ); + } else { + grandpa::setup_disabled_grandpa( + client.clone(), + &inherent_data_providers, + network.clone(), + )?; + } - Ok((service, inherent_data_providers)) - }}; - ($config:expr) => {{ - new_full!($config, |_, _| {}) - }} + Ok((task_manager, inherent_data_providers, client, network, transaction_pool)) } /// Builds a new service for a full client. pub fn new_full(config: Configuration) --> Result -{ - new_full!(config).map(|(service, _)| service) +-> Result { + new_full_base(config, |_, _| ()).map(|(task_manager, _, _, _, _)| { + task_manager + }) } -/// Builds a new service for a light client. -pub fn new_light(config: Configuration) --> Result { +type LightClient = sc_service::TLightClient; +type LightFetcher = sc_network::config::OnDemand; + +pub fn new_light_base(config: Configuration) -> Result<( + TaskManager, Arc, Arc, + Arc::Hash>>, + Arc, Block + >> +), ServiceError> { let inherent_data_providers = InherentDataProviders::new(); - let service = ServiceBuilder::new_light::(config)? + let ServiceComponents { + task_manager, rpc_handlers, client, network, transaction_pool, .. + } = ServiceBuilder::new_light::(config)? .with_select_chain(|_config, backend| { Ok(LongestChain::new(backend.clone())) })? @@ -406,16 +426,21 @@ pub fn new_light(config: Configuration) Ok(node_rpc::create_light(light_deps)) })? .build_light()?; + + Ok((task_manager, rpc_handlers, client, network, transaction_pool)) +} - Ok(service) +/// Builds a new service for a light client. +pub fn new_light(config: Configuration) -> Result { + new_light_base(config).map(|(task_manager, _, _, _, _)| { + task_manager + }) } #[cfg(test)] mod tests { use std::{sync::Arc, borrow::Cow, any::Any}; - use sc_consensus_babe::{ - CompatibleDigestItem, BabeIntermediate, INTERMEDIATE_KEY - }; + use sc_consensus_babe::{CompatibleDigestItem, BabeIntermediate, INTERMEDIATE_KEY}; use sc_consensus_epochs::descendent_query; use sp_consensus::{ Environment, Proposer, BlockImportParams, BlockOrigin, ForkChoiceStrategy, BlockImport, @@ -434,10 +459,11 @@ mod tests { use sp_timestamp; use sp_finality_tracker; use sp_keyring::AccountKeyring; - use sc_service::AbstractService; - use crate::service::{new_full, new_light}; + use sc_service_test::TestNetNode; + use crate::service::{new_full_base, new_light_base}; use sp_runtime::traits::IdentifyAccount; use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent}; + use sc_client_api::BlockBackend; type AccountPublic = ::Signer; @@ -466,14 +492,25 @@ mod tests { chain_spec, |config| { let mut setup_handles = None; - new_full!(config, | - block_import: &sc_consensus_babe::BabeBlockImport, - babe_link: &sc_consensus_babe::BabeLink, - | { - setup_handles = Some((block_import.clone(), babe_link.clone())); - }).map(move |(node, x)| (node, (x, setup_handles.unwrap()))) + let (keep_alive, inherent_data_providers, client, network, transaction_pool) = + new_full_base(config, + | + block_import: &sc_consensus_babe::BabeBlockImport, + babe_link: &sc_consensus_babe::BabeLink, + | { + setup_handles = Some((block_import.clone(), babe_link.clone())); + } + )?; + + let node = sc_service_test::TestNetComponents::new( + keep_alive, client, network, transaction_pool + ); + Ok((node, (inherent_data_providers, setup_handles.unwrap()))) + }, + |config| { + let (keep_alive, _, client, network, transaction_pool) = new_light_base(config)?; + Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool)) }, - |config| new_light(config), |service, &mut (ref inherent_data_providers, (ref mut block_import, ref babe_link))| { let mut inherent_data = inherent_data_providers .create_inherent_data() @@ -620,8 +657,14 @@ mod tests { fn test_consensus() { sc_service_test::consensus( crate::chain_spec::tests::integration_test_config_with_two_authorities(), - |config| new_full(config), - |config| new_light(config), + |config| { + let (keep_alive, _, client, network, transaction_pool) = new_full_base(config, |_, _| ())?; + Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool)) + }, + |config| { + let (keep_alive, _, client, network, transaction_pool) = new_light_base(config)?; + Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool)) + }, vec![ "//Alice".into(), "//Bob".into(), diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs index fc5daa80ad..5df2709f87 100644 --- a/bin/node/testing/src/bench.rs +++ b/bin/node/testing/src/bench.rs @@ -55,7 +55,7 @@ use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_inherents::InherentData; use sc_client_api::{ - ExecutionStrategy, + ExecutionStrategy, BlockBackend, execution_extensions::{ExecutionExtensions, ExecutionStrategies}, }; use sp_core::{Pair, Public, sr25519, ed25519}; diff --git a/client/api/src/client.rs b/client/api/src/client.rs index 42dd5d53b1..35d40965e6 100644 --- a/client/api/src/client.rs +++ b/client/api/src/client.rs @@ -90,6 +90,9 @@ pub trait BlockBackend { /// Get block justification set by id. fn justification(&self, id: &BlockId) -> sp_blockchain::Result>; + + /// Get block hash by number. + fn block_hash(&self, number: NumberFor) -> sp_blockchain::Result>; } /// Provide a list of potential uncle headers for a given block. diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index 9623b08bfb..a702edba65 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -37,7 +37,9 @@ use log::info; pub use params::*; use regex::Regex; pub use runner::*; -use sc_service::{ChainSpec, Configuration, TaskExecutor}; +use sc_service::{Configuration, TaskExecutor}; +pub use sc_service::{ChainSpec, Role}; +pub use sp_version::RuntimeVersion; use std::io::Write; pub use structopt; use structopt::{ @@ -207,6 +209,9 @@ pub trait SubstrateCli: Sized { command.init::()?; Runner::new(self, command) } + + /// Native runtime version. + fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion; } /// Initialize the logger diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs index 51ea2d2186..fcc869dc87 100644 --- a/client/cli/src/runner.rs +++ b/client/cli/src/runner.rs @@ -25,10 +25,9 @@ use futures::pin_mut; use futures::select; use futures::{future, future::FutureExt, Future}; use log::info; -use sc_service::{AbstractService, Configuration, Role, ServiceBuilderCommand, TaskType}; +use sc_service::{Configuration, ServiceBuilderCommand, TaskType, TaskManager}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use sp_utils::metrics::{TOKIO_THREADS_ALIVE, TOKIO_THREADS_TOTAL}; -use sp_version::RuntimeVersion; use std::{fmt::Debug, marker::PhantomData, str::FromStr}; #[cfg(target_family = "unix")] @@ -153,7 +152,7 @@ impl Runner { /// 2020-06-03 16:14:21 💾 Database: RocksDb at /tmp/c/chains/flamingfir7/db /// 2020-06-03 16:14:21 ⛓ Native runtime: node-251 (substrate-node-1.tx1.au10) /// ``` - pub fn print_node_infos(&self, runtime_version: RuntimeVersion) { + fn print_node_infos(&self) { info!("{}", C::impl_name()); info!("✌️ version {}", C::impl_version()); info!( @@ -169,64 +168,7 @@ impl Runner { self.config.database, self.config.database.path().map_or_else(|| "".to_owned(), |p| p.display().to_string()) ); - info!("⛓ Native runtime: {}", runtime_version); - } - - /// A helper function that runs an `AbstractService` with tokio and stops if the process - /// receives the signal `SIGTERM` or `SIGINT`. It can run a full or a light node depending on - /// the node's configuration. - pub fn run_node( - self, - new_light: impl FnOnce(Configuration) -> sc_service::error::Result, - new_full: impl FnOnce(Configuration) -> sc_service::error::Result, - runtime_version: RuntimeVersion, - ) -> Result<()> - where - SL: AbstractService + Unpin, - SF: AbstractService + Unpin, - { - match self.config.role { - Role::Light => self.run_light_node(new_light, runtime_version), - _ => self.run_full_node(new_full, runtime_version), - } - } - - /// A helper function that runs an `AbstractService` with tokio and stops if the process - /// receives the signal `SIGTERM` or `SIGINT`. It can only run a "full" node and will fail if - /// the node's configuration uses a "light" role. - pub fn run_full_node( - self, - new_full: impl FnOnce(Configuration) -> sc_service::error::Result, - runtime_version: RuntimeVersion, - ) -> Result<()> - where - S: AbstractService + Unpin, - { - if matches!(self.config.role, Role::Light) { - return Err("Light node has been requested but this is not implemented".into()); - } - - self.print_node_infos(runtime_version); - self.run_service_until_exit(new_full) - } - - /// A helper function that runs an `AbstractService` with tokio and stops if the process - /// receives the signal `SIGTERM` or `SIGINT`. It can only run a "light" node and will fail if - /// the node's configuration uses a "full" role. - pub fn run_light_node( - self, - new_light: impl FnOnce(Configuration) -> sc_service::error::Result, - runtime_version: RuntimeVersion, - ) -> Result<()> - where - S: AbstractService + Unpin, - { - if !matches!(self.config.role, Role::Light) { - return Err("Full node has been requested but this is not implemented".into()); - } - - self.print_node_infos(runtime_version); - self.run_service_until_exit(new_light) + info!("⛓ Native runtime: {}", C::native_runtime_version(&self.config.chain_spec)); } /// A helper function that runs a future with tokio and stops if the process receives the signal @@ -257,34 +199,18 @@ impl Runner { } } - fn run_service_until_exit(mut self, service_builder: F) -> Result<()> - where - F: FnOnce(Configuration) -> std::result::Result, - T: AbstractService + Unpin, - { - let service = service_builder(self.config)?; - - // we eagerly drop the service so that the internal exit future is fired, - // but we need to keep holding a reference to the global telemetry guard - // and drop the runtime first. - let _telemetry = service.telemetry(); - - // we hold a reference to the base path so if the base path is a temporary directory it will - // not be deleted before the tokio runtime finish to clean up - let _base_path = service.base_path(); - - { - let f = service.fuse(); - self.tokio_runtime - .block_on(main(f)) - .map_err(|e| e.to_string())?; - } - - // The `service` **must** have been destroyed here for the shutdown signal to propagate - // to all the tasks. Dropping `tokio_runtime` will block the thread until all tasks have - // shut down. - drop(self.tokio_runtime); - + /// A helper function that runs a node with tokio and stops if the process receives the signal + /// `SIGTERM` or `SIGINT`. + pub fn run_node_until_exit( + mut self, + initialise: impl FnOnce(Configuration) -> sc_service::error::Result, + ) -> Result<()> { + self.print_node_infos(); + let mut task_manager = initialise(self.config)?; + self.tokio_runtime.block_on(main(task_manager.future().fuse())) + .map_err(|e| e.to_string())?; + task_manager.terminate(); + drop(task_manager); Ok(()) } diff --git a/client/finality-grandpa/src/light_import.rs b/client/finality-grandpa/src/light_import.rs index b63c6f0bd7..a7c9a65546 100644 --- a/client/finality-grandpa/src/light_import.rs +++ b/client/finality-grandpa/src/light_import.rs @@ -573,7 +573,7 @@ pub mod tests { use sp_consensus::{import_queue::CacheKeyId, ForkChoiceStrategy, BlockImport}; use sp_finality_grandpa::AuthorityId; use sp_core::{H256, crypto::Public}; - use sc_client_api::{in_mem::Blockchain as InMemoryAuxStore, StorageProof}; + use sc_client_api::{in_mem::Blockchain as InMemoryAuxStore, StorageProof, BlockBackend}; use substrate_test_runtime_client::runtime::{Block, Header}; use crate::tests::TestApi; use crate::finality_proof::{ diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 1fbf301f5b..8c96f514dd 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -17,21 +17,20 @@ // along with this program. If not, see . use crate::{ - Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm, + NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm, start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle, status_sinks, metrics::MetricsService, client::{light, Client, ClientConfig}, config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig}, }; use sc_client_api::{ - self, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, - ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider, - backend::RemoteBackend, + self, light::RemoteBlockchain, execution_extensions::ExtensionsFactory, ExecutorProvider, + ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider, backend::RemoteBackend, }; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender, TracingUnboundedReceiver}; use sc_chain_spec::get_extension; use sp_consensus::{ - block_validation::{BlockAnnounceValidator, DefaultBlockAnnounceValidator}, + block_validation::{BlockAnnounceValidator, DefaultBlockAnnounceValidator, Chain}, import_queue::ImportQueue, }; use futures::{ @@ -46,9 +45,9 @@ use sc_network::NetworkService; use parking_lot::{Mutex, RwLock}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{ - Block as BlockT, NumberFor, SaturatedConversion, HashFor, Zero, + Block as BlockT, NumberFor, SaturatedConversion, HashFor, Zero, BlockIdTo, }; -use sp_api::ProvideRuntimeApi; +use sp_api::{ProvideRuntimeApi, CallApiAt}; use sc_executor::{NativeExecutor, NativeExecutionDispatch, RuntimeInfo}; use std::{ collections::HashMap, @@ -62,8 +61,15 @@ use prometheus_endpoint::Registry; use sc_client_db::{Backend, DatabaseSettings}; use sp_core::traits::CodeExecutor; use sp_runtime::BuildStorage; -use sc_client_api::execution_extensions::ExecutionExtensions; +use sc_client_api::{ + BlockBackend, BlockchainEvents, + backend::StorageProvider, + proof_provider::ProofProvider, + execution_extensions::ExecutionExtensions +}; use sp_core::storage::Storage; +use sp_blockchain::{HeaderMetadata, HeaderBackend}; +use crate::{ServiceComponents, TelemetryOnConnectSinks, RpcHandlers, NetworkStatusSinks}; pub type BackgroundTask = Pin + Send>>; @@ -878,11 +884,11 @@ pub trait ServiceBuilderCommand { ) -> Result; } -impl +impl ServiceBuilder< TBl, TRtApi, - Client, + TCl, Arc>, TSc, TImpQu, @@ -892,8 +898,12 @@ ServiceBuilder< TRpc, TBackend, > where - Client: ProvideRuntimeApi, - as ProvideRuntimeApi>::Api: + TCl: ProvideRuntimeApi + HeaderMetadata + Chain + + BlockBackend + BlockIdTo + ProofProvider + + HeaderBackend + BlockchainEvents + ExecutorProvider + UsageProvider + + StorageProvider + CallApiAt + + Send + 'static, + >::Api: sp_api::Metadata + sc_offchain::OffchainWorkerApi + sp_transaction_pool::runtime_api::TaggedTransactionQueue + @@ -903,7 +913,6 @@ ServiceBuilder< TBl: BlockT, TRtApi: 'static + Send + Sync, TBackend: 'static + sc_client_api::backend::Backend + Send, - TExec: 'static + CallExecutor + Send + Sync + Clone, TSc: Clone, TImpQu: 'static + ImportQueue, TExPool: MaintainedTransactionPool::Hash> + MallocSizeOfWasm + 'static, @@ -916,26 +925,12 @@ ServiceBuilder< Ok(self) } - fn build_common(self) -> Result, - TSc, - NetworkStatus, - NetworkService::Hash>, - TExPool, - sc_offchain::OffchainWorkers< - Client, - TBackend::OffchainStorage, - TBl - >, - >, Error> - where TExec: CallExecutor, - { + fn build_common(self) -> Result, Error> { let ServiceBuilder { marker: _, mut config, client, - task_manager, + mut task_manager, fetcher: on_demand, backend, keystore, @@ -949,17 +944,14 @@ ServiceBuilder< block_announce_validator_builder, } = self; + let chain_info = client.usage_info().chain; + sp_session::generate_initial_session_keys( client.clone(), - &BlockId::Hash(client.chain_info().best_hash), + &BlockId::Hash(chain_info.best_hash), config.dev_key_seed.clone().map(|s| vec![s]).unwrap_or_default(), )?; - // A side-channel for essential tasks to communicate shutdown. - let (essential_failed_tx, essential_failed_rx) = tracing_unbounded("mpsc_essential_tasks"); - - let chain_info = client.chain_info(); - info!("📦 Highest known block at #{}", chain_info.best_number); telemetry!( SUBSTRATE_INFO; @@ -968,15 +960,16 @@ ServiceBuilder< "best" => ?chain_info.best_hash ); - let spawn_handle = task_manager.spawn_handle(); let (system_rpc_tx, system_rpc_rx) = tracing_unbounded("mpsc_system_rpc"); let (network, network_status_sinks, network_future) = build_network( - &config, client.clone(), transaction_pool.clone(), Clone::clone(&spawn_handle), on_demand.clone(), - block_announce_validator_builder, finality_proof_request_builder, finality_proof_provider, - system_rpc_rx, import_queue + &config, client.clone(), transaction_pool.clone(), task_manager.spawn_handle(), + on_demand.clone(), block_announce_validator_builder, finality_proof_request_builder, + finality_proof_provider, system_rpc_rx, import_queue )?; + let spawn_handle = task_manager.spawn_handle(); + // The network worker is responsible for gathering all network messages and processing // them. This is quite a heavy task, and at the time of the writing of this comment it // frequently happens that this future takes several seconds or in some situations @@ -1064,7 +1057,7 @@ ServiceBuilder< ); let rpc = start_rpc_servers(&config, gen_handler)?; // This is used internally, so don't restrict access to unsafe RPC - let rpc_handlers = gen_handler(sc_rpc::DenyUnsafe::No); + let rpc_handlers = Arc::new(RpcHandlers(gen_handler(sc_rpc::DenyUnsafe::No))); let telemetry_connection_sinks: Arc>>> = Default::default(); @@ -1110,52 +1103,34 @@ ServiceBuilder< config.informant_output_format, )); - Ok(Service { + task_manager.keep_alive((telemetry, config.base_path, rpc, rpc_handlers.clone())); + + Ok(ServiceComponents { client, task_manager, network, - network_status_sinks, select_chain, transaction_pool, - essential_failed_tx, - essential_failed_rx, rpc_handlers, - _rpc: rpc, - _telemetry: telemetry, - _offchain_workers: offchain_workers, - _telemetry_on_connect_sinks: telemetry_connection_sinks.clone(), keystore, - marker: PhantomData::, + offchain_workers, + telemetry_on_connect_sinks: TelemetryOnConnectSinks(telemetry_connection_sinks), + network_status_sinks: NetworkStatusSinks::new(network_status_sinks), prometheus_registry: config.prometheus_config.map(|config| config.registry), - _base_path: config.base_path.map(Arc::new), }) } /// Builds the light service. - pub fn build_light(self) -> Result, - TSc, - NetworkStatus, - NetworkService::Hash>, - TExPool, - sc_offchain::OffchainWorkers< - Client, - TBackend::OffchainStorage, - TBl - >, - >, Error> - where TExec: CallExecutor, - { + pub fn build_light(self) -> Result, Error> { self.build_common() } } -impl +impl ServiceBuilder< TBl, TRtApi, - Client, + TCl, Arc>, TSc, TImpQu, @@ -1165,8 +1140,12 @@ ServiceBuilder< TRpc, TBackend, > where - Client: ProvideRuntimeApi, - as ProvideRuntimeApi>::Api: + TCl: ProvideRuntimeApi + HeaderMetadata + Chain + + BlockBackend + BlockIdTo + ProofProvider + + HeaderBackend + BlockchainEvents + ExecutorProvider + UsageProvider + + StorageProvider + CallApiAt + + Send + 'static, + >::Api: sp_api::Metadata + sc_offchain::OffchainWorkerApi + sp_transaction_pool::runtime_api::TaggedTransactionQueue + @@ -1176,7 +1155,6 @@ ServiceBuilder< TBl: BlockT, TRtApi: 'static + Send + Sync, TBackend: 'static + sc_client_api::backend::Backend + Send, - TExec: 'static + CallExecutor + Send + Sync + Clone, TSc: Clone, TImpQu: 'static + ImportQueue, TExPool: MaintainedTransactionPool::Hash> + @@ -1187,21 +1165,7 @@ ServiceBuilder< { /// Builds the full service. - pub fn build_full(self) -> Result, - TSc, - NetworkStatus, - NetworkService::Hash>, - TExPool, - sc_offchain::OffchainWorkers< - Client, - TBackend::OffchainStorage, - TBl - >, - >, Error> - where TExec: CallExecutor, - { + pub fn build_full(self) -> Result, Error> { // make transaction pool available for off-chain runtime calls. self.client.execution_extensions() .register_transaction_pool(Arc::downgrade(&self.transaction_pool) as _); @@ -1233,18 +1197,16 @@ async fn transaction_notifications( } // Periodically notify the telemetry. -async fn telemetry_periodic_send( - client: Arc>, +async fn telemetry_periodic_send( + client: Arc, transaction_pool: Arc, mut metrics_service: MetricsService, network_status_sinks: Arc, NetworkState)>>> ) where TBl: BlockT, - TExec: CallExecutor, - Client: ProvideRuntimeApi, + TCl: ProvideRuntimeApi + UsageProvider, TExPool: MaintainedTransactionPool::Hash>, - TBackend: sc_client_api::backend::Backend, { let (state_tx, state_rx) = tracing_unbounded::<(NetworkStatus<_>, NetworkState)>("mpsc_netstat1"); network_status_sinks.lock().push(std::time::Duration::from_millis(5000), state_tx); @@ -1322,11 +1284,11 @@ fn build_telemetry( (telemetry, future) } -fn gen_handler( +fn gen_handler( deny_unsafe: sc_rpc::DenyUnsafe, config: &Configuration, task_manager: &TaskManager, - client: Arc>, + client: Arc, transaction_pool: Arc, keystore: Arc>, on_demand: Option>>, @@ -1337,13 +1299,14 @@ fn gen_handler( ) -> jsonrpc_pubsub::PubSubHandler where TBl: BlockT, - TExec: CallExecutor + Send + Sync + 'static, - TRtApi: Send + Sync + 'static, - Client: ProvideRuntimeApi, + TCl: ProvideRuntimeApi + BlockchainEvents + HeaderBackend + + HeaderMetadata + ExecutorProvider + + CallApiAt + ProofProvider + + StorageProvider + BlockBackend + Send + Sync + 'static, TExPool: MaintainedTransactionPool::Hash> + 'static, TBackend: sc_client_api::backend::Backend + 'static, TRpc: sc_rpc::RpcExtension, - as ProvideRuntimeApi>::Api: + >::Api: sp_session::SessionKeys + sp_api::Metadata, { @@ -1412,15 +1375,14 @@ fn gen_handler( )) } -fn build_network( +fn build_network( config: &Configuration, - client: Arc>, + client: Arc, transaction_pool: Arc, spawn_handle: SpawnTaskHandle, on_demand: Option>>, block_announce_validator_builder: Option>) -> - Box + Send> + Send + dyn FnOnce(Arc) -> Box + Send> + Send >>, finality_proof_request_builder: Option>, finality_proof_provider: Option>>, @@ -1436,11 +1398,10 @@ fn build_network( > where TBl: BlockT, - TExec: CallExecutor + Send + Sync + 'static, - TRtApi: Send + Sync + 'static, - Client: ProvideRuntimeApi, + TCl: ProvideRuntimeApi + HeaderMetadata + Chain + + BlockBackend + BlockIdTo + ProofProvider + + HeaderBackend + BlockchainEvents + 'static, TExPool: MaintainedTransactionPool::Hash> + 'static, - TBackend: sc_client_api::backend::Backend + 'static, TImpQu: ImportQueue + 'static, { let transaction_pool_adapter = Arc::new(TransactionPoolAdapter { diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 922f34b656..2f101465d5 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -353,13 +353,6 @@ impl Client where self.executor.runtime_version(id) } - /// Get block hash by number. - pub fn block_hash(&self, - block_number: <::Header as HeaderT>::Number - ) -> sp_blockchain::Result> { - self.backend.blockchain().hash(block_number) - } - /// Reads given header and generates CHT-based header proof for CHT of given size. pub fn header_proof_with_cht_size( &self, @@ -1925,6 +1918,10 @@ impl BlockBackend for Client fn justification(&self, id: &BlockId) -> sp_blockchain::Result> { self.backend.blockchain().justification(*id) } + + fn block_hash(&self, number: NumberFor) -> sp_blockchain::Result> { + self.backend.blockchain().hash(number) + } } impl backend::AuxStore for Client diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 036c957773..c3c8f60e68 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -36,22 +36,15 @@ mod client; mod task_manager; use std::{io, pin::Pin}; -use std::marker::PhantomData; use std::net::SocketAddr; use std::collections::HashMap; use std::time::Duration; use wasm_timer::Instant; -use std::task::{Poll, Context}; +use std::task::Poll; use parking_lot::Mutex; -use client::Client; -use futures::{ - Future, FutureExt, Stream, StreamExt, - compat::*, - sink::SinkExt, - task::{Spawn, FutureObj, SpawnError}, -}; -use sc_network::{NetworkService, NetworkStatus, network_state::NetworkState, PeerId}; +use futures::{Future, FutureExt, Stream, StreamExt, compat::*}; +use sc_network::{NetworkStatus, network_state::NetworkState, PeerId}; use log::{log, warn, debug, error, Level}; use codec::{Encode, Decode}; use sp_runtime::generic::BlockId; @@ -84,14 +77,9 @@ pub use sc_network::config::{ TransactionImportFuture, }; pub use sc_tracing::TracingReceiver; -pub use task_manager::{SpawnEssentialTaskHandle, SpawnTaskHandle}; -use task_manager::TaskManager; -use sp_blockchain::{HeaderBackend, HeaderMetadata}; -use sp_api::{ApiExt, ConstructRuntimeApi, ApiErrorExt}; -use sc_client_api::{ - Backend as BackendT, BlockchainEvents, CallExecutor, UsageProvider, -}; -use sp_block_builder::BlockBuilder; +pub use task_manager::SpawnTaskHandle; +pub use task_manager::TaskManager; +use sc_client_api::{Backend, BlockchainEvents}; const DEFAULT_PROTOCOL_ID: &str = "sup"; @@ -105,88 +93,10 @@ impl MallocSizeOfWasm for T {} #[cfg(target_os = "unknown")] impl MallocSizeOfWasm for T {} -/// Substrate service. -pub struct Service { - client: Arc, - task_manager: TaskManager, - select_chain: Option, - network: Arc, - // Sinks to propagate network status updates. - // For each element, every time the `Interval` fires we push an element on the sender. - network_status_sinks: Arc>>, - transaction_pool: Arc, - // Send a signal when a spawned essential task has concluded. The next time - // the service future is polled it should complete with an error. - essential_failed_tx: TracingUnboundedSender<()>, - // A receiver for spawned essential-tasks concluding. - essential_failed_rx: TracingUnboundedReceiver<()>, - rpc_handlers: sc_rpc_server::RpcHandler, - _rpc: Box, - _telemetry: Option, - _telemetry_on_connect_sinks: Arc>>>, - _offchain_workers: Option>, - keystore: sc_keystore::KeyStorePtr, - marker: PhantomData, - prometheus_registry: Option, - // The base path is kept here because it can be a temporary directory which will be deleted - // when dropped - _base_path: Option>, -} - -impl Unpin for Service {} - -/// Abstraction over a Substrate service. -pub trait AbstractService: Future> + Send + Unpin + Spawn + 'static { - /// Type of block of this chain. - type Block: BlockT; - /// Backend storage for the client. - type Backend: 'static + BackendT; - /// How to execute calls towards the runtime. - type CallExecutor: 'static + CallExecutor + Send + Sync + Clone; - /// API that the runtime provides. - type RuntimeApi: Send + Sync; - /// Chain selection algorithm. - type SelectChain: sp_consensus::SelectChain; - /// Transaction pool. - type TransactionPool: TransactionPool + MallocSizeOfWasm; - /// The generic Client type, the bounds here are the ones specifically required by - /// internal crates like sc_informant. - type Client: - HeaderMetadata + UsageProvider - + BlockchainEvents + HeaderBackend + Send + Sync; - - /// Get event stream for telemetry connection established events. - fn telemetry_on_connect_stream(&self) -> TracingUnboundedReceiver<()>; - - /// return a shared instance of Telemetry (if enabled) - fn telemetry(&self) -> Option; - - /// Spawns a task in the background that runs the future passed as parameter. - /// - /// Information about this task will be reported to Prometheus. - /// - /// The task name is a `&'static str` as opposed to a `String`. The reason for that is that - /// in order to avoid memory consumption issues with the Prometheus metrics, the set of - /// possible task names has to be bounded. - #[deprecated(note = "Use `spawn_task_handle().spawn() instead.")] - fn spawn_task(&self, name: &'static str, task: impl Future + Send + 'static); - - /// Spawns a task in the background that runs the future passed as - /// parameter. The given task is considered essential, i.e. if it errors we - /// trigger a service exit. - #[deprecated(note = "Use `spawn_essential_task_handle().spawn() instead.")] - fn spawn_essential_task(&self, name: &'static str, task: impl Future + Send + 'static); - - /// Returns a handle for spawning essential tasks. Any task spawned through this handle is - /// considered essential, i.e. if it errors we trigger a service exit. - fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle; - - /// Returns a handle for spawning tasks. - fn spawn_task_handle(&self) -> SpawnTaskHandle; - - /// Returns the keystore that stores keys. - fn keystore(&self) -> sc_keystore::KeyStorePtr; +/// RPC handlers that can perform RPC queries. +pub struct RpcHandlers(sc_rpc_server::RpcHandler); +impl RpcHandlers { /// Starts an RPC query. /// /// The query is passed as a string and must be a JSON text similar to what an HTTP client @@ -196,178 +106,76 @@ pub trait AbstractService: Future> + Send + Unpin + S /// /// If the request subscribes you to events, the `Sender` in the `RpcSession` object is used to /// send back spontaneous events. - fn rpc_query(&self, mem: &RpcSession, request: &str) -> Pin> + Send>>; - - /// Get shared client instance. - fn client(&self) -> Arc; - - /// Get clone of select chain. - fn select_chain(&self) -> Option; - - /// Get shared network instance. - fn network(&self) - -> Arc::Hash>>; - - /// Returns a receiver that periodically receives a status of the network. - fn network_status(&self, interval: Duration) -> TracingUnboundedReceiver<(NetworkStatus, NetworkState)>; - - /// Get shared transaction pool instance. - fn transaction_pool(&self) -> Arc; - - /// Get a handle to a future that will resolve on exit. - #[deprecated(note = "Use `spawn_task`/`spawn_essential_task` instead, those functions will attach on_exit signal.")] - fn on_exit(&self) -> ::exit_future::Exit; - - /// Get the prometheus metrics registry, if available. - fn prometheus_registry(&self) -> Option; - - /// Get a clone of the base_path - fn base_path(&self) -> Option>; -} - -impl AbstractService for - Service, TSc, NetworkStatus, - NetworkService, TExPool, TOc> -where - TBl: BlockT, - TBackend: 'static + BackendT, - TExec: 'static + CallExecutor + Send + Sync + Clone, - TRtApi: 'static + Send + Sync + ConstructRuntimeApi>, - >>::RuntimeApi: - sp_api::Core - + ApiExt - + ApiErrorExt - + BlockBuilder, - TSc: sp_consensus::SelectChain + 'static + Clone + Send + Unpin, - TExPool: 'static + TransactionPool + MallocSizeOfWasm, - TOc: 'static + Send + Sync, -{ - type Block = TBl; - type Backend = TBackend; - type CallExecutor = TExec; - type RuntimeApi = TRtApi; - type SelectChain = TSc; - type TransactionPool = TExPool; - type Client = Client; - - fn telemetry_on_connect_stream(&self) -> TracingUnboundedReceiver<()> { - let (sink, stream) = tracing_unbounded("mpsc_telemetry_on_connect"); - self._telemetry_on_connect_sinks.lock().push(sink); - stream - } - - fn telemetry(&self) -> Option { - self._telemetry.clone() - } - - fn keystore(&self) -> sc_keystore::KeyStorePtr { - self.keystore.clone() - } - - fn spawn_task(&self, name: &'static str, task: impl Future + Send + 'static) { - self.task_manager.spawn(name, task) - } - - fn spawn_essential_task(&self, name: &'static str, task: impl Future + Send + 'static) { - let mut essential_failed = self.essential_failed_tx.clone(); - let essential_task = std::panic::AssertUnwindSafe(task) - .catch_unwind() - .map(move |_| { - error!("Essential task `{}` failed. Shutting down service.", name); - let _ = essential_failed.send(()); - }); - - let _ = self.spawn_task_handle().spawn(name, essential_task); - } - - fn spawn_task_handle(&self) -> SpawnTaskHandle { - self.task_manager.spawn_handle() - } - - fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle { - SpawnEssentialTaskHandle::new( - self.essential_failed_tx.clone(), - self.task_manager.spawn_handle(), - ) - } - - fn rpc_query(&self, mem: &RpcSession, request: &str) -> Pin> + Send>> { - Box::pin( - self.rpc_handlers.handle_request(request, mem.metadata.clone()) - .compat() - .map(|res| res.expect("this should never fail")) - ) - } - - fn client(&self) -> Arc { - self.client.clone() - } - - fn select_chain(&self) -> Option { - self.select_chain.clone() + pub fn rpc_query(&self, mem: &RpcSession, request: &str) + -> Pin> + Send>> { + self.0.handle_request(request, mem.metadata.clone()) + .compat() + .map(|res| res.expect("this should never fail")) + .boxed() } +} - fn network(&self) - -> Arc::Hash>> - { - self.network.clone() +/// Sinks to propagate network status updates. +/// For each element, every time the `Interval` fires we push an element on the sender. +pub struct NetworkStatusSinks( + Arc, NetworkState)>>>, +); + +impl NetworkStatusSinks { + fn new( + sinks: Arc, NetworkState)>>> + ) -> Self { + Self(sinks) } - fn network_status(&self, interval: Duration) -> TracingUnboundedReceiver<(NetworkStatus, NetworkState)> { + /// Returns a receiver that periodically receives a status of the network. + pub fn network_status(&self, interval: Duration) + -> TracingUnboundedReceiver<(NetworkStatus, NetworkState)> { let (sink, stream) = tracing_unbounded("mpsc_network_status"); - self.network_status_sinks.lock().push(interval, sink); + self.0.lock().push(interval, sink); stream } - - fn transaction_pool(&self) -> Arc { - self.transaction_pool.clone() - } - - fn on_exit(&self) -> exit_future::Exit { - self.task_manager.on_exit() - } - - fn prometheus_registry(&self) -> Option { - self.prometheus_registry.clone() - } - - fn base_path(&self) -> Option> { - self._base_path.clone() - } } -impl Future for - Service -{ - type Output = Result<(), Error>; - - fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { - let this = Pin::into_inner(self); +/// Sinks to propagate telemetry connection established events. +pub struct TelemetryOnConnectSinks(pub Arc>>>); - match Pin::new(&mut this.essential_failed_rx).poll_next(cx) { - Poll::Pending => {}, - Poll::Ready(_) => { - // Ready(None) should not be possible since we hold a live - // sender. - return Poll::Ready(Err(Error::Other("Essential task failed.".into()))); - } - } - - // The service future never ends. - Poll::Pending +impl TelemetryOnConnectSinks { + /// Get event stream for telemetry connection established events. + pub fn on_connect_stream(&self) -> TracingUnboundedReceiver<()> { + let (sink, stream) =tracing_unbounded("mpsc_telemetry_on_connect"); + self.0.lock().push(sink); + stream } } -impl Spawn for - Service -{ - fn spawn_obj( - &self, - future: FutureObj<'static, ()> - ) -> Result<(), SpawnError> { - self.task_manager.spawn_handle().spawn("unnamed", future); - Ok(()) - } +/// The individual components of the chain, built by the service builder. You are encouraged to +/// deconstruct this into its fields. +pub struct ServiceComponents, TSc, TExPool, TCl> { + /// A blockchain client. + pub client: Arc, + /// A shared transaction pool instance. + pub transaction_pool: Arc, + /// The chain task manager. + pub task_manager: TaskManager, + /// A keystore that stores keys. + pub keystore: sc_keystore::KeyStorePtr, + /// A shared network instance. + pub network: Arc::Hash>>, + /// RPC handlers that can perform RPC queries. + pub rpc_handlers: Arc, + /// A shared instance of the chain selection algorithm. + pub select_chain: Option, + /// Sinks to propagate network status updates. + pub network_status_sinks: NetworkStatusSinks, + /// A prometheus metrics registry, (if enabled). + pub prometheus_registry: Option, + /// Shared Telemetry connection sinks, + pub telemetry_on_connect_sinks: TelemetryOnConnectSinks, + /// A shared offchain workers instance. + pub offchain_workers: Option>>, } /// Builds a never-ending future that continuously polls the network. diff --git a/client/service/src/task_manager.rs b/client/service/src/task_manager.rs index 544d76fc47..b6cc260055 100644 --- a/client/service/src/task_manager.rs +++ b/client/service/src/task_manager.rs @@ -13,14 +13,15 @@ //! Substrate service tasks management module. -use std::{panic, result::Result}; +use std::{panic, result::Result, pin::Pin}; use exit_future::Signal; use log::debug; use futures::{ - Future, FutureExt, + Future, FutureExt, StreamExt, future::{select, Either, BoxFuture}, compat::*, task::{Spawn, FutureObj, SpawnError}, + sink::SinkExt, }; use prometheus_endpoint::{ exponential_buckets, register, @@ -28,8 +29,8 @@ use prometheus_endpoint::{ CounterVec, HistogramOpts, HistogramVec, Opts, Registry, U64 }; use sc_client_api::CloneableSpawn; -use sp_utils::mpsc::TracingUnboundedSender; -use crate::config::{TaskExecutor, TaskType}; +use sp_utils::mpsc::{TracingUnboundedSender, TracingUnboundedReceiver, tracing_unbounded}; +use crate::{config::{TaskExecutor, TaskType}, Error}; mod prometheus_future; @@ -192,7 +193,6 @@ impl SpawnEssentialTaskHandle { task: impl Future + Send + 'static, task_type: TaskType, ) { - use futures::sink::SinkExt; let mut essential_failed = self.essential_failed_tx.clone(); let essential_task = std::panic::AssertUnwindSafe(task) .catch_unwind() @@ -216,6 +216,13 @@ pub struct TaskManager { executor: TaskExecutor, /// Prometheus metric where to report the polling times. metrics: Option, + /// Send a signal when a spawned essential task has concluded. The next time + /// the service future is polled it should complete with an error. + essential_failed_tx: TracingUnboundedSender<()>, + /// A receiver for spawned essential-tasks concluding. + essential_failed_rx: TracingUnboundedReceiver<()>, + /// Things to keep alive until the task manager is dropped. + keep_alive: Box, } impl TaskManager { @@ -226,6 +233,8 @@ impl TaskManager { prometheus_registry: Option<&Registry> ) -> Result { let (signal, on_exit) = exit_future::signal(); + // A side-channel for essential tasks to communicate shutdown. + let (essential_failed_tx, essential_failed_rx) = tracing_unbounded("mpsc_essential_tasks"); let metrics = prometheus_registry.map(Metrics::register).transpose()?; @@ -234,17 +243,15 @@ impl TaskManager { signal: Some(signal), executor, metrics, + essential_failed_tx, + essential_failed_rx, + keep_alive: Box::new(()), }) } - /// Spawn background/async task, which will be aware on exit signal. - /// - /// See also the documentation of [`SpawnTaskHandler::spawn`]. - pub(super) fn spawn(&self, name: &'static str, task: impl Future + Send + 'static) { - self.spawn_handle().spawn(name, task) - } - pub(super) fn spawn_handle(&self) -> SpawnTaskHandle { + /// Get a handle for spawning tasks. + pub fn spawn_handle(&self) -> SpawnTaskHandle { SpawnTaskHandle { on_exit: self.on_exit.clone(), executor: self.executor.clone(), @@ -252,18 +259,37 @@ impl TaskManager { } } - /// Clone on exit signal. - pub(super) fn on_exit(&self) -> exit_future::Exit { - self.on_exit.clone() + /// Get a handle for spawning essential tasks. + pub fn spawn_essential_handle(&self) -> SpawnEssentialTaskHandle { + SpawnEssentialTaskHandle::new(self.essential_failed_tx.clone(), self.spawn_handle()) + } + + /// Return a future that will end if an essential task fails. + pub fn future<'a>(&'a mut self) -> Pin> + Send + 'a>> { + Box::pin(async move { + self.essential_failed_rx.next().await; + + Err(Error::Other("Essential task failed.".into())) + }) + } + + /// Signal to terminate all the running tasks. + pub fn terminate(&mut self) { + if let Some(signal) = self.signal.take() { + let _ = signal.fire(); + } + } + + /// Set what the task manager should keep alivei + pub(super) fn keep_alive(&mut self, to_keep_alive: T) { + self.keep_alive = Box::new(to_keep_alive); } } impl Drop for TaskManager { fn drop(&mut self) { debug!(target: "service", "Tasks manager shutdown"); - if let Some(signal) = self.signal.take() { - let _ = signal.fire(); - } + self.terminate(); } } diff --git a/client/service/test/src/client/light.rs b/client/service/test/src/client/light.rs index 994d846c6a..e72c290d43 100644 --- a/client/service/test/src/client/light.rs +++ b/client/service/test/src/client/light.rs @@ -40,7 +40,13 @@ use sp_api::{InitializeBlock, StorageTransactionCache, ProofRecorder, OffchainOv use sp_consensus::{BlockOrigin}; use sc_executor::{NativeExecutor, WasmExecutionMethod, RuntimeVersion, NativeVersion}; use sp_core::{H256, tasks::executor as tasks_executor, NativeOrEncoded}; -use sc_client_api::{blockchain::Info, backend::NewBlockState, Backend as ClientBackend, ProofProvider, in_mem::{Backend as InMemBackend, Blockchain as InMemoryBlockchain}, AuxStore, Storage, CallExecutor, cht, ExecutionStrategy, StorageProof, BlockImportOperation, RemoteCallRequest, StorageProvider, ChangesProof, RemoteBodyRequest, RemoteReadRequest, RemoteChangesRequest, FetchChecker, RemoteReadChildRequest, RemoteHeaderRequest}; +use sc_client_api::{ + blockchain::Info, backend::NewBlockState, Backend as ClientBackend, ProofProvider, + in_mem::{Backend as InMemBackend, Blockchain as InMemoryBlockchain}, + AuxStore, Storage, CallExecutor, cht, ExecutionStrategy, StorageProof, BlockImportOperation, + RemoteCallRequest, StorageProvider, ChangesProof, RemoteBodyRequest, RemoteReadRequest, + RemoteChangesRequest, FetchChecker, RemoteReadChildRequest, RemoteHeaderRequest, BlockBackend, +}; use sp_externalities::Extensions; use sc_block_builder::BlockBuilderProvider; use sp_blockchain::{ diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 4ff89f5319..5a676e5263 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -19,18 +19,18 @@ //! Service integration test utils. use std::iter; -use std::sync::{Arc, Mutex, MutexGuard}; +use std::sync::Arc; use std::net::Ipv4Addr; use std::pin::Pin; use std::time::Duration; -use log::info; +use log::{info, debug}; use futures01::{Future, Stream, Poll}; use futures::{FutureExt as _, TryFutureExt as _}; use tempfile::TempDir; use tokio::{runtime::Runtime, prelude::FutureExt}; use tokio::timer::Interval; use sc_service::{ - AbstractService, + TaskManager, GenericChainSpec, ChainSpecExtension, Configuration, @@ -39,12 +39,15 @@ use sc_service::{ Role, Error, TaskExecutor, + client::Client, }; use sp_blockchain::HeaderBackend; use sc_network::{multiaddr, Multiaddr}; use sc_network::config::{NetworkConfiguration, TransportConfig}; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; use sp_transaction_pool::TransactionPool; +use sc_client_api::{Backend, CallExecutor}; +use parking_lot::Mutex; #[cfg(test)] mod client; @@ -54,47 +57,100 @@ const MAX_WAIT_TIME: Duration = Duration::from_secs(60 * 3); struct TestNet { runtime: Runtime, - authority_nodes: Vec<(usize, SyncService, U, Multiaddr)>, - full_nodes: Vec<(usize, SyncService, U, Multiaddr)>, - light_nodes: Vec<(usize, SyncService, Multiaddr)>, + authority_nodes: Vec<(usize, F, U, Multiaddr)>, + full_nodes: Vec<(usize, F, U, Multiaddr)>, + light_nodes: Vec<(usize, L, Multiaddr)>, chain_spec: GenericChainSpec, base_port: u16, nodes: usize, } -/// Wraps around an `Arc` and implements `Future`. -pub struct SyncService(Arc>); +pub trait TestNetNode: Clone + Future + Send + 'static { + type Block: BlockT; + type Backend: Backend; + type Executor: CallExecutor + Send + Sync; + type RuntimeApi: Send + Sync; + type TransactionPool: TransactionPool; -impl SyncService { - pub fn get(&self) -> MutexGuard { - self.0.lock().unwrap() - } + fn client(&self) -> Arc>; + fn transaction_pool(&self) -> Arc; + fn network(&self) -> Arc::Hash>>; } -impl Clone for SyncService { - fn clone(&self) -> Self { - Self(self.0.clone()) +pub struct TestNetComponents { + task_manager: Arc>, + client: Arc>, + transaction_pool: Arc, + network: Arc::Hash>>, +} + +impl +TestNetComponents { + pub fn new( + task_manager: TaskManager, + client: Arc>, + network: Arc::Hash>>, + transaction_pool: Arc, + ) -> Self { + Self { + client, transaction_pool, network, + task_manager: Arc::new(Mutex::new(task_manager)), + } } } -impl From for SyncService { - fn from(service: T) -> Self { - SyncService(Arc::new(Mutex::new(service))) + +impl Clone for +TestNetComponents { + fn clone(&self) -> Self { + Self { + task_manager: self.task_manager.clone(), + client: self.client.clone(), + transaction_pool: self.transaction_pool.clone(), + network: self.network.clone(), + } } } -impl> + Unpin> Future for SyncService { +impl Future for + TestNetComponents +{ type Item = (); type Error = sc_service::Error; fn poll(&mut self) -> Poll { - let mut f = self.0.lock().unwrap(); - futures::compat::Compat::new(&mut *f).poll() + futures::compat::Compat::new(&mut self.task_manager.lock().future()).poll() + } +} + +impl TestNetNode for +TestNetComponents + where + TBl: BlockT, + TBackend: sc_client_api::Backend + Send + Sync + 'static, + TExec: CallExecutor + Send + Sync + 'static, + TRtApi: Send + Sync + 'static, + TExPool: TransactionPool + Send + Sync + 'static, +{ + type Block = TBl; + type Backend = TBackend; + type Executor = TExec; + type RuntimeApi = TRtApi; + type TransactionPool = TExPool; + + fn client(&self) -> Arc> { + self.client.clone() + } + fn transaction_pool(&self) -> Arc { + self.transaction_pool.clone() + } + fn network(&self) -> Arc::Hash>> { + self.network.clone() } } impl TestNet -where F: Send + 'static, L: Send +'static, U: Clone + Send + 'static +where F: Clone + Send + 'static, L: Clone + Send +'static, U: Clone + Send + 'static { pub fn run_until_all_full( &mut self, @@ -102,8 +158,8 @@ where F: Send + 'static, L: Send +'static, U: Clone + Send + 'static light_predicate: LP, ) where - FP: Send + Fn(usize, &SyncService) -> bool + 'static, - LP: Send + Fn(usize, &SyncService) -> bool + 'static, + FP: Send + Fn(usize, &F) -> bool + 'static, + LP: Send + Fn(usize, &L) -> bool + 'static, { let full_nodes = self.full_nodes.clone(); let light_nodes = self.light_nodes.clone(); @@ -217,8 +273,8 @@ fn node_config TestNet where - F: AbstractService, - L: AbstractService, + F: TestNetNode, + L: TestNetNode, E: ChainSpecExtension + Clone + 'static + Send, G: RuntimeGenesis + 'static, { @@ -276,10 +332,9 @@ impl TestNet where ); let addr = node_config.network.listen_addresses.iter().next().unwrap().clone(); let (service, user_data) = authority(node_config).expect("Error creating test node service"); - let service = SyncService::from(service); executor.spawn(service.clone().map_err(|_| ())); - let addr = addr.with(multiaddr::Protocol::P2p(service.get().network().local_peer_id().clone().into())); + let addr = addr.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into())); self.authority_nodes.push((self.nodes, service, user_data, addr)); self.nodes += 1; } @@ -296,10 +351,9 @@ impl TestNet where ); let addr = node_config.network.listen_addresses.iter().next().unwrap().clone(); let (service, user_data) = full(node_config).expect("Error creating test node service"); - let service = SyncService::from(service); executor.spawn(service.clone().map_err(|_| ())); - let addr = addr.with(multiaddr::Protocol::P2p(service.get().network().local_peer_id().clone().into())); + let addr = addr.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into())); self.full_nodes.push((self.nodes, service, user_data, addr)); self.nodes += 1; } @@ -315,10 +369,10 @@ impl TestNet where &temp, ); let addr = node_config.network.listen_addresses.iter().next().unwrap().clone(); - let service = SyncService::from(light(node_config).expect("Error creating test node service")); + let service = light(node_config).expect("Error creating test node service"); executor.spawn(service.clone().map_err(|_| ())); - let addr = addr.with(multiaddr::Protocol::P2p(service.get().network().local_peer_id().clone().into())); + let addr = addr.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into())); self.light_nodes.push((self.nodes, service, addr)); self.nodes += 1; } @@ -337,9 +391,9 @@ pub fn connectivity( E: ChainSpecExtension + Clone + 'static + Send, G: RuntimeGenesis + 'static, Fb: Fn(Configuration) -> Result, - F: AbstractService, + F: TestNetNode, Lb: Fn(Configuration) -> Result, - L: AbstractService, + L: TestNetNode, { const NUM_FULL_NODES: usize = 5; const NUM_LIGHT_NODES: usize = 5; @@ -363,19 +417,25 @@ pub fn connectivity( info!("Checking star topology"); let first_address = network.full_nodes[0].3.clone(); for (_, service, _, _) in network.full_nodes.iter().skip(1) { - service.get().network().add_reserved_peer(first_address.to_string()) + service.network().add_reserved_peer(first_address.to_string()) .expect("Error adding reserved peer"); } for (_, service, _) in network.light_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()) + service.network().add_reserved_peer(first_address.to_string()) .expect("Error adding reserved peer"); } network.run_until_all_full( - move |_index, service| service.get().network().num_connected() - == expected_full_connections, - move |_index, service| service.get().network().num_connected() - == expected_light_connections, + move |_index, service| { + let connected = service.network().num_connected(); + debug!("Got {}/{} full connections...", connected, expected_full_connections); + connected == expected_full_connections + }, + move |_index, service| { + let connected = service.network().num_connected(); + debug!("Got {}/{} light connections...", connected, expected_light_connections); + connected == expected_light_connections + }, ); network.runtime @@ -404,24 +464,30 @@ pub fn connectivity( for i in 0..max_nodes { if i != 0 { if let Some((_, service, _, node_id)) = network.full_nodes.get(i) { - service.get().network().add_reserved_peer(address.to_string()) + service.network().add_reserved_peer(address.to_string()) .expect("Error adding reserved peer"); address = node_id.clone(); } } if let Some((_, service, node_id)) = network.light_nodes.get(i) { - service.get().network().add_reserved_peer(address.to_string()) + service.network().add_reserved_peer(address.to_string()) .expect("Error adding reserved peer"); address = node_id.clone(); } } network.run_until_all_full( - move |_index, service| service.get().network().num_connected() - == expected_full_connections, - move |_index, service| service.get().network().num_connected() - == expected_light_connections, + move |_index, service| { + let connected = service.network().num_connected(); + debug!("Got {}/{} full connections...", connected, expected_full_connections); + connected == expected_full_connections + }, + move |_index, service| { + let connected = service.network().num_connected(); + debug!("Got {}/{} light connections...", connected, expected_light_connections); + connected == expected_light_connections + }, ); } temp.close().expect("Error removing temp dir"); @@ -436,9 +502,9 @@ pub fn sync( mut extrinsic_factory: ExF ) where Fb: Fn(Configuration) -> Result<(F, U), Error>, - F: AbstractService, + F: TestNetNode, Lb: Fn(Configuration) -> Result, - L: AbstractService, + L: TestNetNode, B: FnMut(&F, &mut U), ExF: FnMut(&F, &U) -> ::Extrinsic, U: Clone + Send + 'static, @@ -468,39 +534,41 @@ pub fn sync( info!("Generating #{}", i + 1); } - make_block_and_import(&first_service.get(), first_user_data); + make_block_and_import(&first_service, first_user_data); } - (network.full_nodes[0].1).0.lock().unwrap().network().update_chain(); + network.full_nodes[0].1.network().update_chain(); network.full_nodes[0].3.clone() }; info!("Running sync"); for (_, service, _, _) in network.full_nodes.iter().skip(1) { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } for (_, service, _) in network.light_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } network.run_until_all_full( |_index, service| - service.get().client().info().best_number == (NUM_BLOCKS as u32).into(), + service.client().info().best_number == (NUM_BLOCKS as u32).into(), |_index, service| - service.get().client().info().best_number == (NUM_BLOCKS as u32).into(), + service.client().info().best_number == (NUM_BLOCKS as u32).into(), ); info!("Checking extrinsic propagation"); let first_service = network.full_nodes[0].1.clone(); let first_user_data = &network.full_nodes[0].2; - let best_block = BlockId::number(first_service.get().client().info().best_number); - let extrinsic = extrinsic_factory(&first_service.get(), first_user_data); + let best_block = BlockId::number(first_service.client().info().best_number); + let extrinsic = extrinsic_factory(&first_service, first_user_data); let source = sp_transaction_pool::TransactionSource::External; futures::executor::block_on( - first_service.get().transaction_pool().submit_one(&best_block, source, extrinsic) + first_service.transaction_pool().submit_one(&best_block, source, extrinsic) ).expect("failed to submit extrinsic"); network.run_until_all_full( - |_index, service| service.get().transaction_pool().ready().count() == 1, + |_index, service| service.transaction_pool().ready().count() == 1, |_index, _service| true, ); } @@ -512,9 +580,9 @@ pub fn consensus( authorities: impl IntoIterator ) where Fb: Fn(Configuration) -> Result, - F: AbstractService, + F: TestNetNode, Lb: Fn(Configuration) -> Result, - L: AbstractService, + L: TestNetNode, E: ChainSpecExtension + Clone + 'static + Send, G: RuntimeGenesis + 'static, { @@ -534,19 +602,22 @@ pub fn consensus( info!("Checking consensus"); let first_address = network.authority_nodes[0].3.clone(); for (_, service, _, _) in network.full_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } for (_, service, _) in network.light_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } for (_, service, _, _) in network.authority_nodes.iter().skip(1) { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } network.run_until_all_full( |_index, service| - service.get().client().info().finalized_number >= (NUM_BLOCKS as u32 / 2).into(), + service.client().info().finalized_number >= (NUM_BLOCKS as u32 / 2).into(), |_index, service| - service.get().client().info().best_number >= (NUM_BLOCKS as u32 / 2).into(), + service.client().info().best_number >= (NUM_BLOCKS as u32 / 2).into(), ); info!("Adding more peers"); @@ -559,15 +630,17 @@ pub fn consensus( (0..0).map(|_| (String::new(), { |cfg| full_builder(cfg).map(|s| (s, ())) })), ); for (_, service, _, _) in network.full_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } for (_, service, _) in network.light_nodes.iter() { - service.get().network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer"); + service.network().add_reserved_peer(first_address.to_string()) + .expect("Error adding reserved peer"); } network.run_until_all_full( |_index, service| - service.get().client().info().finalized_number >= (NUM_BLOCKS as u32).into(), + service.client().info().finalized_number >= (NUM_BLOCKS as u32).into(), |_index, service| - service.get().client().info().best_number >= (NUM_BLOCKS as u32).into(), + service.client().info().best_number >= (NUM_BLOCKS as u32).into(), ); } diff --git a/test-utils/client/src/client_ext.rs b/test-utils/client/src/client_ext.rs index 706a7b6e95..a74bd3258e 100644 --- a/test-utils/client/src/client_ext.rs +++ b/test-utils/client/src/client_ext.rs @@ -19,6 +19,7 @@ use sc_service::client::Client; use sc_client_api::backend::Finalizer; +use sc_client_api::client::BlockBackend; use sp_consensus::{ BlockImportParams, BlockImport, BlockOrigin, Error as ConsensusError, ForkChoiceStrategy, diff --git a/utils/browser/src/lib.rs b/utils/browser/src/lib.rs index 799fe9788c..c8034d9466 100644 --- a/utils/browser/src/lib.rs +++ b/utils/browser/src/lib.rs @@ -19,14 +19,15 @@ use futures01::sync::mpsc as mpsc01; use log::{debug, info}; use sc_network::config::TransportConfig; use sc_service::{ - AbstractService, RpcSession, Role, Configuration, + RpcSession, Role, Configuration, TaskManager, RpcHandlers, config::{DatabaseConfig, KeystoreConfig, NetworkConfiguration}, GenericChainSpec, RuntimeGenesis }; use wasm_bindgen::prelude::*; -use futures::{prelude::*, channel::{oneshot, mpsc}, future::{poll_fn, ok}, compat::*}; -use std::task::Poll; -use std::pin::Pin; +use futures::{ + prelude::*, channel::{oneshot, mpsc}, compat::*, future::{ready, ok, select} +}; +use std::{sync::Arc, pin::Pin}; use sc_chain_spec::Extension; use libp2p_wasm_ext::{ExtTransport, ffi}; @@ -120,31 +121,25 @@ struct RpcMessage { } /// Create a Client object that connects to a service. -pub fn start_client(mut service: impl AbstractService) -> Client { +pub fn start_client(mut task_manager: TaskManager, rpc_handlers: Arc) -> Client { // We dispatch a background task responsible for processing the service. // // The main action performed by the code below consists in polling the service with // `service.poll()`. // The rest consists in handling RPC requests. - let (rpc_send_tx, mut rpc_send_rx) = mpsc::unbounded::(); - wasm_bindgen_futures::spawn_local(poll_fn(move |cx| { - loop { - match Pin::new(&mut rpc_send_rx).poll_next(cx) { - Poll::Ready(Some(message)) => { - let fut = service - .rpc_query(&message.session, &message.rpc_json) - .boxed(); - let _ = message.send_back.send(fut); - }, - Poll::Pending => break, - Poll::Ready(None) => return Poll::Ready(()), - } - } - - Pin::new(&mut service) - .poll(cx) - .map(drop) - })); + let (rpc_send_tx, rpc_send_rx) = mpsc::unbounded::(); + wasm_bindgen_futures::spawn_local( + select( + rpc_send_rx.for_each(move |message| { + let fut = rpc_handlers.rpc_query(&message.session, &message.rpc_json); + let _ = message.send_back.send(fut); + ready(()) + }), + Box::pin(async move { + let _ = task_manager.future().await; + }), + ).map(drop) + ); Client { rpc_send_tx, -- GitLab From 1b34df8bf27a8e49fdf928890491253144099351 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 30 Jun 2020 16:06:16 +0300 Subject: [PATCH 269/280] Block production integration benchmark (#6468) * proposer benchmark * update cargo.lock --- Cargo.lock | 7 + bin/node/bench/Cargo.toml | 7 + bin/node/bench/src/common.rs | 48 ++++ bin/node/bench/src/construct.rs | 296 ++++++++++++++++++++++++ bin/node/bench/src/import.rs | 38 +-- bin/node/bench/src/main.rs | 38 ++- bin/node/testing/src/bench.rs | 209 ++++++++++------- primitives/transaction-pool/src/pool.rs | 4 +- 8 files changed, 523 insertions(+), 124 deletions(-) create mode 100644 bin/node/bench/src/common.rs create mode 100644 bin/node/bench/src/construct.rs diff --git a/Cargo.lock b/Cargo.lock index 8b0273d199..94f3f5effe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3362,6 +3362,7 @@ version = "0.8.0-rc4" dependencies = [ "derive_more", "fs_extra", + "futures 0.3.5", "hash-db", "hex", "kvdb", @@ -3374,13 +3375,19 @@ dependencies = [ "parity-db", "parity-util-mem", "rand 0.7.3", + "sc-basic-authorship", "sc-cli", "sc-client-api", "serde", "serde_json", + "sp-consensus", "sp-core", + "sp-finality-tracker", + "sp-inherents", "sp-runtime", "sp-state-machine", + "sp-timestamp", + "sp-transaction-pool", "sp-trie", "structopt", "tempfile", diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index ab156635ec..07db27a1f1 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -25,6 +25,12 @@ kvdb = "0.6" kvdb-rocksdb = "0.8" sp-trie = { version = "2.0.0-rc4", path = "../../../primitives/trie" } sp-core = { version = "2.0.0-rc4", path = "../../../primitives/core" } +sp-consensus = { version = "0.8.0-rc4", path = "../../../primitives/consensus/common" } +sp-transaction-pool = { version = "2.0.0-rc4", path = "../../../primitives/transaction-pool" } +sc-basic-authorship = { version = "0.8.0-rc4", path = "../../../client/basic-authorship" } +sp-inherents = { version = "2.0.0-rc4", path = "../../../primitives/inherents" } +sp-finality-tracker = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/finality-tracker" } +sp-timestamp = { version = "2.0.0-rc4", default-features = false, path = "../../../primitives/timestamp" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" @@ -33,3 +39,4 @@ rand = { version = "0.7.2", features = ["small_rng"] } lazy_static = "1.4.0" parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] } parity-db = { version = "0.1.2" } +futures = "0.3.1" diff --git a/bin/node/bench/src/common.rs b/bin/node/bench/src/common.rs new file mode 100644 index 0000000000..2637d6e9bd --- /dev/null +++ b/bin/node/bench/src/common.rs @@ -0,0 +1,48 @@ + +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +#[derive(Clone, Copy, Debug, derive_more::Display)] +pub enum SizeType { + #[display(fmt = "empty")] + Empty, + #[display(fmt = "small")] + Small, + #[display(fmt = "medium")] + Medium, + #[display(fmt = "large")] + Large, + #[display(fmt = "full")] + Full, + #[display(fmt = "custom")] + Custom(usize), +} + +impl SizeType { + pub fn transactions(&self) -> Option { + match self { + SizeType::Empty => Some(0), + SizeType::Small => Some(10), + SizeType::Medium => Some(100), + SizeType::Large => Some(500), + SizeType::Full => None, + // Custom SizeType will use the `--transactions` input parameter + SizeType::Custom(val) => Some(*val), + } + } +} \ No newline at end of file diff --git a/bin/node/bench/src/construct.rs b/bin/node/bench/src/construct.rs new file mode 100644 index 0000000000..e23594dd43 --- /dev/null +++ b/bin/node/bench/src/construct.rs @@ -0,0 +1,296 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program 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. + +// This program 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 this program. If not, see . + +//! Block construction benchmark. +//! +//! This benchmark is expected to measure block construction. +//! We want to protect against cold-cache attacks, and so this +//! benchmark should not rely on any caching (except those entries that +//! DO NOT depend on user input). Thus transaction generation should be +//! based on randomized data. + +use std::{ + borrow::Cow, + collections::HashMap, + pin::Pin, + sync::Arc, +}; +use futures::Future; + +use node_primitives::Block; +use node_testing::bench::{BenchDb, Profile, BlockType, KeyTypes, DatabaseType}; +use sp_runtime::{ + generic::BlockId, + traits::NumberFor, + OpaqueExtrinsic, +}; +use sp_transaction_pool::{ + ImportNotificationStream, + PoolFuture, + PoolStatus, + TransactionFor, + TransactionSource, + TransactionStatusStreamFor, + TxHash, +}; +use sp_consensus::{Environment, Proposer, RecordProof}; + +use crate::{ + common::SizeType, + core::{self, Path, Mode}, +}; + +pub struct ConstructionBenchmarkDescription { + pub profile: Profile, + pub key_types: KeyTypes, + pub block_type: BlockType, + pub size: SizeType, + pub database_type: DatabaseType, +} + +pub struct ConstructionBenchmark { + profile: Profile, + database: BenchDb, + transactions: Transactions, +} + +impl core::BenchmarkDescription for ConstructionBenchmarkDescription { + fn path(&self) -> Path { + + let mut path = Path::new(&["node", "proposer"]); + + match self.profile { + Profile::Wasm => path.push("wasm"), + Profile::Native => path.push("native"), + } + + match self.key_types { + KeyTypes::Sr25519 => path.push("sr25519"), + KeyTypes::Ed25519 => path.push("ed25519"), + } + + match self.block_type { + BlockType::RandomTransfersKeepAlive => path.push("transfer"), + BlockType::RandomTransfersReaping => path.push("transfer_reaping"), + BlockType::Noop => path.push("noop"), + } + + match self.database_type { + DatabaseType::RocksDb => path.push("rocksdb"), + DatabaseType::ParityDb => path.push("paritydb"), + } + + path.push(&format!("{}", self.size)); + + path + } + + fn setup(self: Box) -> Box { + let mut extrinsics: Vec> = Vec::new(); + + let mut bench_db = BenchDb::with_key_types( + self.database_type, + 50_000, + self.key_types + ); + + let client = bench_db.client(); + + let content_type = self.block_type.to_content(self.size.transactions()); + for transaction in bench_db.block_content(content_type, &client) { + extrinsics.push(Arc::new(transaction.into())); + } + + Box::new(ConstructionBenchmark { + profile: self.profile, + database: bench_db, + transactions: Transactions(extrinsics), + }) + } + + fn name(&self) -> Cow<'static, str> { + format!( + "Block construction ({:?}/{}, {:?}, {:?} backend)", + self.block_type, + self.size, + self.profile, + self.database_type, + ).into() + } +} + +impl core::Benchmark for ConstructionBenchmark { + fn run(&mut self, mode: Mode) -> std::time::Duration { + let context = self.database.create_context(self.profile); + + let _ = context.client.runtime_version_at(&BlockId::Number(0)) + .expect("Failed to get runtime version") + .spec_version; + + if mode == Mode::Profile { + std::thread::park_timeout(std::time::Duration::from_secs(3)); + } + + let mut proposer_factory = sc_basic_authorship::ProposerFactory::new( + context.client.clone(), + self.transactions.clone().into(), + None, + ); + let inherent_data_providers = sp_inherents::InherentDataProviders::new(); + inherent_data_providers + .register_provider(sp_timestamp::InherentDataProvider) + .expect("Failed to register timestamp data provider"); + + let start = std::time::Instant::now(); + + let proposer = futures::executor::block_on(proposer_factory.init( + &context.client.header(&BlockId::number(0)) + .expect("Database error querying block #0") + .expect("Block #0 should exist"), + )).expect("Proposer initialization failed"); + + let _block = futures::executor::block_on( + proposer.propose( + inherent_data_providers.create_inherent_data().expect("Create inherent data failed"), + Default::default(), + std::time::Duration::from_secs(20), + RecordProof::Yes, + ), + ).map(|r| r.block).expect("Proposing failed"); + + let elapsed = start.elapsed(); + + if mode == Mode::Profile { + std::thread::park_timeout(std::time::Duration::from_secs(1)); + } + + elapsed + } +} + +#[derive(Clone, Debug)] +pub struct PoolTransaction { + data: OpaqueExtrinsic, + hash: node_primitives::Hash, +} + +impl From for PoolTransaction { + fn from(e: OpaqueExtrinsic) -> Self { + PoolTransaction { + data: e, + hash: node_primitives::Hash::zero(), + } + } +} + +impl sp_transaction_pool::InPoolTransaction for PoolTransaction { + type Transaction = OpaqueExtrinsic; + type Hash = node_primitives::Hash; + + fn data(&self) -> &Self::Transaction { + &self.data + } + + fn hash(&self) -> &Self::Hash { + &self.hash + } + + fn priority(&self) -> &u64 { unimplemented!() } + + fn longevity(&self) -> &u64 { unimplemented!() } + + fn requires(&self) -> &[Vec] { unimplemented!() } + + fn provides(&self) -> &[Vec] { unimplemented!() } + + fn is_propagable(&self) -> bool { unimplemented!() } +} + +#[derive(Clone, Debug)] +pub struct Transactions(Vec>); + +impl sp_transaction_pool::TransactionPool for Transactions { + type Block = Block; + type Hash = node_primitives::Hash; + type InPoolTransaction = PoolTransaction; + type Error = sp_transaction_pool::error::Error; + + /// Returns a future that imports a bunch of unverified transactions to the pool. + fn submit_at( + &self, + _at: &BlockId, + _source: TransactionSource, + _xts: Vec>, + ) -> PoolFuture>, Self::Error> { + unimplemented!() + } + + /// Returns a future that imports one unverified transaction to the pool. + fn submit_one( + &self, + _at: &BlockId, + _source: TransactionSource, + _xt: TransactionFor, + ) -> PoolFuture, Self::Error> { + unimplemented!() + } + + fn submit_and_watch( + &self, + _at: &BlockId, + _source: TransactionSource, + _xt: TransactionFor, + ) -> PoolFuture>, Self::Error> { + unimplemented!() + } + + fn ready_at(&self, _at: NumberFor) + -> Pin> + Send>> + Send>> + { + let iter: Box> + Send> = Box::new(self.0.clone().into_iter()); + Box::pin(futures::future::ready(iter)) + } + + fn ready(&self) -> Box> + Send> { + unimplemented!() + } + + fn remove_invalid(&self, _hashes: &[TxHash]) -> Vec> { + Default::default() + } + + fn status(&self) -> PoolStatus { + unimplemented!() + } + + fn import_notification_stream(&self) -> ImportNotificationStream> { + unimplemented!() + } + + fn on_broadcasted(&self, _propagations: HashMap, Vec>) { + unimplemented!() + } + + fn hash_of(&self, _xt: &TransactionFor) -> TxHash { + unimplemented!() + } + + fn ready_transaction(&self, _hash: &TxHash) -> Option> { + unimplemented!() + } +} \ No newline at end of file diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs index c1b324c03c..e49a359fb6 100644 --- a/bin/node/bench/src/import.rs +++ b/bin/node/bench/src/import.rs @@ -38,37 +38,10 @@ use sc_client_api::backend::Backend; use sp_runtime::generic::BlockId; use sp_state_machine::InspectState; -use crate::core::{self, Path, Mode}; - -#[derive(Clone, Copy, Debug, derive_more::Display)] -pub enum SizeType { - #[display(fmt = "empty")] - Empty, - #[display(fmt = "small")] - Small, - #[display(fmt = "medium")] - Medium, - #[display(fmt = "large")] - Large, - #[display(fmt = "full")] - Full, - #[display(fmt = "custom")] - Custom(usize), -} - -impl SizeType { - pub fn transactions(&self) -> Option { - match self { - SizeType::Empty => Some(0), - SizeType::Small => Some(10), - SizeType::Medium => Some(100), - SizeType::Large => Some(500), - SizeType::Full => None, - // Custom SizeType will use the `--transactions` input parameter - SizeType::Custom(val) => Some(*val), - } - } -} +use crate::{ + common::SizeType, + core::{self, Path, Mode}, +}; pub struct ImportBenchmarkDescription { pub profile: Profile, @@ -134,8 +107,9 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription { fn name(&self) -> Cow<'static, str> { format!( - "Import benchmark ({:?}, {:?}, {:?} backend)", + "Block import ({:?}/{}, {:?}, {:?} backend)", self.block_type, + self.size, self.profile, self.database_type, ).into() diff --git a/bin/node/bench/src/main.rs b/bin/node/bench/src/main.rs index 5c5af37038..1182024711 100644 --- a/bin/node/bench/src/main.rs +++ b/bin/node/bench/src/main.rs @@ -16,21 +16,29 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +mod common; +mod construct; #[macro_use] mod core; mod import; -mod trie; -mod simple_trie; mod generator; -mod tempdb; +mod simple_trie; mod state_sizes; +mod tempdb; +mod trie; -use crate::core::{run_benchmark, Mode as BenchmarkMode}; -use crate::tempdb::DatabaseType; -use import::{ImportBenchmarkDescription, SizeType}; -use trie::{TrieReadBenchmarkDescription, TrieWriteBenchmarkDescription, DatabaseSize}; -use node_testing::bench::{Profile, KeyTypes, BlockType, DatabaseType as BenchDataBaseType}; use structopt::StructOpt; +use node_testing::bench::{Profile, KeyTypes, BlockType, DatabaseType as BenchDataBaseType}; + +use crate::{ + common::SizeType, + core::{run_benchmark, Mode as BenchmarkMode}, + tempdb::DatabaseType, + import::ImportBenchmarkDescription, + trie::{TrieReadBenchmarkDescription, TrieWriteBenchmarkDescription, DatabaseSize}, + construct::ConstructionBenchmarkDescription, +}; + #[derive(Debug, StructOpt)] #[structopt(name = "node-bench", about = "Node integration benchmarks")] struct Opt { @@ -126,6 +134,20 @@ fn main() { ] .iter().map(move |db_type| (size, db_type))) => TrieWriteBenchmarkDescription { database_size: *size, database_type: *db_type }, + ConstructionBenchmarkDescription { + profile: Profile::Wasm, + key_types: KeyTypes::Sr25519, + block_type: BlockType::RandomTransfersKeepAlive, + size: SizeType::Medium, + database_type: BenchDataBaseType::RocksDb, + }, + ConstructionBenchmarkDescription { + profile: Profile::Wasm, + key_types: KeyTypes::Sr25519, + block_type: BlockType::RandomTransfersKeepAlive, + size: SizeType::Large, + database_type: BenchDataBaseType::RocksDb, + }, ); if opt.list { diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs index 5df2709f87..507d3420d8 100644 --- a/bin/node/testing/src/bench.rs +++ b/bin/node/testing/src/bench.rs @@ -152,20 +152,12 @@ impl BlockType { } /// Content of the generated block. +#[derive(Clone, Debug)] pub struct BlockContent { block_type: BlockType, size: Option, } -impl BlockContent { - fn iter_while(&self, mut f: impl FnMut(usize) -> bool) { - match self.size { - Some(v) => { for i in 0..v { if !f(i) { break; }}} - None => { for i in 0.. { if !f(i) { break; }}} - } - } -} - /// Type of backend database. #[derive(Debug, PartialEq, Clone, Copy)] pub enum DatabaseType { @@ -219,6 +211,93 @@ impl CloneableSpawn for TaskExecutor { } } +/// Iterator for block content. +pub struct BlockContentIterator<'a> { + iteration: usize, + content: BlockContent, + runtime_version: sc_executor::RuntimeVersion, + genesis_hash: node_primitives::Hash, + keyring: &'a BenchKeyring, +} + +impl<'a> BlockContentIterator<'a> { + fn new(content: BlockContent, keyring: &'a BenchKeyring, client: &Client) -> Self { + let runtime_version = client.runtime_version_at(&BlockId::number(0)) + .expect("There should be runtime version at 0"); + + let genesis_hash = client.block_hash(Zero::zero()) + .expect("Database error?") + .expect("Genesis block always exists; qed") + .into(); + + BlockContentIterator { + iteration: 0, + content, + keyring, + runtime_version, + genesis_hash, + } + } +} + +impl<'a> Iterator for BlockContentIterator<'a> { + type Item = OpaqueExtrinsic; + + fn next(&mut self) -> Option { + if self.content.size.map(|size| size <= self.iteration).unwrap_or(false) { + return None; + } + + let sender = self.keyring.at(self.iteration); + let receiver = get_account_id_from_seed::( + &format!("random-user//{}", self.iteration) + ); + + let signed = self.keyring.sign( + CheckedExtrinsic { + signed: Some((sender, signed_extra(0, node_runtime::ExistentialDeposit::get() + 1))), + function: match self.content.block_type { + BlockType::RandomTransfersKeepAlive => { + Call::Balances( + BalancesCall::transfer_keep_alive( + pallet_indices::address::Address::Id(receiver), + node_runtime::ExistentialDeposit::get() + 1, + ) + ) + }, + BlockType::RandomTransfersReaping => { + Call::Balances( + BalancesCall::transfer( + pallet_indices::address::Address::Id(receiver), + // Transfer so that ending balance would be 1 less than existential deposit + // so that we kill the sender account. + 100*DOLLARS - (node_runtime::ExistentialDeposit::get() - 1), + ) + ) + }, + BlockType::Noop => { + Call::System( + SystemCall::remark(Vec::new()) + ) + }, + }, + }, + self.runtime_version.spec_version, + self.runtime_version.transaction_version, + self.genesis_hash.into(), + ); + + let encoded = Encode::encode(&signed); + + let opaque = OpaqueExtrinsic::decode(&mut &encoded[..]) + .expect("Failed to decode opaque"); + + self.iteration += 1; + + Some(opaque) + } +} + impl BenchDb { /// New immutable benchmarking database. /// @@ -288,8 +367,33 @@ impl BenchDb { (client, backend) } - /// Generate new block using this database. - pub fn generate_block(&mut self, content: BlockContent) -> Block { + /// Generate list of required inherents. + /// + /// Uses already instantiated Client. + pub fn generate_inherents(&mut self, client: &Client) -> Vec { + let mut inherent_data = InherentData::new(); + let timestamp = 1 * MinimumPeriod::get(); + + inherent_data.put_data(sp_timestamp::INHERENT_IDENTIFIER, ×tamp) + .expect("Put timestamp failed"); + inherent_data.put_data(sp_finality_tracker::INHERENT_IDENTIFIER, &0) + .expect("Put finality tracker failed"); + + client.runtime_api() + .inherent_extrinsics_with_context( + &BlockId::number(0), + ExecutionContext::BlockConstruction, + inherent_data, + ).expect("Get inherents failed") + } + + /// Iterate over some block content with transaction signed using this database keyring. + pub fn block_content(&self, content: BlockContent, client: &Client) -> BlockContentIterator { + BlockContentIterator::new(content, &self.keyring, client) + } + + /// Get cliet for this database operations. + pub fn client(&mut self) -> Client { let (client, _backend) = Self::bench_client( self.database_type, self.directory_guard.path(), @@ -297,92 +401,33 @@ impl BenchDb { &self.keyring, ); - let runtime_version = client.runtime_version_at(&BlockId::number(0)) - .expect("There should be runtime version at 0"); + client + } - let genesis_hash = client.block_hash(Zero::zero()) - .expect("Database error?") - .expect("Genesis block always exists; qed") - .into(); + /// Generate new block using this database. + pub fn generate_block(&mut self, content: BlockContent) -> Block { + let client = self.client(); let mut block = client .new_block(Default::default()) .expect("Block creation failed"); - let timestamp = 1 * MinimumPeriod::get(); - - let mut inherent_data = InherentData::new(); - inherent_data.put_data(sp_timestamp::INHERENT_IDENTIFIER, ×tamp) - .expect("Put timestamp failed"); - inherent_data.put_data(sp_finality_tracker::INHERENT_IDENTIFIER, &0) - .expect("Put finality tracker failed"); - - for extrinsic in client.runtime_api() - .inherent_extrinsics_with_context( - &BlockId::number(0), - ExecutionContext::BlockConstruction, - inherent_data, - ).expect("Get inherents failed") - { + for extrinsic in self.generate_inherents(&client) { block.push(extrinsic).expect("Push inherent failed"); } let start = std::time::Instant::now(); - content.iter_while(|iteration| { - let sender = self.keyring.at(iteration); - let receiver = get_account_id_from_seed::( - &format!("random-user//{}", iteration) - ); - - let signed = self.keyring.sign( - CheckedExtrinsic { - signed: Some((sender, signed_extra(0, node_runtime::ExistentialDeposit::get() + 1))), - function: match content.block_type { - BlockType::RandomTransfersKeepAlive => { - Call::Balances( - BalancesCall::transfer_keep_alive( - pallet_indices::address::Address::Id(receiver), - node_runtime::ExistentialDeposit::get() + 1, - ) - ) - }, - BlockType::RandomTransfersReaping => { - Call::Balances( - BalancesCall::transfer( - pallet_indices::address::Address::Id(receiver), - // Transfer so that ending balance would be 1 less than existential deposit - // so that we kill the sender account. - 100*DOLLARS - (node_runtime::ExistentialDeposit::get() - 1), - ) - ) - }, - BlockType::Noop => { - Call::System( - SystemCall::remark(Vec::new()) - ) - }, - }, - }, - runtime_version.spec_version, - runtime_version.transaction_version, - genesis_hash, - ); - - let encoded = Encode::encode(&signed); - - let opaque = OpaqueExtrinsic::decode(&mut &encoded[..]) - .expect("Failed to decode opaque"); - + for opaque in self.block_content(content, &client) { match block.push(opaque) { Err(sp_blockchain::Error::ApplyExtrinsicFailed( sp_blockchain::ApplyExtrinsicFailed::Validity(e) )) if e.exhausted_resources() => { - return false; + break; }, Err(err) => panic!("Error pushing transaction: {:?}", err), - Ok(_) => true, + Ok(_) => {}, } - }); + }; let block = block.build().expect("Block build failed").block; @@ -411,7 +456,7 @@ impl BenchDb { ); BenchContext { - client, backend, db_guard: directory_guard, + client: Arc::new(client), backend, db_guard: directory_guard, } } } @@ -543,7 +588,7 @@ impl Guard { /// Benchmarking/test context holding instantiated client and backend references. pub struct BenchContext { /// Node client. - pub client: Client, + pub client: Arc, /// Node backend. pub backend: Arc, diff --git a/primitives/transaction-pool/src/pool.rs b/primitives/transaction-pool/src/pool.rs index b00c283ac7..848c6f9e17 100644 --- a/primitives/transaction-pool/src/pool.rs +++ b/primitives/transaction-pool/src/pool.rs @@ -23,7 +23,7 @@ use std::{ sync::Arc, pin::Pin, }; -use futures::{Future, Stream,}; +use futures::{Future, Stream}; use serde::{Deserialize, Serialize}; use sp_utils::mpsc; use sp_runtime::{ @@ -164,7 +164,7 @@ pub trait InPoolTransaction { /// Get priority of the transaction. fn priority(&self) -> &TransactionPriority; /// Get longevity of the transaction. - fn longevity(&self) ->&TransactionLongevity; + fn longevity(&self) -> &TransactionLongevity; /// Get transaction dependencies. fn requires(&self) -> &[TransactionTag]; /// Get tags that transaction provides. -- GitLab From 329d538781390cb896692f03e966e159b7602e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 30 Jun 2020 16:04:15 +0200 Subject: [PATCH 270/280] Make the `OnRuntimeUpgrade` docs more clear (#6542) --- frame/support/src/traits.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frame/support/src/traits.rs b/frame/support/src/traits.rs index b36559c363..f7e7710b32 100644 --- a/frame/support/src/traits.rs +++ b/frame/support/src/traits.rs @@ -1431,11 +1431,19 @@ impl OnInitialize for Tuple { } } -/// The runtime upgrade trait. Implementing this lets you express what should happen -/// when the runtime upgrades, and changes may need to occur to your module. +/// The runtime upgrade trait. +/// +/// Implementing this lets you express what should happen when the runtime upgrades, +/// and changes may need to occur to your module. pub trait OnRuntimeUpgrade { /// Perform a module upgrade. /// + /// # Warning + /// + /// This function will be called before we initialized any runtime state, aka `on_initialize` + /// wasn't called yet. So, information like the block number and any other + /// block local data are not accessible. + /// /// Return the non-negotiable weight consumed for runtime upgrade. fn on_runtime_upgrade() -> crate::weights::Weight { 0 } } -- GitLab From e8f901868997be15635cba9b21a99b212009adc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 30 Jun 2020 16:44:52 +0200 Subject: [PATCH 271/280] Support synching of blocks that are not `new_best` (#6508) * Start * Remove debug println * Add tests --- client/finality-grandpa/src/tests.rs | 2 +- client/network/src/protocol.rs | 4 +- client/network/src/protocol/sync.rs | 48 ++++++---- client/network/src/service/tests.rs | 2 +- client/network/test/src/block_import.rs | 8 +- client/network/test/src/lib.rs | 92 +++++++++++++++++-- client/network/test/src/sync.rs | 48 +++++++++- client/service/src/builder.rs | 2 +- .../consensus/common/src/block_validation.rs | 19 ++-- 9 files changed, 172 insertions(+), 53 deletions(-) diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index ffd8f1c8c6..b94c37d07e 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -106,7 +106,7 @@ impl TestNetFactory for GrandpaTestNet { _cfg: &ProtocolConfig, _: &PeerData, ) -> Self::Verifier { - PassThroughVerifier(false) // use non-instant finality. + PassThroughVerifier::new(false) // use non-instant finality. } fn make_block_import(&self, client: PeersClient) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index 90076552a7..ff3748bd55 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -1287,7 +1287,7 @@ impl Protocol { } let is_best = self.context_data.chain.info().best_hash == hash; - debug!(target: "sync", "Reannouncing block {:?}", hash); + debug!(target: "sync", "Reannouncing block {:?} is_best: {}", hash, is_best); self.send_announcement(&header, data, is_best, true) } @@ -2160,7 +2160,7 @@ mod tests { reserved_only: false, priority_groups: Vec::new(), }, - Box::new(DefaultBlockAnnounceValidator::new(client.clone())), + Box::new(DefaultBlockAnnounceValidator), None, Default::default(), None, diff --git a/client/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs index c3e87ca19a..bfd8c4fe21 100644 --- a/client/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -48,6 +48,7 @@ use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, Header, NumberFor, Zero, One, CheckedSub, SaturatedConversion, Hash, HashFor} }; +use sp_arithmetic::traits::Saturating; use std::{fmt, ops::Range, collections::{HashMap, HashSet, VecDeque}, sync::Arc}; mod blocks; @@ -388,7 +389,7 @@ impl ChainSync { /// Returns the current sync status. pub fn status(&self) -> Status { - let best_seen = self.peers.values().max_by_key(|p| p.best_number).map(|p| p.best_number); + let best_seen = self.peers.values().map(|p| p.best_number).max(); let sync_state = if let Some(n) = best_seen { // A chain is classified as downloading if the provided best block is @@ -1186,6 +1187,21 @@ impl ChainSync { peer.recently_announced.pop_front(); } peer.recently_announced.push_back(hash.clone()); + + // Let external validator check the block announcement. + let assoc_data = announce.data.as_ref().map_or(&[][..], |v| v.as_slice()); + let is_best = match self.block_announce_validator.validate(&header, assoc_data) { + Ok(Validation::Success { is_new_best }) => is_new_best || is_best, + Ok(Validation::Failure) => { + debug!(target: "sync", "Block announcement validation of block {} from {} failed", hash, who); + return OnBlockAnnounce::Nothing + } + Err(e) => { + error!(target: "sync", "💔 Block announcement validation errored: {}", e); + return OnBlockAnnounce::Nothing + } + }; + if is_best { // update their best block peer.best_number = number; @@ -1216,20 +1232,6 @@ impl ChainSync { return OnBlockAnnounce::Nothing } - // Let external validator check the block announcement. - let assoc_data = announce.data.as_ref().map_or(&[][..], |v| v.as_slice()); - match self.block_announce_validator.validate(&header, assoc_data) { - Ok(Validation::Success) => (), - Ok(Validation::Failure) => { - debug!(target: "sync", "Block announcement validation of block {} from {} failed", hash, who); - return OnBlockAnnounce::Nothing - } - Err(e) => { - error!(target: "sync", "💔 Block announcement validation errored: {}", e); - return OnBlockAnnounce::Nothing - } - } - if ancient_parent { trace!(target: "sync", "Ignored ancient block announced from {}: {} {:?}", who, hash, header); return OnBlockAnnounce::Nothing @@ -1428,14 +1430,24 @@ fn peer_block_request( max_parallel_downloads, MAX_DOWNLOAD_AHEAD, ) { + // The end is not part of the range. + let last = range.end.saturating_sub(One::one()); + + let from = if peer.best_number == last { + message::FromBlock::Hash(peer.best_hash) + } else { + message::FromBlock::Number(last) + }; + let request = message::generic::BlockRequest { id: 0, fields: attrs.clone(), - from: message::FromBlock::Number(range.start), + from, to: None, - direction: message::Direction::Ascending, + direction: message::Direction::Descending, max: Some((range.end - range.start).saturated_into::()) }; + Some((range, request)) } else { None @@ -1558,7 +1570,7 @@ mod test { let client = Arc::new(TestClientBuilder::new().build()); let info = client.info(); - let block_announce_validator = Box::new(DefaultBlockAnnounceValidator::new(client.clone())); + let block_announce_validator = Box::new(DefaultBlockAnnounceValidator); let peer_id = PeerId::random(); let mut sync = ChainSync::new( diff --git a/client/network/src/service/tests.rs b/client/network/src/service/tests.rs index c027c3be73..17d9553fa6 100644 --- a/client/network/src/service/tests.rs +++ b/client/network/src/service/tests.rs @@ -104,7 +104,7 @@ fn build_test_full_node(config: config::NetworkConfiguration) protocol_id: config::ProtocolId::from(&b"/test-protocol-name"[..]), import_queue, block_announce_validator: Box::new( - sp_consensus::block_validation::DefaultBlockAnnounceValidator::new(client.clone()), + sp_consensus::block_validation::DefaultBlockAnnounceValidator, ), metrics_registry: None, }) diff --git a/client/network/test/src/block_import.rs b/client/network/test/src/block_import.rs index 46a395700c..6762b74b6b 100644 --- a/client/network/test/src/block_import.rs +++ b/client/network/test/src/block_import.rs @@ -59,7 +59,7 @@ fn import_single_good_block_works() { &mut substrate_test_runtime_client::new(), BlockOrigin::File, block, - &mut PassThroughVerifier(true) + &mut PassThroughVerifier::new(true) ) { Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org)) if *num == number && *aux == expected_aux && *org == Some(peer_id) => {} @@ -74,7 +74,7 @@ fn import_single_good_known_block_is_ignored() { &mut client, BlockOrigin::File, block, - &mut PassThroughVerifier(true) + &mut PassThroughVerifier::new(true) ) { Ok(BlockImportResult::ImportedKnown(ref n)) if *n == number => {} _ => panic!() @@ -89,7 +89,7 @@ fn import_single_good_block_without_header_fails() { &mut substrate_test_runtime_client::new(), BlockOrigin::File, block, - &mut PassThroughVerifier(true) + &mut PassThroughVerifier::new(true) ) { Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {} _ => panic!() @@ -101,7 +101,7 @@ fn async_import_queue_drops() { let executor = sp_core::testing::SpawnBlockingExecutor::new(); // Perform this test multiple times since it exhibits non-deterministic behavior. for _ in 0..100 { - let verifier = PassThroughVerifier(true); + let verifier = PassThroughVerifier::new(true); let queue = BasicQueue::new( verifier, diff --git a/client/network/test/src/lib.rs b/client/network/test/src/lib.rs index a3e644558b..2896c4e3e1 100644 --- a/client/network/test/src/lib.rs +++ b/client/network/test/src/lib.rs @@ -39,7 +39,7 @@ use sc_client_api::{ use sc_consensus::LongestChain; use sc_block_builder::{BlockBuilder, BlockBuilderProvider}; use sc_network::config::Role; -use sp_consensus::block_validation::DefaultBlockAnnounceValidator; +use sp_consensus::block_validation::{DefaultBlockAnnounceValidator, BlockAnnounceValidator}; use sp_consensus::import_queue::{ BasicQueue, BoxJustificationImport, Verifier, BoxFinalityProofImport, }; @@ -67,7 +67,33 @@ type AuthorityId = sp_consensus_babe::AuthorityId; /// A Verifier that accepts all blocks and passes them on with the configured /// finality to be imported. #[derive(Clone)] -pub struct PassThroughVerifier(pub bool); +pub struct PassThroughVerifier { + finalized: bool, + fork_choice: ForkChoiceStrategy, +} + +impl PassThroughVerifier { + /// Create a new instance. + /// + /// Every verified block will use `finalized` for the `BlockImportParams`. + pub fn new(finalized: bool) -> Self { + Self { + finalized, + fork_choice: ForkChoiceStrategy::LongestChain, + } + } + + /// Create a new instance. + /// + /// Every verified block will use `finalized` for the `BlockImportParams` and + /// the given [`ForkChoiceStrategy`]. + pub fn new_with_fork_choice(finalized: bool, fork_choice: ForkChoiceStrategy) -> Self { + Self { + finalized, + fork_choice, + } + } +} /// This `Verifier` accepts all data as valid. impl Verifier for PassThroughVerifier { @@ -85,9 +111,9 @@ impl Verifier for PassThroughVerifier { .map(|blob| vec![(well_known_cache_keys::AUTHORITIES, blob.to_vec())]); let mut import = BlockImportParams::new(origin, header); import.body = body; - import.finalized = self.0; + import.finalized = self.finalized; import.justification = justification; - import.fork_choice = Some(ForkChoiceStrategy::LongestChain); + import.fork_choice = Some(self.fork_choice.clone()); Ok((import, maybe_keys)) } @@ -294,6 +320,7 @@ impl Peer { } else { Default::default() }; + self.block_import.import_block(import_block, cache).expect("block_import failed"); self.network.service().announce_block(hash, Vec::new()); at = hash; @@ -519,6 +546,15 @@ impl VerifierAdapter { } } +/// Configuration for a full peer. +#[derive(Default)] +pub struct FullPeerConfig { + /// Pruning window size. + pub keep_blocks: Option, + /// Block announce validator. + pub block_announce_validator: Option + Send + Sync>>, +} + pub trait TestNetFactory: Sized { type Verifier: 'static + Verifier; type PeerData: Default; @@ -579,12 +615,12 @@ pub trait TestNetFactory: Sized { } fn add_full_peer(&mut self) { - self.add_full_peer_with_states(None) + self.add_full_peer_with_config(Default::default()) } /// Add a full peer. - fn add_full_peer_with_states(&mut self, keep_blocks: Option) { - let test_client_builder = match keep_blocks { + fn add_full_peer_with_config(&mut self, config: FullPeerConfig) { + let test_client_builder = match config.keep_blocks { Some(keep_blocks) => TestClientBuilder::with_pruning_window(keep_blocks), None => TestClientBuilder::with_default_backend(), }; @@ -641,7 +677,8 @@ pub trait TestNetFactory: Sized { transaction_pool: Arc::new(EmptyTransactionPool), protocol_id: ProtocolId::from(&b"test-protocol-name"[..]), import_queue, - block_announce_validator: Box::new(DefaultBlockAnnounceValidator::new(client.clone())), + block_announce_validator: config.block_announce_validator + .unwrap_or(Box::new(DefaultBlockAnnounceValidator)), metrics_registry: None, }).unwrap(); @@ -720,7 +757,7 @@ pub trait TestNetFactory: Sized { transaction_pool: Arc::new(EmptyTransactionPool), protocol_id: ProtocolId::from(&b"test-protocol-name"[..]), import_queue, - block_announce_validator: Box::new(DefaultBlockAnnounceValidator::new(client.clone())), + block_announce_validator: Box::new(DefaultBlockAnnounceValidator), metrics_registry: None, }).unwrap(); @@ -787,6 +824,20 @@ pub trait TestNetFactory: Sized { Poll::Ready(()) } + /// Polls the testnet until all peers are connected to each other. + /// + /// Must be executed in a task context. + fn poll_until_connected(&mut self, cx: &mut FutureContext) -> Poll<()> { + self.poll(cx); + + let num_peers = self.peers().len(); + if self.peers().iter().all(|p| p.num_peers() == num_peers - 1) { + return Poll::Ready(()) + } + + Poll::Pending + } + /// Blocks the current thread until we are sync'ed. /// /// Calls `poll_until_sync` repeatedly. @@ -801,6 +852,15 @@ pub trait TestNetFactory: Sized { futures::executor::block_on(futures::future::poll_fn::<(), _>(|cx| self.poll_until_idle(cx))); } + /// Blocks the current thread until all peers are connected to each other. + /// + /// Calls `poll_until_connected` repeatedly with the runtime passed as parameter. + fn block_until_connected(&mut self) { + futures::executor::block_on( + futures::future::poll_fn::<(), _>(|cx| self.poll_until_connected(cx)), + ); + } + /// Polls the testnet. Processes all the pending actions and returns `NotReady`. fn poll(&mut self, cx: &mut FutureContext) { self.mut_peers(|peers| { @@ -831,6 +891,17 @@ pub trait TestNetFactory: Sized { pub struct TestNet { peers: Vec>, + fork_choice: ForkChoiceStrategy, +} + +impl TestNet { + /// Create a `TestNet` that used the given fork choice rule. + pub fn with_fork_choice(fork_choice: ForkChoiceStrategy) -> Self { + Self { + peers: Vec::new(), + fork_choice, + } + } } impl TestNetFactory for TestNet { @@ -841,13 +912,14 @@ impl TestNetFactory for TestNet { fn from_config(_config: &ProtocolConfig) -> Self { TestNet { peers: Vec::new(), + fork_choice: ForkChoiceStrategy::LongestChain, } } fn make_verifier(&self, _client: PeersClient, _config: &ProtocolConfig, _peer_data: &()) -> Self::Verifier { - PassThroughVerifier(false) + PassThroughVerifier::new_with_fork_choice(false, self.fork_choice.clone()) } fn peer(&mut self, i: usize) -> &mut Peer<()> { diff --git a/client/network/test/src/sync.rs b/client/network/test/src/sync.rs index 0269eb3562..1cf2a8fee3 100644 --- a/client/network/test/src/sync.rs +++ b/client/network/test/src/sync.rs @@ -20,6 +20,8 @@ use sp_consensus::BlockOrigin; use std::time::Duration; use futures::executor::block_on; use super::*; +use sp_consensus::block_validation::Validation; +use substrate_test_runtime::Header; fn test_ancestor_search_when_common_is(n: usize) { let _ = ::env_logger::try_init(); @@ -582,10 +584,10 @@ fn can_sync_explicit_forks() { #[test] fn syncs_header_only_forks() { - let _ = ::env_logger::try_init(); + let _ = env_logger::try_init(); let mut net = TestNet::new(0); - net.add_full_peer_with_states(None); - net.add_full_peer_with_states(Some(3)); + net.add_full_peer_with_config(Default::default()); + net.add_full_peer_with_config(FullPeerConfig { keep_blocks: Some(3), ..Default::default() }); net.peer(0).push_blocks(2, false); net.peer(1).push_blocks(2, false); @@ -683,7 +685,7 @@ fn imports_stale_once() { #[test] fn can_sync_to_peers_with_wrong_common_block() { - let _ = ::env_logger::try_init(); + let _ = env_logger::try_init(); let mut net = TestNet::new(2); net.peer(0).push_blocks(2, true); @@ -710,3 +712,41 @@ fn can_sync_to_peers_with_wrong_common_block() { assert!(net.peer(1).client().header(&BlockId::Hash(final_hash)).unwrap().is_some()); } +/// Returns `is_new_best = true` for each validated announcement. +struct NewBestBlockAnnounceValidator; + +impl BlockAnnounceValidator for NewBestBlockAnnounceValidator { + fn validate( + &mut self, + _: &Header, + _: &[u8], + ) -> Result> { + Ok(Validation::Success { is_new_best: true }) + } +} + +#[test] +fn sync_blocks_when_block_announce_validator_says_it_is_new_best() { + let _ = env_logger::try_init(); + log::trace!(target: "sync", "Test"); + let mut net = TestNet::with_fork_choice(ForkChoiceStrategy::Custom(false)); + net.add_full_peer_with_config(Default::default()); + net.add_full_peer_with_config(Default::default()); + net.add_full_peer_with_config(FullPeerConfig { + block_announce_validator: Some(Box::new(NewBestBlockAnnounceValidator)), + ..Default::default() + }); + + net.block_until_connected(); + + let block_hash = net.peer(0).push_blocks(1, false); + + while !net.peer(2).has_block(&block_hash) { + net.block_until_idle(); + } + + // Peer1 should not have the block, because peer 0 did not reported the block + // as new best. However, peer2 has a special block announcement validator + // that flags all blocks as `is_new_best` and thus, it should have synced the blocks. + assert!(!net.peer(1).has_block(&block_hash)); +} diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 8c96f514dd..234356856b 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -1426,7 +1426,7 @@ fn build_network( let block_announce_validator = if let Some(f) = block_announce_validator_builder { f(client.clone()) } else { - Box::new(DefaultBlockAnnounceValidator::new(client.clone())) + Box::new(DefaultBlockAnnounceValidator) }; let network_params = sc_network::config::Params { diff --git a/primitives/consensus/common/src/block_validation.rs b/primitives/consensus/common/src/block_validation.rs index e8054f3ae4..66f960f16f 100644 --- a/primitives/consensus/common/src/block_validation.rs +++ b/primitives/consensus/common/src/block_validation.rs @@ -36,7 +36,10 @@ impl, B: Block> Chain for Arc { #[derive(Debug, PartialEq, Eq)] pub enum Validation { /// Valid block announcement. - Success, + Success { + /// Is this the new best block of the node? + is_new_best: bool, + }, /// Invalid block announcement. Failure, } @@ -49,18 +52,10 @@ pub trait BlockAnnounceValidator { /// Default implementation of `BlockAnnounceValidator`. #[derive(Debug)] -pub struct DefaultBlockAnnounceValidator { - chain: C -} - -impl DefaultBlockAnnounceValidator { - pub fn new(chain: C) -> Self { - Self { chain } - } -} +pub struct DefaultBlockAnnounceValidator; -impl> BlockAnnounceValidator for DefaultBlockAnnounceValidator { +impl BlockAnnounceValidator for DefaultBlockAnnounceValidator { fn validate(&mut self, _h: &B::Header, _d: &[u8]) -> Result> { - Ok(Validation::Success) + Ok(Validation::Success { is_new_best: false }) } } -- GitLab From 996a86caed165cbb405dfaebe52e681763167609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 30 Jun 2020 18:59:36 +0100 Subject: [PATCH 272/280] grandpa: minor cleanups in communication module (#6371) * grandpa: replace Result<(), ()> with Option<()> * grandpa: replace &Option with Option<&T> * grandpa: cleanup local id and keystore usages * grandpa: return bool on check_message_signature * grandpa: fix erroneous log message on startup * grandpa: fix test --- .../src/communication/gossip.rs | 12 ++-- .../finality-grandpa/src/communication/mod.rs | 61 ++++++++++++------- client/finality-grandpa/src/environment.rs | 10 ++- client/finality-grandpa/src/justification.rs | 4 +- client/finality-grandpa/src/lib.rs | 6 +- client/finality-grandpa/src/observer.rs | 2 +- client/finality-grandpa/src/tests.rs | 3 +- frame/grandpa/src/equivocation.rs | 2 +- primitives/finality-grandpa/src/lib.rs | 30 ++++----- 9 files changed, 79 insertions(+), 51 deletions(-) diff --git a/client/finality-grandpa/src/communication/gossip.rs b/client/finality-grandpa/src/communication/gossip.rs index c96301ede8..7d9fe4e7f2 100644 --- a/client/finality-grandpa/src/communication/gossip.rs +++ b/client/finality-grandpa/src/communication/gossip.rs @@ -750,7 +750,11 @@ impl Inner { Round(1), )), Some(ref mut v) => if v.set_id == set_id { - if self.authorities != authorities { + let diff_authorities = + self.authorities.iter().collect::>() != + authorities.iter().collect(); + + if diff_authorities { debug!(target: "afg", "Gossip validator noted set {:?} twice with different authorities. \ Was the authority set hard forked?", @@ -829,7 +833,7 @@ impl Inner { return Action::Discard(cost::UNKNOWN_VOTER); } - if let Err(()) = sp_finality_grandpa::check_message_signature( + if !sp_finality_grandpa::check_message_signature( &full.message.message, &full.message.id, &full.message.signature, @@ -2620,12 +2624,12 @@ mod tests { fn allow_noting_different_authorities_for_same_set() { let (val, _) = GossipValidator::::new(config(), voter_set_state(), None); - let a1 = vec![AuthorityId::default()]; + let a1 = vec![AuthorityId::from_slice(&[0; 32])]; val.note_set(SetId(1), a1.clone(), |_, _| {}); assert_eq!(val.inner().read().authorities, a1); - let a2 = vec![AuthorityId::default(), AuthorityId::default()]; + let a2 = vec![AuthorityId::from_slice(&[1; 32]), AuthorityId::from_slice(&[2; 32])]; val.note_set(SetId(1), a2.clone(), |_, _| {}); assert_eq!(val.inner().read().authorities, a2); diff --git a/client/finality-grandpa/src/communication/mod.rs b/client/finality-grandpa/src/communication/mod.rs index e331d8b089..b7bbad9f8e 100644 --- a/client/finality-grandpa/src/communication/mod.rs +++ b/client/finality-grandpa/src/communication/mod.rs @@ -105,6 +105,34 @@ mod benefit { pub(super) const PER_EQUIVOCATION: i32 = 10; } +/// A type that ties together our local authority id and a keystore where it is +/// available for signing. +pub struct LocalIdKeystore((AuthorityId, BareCryptoStorePtr)); + +impl LocalIdKeystore { + /// Returns a reference to our local authority id. + fn local_id(&self) -> &AuthorityId { + &(self.0).0 + } + + /// Returns a reference to the keystore. + fn keystore(&self) -> &BareCryptoStorePtr { + &(self.0).1 + } +} + +impl AsRef for LocalIdKeystore { + fn as_ref(&self) -> &BareCryptoStorePtr { + self.keystore() + } +} + +impl From<(AuthorityId, BareCryptoStorePtr)> for LocalIdKeystore { + fn from(inner: (AuthorityId, BareCryptoStorePtr)) -> LocalIdKeystore { + LocalIdKeystore(inner) + } +} + /// If the voter set is larger than this value some telemetry events are not /// sent to avoid increasing usage resource on the node and flooding the /// telemetry server (e.g. received votes, received commits.) @@ -272,11 +300,10 @@ impl> NetworkBridge { /// network all within the current set. pub(crate) fn round_communication( &self, - keystore: Option, + keystore: Option, round: Round, set_id: SetId, voters: Arc>, - local_key: Option, has_voted: HasVoted, ) -> ( impl Stream> + Unpin, @@ -288,9 +315,10 @@ impl> NetworkBridge { &*voters, ); - let local_id = local_key.and_then(|id| { - if voters.contains(&id) { - Some(id) + let keystore = keystore.and_then(|ks| { + let id = ks.local_id(); + if voters.contains(id) { + Some(ks) } else { None } @@ -350,11 +378,10 @@ impl> NetworkBridge { let (tx, out_rx) = mpsc::channel(0); let outgoing = OutgoingMessages:: { - keystore: keystore.clone(), + keystore, round: round.0, set_id: set_id.0, network: self.gossip_engine.clone(), - local_id, sender: tx, has_voted, }; @@ -629,11 +656,10 @@ pub struct SetId(pub SetIdNumber); pub(crate) struct OutgoingMessages { round: RoundNumber, set_id: SetIdNumber, - local_id: Option, + keystore: Option, sender: mpsc::Sender>, network: Arc>>, has_voted: HasVoted, - keystore: Option, } impl Unpin for OutgoingMessages {} @@ -667,19 +693,12 @@ impl Sink> for OutgoingMessages } // when locals exist, sign messages on import - if let Some(ref public) = self.local_id { - let keystore = match &self.keystore { - Some(keystore) => keystore.clone(), - None => { - return Err(Error::Signing("Cannot sign without a keystore".to_string())) - } - }; - + if let Some(ref keystore) = self.keystore { let target_hash = *(msg.target().0); let signed = sp_finality_grandpa::sign_message( - keystore, + keystore.as_ref(), msg, - public.clone(), + keystore.local_id().clone(), self.round, self.set_id, ).ok_or( @@ -774,7 +793,7 @@ fn check_compact_commit( use crate::communication::gossip::Misbehavior; use finality_grandpa::Message as GrandpaMessage; - if let Err(()) = sp_finality_grandpa::check_message_signature_with_buffer( + if !sp_finality_grandpa::check_message_signature_with_buffer( &GrandpaMessage::Precommit(precommit.clone()), id, sig, @@ -862,7 +881,7 @@ fn check_catch_up( for (msg, id, sig) in messages { signatures_checked += 1; - if let Err(()) = sp_finality_grandpa::check_message_signature_with_buffer( + if !sp_finality_grandpa::check_message_signature_with_buffer( &msg, id, sig, diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs index 6db854bacc..cc6497fc72 100644 --- a/client/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -716,12 +716,18 @@ where HasVoted::No => HasVoted::No, }; + // we can only sign when we have a local key in the authority set + // and we have a reference to the keystore. + let keystore = match (local_key.as_ref(), self.config.keystore.as_ref()) { + (Some(id), Some(keystore)) => Some((id.clone(), keystore.clone()).into()), + _ => None, + }; + let (incoming, outgoing) = self.network.round_communication( - self.config.keystore.clone(), + keystore, crate::communication::Round(round), crate::communication::SetId(self.set_id), self.voters.clone(), - local_key.clone(), has_voted, ); diff --git a/client/finality-grandpa/src/justification.rs b/client/finality-grandpa/src/justification.rs index b4db81f8a4..0e51a230c5 100644 --- a/client/finality-grandpa/src/justification.rs +++ b/client/finality-grandpa/src/justification.rs @@ -133,14 +133,14 @@ impl GrandpaJustification { let mut buf = Vec::new(); let mut visited_hashes = HashSet::new(); for signed in self.commit.precommits.iter() { - if sp_finality_grandpa::check_message_signature_with_buffer( + if !sp_finality_grandpa::check_message_signature_with_buffer( &finality_grandpa::Message::Precommit(signed.precommit.clone()), &signed.id, &signed.signature, self.round, set_id, &mut buf, - ).is_err() { + ) { return Err(ClientError::BadJustification( "invalid signature for precommit in grandpa justification".to_string())); } diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index 481544b5c6..fa2a6fedd8 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -593,7 +593,7 @@ fn global_communication( voters: &Arc>, client: Arc, network: &NetworkBridge, - keystore: &Option, + keystore: Option<&BareCryptoStorePtr>, metrics: Option, ) -> ( impl Stream< @@ -609,7 +609,7 @@ fn global_communication( N: NetworkT, NumberFor: BlockNumberOps, { - let is_voter = is_voter(voters, keystore.as_ref()).is_some(); + let is_voter = is_voter(voters, keystore).is_some(); // verification stream let (global_in, global_out) = network.global_communication( @@ -907,7 +907,7 @@ where &self.env.voters, self.env.client.clone(), &self.env.network, - &self.env.config.keystore, + self.env.config.keystore.as_ref(), self.metrics.as_ref().map(|m| m.until_imported.clone()), ); diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index f7179d70e7..6a7a1f07b0 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -260,7 +260,7 @@ where &voters, self.client.clone(), &self.network, - &self.keystore, + self.keystore.as_ref(), None, ); diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index b94c37d07e..50f9e8eba2 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -1160,11 +1160,10 @@ fn voter_persists_its_votes() { ); let (round_rx, round_tx) = network.round_communication( - Some(keystore), + Some((peers[1].public().into(), keystore).into()), communication::Round(1), communication::SetId(0), Arc::new(VoterSet::new(voters).unwrap()), - Some(peers[1].public().into()), HasVoted::No, ); diff --git a/frame/grandpa/src/equivocation.rs b/frame/grandpa/src/equivocation.rs index 7c6e5c6d66..1cc1620125 100644 --- a/frame/grandpa/src/equivocation.rs +++ b/frame/grandpa/src/equivocation.rs @@ -145,7 +145,7 @@ where // validate equivocation proof (check votes are different and // signatures are valid). - if let Err(_) = sp_finality_grandpa::check_equivocation_proof(equivocation_proof.clone()) { + if !sp_finality_grandpa::check_equivocation_proof(equivocation_proof.clone()) { return Err(ReportEquivocationValidityError::InvalidEquivocationProof.into()); } diff --git a/primitives/finality-grandpa/src/lib.rs b/primitives/finality-grandpa/src/lib.rs index 889468a352..f99880041c 100644 --- a/primitives/finality-grandpa/src/lib.rs +++ b/primitives/finality-grandpa/src/lib.rs @@ -257,7 +257,7 @@ impl Equivocation { /// Verifies the equivocation proof by making sure that both votes target /// different blocks and that its signatures are valid. -pub fn check_equivocation_proof(report: EquivocationProof) -> Result<(), ()> +pub fn check_equivocation_proof(report: EquivocationProof) -> bool where H: Clone + Encode + PartialEq, N: Clone + Encode + PartialEq, @@ -270,27 +270,27 @@ where if $equivocation.first.0.target_hash == $equivocation.second.0.target_hash && $equivocation.first.0.target_number == $equivocation.second.0.target_number { - return Err(()); + return false; } // check signatures on both votes are valid - check_message_signature( + let valid_first = check_message_signature( &$message($equivocation.first.0), &$equivocation.identity, &$equivocation.first.1, $equivocation.round_number, report.set_id, - )?; + ); - check_message_signature( + let valid_second = check_message_signature( &$message($equivocation.second.0), &$equivocation.identity, &$equivocation.second.1, $equivocation.round_number, report.set_id, - )?; + ); - return Ok(()); + return valid_first && valid_second; }; } @@ -332,7 +332,7 @@ pub fn check_message_signature( signature: &AuthoritySignature, round: RoundNumber, set_id: SetId, -) -> Result<(), ()> +) -> bool where H: Encode, N: Encode, @@ -351,7 +351,7 @@ pub fn check_message_signature_with_buffer( round: RoundNumber, set_id: SetId, buf: &mut Vec, -) -> Result<(), ()> +) -> bool where H: Encode, N: Encode, @@ -360,20 +360,20 @@ where localized_payload_with_buffer(round, set_id, message, buf); - if id.verify(&buf, signature) { - Ok(()) - } else { + let valid = id.verify(&buf, signature); + + if !valid { #[cfg(feature = "std")] debug!(target: "afg", "Bad signature on message from {:?}", id); - - Err(()) } + + valid } /// Localizes the message to the given set and round and signs the payload. #[cfg(feature = "std")] pub fn sign_message( - keystore: BareCryptoStorePtr, + keystore: &BareCryptoStorePtr, message: grandpa::Message, public: AuthorityId, round: RoundNumber, -- GitLab From fccb92391ea75c8d8310b293fbd9e099191166ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 1 Jul 2020 08:49:51 +0200 Subject: [PATCH 273/280] Update to make cargo-deny happy (#6547) * Update to make cargo-deny happy * Remove cargo deny from CI * change (ci): run cargo deny only on tags and schedules Co-authored-by: Denis P --- .gitlab-ci.yml | 4 ++++ Cargo.lock | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 594c9d1dde..69a9d94c08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,6 +158,10 @@ cargo-audit: cargo-deny: stage: test <<: *docker-env + only: + - schedules + - tags + - web script: - cargo deny check --hide-inclusion-graph -c .maintain/deny.toml after_script: diff --git a/Cargo.lock b/Cargo.lock index 94f3f5effe..2563350f6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8901,9 +8901,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" +checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" dependencies = [ "futures-core", "rustls", -- GitLab From e6c3388b770b3840b4509b3bdc6ccd3727309171 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 1 Jul 2020 09:00:12 +0200 Subject: [PATCH 274/280] pallet-evm: customizable chain id (#6537) --- frame/evm/src/backend.rs | 3 ++- frame/evm/src/lib.rs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frame/evm/src/backend.rs b/frame/evm/src/backend.rs index c610f24bb1..09f31d8aeb 100644 --- a/frame/evm/src/backend.rs +++ b/frame/evm/src/backend.rs @@ -5,6 +5,7 @@ use serde::{Serialize, Deserialize}; use codec::{Encode, Decode}; use sp_core::{U256, H256, H160}; use sp_runtime::traits::UniqueSaturatedInto; +use frame_support::traits::Get; use frame_support::storage::{StorageMap, StorageDoubleMap}; use sha3::{Keccak256, Digest}; use evm::backend::{Backend as BackendT, ApplyBackend, Apply}; @@ -91,7 +92,7 @@ impl<'vicinity, T: Trait> BackendT for Backend<'vicinity, T> { } fn chain_id(&self) -> U256 { - U256::from(sp_io::misc::chain_id()) + U256::from(T::ChainId::get()) } fn exists(&self, _address: H160) -> bool { diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index 72392629d6..eebdc66b38 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -118,6 +118,15 @@ impl Precompiles for () { } } +/// Substrate system chain ID. +pub struct SystemChainId; + +impl Get for SystemChainId { + fn get() -> u64 { + sp_io::misc::chain_id() + } +} + static ISTANBUL_CONFIG: Config = Config::istanbul(); /// EVM module trait @@ -134,6 +143,8 @@ pub trait Trait: frame_system::Trait + pallet_timestamp::Trait { type Event: From> + Into<::Event>; /// Precompiles associated with this EVM engine. type Precompiles: Precompiles; + /// Chain ID of EVM. + type ChainId: Get; /// EVM config used in the module. fn config() -> &'static Config { @@ -159,7 +170,7 @@ decl_storage! { trait Store for Module as EVM { Accounts get(fn accounts): map hasher(blake2_128_concat) H160 => Account; AccountCodes get(fn account_codes): map hasher(blake2_128_concat) H160 => Vec; - AccountStorages get(fn account_storages): + AccountStorages get(fn account_storages): double_map hasher(blake2_128_concat) H160, hasher(blake2_128_concat) H256 => H256; } -- GitLab From 23055a9ef77f6c577090ff57eebf510fe7a2d938 Mon Sep 17 00:00:00 2001 From: Denis Pisarev Date: Wed, 1 Jul 2020 09:36:12 +0200 Subject: [PATCH 275/280] Fix runtime benchmarks CI (#6545) * debug (ci): ci config [skip ci] * debug (ci): fix runtime benchmarks * fix identity benchmarks * fix utility benchmarks * Revert "debug (ci): ci config [skip ci]" This reverts commit 081b175b5e95604520c79ea4e5822b84ea35ddaa. * change (ci): touch ci config to run CI Co-authored-by: Shawn Tabrizi Co-authored-by: Gav Wood --- .gitlab-ci.yml | 4 ++-- frame/identity/src/lib.rs | 16 +++++++++++++--- frame/utility/src/benchmarking.rs | 13 ++++++++++++- frame/utility/src/tests.rs | 6 ++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69a9d94c08..d3a7f36980 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -263,7 +263,7 @@ test-wasmtime: variables: <<: *default-vars # Enable debug assertions since we are running optimized builds for testing - # but still want to have debug assertions. + # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y RUST_BACKTRACE: 1 except: @@ -289,7 +289,7 @@ test-runtime-benchmarks: - $DEPLOY_TAG script: - cd bin/node/cli - - WASM_BUILD_NO_COLOR=1 time cargo test --release --verbose --features runtime-benchmarks + - WASM_BUILD_NO_COLOR=1 time cargo test --workspace --release --verbose --features runtime-benchmarks - sccache -s test-linux-stable-int: diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index 2768340403..19b23a644d 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -1151,7 +1151,7 @@ mod tests { ord_parameter_types, }; use sp_core::H256; - use frame_system::EnsureSignedBy; + use frame_system::{EnsureSignedBy, EnsureOneOf, EnsureRoot}; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. use sp_runtime::{ @@ -1221,6 +1221,16 @@ mod tests { pub const One: u64 = 1; pub const Two: u64 = 2; } + type EnsureOneOrRoot = EnsureOneOf< + u64, + EnsureRoot, + EnsureSignedBy + >; + type EnsureTwoOrRoot = EnsureOneOf< + u64, + EnsureRoot, + EnsureSignedBy + >; impl Trait for Test { type Event = (); type Currency = Balances; @@ -1231,8 +1241,8 @@ mod tests { type MaxSubAccounts = MaxSubAccounts; type MaxAdditionalFields = MaxAdditionalFields; type MaxRegistrars = MaxRegistrars; - type RegistrarOrigin = EnsureSignedBy; - type ForceOrigin = EnsureSignedBy; + type RegistrarOrigin = EnsureOneOrRoot; + type ForceOrigin = EnsureTwoOrRoot; } type System = frame_system::Module; type Balances = pallet_balances::Module; diff --git a/frame/utility/src/benchmarking.rs b/frame/utility/src/benchmarking.rs index 8d98178957..155a279807 100644 --- a/frame/utility/src/benchmarking.rs +++ b/frame/utility/src/benchmarking.rs @@ -20,11 +20,19 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; -use frame_system::RawOrigin; +use frame_system::{RawOrigin, EventRecord}; use frame_benchmarking::{benchmarks, account}; const SEED: u32 = 0; +fn assert_last_event(generic_event: ::Event) { + let events = frame_system::Module::::events(); + let system_event: ::Event = generic_event.into(); + // compare to the last event record + let EventRecord { event, .. } = &events[events.len() - 1]; + assert_eq!(event, &system_event); +} + benchmarks! { _ { } @@ -37,6 +45,9 @@ benchmarks! { } let caller = account("caller", 0, SEED); }: _(RawOrigin::Signed(caller), calls) + verify { + assert_last_event::(Event::BatchCompleted.into()) + } as_derivative { let u in 0 .. 1000; diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index c0a6499250..349d748a37 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -104,6 +104,8 @@ impl Filter for TestBaseCallFilter { fn filter(c: &Call) -> bool { match *c { Call::Balances(_) => true, + // For benchmarking, this acts as a noop call + Call::System(frame_system::Call::remark(..)) => true, _ => false, } } @@ -163,7 +165,7 @@ fn as_derivative_filters() { assert_noop!(Utility::as_derivative( Origin::signed(1), 1, - Box::new(Call::System(frame_system::Call::remark(vec![]))), + Box::new(Call::System(frame_system::Call::suicide())), ), DispatchError::BadOrigin); }); } @@ -208,7 +210,7 @@ fn batch_with_signed_filters() { new_test_ext().execute_with(|| { assert_ok!( Utility::batch(Origin::signed(1), vec![ - Call::System(frame_system::Call::remark(vec![])) + Call::System(frame_system::Call::suicide()) ]), ); expect_event(Event::BatchInterrupted(0, DispatchError::BadOrigin)); -- GitLab From d855a5e90e9938593edff12c588e37fb201e6a08 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 1 Jul 2020 10:22:47 +0200 Subject: [PATCH 276/280] Fix mocking multiple http calls in the same function call (#6510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix mocking multiple http calls in the same function call Fixes an issue where a function call would perform more than one http request and wait for each to complete before proceeding. The `RequestId` comes from the length of the `requests` collection in the `OffchainState` and if a request is completed before the next one starts it will be removed and the "next expected" will be off by one. This PR tries to fix that by using a request counter that tracks how many requests have been performed so that we can `remove()` items from the `expected_requests` at the right index. I suspect that this is a sub-optimal soluton and perhaps requests and their mocks should live side by side in the same collection, e.g. in a tuple of `(PendingRequest, Option)`. * Update primitives/core/src/offchain/testing.rs Co-authored-by: Bernhard Schuster * Update primitives/core/src/offchain/testing.rs Co-authored-by: Bernhard Schuster * Panic on overflow * Update primitives/core/src/offchain/testing.rs Co-authored-by: Bastian Köcher * Use a Deque and push/pop expected requests * fix test Co-authored-by: Bernhard Schuster Co-authored-by: Bastian Köcher --- client/executor/src/integration_tests/mod.rs | 4 +- frame/example-offchain-worker/src/tests.rs | 48 +++++++++++++++++++- primitives/core/src/offchain/testing.rs | 14 +++--- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index f07e98178b..21924270b8 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -497,9 +497,7 @@ fn offchain_http_should_work(wasm_method: WasmExecutionMethod) { let mut ext = TestExternalities::default(); let (offchain, state) = testing::TestOffchainExt::new(); ext.register_extension(OffchainExt::new(offchain)); - state.write().expect_request( - 0, - testing::PendingRequest { + state.write().expect_request(testing::PendingRequest { method: "POST".into(), uri: "http://localhost:12345".into(), body: vec![1, 2, 3, 4], diff --git a/frame/example-offchain-worker/src/tests.rs b/frame/example-offchain-worker/src/tests.rs index ef910b95ff..b300809f41 100644 --- a/frame/example-offchain-worker/src/tests.rs +++ b/frame/example-offchain-worker/src/tests.rs @@ -154,6 +154,52 @@ fn should_make_http_call_and_parse_result() { }); } +#[test] +fn knows_how_to_mock_several_http_calls() { + let (offchain, state) = testing::TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainExt::new(offchain)); + + { + let mut state = state.write(); + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD".into(), + response: Some(br#"{"USD": 1}"#.to_vec()), + sent: true, + ..Default::default() + }); + + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD".into(), + response: Some(br#"{"USD": 2}"#.to_vec()), + sent: true, + ..Default::default() + }); + + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD".into(), + response: Some(br#"{"USD": 3}"#.to_vec()), + sent: true, + ..Default::default() + }); + } + + + t.execute_with(|| { + let price1 = Example::fetch_price().unwrap(); + let price2 = Example::fetch_price().unwrap(); + let price3 = Example::fetch_price().unwrap(); + + assert_eq!(price1, 100); + assert_eq!(price2, 200); + assert_eq!(price3, 300); + }) + +} + #[test] fn should_submit_signed_transaction_on_chain() { const PHRASE: &str = "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; @@ -319,7 +365,7 @@ fn should_submit_raw_unsigned_transaction_on_chain() { } fn price_oracle_response(state: &mut testing::OffchainState) { - state.expect_request(0, testing::PendingRequest { + state.expect_request(testing::PendingRequest { method: "GET".into(), uri: "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD".into(), response: Some(br#"{"USD": 155.23}"#.to_vec()), diff --git a/primitives/core/src/offchain/testing.rs b/primitives/core/src/offchain/testing.rs index a14e906f54..9145477722 100644 --- a/primitives/core/src/offchain/testing.rs +++ b/primitives/core/src/offchain/testing.rs @@ -21,7 +21,7 @@ //! the extra APIs. use std::{ - collections::BTreeMap, + collections::{BTreeMap, VecDeque}, sync::Arc, }; use crate::offchain::{ @@ -120,7 +120,8 @@ impl OffchainStorage for TestPersistentOffchainDB { pub struct OffchainState { /// A list of pending requests. pub requests: BTreeMap, - expected_requests: BTreeMap, + // Queue of requests that the test is expected to perform (in order). + expected_requests: VecDeque, /// Persistent local storage pub persistent_storage: TestPersistentOffchainDB, /// Local storage @@ -156,8 +157,8 @@ impl OffchainState { } fn fulfill_expected(&mut self, id: u16) { - if let Some(mut req) = self.expected_requests.remove(&RequestId(id)) { - let response = req.response.take().expect("Response checked while added."); + if let Some(mut req) = self.expected_requests.pop_back() { + let response = req.response.take().expect("Response checked when added."); let headers = std::mem::take(&mut req.response_headers); self.fulfill_pending_request(id, req, response, headers); } @@ -169,11 +170,12 @@ impl OffchainState { /// before running the actual code that utilizes them (for instance before calling into runtime). /// Expected request has to be fulfilled before this struct is dropped, /// the `response` and `response_headers` fields will be used to return results to the callers. - pub fn expect_request(&mut self, id: u16, expected: PendingRequest) { + /// Requests are expected to be performed in the insertion order. + pub fn expect_request(&mut self, expected: PendingRequest) { if expected.response.is_none() { panic!("Expected request needs to have a response."); } - self.expected_requests.insert(RequestId(id), expected); + self.expected_requests.push_front(expected); } } -- GitLab From d5d630447aa5463944e314b54f44c00333d666e1 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 1 Jul 2020 10:31:56 +0200 Subject: [PATCH 277/280] .maintain/monitoring/alerting-rules: Adjust transaction queue size alert (#6426) The transaction queue size alert has been firing with a constant 10 transactions in the queue. While maybe problematic those 10 transactions don't need to be the same across scrape intervals. Instead of alerting with a size above 10, alert based on two things: 1. Monotonically increasing queue size 2. Upper limit queue size reached --- .../alerting-rules/alerting-rule-tests.yaml | 59 +++++++++++++------ .../alerting-rules/alerting-rules.yaml | 29 +++++---- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml b/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml index 069cfaf977..288750be3c 100644 --- a/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml +++ b/.maintain/monitoring/alerting-rules/alerting-rule-tests.yaml @@ -18,14 +18,14 @@ tests: pod="polkadot-abcdef01234-abcdef", instance="polkadot-abcdef01234-abcdef", }' - values: '10+1x30' # 10 11 12 13 .. 40 + values: '11+1x10 22+2x30 10043x5' - series: 'polkadot_sub_txpool_validations_finished{ job="polkadot", pod="polkadot-abcdef01234-abcdef", instance="polkadot-abcdef01234-abcdef", }' - values: '0x30' # 0 0 0 0 .. 0 + values: '0+1x42 42x5' - series: 'polkadot_block_height{ status="best", job="polkadot", @@ -161,11 +161,17 @@ tests: # Transaction queue ###################################################################### - - eval_time: 10m - alertname: TransactionQueueSize - exp_alerts: - eval_time: 11m - alertname: TransactionQueueSize + alertname: TransactionQueueSizeIncreasing + # Number of validations scheduled and finished both grow at a rate + # of 1 in the first 10 minutes, thereby the queue is not increasing + # in size, thus don't expect an alert. + exp_alerts: + - eval_time: 22m + alertname: TransactionQueueSizeIncreasing + # Number of validations scheduled is growing twice as fast as the + # number of validations finished after minute 10. Thus expect + # warning alert after 20 minutes. exp_alerts: - exp_labels: severity: warning @@ -173,12 +179,14 @@ tests: instance: polkadot-abcdef01234-abcdef job: polkadot exp_annotations: - message: "The node polkadot-abcdef01234-abcdef has more - than 10 transactions in the queue for more than 10 - minutes" - - - eval_time: 31m - alertname: TransactionQueueSize + message: "The transaction pool size on node + polkadot-abcdef01234-abcdef has been monotonically + increasing for the last 10 minutes." + - eval_time: 43m + alertname: TransactionQueueSizeIncreasing + # Number of validations scheduled is growing twice as fast as the + # number of validations finished after minute 10. Thus expect + # both warning and critical alert after 40 minutes. exp_alerts: - exp_labels: severity: warning @@ -186,18 +194,33 @@ tests: instance: polkadot-abcdef01234-abcdef job: polkadot exp_annotations: - message: "The node polkadot-abcdef01234-abcdef has more - than 10 transactions in the queue for more than 10 - minutes" + message: "The transaction pool size on node + polkadot-abcdef01234-abcdef has been monotonically + increasing for the last 10 minutes." + - exp_labels: + severity: critical + pod: polkadot-abcdef01234-abcdef + instance: polkadot-abcdef01234-abcdef + job: polkadot + exp_annotations: + message: "The transaction pool size on node + polkadot-abcdef01234-abcdef has been monotonically + increasing for the last 30 minutes." + - eval_time: 49m + alertname: TransactionQueueSizeHigh + # After minute 43 the number of validations scheduled jumps up + # drastically while the number of validations finished stays the + # same. Thus expect an alert. + exp_alerts: - exp_labels: severity: critical pod: polkadot-abcdef01234-abcdef instance: polkadot-abcdef01234-abcdef job: polkadot exp_annotations: - message: "The node polkadot-abcdef01234-abcdef has more - than 10 transactions in the queue for more than 30 - minutes" + message: "The transaction pool size on node + polkadot-abcdef01234-abcdef has been above 10_000 for the + last 5 minutes." ###################################################################### # Networking diff --git a/.maintain/monitoring/alerting-rules/alerting-rules.yaml b/.maintain/monitoring/alerting-rules/alerting-rules.yaml index 06d204f7af..2ed3889a2c 100644 --- a/.maintain/monitoring/alerting-rules/alerting-rules.yaml +++ b/.maintain/monitoring/alerting-rules/alerting-rules.yaml @@ -73,24 +73,33 @@ groups: # Transaction queue ############################################################################## - - alert: TransactionQueueSize - expr: 'polkadot_sub_txpool_validations_scheduled - - polkadot_sub_txpool_validations_finished > 10' + - alert: TransactionQueueSizeIncreasing + expr: 'increase(polkadot_sub_txpool_validations_scheduled[5m]) - + increase(polkadot_sub_txpool_validations_finished[5m]) > 0' for: 10m labels: severity: warning annotations: - message: 'The node {{ $labels.instance }} has more than 10 transactions in - the queue for more than 10 minutes' - - alert: TransactionQueueSize - expr: 'polkadot_sub_txpool_validations_scheduled - - polkadot_sub_txpool_validations_finished > 10' + message: 'The transaction pool size on node {{ $labels.instance }} has + been monotonically increasing for the last 10 minutes.' + - alert: TransactionQueueSizeIncreasing + expr: 'increase(polkadot_sub_txpool_validations_scheduled[5m]) - + increase(polkadot_sub_txpool_validations_finished[5m]) > 0' for: 30m labels: severity: critical annotations: - message: 'The node {{ $labels.instance }} has more than 10 transactions in - the queue for more than 30 minutes' + message: 'The transaction pool size on node {{ $labels.instance }} has + been monotonically increasing for the last 30 minutes.' + - alert: TransactionQueueSizeHigh + expr: 'polkadot_sub_txpool_validations_scheduled - + polkadot_sub_txpool_validations_finished > 10000' + for: 5m + labels: + severity: critical + annotations: + message: 'The transaction pool size on node {{ $labels.instance }} has + been above 10_000 for the last 5 minutes.' ############################################################################## # Networking -- GitLab From 176bda52a49c1a5d07963327a9fef960ca6a34a3 Mon Sep 17 00:00:00 2001 From: s3krit Date: Wed, 1 Jul 2020 11:33:10 +0200 Subject: [PATCH 278/280] Fix auto-label-issues.yml (#6536) statements in github actions cannot use ", must use ' Co-authored-by: Gav Wood --- .github/workflows/auto-label-issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml index ce0bad59d1..cd889b5941 100644 --- a/.github/workflows/auto-label-issues.yml +++ b/.github/workflows/auto-label-issues.yml @@ -8,10 +8,10 @@ on: jobs: label-new-issues: - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - name: Label drafts uses: andymckay/labeler@master - if: github.event.issue.author_association == "NONE" + if: github.event.issue.author_association == 'NONE' with: add-labels: 'Z0-unconfirmed' -- GitLab From 4919c808cb75618d95762944aa6f5664c1aa3b59 Mon Sep 17 00:00:00 2001 From: s3krit Date: Wed, 1 Jul 2020 11:33:28 +0200 Subject: [PATCH 279/280] [CI] Add Github Action to notify devops of PRs labelled with A1-needsburnin (#6525) * add burnin-label-notification.yml * fix burnin-label-notification.yml * fix burnin-label-notification.yml * fix burnin-label-notification.yml * fix burnin-label-notification.yml * Update .github/workflows/burnin-label-notification.yml Co-authored-by: Benjamin Kampmann Co-authored-by: Benjamin Kampmann Co-authored-by: Gav Wood --- .github/workflows/burnin-label-notification.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/burnin-label-notification.yml diff --git a/.github/workflows/burnin-label-notification.yml b/.github/workflows/burnin-label-notification.yml new file mode 100644 index 0000000000..da422a659e --- /dev/null +++ b/.github/workflows/burnin-label-notification.yml @@ -0,0 +1,17 @@ +name: Notify devops when burn-in label applied +on: + pull_request: + types: [labeled] + +jobs: + notify-devops: + runs-on: ubuntu-latest + steps: + - name: Notify devops + if: github.event.label.name == 'A1-needsburnin' + uses: s3krit/matrix-message-action@v0.0.2 + with: + room_id: ${{ secrets.POLKADOT_DEVOPS_MATRIX_ROOM_ID }} + access_token: ${{ secrets.POLKADOT_DEVOPS_MATRIX_ACCESS_TOKEN }} + message: "@room Burn-in request received for [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})" + server: "matrix.parity.io" -- GitLab From 8ef1ac0ee13d2a72cc1c391d4624dfaaafe641e8 Mon Sep 17 00:00:00 2001 From: cheme Date: Wed, 1 Jul 2020 11:59:07 +0200 Subject: [PATCH 280/280] Restrict `Protected` to some heap types. (#6471) * Restrict `Protected` to some heap types. * Comment abut Protected usage. * Remove Protected from crypto, use secrecy crate for existing uses. * use a parse function * fix error convert * Rename and move secretY string function. * std result --- Cargo.lock | 10 +++++ client/cli/src/params/keystore_params.rs | 33 ++++++++++----- client/keystore/src/lib.rs | 27 ++++++++---- client/service/src/config.rs | 4 +- primitives/core/Cargo.toml | 2 + primitives/core/src/crypto.rs | 53 ++++-------------------- 6 files changed, 62 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2563350f6e..afdfb5e81c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7089,6 +7089,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "secrecy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +dependencies = [ + "zeroize", +] + [[package]] name = "security-framework" version = "0.4.2" @@ -7616,6 +7625,7 @@ dependencies = [ "rand_chacha 0.2.2", "regex", "schnorrkel", + "secrecy", "serde", "serde_json", "sha2", diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs index 840cc51dff..8b20dd247a 100644 --- a/client/cli/src/params/keystore_params.rs +++ b/client/cli/src/params/keystore_params.rs @@ -21,6 +21,7 @@ use sc_service::config::KeystoreConfig; use std::fs; use std::path::PathBuf; use structopt::StructOpt; +use sp_core::crypto::SecretString; /// default sub directory for the key store const DEFAULT_KEYSTORE_CONFIG_PATH: &'static str = "keystore"; @@ -42,9 +43,10 @@ pub struct KeystoreParams { /// Password used by the keystore. #[structopt( long = "password", + parse(try_from_str = secret_string_from_str), conflicts_with_all = &[ "password-interactive", "password-filename" ] )] - pub password: Option, + pub password: Option, /// File that contains the password used by the keystore. #[structopt( @@ -56,26 +58,37 @@ pub struct KeystoreParams { pub password_filename: Option, } +/// Parse a sercret string, returning a displayable error. +pub fn secret_string_from_str(s: &str) -> std::result::Result { + Ok(std::str::FromStr::from_str(s) + .map_err(|_e| "Could not get SecretString".to_string())?) +} + impl KeystoreParams { /// Get the keystore configuration for the parameters pub fn keystore_config(&self, base_path: &PathBuf) -> Result { let password = if self.password_interactive { #[cfg(not(target_os = "unknown"))] { - Some(input_keystore_password()?.into()) + let mut password = input_keystore_password()?; + let secret = std::str::FromStr::from_str(password.as_str()) + .map_err(|()| "Error reading password")?; + use sp_core::crypto::Zeroize; + password.zeroize(); + Some(secret) } #[cfg(target_os = "unknown")] None } else if let Some(ref file) = self.password_filename { - Some( - fs::read_to_string(file) - .map_err(|e| format!("{}", e))? - .into(), - ) - } else if let Some(ref password) = self.password { - Some(password.clone().into()) + let mut password = fs::read_to_string(file) + .map_err(|e| format!("{}", e))?; + let secret = std::str::FromStr::from_str(password.as_str()) + .map_err(|()| "Error reading password")?; + use sp_core::crypto::Zeroize; + password.zeroize(); + Some(secret) } else { - None + self.password.clone() }; let path = self diff --git a/client/keystore/src/lib.rs b/client/keystore/src/lib.rs index aed60ab0cf..7fec32bae2 100644 --- a/client/keystore/src/lib.rs +++ b/client/keystore/src/lib.rs @@ -19,7 +19,7 @@ #![warn(missing_docs)] use std::{collections::{HashMap, HashSet}, path::PathBuf, fs::{self, File}, io::{self, Write}, sync::Arc}; use sp_core::{ - crypto::{IsWrappedBy, CryptoTypePublicPair, KeyTypeId, Pair as PairT, Protected, Public}, + crypto::{IsWrappedBy, CryptoTypePublicPair, KeyTypeId, Pair as PairT, ExposeSecret, SecretString, Public}, traits::{BareCryptoStore, Error as TraitError}, sr25519::{Public as Sr25519Public, Pair as Sr25519Pair}, vrf::{VRFTranscriptData, VRFSignature, make_transcript}, @@ -95,14 +95,14 @@ pub struct Store { path: Option, /// Map over `(KeyTypeId, Raw public key)` -> `Key phrase/seed` additional: HashMap<(KeyTypeId, Vec), String>, - password: Option>, + password: Option, } impl Store { /// Open the store at the given path. /// /// Optionally takes a password that will be used to encrypt/decrypt the keys. - pub fn open>(path: T, password: Option>) -> Result { + pub fn open>(path: T, password: Option) -> Result { let path = path.into(); fs::create_dir_all(&path)?; @@ -155,7 +155,7 @@ impl Store { pub fn insert_by_type(&self, key_type: KeyTypeId, suri: &str) -> Result { let pair = Pair::from_string( suri, - self.password.as_ref().map(|p| &***p) + self.password() ).map_err(|_| Error::InvalidSeed)?; self.insert_unknown(key_type, suri, pair.public().as_slice()) .map_err(|_| Error::Unavailable)?; @@ -173,7 +173,7 @@ impl Store { /// /// Places it into the file system store. pub fn generate_by_type(&self, key_type: KeyTypeId) -> Result { - let (pair, phrase, _) = Pair::generate_with_phrase(self.password.as_ref().map(|p| &***p)); + let (pair, phrase, _) = Pair::generate_with_phrase(self.password()); if let Some(path) = self.key_file_path(pair.public().as_slice(), key_type) { let mut file = File::create(path)?; serde_json::to_writer(&file, &phrase)?; @@ -229,7 +229,7 @@ impl Store { let phrase = self.key_phrase_by_type(public.as_slice(), key_type)?; let pair = Pair::from_string( &phrase, - self.password.as_ref().map(|p| &***p), + self.password(), ).map_err(|_| Error::InvalidPhrase)?; if &pair.public() == public { @@ -434,7 +434,9 @@ impl BareCryptoStore for Store { } fn password(&self) -> Option<&str> { - self.password.as_ref().map(|x| x.as_str()) + self.password.as_ref() + .map(|p| p.expose_secret()) + .map(|p| p.as_str()) } fn has_keys(&self, public_keys: &[(Vec, KeyTypeId)]) -> bool { @@ -464,6 +466,7 @@ mod tests { use super::*; use tempfile::TempDir; use sp_core::{testing::SR25519, crypto::Ss58Codec}; + use std::str::FromStr; #[test] fn basic_store() { @@ -504,7 +507,10 @@ mod tests { fn password_being_used() { let password = String::from("password"); let temp_dir = TempDir::new().unwrap(); - let store = Store::open(temp_dir.path(), Some(password.clone().into())).unwrap(); + let store = Store::open( + temp_dir.path(), + Some(FromStr::from_str(password.as_str()).unwrap()), + ).unwrap(); let pair: ed25519::AppPair = store.write().generate().unwrap(); assert_eq!( @@ -516,7 +522,10 @@ mod tests { let store = Store::open(temp_dir.path(), None).unwrap(); assert!(store.read().key_pair::(&pair.public()).is_err()); - let store = Store::open(temp_dir.path(), Some(password.into())).unwrap(); + let store = Store::open( + temp_dir.path(), + Some(FromStr::from_str(password.as_str()).unwrap()), + ).unwrap(); assert_eq!( pair.public(), store.read().key_pair::(&pair.public()).unwrap().public(), diff --git a/client/service/src/config.rs b/client/service/src/config.rs index fb4dbc666a..5015ce7fac 100644 --- a/client/service/src/config.rs +++ b/client/service/src/config.rs @@ -27,7 +27,7 @@ use sc_client_api::execution_extensions::ExecutionStrategies; use std::{io, future::Future, path::{PathBuf, Path}, pin::Pin, net::SocketAddr, sync::Arc}; pub use sc_transaction_pool::txpool::Options as TransactionPoolOptions; use sc_chain_spec::ChainSpec; -use sp_core::crypto::Protected; +use sp_core::crypto::SecretString; pub use sc_telemetry::TelemetryEndpoints; use prometheus_endpoint::Registry; #[cfg(not(target_os = "unknown"))] @@ -130,7 +130,7 @@ pub enum KeystoreConfig { /// The path of the keystore. path: PathBuf, /// Node keystore's password. - password: Option> + password: Option }, /// In-memory keystore. Recommended for in-browser nodes. InMemory, diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 33b4a7bc82..6a7568a626 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -31,6 +31,7 @@ tiny-bip39 = { version = "0.7", optional = true } regex = { version = "1.3.1", optional = true } num-traits = { version = "0.2.8", default-features = false } zeroize = { version = "1.0.0", default-features = false } +secrecy = { version = "0.6.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false, optional = true } parking_lot = { version = "0.10.0", optional = true } sp-debug-derive = { version = "2.0.0-rc4", path = "../debug-derive" } @@ -106,6 +107,7 @@ std = [ "sp-storage/std", "sp-runtime-interface/std", "zeroize/alloc", + "secrecy/alloc", "futures", "futures/thread-pool", "libsecp256k1/std", diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index aa77345993..745f5776fe 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -37,10 +37,16 @@ use regex::Regex; use base58::{FromBase58, ToBase58}; #[cfg(feature = "std")] use crate::hexdisplay::HexDisplay; -use zeroize::Zeroize; #[doc(hidden)] pub use sp_std::ops::Deref; use sp_runtime_interface::pass_by::PassByInner; +/// Trait to zeroize a memory buffer. +pub use zeroize::Zeroize; +/// Trait for accessing reference to `SecretString`. +pub use secrecy::ExposeSecret; +/// A store for sensitive data. +#[cfg(feature = "std")] +pub use secrecy::SecretString; /// The root phrase for our publicly known keys. pub const DEV_PHRASE: &str = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -79,51 +85,6 @@ impl> UncheckedInto for S { } } -/// A store for sensitive data. -/// -/// Calls `Zeroize::zeroize` upon `Drop`. -#[derive(Clone)] -pub struct Protected(T); - -impl AsRef for Protected { - fn as_ref(&self) -> &T { - &self.0 - } -} - -impl sp_std::ops::Deref for Protected { - type Target = T; - - fn deref(&self) -> &T { - &self.0 - } -} - -#[cfg(feature = "std")] -impl std::fmt::Debug for Protected { - fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(fmt, "") - } -} - -impl From for Protected { - fn from(t: T) -> Self { - Protected(t) - } -} - -impl Zeroize for Protected { - fn zeroize(&mut self) { - self.0.zeroize() - } -} - -impl Drop for Protected { - fn drop(&mut self) { - self.zeroize() - } -} - /// An error with the interpretation of a secret. #[derive(Debug, Clone, PartialEq, Eq)] #[cfg(feature = "full_crypto")] -- GitLab