From b1db89b3a6297ce636f2d2d7b15e3ed287b99c1b Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 28 Jul 2022 18:40:41 +0200 Subject: [PATCH 01/59] Temporary hack to fetch leaves from parachain block import --- Cargo.lock | 4 +++ client/consensus/common/Cargo.toml | 5 ++++ client/consensus/common/src/lib.rs | 42 ++++++++++++++++++++++---- polkadot-parachain/Cargo.toml | 3 ++ polkadot-parachain/src/service.rs | 47 +++++++++++++++++++++++++++++- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4aad0acdeb..f0114b835f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1515,6 +1515,8 @@ dependencies = [ "dyn-clone", "futures", "futures-timer", + "lazy_static", + "log", "parity-scale-codec", "polkadot-primitives", "sc-client-api", @@ -1522,6 +1524,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", + "sp-core", "sp-runtime", "sp-tracing", "sp-trie", @@ -7604,6 +7607,7 @@ dependencies = [ "futures", "hex-literal", "jsonrpsee", + "lazy_static", "log", "nix 0.24.1", "pallet-contracts-rpc", diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index e2af49ac5cb..171fdf58aaa 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -27,6 +27,11 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = # Cumulus cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } +# Temporary +log = "0.4.17" +lazy_static = "1.4.0" +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } + [dev-dependencies] futures-timer = "3.0.2" diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 61098dfd434..45810f49f14 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -16,7 +16,7 @@ use polkadot_primitives::v2::{Hash as PHash, PersistedValidationData}; use sc_consensus::BlockImport; -use sp_runtime::traits::Block as BlockT; +use sp_runtime::traits::{Block as BlockT, Header as _}; mod parachain_consensus; #[cfg(test)] @@ -83,6 +83,11 @@ impl ParachainBlockImport { } } +extern "Rust" { + fn get_leaves() -> Vec; + fn del_leaf(hash: &sp_core::H256); +} + #[async_trait::async_trait] impl BlockImport for ParachainBlockImport where @@ -101,14 +106,41 @@ where async fn import_block( &mut self, - mut block_import_params: sc_consensus::BlockImportParams, + mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Importing block @ {}", params.header.number()); + let leaves = unsafe { get_leaves() }; + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); + + const MAX_LEAVES: usize = 2; + if leaves.len() > MAX_LEAVES { + // Per interface contract, we know that the leaves are ordered from the highest. + // For this PoC just remove one of the lowers. + // TODO: Here we have to check the num of leaves at level of the block we are importing + // TODO: Better strategy, here we're just removin the first one + let leaf = &leaves[leaves.len() - 1]; + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", leaf); + unsafe { del_leaf(leaf) }; + let leaves = unsafe { get_leaves() }; + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); + } + // Best block is determined by the relay chain, or if we are doing the initial sync // we import all blocks as new best. - block_import_params.fork_choice = Some(sc_consensus::ForkChoiceStrategy::Custom( - block_import_params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, + params.fork_choice = Some(sc_consensus::ForkChoiceStrategy::Custom( + params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, )); - self.0.import_block(block_import_params, cache).await + + // Check if we require to prune a leaf before trying to import block + + let res = self.0.import_block(params, cache).await; + if let Err(err) = &res { + dbg!(&err); + log::error!("RAW ERRROR: {:?}", err); + let err_str = err.to_string(); + log::error!("ERROR IMPORTING: {}", err_str); + } + res } } diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index c775b9fc78c..84bf4673332 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -84,6 +84,9 @@ cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" } cumulus-relay-chain-inprocess-interface = { path = "../client/relay-chain-inprocess-interface" } cumulus-relay-chain-rpc-interface = { path = "../client/relay-chain-rpc-interface" } +# Temporary +lazy_static = "1.4.0" + [build-dependencies] substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index cd8eaf242c5..cdbd9779592 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -31,7 +31,7 @@ use cumulus_primitives_core::{ use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface; -use polkadot_service::CollatorPair; +use polkadot_service::{CollatorPair, FullBackend}; use sp_core::Pair; use jsonrpsee::RpcModule; @@ -504,6 +504,46 @@ where Ok((task_manager, client)) } +// ========= START TEMPORARY HACK ========= + +use std::sync::Mutex as StdMutex; +lazy_static::lazy_static! { + static ref BACKEND: StdMutex>> = StdMutex::new(None); +} +use sc_client_api::{ + backend::Backend, + blockchain::{Backend as _, HeaderBackend as _}, +}; + +#[no_mangle] +pub fn get_leaves() -> Vec { + let lock = BACKEND.lock().unwrap(); + let backend = lock.as_ref().expect("Backend should be already initialized"); + let blockchain = backend.blockchain(); + // Interface contract: results are ordered best (longest, highest) chain first. + let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + for leaf in leaves.iter() { + let number = match blockchain.number(*leaf).ok().flatten() { + Some(n) => n, + None => { + let msg = format!("Unexpected missing number for leaf {}", leaf); + panic!("{}", msg); + }, + }; + log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); + } + leaves +} + +#[no_mangle] +pub fn del_leaf(hash: &sp_core::H256) { + let lock = BACKEND.lock().unwrap(); + let backend = lock.as_ref().expect("Backend should be already initialized"); + backend.remove_leaf_block(hash).expect("Error removing leaf"); +} + +// ========= END TEMPORARY HACK ========= + /// Start a node with the given parachain `Configuration` and relay chain `Configuration`. /// /// This is the actual implementation that is abstract over the executor and the runtime api. @@ -580,6 +620,11 @@ where let client = params.client.clone(); let backend = params.backend.clone(); + { + let mut mtx = BACKEND.lock().unwrap(); + *mtx = Some(backend.clone()); + } + let mut task_manager = params.task_manager; let (relay_chain_interface, collator_key) = build_relay_chain_interface( polkadot_config, From e9bd43821d22e9ac72ca2f319f2f4ccbda75c988 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Mon, 1 Aug 2022 19:16:58 +0200 Subject: [PATCH 02/59] Working temporary PoC implementation --- client/consensus/common/src/lib.rs | 25 +++++---------- polkadot-parachain/src/service.rs | 49 ++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 45810f49f14..73a20088d25 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -84,8 +84,7 @@ impl ParachainBlockImport { } extern "Rust" { - fn get_leaves() -> Vec; - fn del_leaf(hash: &sp_core::H256); + fn check_leaves(number: u32); } #[async_trait::async_trait] @@ -109,21 +108,13 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Importing block @ {}", params.header.number()); - let leaves = unsafe { get_leaves() }; - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - - const MAX_LEAVES: usize = 2; - if leaves.len() > MAX_LEAVES { - // Per interface contract, we know that the leaves are ordered from the highest. - // For this PoC just remove one of the lowers. - // TODO: Here we have to check the num of leaves at level of the block we are importing - // TODO: Better strategy, here we're just removin the first one - let leaf = &leaves[leaves.len() - 1]; - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", leaf); - unsafe { del_leaf(leaf) }; - let leaves = unsafe { get_leaves() }; - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); + let number = params.header.number(); + let hash = params.header.hash(); + log::debug!(target: "parachain", ">>>>>>>>>>>>>> Importing block {:?} @ {}", hash, number); + + unsafe { + let number = number as *const _ as *const u32; + check_leaves(*number); } // Best block is determined by the relay chain, or if we are doing the initial sync diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 9af5cb02eb3..373e1ee3344 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -520,12 +520,17 @@ use sc_client_api::{ }; #[no_mangle] -pub fn get_leaves() -> Vec { +pub fn check_leaves(number: u32) { let lock = BACKEND.lock().unwrap(); let backend = lock.as_ref().expect("Backend should be already initialized"); let blockchain = backend.blockchain(); + + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); + // Interface contract: results are ordered best (longest, highest) chain first. - let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); + for leaf in leaves.iter() { let number = match blockchain.number(*leaf).ok().flatten() { Some(n) => n, @@ -536,14 +541,40 @@ pub fn get_leaves() -> Vec { }; log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); } - leaves -} -#[no_mangle] -pub fn del_leaf(hash: &sp_core::H256) { - let lock = BACKEND.lock().unwrap(); - let backend = lock.as_ref().expect("Backend should be already initialized"); - backend.remove_leaf_block(hash).expect("Error removing leaf"); + const MAX_LEAVES_PER_LEVEL: usize = 3; + if leaves.len() >= MAX_LEAVES_PER_LEVEL { + let best = blockchain.info().best_hash; + + leaves.retain(|hash| { + let this_num = blockchain.number(*hash).ok().flatten().unwrap(); + this_num == number + }); + let leaves_len = leaves.len(); + if leaves_len < MAX_LEAVES_PER_LEVEL { + return + } + + let mut to_remove = (leaves_len + 1) - MAX_LEAVES_PER_LEVEL; + // TODO: Better strategy + for hash in leaves { + if hash == best { + continue + } + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); + if backend.remove_leaf_block(&hash).is_err() { + log::debug!(target: "parachain", "Unable to remove block"); + } + + to_remove -= 1; + if to_remove == 0 { + break + } + } + + let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); + } } // ========= END TEMPORARY HACK ========= From e0a7da1efebeac9a4dd072b2ad107e5c7d683858 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 10 Aug 2022 12:56:56 +0200 Subject: [PATCH 03/59] TEMPORARY COMMIT --- client/consensus/common/src/tests.rs | 112 +++++++++++++++++++++++++++ polkadot-parachain/src/service.rs | 39 ++++++---- 2 files changed, 134 insertions(+), 17 deletions(-) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 23729abebb4..c31c48e6119 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -355,3 +355,115 @@ fn do_not_set_best_block_to_older_block() { // Build and import a new best block. build_and_import_block(client2.clone(), true); } + +#[test] +fn prune_blocks_on_leaves_overflow() { + const NUM_BLOCKS: usize = 4; + + let backend = Arc::new(Backend::new_test(1000, 1)); + { + let mut mtx = BACKEND.lock().unwrap(); + *mtx = Some(backend.clone()); + } + + let client = Arc::new(TestClientBuilder::with_backend(backend).build()); + + let blocks = (0..NUM_BLOCKS) + .into_iter() + .map(|_| build_and_import_block(client.clone(), true)) + .collect::>(); + + { + let builder = client.init_block_builder(None, Default::default()); + + let block = builder.build().unwrap().block; + let (header, body) = block.clone().deconstruct(); + + let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header); + block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(false)); + block_import_params.body = Some(body); + + + let mut para_import = ParachainBlockImport::new(client); + block_on(para_import.import_block(block_import_params, Default::default())).unwrap(); + + } + +} + +// ========= START TEMPORARY HACK ========= + +use std::sync::Mutex as StdMutex; + +lazy_static::lazy_static! { + static ref BACKEND: StdMutex>> = StdMutex::new(None); +} +use sc_client_api::{ + backend::Backend as _, + blockchain::{Backend as _, HeaderBackend as _}, +}; + +#[no_mangle] +pub fn check_leaves(number: u32) { + let lock = BACKEND.lock().unwrap(); + let backend = lock.as_ref().expect("Backend should be already initialized"); + let blockchain = backend.blockchain(); + + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); + + // Interface contract: results are ordered best (longest, highest) chain first. + let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); + + // TODO: Just debugging + for leaf in leaves.iter() { + let number = match blockchain.number(*leaf).ok().flatten() { + Some(n) => n, + None => { + let msg = format!("Unexpected missing number for leaf {}", leaf); + panic!("{}", msg); + }, + }; + log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); + } + + // Magic number + const MAX_LEAVES_PER_LEVEL: usize = 3; + + // First cheap check: the number of leaves at level `number` is always less than the total. + if leaves.len() >= MAX_LEAVES_PER_LEVEL { + // Now focus on the leaves at the given height. + leaves.retain(|hash| + blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() + ); + if leaves.len() < MAX_LEAVES_PER_LEVEL { + return + } + + // TODO: double check + let mut remove_count = (leaves.len() + 1) - MAX_LEAVES_PER_LEVEL; + + // TODO: Better strategy + let best = blockchain.info().best_hash; + + // TODO: here we strongly assume that the leaves returned by the backend are returned + // by "age". This is actually true in our backend implementation... + // We can add a constraint to the leaves() method signature. + for hash in leaves.into_iter().filter(|hash| *hash != best) { + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); + if backend.remove_leaf_block(&hash).is_err() { + log::warn!(target: "parachain", "Unable to remove block {}", hash); + continue; + } + remove_count -= 1; + if remove_count == 0 { + break + } + } + + let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); + } +} + +// ========= END TEMPORARY HACK ========= diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index c2c51e9d146..71cb4b5ef06 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -532,6 +532,7 @@ pub fn check_leaves(number: u32) { let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); + // TODO: Just debugging for leaf in leaves.iter() { let number = match blockchain.number(*leaf).ok().flatten() { Some(n) => n, @@ -543,32 +544,36 @@ pub fn check_leaves(number: u32) { log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); } + // Magic number const MAX_LEAVES_PER_LEVEL: usize = 3; - if leaves.len() >= MAX_LEAVES_PER_LEVEL { - let best = blockchain.info().best_hash; - leaves.retain(|hash| { - let this_num = blockchain.number(*hash).ok().flatten().unwrap(); - this_num == number - }); - let leaves_len = leaves.len(); - if leaves_len < MAX_LEAVES_PER_LEVEL { + // First cheap check: the number of leaves at level `number` is always less than the total. + if leaves.len() >= MAX_LEAVES_PER_LEVEL { + // Now focus on the leaves at the given height. + leaves.retain(|hash| + blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() + ); + if leaves.len() < MAX_LEAVES_PER_LEVEL { return } - let mut to_remove = (leaves_len + 1) - MAX_LEAVES_PER_LEVEL; + // TODO: double check + let mut remove_count = (leaves.len() + 1) - MAX_LEAVES_PER_LEVEL; + // TODO: Better strategy - for hash in leaves { - if hash == best { - continue - } + let best = blockchain.info().best_hash; + + // TODO: here we strongly assume that the leaves returned by the backend are returned + // by "age". This is actually true in our backend implementation... + // We can add a constraint to the leaves() method signature. + for hash in leaves.into_iter().filter(|hash| *hash != best) { log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); if backend.remove_leaf_block(&hash).is_err() { - log::debug!(target: "parachain", "Unable to remove block"); + log::warn!(target: "parachain", "Unable to remove block {}", hash); + continue; } - - to_remove -= 1; - if to_remove == 0 { + remove_count -= 1; + if remove_count == 0 { break } } From 48367c6a4d534d8dc58fd93561ada9e4fcc77eab Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 11 Aug 2022 11:45:49 +0200 Subject: [PATCH 04/59] Test excercising leaves pruning feature --- client/consensus/common/src/lib.rs | 23 ++-- client/consensus/common/src/tests.rs | 113 ++++++++++++------ .../consensus/relay-chain/src/import_queue.rs | 2 +- client/consensus/relay-chain/src/lib.rs | 1 + polkadot-parachain/src/service.rs | 22 ++-- 5 files changed, 103 insertions(+), 58 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 73a20088d25..dbbcc58525b 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -74,17 +74,20 @@ impl ParachainConsensus for Box + Send + /// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is /// not `NetworkInitialSync`. The best block for parachains is determined by the relay chain. Meaning /// we will update the best block, as it is included by the relay-chain. -pub struct ParachainBlockImport(I); +pub struct ParachainBlockImport { + inner: I, + level_limit: Option, +} impl ParachainBlockImport { /// Create a new instance. - pub fn new(inner: I) -> Self { - Self(inner) + pub fn new(inner: I, level_limit: Option) -> Self { + Self { inner, level_limit } } } extern "Rust" { - fn check_leaves(number: u32); + fn check_leaves(number: u32, level_limit: usize); } #[async_trait::async_trait] @@ -100,7 +103,7 @@ where &mut self, block: sc_consensus::BlockCheckParams, ) -> Result { - self.0.check_block(block).await + self.inner.check_block(block).await } async fn import_block( @@ -112,9 +115,11 @@ where let hash = params.header.hash(); log::debug!(target: "parachain", ">>>>>>>>>>>>>> Importing block {:?} @ {}", hash, number); - unsafe { - let number = number as *const _ as *const u32; - check_leaves(*number); + if let Some(limit) = self.level_limit { + unsafe { + let number = number as *const _ as *const u32; + check_leaves(*number, limit); + } } // Best block is determined by the relay chain, or if we are doing the initial sync @@ -125,7 +130,7 @@ where // Check if we require to prune a leaf before trying to import block - let res = self.0.import_block(params, cache).await; + let res = self.inner.import_block(params, cache).await; if let Err(err) = &res { dbg!(&err); log::error!("RAW ERRROR: {:?}", err); diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index c31c48e6119..cb000a53c9c 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -103,8 +103,26 @@ impl crate::parachain_consensus::RelaychainClient for Relaychain { } } +#[inline] fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Block { - let builder = client.init_block_builder(None, Default::default()); + build_and_import_block_ext(&*client.clone(), import_as_best, &mut client, None, None) +} + +fn build_and_import_block_ext>( + builder: &B, + import_as_best: bool, + importer: &mut I, + at: Option>, + timestamp: Option, +) -> Block { + let builder = match at { + Some(at) => match timestamp { + Some(ts) => + builder.init_block_builder_with_timestamp(&at, None, Default::default(), ts), + None => builder.init_block_builder_at(&at, None, Default::default()), + }, + None => builder.init_block_builder(None, Default::default()), + }; let block = builder.build().unwrap().block; let (header, body) = block.clone().deconstruct(); @@ -113,7 +131,7 @@ fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Bloc block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(import_as_best)); block_import_params.body = Some(body); - block_on(client.import_block(block_import_params, Default::default())).unwrap(); + block_on(importer.import_block(block_import_params, Default::default())).unwrap(); block } @@ -358,37 +376,61 @@ fn do_not_set_best_block_to_older_block() { #[test] fn prune_blocks_on_leaves_overflow() { - const NUM_BLOCKS: usize = 4; + const LEVEL_LIMIT: usize = 3; + const TIMESTAMP_MULTIPLIER: u64 = 60000; let backend = Arc::new(Backend::new_test(1000, 1)); - { - let mut mtx = BACKEND.lock().unwrap(); - *mtx = Some(backend.clone()); - } + { + let mut mtx = BACKEND.lock().unwrap(); + *mtx = Some(backend.clone()); + } - let client = Arc::new(TestClientBuilder::with_backend(backend).build()); + let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); - let blocks = (0..NUM_BLOCKS) + let mut para_import = ParachainBlockImport::new(client.clone(), Some(LEVEL_LIMIT)); + + let root_block = build_and_import_block(client.clone(), true); + let _num = root_block.header.number(); + let root_id = BlockId::Hash(root_block.header.hash()); + + let blocks = (0..LEVEL_LIMIT) .into_iter() - .map(|_| build_and_import_block(client.clone(), true)) + .map(|i| { + build_and_import_block_ext( + &*client, + false, + &mut para_import, + Some(root_id), + Some(i as u64 * TIMESTAMP_MULTIPLIER), + ) + }) .collect::>(); - { - let builder = client.init_block_builder(None, Default::default()); + let _ = dbg!(&blocks.iter().map(|b| b.header.hash()).collect::>()); - let block = builder.build().unwrap().block; - let (header, body) = block.clone().deconstruct(); + let leaves = backend.blockchain().leaves(); + let _ = dbg!(&leaves); - let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header); - block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(false)); - block_import_params.body = Some(body); + { + let builder = client.init_block_builder_with_timestamp( + &root_id, + None, + Default::default(), + LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER, + ); + let block = builder.build().unwrap().block; + let (header, body) = block.clone().deconstruct(); - let mut para_import = ParachainBlockImport::new(client); - block_on(para_import.import_block(block_import_params, Default::default())).unwrap(); + let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header); + block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(false)); + block_import_params.body = Some(body); - } + block_on(para_import.import_block(block_import_params, Default::default())).unwrap(); + } + let leaves = backend.blockchain().leaves(); + let _ = dbg!(&leaves); } // ========= START TEMPORARY HACK ========= @@ -404,7 +446,7 @@ use sc_client_api::{ }; #[no_mangle] -pub fn check_leaves(number: u32) { +pub fn check_leaves(number: u32, level_limit: usize) { let lock = BACKEND.lock().unwrap(); let backend = lock.as_ref().expect("Backend should be already initialized"); let blockchain = backend.blockchain(); @@ -415,7 +457,7 @@ pub fn check_leaves(number: u32) { let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - // TODO: Just debugging + // TODO: Just debugging for leaf in leaves.iter() { let number = match blockchain.number(*leaf).ok().flatten() { Some(n) => n, @@ -427,33 +469,30 @@ pub fn check_leaves(number: u32) { log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); } - // Magic number - const MAX_LEAVES_PER_LEVEL: usize = 3; - - // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() >= MAX_LEAVES_PER_LEVEL { - // Now focus on the leaves at the given height. - leaves.retain(|hash| + // First cheap check: the number of leaves at level `number` is always less than the total. + if leaves.len() >= level_limit { + // Now focus on the leaves at the given height. + leaves.retain(|hash| { blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - ); - if leaves.len() < MAX_LEAVES_PER_LEVEL { + }); + if leaves.len() < level_limit { return } - // TODO: double check - let mut remove_count = (leaves.len() + 1) - MAX_LEAVES_PER_LEVEL; + // TODO: double check + let mut remove_count = (leaves.len() + 1) - level_limit; // TODO: Better strategy let best = blockchain.info().best_hash; - // TODO: here we strongly assume that the leaves returned by the backend are returned - // by "age". This is actually true in our backend implementation... - // We can add a constraint to the leaves() method signature. + // TODO: here we strongly assume that the leaves returned by the backend are returned + // by "age". This is actually true in our backend implementation... + // We can add a constraint to the leaves() method signature. for hash in leaves.into_iter().filter(|hash| *hash != best) { log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); if backend.remove_leaf_block(&hash).is_err() { log::warn!(target: "parachain", "Unable to remove block {}", hash); - continue; + continue } remove_count -= 1; if remove_count == 0 { diff --git a/client/consensus/relay-chain/src/import_queue.rs b/client/consensus/relay-chain/src/import_queue.rs index 3792a9c04bb..23638514b06 100644 --- a/client/consensus/relay-chain/src/import_queue.rs +++ b/client/consensus/relay-chain/src/import_queue.rs @@ -119,7 +119,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(cumulus_client_consensus_common::ParachainBlockImport::new(block_import)), + Box::new(cumulus_client_consensus_common::ParachainBlockImport::new(block_import, None)), None, spawner, registry, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index 20d3b7cc757..b1a72c0f35b 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -99,6 +99,7 @@ where create_inherent_data_providers: Arc::new(create_inherent_data_providers), block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new( block_import, + None, ))), relay_chain_interface, _phantom: PhantomData, diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 71cb4b5ef06..7f6ece2f393 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -532,7 +532,7 @@ pub fn check_leaves(number: u32) { let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - // TODO: Just debugging + // TODO: Just debugging for leaf in leaves.iter() { let number = match blockchain.number(*leaf).ok().flatten() { Some(n) => n, @@ -544,33 +544,33 @@ pub fn check_leaves(number: u32) { log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); } - // Magic number + // Magic number const MAX_LEAVES_PER_LEVEL: usize = 3; - // First cheap check: the number of leaves at level `number` is always less than the total. + // First cheap check: the number of leaves at level `number` is always less than the total. if leaves.len() >= MAX_LEAVES_PER_LEVEL { - // Now focus on the leaves at the given height. - leaves.retain(|hash| + // Now focus on the leaves at the given height. + leaves.retain(|hash| { blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - ); + }); if leaves.len() < MAX_LEAVES_PER_LEVEL { return } - // TODO: double check + // TODO: double check let mut remove_count = (leaves.len() + 1) - MAX_LEAVES_PER_LEVEL; // TODO: Better strategy let best = blockchain.info().best_hash; - // TODO: here we strongly assume that the leaves returned by the backend are returned - // by "age". This is actually true in our backend implementation... - // We can add a constraint to the leaves() method signature. + // TODO: here we strongly assume that the leaves returned by the backend are returned + // by "age". This is actually true in our backend implementation... + // We can add a constraint to the leaves() method signature. for hash in leaves.into_iter().filter(|hash| *hash != best) { log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); if backend.remove_leaf_block(&hash).is_err() { log::warn!(target: "parachain", "Unable to remove block {}", hash); - continue; + continue } remove_count -= 1; if remove_count == 0 { From 0613b3b6a8d891dc7f9c55485c17e7883d191740 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 13:44:53 +0200 Subject: [PATCH 05/59] Removed global backend hack and introduced configurable leaves level limit --- client/consensus/aura/src/import_queue.rs | 14 +- client/consensus/aura/src/lib.rs | 19 +- client/consensus/common/src/lib.rs | 124 ++++++++++++-- client/consensus/common/src/tests.rs | 7 +- .../consensus/relay-chain/src/import_queue.rs | 8 +- client/consensus/relay-chain/src/lib.rs | 33 ++-- parachain-template/node/src/service.rs | 29 +++- polkadot-parachain/src/service.rs | 162 +++++++----------- test/service/src/lib.rs | 4 +- 9 files changed, 253 insertions(+), 147 deletions(-) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 31ed5779850..09c932bee81 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -34,7 +34,7 @@ use std::{fmt::Debug, hash::Hash, sync::Arc}; use substrate_prometheus_endpoint::Registry; /// Parameters of [`import_queue`]. -pub struct ImportQueueParams<'a, I, C, CIDP, S, CAW> { +pub struct ImportQueueParams<'a, I, C, CIDP, S, CAW, BE> { /// The block import to use. pub block_import: I, /// The client to interact with the chain. @@ -49,10 +49,12 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S, CAW> { pub can_author_with: CAW, /// The telemetry handle. pub telemetry: Option, + /// The backend. + pub backend: Arc, } /// Start an import queue for the Aura consensus algorithm. -pub fn import_queue<'a, P, Block, I, C, S, CAW, CIDP>( +pub fn import_queue<'a, P, Block, I, C, S, CAW, CIDP, BE>( ImportQueueParams { block_import, client, @@ -61,7 +63,8 @@ pub fn import_queue<'a, P, Block, I, C, S, CAW, CIDP>( registry, can_author_with, telemetry, - }: ImportQueueParams<'a, I, C, CIDP, S, CAW>, + backend, + }: ImportQueueParams<'a, I, C, CIDP, S, CAW, BE>, ) -> Result, sp_consensus::Error> where Block: BlockT, @@ -85,9 +88,12 @@ where CAW: CanAuthorWith + Send + Sync + 'static, CIDP: CreateInherentDataProviders + Sync + Send + 'static, CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, + BE: sc_client_api::Backend + 'static, { + use cumulus_client_consensus_common::{LeavesLevelLimit, ParachainBlockImport}; + sc_consensus_aura::import_queue::(sc_consensus_aura::ImportQueueParams { - block_import: cumulus_client_consensus_common::ParachainBlockImport::new(block_import), + block_import: ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::Default), justification_import: None, client, create_inherent_data_providers, diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index f88bca38d4b..7cc93fbcc2e 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -24,12 +24,12 @@ use codec::{Decode, Encode}; use cumulus_client_consensus_common::{ - ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, PersistedValidationData}; use futures::lock::Mutex; -use sc_client_api::{backend::AuxStore, BlockOf}; +use sc_client_api::{backend::AuxStore, Backend, BlockOf}; use sc_consensus::BlockImport; use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SimpleSlotWorker, SlotInfo}; use sc_telemetry::TelemetryHandle; @@ -78,12 +78,13 @@ where CIDP::InherentDataProviders: InherentDataProviderExt, { /// Create a new boxed instance of AURA consensus. - pub fn build( + pub fn build( BuildAuraConsensusParams { proposer_factory, create_inherent_data_providers, block_import, para_client, + backend, backoff_authoring_blocks, sync_oracle, keystore, @@ -92,12 +93,13 @@ where telemetry, block_proposal_slot_portion, max_block_proposal_slot_portion, - }: BuildAuraConsensusParams, + }: BuildAuraConsensusParams, ) -> Box> where Client: ProvideRuntimeApi + BlockOf + AuxStore + HeaderBackend + Send + Sync + 'static, Client::Api: AuraApi, + BE: Backend + 'static, BI: BlockImport> + Send + Sync + 'static, SO: SyncOracle + Send + Sync + Clone + 'static, BS: BackoffAuthoringBlocksStrategy> + Send + Sync + 'static, @@ -117,7 +119,11 @@ where let worker = sc_consensus_aura::build_aura_worker::( BuildAuraWorkerParams { client: para_client, - block_import: ParachainBlockImport::new(block_import), + block_import: ParachainBlockImport::new( + block_import, + backend, + LeavesLevelLimit::Default, + ), justification_sync_link: (), proposer_factory, sync_oracle, @@ -219,11 +225,12 @@ where } /// Parameters of [`AuraConsensus::build`]. -pub struct BuildAuraConsensusParams { +pub struct BuildAuraConsensusParams { pub proposer_factory: PF, pub create_inherent_data_providers: CIDP, pub block_import: BI, pub para_client: Arc, + pub backend: Arc, pub backoff_authoring_blocks: Option, pub sync_oracle: SO, pub keystore: SyncCryptoStorePtr, diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index dbbcc58525b..3565482f119 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -15,14 +15,44 @@ // along with Cumulus. If not, see . use polkadot_primitives::v2::{Hash as PHash, PersistedValidationData}; + +use sc_client_api::{ + blockchain::{Backend as _, HeaderBackend as _}, + Backend, +}; use sc_consensus::BlockImport; use sp_runtime::traits::{Block as BlockT, Header as _}; +use std::sync::Arc; + mod parachain_consensus; #[cfg(test)] mod tests; + pub use parachain_consensus::run_parachain_consensus; +/// Value good enough to be use on parachains under the current backend implementation. +/// Note that this value may change in the future. +pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 3; + +/// Uppere bound to the number of leaves held by each chain level. +/// +/// The a limit is set and more leaves are detected on block import, then the older ones are +/// eventually dropped to make space for more fresh blocks. +/// +/// In environments where blocks confirmations from the relay chain are "slow", then +/// setting an upper bound helps keeping the chain health by dropping old (presumably) stale +/// leaves and prevents discarding new fresh blocks because we've reached the backend max value +/// according to the backend implementation. +pub enum LeavesLevelLimit { + /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. + Default, + /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. + None, + /// Custom value. + Some(usize), +} + /// The result of [`ParachainConsensus::produce_candidate`]. pub struct ParachainCandidate { /// The block that was built for this candidate. @@ -74,30 +104,33 @@ impl ParachainConsensus for Box + Send + /// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is /// not `NetworkInitialSync`. The best block for parachains is determined by the relay chain. Meaning /// we will update the best block, as it is included by the relay-chain. -pub struct ParachainBlockImport { - inner: I, - level_limit: Option, +pub struct ParachainBlockImport { + inner: BI, + backend: Arc, + level_leaves_max: Option, } -impl ParachainBlockImport { +impl ParachainBlockImport { /// Create a new instance. - pub fn new(inner: I, level_limit: Option) -> Self { - Self { inner, level_limit } + pub fn new(inner: BI, backend: Arc, level_leaves_max: LeavesLevelLimit) -> Self { + let level_leaves_max = match level_leaves_max { + LeavesLevelLimit::None => None, + LeavesLevelLimit::Some(limit) => Some(limit), + LeavesLevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), + }; + Self { inner, backend, level_leaves_max } } } -extern "Rust" { - fn check_leaves(number: u32, level_limit: usize); -} - #[async_trait::async_trait] -impl BlockImport for ParachainBlockImport +impl BlockImport for ParachainBlockImport where Block: BlockT, - I: BlockImport + Send, + BI: BlockImport + Send, + BE: Backend, { - type Error = I::Error; - type Transaction = I::Transaction; + type Error = BI::Error; + type Transaction = BI::Transaction; async fn check_block( &mut self, @@ -115,11 +148,66 @@ where let hash = params.header.hash(); log::debug!(target: "parachain", ">>>>>>>>>>>>>> Importing block {:?} @ {}", hash, number); - if let Some(limit) = self.level_limit { - unsafe { - let number = number as *const _ as *const u32; - check_leaves(*number, limit); + let check_leaves = |level_limit| { + let blockchain = self.backend.blockchain(); + + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); + + // Interface contract: results are ordered best (longest, highest) chain first. + let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); + + // TODO: Just debugging + for leaf in leaves.iter() { + match blockchain.number(*leaf).ok().flatten() { + Some(n) => log::debug!(target: "parachain", ">>> (@{}) : {}", n, leaf), + None => panic!("Unexpected missing number for leaf {}", leaf), + }; + } + + // First cheap check: the number of leaves at level `number` is always less than the total. + if leaves.len() < level_limit { + return + } + + // Now focus on the leaves at the given height. + leaves.retain(|hash| { + blockchain + .number(*hash) + .ok() + .flatten() + .map(|n| n == *number) + .unwrap_or_default() + }); + if leaves.len() < level_limit { + return + } + + let best = blockchain.info().best_hash; + + // TODO: here we assuming that the leaves returned by the backend are sorted + // by "age" with younger leaves in the back. + // This is true in our backend implementation, we can add a constraint to the + // leaves() method signature. + let mut remove_count = (leaves.len() + 1) - level_limit; + for hash in leaves.into_iter().filter(|hash| *hash != best) { + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); + if self.backend.remove_leaf_block(&hash).is_err() { + log::warn!(target: "parachain", "Unable to remove block {}", hash); + continue + } + remove_count -= 1; + if remove_count == 0 { + break + } } + + let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); + log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); + }; + + if let Some(limit) = self.level_leaves_max { + check_leaves(limit); } // Best block is determined by the relay chain, or if we are doing the initial sync diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index cb000a53c9c..ce32cfe804f 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -387,7 +387,12 @@ fn prune_blocks_on_leaves_overflow() { let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); - let mut para_import = ParachainBlockImport::new(client.clone(), Some(LEVEL_LIMIT)); + // TODO: maybe we have to pass a weak ref + let mut para_import = ParachainBlockImport::new( + client.clone(), + backend.clone(), + LeavesLevelLimit::Some(LEVEL_LIMIT), + ); let root_block = build_and_import_block(client.clone(), true); let _num = root_block.header.number(); diff --git a/client/consensus/relay-chain/src/import_queue.rs b/client/consensus/relay-chain/src/import_queue.rs index 23638514b06..94cf7f9a9a7 100644 --- a/client/consensus/relay-chain/src/import_queue.rs +++ b/client/consensus/relay-chain/src/import_queue.rs @@ -30,6 +30,8 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT}, }; +use cumulus_client_consensus_common::{LeavesLevelLimit, ParachainBlockImport}; + /// A verifier that just checks the inherents. pub struct Verifier { client: Arc, @@ -101,12 +103,13 @@ where } /// Start an import queue for a Cumulus collator that does not uses any special authoring logic. -pub fn import_queue( +pub fn import_queue( client: Arc, block_import: I, create_inherent_data_providers: CIDP, spawner: &impl sp_core::traits::SpawnEssentialNamed, registry: Option<&substrate_prometheus_endpoint::Registry>, + backend: Arc, ) -> ClientResult> where I: BlockImport + Send + Sync + 'static, @@ -114,12 +117,13 @@ where Client: ProvideRuntimeApi + Send + Sync + 'static, >::Api: BlockBuilderApi, CIDP: CreateInherentDataProviders + 'static, + BE: sc_client_api::Backend + 'static, { let verifier = Verifier::new(client, create_inherent_data_providers); Ok(BasicQueue::new( verifier, - Box::new(cumulus_client_consensus_common::ParachainBlockImport::new(block_import, None)), + Box::new(ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::None)), None, spawner, registry, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index b1a72c0f35b..0074aa7ed92 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -34,11 +34,10 @@ //! 5. After the parachain candidate got backed and included, all collators start at 1. use cumulus_client_consensus_common::{ - ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, ParaId, PersistedValidationData}; use cumulus_relay_chain_interface::RelayChainInterface; -use parking_lot::Mutex; use sc_consensus::{BlockImport, BlockImportParams}; use sp_consensus::{ @@ -46,6 +45,8 @@ use sp_consensus::{ }; use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; + +use parking_lot::Mutex; use std::{marker::PhantomData, sync::Arc, time::Duration}; mod import_queue; @@ -54,16 +55,17 @@ pub use import_queue::{import_queue, Verifier}; const LOG_TARGET: &str = "cumulus-consensus-relay-chain"; /// The implementation of the relay-chain provided consensus for parachains. -pub struct RelayChainConsensus { +pub struct RelayChainConsensus { para_id: ParaId, _phantom: PhantomData, proposer_factory: Arc>, create_inherent_data_providers: Arc, - block_import: Arc>>, + block_import: Arc>>, relay_chain_interface: RCInterface, } -impl Clone for RelayChainConsensus +impl Clone + for RelayChainConsensus where RCInterface: Clone, { @@ -79,7 +81,7 @@ where } } -impl RelayChainConsensus +impl RelayChainConsensus where B: BlockT, RCInterface: RelayChainInterface, @@ -92,6 +94,7 @@ where create_inherent_data_providers: CIDP, block_import: BI, relay_chain_interface: RCInterface, + backend: Arc, ) -> Self { Self { para_id, @@ -99,7 +102,8 @@ where create_inherent_data_providers: Arc::new(create_inherent_data_providers), block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new( block_import, - None, + backend, + LeavesLevelLimit::None, ))), relay_chain_interface, _phantom: PhantomData, @@ -140,8 +144,8 @@ where } #[async_trait::async_trait] -impl ParachainConsensus - for RelayChainConsensus +impl ParachainConsensus + for RelayChainConsensus where B: BlockT, RCInterface: RelayChainInterface + Clone, @@ -154,6 +158,7 @@ where Proof = ::Proof, >, CIDP: CreateInherentDataProviders, + BE: sc_client_api::Backend + Send + Sync, { async fn produce_candidate( &mut self, @@ -219,25 +224,27 @@ where } /// Parameters of [`build_relay_chain_consensus`]. -pub struct BuildRelayChainConsensusParams { +pub struct BuildRelayChainConsensusParams { pub para_id: ParaId, pub proposer_factory: PF, pub create_inherent_data_providers: CIDP, pub block_import: BI, pub relay_chain_interface: RCInterface, + pub backend: Arc, } /// Build the [`RelayChainConsensus`]. /// /// Returns a boxed [`ParachainConsensus`]. -pub fn build_relay_chain_consensus( +pub fn build_relay_chain_consensus( BuildRelayChainConsensusParams { para_id, proposer_factory, create_inherent_data_providers, block_import, relay_chain_interface, - }: BuildRelayChainConsensusParams, + backend, + }: BuildRelayChainConsensusParams, ) -> Box> where Block: BlockT, @@ -251,6 +258,7 @@ where BI: BlockImport + Send + Sync + 'static, CIDP: CreateInherentDataProviders + 'static, RCInterface: RelayChainInterface + Clone + 'static, + BE: sc_client_api::Backend + Send + Sync + 'static, { Box::new(RelayChainConsensus::new( para_id, @@ -258,5 +266,6 @@ where create_inherent_data_providers, block_import, relay_chain_interface, + backend, )) } diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index 9ad3c38e1ac..2c84bb75503 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -95,6 +95,7 @@ where Executor: sc_executor::NativeExecutionDispatch + 'static, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -149,6 +150,7 @@ where let import_queue = build_import_queue( client.clone(), + backend.clone(), config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, @@ -233,6 +235,7 @@ where + 'static, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -258,6 +261,7 @@ where Arc>, SyncCryptoStorePtr, bool, + Arc>, ) -> Result>, sc_service::Error>, { let parachain_config = prepare_node_config(parachain_config); @@ -362,6 +366,7 @@ where network, params.keystore_container.sync_keystore(), force_authoring, + backend, )?; let spawner = task_manager.spawn_handle(); @@ -405,6 +410,7 @@ where #[allow(clippy::type_complexity)] pub fn parachain_build_import_queue( client: Arc>>, + backend: Arc>, config: &Configuration, telemetry: Option, task_manager: &TaskManager, @@ -425,6 +431,7 @@ pub fn parachain_build_import_queue( _, _, _, + _, >(cumulus_client_consensus_aura::ImportQueueParams { block_import: client.clone(), client: client.clone(), @@ -443,6 +450,7 @@ pub fn parachain_build_import_queue( can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), spawner: &task_manager.spawn_essential_handle(), telemetry, + backend, }) .map_err(Into::into) } @@ -473,7 +481,8 @@ pub async fn start_parachain_node( transaction_pool, sync_oracle, keystore, - force_authoring| { + force_authoring, + backend| { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( @@ -484,8 +493,17 @@ pub async fn start_parachain_node( telemetry.clone(), ); - Ok(AuraConsensus::build::( - BuildAuraConsensusParams { + Ok( + AuraConsensus::build::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + _, + >(BuildAuraConsensusParams { proposer_factory, create_inherent_data_providers: move |_, (relay_parent, validation_data)| { let relay_chain_interface = relay_chain_interface.clone(); @@ -515,6 +533,7 @@ pub async fn start_parachain_node( }, block_import: client.clone(), para_client: client, + backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -525,8 +544,8 @@ pub async fn start_parachain_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, - }, - )) + }), + ) }, hwbench, ) diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 7f6ece2f393..58b32e76883 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -18,7 +18,7 @@ use codec::Codec; use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::{ - ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_service::{ @@ -214,6 +214,7 @@ where sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -269,6 +270,7 @@ where let import_queue = build_import_queue( client.clone(), + backend.clone(), config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, @@ -350,6 +352,7 @@ where + 'static, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -375,6 +378,7 @@ where Arc>, SyncCryptoStorePtr, bool, + Arc>, ) -> Result>, sc_service::Error>, { let parachain_config = prepare_node_config(parachain_config); @@ -468,6 +472,7 @@ where network, params.keystore_container.sync_keystore(), force_authoring, + backend, )?; let spawner = task_manager.spawn_handle(); @@ -507,84 +512,6 @@ where Ok((task_manager, client)) } -// ========= START TEMPORARY HACK ========= - -use polkadot_service::FullBackend; -use std::sync::Mutex as StdMutex; - -lazy_static::lazy_static! { - static ref BACKEND: StdMutex>> = StdMutex::new(None); -} -use sc_client_api::{ - backend::Backend, - blockchain::{Backend as _, HeaderBackend as _}, -}; - -#[no_mangle] -pub fn check_leaves(number: u32) { - let lock = BACKEND.lock().unwrap(); - let backend = lock.as_ref().expect("Backend should be already initialized"); - let blockchain = backend.blockchain(); - - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); - - // Interface contract: results are ordered best (longest, highest) chain first. - let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - - // TODO: Just debugging - for leaf in leaves.iter() { - let number = match blockchain.number(*leaf).ok().flatten() { - Some(n) => n, - None => { - let msg = format!("Unexpected missing number for leaf {}", leaf); - panic!("{}", msg); - }, - }; - log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); - } - - // Magic number - const MAX_LEAVES_PER_LEVEL: usize = 3; - - // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() >= MAX_LEAVES_PER_LEVEL { - // Now focus on the leaves at the given height. - leaves.retain(|hash| { - blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - }); - if leaves.len() < MAX_LEAVES_PER_LEVEL { - return - } - - // TODO: double check - let mut remove_count = (leaves.len() + 1) - MAX_LEAVES_PER_LEVEL; - - // TODO: Better strategy - let best = blockchain.info().best_hash; - - // TODO: here we strongly assume that the leaves returned by the backend are returned - // by "age". This is actually true in our backend implementation... - // We can add a constraint to the leaves() method signature. - for hash in leaves.into_iter().filter(|hash| *hash != best) { - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); - if backend.remove_leaf_block(&hash).is_err() { - log::warn!(target: "parachain", "Unable to remove block {}", hash); - continue - } - remove_count -= 1; - if remove_count == 0 { - break - } - } - - let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); - } -} - -// ========= END TEMPORARY HACK ========= - /// Start a node with the given parachain `Configuration` and relay chain `Configuration`. /// /// This is the actual implementation that is abstract over the executor and the runtime api. @@ -626,6 +553,7 @@ where + 'static, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -651,6 +579,7 @@ where Arc>, SyncCryptoStorePtr, bool, + Arc>, ) -> Result>, sc_service::Error>, { let parachain_config = prepare_node_config(parachain_config); @@ -661,11 +590,6 @@ where let client = params.client.clone(); let backend = params.backend.clone(); - { - let mut mtx = BACKEND.lock().unwrap(); - *mtx = Some(backend.clone()); - } - let mut task_manager = params.task_manager; let (relay_chain_interface, collator_key) = build_relay_chain_interface( polkadot_config, @@ -760,6 +684,7 @@ where network, params.keystore_container.sync_keystore(), force_authoring, + backend, )?; let spawner = task_manager.spawn_handle(); @@ -804,6 +729,7 @@ pub fn rococo_parachain_build_import_queue( client: Arc< TFullClient>, >, + backend: Arc>, config: &Configuration, telemetry: Option, task_manager: &TaskManager, @@ -824,6 +750,7 @@ pub fn rococo_parachain_build_import_queue( _, _, _, + _, >(cumulus_client_consensus_aura::ImportQueueParams { block_import: client.clone(), client, @@ -842,6 +769,7 @@ pub fn rococo_parachain_build_import_queue( can_author_with: sp_consensus::AlwaysCanAuthor, spawner: &task_manager.spawn_essential_handle(), telemetry, + backend, }) .map_err(Into::into) } @@ -872,7 +800,8 @@ pub async fn start_rococo_parachain_node( transaction_pool, sync_oracle, keystore, - force_authoring| { + force_authoring, + backend| { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( @@ -883,8 +812,17 @@ pub async fn start_rococo_parachain_node( telemetry.clone(), ); - Ok(AuraConsensus::build::( - BuildAuraConsensusParams { + Ok( + AuraConsensus::build::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + _, + >(BuildAuraConsensusParams { proposer_factory, create_inherent_data_providers: move |_, (relay_parent, validation_data)| { let relay_chain_interface = relay_chain_interface.clone(); @@ -917,6 +855,7 @@ pub async fn start_rococo_parachain_node( }, block_import: client.clone(), para_client: client, + backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -927,8 +866,8 @@ pub async fn start_rococo_parachain_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, - }, - )) + }), + ) }, hwbench, ) @@ -938,6 +877,7 @@ pub async fn start_rococo_parachain_node( /// Build the import queue for the shell runtime. pub fn shell_build_import_queue( client: Arc>>, + backend: Arc>, config: &Configuration, _: Option, task_manager: &TaskManager, @@ -969,6 +909,7 @@ where |_, _| async { Ok(()) }, &task_manager.spawn_essential_handle(), config.prometheus_registry(), + backend, ) .map_err(Into::into) } @@ -1015,7 +956,8 @@ where transaction_pool, _, _, - _| { + _, + backend| { let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( task_manager.spawn_handle(), client.clone(), @@ -1048,6 +990,7 @@ where Ok(parachain_inherent) } }, + backend, }, )) }, @@ -1166,6 +1109,7 @@ where /// Build the import queue for Statemint and other Aura-based runtimes. pub fn aura_build_import_queue( client: Arc>>, + backend: Arc>, config: &Configuration, telemetry_handle: Option, task_manager: &TaskManager, @@ -1236,7 +1180,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(client)), + Box::new(ParachainBlockImport::new(client, backend, LeavesLevelLimit::Default)), None, &spawner, registry, @@ -1291,13 +1235,16 @@ where transaction_pool, sync_oracle, keystore, - force_authoring| { + force_authoring, + backend| { let client2 = client.clone(); let spawn_handle = task_manager.spawn_handle(); let transaction_pool2 = transaction_pool.clone(); let telemetry2 = telemetry.clone(); let prometheus_registry2 = prometheus_registry.map(|r| (*r).clone()); let relay_chain_for_aura = relay_chain_interface.clone(); + let backend2 = backend.clone(); + let aura_consensus = BuildOnAccess::Uninitialized(Some(Box::new(move || { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client2).unwrap(); @@ -1310,7 +1257,7 @@ where telemetry2.clone(), ); - AuraConsensus::build::<::Pair, _, _, _, _, _, _>( + AuraConsensus::build::<::Pair, _, _, _, _, _, _, _>( BuildAuraConsensusParams { proposer_factory, create_inherent_data_providers: @@ -1346,6 +1293,7 @@ where }, block_import: client2.clone(), para_client: client2.clone(), + backend: backend2.clone(), backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -1395,6 +1343,7 @@ where Ok(parachain_inherent) } }, + backend, }, ); @@ -1451,6 +1400,7 @@ where + 'static, BIQ: FnOnce( Arc>>, + Arc>, &Configuration, Option, &TaskManager, @@ -1476,6 +1426,7 @@ where Arc>, SyncCryptoStorePtr, bool, + Arc>, ) -> Result>, sc_service::Error>, { let parachain_config = prepare_node_config(parachain_config); @@ -1580,6 +1531,7 @@ where network, params.keystore_container.sync_keystore(), force_authoring, + backend, )?; let spawner = task_manager.spawn_handle(); @@ -1624,6 +1576,7 @@ pub fn contracts_rococo_build_import_queue( client: Arc< TFullClient>, >, + backend: Arc>, config: &Configuration, telemetry: Option, task_manager: &TaskManager, @@ -1644,6 +1597,7 @@ pub fn contracts_rococo_build_import_queue( _, _, _, + _, >(cumulus_client_consensus_aura::ImportQueueParams { block_import: client.clone(), client, @@ -1662,6 +1616,7 @@ pub fn contracts_rococo_build_import_queue( can_author_with: sp_consensus::AlwaysCanAuthor, spawner: &task_manager.spawn_essential_handle(), telemetry, + backend, }) .map_err(Into::into) } @@ -1692,7 +1647,8 @@ pub async fn start_contracts_rococo_node( transaction_pool, sync_oracle, keystore, - force_authoring| { + force_authoring, + backend| { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( @@ -1703,8 +1659,17 @@ pub async fn start_contracts_rococo_node( telemetry.clone(), ); - Ok(AuraConsensus::build::( - BuildAuraConsensusParams { + Ok( + AuraConsensus::build::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + _, + >(BuildAuraConsensusParams { proposer_factory, create_inherent_data_providers: move |_, (relay_parent, validation_data)| { let relay_chain_interface = relay_chain_interface.clone(); @@ -1736,6 +1701,7 @@ pub async fn start_contracts_rococo_node( }, block_import: client.clone(), para_client: client, + backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -1746,8 +1712,8 @@ pub async fn start_contracts_rococo_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, - }, - )) + }), + ) }, hwbench, ) diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index 28c52ac8f70..796c1f738e1 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -159,6 +159,7 @@ pub fn new_partial( |_, _| async { Ok(sp_timestamp::InherentDataProvider::from_system_time()) }, &task_manager.spawn_essential_handle(), registry, + backend.clone(), )?; let params = PartialComponents { @@ -280,7 +281,7 @@ where task_manager: &mut task_manager, config: parachain_config, keystore: params.keystore_container.sync_keystore(), - backend, + backend: backend.clone(), network: network.clone(), system_rpc_tx, telemetry: None, @@ -333,6 +334,7 @@ where }, client.clone(), relay_chain_interface2, + backend, )) }, Consensus::Null => Box::new(NullConsensus), From 0ddaedc200d04c0d2183e08ad4745807d474ca48 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 14:49:34 +0200 Subject: [PATCH 06/59] Cleanup --- client/consensus/common/Cargo.toml | 4 +- client/consensus/common/src/lib.rs | 11 +-- client/consensus/common/src/tests.rs | 123 +++++---------------------- polkadot-parachain/Cargo.toml | 3 - 4 files changed, 21 insertions(+), 120 deletions(-) diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index b5c8ae67f0f..d1b0458de6a 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -27,10 +27,8 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = # Cumulus cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } -# Temporary +# TEMPORARY (REMOVE THIS) log = "0.4.17" -lazy_static = "1.4.0" -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } [dev-dependencies] futures-timer = "3.0.2" diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 3565482f119..ff1eabae47a 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -216,15 +216,6 @@ where params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, )); - // Check if we require to prune a leaf before trying to import block - - let res = self.inner.import_block(params, cache).await; - if let Err(err) = &res { - dbg!(&err); - log::error!("RAW ERRROR: {:?}", err); - let err_str = err.to_string(); - log::error!("ERROR IMPORTING: {}", err_str); - } - res + self.inner.import_block(params, cache).await } } diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index ce32cfe804f..7f56e8f7d67 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -26,7 +26,7 @@ use cumulus_test_client::{ use futures::{channel::mpsc, executor::block_on, select, FutureExt, Stream, StreamExt}; use futures_timer::Delay; use polkadot_primitives::v2::Id as ParaId; -use sc_client_api::UsageProvider; +use sc_client_api::{Backend as _, UsageProvider}; use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy}; use sp_blockchain::Error as ClientError; use sp_consensus::BlockOrigin; @@ -380,14 +380,9 @@ fn prune_blocks_on_leaves_overflow() { const TIMESTAMP_MULTIPLIER: u64 = 60000; let backend = Arc::new(Backend::new_test(1000, 1)); - { - let mut mtx = BACKEND.lock().unwrap(); - *mtx = Some(backend.clone()); - } let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); - // TODO: maybe we have to pass a weak ref let mut para_import = ParachainBlockImport::new( client.clone(), backend.clone(), @@ -395,9 +390,9 @@ fn prune_blocks_on_leaves_overflow() { ); let root_block = build_and_import_block(client.clone(), true); - let _num = root_block.header.number(); - let root_id = BlockId::Hash(root_block.header.hash()); + let root_id = BlockId::Number(*root_block.header.number()); + // Here we are using the timestamp value to generate blocks with different hashes. let blocks = (0..LEVEL_LIMIT) .into_iter() .map(|i| { @@ -411,103 +406,23 @@ fn prune_blocks_on_leaves_overflow() { }) .collect::>(); - let _ = dbg!(&blocks.iter().map(|b| b.header.hash()).collect::>()); - - let leaves = backend.blockchain().leaves(); - let _ = dbg!(&leaves); - - { - let builder = client.init_block_builder_with_timestamp( - &root_id, - None, - Default::default(), - LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER, - ); - - let block = builder.build().unwrap().block; - let (header, body) = block.clone().deconstruct(); + let leaves = backend.blockchain().leaves().unwrap(); + let mut expected = blocks.iter().map(|b| b.header.hash()).collect::>(); - let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header); - block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(false)); - block_import_params.body = Some(body); + assert_eq!(leaves.len(), LEVEL_LIMIT); + assert_eq!(leaves, expected); - block_on(para_import.import_block(block_import_params, Default::default())).unwrap(); - } - - let leaves = backend.blockchain().leaves(); - let _ = dbg!(&leaves); -} - -// ========= START TEMPORARY HACK ========= - -use std::sync::Mutex as StdMutex; - -lazy_static::lazy_static! { - static ref BACKEND: StdMutex>> = StdMutex::new(None); -} -use sc_client_api::{ - backend::Backend as _, - blockchain::{Backend as _, HeaderBackend as _}, -}; - -#[no_mangle] -pub fn check_leaves(number: u32, level_limit: usize) { - let lock = BACKEND.lock().unwrap(); - let backend = lock.as_ref().expect("Backend should be already initialized"); - let blockchain = backend.blockchain(); - - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); - - // Interface contract: results are ordered best (longest, highest) chain first. - let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - - // TODO: Just debugging - for leaf in leaves.iter() { - let number = match blockchain.number(*leaf).ok().flatten() { - Some(n) => n, - None => { - let msg = format!("Unexpected missing number for leaf {}", leaf); - panic!("{}", msg); - }, - }; - log::debug!(target: "parachain", ">>> (@{}) : {}", number, leaf); - } - - // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() >= level_limit { - // Now focus on the leaves at the given height. - leaves.retain(|hash| { - blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - }); - if leaves.len() < level_limit { - return - } - - // TODO: double check - let mut remove_count = (leaves.len() + 1) - level_limit; - - // TODO: Better strategy - let best = blockchain.info().best_hash; - - // TODO: here we strongly assume that the leaves returned by the backend are returned - // by "age". This is actually true in our backend implementation... - // We can add a constraint to the leaves() method signature. - for hash in leaves.into_iter().filter(|hash| *hash != best) { - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); - if backend.remove_leaf_block(&hash).is_err() { - log::warn!(target: "parachain", "Unable to remove block {}", hash); - continue - } - remove_count -= 1; - if remove_count == 0 { - break - } - } + let block = build_and_import_block_ext( + &*client, + false, + &mut para_import, + Some(root_id), + Some(LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER), + ); - let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); - } + let leaves = backend.blockchain().leaves().unwrap(); + expected.remove(0); + expected.push(block.header.hash()); + assert_eq!(leaves.len(), LEVEL_LIMIT); + assert_eq!(leaves, expected); } - -// ========= END TEMPORARY HACK ========= diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index 1e3943abe20..f266da2f9c0 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -85,9 +85,6 @@ cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" } cumulus-relay-chain-inprocess-interface = { path = "../client/relay-chain-inprocess-interface" } cumulus-relay-chain-rpc-interface = { path = "../client/relay-chain-rpc-interface" } -# Temporary -lazy_static = "1.4.0" - [build-dependencies] substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } From e811887c0b2e031b08a130181c9a9acf073e8d40 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 15:25:39 +0200 Subject: [PATCH 07/59] Nitpicks --- client/consensus/aura/src/import_queue.rs | 4 ++-- client/consensus/aura/src/lib.rs | 6 +++--- client/consensus/common/src/lib.rs | 2 +- parachain-template/node/src/service.rs | 2 +- polkadot-parachain/src/service.rs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 09c932bee81..7a303922c0c 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -17,7 +17,7 @@ //! Parachain specific wrapper for the AuRa import queue. use codec::Codec; -use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider}; +use sc_client_api::{backend::AuxStore, Backend, BlockOf, UsageProvider}; use sc_consensus::{import_queue::DefaultImportQueue, BlockImport}; use sc_consensus_aura::AuraVerifier; use sc_consensus_slots::InherentDataProviderExt; @@ -88,7 +88,7 @@ where CAW: CanAuthorWith + Send + Sync + 'static, CIDP: CreateInherentDataProviders + Sync + Send + 'static, CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, - BE: sc_client_api::Backend + 'static, + BE: Backend + 'static, { use cumulus_client_consensus_common::{LeavesLevelLimit, ParachainBlockImport}; diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index 7cc93fbcc2e..3a3b8d3378e 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -84,7 +84,6 @@ where create_inherent_data_providers, block_import, para_client, - backend, backoff_authoring_blocks, sync_oracle, keystore, @@ -93,13 +92,13 @@ where telemetry, block_proposal_slot_portion, max_block_proposal_slot_portion, + backend, }: BuildAuraConsensusParams, ) -> Box> where Client: ProvideRuntimeApi + BlockOf + AuxStore + HeaderBackend + Send + Sync + 'static, Client::Api: AuraApi, - BE: Backend + 'static, BI: BlockImport> + Send + Sync + 'static, SO: SyncOracle + Send + Sync + Clone + 'static, BS: BackoffAuthoringBlocksStrategy> + Send + Sync + 'static, @@ -115,6 +114,7 @@ where P: Pair + Send + Sync, P::Public: AppPublic + Hash + Member + Encode + Decode, P::Signature: TryFrom> + Hash + Member + Encode + Decode, + BE: Backend + 'static, { let worker = sc_consensus_aura::build_aura_worker::( BuildAuraWorkerParams { @@ -230,7 +230,6 @@ pub struct BuildAuraConsensusParams { pub create_inherent_data_providers: CIDP, pub block_import: BI, pub para_client: Arc, - pub backend: Arc, pub backoff_authoring_blocks: Option, pub sync_oracle: SO, pub keystore: SyncCryptoStorePtr, @@ -239,4 +238,5 @@ pub struct BuildAuraConsensusParams { pub telemetry: Option, pub block_proposal_slot_portion: SlotProportion, pub max_block_proposal_slot_portion: Option, + pub backend: Arc, } diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index ff1eabae47a..2a540868c59 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -35,7 +35,7 @@ pub use parachain_consensus::run_parachain_consensus; /// Note that this value may change in the future. pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 3; -/// Uppere bound to the number of leaves held by each chain level. +/// Upper bound for the number of leaves allowed for each chain level. /// /// The a limit is set and more leaves are detected on block import, then the older ones are /// eventually dropped to make space for more fresh blocks. diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index 2c84bb75503..0128f98fd85 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -533,7 +533,6 @@ pub async fn start_parachain_node( }, block_import: client.clone(), para_client: client, - backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -544,6 +543,7 @@ pub async fn start_parachain_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, + backend, }), ) }, diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 58b32e76883..a7ee4fa8269 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -855,7 +855,6 @@ pub async fn start_rococo_parachain_node( }, block_import: client.clone(), para_client: client, - backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -866,6 +865,7 @@ pub async fn start_rococo_parachain_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, + backend, }), ) }, @@ -1293,7 +1293,6 @@ where }, block_import: client2.clone(), para_client: client2.clone(), - backend: backend2.clone(), backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -1304,6 +1303,7 @@ where // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry: telemetry2, + backend: backend2, }, ) }))); @@ -1701,7 +1701,6 @@ pub async fn start_contracts_rococo_node( }, block_import: client.clone(), para_client: client, - backend, backoff_authoring_blocks: Option::<()>::None, sync_oracle, keystore, @@ -1712,6 +1711,7 @@ pub async fn start_contracts_rococo_node( // And a maximum of 750ms if slots are skipped max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), telemetry, + backend, }), ) }, From be75d7b591e8dfd79ad77402089916b3ea7c5dd6 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 15:56:49 +0200 Subject: [PATCH 08/59] Removed debug logs --- Cargo.lock | 3 --- client/consensus/common/Cargo.toml | 4 +--- client/consensus/common/src/lib.rs | 30 +++++++----------------------- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f14caef855b..592c085f04b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1536,7 +1536,6 @@ dependencies = [ "dyn-clone", "futures", "futures-timer", - "lazy_static", "log", "parity-scale-codec", "polkadot-primitives", @@ -1545,7 +1544,6 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", - "sp-core", "sp-runtime", "sp-tracing", "sp-trie", @@ -7645,7 +7643,6 @@ dependencies = [ "futures", "hex-literal", "jsonrpsee", - "lazy_static", "log", "nix 0.24.2", "pallet-contracts-rpc", diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index d1b0458de6a..b1d1ade9b30 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -11,6 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "deriv dyn-clone = "1.0.9" futures = "0.3.21" tracing = "0.1.36" +log = "0.4.17" # Substrate sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -27,9 +28,6 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = # Cumulus cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } -# TEMPORARY (REMOVE THIS) -log = "0.4.17" - [dev-dependencies] futures-timer = "3.0.2" diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 2a540868c59..cbdd2dcf2ec 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -145,25 +145,10 @@ where cache: std::collections::HashMap>, ) -> Result { let number = params.header.number(); - let hash = params.header.hash(); - log::debug!(target: "parachain", ">>>>>>>>>>>>>> Importing block {:?} @ {}", hash, number); let check_leaves = |level_limit| { let blockchain = self.backend.blockchain(); - - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> BLOCK Number: {}", number); - - // Interface contract: results are ordered best (longest, highest) chain first. - let mut leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number: {}", leaves.len()); - - // TODO: Just debugging - for leaf in leaves.iter() { - match blockchain.number(*leaf).ok().flatten() { - Some(n) => log::debug!(target: "parachain", ">>> (@{}) : {}", n, leaf), - None => panic!("Unexpected missing number for leaf {}", leaf), - }; - } + let mut leaves = blockchain.leaves().unwrap_or_default(); // First cheap check: the number of leaves at level `number` is always less than the total. if leaves.len() < level_limit { @@ -183,17 +168,19 @@ where return } - let best = blockchain.info().best_hash; + log::debug!(target: "parachain", "Detected leaves overflow, removing old blocks"); // TODO: here we assuming that the leaves returned by the backend are sorted // by "age" with younger leaves in the back. // This is true in our backend implementation, we can add a constraint to the - // leaves() method signature. + // Backend trait leaves() method signature. + + let best = blockchain.info().best_hash; let mut remove_count = (leaves.len() + 1) - level_limit; + for hash in leaves.into_iter().filter(|hash| *hash != best) { - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Removing block: {}", hash); if self.backend.remove_leaf_block(&hash).is_err() { - log::warn!(target: "parachain", "Unable to remove block {}", hash); + log::warn!(target: "parachain", "Unable to remove block {}, skipping it...", hash); continue } remove_count -= 1; @@ -201,9 +188,6 @@ where break } } - - let leaves = blockchain.leaves().expect("Error fetching leaves from backend"); - log::debug!(target: "parachain", ">>>>>>>>>>>>>>>>>>>>> Leaves Number (post-del): {}", leaves.len()); }; if let Some(limit) = self.level_leaves_max { From bd8852bc6b1337ab373a1e2ea967fb47fc119ec8 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 16:24:57 +0200 Subject: [PATCH 09/59] Adjust leaves per level default value to be equal to the substrate backend value --- client/consensus/common/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index cbdd2dcf2ec..5ced1f744e8 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -33,7 +33,7 @@ pub use parachain_consensus::run_parachain_consensus; /// Value good enough to be use on parachains under the current backend implementation. /// Note that this value may change in the future. -pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 3; +pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; /// Upper bound for the number of leaves allowed for each chain level. /// From 5b299dd1d007722a48fa946d957e209a0df24250 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 12 Aug 2022 16:45:48 +0200 Subject: [PATCH 10/59] Better docs --- client/consensus/common/src/lib.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 5ced1f744e8..b8540575e76 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -31,19 +31,18 @@ mod tests; pub use parachain_consensus::run_parachain_consensus; -/// Value good enough to be use on parachains under the current backend implementation. -/// Note that this value may change in the future. +/// Value good enough to be used with parachains using the current backend implementation +/// that ships with Substrate. This value may change in the future. pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; -/// Upper bound for the number of leaves allowed for each chain level. +/// Upper bound to the number of leaves allowed for each level of the blockchain. /// -/// The a limit is set and more leaves are detected on block import, then the older ones are -/// eventually dropped to make space for more fresh blocks. +/// If the limit is set and more leaves are detected on block import, then the older ones are +/// dropped to make space for the fresh blocks. /// -/// In environments where blocks confirmations from the relay chain are "slow", then +/// In environments where blocks confirmations from the relay chain may be "slow", then /// setting an upper bound helps keeping the chain health by dropping old (presumably) stale -/// leaves and prevents discarding new fresh blocks because we've reached the backend max value -/// according to the backend implementation. +/// leaves and prevents discarding new blocks because we've reached the backend max value. pub enum LeavesLevelLimit { /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. Default, @@ -170,11 +169,6 @@ where log::debug!(target: "parachain", "Detected leaves overflow, removing old blocks"); - // TODO: here we assuming that the leaves returned by the backend are sorted - // by "age" with younger leaves in the back. - // This is true in our backend implementation, we can add a constraint to the - // Backend trait leaves() method signature. - let best = blockchain.info().best_hash; let mut remove_count = (leaves.len() + 1) - level_limit; From 6e3cef9e61900f0a8417d14fae78cc4d2833aa9e Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 19 Aug 2022 16:30:23 +0200 Subject: [PATCH 11/59] Don't rely on the backend implementation order for the leaves --- Cargo.lock | 1805 +++++++++++------------ client/consensus/common/src/lib.rs | 87 +- client/consensus/relay-chain/src/lib.rs | 10 +- 3 files changed, 921 insertions(+), 981 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 592c085f04b..710f4a4bab9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", ] [[package]] @@ -68,7 +68,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", "once_cell", "version_check", ] @@ -88,6 +88,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" +[[package]] +name = "android_system_properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" +dependencies = [ + "libc", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -99,15 +108,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.51" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" +checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" [[package]] name = "approx" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" dependencies = [ "num-traits", ] @@ -196,9 +205,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ "concurrent-queue", "event-listener", @@ -221,14 +230,14 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +checksum = "5262ed948da60dd8956c6c5aca4d4163593dddb7b32d73267c93dab7b2e98940" dependencies = [ "async-channel", "async-executor", "async-io", - "async-mutex", + "async-lock", "blocking", "futures-lite", "num_cpus", @@ -237,10 +246,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +checksum = "0ab006897723d9352f63e2b13047177c3982d8d79709d713ce7747a8f19fd1b0" dependencies = [ + "autocfg", "concurrent-queue", "futures-lite", "libc", @@ -256,27 +266,18 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" dependencies = [ "event-listener", ] [[package]] name = "async-process" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" +checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" dependencies = [ "async-io", "blocking", @@ -291,9 +292,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", "async-channel", @@ -310,7 +311,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite 0.2.9", "pin-utils", @@ -335,9 +335,9 @@ dependencies = [ [[package]] name = "async-task" -version = "4.0.3" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" @@ -382,9 +382,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backoff" @@ -393,7 +393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", - "getrandom 0.2.3", + "getrandom 0.2.7", "instant", "pin-project-lite 0.2.9", "rand 0.8.5", @@ -402,24 +402,24 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.27.1", + "object 0.29.0", "rustc-demangle", ] [[package]] name = "base-x" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base16ct" @@ -441,9 +441,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "beef" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed554bd50246729a1ec158d08aa3235d1b69d94ad120ebe187e28894787e736" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" dependencies = [ "serde", ] @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "beefy-primitives", @@ -487,7 +487,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -507,7 +507,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "beefy-primitives", "sp-api", @@ -516,7 +516,7 @@ dependencies = [ [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -529,9 +529,9 @@ dependencies = [ [[package]] name = "bimap" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ae17cabbc8a38a1e3e4c1a6a664e9a09672dc14d0896fa8d865d3a5a446b07" +checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" [[package]] name = "bincode" @@ -569,9 +569,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitvec" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1489fcb93a5bb47da0462ca93ad252ad6af2145cce58d10d46a83931ba9f016b" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", @@ -581,9 +581,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94ba84325db59637ffc528bbe8c7f86c02c57cff5c0e2b9b00f9a851f42f309" +checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ "digest 0.10.3", ] @@ -653,16 +653,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding 0.2.1", - "generic-array 0.14.4", + "generic-array 0.14.6", ] [[package]] name = "block-buffer" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", ] [[package]] @@ -682,9 +682,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427" +checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" dependencies = [ "async-channel", "async-task", @@ -732,15 +732,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "byte-slice-cast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d30c751592b77c499e7bce34d99d67c2c11bdc0574e9a488ddade14150a4698" +checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" [[package]] name = "byte-tools" @@ -773,15 +773,15 @@ dependencies = [ [[package]] name = "cache-padded" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "camino" -version = "1.0.5" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d74260d9bf6944e2208aa46841b4b8f0d7ffc0849a06837b2f510337f86b2b" +checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" dependencies = [ "serde", ] @@ -803,20 +803,11 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.4", + "semver 1.0.13", "serde", "serde_json", ] -[[package]] -name = "cast" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version 0.4.0", -] - [[package]] name = "cast" version = "0.3.0" @@ -825,9 +816,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -861,9 +852,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chacha20" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" +checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if 1.0.0", "cipher", @@ -873,9 +864,9 @@ dependencies = [ [[package]] name = "chacha20poly1305" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b84ed6d1d5f7aa9bdde921a5090e0ca4d934d250ea3b402a5fab3a994e28a2a" +checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ "aead", "chacha20", @@ -886,22 +877,24 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" dependencies = [ - "libc", + "iana-time-zone", + "js-sys", "num-integer", "num-traits", "time", + "wasm-bindgen", "winapi", ] [[package]] name = "cid" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52cffa791ce5cf490ac3b2d6df970dc04f931b04e727be3c3e220e17164dfc4" +checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase", @@ -916,7 +909,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", ] [[package]] @@ -930,13 +923,13 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.3.0" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", - "libloading 0.7.2", + "libloading 0.7.3", ] [[package]] @@ -952,9 +945,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.16" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9" +checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b" dependencies = [ "atty", "bitflags", @@ -969,9 +962,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.15" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4" +checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa" dependencies = [ "heck", "proc-macro-error", @@ -982,9 +975,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] @@ -1023,9 +1016,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" dependencies = [ "cache-padded", ] @@ -1116,9 +1109,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -1150,9 +1143,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "1079fb8528d9f9c888b1e8aa651e6e079ade467323d58f75faf1d30b1808f540" dependencies = [ "libc", ] @@ -1210,9 +1203,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.85.1" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace74eeca11c439a9d4ed1a5cb9df31a54cd0f7fbddf82c8ce4ea8e9ad2a8fe0" +checksum = "dba69c9980d5ffd62c18a2bde927855fcd7c8dc92f29feaf8636052662cbd99c" dependencies = [ "cranelift-codegen", "log", @@ -1228,9 +1221,9 @@ checksum = "d2920dc1e05cac40304456ed3301fde2c09bd6a9b0210bcfa2f101398d628d5b" [[package]] name = "cranelift-native" -version = "0.85.1" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dadcfb7852900780d37102bce5698bcd401736403f07b52e714ff7a180e0e22f" +checksum = "f04dfa45f9b2a6f587c564d6b63388e00cd6589d2df6ea2758cf79e1a13285e6" dependencies = [ "cranelift-codegen", "libc", @@ -1239,9 +1232,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.85.1" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e3410960389110b88f97776f39f6d2c8becdaa4cd59e390e6b76d9d0e7190" +checksum = "31a46513ae6f26f3f267d8d75b5373d555fbbd1e68681f348d99df43f747ec54" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1255,9 +1248,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -1269,7 +1262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" dependencies = [ "atty", - "cast 0.3.0", + "cast", "clap 2.34.0", "criterion-plot", "csv", @@ -1292,19 +1285,19 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ - "cast 0.2.7", + "cast", "itertools", ] [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1312,9 +1305,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", @@ -1323,22 +1316,23 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ + "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1346,12 +1340,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] @@ -1366,7 +1360,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", "rand_core 0.6.3", "subtle", "zeroize", @@ -1374,11 +1368,11 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", "typenum", ] @@ -1388,7 +1382,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", "subtle", ] @@ -1398,7 +1392,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", "subtle", ] @@ -1426,9 +1420,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" +checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" dependencies = [ "quote", "syn", @@ -1458,7 +1452,7 @@ dependencies = [ name = "cumulus-client-cli" version = "0.1.0" dependencies = [ - "clap 3.2.16", + "clap 3.2.17", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -2073,7 +2067,7 @@ name = "cumulus-test-service" version = "0.1.0" dependencies = [ "async-trait", - "clap 3.2.16", + "clap 3.2.17", "criterion", "cumulus-client-cli", "cumulus-client-consensus-common", @@ -2251,7 +2245,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", ] [[package]] @@ -2260,7 +2254,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "block-buffer 0.10.0", + "block-buffer 0.10.2", "crypto-common", "subtle", ] @@ -2286,9 +2280,9 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", @@ -2313,7 +2307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" dependencies = [ "byteorder", - "quick-error 1.2.3", + "quick-error", ] [[package]] @@ -2330,9 +2324,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5caaa75cbd2b960ff1e5392d2cfb1f44717fffe12fc1f32b7b5d1267f99732a6" +checksum = "c6053ff46b5639ceb91756a85a4c8914668393a03170efd79c8884a529d80656" [[package]] name = "dyn-clonable" @@ -2375,9 +2369,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.3.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e1069e39f1454367eb2de793ed062fac4c35c2934b76a81d90dd9abcd28816" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" dependencies = [ "signature", ] @@ -2392,15 +2386,29 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.8", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" +dependencies = [ + "curve25519-dalek 3.2.0", + "hex", + "rand_core 0.6.3", + "sha2 0.9.9", + "thiserror", "zeroize", ] [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "elliptic-curve" @@ -2412,7 +2420,7 @@ dependencies = [ "crypto-bigint", "der", "ff", - "generic-array 0.14.4", + "generic-array 0.14.6", "group", "rand_core 0.6.3", "sec1", @@ -2434,9 +2442,9 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3ab37dc79652c9d85f1f7b6070d77d321d2467f5fe7b00d6b7a86c57b092ae" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" dependencies = [ "enumflags2_derive", ] @@ -2454,28 +2462,15 @@ dependencies = [ [[package]] name = "enumn" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052bc8773a98bd051ff37db74a8a25f00e6bfa2cbd03373390c72e9f7afbf344" +checksum = "038b1afa59052df211f9efd58f8b1d84c242935ede1c3dbaed26b018a9e06ae2" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime 1.3.0", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.9.0" @@ -2483,7 +2478,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ "atty", - "humantime 2.1.0", + "humantime", "log", "regex", "termcolor", @@ -2518,9 +2513,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.1" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "exit-future" @@ -2570,9 +2565,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -2613,9 +2608,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2958d04124b9f27f175eaeb9a9f383d026098aa837eadd8ba22c11f13a05b9e" +checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" dependencies = [ "rand_core 0.6.3", "subtle", @@ -2623,24 +2618,24 @@ dependencies = [ [[package]] name = "file-per-thread-logger" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" +checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" dependencies = [ - "env_logger 0.7.1", + "env_logger", "log", ] [[package]] name = "filetime" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", - "winapi", + "windows-sys", ] [[package]] @@ -2673,19 +2668,17 @@ dependencies = [ [[package]] name = "fixedbitset" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if 1.0.0", "crc32fast", - "libc", "libz-sys", "miniz_oxide", ] @@ -2699,7 +2692,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", ] @@ -2717,7 +2710,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -2729,6 +2722,7 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -2739,11 +2733,11 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "Inflector", "chrono", - "clap 3.2.16", + "clap 3.2.17", "comfy-table", "frame-benchmarking", "frame-support", @@ -2790,7 +2784,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2801,7 +2795,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2817,7 +2811,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -2845,7 +2839,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bitflags", "frame-metadata", @@ -2859,6 +2853,7 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", @@ -2875,7 +2870,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2887,7 +2882,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2899,7 +2894,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro2", "quote", @@ -2909,7 +2904,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "log", @@ -2926,7 +2921,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -2941,7 +2936,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "sp-api", @@ -2950,7 +2945,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "sp-api", @@ -2960,9 +2955,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "2.6.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ebd3504ad6116843b8375ad70df74e7bfe83cac77a1f3fe73200c844d43bfe0" +checksum = "64db3e262960f0662f43a6366788d5f10f7f244b8f7d7d987f560baf5ded5c50" [[package]] name = "fs-swap" @@ -3000,9 +2995,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa" dependencies = [ "futures-channel", "futures-core", @@ -3015,9 +3010,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1" dependencies = [ "futures-core", "futures-sink", @@ -3025,15 +3020,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528" dependencies = [ "futures-core", "futures-task", @@ -3043,9 +3038,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" [[package]] name = "futures-lite" @@ -3064,9 +3059,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d" dependencies = [ "proc-macro2", "quote", @@ -3075,9 +3070,9 @@ dependencies = [ [[package]] name = "futures-rustls" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" +checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", "rustls", @@ -3086,15 +3081,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" [[package]] name = "futures-timer" @@ -3104,9 +3099,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" dependencies = [ "futures-channel", "futures-core", @@ -3140,9 +3135,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -3173,13 +3168,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -3194,9 +3189,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", "indexmap", @@ -3211,9 +3206,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" dependencies = [ "aho-corasick", "bstr", @@ -3224,15 +3219,14 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", - "web-sys", ] [[package]] @@ -3248,9 +3242,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ "bytes", "fnv", @@ -3261,7 +3255,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.6.9", + "tokio-util", "tracing", ] @@ -3273,16 +3267,16 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "handlebars" -version = "4.2.2" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d6a30320f094710245150395bc763ad23128d6a1ebbad7594dc4164b62c56b" +checksum = "360d9740069b2f6cbb63ce2dbaa71a20d3185350cbb990d7bebeb9318415eb17" dependencies = [ "log", "pest", "pest_derive", - "quick-error 2.0.1", "serde", "serde_json", + "thiserror", ] [[package]] @@ -3311,9 +3305,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash", ] @@ -3378,7 +3372,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.4", + "generic-array 0.14.6", "hmac 0.8.1", ] @@ -3401,14 +3395,14 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.1", + "itoa 1.0.3", ] [[package]] name = "http-body" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", @@ -3417,9 +3411,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" @@ -3427,15 +3421,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error 1.2.3", -] - [[package]] name = "humantime" version = "2.1.0" @@ -3444,9 +3429,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.16" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ "bytes", "futures-channel", @@ -3457,7 +3442,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.8", + "itoa 1.0.3", "pin-project-lite 0.2.9", "socket2", "tokio", @@ -3481,6 +3466,19 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "iana-time-zone" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi", +] + [[package]] name = "idna" version = "0.2.3" @@ -3504,9 +3502,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8f4a3c3d4c89351ca83e120c1c00b27df945d38e05695668c9d4b4f7bc52f3" +checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" dependencies = [ "async-io", "core-foundation", @@ -3551,12 +3549,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.12.0", + "hashbrown 0.12.3", "serde", ] @@ -3571,9 +3569,9 @@ dependencies = [ [[package]] name = "integer-encoding" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c11140ffea82edce8dcd74137ce9324ec24b3cf0175fc9d7e29164da9915b8" +checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" [[package]] name = "integer-sqrt" @@ -3592,9 +3590,9 @@ checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" [[package]] name = "io-lifetimes" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb" +checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06" [[package]] name = "ip_network" @@ -3616,9 +3614,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itertools" @@ -3637,9 +3635,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jobserver" @@ -3652,9 +3650,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -3690,7 +3688,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls", - "tokio-util 0.7.1", + "tokio-util", "tracing", "webpki-roots", ] @@ -3798,7 +3796,7 @@ dependencies = [ "soketto", "tokio", "tokio-stream", - "tokio-util 0.7.1", + "tokio-util", "tracing", "tracing-futures", ] @@ -3817,14 +3815,14 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "kusama-runtime" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "bitvec", @@ -3917,7 +3915,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "polkadot-primitives", @@ -3988,9 +3986,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libloading" @@ -4004,9 +4002,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if 1.0.0", "winapi", @@ -4014,9 +4012,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.1" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" @@ -4027,7 +4025,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.3", + "getrandom 0.2.7", "instant", "lazy_static", "libp2p-autonat", @@ -4200,7 +4198,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru 0.7.7", + "lru 0.7.8", "prost", "prost-build", "prost-codec", @@ -4550,9 +4548,9 @@ dependencies = [ [[package]] name = "libsecp256k1" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", "base64", @@ -4563,7 +4561,7 @@ dependencies = [ "libsecp256k1-gen-genmult", "rand 0.8.5", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "typenum", ] @@ -4598,9 +4596,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.3" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "pkg-config", @@ -4609,9 +4607,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linked_hash_set" @@ -4646,10 +4644,11 @@ checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] @@ -4674,11 +4673,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e6fe5655adc6ce00787cf7dcaf8dc4f998a0565d23eafc207a8b08ca3349a" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" dependencies = [ - "hashbrown 0.11.2", + "hashbrown 0.12.3", ] [[package]] @@ -4692,9 +4691,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.23.2" +version = "1.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac20ed6991e01bf6a2e68cc73df2b389707403662a8ba89f68511fb340f724c" +checksum = "4edcb94251b1c375c459e5abe9fb0168c1c826c3370172684844f8f3f8d1a885" dependencies = [ "libc", "lz4-sys", @@ -4702,9 +4701,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca79aa95d8b3226213ad454d328369853be3a1382d89532a854f4d69640acae" +checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" dependencies = [ "cc", "libc", @@ -4719,12 +4718,6 @@ dependencies = [ "libc", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "match_cfg" version = "0.1.0" @@ -4757,9 +4750,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" @@ -4781,9 +4774,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.0" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -4804,7 +4797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" dependencies = [ "hash-db", - "hashbrown 0.12.0", + "hashbrown 0.12.3", "parity-util-mem", ] @@ -4854,35 +4847,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", - "autocfg", ] [[package]] name = "mio" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "miow", - "ntapi", "wasi 0.11.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -4922,9 +4903,9 @@ dependencies = [ [[package]] name = "multihash" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3db354f401db558759dfc1e568d010a5d4146f4d3f637be1275ec4a3cf09689" +checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" dependencies = [ "blake2b_simd", "blake2s_simd", @@ -4933,7 +4914,7 @@ dependencies = [ "digest 0.10.3", "multihash-derive", "sha2 0.10.2", - "sha3 0.10.0", + "sha3 0.10.2", "unsigned-varint", ] @@ -4981,7 +4962,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.0", + "num-rational 0.4.1", "num-traits", "rand 0.8.5", "rand_distr", @@ -5029,9 +5010,9 @@ dependencies = [ [[package]] name = "netlink-packet-route" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733ea73609acfd7fa7ddadfb7bf709b0471668c456ad9513685af543a06342b2" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", "bitflags", @@ -5055,23 +5036,24 @@ dependencies = [ [[package]] name = "netlink-proto" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8785b8141e8432aa45fceb922a7e876d7da3fad37fa7e7ec702ace3aa0826b" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ "bytes", "futures", "log", "netlink-packet-core", "netlink-sys", + "thiserror", "tokio", ] [[package]] name = "netlink-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c9f9547a08241bee7b6558b9b98e1f290d187de8b7cfca2bbb4937bcaa8f8" +checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" dependencies = [ "async-io", "bytes", @@ -5080,19 +5062,6 @@ dependencies = [ "log", ] -[[package]] -name = "nix" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset", -] - [[package]] name = "nix" version = "0.24.2" @@ -5119,22 +5088,12 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ "memchr", "minimal-lexical", - "version_check", -] - -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi", ] [[package]] @@ -5150,9 +5109,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ "num-traits", ] @@ -5169,9 +5128,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -5191,9 +5150,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", @@ -5212,9 +5171,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -5222,30 +5181,30 @@ dependencies = [ [[package]] name = "object" -version = "0.27.1" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ + "crc32fast", + "hashbrown 0.11.2", + "indexmap", "memchr", ] [[package]] name = "object" -version = "0.28.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ - "crc32fast", - "hashbrown 0.11.2", - "indexmap", "memchr", ] [[package]] name = "once_cell" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "oorandom" @@ -5267,14 +5226,14 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "dyn-clonable", @@ -5290,7 +5249,7 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "expander 0.0.6", "itertools", @@ -5312,9 +5271,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "owning_ref" @@ -5328,7 +5287,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5345,7 +5304,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5359,7 +5318,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5375,7 +5334,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5391,7 +5350,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5406,7 +5365,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5430,7 +5389,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5450,7 +5409,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5465,7 +5424,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "beefy-primitives", "frame-support", @@ -5481,7 +5440,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -5504,7 +5463,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5522,7 +5481,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5567,7 +5526,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5584,7 +5543,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bitflags", "frame-benchmarking", @@ -5612,7 +5571,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bitflags", "parity-scale-codec", @@ -5627,7 +5586,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro2", "quote", @@ -5637,7 +5596,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "jsonrpsee", "pallet-contracts-primitives", @@ -5654,7 +5613,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -5667,7 +5626,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5683,7 +5642,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5706,7 +5665,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5719,7 +5678,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5737,7 +5696,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5752,7 +5711,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5775,7 +5734,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5791,7 +5750,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5811,7 +5770,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5828,7 +5787,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5845,7 +5804,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5863,7 +5822,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -5878,7 +5837,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5893,7 +5852,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5910,7 +5869,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5929,7 +5888,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "sp-api", @@ -5939,7 +5898,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -5956,7 +5915,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5979,7 +5938,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -5995,7 +5954,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6010,7 +5969,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -6024,7 +5983,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6039,7 +5998,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6055,7 +6014,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -6076,7 +6035,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6092,7 +6051,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -6106,7 +6065,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6129,7 +6088,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6140,7 +6099,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "sp-arithmetic", @@ -6149,7 +6108,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -6178,7 +6137,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6196,7 +6155,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6215,7 +6174,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-support", "frame-system", @@ -6231,7 +6190,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6246,7 +6205,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6257,7 +6216,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6274,7 +6233,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6289,7 +6248,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6305,7 +6264,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6320,7 +6279,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "frame-system", @@ -6338,7 +6297,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6368,7 +6327,7 @@ dependencies = [ name = "parachain-template-node" version = "0.1.0" dependencies = [ - "clap 3.2.16", + "clap 3.2.17", "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-aura", @@ -6576,7 +6535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.12.0", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.12.1", @@ -6635,7 +6594,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.1", + "parking_lot_core 0.9.3", ] [[package]] @@ -6654,22 +6613,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", "smallvec", - "windows-sys 0.32.0", + "windows-sys", ] [[package]] name = "paste" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" [[package]] name = "pbkdf2" @@ -6763,18 +6722,19 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pest" -version = "2.1.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8" dependencies = [ + "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +checksum = "b13570633aff33c6d22ce47dd566b10a3b9122c2fe9d8e7501895905be532b91" dependencies = [ "pest", "pest_generator", @@ -6782,9 +6742,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.1.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +checksum = "b3c567e5702efdc79fb18859ea74c3eb36e14c43da7b8c1f098a4ed6514ec7a0" dependencies = [ "pest", "pest_meta", @@ -6795,20 +6755,20 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.1.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +checksum = "5eb32be5ee3bbdafa8c7a18b0a8a8d962b66cfa2ceee4037f49267a50ee821fe" dependencies = [ - "maplit", + "once_cell", "pest", - "sha-1 0.8.2", + "sha-1 0.10.0", ] [[package]] name = "petgraph" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" dependencies = [ "fixedbitset", "indexmap", @@ -6816,18 +6776,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -6854,9 +6814,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.22" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "platforms" @@ -6866,9 +6826,9 @@ checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" [[package]] name = "plotters" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +checksum = "716b4eeb6c4a1d3ecc956f75b43ec2e8e8ba80026413e70a3f41fd3313d3492b" dependencies = [ "num-traits", "plotters-backend", @@ -6879,15 +6839,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" [[package]] name = "plotters-svg" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" dependencies = [ "plotters-backend", ] @@ -6895,7 +6855,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -6910,7 +6870,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -6924,12 +6884,12 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "derive_more", "fatality", "futures", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6947,11 +6907,11 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "fatality", "futures", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6968,9 +6928,9 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ - "clap 3.2.16", + "clap 3.2.17", "frame-benchmarking-cli", "futures", "log", @@ -6994,7 +6954,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "frame-benchmarking", @@ -7034,7 +6994,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "always-assert", "fatality", @@ -7055,7 +7015,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -7068,12 +7028,12 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "derive_more", "fatality", "futures", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -7091,7 +7051,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -7105,7 +7065,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "futures-timer", @@ -7125,7 +7085,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "always-assert", "async-trait", @@ -7149,7 +7109,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "parity-scale-codec", @@ -7167,14 +7127,14 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitvec", "derive_more", "futures", "futures-timer", "kvdb", - "lru 0.7.7", + "lru 0.7.8", "merlin", "parity-scale-codec", "polkadot-node-jaeger", @@ -7196,7 +7156,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitvec", "futures", @@ -7216,7 +7176,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitvec", "fatality", @@ -7235,7 +7195,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7250,7 +7210,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "futures", @@ -7268,7 +7228,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7283,7 +7243,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "futures-timer", @@ -7300,12 +7260,12 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "fatality", "futures", "kvdb", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -7319,7 +7279,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "futures", @@ -7336,7 +7296,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitvec", "fatality", @@ -7354,7 +7314,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "always-assert", "assert_matches", @@ -7386,7 +7346,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "polkadot-node-primitives", @@ -7402,7 +7362,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "futures", "memory-lru", @@ -7418,7 +7378,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-std", "lazy_static", @@ -7436,7 +7396,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bs58", "futures", @@ -7455,12 +7415,13 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "derive_more", "fatality", "futures", + "hex", "parity-scale-codec", "polkadot-node-jaeger", "polkadot-node-primitives", @@ -7476,7 +7437,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bounded-vec", "futures", @@ -7498,7 +7459,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -7508,7 +7469,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "futures", @@ -7526,7 +7487,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "derive_more", @@ -7549,7 +7510,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "derive_more", @@ -7557,7 +7518,7 @@ dependencies = [ "futures", "itertools", "kvdb", - "lru 0.7.7", + "lru 0.7.8", "parity-db", "parity-scale-codec", "parity-util-mem", @@ -7582,12 +7543,12 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "futures", "futures-timer", - "lru 0.7.7", + "lru 0.7.8", "orchestra", "parity-util-mem", "parking_lot 0.12.1", @@ -7605,7 +7566,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "derive_more", "frame-support", @@ -7625,7 +7586,7 @@ version = "0.9.230" dependencies = [ "assert_cmd", "async-trait", - "clap 3.2.16", + "clap 3.2.17", "contracts-rococo-runtime", "cumulus-client-cli", "cumulus-client-consensus-aura", @@ -7644,7 +7605,7 @@ dependencies = [ "hex-literal", "jsonrpsee", "log", - "nix 0.24.2", + "nix", "pallet-contracts-rpc", "pallet-transaction-payment-rpc", "parachains-common", @@ -7701,9 +7662,9 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ - "env_logger 0.9.0", + "env_logger", "kusama-runtime", "log", "polkadot-erasure-coding", @@ -7716,7 +7677,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitvec", "frame-system", @@ -7746,7 +7707,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -7778,7 +7739,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "bitvec", @@ -7810,6 +7771,8 @@ dependencies = [ "pallet-indices", "pallet-membership", "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", "pallet-offences", "pallet-offences-benchmarking", "pallet-preimage", @@ -7863,7 +7826,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "bitvec", @@ -7910,7 +7873,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "polkadot-primitives", @@ -7922,7 +7885,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bs58", "parity-scale-codec", @@ -7934,7 +7897,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "bitflags", "bitvec", @@ -7977,7 +7940,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "async-trait", "beefy-gadget", @@ -7988,7 +7951,7 @@ dependencies = [ "kusama-runtime", "kvdb", "kvdb-rocksdb", - "lru 0.7.7", + "lru 0.7.8", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -8080,7 +8043,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8101,7 +8064,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8111,7 +8074,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -8136,7 +8099,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "bitvec", @@ -8197,7 +8160,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-benchmarking", "frame-system", @@ -8295,9 +8258,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "predicates" @@ -8312,15 +8275,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" +checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" [[package]] name = "predicates-tree" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338c7be2905b732ae3984a2f40032b5e94fd8f52505b186c7d4d68d193445df7" +checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" dependencies = [ "predicates-core", "termtree", @@ -8342,7 +8305,7 @@ dependencies = [ [[package]] name = "prioritized-metered-channel" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "coarsetime", "crossbeam-queue", @@ -8356,10 +8319,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ + "once_cell", "thiserror", "toml", ] @@ -8390,24 +8354,24 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ "unicode-ident", ] [[package]] name = "prometheus" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f64969ffd5dd8f39bd57a68ac53c163a095ed9d0fb707146da1b27025a3504" +checksum = "cface98dfa6d645ea4c789839f176e4b072265d085bfcc48eaa8d137f58d3c39" dependencies = [ "cfg-if 1.0.0", "fnv", "lazy_static", "memchr", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "thiserror", ] @@ -8418,7 +8382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" dependencies = [ "dtoa", - "itoa 1.0.1", + "itoa 1.0.3", "owning_ref", "prometheus-client-derive-text-encode", ] @@ -8436,9 +8400,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc03e116981ff7d8da8e5c220e374587b98d294af7ba7dd7fda761158f00086f" +checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes", "prost-derive", @@ -8504,9 +8468,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.16" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd136ff4382c4753fc061cb9e4712ab2af263376b95bbd5bd8cd50c020b78e69" +checksum = "f446d0a6efba22928558c4fb4ce0b3fd6c89b0061343e390bf01a703742b8125" dependencies = [ "cc", ] @@ -8517,12 +8481,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quicksink" version = "0.1.2" @@ -8536,9 +8494,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -8609,14 +8567,14 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", ] [[package]] name = "rand_distr" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964d548f8e7d12e102ef183a0de7e98180c9f8729f555897a857b96e48122d2f" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", "rand 0.8.5", @@ -8657,9 +8615,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -8669,34 +8627,34 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", "redox_syscall", + "thiserror", ] [[package]] @@ -8714,18 +8672,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "ed13bcd201494ab44900a96490291651d200730904221832b9547d24a87d332b" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" dependencies = [ "proc-macro2", "quote", @@ -8746,9 +8704,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.5" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -8766,9 +8724,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "region" @@ -8785,9 +8743,9 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ - "env_logger 0.9.0", + "env_logger", "jsonrpsee", "log", "parity-scale-codec", @@ -8815,7 +8773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", - "quick-error 1.2.3", + "quick-error", ] [[package]] @@ -8907,7 +8865,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -8976,7 +8934,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "polkadot-primitives", @@ -8987,9 +8945,9 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680" dependencies = [ "libc", "winapi", @@ -8997,16 +8955,16 @@ dependencies = [ [[package]] name = "rtnetlink" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f54290e54521dac3de4149d83ddf9f62a359b3cc93bcb494a794a41e6f4744b" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ "async-global-executor", "futures", "log", "netlink-packet-route", "netlink-proto", - "nix 0.22.3", + "nix", "thiserror", ] @@ -9043,7 +9001,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.4", + "semver 1.0.13", ] [[package]] @@ -9062,23 +9020,23 @@ dependencies = [ [[package]] name = "rustix" -version = "0.35.7" +version = "0.35.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51cc38aa10f6bbb377ed28197aa052aa4e2b762c22be9d3153d01822587e787" +checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.7.2", + "io-lifetimes 0.7.3", "libc", "linux-raw-sys 0.0.46", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] name = "rustls" -version = "0.20.2" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" +checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" dependencies = [ "log", "ring", @@ -9088,9 +9046,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca9ebdfa27d3fc180e42879037b5338ab1c040c06affd00d8338598e7800943" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -9100,18 +9058,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.2.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ "base64", ] [[package]] name = "rustversion" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "rw-stream-sink" @@ -9126,9 +9084,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "safe-mix" @@ -9160,7 +9118,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "sp-core", @@ -9171,7 +9129,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "futures-timer", @@ -9198,7 +9156,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "futures-timer", @@ -9221,7 +9179,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9237,10 +9195,10 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "impl-trait-for-tuples", - "memmap2 0.5.0", + "memmap2 0.5.7", "parity-scale-codec", "sc-chain-spec-derive", "sc-network", @@ -9254,7 +9212,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9265,10 +9223,10 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "chrono", - "clap 3.2.16", + "clap 3.2.17", "fdlimit", "futures", "hex", @@ -9304,7 +9262,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "fnv", "futures", @@ -9332,7 +9290,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "hash-db", "kvdb", @@ -9357,7 +9315,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -9381,7 +9339,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -9410,7 +9368,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "fork-tree", @@ -9452,7 +9410,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "jsonrpsee", @@ -9474,7 +9432,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9487,7 +9445,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -9512,10 +9470,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "lazy_static", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -9539,14 +9497,13 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "environmental", "parity-scale-codec", "sc-allocator", "sp-maybe-compressed-blob", "sp-sandbox", - "sp-serializer", "sp-wasm-interface", "thiserror", "wasm-instrument", @@ -9556,7 +9513,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "parity-scale-codec", @@ -9571,7 +9528,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "cfg-if 1.0.0", "libc", @@ -9579,7 +9536,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parity-wasm 0.42.2", - "rustix 0.35.7", + "rustix 0.35.9", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -9591,7 +9548,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ahash", "async-trait", @@ -9632,7 +9589,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "finality-grandpa", "futures", @@ -9653,7 +9610,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ansi_term", "futures", @@ -9670,7 +9627,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "hex", @@ -9685,7 +9642,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "asynchronous-codec", @@ -9703,7 +9660,7 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", @@ -9734,7 +9691,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "bitflags", @@ -9755,14 +9712,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ahash", "futures", "futures-timer", "libp2p", "log", - "lru 0.7.7", + "lru 0.7.8", "sc-network", "sc-network-common", "sp-runtime", @@ -9773,7 +9730,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "hex", @@ -9794,14 +9751,14 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "fork-tree", "futures", "hex", "libp2p", "log", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "prost", "prost-build", @@ -9822,7 +9779,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bytes", "fnv", @@ -9851,7 +9808,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "libp2p", @@ -9864,7 +9821,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -9873,7 +9830,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "hash-db", @@ -9903,7 +9860,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "jsonrpsee", @@ -9926,7 +9883,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "jsonrpsee", @@ -9939,7 +9896,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "directories", @@ -10006,7 +9963,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "parity-scale-codec", @@ -10020,7 +9977,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10039,7 +9996,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "libc", @@ -10058,7 +10015,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "chrono", "futures", @@ -10076,7 +10033,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ansi_term", "atty", @@ -10107,7 +10064,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10118,7 +10075,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "futures-timer", @@ -10144,7 +10101,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "log", @@ -10157,7 +10114,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "futures-timer", @@ -10195,12 +10152,12 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "winapi", + "windows-sys", ] [[package]] @@ -10244,7 +10201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ "der", - "generic-array 0.14.4", + "generic-array 0.14.6", "subtle", "zeroize", ] @@ -10278,9 +10235,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.4.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ "bitflags", "core-foundation", @@ -10291,9 +10248,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -10350,9 +10307,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.4" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" dependencies = [ "serde", ] @@ -10365,9 +10322,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.141" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] @@ -10384,9 +10341,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.141" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -10395,11 +10352,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ - "itoa 1.0.1", + "itoa 1.0.3", "ryu", "serde", ] @@ -10415,27 +10372,26 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] name = "sha-1" -version = "0.9.8" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.3", ] [[package]] @@ -10452,9 +10408,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -10488,9 +10444,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f935e31cf406e8c0e96c2815a5516181b7004ae8c5f296293221e9b1e356bd" +checksum = "0a31480366ec990f395a61b7c08122d99bd40544fdb5abcfc1b06bb29994312c" dependencies = [ "digest 0.10.3", "keccak", @@ -10548,9 +10504,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.10" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" dependencies = [ "libc", "signal-hook-registry", @@ -10589,9 +10545,12 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "slice-group-by" @@ -10602,7 +10561,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "enumn", "parity-scale-codec", @@ -10678,7 +10637,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "hash-db", "log", @@ -10688,6 +10647,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-version", "thiserror", ] @@ -10695,7 +10655,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "blake2", "proc-macro-crate", @@ -10707,7 +10667,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -10720,7 +10680,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "integer-sqrt", "num-traits", @@ -10735,7 +10695,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -10748,7 +10708,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "parity-scale-codec", @@ -10760,7 +10720,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "sp-api", @@ -10772,11 +10732,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "log", - "lru 0.7.7", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -10790,7 +10750,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -10809,7 +10769,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "parity-scale-codec", @@ -10827,7 +10787,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "merlin", @@ -10850,7 +10810,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -10864,7 +10824,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -10877,14 +10837,14 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "base58", "bitflags", "blake2-rfc", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", @@ -10923,13 +10883,13 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "blake2", "byteorder", "digest 0.10.3", "sha2 0.10.2", - "sha3 0.10.0", + "sha3 0.10.2", "sp-std", "twox-hash", ] @@ -10937,7 +10897,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro2", "quote", @@ -10948,7 +10908,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -10957,7 +10917,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro2", "quote", @@ -10967,7 +10927,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "environmental", "parity-scale-codec", @@ -10978,7 +10938,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "finality-grandpa", "log", @@ -10996,7 +10956,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11010,7 +10970,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bytes", "futures", @@ -11036,7 +10996,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "lazy_static", "sp-core", @@ -11047,7 +11007,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -11064,7 +11024,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "thiserror", "zstd", @@ -11073,7 +11033,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "parity-scale-codec", @@ -11088,7 +11048,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -11102,7 +11062,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "sp-api", "sp-core", @@ -11112,7 +11072,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "backtrace", "lazy_static", @@ -11122,7 +11082,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "rustc-hash", "serde", @@ -11132,7 +11092,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "either", "hash256-std-hasher", @@ -11154,7 +11114,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11172,7 +11132,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "Inflector", "proc-macro-crate", @@ -11184,7 +11144,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "parity-scale-codec", @@ -11195,19 +11155,10 @@ dependencies = [ "wasmi", ] -[[package]] -name = "sp-serializer" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -11221,7 +11172,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -11232,7 +11183,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "hash-db", "log", @@ -11254,12 +11205,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11272,7 +11223,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "log", "sp-core", @@ -11285,7 +11236,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures-timer", @@ -11301,7 +11252,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "sp-std", @@ -11313,7 +11264,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "sp-api", "sp-runtime", @@ -11322,7 +11273,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "log", @@ -11338,15 +11289,22 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ + "ahash", "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "lru 0.7.8", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot 0.12.1", "scale-info", "sp-core", "sp-std", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -11354,7 +11312,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11371,7 +11329,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11382,7 +11340,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "impl-trait-for-tuples", "log", @@ -11400,9 +11358,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.18.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceb8b72a924ccfe7882d0e26144c114503760a4d1248bb5cd06c8ab2d55404cc" +checksum = "a039906277e0d8db996cd9d1ef19278c10209d994ecfc1025ced16342873a17c" dependencies = [ "Inflector", "num-format", @@ -11614,9 +11572,9 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.24.0" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6878079b17446e4d3eba6192bb0a2950d5b14f0ed8424b852310e5a94345d0ef" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck", "proc-macro2", @@ -11634,14 +11592,14 @@ dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", "schnorrkel", - "sha2 0.9.8", + "sha2 0.9.9", "zeroize", ] [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "platforms", ] @@ -11649,7 +11607,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -11670,7 +11628,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures-util", "hyper", @@ -11683,7 +11641,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "jsonrpsee", "log", @@ -11704,7 +11662,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "async-trait", "futures", @@ -11730,7 +11688,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "futures", "substrate-test-utils-derive", @@ -11740,7 +11698,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11751,7 +11709,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ "ansi_term", "build-helper", @@ -11773,9 +11731,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", @@ -11823,9 +11781,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bffcddbc2458fa3e6058414599e3c838a022abae82e5c67b4f7f80298d5bff" +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "tempfile" @@ -11843,23 +11801,23 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] [[package]] name = "termtree" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" +checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" [[package]] name = "test-runtime-constants" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "polkadot-primitives", @@ -11885,18 +11843,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -11974,7 +11932,7 @@ dependencies = [ "pbkdf2 0.4.0", "rand 0.7.3", "rustc-hash", - "sha2 0.9.8", + "sha2 0.9.9", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -11993,9 +11951,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -12008,10 +11966,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.19.2" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" dependencies = [ + "autocfg", "bytes", "libc", "memchr", @@ -12028,9 +11987,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -12039,9 +11998,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.2" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ "rustls", "tokio", @@ -12061,23 +12020,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.2.9", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", @@ -12085,6 +12030,7 @@ dependencies = [ "futures-sink", "pin-project-lite 0.2.9", "tokio", + "tracing", ] [[package]] @@ -12098,9 +12044,9 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -12148,7 +12094,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12159,7 +12105,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12181,9 +12127,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -12214,12 +12160,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown 0.12.0", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -12286,9 +12232,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#fece0657f20e15df94be5833b164dfacd44823eb" +source = "git+https://github.com/paritytech/substrate?branch=master#b7d2cb5c2dbfbc49cb3c06f6198daa60b04f16c0" dependencies = [ - "clap 3.2.16", + "clap 3.2.17", "jsonrpsee", "log", "parity-scale-codec", @@ -12328,21 +12274,21 @@ dependencies = [ [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" [[package]] name = "uint" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" +checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" dependencies = [ "byteorder", "crunchy", @@ -12361,21 +12307,21 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -12388,9 +12334,9 @@ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "universal-hash" @@ -12398,7 +12344,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.6", "subtle", ] @@ -12456,9 +12402,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -12522,9 +12468,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -12532,13 +12478,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -12547,9 +12493,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -12559,9 +12505,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -12569,9 +12515,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", @@ -12582,9 +12528,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "wasm-gc-api" @@ -12657,9 +12603,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e76e2b2833bb0ece666ccdbed7b71b617d447da11f1bb61f4f2bab2648f745ee" +checksum = "1f50eadf868ab6a04b7b511460233377d0bfbb92e417b2f6a98b98fef2e098f5" dependencies = [ "anyhow", "backtrace", @@ -12688,9 +12634,9 @@ dependencies = [ [[package]] name = "wasmtime-cache" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743a9f142d93318262d7e1fe329394ff2e8f86a1df45ae5e4f0eedba215ca5ce" +checksum = "d1df23c642e1376892f3b72f311596976979cbf8b85469680cdd3a8a063d12a2" dependencies = [ "anyhow", "base64", @@ -12700,7 +12646,7 @@ dependencies = [ "log", "rustix 0.33.7", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "toml", "winapi", "zstd", @@ -12708,9 +12654,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc0f80afa1ce97083a7168e6b6948d015d6237369e9f4a511d38c9c4ac8fbb9" +checksum = "f264ff6b4df247d15584f2f53d009fbc90032cfdc2605b52b961bffc71b6eccd" dependencies = [ "anyhow", "cranelift-codegen", @@ -12730,9 +12676,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0816d9365196f1f447060087e0f87239ccded830bd54970a1168b0c9c8e824c9" +checksum = "839d2820e4b830f4b9e7aa08d4c0acabf4a5036105d639f6dfa1c6891c73bdc6" dependencies = [ "anyhow", "cranelift-entity", @@ -12750,9 +12696,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c687f33cfa0f89ec1646929d0ff102087052cf9f0d15533de56526b0da0d1b3" +checksum = "ef0a0bcbfa18b946d890078ba0e1bc76bcc53eccfb40806c0020ec29dcd1bd49" dependencies = [ "addr2line", "anyhow", @@ -12776,9 +12722,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b252d1d025f94f3954ba2111f12f3a22826a0764a11c150c2d46623115a69e27" +checksum = "4f4779d976206c458edd643d1ac622b6c37e4a0800a8b1d25dfbf245ac2f2cac" dependencies = [ "lazy_static", "object 0.28.4", @@ -12787,9 +12733,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace251693103c9facbbd7df87a29a75e68016e48bc83c09133f2fda6b575e0ab" +checksum = "b7eb6ffa169eb5dcd18ac9473c817358cd57bc62c244622210566d473397954a" dependencies = [ "anyhow", "backtrace", @@ -12813,9 +12759,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "0.38.1" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d129b0487a95986692af8708ffde9c50b0568dcefd79200941d475713b4f40bb" +checksum = "8d932b0ac5336f7308d869703dd225610a6a3aeaa8e968c52b43eed96cefb1c2" dependencies = [ "cranelift-entity", "serde", @@ -12825,9 +12771,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -12845,9 +12791,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.2" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" dependencies = [ "webpki", ] @@ -12864,7 +12810,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "beefy-primitives", "bitvec", @@ -12953,7 +12899,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "polkadot-primitives", @@ -13031,9 +12977,9 @@ dependencies = [ [[package]] name = "which" -version = "4.2.2" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" dependencies = [ "either", "lazy_static", @@ -13079,28 +13025,15 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3" -dependencies = [ - "windows_aarch64_msvc 0.29.0", - "windows_i686_gnu 0.29.0", - "windows_i686_msvc 0.29.0", - "windows_x86_64_gnu 0.29.0", - "windows_x86_64_msvc 0.29.0", -] - -[[package]] -name = "windows-sys" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", ] [[package]] @@ -13118,15 +13051,9 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" [[package]] name = "windows_aarch64_msvc" @@ -13136,15 +13063,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" - -[[package]] -name = "windows_i686_gnu" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" [[package]] name = "windows_i686_gnu" @@ -13154,15 +13075,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" - -[[package]] -name = "windows_i686_msvc" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" [[package]] name = "windows_i686_msvc" @@ -13172,15 +13087,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" [[package]] name = "windows_x86_64_gnu" @@ -13190,15 +13099,9 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.32.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" [[package]] name = "windows_x86_64_msvc" @@ -13238,7 +13141,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "derivative", "impl-trait-for-tuples", @@ -13252,7 +13155,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-support", "frame-system", @@ -13272,7 +13175,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "frame-benchmarking", "frame-support", @@ -13290,7 +13193,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.27" -source = "git+https://github.com/paritytech/polkadot?branch=master#4863d0a33a4a3534236f76abb5b1dc91751c6c34" +source = "git+https://github.com/paritytech/polkadot?branch=master#160bb845e3e3ef209fec15199ac54b755425cce1" dependencies = [ "Inflector", "proc-macro2", @@ -13300,9 +13203,9 @@ dependencies = [ [[package]] name = "yamux" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0608f53c1dc0bad505d03a34bbd49fbf2ad7b51eb036123e896365532745a1" +checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" dependencies = [ "futures", "log", @@ -13314,9 +13217,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" dependencies = [ "zeroize_derive", ] diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index b8540575e76..6d71358db1d 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -20,10 +20,10 @@ use sc_client_api::{ blockchain::{Backend as _, HeaderBackend as _}, Backend, }; -use sc_consensus::BlockImport; -use sp_runtime::traits::{Block as BlockT, Header as _}; +use sc_consensus::{BlockImport, ImportResult}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; -use std::sync::Arc; +use std::{collections::HashMap, sync::Arc}; mod parachain_consensus; #[cfg(test)] @@ -98,31 +98,46 @@ impl ParachainConsensus for Box + Send + } } +type BlockHash = <::Header as HeaderT>::Hash; + +struct LeavesCache { + level_limit: usize, + import_counter: u64, + import_map: HashMap, u64>, +} + /// Parachain specific block import. /// /// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is /// not `NetworkInitialSync`. The best block for parachains is determined by the relay chain. Meaning /// we will update the best block, as it is included by the relay-chain. -pub struct ParachainBlockImport { +pub struct ParachainBlockImport { inner: BI, backend: Arc, - level_leaves_max: Option, + leaves_cache: Option>, } -impl ParachainBlockImport { +impl ParachainBlockImport { /// Create a new instance. pub fn new(inner: BI, backend: Arc, level_leaves_max: LeavesLevelLimit) -> Self { - let level_leaves_max = match level_leaves_max { + let level_limit = match level_leaves_max { LeavesLevelLimit::None => None, LeavesLevelLimit::Some(limit) => Some(limit), LeavesLevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), }; - Self { inner, backend, level_leaves_max } + let leaves_cache = level_limit.map(|limit| LeavesCache { + level_limit: limit, + import_map: HashMap::new(), + import_counter: 0, + }); + Self { inner, backend, leaves_cache } } } +use std::collections::HashSet; + #[async_trait::async_trait] -impl BlockImport for ParachainBlockImport +impl BlockImport for ParachainBlockImport where Block: BlockT, BI: BlockImport + Send, @@ -143,34 +158,50 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { - let number = params.header.number(); + let hash = params.header.hash(); + let number = *params.header.number(); - let check_leaves = |level_limit| { + let check_leaves = |leaves_cache: &mut LeavesCache<_>| { let blockchain = self.backend.blockchain(); let mut leaves = blockchain.leaves().unwrap_or_default(); // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() < level_limit { + if leaves.len() < leaves_cache.level_limit { return } + let mut leaves_set = HashSet::with_capacity(leaves.len()); + // Now focus on the leaves at the given height. leaves.retain(|hash| { - blockchain - .number(*hash) - .ok() - .flatten() - .map(|n| n == *number) - .unwrap_or_default() + // Pick all the leaves in our temporary leaves set to cleanup the leaves cache. + leaves_set.insert(*hash); + + // Exloit this iteration to cleanup our cache + blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() }); - if leaves.len() < level_limit { + + // Take the opportunity to cleanup our leaves cache. + // We use the leaves HashSet to have a O(1) complexity. + leaves_cache.import_map.retain(|hash, _| leaves_set.contains(hash)); + + if leaves.len() < leaves_cache.level_limit { return } - log::debug!(target: "parachain", "Detected leaves overflow, removing old blocks"); + log::debug!( + target: "parachain", + "Detected leaves overflow at height {}, removing old blocks", number); let best = blockchain.info().best_hash; - let mut remove_count = (leaves.len() + 1) - level_limit; + let mut remove_count = (leaves.len() + 1) - leaves_cache.level_limit; + + // Sort by import chronological order + // With Substrate the leaves for one level are already given ordered by + // import time, so this will be cheap. + leaves.sort_unstable_by(|a, b| { + leaves_cache.import_map.get(a).cmp(&leaves_cache.import_map.get(b)) + }); for hash in leaves.into_iter().filter(|hash| *hash != best) { if self.backend.remove_leaf_block(&hash).is_err() { @@ -184,8 +215,8 @@ where } }; - if let Some(limit) = self.level_leaves_max { - check_leaves(limit); + if let Some(leaves_cache) = &mut self.leaves_cache { + check_leaves(leaves_cache); } // Best block is determined by the relay chain, or if we are doing the initial sync @@ -194,6 +225,14 @@ where params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, )); - self.inner.import_block(params, cache).await + let res = self.inner.import_block(params, cache).await; + if let Ok(ImportResult::Imported(_)) = res { + if let Some(leaves_cache) = &mut self.leaves_cache { + leaves_cache.import_counter += 1; + leaves_cache.import_map.insert(hash, leaves_cache.import_counter); + } + } + + res } } diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index 0074aa7ed92..3a33e361a75 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -47,7 +47,7 @@ use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvid use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use parking_lot::Mutex; -use std::{marker::PhantomData, sync::Arc, time::Duration}; +use std::{sync::Arc, time::Duration}; mod import_queue; pub use import_queue::{import_queue, Verifier}; @@ -55,24 +55,23 @@ pub use import_queue::{import_queue, Verifier}; const LOG_TARGET: &str = "cumulus-consensus-relay-chain"; /// The implementation of the relay-chain provided consensus for parachains. -pub struct RelayChainConsensus { +pub struct RelayChainConsensus { para_id: ParaId, - _phantom: PhantomData, proposer_factory: Arc>, create_inherent_data_providers: Arc, - block_import: Arc>>, + block_import: Arc>>, relay_chain_interface: RCInterface, } impl Clone for RelayChainConsensus where + B: BlockT, RCInterface: Clone, { fn clone(&self) -> Self { Self { para_id: self.para_id, - _phantom: PhantomData, proposer_factory: self.proposer_factory.clone(), create_inherent_data_providers: self.create_inherent_data_providers.clone(), block_import: self.block_import.clone(), @@ -106,7 +105,6 @@ where LeavesLevelLimit::None, ))), relay_chain_interface, - _phantom: PhantomData, } } From 7453fe08bcac5367fe308ed63c753cb35b08b464 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 19 Aug 2022 18:34:51 +0200 Subject: [PATCH 12/59] Leaves monitoring code encapsulation --- client/consensus/common/src/lib.rs | 198 +++++++++++++++-------------- 1 file changed, 100 insertions(+), 98 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 6d71358db1d..8c45c72f1b2 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -20,10 +20,14 @@ use sc_client_api::{ blockchain::{Backend as _, HeaderBackend as _}, Backend, }; -use sc_consensus::{BlockImport, ImportResult}; +use sc_consensus::BlockImport; +use sp_api::NumberFor; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; -use std::{collections::HashMap, sync::Arc}; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, +}; mod parachain_consensus; #[cfg(test)] @@ -31,27 +35,6 @@ mod tests; pub use parachain_consensus::run_parachain_consensus; -/// Value good enough to be used with parachains using the current backend implementation -/// that ships with Substrate. This value may change in the future. -pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; - -/// Upper bound to the number of leaves allowed for each level of the blockchain. -/// -/// If the limit is set and more leaves are detected on block import, then the older ones are -/// dropped to make space for the fresh blocks. -/// -/// In environments where blocks confirmations from the relay chain may be "slow", then -/// setting an upper bound helps keeping the chain health by dropping old (presumably) stale -/// leaves and prevents discarding new blocks because we've reached the backend max value. -pub enum LeavesLevelLimit { - /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. - Default, - /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. - None, - /// Custom value. - Some(usize), -} - /// The result of [`ParachainConsensus::produce_candidate`]. pub struct ParachainCandidate { /// The block that was built for this candidate. @@ -98,12 +81,98 @@ impl ParachainConsensus for Box + Send + } } +/// Value good enough to be used with parachains using the current backend implementation +/// that ships with Substrate. This value may change in the future. +pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; + +/// Upper bound to the number of leaves allowed for each level of the blockchain. +/// +/// If the limit is set and more leaves are detected on block import, then the older ones are +/// dropped to make space for the fresh blocks. +/// +/// In environments where blocks confirmations from the relay chain may be "slow", then +/// setting an upper bound helps keeping the chain health by dropping old (presumably) stale +/// leaves and prevents discarding new blocks because we've reached the backend max value. +pub enum LeavesLevelLimit { + /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. + Default, + /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. + None, + /// Custom value. + Some(usize), +} + type BlockHash = <::Header as HeaderT>::Hash; -struct LeavesCache { +// Support structure to constrain the number of leaves for each level. +struct LeavesLevelMonitor { + // Max number of leaves for each level. level_limit: usize, + // Monotonic counter used to keep track of block age (bigger is younger). import_counter: u64, + // Map between block hash and age. import_map: HashMap, u64>, + // Backend reference to remove leaves on level saturation. + backend: Arc, +} + +// Threshold after which we are going to cleanup our internal map by removing hashes that +// doesn't belong to leaves anymore. +// This is a farly arbitrary value that can be changed in the future without breaking anything. +const CLEANUP_THRESHOLD: usize = 64; + +impl> LeavesLevelMonitor { + fn update(&mut self, hash: BlockHash, number: NumberFor) { + let blockchain = self.backend.blockchain(); + let mut leaves = blockchain.leaves().unwrap_or_default(); + + if self.import_map.len() - leaves.len() >= CLEANUP_THRESHOLD { + // Using a temporary HashSet we allegedly reduce iterations from O(n^2) to O(2n) + let leaves_set: HashSet<_> = leaves.iter().collect(); + self.import_map.retain(|hash, _| leaves_set.contains(hash)); + } + + self.import_counter += 1; + self.import_map.insert(hash, self.import_counter); + + // First cheap check: the number of leaves at level `number` is always less than the total. + if leaves.len() < self.level_limit { + return + } + + // Now focus on the leaves at the given height. + leaves.retain(|hash| { + blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() + }); + + if leaves.len() < self.level_limit { + return + } + + log::debug!( + target: "parachain", + "Detected leaves overflow at height {}, removing old blocks", number); + + let best = blockchain.info().best_hash; + let mut remove_count = leaves.len() - self.level_limit + 1; + + // Sort by import chronological order + // With Substrate the leaves for one level are already given ordered by + // import time, so this will be cheap. + leaves.sort_unstable_by(|a, b| self.import_map.get(a).cmp(&self.import_map.get(b))); + + for hash in leaves.into_iter().filter(|hash| *hash != best) { + log::debug!(target: "parachain", "Removing block {}", hash); + if self.backend.remove_leaf_block(&hash).is_err() { + log::warn!(target: "parachain", "Unable to remove block {}, skipping it...", hash); + continue + } + remove_count -= 1; + if remove_count == 0 { + break + } + } + } } /// Parachain specific block import. @@ -113,8 +182,7 @@ struct LeavesCache { /// we will update the best block, as it is included by the relay-chain. pub struct ParachainBlockImport { inner: BI, - backend: Arc, - leaves_cache: Option>, + leaves_monitor: Option>, } impl ParachainBlockImport { @@ -125,17 +193,16 @@ impl ParachainBlockImport { LeavesLevelLimit::Some(limit) => Some(limit), LeavesLevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), }; - let leaves_cache = level_limit.map(|limit| LeavesCache { + let leaves_monitor = level_limit.map(|limit| LeavesLevelMonitor { level_limit: limit, import_map: HashMap::new(), import_counter: 0, + backend, }); - Self { inner, backend, leaves_cache } + Self { inner, leaves_monitor } } } -use std::collections::HashSet; - #[async_trait::async_trait] impl BlockImport for ParachainBlockImport where @@ -158,65 +225,8 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { - let hash = params.header.hash(); - let number = *params.header.number(); - - let check_leaves = |leaves_cache: &mut LeavesCache<_>| { - let blockchain = self.backend.blockchain(); - let mut leaves = blockchain.leaves().unwrap_or_default(); - - // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() < leaves_cache.level_limit { - return - } - - let mut leaves_set = HashSet::with_capacity(leaves.len()); - - // Now focus on the leaves at the given height. - leaves.retain(|hash| { - // Pick all the leaves in our temporary leaves set to cleanup the leaves cache. - leaves_set.insert(*hash); - - // Exloit this iteration to cleanup our cache - blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - }); - - // Take the opportunity to cleanup our leaves cache. - // We use the leaves HashSet to have a O(1) complexity. - leaves_cache.import_map.retain(|hash, _| leaves_set.contains(hash)); - - if leaves.len() < leaves_cache.level_limit { - return - } - - log::debug!( - target: "parachain", - "Detected leaves overflow at height {}, removing old blocks", number); - - let best = blockchain.info().best_hash; - let mut remove_count = (leaves.len() + 1) - leaves_cache.level_limit; - - // Sort by import chronological order - // With Substrate the leaves for one level are already given ordered by - // import time, so this will be cheap. - leaves.sort_unstable_by(|a, b| { - leaves_cache.import_map.get(a).cmp(&leaves_cache.import_map.get(b)) - }); - - for hash in leaves.into_iter().filter(|hash| *hash != best) { - if self.backend.remove_leaf_block(&hash).is_err() { - log::warn!(target: "parachain", "Unable to remove block {}, skipping it...", hash); - continue - } - remove_count -= 1; - if remove_count == 0 { - break - } - } - }; - - if let Some(leaves_cache) = &mut self.leaves_cache { - check_leaves(leaves_cache); + if let Some(ref mut leaves_monitor) = self.leaves_monitor { + leaves_monitor.update(params.header.hash(), *params.header.number()); } // Best block is determined by the relay chain, or if we are doing the initial sync @@ -225,14 +235,6 @@ where params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, )); - let res = self.inner.import_block(params, cache).await; - if let Ok(ImportResult::Imported(_)) = res { - if let Some(leaves_cache) = &mut self.leaves_cache { - leaves_cache.import_counter += 1; - leaves_cache.import_map.insert(hash, leaves_cache.import_counter); - } - } - - res + self.inner.import_block(params, cache).await } } From 45fc0d19157ba4939a428d25391a58f5dcecb12c Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 19 Aug 2022 18:46:23 +0200 Subject: [PATCH 13/59] Fix panic for unsigned subtraction underflow --- client/consensus/common/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 8c45c72f1b2..4f44fbe9680 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -126,7 +126,7 @@ impl> LeavesLevelMonitor { let blockchain = self.backend.blockchain(); let mut leaves = blockchain.leaves().unwrap_or_default(); - if self.import_map.len() - leaves.len() >= CLEANUP_THRESHOLD { + if self.import_map.len().saturating_sub(leaves.len()) >= CLEANUP_THRESHOLD { // Using a temporary HashSet we allegedly reduce iterations from O(n^2) to O(2n) let leaves_set: HashSet<_> = leaves.iter().collect(); self.import_map.retain(|hash, _| leaves_set.contains(hash)); @@ -156,9 +156,7 @@ impl> LeavesLevelMonitor { let best = blockchain.info().best_hash; let mut remove_count = leaves.len() - self.level_limit + 1; - // Sort by import chronological order - // With Substrate the leaves for one level are already given ordered by - // import time, so this will be cheap. + // Sort leaves by import chronological order leaves.sort_unstable_by(|a, b| self.import_map.get(a).cmp(&self.import_map.get(b))); for hash in leaves.into_iter().filter(|hash| *hash != best) { From 12427d58a1d3e63b32f75ed3d5b1cd3e6b8e2615 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 19 Aug 2022 19:04:22 +0200 Subject: [PATCH 14/59] Cargo fmt --- client/consensus/common/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 4f44fbe9680..08232307c9b 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -150,8 +150,9 @@ impl> LeavesLevelMonitor { } log::debug!( - target: "parachain", - "Detected leaves overflow at height {}, removing old blocks", number); + target: "parachain", + "Detected leaves overflow at height {}, removing old blocks", number + ); let best = blockchain.info().best_hash; let mut remove_count = leaves.len() - self.level_limit + 1; From b2c197fa40eda547c3f42bd1cf9bd2d1ace45d68 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Sun, 21 Aug 2022 10:47:25 +0200 Subject: [PATCH 15/59] Improval leaves cache insertion/deletion strategy --- client/consensus/common/src/lib.rs | 46 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 08232307c9b..4316a1bb1f6 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -108,33 +108,37 @@ type BlockHash = <::Header as HeaderT>::Hash; struct LeavesLevelMonitor { // Max number of leaves for each level. level_limit: usize, - // Monotonic counter used to keep track of block age (bigger is younger). + // Monotonic counter used to keep track of block import age (bigger is younger). import_counter: u64, // Map between block hash and age. - import_map: HashMap, u64>, + leaves_cache: HashMap, u64>, // Backend reference to remove leaves on level saturation. backend: Arc, } -// Threshold after which we are going to cleanup our internal map by removing hashes that -// doesn't belong to leaves anymore. +// Threshold after which we are going to cleanup our internal leaves cache by removing hashes that +// doesn't belong to leaf blocks anymore. // This is a farly arbitrary value that can be changed in the future without breaking anything. const CLEANUP_THRESHOLD: usize = 64; impl> LeavesLevelMonitor { - fn update(&mut self, hash: BlockHash, number: NumberFor) { + fn update(&mut self, hash: BlockHash, parent_hash: BlockHash) { + self.import_counter += 1; + self.leaves_cache.insert(hash, self.import_counter); + self.leaves_cache.remove(&parent_hash); + } + + fn check(&mut self, number: NumberFor) { let blockchain = self.backend.blockchain(); let mut leaves = blockchain.leaves().unwrap_or_default(); - if self.import_map.len().saturating_sub(leaves.len()) >= CLEANUP_THRESHOLD { - // Using a temporary HashSet we allegedly reduce iterations from O(n^2) to O(2n) + if self.leaves_cache.len().saturating_sub(leaves.len()) >= CLEANUP_THRESHOLD { + // Update the cache once in a while by using the leaves set returned by the backend. + // Using a temporary HashSet we reduce iterations from O(n^2) to O(2n) let leaves_set: HashSet<_> = leaves.iter().collect(); - self.import_map.retain(|hash, _| leaves_set.contains(hash)); + self.leaves_cache.retain(|hash, _| leaves_set.contains(hash)); } - self.import_counter += 1; - self.import_map.insert(hash, self.import_counter); - // First cheap check: the number of leaves at level `number` is always less than the total. if leaves.len() < self.level_limit { return @@ -158,7 +162,7 @@ impl> LeavesLevelMonitor { let mut remove_count = leaves.len() - self.level_limit + 1; // Sort leaves by import chronological order - leaves.sort_unstable_by(|a, b| self.import_map.get(a).cmp(&self.import_map.get(b))); + leaves.sort_unstable_by(|a, b| self.leaves_cache.get(a).cmp(&self.leaves_cache.get(b))); for hash in leaves.into_iter().filter(|hash| *hash != best) { log::debug!(target: "parachain", "Removing block {}", hash); @@ -166,6 +170,7 @@ impl> LeavesLevelMonitor { log::warn!(target: "parachain", "Unable to remove block {}, skipping it...", hash); continue } + self.leaves_cache.remove(&hash); remove_count -= 1; if remove_count == 0 { break @@ -194,7 +199,7 @@ impl ParachainBlockImport { }; let leaves_monitor = level_limit.map(|limit| LeavesLevelMonitor { level_limit: limit, - import_map: HashMap::new(), + leaves_cache: HashMap::new(), import_counter: 0, backend, }); @@ -224,8 +229,11 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { - if let Some(ref mut leaves_monitor) = self.leaves_monitor { - leaves_monitor.update(params.header.hash(), *params.header.number()); + let hash = params.header.hash(); + let parent = *params.header.parent_hash(); + + if let Some(ref mut monitor) = self.leaves_monitor { + monitor.check(*params.header.number()); } // Best block is determined by the relay chain, or if we are doing the initial sync @@ -234,6 +242,12 @@ where params.origin == sp_consensus::BlockOrigin::NetworkInitialSync, )); - self.inner.import_block(params, cache).await + let res = self.inner.import_block(params, cache).await?; + + if let Some(ref mut monitor) = self.leaves_monitor { + monitor.update(hash, parent); + } + + Ok(res) } } From 0c81d6b8558453eeef1710cc106b053de2fc4aa6 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Mon, 22 Aug 2022 14:42:50 +0200 Subject: [PATCH 16/59] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/consensus/common/src/lib.rs | 2 +- client/consensus/common/src/tests.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 4316a1bb1f6..036303af820 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -111,7 +111,7 @@ struct LeavesLevelMonitor { // Monotonic counter used to keep track of block import age (bigger is younger). import_counter: u64, // Map between block hash and age. - leaves_cache: HashMap, u64>, + leaves_cache: HashMap, // Backend reference to remove leaves on level saturation. backend: Arc, } diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 7f56e8f7d67..d8776d5ec90 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -103,7 +103,6 @@ impl crate::parachain_consensus::RelaychainClient for Relaychain { } } -#[inline] fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Block { build_and_import_block_ext(&*client.clone(), import_as_best, &mut client, None, None) } From aabc69a5dd5dd1f44c175d7917b1ee59aa3c7344 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Mon, 22 Aug 2022 14:48:40 +0200 Subject: [PATCH 17/59] Fix to default level limit --- client/consensus/relay-chain/src/import_queue.rs | 2 +- client/consensus/relay-chain/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/consensus/relay-chain/src/import_queue.rs b/client/consensus/relay-chain/src/import_queue.rs index 94cf7f9a9a7..44f42212f68 100644 --- a/client/consensus/relay-chain/src/import_queue.rs +++ b/client/consensus/relay-chain/src/import_queue.rs @@ -123,7 +123,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::None)), + Box::new(ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::Default)), None, spawner, registry, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index 3a33e361a75..1f7e15533a9 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -102,7 +102,7 @@ where block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new( block_import, backend, - LeavesLevelLimit::None, + LeavesLevelLimit::Default, ))), relay_chain_interface, } From 55e598e82a4bcd07ec1d50770a229b0233f410a5 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 23 Aug 2022 20:38:14 +0200 Subject: [PATCH 18/59] Remove redundant type --- client/consensus/common/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 036303af820..7ceb6031a6c 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -102,8 +102,6 @@ pub enum LeavesLevelLimit { Some(usize), } -type BlockHash = <::Header as HeaderT>::Hash; - // Support structure to constrain the number of leaves for each level. struct LeavesLevelMonitor { // Max number of leaves for each level. @@ -122,7 +120,7 @@ struct LeavesLevelMonitor { const CLEANUP_THRESHOLD: usize = 64; impl> LeavesLevelMonitor { - fn update(&mut self, hash: BlockHash, parent_hash: BlockHash) { + fn update(&mut self, hash: Block::Hash, parent_hash: Block::Hash) { self.import_counter += 1; self.leaves_cache.insert(hash, self.import_counter); self.leaves_cache.remove(&parent_hash); From d93975736ca3b91198d83173b9d8d05422acb980 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 30 Aug 2022 18:44:12 +0200 Subject: [PATCH 19/59] Allow removal of non-leaves blocks and restore from backend --- client/consensus/aura/src/import_queue.rs | 4 +- client/consensus/aura/src/lib.rs | 8 +- client/consensus/common/src/lib.rs | 197 ++++++++++++------ client/consensus/common/src/tests.rs | 189 +++++++++++++++-- .../consensus/relay-chain/src/import_queue.rs | 4 +- client/consensus/relay-chain/src/lib.rs | 4 +- polkadot-parachain/src/service.rs | 4 +- 7 files changed, 313 insertions(+), 97 deletions(-) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 7a303922c0c..408bc367cc0 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -90,10 +90,10 @@ where CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, BE: Backend + 'static, { - use cumulus_client_consensus_common::{LeavesLevelLimit, ParachainBlockImport}; + use cumulus_client_consensus_common::{LevelLimit, ParachainBlockImport}; sc_consensus_aura::import_queue::(sc_consensus_aura::ImportQueueParams { - block_import: ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::Default), + block_import: ParachainBlockImport::new(block_import, backend, LevelLimit::Default), justification_import: None, client, create_inherent_data_providers, diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index 3a3b8d3378e..ffe9500060f 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -24,7 +24,7 @@ use codec::{Decode, Encode}; use cumulus_client_consensus_common::{ - LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, PersistedValidationData}; @@ -119,11 +119,7 @@ where let worker = sc_consensus_aura::build_aura_worker::( BuildAuraWorkerParams { client: para_client, - block_import: ParachainBlockImport::new( - block_import, - backend, - LeavesLevelLimit::Default, - ), + block_import: ParachainBlockImport::new(block_import, backend, LevelLimit::Default), justification_sync_link: (), proposer_factory, sync_oracle, diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 7ceb6031a6c..91fa2b1d4de 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -22,12 +22,9 @@ use sc_client_api::{ }; use sc_consensus::BlockImport; use sp_api::NumberFor; -use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}; -use std::{ - collections::{HashMap, HashSet}, - sync::Arc, -}; +use std::{collections::HashMap, sync::Arc}; mod parachain_consensus; #[cfg(test)] @@ -93,7 +90,7 @@ pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; /// In environments where blocks confirmations from the relay chain may be "slow", then /// setting an upper bound helps keeping the chain health by dropping old (presumably) stale /// leaves and prevents discarding new blocks because we've reached the backend max value. -pub enum LeavesLevelLimit { +pub enum LevelLimit { /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. Default, /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. @@ -103,51 +100,43 @@ pub enum LeavesLevelLimit { } // Support structure to constrain the number of leaves for each level. -struct LeavesLevelMonitor { +struct LevelMonitor { // Max number of leaves for each level. level_limit: usize, - // Monotonic counter used to keep track of block import age (bigger is younger). + // Monotonic counter used to keep track of block import age (used as a timestamp). import_counter: u64, - // Map between block hash and age. - leaves_cache: HashMap, + // Map between leaves hashes and insertion timestamp. + import_counters: HashMap, + // Blockhain levels cache. + levels: HashMap, Vec>, // Backend reference to remove leaves on level saturation. backend: Arc, } -// Threshold after which we are going to cleanup our internal leaves cache by removing hashes that -// doesn't belong to leaf blocks anymore. -// This is a farly arbitrary value that can be changed in the future without breaking anything. -const CLEANUP_THRESHOLD: usize = 64; +// // Threshold after which we are going to cleanup our internal leaves cache by removing hashes that +// // doesn't belong to leaf blocks anymore. +// // This is a farly arbitrary value that can be changed in the future without breaking anything. +// const CLEANUP_THRESHOLD: usize = 64; -impl> LeavesLevelMonitor { - fn update(&mut self, hash: Block::Hash, parent_hash: Block::Hash) { +impl LevelMonitor +where + Block: BlockT, + BE: Backend, +{ + fn update(&mut self, number: NumberFor, hash: Block::Hash) { + self.import_counters.insert(hash, self.import_counter); + self.levels.entry(number).or_default().push(hash); self.import_counter += 1; - self.leaves_cache.insert(hash, self.import_counter); - self.leaves_cache.remove(&parent_hash); } fn check(&mut self, number: NumberFor) { - let blockchain = self.backend.blockchain(); - let mut leaves = blockchain.leaves().unwrap_or_default(); - - if self.leaves_cache.len().saturating_sub(leaves.len()) >= CLEANUP_THRESHOLD { - // Update the cache once in a while by using the leaves set returned by the backend. - // Using a temporary HashSet we reduce iterations from O(n^2) to O(2n) - let leaves_set: HashSet<_> = leaves.iter().collect(); - self.leaves_cache.retain(|hash, _| leaves_set.contains(hash)); - } - - // First cheap check: the number of leaves at level `number` is always less than the total. - if leaves.len() < self.level_limit { - return + if self.import_counter == 0 { + // First call detected, restore using backend. + self.restore(); } - // Now focus on the leaves at the given height. - leaves.retain(|hash| { - blockchain.number(*hash).ok().flatten().map(|n| n == number).unwrap_or_default() - }); - - if leaves.len() < self.level_limit { + let level = self.levels.entry(number).or_default(); + if level.len() < self.level_limit { return } @@ -156,24 +145,105 @@ impl> LeavesLevelMonitor { "Detected leaves overflow at height {}, removing old blocks", number ); + let blockchain = self.backend.blockchain(); let best = blockchain.info().best_hash; - let mut remove_count = leaves.len() - self.level_limit + 1; - // Sort leaves by import chronological order - leaves.sort_unstable_by(|a, b| self.leaves_cache.get(a).cmp(&self.leaves_cache.get(b))); + let mut leaves = blockchain.leaves().unwrap_or_default(); + // Sort leaves by import time. + leaves + .sort_unstable_by(|a, b| self.import_counters.get(a).cmp(&self.import_counters.get(b))); + + let remove_count = level.len() - self.level_limit + 1; + + let mut remove_one = || { + let mut candidate_idx = 0; + let mut candidate_routes = vec![]; + let mut candidate_fresher_leaf_idx = usize::MAX; + + for (blk_idx, blk_hash) in level.iter().enumerate() { + let mut blk_leaves_routes = vec![]; + let mut blk_fresher_leaf_idx = 0; + // Start from the most current one (the bottom) + // Here leaf index is synonym of its freshness, that is the greater the index the + // fresher it is. + for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { + let leaf_route = + match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) => route, + Err(e) => { + log::warn!( + target: "parachain", + "Unable getting route from {} to {}: {}", + blk_hash, leaf_hash, e, + ); + continue + }, + }; + if leaf_route.retracted().is_empty() { + if leaf_idx > candidate_fresher_leaf_idx || + leaf_route.common_block().hash == best || + leaf_route.enacted().iter().any(|entry| entry.hash == best) + { + blk_leaves_routes.clear(); + break + } + + if blk_fresher_leaf_idx == 0 { + blk_fresher_leaf_idx = leaf_idx; + } + blk_leaves_routes.push(leaf_route); + } + } + + if !blk_leaves_routes.is_empty() { + candidate_idx = blk_idx; + candidate_routes = blk_leaves_routes; + candidate_fresher_leaf_idx = blk_fresher_leaf_idx; + } + } + + // We now have all the routes to remove + for route in candidate_routes.iter() { + std::iter::once(route.common_block()).chain(route.enacted()).rev().for_each( + |elem| { + self.import_counters.remove(&elem.hash); + if let Err(err) = self.backend.remove_leaf_block(&elem.hash) { + log::warn!(target: "parachain", "Unable to remove block {}: {}", elem.hash, err); + } + }, + ); + } + + level.remove(candidate_idx); + }; + + // This is not the most efficient way to remove multiple entries, + // but sould be considered that remove count is commonly 1. + (0..remove_count).for_each(|_| remove_one()); + } - for hash in leaves.into_iter().filter(|hash| *hash != best) { - log::debug!(target: "parachain", "Removing block {}", hash); - if self.backend.remove_leaf_block(&hash).is_err() { - log::warn!(target: "parachain", "Unable to remove block {}, skipping it...", hash); + fn restore(&mut self) { + let leaves = self.backend.blockchain().leaves().unwrap_or_default(); + let finalized = self.backend.blockchain().last_finalized().unwrap_or_default(); + let mut counter_max = 0; + + for leaf in leaves { + let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) + .expect("Route from finalized to leaf should be present; qed"); + if !route.retracted().is_empty() { continue } - self.leaves_cache.remove(&hash); - remove_count -= 1; - if remove_count == 0 { - break + std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { + if !self.import_counters.contains_key(&elem.hash) { + self.import_counter = elem.number.unique_saturated_into(); + self.update(elem.number, elem.hash); + } + }); + if self.import_counter > counter_max { + counter_max = self.import_counter; } } + self.import_counter = counter_max; } } @@ -184,24 +254,27 @@ impl> LeavesLevelMonitor { /// we will update the best block, as it is included by the relay-chain. pub struct ParachainBlockImport { inner: BI, - leaves_monitor: Option>, + level_monitor: Option>, } impl ParachainBlockImport { /// Create a new instance. - pub fn new(inner: BI, backend: Arc, level_leaves_max: LeavesLevelLimit) -> Self { + pub fn new(inner: BI, backend: Arc, level_leaves_max: LevelLimit) -> Self { let level_limit = match level_leaves_max { - LeavesLevelLimit::None => None, - LeavesLevelLimit::Some(limit) => Some(limit), - LeavesLevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), + LevelLimit::None => None, + LevelLimit::Some(limit) => Some(limit), + LevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), }; - let leaves_monitor = level_limit.map(|limit| LeavesLevelMonitor { - level_limit: limit, - leaves_cache: HashMap::new(), + + let level_monitor = level_limit.map(|level_limit| LevelMonitor { + level_limit, import_counter: 0, + import_counters: HashMap::new(), + levels: HashMap::new(), backend, }); - Self { inner, leaves_monitor } + + Self { inner, level_monitor } } } @@ -227,11 +300,11 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { + let number = *params.header.number(); let hash = params.header.hash(); - let parent = *params.header.parent_hash(); - if let Some(ref mut monitor) = self.leaves_monitor { - monitor.check(*params.header.number()); + if let Some(ref mut monitor) = self.level_monitor { + monitor.check(number); } // Best block is determined by the relay chain, or if we are doing the initial sync @@ -242,8 +315,8 @@ where let res = self.inner.import_block(params, cache).await?; - if let Some(ref mut monitor) = self.leaves_monitor { - monitor.update(hash, parent); + if let Some(ref mut monitor) = self.level_monitor { + monitor.update(number, hash); } Ok(res) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index d8776d5ec90..f77420bf563 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -104,11 +104,19 @@ impl crate::parachain_consensus::RelaychainClient for Relaychain { } fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Block { - build_and_import_block_ext(&*client.clone(), import_as_best, &mut client, None, None) + build_and_import_block_ext( + &*client.clone(), + BlockOrigin::Own, + import_as_best, + &mut client, + None, + None, + ) } fn build_and_import_block_ext>( builder: &B, + origin: BlockOrigin, import_as_best: bool, importer: &mut I, at: Option>, @@ -126,7 +134,7 @@ fn build_and_import_block_ext>( let block = builder.build().unwrap().block; let (header, body) = block.clone().deconstruct(); - let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header); + let mut block_import_params = BlockImportParams::new(origin, header); block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(import_as_best)); block_import_params.body = Some(body); @@ -374,54 +382,193 @@ fn do_not_set_best_block_to_older_block() { } #[test] -fn prune_blocks_on_leaves_overflow() { +fn prune_blocks_on_level_overflow() { + // Here we are using the timestamp value to generate blocks with different hashes. const LEVEL_LIMIT: usize = 3; const TIMESTAMP_MULTIPLIER: u64 = 60000; - let backend = Arc::new(Backend::new_test(1000, 1)); - + let backend = Arc::new(Backend::new_test(1000, 3)); let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); + let mut para_import = + ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); - let mut para_import = ParachainBlockImport::new( - client.clone(), - backend.clone(), - LeavesLevelLimit::Some(LEVEL_LIMIT), + let block0 = build_and_import_block_ext( + &*client, + BlockOrigin::NetworkInitialSync, + true, + &mut para_import, + None, + None, ); + let id0 = BlockId::Hash(block0.header.hash()); - let root_block = build_and_import_block(client.clone(), true); - let root_id = BlockId::Number(*root_block.header.number()); + let blocks1 = (0..LEVEL_LIMIT) + .into_iter() + .map(|i| { + build_and_import_block_ext( + &*client, + if i == 1 { BlockOrigin::NetworkInitialSync } else { BlockOrigin::Own }, + i == 1, + &mut para_import, + Some(id0), + Some(i as u64 * TIMESTAMP_MULTIPLIER), + ) + }) + .collect::>(); + let id10 = BlockId::Hash(blocks1[0].header.hash()); - // Here we are using the timestamp value to generate blocks with different hashes. - let blocks = (0..LEVEL_LIMIT) + let blocks2 = (0..2) .into_iter() .map(|i| { build_and_import_block_ext( &*client, + BlockOrigin::Own, false, &mut para_import, - Some(root_id), + Some(id10), Some(i as u64 * TIMESTAMP_MULTIPLIER), ) }) .collect::>(); - let leaves = backend.blockchain().leaves().unwrap(); - let mut expected = blocks.iter().map(|b| b.header.hash()).collect::>(); + // Initial scenario (with B11 imported as best) + // + // B0 --+-- B10 --+-- B20 + // +-- B11 +-- B21 + // +-- B12 - assert_eq!(leaves.len(), LEVEL_LIMIT); + let leaves = backend.blockchain().leaves().unwrap(); + let mut expected = vec![ + blocks2[0].header.hash(), + blocks2[1].header.hash(), + blocks1[1].header.hash(), + blocks1[2].header.hash(), + ]; assert_eq!(leaves, expected); + let best = client.usage_info().chain.best_hash; + assert_eq!(best, blocks1[1].header.hash()); - let block = build_and_import_block_ext( + let block13 = build_and_import_block_ext( &*client, + BlockOrigin::Own, false, &mut para_import, - Some(root_id), + Some(id0), Some(LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER), ); + // Expected scenario + // + // B0 --+-- B10 --+-- B20 + // +-- B11 +-- B21 + // +--(B13) <-- B12 has been replaced + let leaves = backend.blockchain().leaves().unwrap(); + expected[3] = block13.header.hash(); + assert_eq!(leaves, expected); + + let block14 = build_and_import_block_ext( + &*client, + BlockOrigin::Own, + false, + &mut para_import, + Some(id0), + Some(2 * LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER), + ); + + // Expected scenario + // + // B0 --+--(B14) <-- B10 has been replaced + // +-- B11 + // +--(B13) + + let leaves = backend.blockchain().leaves().unwrap(); + expected.remove(0); expected.remove(0); - expected.push(block.header.hash()); - assert_eq!(leaves.len(), LEVEL_LIMIT); + expected.push(block14.header.hash()); + assert_eq!(leaves, expected); +} + +// TODO: test monitor reload from backend +#[test] +fn restore_limit_monitor() { + // Here we are using the timestamp value to generate blocks with different hashes. + const LEVEL_LIMIT: usize = 3; + const TIMESTAMP_MULTIPLIER: u64 = 60000; + + let backend = Arc::new(Backend::new_test(1000, 3)); + let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); + let mut para_import = + ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); + + let block0 = build_and_import_block_ext( + &*client, + BlockOrigin::NetworkInitialSync, + true, + &mut para_import, + None, + None, + ); + let id0 = BlockId::Hash(block0.header.hash()); + + let blocks1 = (0..LEVEL_LIMIT) + .into_iter() + .map(|i| { + build_and_import_block_ext( + &*client, + if i == 1 { BlockOrigin::NetworkInitialSync } else { BlockOrigin::Own }, + i == 1, + &mut para_import, + Some(id0), + Some(i as u64 * TIMESTAMP_MULTIPLIER), + ) + }) + .collect::>(); + let id10 = BlockId::Hash(blocks1[0].header.hash()); + + let blocks2 = (0..2) + .into_iter() + .map(|i| { + build_and_import_block_ext( + &*client, + BlockOrigin::Own, + false, + &mut para_import, + Some(id10), + Some(i as u64 * TIMESTAMP_MULTIPLIER), + ) + }) + .collect::>(); + + // Simulate a restart by using a new structure + + let mut para_import = + ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); + + let block13 = build_and_import_block_ext( + &*client, + BlockOrigin::Own, + false, + &mut para_import, + Some(id0), + Some(LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER), + ); + + // Expected scenario + // + // B0 --+-- B10 --+-- B20 + // +-- B11 +-- B21 + // +--(B13) <-- B12 has been replaced + + let leaves = backend.blockchain().leaves().unwrap(); + let expected = vec![ + blocks2[0].header.hash(), + blocks2[1].header.hash(), + blocks1[1].header.hash(), + block13.header.hash(), + ]; assert_eq!(leaves, expected); + + let monitor = para_import.level_monitor.unwrap(); + assert_eq!(monitor.import_counter, 0); } diff --git a/client/consensus/relay-chain/src/import_queue.rs b/client/consensus/relay-chain/src/import_queue.rs index 44f42212f68..e3e41577cc0 100644 --- a/client/consensus/relay-chain/src/import_queue.rs +++ b/client/consensus/relay-chain/src/import_queue.rs @@ -30,7 +30,7 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT}, }; -use cumulus_client_consensus_common::{LeavesLevelLimit, ParachainBlockImport}; +use cumulus_client_consensus_common::{LevelLimit, ParachainBlockImport}; /// A verifier that just checks the inherents. pub struct Verifier { @@ -123,7 +123,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(block_import, backend, LeavesLevelLimit::Default)), + Box::new(ParachainBlockImport::new(block_import, backend, LevelLimit::Default)), None, spawner, registry, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index 1f7e15533a9..4ff4a6a43ff 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -34,7 +34,7 @@ //! 5. After the parachain candidate got backed and included, all collators start at 1. use cumulus_client_consensus_common::{ - LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, ParaId, PersistedValidationData}; use cumulus_relay_chain_interface::RelayChainInterface; @@ -102,7 +102,7 @@ where block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new( block_import, backend, - LeavesLevelLimit::Default, + LevelLimit::Default, ))), relay_chain_interface, } diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index a2454be3f68..4c686007bb0 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -18,7 +18,7 @@ use codec::Codec; use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::{ - LeavesLevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_service::{ @@ -1150,7 +1150,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(client, backend, LeavesLevelLimit::Default)), + Box::new(ParachainBlockImport::new(client, backend, LevelLimit::Default)), None, &spawner, registry, From ca4b38354d8c877b68cc109ed5de5878da15399f Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 30 Aug 2022 19:36:40 +0200 Subject: [PATCH 20/59] Encapsulate limit monitor in its own module --- client/consensus/common/src/level_monitor.rs | 200 +++++++++++++++++++ client/consensus/common/src/lib.rs | 191 +----------------- client/consensus/common/src/tests.rs | 17 +- 3 files changed, 221 insertions(+), 187 deletions(-) create mode 100644 client/consensus/common/src/level_monitor.rs diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs new file mode 100644 index 00000000000..ae4f4580b1b --- /dev/null +++ b/client/consensus/common/src/level_monitor.rs @@ -0,0 +1,200 @@ +// Copyright 2022 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; +use sp_runtime::traits::{Block as BlockT, NumberFor, UniqueSaturatedInto}; +use std::{collections::HashMap, sync::Arc}; + +/// Value good enough to be used with parachains using the current backend implementation +/// that ships with Substrate. This value may change in the future. +pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; + +/// Upper bound to the number of leaves allowed for each level of the blockchain. +/// +/// If the limit is set and more leaves are detected on block import, then the older ones are +/// dropped to make space for the fresh blocks. +/// +/// In environments where blocks confirmations from the relay chain may be "slow", then +/// setting an upper bound helps keeping the chain health by dropping old (presumably) stale +/// leaves and prevents discarding new blocks because we've reached the backend max value. +pub enum LevelLimit { + /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. + Default, + /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. + None, + /// Custom value. + Some(usize), +} + +// Support structure to constrain the number of leaves for each level. +pub struct LevelMonitor { + // Max number of leaves for each level. + pub level_limit: usize, + // Monotonic counter used to keep track of block import age (used as a timestamp). + pub import_counter: u64, + // Map between leaves hashes and insertion timestamp. + pub import_counters: HashMap, + // Blockhain levels cache. + pub levels: HashMap, Vec>, + // Backend reference to remove leaves on level saturation. + pub backend: Arc, +} + +// // Threshold after which we are going to cleanup our internal leaves cache by removing hashes that +// // doesn't belong to leaf blocks anymore. +// // This is a farly arbitrary value that can be changed in the future without breaking anything. +// const CLEANUP_THRESHOLD: usize = 64; + +impl LevelMonitor { + pub fn new(level_limit: usize, backend: Arc) -> Self { + LevelMonitor { + level_limit, + import_counter: 0, + import_counters: HashMap::new(), + levels: HashMap::new(), + backend, + } + } +} + +impl LevelMonitor +where + Block: BlockT, + BE: Backend, +{ + pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { + self.import_counters.insert(hash, self.import_counter); + self.levels.entry(number).or_default().push(hash); + self.import_counter += 1; + } + + pub fn check(&mut self, number: NumberFor) { + if self.import_counter == 0 { + // First call detected, restore using backend. + self.restore(); + } + + let level = self.levels.entry(number).or_default(); + if level.len() < self.level_limit { + return + } + + log::debug!( + target: "parachain", + "Detected leaves overflow at height {}, removing old blocks", number + ); + + let blockchain = self.backend.blockchain(); + let best = blockchain.info().best_hash; + + let mut leaves = blockchain.leaves().unwrap_or_default(); + // Sort leaves by import time. + leaves + .sort_unstable_by(|a, b| self.import_counters.get(a).cmp(&self.import_counters.get(b))); + + let remove_count = level.len() - self.level_limit + 1; + + let mut remove_one = || { + let mut candidate_idx = 0; + let mut candidate_routes = vec![]; + let mut candidate_fresher_leaf_idx = usize::MAX; + + for (blk_idx, blk_hash) in level.iter().enumerate() { + let mut blk_leaves_routes = vec![]; + let mut blk_fresher_leaf_idx = 0; + // Start from the most current one (the bottom) + // Here leaf index is synonym of its freshness, that is the greater the index the + // fresher it is. + for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { + let leaf_route = + match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) => route, + Err(e) => { + log::warn!( + target: "parachain", + "Unable getting route from {} to {}: {}", + blk_hash, leaf_hash, e, + ); + continue + }, + }; + if leaf_route.retracted().is_empty() { + if leaf_idx > candidate_fresher_leaf_idx || + leaf_route.common_block().hash == best || + leaf_route.enacted().iter().any(|entry| entry.hash == best) + { + blk_leaves_routes.clear(); + break + } + + if blk_fresher_leaf_idx == 0 { + blk_fresher_leaf_idx = leaf_idx; + } + blk_leaves_routes.push(leaf_route); + } + } + + if !blk_leaves_routes.is_empty() { + candidate_idx = blk_idx; + candidate_routes = blk_leaves_routes; + candidate_fresher_leaf_idx = blk_fresher_leaf_idx; + } + } + + // We now have all the routes to remove + for route in candidate_routes.iter() { + std::iter::once(route.common_block()).chain(route.enacted()).rev().for_each( + |elem| { + self.import_counters.remove(&elem.hash); + if let Err(err) = self.backend.remove_leaf_block(&elem.hash) { + log::warn!(target: "parachain", "Unable to remove block {}: {}", elem.hash, err); + } + }, + ); + } + + level.remove(candidate_idx); + }; + + // This is not the most efficient way to remove multiple entries, + // but sould be considered that remove count is commonly 1. + (0..remove_count).for_each(|_| remove_one()); + } + + pub fn restore(&mut self) { + let leaves = self.backend.blockchain().leaves().unwrap_or_default(); + let finalized = self.backend.blockchain().last_finalized().unwrap_or_default(); + let mut counter_max = 0; + + for leaf in leaves { + let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) + .expect("Route from finalized to leaf should be present; qed"); + if !route.retracted().is_empty() { + continue + } + std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { + if !self.import_counters.contains_key(&elem.hash) { + self.import_counter = elem.number.unique_saturated_into(); + self.update(elem.number, elem.hash); + } + }); + if self.import_counter > counter_max { + counter_max = self.import_counter; + } + } + self.import_counter = counter_max; + } +} diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 91fa2b1d4de..fb49d5ff3a2 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -16,22 +16,22 @@ use polkadot_primitives::v2::{Hash as PHash, PersistedValidationData}; -use sc_client_api::{ - blockchain::{Backend as _, HeaderBackend as _}, - Backend, -}; +use sc_client_api::Backend; use sc_consensus::BlockImport; -use sp_api::NumberFor; -use sp_runtime::traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; +mod level_monitor; mod parachain_consensus; #[cfg(test)] mod tests; pub use parachain_consensus::run_parachain_consensus; +pub use level_monitor::LevelLimit; +use level_monitor::{LevelMonitor, MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT}; + /// The result of [`ParachainConsensus::produce_candidate`]. pub struct ParachainCandidate { /// The block that was built for this candidate. @@ -78,175 +78,6 @@ impl ParachainConsensus for Box + Send + } } -/// Value good enough to be used with parachains using the current backend implementation -/// that ships with Substrate. This value may change in the future. -pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; - -/// Upper bound to the number of leaves allowed for each level of the blockchain. -/// -/// If the limit is set and more leaves are detected on block import, then the older ones are -/// dropped to make space for the fresh blocks. -/// -/// In environments where blocks confirmations from the relay chain may be "slow", then -/// setting an upper bound helps keeping the chain health by dropping old (presumably) stale -/// leaves and prevents discarding new blocks because we've reached the backend max value. -pub enum LevelLimit { - /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. - Default, - /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. - None, - /// Custom value. - Some(usize), -} - -// Support structure to constrain the number of leaves for each level. -struct LevelMonitor { - // Max number of leaves for each level. - level_limit: usize, - // Monotonic counter used to keep track of block import age (used as a timestamp). - import_counter: u64, - // Map between leaves hashes and insertion timestamp. - import_counters: HashMap, - // Blockhain levels cache. - levels: HashMap, Vec>, - // Backend reference to remove leaves on level saturation. - backend: Arc, -} - -// // Threshold after which we are going to cleanup our internal leaves cache by removing hashes that -// // doesn't belong to leaf blocks anymore. -// // This is a farly arbitrary value that can be changed in the future without breaking anything. -// const CLEANUP_THRESHOLD: usize = 64; - -impl LevelMonitor -where - Block: BlockT, - BE: Backend, -{ - fn update(&mut self, number: NumberFor, hash: Block::Hash) { - self.import_counters.insert(hash, self.import_counter); - self.levels.entry(number).or_default().push(hash); - self.import_counter += 1; - } - - fn check(&mut self, number: NumberFor) { - if self.import_counter == 0 { - // First call detected, restore using backend. - self.restore(); - } - - let level = self.levels.entry(number).or_default(); - if level.len() < self.level_limit { - return - } - - log::debug!( - target: "parachain", - "Detected leaves overflow at height {}, removing old blocks", number - ); - - let blockchain = self.backend.blockchain(); - let best = blockchain.info().best_hash; - - let mut leaves = blockchain.leaves().unwrap_or_default(); - // Sort leaves by import time. - leaves - .sort_unstable_by(|a, b| self.import_counters.get(a).cmp(&self.import_counters.get(b))); - - let remove_count = level.len() - self.level_limit + 1; - - let mut remove_one = || { - let mut candidate_idx = 0; - let mut candidate_routes = vec![]; - let mut candidate_fresher_leaf_idx = usize::MAX; - - for (blk_idx, blk_hash) in level.iter().enumerate() { - let mut blk_leaves_routes = vec![]; - let mut blk_fresher_leaf_idx = 0; - // Start from the most current one (the bottom) - // Here leaf index is synonym of its freshness, that is the greater the index the - // fresher it is. - for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { - let leaf_route = - match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { - Ok(route) => route, - Err(e) => { - log::warn!( - target: "parachain", - "Unable getting route from {} to {}: {}", - blk_hash, leaf_hash, e, - ); - continue - }, - }; - if leaf_route.retracted().is_empty() { - if leaf_idx > candidate_fresher_leaf_idx || - leaf_route.common_block().hash == best || - leaf_route.enacted().iter().any(|entry| entry.hash == best) - { - blk_leaves_routes.clear(); - break - } - - if blk_fresher_leaf_idx == 0 { - blk_fresher_leaf_idx = leaf_idx; - } - blk_leaves_routes.push(leaf_route); - } - } - - if !blk_leaves_routes.is_empty() { - candidate_idx = blk_idx; - candidate_routes = blk_leaves_routes; - candidate_fresher_leaf_idx = blk_fresher_leaf_idx; - } - } - - // We now have all the routes to remove - for route in candidate_routes.iter() { - std::iter::once(route.common_block()).chain(route.enacted()).rev().for_each( - |elem| { - self.import_counters.remove(&elem.hash); - if let Err(err) = self.backend.remove_leaf_block(&elem.hash) { - log::warn!(target: "parachain", "Unable to remove block {}: {}", elem.hash, err); - } - }, - ); - } - - level.remove(candidate_idx); - }; - - // This is not the most efficient way to remove multiple entries, - // but sould be considered that remove count is commonly 1. - (0..remove_count).for_each(|_| remove_one()); - } - - fn restore(&mut self) { - let leaves = self.backend.blockchain().leaves().unwrap_or_default(); - let finalized = self.backend.blockchain().last_finalized().unwrap_or_default(); - let mut counter_max = 0; - - for leaf in leaves { - let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) - .expect("Route from finalized to leaf should be present; qed"); - if !route.retracted().is_empty() { - continue - } - std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { - if !self.import_counters.contains_key(&elem.hash) { - self.import_counter = elem.number.unique_saturated_into(); - self.update(elem.number, elem.hash); - } - }); - if self.import_counter > counter_max { - counter_max = self.import_counter; - } - } - self.import_counter = counter_max; - } -} - /// Parachain specific block import. /// /// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is @@ -266,13 +97,7 @@ impl ParachainBlockImport { LevelLimit::Default => Some(MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT), }; - let level_monitor = level_limit.map(|level_limit| LevelMonitor { - level_limit, - import_counter: 0, - import_counters: HashMap::new(), - levels: HashMap::new(), - backend, - }); + let level_monitor = level_limit.map(|level_limit| LevelMonitor::new(level_limit, backend)); Self { inner, level_monitor } } diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index f77420bf563..f463cac1e01 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -26,7 +26,7 @@ use cumulus_test_client::{ use futures::{channel::mpsc, executor::block_on, select, FutureExt, Stream, StreamExt}; use futures_timer::Delay; use polkadot_primitives::v2::Id as ParaId; -use sc_client_api::{Backend as _, UsageProvider}; +use sc_client_api::{blockchain::Backend as _, Backend as _, UsageProvider}; use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy}; use sp_blockchain::Error as ClientError; use sp_consensus::BlockOrigin; @@ -489,7 +489,6 @@ fn prune_blocks_on_level_overflow() { assert_eq!(leaves, expected); } -// TODO: test monitor reload from backend #[test] fn restore_limit_monitor() { // Here we are using the timestamp value to generate blocks with different hashes. @@ -540,7 +539,7 @@ fn restore_limit_monitor() { }) .collect::>(); - // Simulate a restart by using a new structure + // Simulate a restart by forcing a new monitor structure instance let mut para_import = ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); @@ -570,5 +569,15 @@ fn restore_limit_monitor() { assert_eq!(leaves, expected); let monitor = para_import.level_monitor.unwrap(); - assert_eq!(monitor.import_counter, 0); + assert_eq!(monitor.import_counter, 5); + assert!(monitor.levels.iter().all(|(number, hashes)| { + hashes + .iter() + .filter(|hash| **hash != block13.header.hash()) + .all(|hash| *number as u64 == *monitor.import_counters.get(hash).unwrap()) + })); + assert_eq!( + *monitor.import_counters.get(&block13.header.hash()).unwrap(), + monitor.import_counter - 1 + ); } From 9c13d60db3c3a1d5edbc0a54a36a07ce8f311b0a Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 31 Aug 2022 18:04:13 +0200 Subject: [PATCH 21/59] Proper cleanup for descendants --- client/consensus/common/src/level_monitor.rs | 259 +++++++++++-------- client/consensus/common/src/lib.rs | 2 +- client/consensus/common/src/tests.rs | 7 +- 3 files changed, 156 insertions(+), 112 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index ae4f4580b1b..51647a6a206 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -15,13 +15,19 @@ // along with Cumulus. If not, see . use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; -use sp_runtime::traits::{Block as BlockT, NumberFor, UniqueSaturatedInto}; -use std::{collections::HashMap, sync::Arc}; +use sp_runtime::traits::{Block as BlockT, NumberFor, Saturating, UniqueSaturatedInto, Zero}; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, +}; /// Value good enough to be used with parachains using the current backend implementation /// that ships with Substrate. This value may change in the future. pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; +// Counter threshold after which we are going to eventually cleanup our internal data. +const CLEANUP_THRESHOLD: u64 = 32; + /// Upper bound to the number of leaves allowed for each level of the blockchain. /// /// If the limit is set and more leaves are detected on block import, then the older ones are @@ -39,32 +45,31 @@ pub enum LevelLimit { Some(usize), } -// Support structure to constrain the number of leaves for each level. +// Support structure to constrain the number of leaves at each level. pub struct LevelMonitor { // Max number of leaves for each level. pub level_limit: usize, - // Monotonic counter used to keep track of block import age (used as a timestamp). + // Monotonic counter used to keep track of block freshness. pub import_counter: u64, - // Map between leaves hashes and insertion timestamp. - pub import_counters: HashMap, - // Blockhain levels cache. - pub levels: HashMap, Vec>, - // Backend reference to remove leaves on level saturation. + // Map between blocks hashes and freshness. + pub freshness: HashMap, + // Blockchain levels cache. + pub levels: HashMap, HashSet>, + // Lower level number stored by the levels map. + pub lowest_level: NumberFor, + // Backend reference to remove blocks on level saturation. pub backend: Arc, } -// // Threshold after which we are going to cleanup our internal leaves cache by removing hashes that -// // doesn't belong to leaf blocks anymore. -// // This is a farly arbitrary value that can be changed in the future without breaking anything. -// const CLEANUP_THRESHOLD: usize = 64; - impl LevelMonitor { + /// Instance a new monitor structure. pub fn new(level_limit: usize, backend: Arc) -> Self { LevelMonitor { level_limit, import_counter: 0, - import_counters: HashMap::new(), + freshness: HashMap::new(), levels: HashMap::new(), + lowest_level: Zero::zero(), backend, } } @@ -75,15 +80,54 @@ where Block: BlockT, BE: Backend, { - pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { - self.import_counters.insert(hash, self.import_counter); - self.levels.entry(number).or_default().push(hash); - self.import_counter += 1; + /// Restore the structure using the backend. + /// + /// Blocks freshness values are inferred from the height and not from the effective import + /// moment. This is a not accurate but "good-enough" best effort solution. + /// + /// Level limits are not enforced during this phase. + fn restore(&mut self) { + let mut counter_max = 0; + let finalized = self.backend.blockchain().info().finalized_hash; + + for leaf in self.backend.blockchain().leaves().unwrap_or_default() { + let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) + .expect("Route from finalized to leaf should be available; qed"); + if !route.retracted().is_empty() { + continue + } + std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { + if !self.freshness.contains_key(&elem.hash) { + // Use the block height value as the freshness. + self.import_counter = elem.number.unique_saturated_into(); + self.update(elem.number, elem.hash); + } + }); + if self.import_counter > counter_max { + counter_max = self.import_counter; + } + } + + self.import_counter = counter_max; + self.lowest_level = self.backend.blockchain().info().finalized_number; } - pub fn check(&mut self, number: NumberFor) { + /// Check and enforce the limit bound at the given height. + /// + /// In practice this will enforce the given height in haiving a number of blocks less than + /// the limit passed to the constructor. + /// + /// If the given level is found to have a number of blocks greater than or equal the limit + /// then the limit is enforced by chosing one (or more) blocks to remove. + /// The removal strategy is driven by the block freshess. + /// + /// A block freshness is determined by the most recent leaf freshness descending from the block + /// itself. In other words its freshness is equal to its more "fresh" descendant. + /// + /// The least "fresh" blocks are eventually removed. + pub fn enforce_limit(&mut self, number: NumberFor) { if self.import_counter == 0 { - // First call detected, restore using backend. + // First call detected, restore using the backend persistent information. self.restore(); } @@ -94,107 +138,110 @@ where log::debug!( target: "parachain", - "Detected leaves overflow at height {}, removing old blocks", number + "Detected leaves overflow at height {}, removing obsolete blocks", number ); - let blockchain = self.backend.blockchain(); - let best = blockchain.info().best_hash; - - let mut leaves = blockchain.leaves().unwrap_or_default(); - // Sort leaves by import time. - leaves - .sort_unstable_by(|a, b| self.import_counters.get(a).cmp(&self.import_counters.get(b))); + let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); + // Sort leaves by freshness (most recent first). + leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); let remove_count = level.len() - self.level_limit + 1; - let mut remove_one = || { - let mut candidate_idx = 0; - let mut candidate_routes = vec![]; - let mut candidate_fresher_leaf_idx = usize::MAX; - - for (blk_idx, blk_hash) in level.iter().enumerate() { - let mut blk_leaves_routes = vec![]; - let mut blk_fresher_leaf_idx = 0; - // Start from the most current one (the bottom) - // Here leaf index is synonym of its freshness, that is the greater the index the - // fresher it is. - for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { - let leaf_route = - match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { - Ok(route) => route, - Err(e) => { - log::warn!( - target: "parachain", - "Unable getting route from {} to {}: {}", - blk_hash, leaf_hash, e, - ); - continue - }, - }; - if leaf_route.retracted().is_empty() { - if leaf_idx > candidate_fresher_leaf_idx || - leaf_route.common_block().hash == best || - leaf_route.enacted().iter().any(|entry| entry.hash == best) - { - blk_leaves_routes.clear(); - break - } - - if blk_fresher_leaf_idx == 0 { - blk_fresher_leaf_idx = leaf_idx; - } - blk_leaves_routes.push(leaf_route); + // This may not be the most efficient way to remove **multiple** entries, but is the clear + // one. Should be considered that in normal conditions the number of blocks to remove is 0 + // or 1, it is not worth to complicate the code too much. + (0..remove_count).for_each(|_| self.remove_block(number, &leaves)); + } + + /// This will effectively search for the less fresh block and removes it along with all + /// its descendants. + fn remove_block(&mut self, number: NumberFor, leaves: &[Block::Hash]) { + let mut candidate_leaves_routes = vec![]; + let mut candidate_fresher_leaf_idx = usize::MAX; + + let mut leaves_routes = vec![]; + + let blockchain = self.backend.blockchain(); + let best_hash = blockchain.info().best_hash; + + for blk_hash in self.levels.entry(number).or_default().iter() { + let mut fresher_leaf_idx = usize::MAX; + // Start checking the most fresh leaf (the last) + // Here leaf index is synonym of its freshness, that is the greater the index the + // fresher it is. + for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { + let route = match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) => route, + Err(e) => { + log::warn!( + target: "parachain", + "Unable getting route from {} to {}: {}", + blk_hash, leaf_hash, e, + ); + continue + }, + }; + if route.retracted().is_empty() { + if leaf_idx >= candidate_fresher_leaf_idx || + route.common_block().hash == best_hash || + route.enacted().iter().any(|entry| entry.hash == best_hash) + { + leaves_routes.clear(); + break } - } - if !blk_leaves_routes.is_empty() { - candidate_idx = blk_idx; - candidate_routes = blk_leaves_routes; - candidate_fresher_leaf_idx = blk_fresher_leaf_idx; + if leaves_routes.is_empty() { + fresher_leaf_idx = leaf_idx; + } + leaves_routes.push(route); } } - // We now have all the routes to remove - for route in candidate_routes.iter() { - std::iter::once(route.common_block()).chain(route.enacted()).rev().for_each( - |elem| { - self.import_counters.remove(&elem.hash); - if let Err(err) = self.backend.remove_leaf_block(&elem.hash) { - log::warn!(target: "parachain", "Unable to remove block {}: {}", elem.hash, err); - } - }, - ); + if !leaves_routes.is_empty() { + // We have a new candidate + candidate_fresher_leaf_idx = fresher_leaf_idx; + std::mem::swap(&mut leaves_routes, &mut candidate_leaves_routes); + leaves_routes.clear(); } + } - level.remove(candidate_idx); - }; - - // This is not the most efficient way to remove multiple entries, - // but sould be considered that remove count is commonly 1. - (0..remove_count).for_each(|_| remove_one()); + // We now have all the routes to remove + for route in candidate_leaves_routes { + std::iter::once(route.common_block()) + .chain(route.enacted()) + .rev() + .for_each(|elem| { + if self.backend.remove_leaf_block(&elem.hash).is_ok() { + log::debug!(target: "parachain", "Removing block {}", elem.hash); + self.levels + .get_mut(&elem.number) + .and_then(|level| level.remove(&elem.hash).then_some(())); + self.freshness.remove(&elem.hash); + } + }); + } } - pub fn restore(&mut self) { - let leaves = self.backend.blockchain().leaves().unwrap_or_default(); - let finalized = self.backend.blockchain().last_finalized().unwrap_or_default(); - let mut counter_max = 0; + /// Add a new imported block information to the monitor. + pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { + self.freshness.insert(hash, self.import_counter); + self.levels.entry(number).or_default().insert(hash); + self.import_counter += 1; - for leaf in leaves { - let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) - .expect("Route from finalized to leaf should be present; qed"); - if !route.retracted().is_empty() { - continue - } - std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { - if !self.import_counters.contains_key(&elem.hash) { - self.import_counter = elem.number.unique_saturated_into(); - self.update(elem.number, elem.hash); - } - }); - if self.import_counter > counter_max { - counter_max = self.import_counter; + if self.import_counter % CLEANUP_THRESHOLD == 0 { + // Do cleanup once in a while, we are allowed to have some obsolete information. + let finalized_num = self.backend.blockchain().info().finalized_number; + let delta: u64 = + finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); + + for i in 0..delta { + let number = finalized_num + i.unique_saturated_into(); + self.levels.remove(&number).unwrap_or_default().iter().for_each(|hash| { + self.freshness.remove(hash); + }); } + + self.lowest_level = finalized_num; } - self.import_counter = counter_max; } } diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index fb49d5ff3a2..369833d666c 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -129,7 +129,7 @@ where let hash = params.header.hash(); if let Some(ref mut monitor) = self.level_monitor { - monitor.check(number); + monitor.enforce_limit(number); } // Best block is determined by the relay chain, or if we are doing the initial sync diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index f463cac1e01..6a926a0be64 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -574,10 +574,7 @@ fn restore_limit_monitor() { hashes .iter() .filter(|hash| **hash != block13.header.hash()) - .all(|hash| *number as u64 == *monitor.import_counters.get(hash).unwrap()) + .all(|hash| *number as u64 == *monitor.freshness.get(hash).unwrap()) })); - assert_eq!( - *monitor.import_counters.get(&block13.header.hash()).unwrap(), - monitor.import_counter - 1 - ); + assert_eq!(*monitor.freshness.get(&block13.header.hash()).unwrap(), monitor.import_counter - 1); } From 765b59ac5dd45f7e39a63ad6541dc77b74d3ead3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 1 Sep 2022 12:06:38 +0200 Subject: [PATCH 22/59] Apply suggestions from code review Co-authored-by: Sebastian Kunert --- client/consensus/common/src/level_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 51647a6a206..83f657250dc 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -119,7 +119,7 @@ where /// /// If the given level is found to have a number of blocks greater than or equal the limit /// then the limit is enforced by chosing one (or more) blocks to remove. - /// The removal strategy is driven by the block freshess. + /// The removal strategy is driven by the block freshness. /// /// A block freshness is determined by the most recent leaf freshness descending from the block /// itself. In other words its freshness is equal to its more "fresh" descendant. From ffeeb2213cce44b70864213f70eca6784c49514e Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 1 Sep 2022 14:24:07 +0200 Subject: [PATCH 23/59] Optimization --- client/consensus/common/src/level_monitor.rs | 123 +++++++++++-------- 1 file changed, 72 insertions(+), 51 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 83f657250dc..7226e3b5242 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -15,6 +15,7 @@ // along with Cumulus. If not, see . use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; +use sp_blockchain::TreeRoute; use sp_runtime::traits::{Block as BlockT, NumberFor, Saturating, UniqueSaturatedInto, Zero}; use std::{ collections::{HashMap, HashSet}, @@ -114,7 +115,7 @@ where /// Check and enforce the limit bound at the given height. /// - /// In practice this will enforce the given height in haiving a number of blocks less than + /// In practice this will enforce the given height in having a number of blocks less than /// the limit passed to the constructor. /// /// If the given level is found to have a number of blocks greater than or equal the limit @@ -145,81 +146,101 @@ where // Sort leaves by freshness (most recent first). leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); - let remove_count = level.len() - self.level_limit + 1; - // This may not be the most efficient way to remove **multiple** entries, but is the clear // one. Should be considered that in normal conditions the number of blocks to remove is 0 // or 1, it is not worth to complicate the code too much. + let remove_count = level.len() - self.level_limit + 1; (0..remove_count).for_each(|_| self.remove_block(number, &leaves)); } - /// This will effectively search for the less fresh block and removes it along with all - /// its descendants. + /// This will search for the less fresh block and removes it along with all its descendants. + /// Leaves should have already been ordered by "freshness" (older first). fn remove_block(&mut self, number: NumberFor, leaves: &[Block::Hash]) { - let mut candidate_leaves_routes = vec![]; let mut candidate_fresher_leaf_idx = usize::MAX; - - let mut leaves_routes = vec![]; + let mut candidate_fresher_route = None; let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; for blk_hash in self.levels.entry(number).or_default().iter() { - let mut fresher_leaf_idx = usize::MAX; - // Start checking the most fresh leaf (the last) - // Here leaf index is synonym of its freshness, that is the greater the index the + // Start checking from the most fresh leaf (the last). Because of the leaves ordering, + // here leaf index is synonym of its freshness, that is the greater the index the // fresher it is. for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { - let route = match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { - Ok(route) => route, - Err(e) => { + match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => { + // Skip this block if it is the ancestor of the best block or if it has + // a descendant leaf fresher (or equally fresh) than the current candidate. + if leaf_idx < candidate_fresher_leaf_idx && + route.common_block().hash != best_hash && + route.enacted().iter().all(|entry| entry.hash != best_hash) + { + // We have a new candidate + candidate_fresher_leaf_idx = leaf_idx; + candidate_fresher_route = Some(route); + } + break + }, + Err(err) => { log::warn!( target: "parachain", "Unable getting route from {} to {}: {}", - blk_hash, leaf_hash, e, + blk_hash, leaf_hash, err, ); - continue }, + _ => (), }; - if route.retracted().is_empty() { - if leaf_idx >= candidate_fresher_leaf_idx || - route.common_block().hash == best_hash || - route.enacted().iter().any(|entry| entry.hash == best_hash) - { - leaves_routes.clear(); - break - } - - if leaves_routes.is_empty() { - fresher_leaf_idx = leaf_idx; - } - leaves_routes.push(route); - } } - - if !leaves_routes.is_empty() { - // We have a new candidate - candidate_fresher_leaf_idx = fresher_leaf_idx; - std::mem::swap(&mut leaves_routes, &mut candidate_leaves_routes); - leaves_routes.clear(); + if candidate_fresher_leaf_idx == 0 { + // We can't find a candidate with an older leaf. + break } } - // We now have all the routes to remove - for route in candidate_leaves_routes { - std::iter::once(route.common_block()) - .chain(route.enacted()) - .rev() - .for_each(|elem| { - if self.backend.remove_leaf_block(&elem.hash).is_ok() { - log::debug!(target: "parachain", "Removing block {}", elem.hash); - self.levels - .get_mut(&elem.number) - .and_then(|level| level.remove(&elem.hash).then_some(())); - self.freshness.remove(&elem.hash); - } - }); - } + let candidate_fresher_route = match candidate_fresher_route { + Some(route) => route, + None => return, + }; + + // We have a candidate, proceed removing the blocka and all its descendants. + + let candidate_hash = candidate_fresher_route.common_block().hash; + + // Takes care of route removal. Starts from the leaf and stops as soon as an error is + // encountered (in this case this is interpreted as the block being not a leaf + // and it will be removed while removing another route from the same block but to a + // different leaf. + let mut remove_route = |route: TreeRoute| { + std::iter::once(route.common_block()).chain(route.enacted()).rev().all(|elem| { + if self.backend.remove_leaf_block(&elem.hash).is_err() { + return false + } + log::debug!(target: "parachain", "Removing block {}", elem.hash); + self.levels + .get_mut(&elem.number) + .and_then(|level| level.remove(&elem.hash).then_some(())); + self.freshness.remove(&elem.hash); + true + }); + }; + + remove_route(candidate_fresher_route); + + leaves.iter().rev().skip(candidate_fresher_leaf_idx).for_each(|leaf_hash| { + match sp_blockchain::tree_route(blockchain, candidate_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => { + remove_route(route); + }, + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {} to {}: {}", + candidate_hash, leaf_hash, err, + ); + }, + _ => (), + }; + }); } /// Add a new imported block information to the monitor. From 7e6ed4726359400fa297a902f4b6426f3e5868a3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 1 Sep 2022 14:45:29 +0200 Subject: [PATCH 24/59] Fix --- client/consensus/common/src/level_monitor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 7226e3b5242..94164c4c3f9 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -226,7 +226,8 @@ where remove_route(candidate_fresher_route); - leaves.iter().rev().skip(candidate_fresher_leaf_idx).for_each(|leaf_hash| { + let to_skip = leaves.len() - candidate_fresher_leaf_idx; + leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { match sp_blockchain::tree_route(blockchain, candidate_hash, *leaf_hash) { Ok(route) if route.retracted().is_empty() => { remove_route(route); From 5dbfe14047500fc53db8de75e38eaf18c7442763 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 1 Sep 2022 14:47:36 +0200 Subject: [PATCH 25/59] Fix typo --- client/consensus/common/src/level_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 94164c4c3f9..bfada43f087 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -207,7 +207,7 @@ where let candidate_hash = candidate_fresher_route.common_block().hash; // Takes care of route removal. Starts from the leaf and stops as soon as an error is - // encountered (in this case this is interpreted as the block being not a leaf + // encountered. In this case an error is interpreted as the block being not a leaf // and it will be removed while removing another route from the same block but to a // different leaf. let mut remove_route = |route: TreeRoute| { From 2d9242c01a33686cb2cdb4b7fbc8cc506fc80441 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 1 Sep 2022 16:28:04 +0200 Subject: [PATCH 26/59] Nit. Rename some fresher to freshest --- client/consensus/common/src/level_monitor.rs | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index bfada43f087..6fd2d549696 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -156,8 +156,8 @@ where /// This will search for the less fresh block and removes it along with all its descendants. /// Leaves should have already been ordered by "freshness" (older first). fn remove_block(&mut self, number: NumberFor, leaves: &[Block::Hash]) { - let mut candidate_fresher_leaf_idx = usize::MAX; - let mut candidate_fresher_route = None; + let mut candidate_freshest_leaf_idx = usize::MAX; + let mut candidate_freshest_route = None; let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; @@ -171,13 +171,13 @@ where Ok(route) if route.retracted().is_empty() => { // Skip this block if it is the ancestor of the best block or if it has // a descendant leaf fresher (or equally fresh) than the current candidate. - if leaf_idx < candidate_fresher_leaf_idx && + if leaf_idx < candidate_freshest_leaf_idx && route.common_block().hash != best_hash && route.enacted().iter().all(|entry| entry.hash != best_hash) { // We have a new candidate - candidate_fresher_leaf_idx = leaf_idx; - candidate_fresher_route = Some(route); + candidate_freshest_leaf_idx = leaf_idx; + candidate_freshest_route = Some(route); } break }, @@ -191,20 +191,20 @@ where _ => (), }; } - if candidate_fresher_leaf_idx == 0 { + if candidate_freshest_leaf_idx == 0 { // We can't find a candidate with an older leaf. break } } - let candidate_fresher_route = match candidate_fresher_route { + let candidate_freshest_route = match candidate_freshest_route { Some(route) => route, None => return, }; - // We have a candidate, proceed removing the blocka and all its descendants. + // We have a candidate, proceed removing the block and all its descendants. - let candidate_hash = candidate_fresher_route.common_block().hash; + let candidate_hash = candidate_freshest_route.common_block().hash; // Takes care of route removal. Starts from the leaf and stops as soon as an error is // encountered. In this case an error is interpreted as the block being not a leaf @@ -224,9 +224,9 @@ where }); }; - remove_route(candidate_fresher_route); + remove_route(candidate_freshest_route); - let to_skip = leaves.len() - candidate_fresher_leaf_idx; + let to_skip = leaves.len() - candidate_freshest_leaf_idx; leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { match sp_blockchain::tree_route(blockchain, candidate_hash, *leaf_hash) { Ok(route) if route.retracted().is_empty() => { From eff06c5f22d1892ff1fdea3b8d38c558ca120997 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 8 Sep 2022 14:49:47 +0200 Subject: [PATCH 27/59] Dedicated ParachainBlockImport constructor with explicit LevelLimit --- client/consensus/aura/src/import_queue.rs | 5 ++--- client/consensus/aura/src/lib.rs | 4 ++-- client/consensus/common/src/lib.rs | 9 +++++++- client/consensus/common/src/tests.rs | 21 +++++++++++++------ .../consensus/relay-chain/src/import_queue.rs | 4 ++-- client/consensus/relay-chain/src/lib.rs | 3 +-- polkadot-parachain/src/service.rs | 4 ++-- 7 files changed, 32 insertions(+), 18 deletions(-) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 408bc367cc0..f778b70cc07 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -17,6 +17,7 @@ //! Parachain specific wrapper for the AuRa import queue. use codec::Codec; +use cumulus_client_consensus_common::ParachainBlockImport; use sc_client_api::{backend::AuxStore, Backend, BlockOf, UsageProvider}; use sc_consensus::{import_queue::DefaultImportQueue, BlockImport}; use sc_consensus_aura::AuraVerifier; @@ -90,10 +91,8 @@ where CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, BE: Backend + 'static, { - use cumulus_client_consensus_common::{LevelLimit, ParachainBlockImport}; - sc_consensus_aura::import_queue::(sc_consensus_aura::ImportQueueParams { - block_import: ParachainBlockImport::new(block_import, backend, LevelLimit::Default), + block_import: ParachainBlockImport::new(block_import, backend), justification_import: None, client, create_inherent_data_providers, diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index ffe9500060f..8cb3967c0b7 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -24,7 +24,7 @@ use codec::{Decode, Encode}; use cumulus_client_consensus_common::{ - LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, PersistedValidationData}; @@ -119,7 +119,7 @@ where let worker = sc_consensus_aura::build_aura_worker::( BuildAuraWorkerParams { client: para_client, - block_import: ParachainBlockImport::new(block_import, backend, LevelLimit::Default), + block_import: ParachainBlockImport::new(block_import, backend), justification_sync_link: (), proposer_factory, sync_oracle, diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 369833d666c..d96be6771ef 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -90,7 +90,14 @@ pub struct ParachainBlockImport { impl ParachainBlockImport { /// Create a new instance. - pub fn new(inner: BI, backend: Arc, level_leaves_max: LevelLimit) -> Self { + /// + /// The number of leaves per level limit is set to `LevelLimit::Default`. + pub fn new(inner: BI, backend: Arc) -> Self { + Self::new_with_limit(inner, backend, LevelLimit::Default) + } + + /// Create a new instance with an explicit limit to the number of leaves per level. + pub fn new_with_limit(inner: BI, backend: Arc, level_leaves_max: LevelLimit) -> Self { let level_limit = match level_leaves_max { LevelLimit::None => None, LevelLimit::Some(limit) => Some(limit), diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 6a926a0be64..6e5f611399c 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -389,8 +389,11 @@ fn prune_blocks_on_level_overflow() { let backend = Arc::new(Backend::new_test(1000, 3)); let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); - let mut para_import = - ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); + let mut para_import = ParachainBlockImport::new_with_limit( + client.clone(), + backend.clone(), + LevelLimit::Some(LEVEL_LIMIT), + ); let block0 = build_and_import_block_ext( &*client, @@ -497,8 +500,11 @@ fn restore_limit_monitor() { let backend = Arc::new(Backend::new_test(1000, 3)); let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); - let mut para_import = - ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); + let mut para_import = ParachainBlockImport::new_with_limit( + client.clone(), + backend.clone(), + LevelLimit::Some(LEVEL_LIMIT), + ); let block0 = build_and_import_block_ext( &*client, @@ -541,8 +547,11 @@ fn restore_limit_monitor() { // Simulate a restart by forcing a new monitor structure instance - let mut para_import = - ParachainBlockImport::new(client.clone(), backend.clone(), LevelLimit::Some(LEVEL_LIMIT)); + let mut para_import = ParachainBlockImport::new_with_limit( + client.clone(), + backend.clone(), + LevelLimit::Some(LEVEL_LIMIT), + ); let block13 = build_and_import_block_ext( &*client, diff --git a/client/consensus/relay-chain/src/import_queue.rs b/client/consensus/relay-chain/src/import_queue.rs index e3e41577cc0..3ddc20d083e 100644 --- a/client/consensus/relay-chain/src/import_queue.rs +++ b/client/consensus/relay-chain/src/import_queue.rs @@ -30,7 +30,7 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT}, }; -use cumulus_client_consensus_common::{LevelLimit, ParachainBlockImport}; +use cumulus_client_consensus_common::ParachainBlockImport; /// A verifier that just checks the inherents. pub struct Verifier { @@ -123,7 +123,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(block_import, backend, LevelLimit::Default)), + Box::new(ParachainBlockImport::new(block_import, backend)), None, spawner, registry, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index 4ff4a6a43ff..ecf9719b19e 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -34,7 +34,7 @@ //! 5. After the parachain candidate got backed and included, all collators start at 1. use cumulus_client_consensus_common::{ - LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, ParaId, PersistedValidationData}; use cumulus_relay_chain_interface::RelayChainInterface; @@ -102,7 +102,6 @@ where block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new( block_import, backend, - LevelLimit::Default, ))), relay_chain_interface, } diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 4c686007bb0..3dbedebb0b2 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -18,7 +18,7 @@ use codec::Codec; use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::{ - LevelLimit, ParachainBlockImport, ParachainCandidate, ParachainConsensus, + ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_service::{ @@ -1150,7 +1150,7 @@ where Ok(BasicQueue::new( verifier, - Box::new(ParachainBlockImport::new(client, backend, LevelLimit::Default)), + Box::new(ParachainBlockImport::new(client, backend)), None, &spawner, registry, From 7a8d6631398a0246e460a7142be90eeb2e3327fe Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 13:43:13 +0200 Subject: [PATCH 28/59] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/consensus/common/src/level_monitor.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 6fd2d549696..1a8e7134a01 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -132,14 +132,15 @@ where self.restore(); } - let level = self.levels.entry(number).or_default(); + let level_len = self.levels.get(&number).map(|l| l.len()).unwrap_or_default(); if level.len() < self.level_limit { return } log::debug!( target: "parachain", - "Detected leaves overflow at height {}, removing obsolete blocks", number + "Detected leaves overflow at height {}, removing obsolete blocks", + number, ); let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); @@ -184,7 +185,7 @@ where Err(err) => { log::warn!( target: "parachain", - "Unable getting route from {} to {}: {}", + "Unable getting route from {:?} to {:?}: {}", blk_hash, leaf_hash, err, ); }, @@ -218,7 +219,7 @@ where log::debug!(target: "parachain", "Removing block {}", elem.hash); self.levels .get_mut(&elem.number) - .and_then(|level| level.remove(&elem.hash).then_some(())); + .map(|level| level.remove(&elem.hash)); self.freshness.remove(&elem.hash); true }); @@ -257,7 +258,7 @@ where finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); for i in 0..delta { - let number = finalized_num + i.unique_saturated_into(); + let number = self.lowest_level + i.unique_saturated_into(); self.levels.remove(&number).unwrap_or_default().iter().for_each(|hash| { self.freshness.remove(hash); }); From 4f15278ff6db914ac5b29698eef4ea04b276724c Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 15:07:58 +0200 Subject: [PATCH 29/59] Fmt --- client/consensus/common/src/level_monitor.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 1a8e7134a01..6f856bcc011 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -217,9 +217,7 @@ where return false } log::debug!(target: "parachain", "Removing block {}", elem.hash); - self.levels - .get_mut(&elem.number) - .map(|level| level.remove(&elem.hash)); + self.levels.get_mut(&elem.number).map(|level| level.remove(&elem.hash)); self.freshness.remove(&elem.hash); true }); From cc60027d35cfabbe6eb84990e264c18a15f688a3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 15:30:14 +0200 Subject: [PATCH 30/59] Fix typo --- client/consensus/common/src/level_monitor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 6f856bcc011..e3d761a894f 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -133,7 +133,7 @@ where } let level_len = self.levels.get(&number).map(|l| l.len()).unwrap_or_default(); - if level.len() < self.level_limit { + if level_len < self.level_limit { return } @@ -150,7 +150,7 @@ where // This may not be the most efficient way to remove **multiple** entries, but is the clear // one. Should be considered that in normal conditions the number of blocks to remove is 0 // or 1, it is not worth to complicate the code too much. - let remove_count = level.len() - self.level_limit + 1; + let remove_count = level_len - self.level_limit + 1; (0..remove_count).for_each(|_| self.remove_block(number, &leaves)); } From 48e0cc9faeca7b7fd234b8735fc6562c561579bd Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 15:32:14 +0200 Subject: [PATCH 31/59] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/consensus/common/src/level_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index e3d761a894f..741fefb6ab4 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -144,7 +144,7 @@ where ); let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); - // Sort leaves by freshness (most recent first). + // Sort leaves by freshness (least recent first). leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); // This may not be the most efficient way to remove **multiple** entries, but is the clear From 7b51bb0782fcb9ef1f944eea52642e991c6cdf4f Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 17:19:39 +0200 Subject: [PATCH 32/59] Use block number instead of u64 for import counter --- client/consensus/common/src/level_monitor.rs | 46 +++++++++++--------- client/consensus/common/src/tests.rs | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 741fefb6ab4..eafe733dd8e 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -16,7 +16,7 @@ use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; use sp_blockchain::TreeRoute; -use sp_runtime::traits::{Block as BlockT, NumberFor, Saturating, UniqueSaturatedInto, Zero}; +use sp_runtime::traits::{Block as BlockT, NumberFor, One, Saturating, UniqueSaturatedInto, Zero}; use std::{ collections::{HashMap, HashSet}, sync::Arc, @@ -51,9 +51,9 @@ pub struct LevelMonitor { // Max number of leaves for each level. pub level_limit: usize, // Monotonic counter used to keep track of block freshness. - pub import_counter: u64, + pub import_counter: NumberFor, // Map between blocks hashes and freshness. - pub freshness: HashMap, + pub freshness: HashMap>, // Blockchain levels cache. pub levels: HashMap, HashSet>, // Lower level number stored by the levels map. @@ -67,7 +67,7 @@ impl LevelMonitor { pub fn new(level_limit: usize, backend: Arc) -> Self { LevelMonitor { level_limit, - import_counter: 0, + import_counter: Zero::zero(), freshness: HashMap::new(), levels: HashMap::new(), lowest_level: Zero::zero(), @@ -88,19 +88,23 @@ where /// /// Level limits are not enforced during this phase. fn restore(&mut self) { - let mut counter_max = 0; - let finalized = self.backend.blockchain().info().finalized_hash; + let mut counter_max = Zero::zero(); + let info = self.backend.blockchain().info(); + + self.import_counter = info.finalized_number; + self.update(info.finalized_number, info.finalized_hash); for leaf in self.backend.blockchain().leaves().unwrap_or_default() { - let route = sp_blockchain::tree_route(self.backend.blockchain(), finalized, leaf) - .expect("Route from finalized to leaf should be available; qed"); + let route = + sp_blockchain::tree_route(self.backend.blockchain(), info.finalized_hash, leaf) + .expect("Route from finalized to leaf should be available; qed"); if !route.retracted().is_empty() { continue } - std::iter::once(route.common_block()).chain(route.enacted()).for_each(|elem| { + route.enacted().iter().for_each(|elem| { if !self.freshness.contains_key(&elem.hash) { // Use the block height value as the freshness. - self.import_counter = elem.number.unique_saturated_into(); + self.import_counter = elem.number; self.update(elem.number, elem.hash); } }); @@ -127,7 +131,7 @@ where /// /// The least "fresh" blocks are eventually removed. pub fn enforce_limit(&mut self, number: NumberFor) { - if self.import_counter == 0 { + if self.import_counter == Zero::zero() { // First call detected, restore using the backend persistent information. self.restore(); } @@ -150,6 +154,8 @@ where // This may not be the most efficient way to remove **multiple** entries, but is the clear // one. Should be considered that in normal conditions the number of blocks to remove is 0 // or 1, it is not worth to complicate the code too much. + // One condition that may trigger multiple removals is if we restart the node using an + // existing db and a smaller limit wrt the one previously used. let remove_count = level_len - self.level_limit + 1; (0..remove_count).for_each(|_| self.remove_block(number, &leaves)); } @@ -247,18 +253,18 @@ where pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { self.freshness.insert(hash, self.import_counter); self.levels.entry(number).or_default().insert(hash); - self.import_counter += 1; - - if self.import_counter % CLEANUP_THRESHOLD == 0 { - // Do cleanup once in a while, we are allowed to have some obsolete information. - let finalized_num = self.backend.blockchain().info().finalized_number; - let delta: u64 = - finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); + self.import_counter += One::one(); + // Do cleanup once in a while, we are allowed to have some obsolete information. + let finalized_num = self.backend.blockchain().info().finalized_number; + let delta: u64 = finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); + if delta >= CLEANUP_THRESHOLD { for i in 0..delta { let number = self.lowest_level + i.unique_saturated_into(); - self.levels.remove(&number).unwrap_or_default().iter().for_each(|hash| { - self.freshness.remove(hash); + self.levels.remove(&number).map(|level| { + level.iter().for_each(|hash| { + self.freshness.remove(hash); + }) }); } diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 6e5f611399c..23566528d99 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -583,7 +583,7 @@ fn restore_limit_monitor() { hashes .iter() .filter(|hash| **hash != block13.header.hash()) - .all(|hash| *number as u64 == *monitor.freshness.get(hash).unwrap()) + .all(|hash| *number == *monitor.freshness.get(hash).unwrap()) })); assert_eq!(*monitor.freshness.get(&block13.header.hash()).unwrap(), monitor.import_counter - 1); } From a9d0b1e081b19456ba343fc373a34b0eb5f72a08 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 18:58:54 +0200 Subject: [PATCH 33/59] Separate target find and removal logic --- client/consensus/common/src/level_monitor.rs | 149 ++++++++++++------- 1 file changed, 94 insertions(+), 55 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index eafe733dd8e..4fc0243195a 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -76,6 +76,14 @@ impl LevelMonitor { } } +// Internal support structure containing information about the target scheduled for removal. +struct TargetInfo { + // Index of freshest leaf in the leaves array. + freshest_leaf_idx: usize, + // Route from target to its freshest leaf. + freshest_route: TreeRoute, +} + impl LevelMonitor where Block: BlockT, @@ -124,6 +132,7 @@ where /// /// If the given level is found to have a number of blocks greater than or equal the limit /// then the limit is enforced by chosing one (or more) blocks to remove. + /// /// The removal strategy is driven by the block freshness. /// /// A block freshness is determined by the most recent leaf freshness descending from the block @@ -148,28 +157,97 @@ where ); let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); - // Sort leaves by freshness (least recent first). + // Sort leaves by freshness (least fresh first). leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); - // This may not be the most efficient way to remove **multiple** entries, but is the clear - // one. Should be considered that in normal conditions the number of blocks to remove is 0 - // or 1, it is not worth to complicate the code too much. - // One condition that may trigger multiple removals is if we restart the node using an - // existing db and a smaller limit wrt the one previously used. + // This may not be the most efficient way to remove **multiple** entries, but is the easy + // one :-). Should be considered that in "normal" conditions the number of blocks to remove + // is 0 or 1, it is not worth to complicate the code too much. One condition that may + // trigger multiple removals (2+) is if we restart the node using an existing db and a + // smaller limit wrt the one previously used. let remove_count = level_len - self.level_limit + 1; - (0..remove_count).for_each(|_| self.remove_block(number, &leaves)); + (0..remove_count).all(|_| { + self.find_target(number, &leaves).map_or(false, |target| { + self.remove_target(target, &leaves); + true + }) + }); + } + + // Remove the target block and all its descendants. + // + // Leaves should have already been ordered by "freshness" (older first). + fn remove_target(&mut self, target: TargetInfo, leaves: &[Block::Hash]) { + let mut remove_leaf = |number, hash| { + if self.backend.remove_leaf_block(&hash).is_err() { + return false + } + log::debug!(target: "parachain", "Removing block {}", hash); + self.levels.get_mut(&number).map(|level| level.remove(&hash)); + self.freshness.remove(&hash); + true + }; + + // Takes care of route removal. Starts from the leaf and stops as soon as an error is + // encountered. In this case an error is interpreted as the block being not a leaf + // and it will be removed while removing another route from the same block but to a + // different leaf. + let mut remove_route = |route: TreeRoute| { + route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); + }; + + let target_number = target.freshest_route.common_block().number; + let target_hash = target.freshest_route.common_block().hash; + + remove_route(target.freshest_route); + + // Don't bother trying with leaves we already found to not be our descendants. + let to_skip = leaves.len() - target.freshest_leaf_idx; + leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { + match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => remove_route(route), + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {:?} to {:?}: {}", + target_hash, leaf_hash, err, + ); + }, + _ => (), + }; + }); + + remove_leaf(target_number, target_hash); } - /// This will search for the less fresh block and removes it along with all its descendants. - /// Leaves should have already been ordered by "freshness" (older first). - fn remove_block(&mut self, number: NumberFor, leaves: &[Block::Hash]) { + // Helper function to find the best candidate to be removed. + // + // Given a set of blocks with height equal to `number` (potential candidates) + // 1. For each candidate fetch all the leaves that are descending from it. + // 2. Set the candidate freshness equal to the fresher of its descending leaves. + // 3. The target is set as the candidate that is less fresh. + // + // Input `leaves` are assumed to be already ordered by "freshness" (fresher first). + // + // Returns the index of the target fresher leaf within `leaves` and the route from target to + // such leaf. + fn find_target( + &self, + number: NumberFor, + leaves: &[Block::Hash], + ) -> Option> { let mut candidate_freshest_leaf_idx = usize::MAX; let mut candidate_freshest_route = None; let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; - for blk_hash in self.levels.entry(number).or_default().iter() { + let level = match self.levels.get(&number) { + Some(level) => level, + None => return None, + }; + + for blk_hash in level.iter() { // Start checking from the most fresh leaf (the last). Because of the leaves ordering, // here leaf index is synonym of its freshness, that is the greater the index the // fresher it is. @@ -199,54 +277,15 @@ where }; } if candidate_freshest_leaf_idx == 0 { - // We can't find a candidate with an older leaf. + // We can't find a candidate with an older leaf that the current one. break } } - let candidate_freshest_route = match candidate_freshest_route { - Some(route) => route, - None => return, - }; - - // We have a candidate, proceed removing the block and all its descendants. - - let candidate_hash = candidate_freshest_route.common_block().hash; - - // Takes care of route removal. Starts from the leaf and stops as soon as an error is - // encountered. In this case an error is interpreted as the block being not a leaf - // and it will be removed while removing another route from the same block but to a - // different leaf. - let mut remove_route = |route: TreeRoute| { - std::iter::once(route.common_block()).chain(route.enacted()).rev().all(|elem| { - if self.backend.remove_leaf_block(&elem.hash).is_err() { - return false - } - log::debug!(target: "parachain", "Removing block {}", elem.hash); - self.levels.get_mut(&elem.number).map(|level| level.remove(&elem.hash)); - self.freshness.remove(&elem.hash); - true - }); - }; - - remove_route(candidate_freshest_route); - - let to_skip = leaves.len() - candidate_freshest_leaf_idx; - leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { - match sp_blockchain::tree_route(blockchain, candidate_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => { - remove_route(route); - }, - Err(err) => { - log::warn!( - target: "parachain", - "Unable getting route from {} to {}: {}", - candidate_hash, leaf_hash, err, - ); - }, - _ => (), - }; - }); + candidate_freshest_route.map(|route| TargetInfo { + freshest_leaf_idx: candidate_freshest_leaf_idx, + freshest_route: route, + }) } /// Add a new imported block information to the monitor. From 27e8f0400255c45822499f90cbe82df172744213 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 14 Sep 2022 19:28:57 +0200 Subject: [PATCH 34/59] Code adjustments --- client/consensus/common/src/level_monitor.rs | 94 ++++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 4fc0243195a..13a75fb527d 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -157,7 +157,7 @@ where ); let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); - // Sort leaves by freshness (least fresh first). + // Sort leaves by freshness (less fresh first). leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); // This may not be the most efficient way to remove **multiple** entries, but is the easy @@ -174,52 +174,6 @@ where }); } - // Remove the target block and all its descendants. - // - // Leaves should have already been ordered by "freshness" (older first). - fn remove_target(&mut self, target: TargetInfo, leaves: &[Block::Hash]) { - let mut remove_leaf = |number, hash| { - if self.backend.remove_leaf_block(&hash).is_err() { - return false - } - log::debug!(target: "parachain", "Removing block {}", hash); - self.levels.get_mut(&number).map(|level| level.remove(&hash)); - self.freshness.remove(&hash); - true - }; - - // Takes care of route removal. Starts from the leaf and stops as soon as an error is - // encountered. In this case an error is interpreted as the block being not a leaf - // and it will be removed while removing another route from the same block but to a - // different leaf. - let mut remove_route = |route: TreeRoute| { - route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); - }; - - let target_number = target.freshest_route.common_block().number; - let target_hash = target.freshest_route.common_block().hash; - - remove_route(target.freshest_route); - - // Don't bother trying with leaves we already found to not be our descendants. - let to_skip = leaves.len() - target.freshest_leaf_idx; - leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { - match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => remove_route(route), - Err(err) => { - log::warn!( - target: "parachain", - "Unable getting route from {:?} to {:?}: {}", - target_hash, leaf_hash, err, - ); - }, - _ => (), - }; - }); - - remove_leaf(target_number, target_hash); - } - // Helper function to find the best candidate to be removed. // // Given a set of blocks with height equal to `number` (potential candidates) @@ -288,6 +242,52 @@ where }) } + // Remove the target block and all its descendants. + // + // Leaves should have already been ordered by "freshness" (older first). + fn remove_target(&mut self, target: TargetInfo, leaves: &[Block::Hash]) { + let mut remove_leaf = |number, hash| { + if self.backend.remove_leaf_block(&hash).is_err() { + return false + } + log::debug!(target: "parachain", "Removing block {}", hash); + self.levels.get_mut(&number).map(|level| level.remove(&hash)); + self.freshness.remove(&hash); + true + }; + + // Takes care of route removal. Starts from the leaf and stops as soon as an error is + // encountered. In this case an error is interpreted as the block being not a leaf + // and it will be removed while removing another route from the same block but to a + // different leaf. + let mut remove_route = |route: TreeRoute| { + route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); + }; + + let target_number = target.freshest_route.common_block().number; + let target_hash = target.freshest_route.common_block().hash; + + remove_route(target.freshest_route); + + // Don't bother trying with leaves we already found to not be our descendants. + let to_skip = leaves.len() - target.freshest_leaf_idx; + leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { + match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => remove_route(route), + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {:?} to {:?}: {}", + target_hash, leaf_hash, err, + ); + }, + _ => (), + }; + }); + + remove_leaf(target_number, target_hash); + } + /// Add a new imported block information to the monitor. pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { self.freshness.insert(hash, self.import_counter); From b675d48342059f3103f02be3992ac082e7080319 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 15 Sep 2022 12:51:42 +0200 Subject: [PATCH 35/59] Refactory to reduce cognitive complexity --- client/consensus/common/src/level_monitor.rs | 94 +++++++++++--------- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 13a75fb527d..b2a51b8cd03 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -181,7 +181,7 @@ where // 2. Set the candidate freshness equal to the fresher of its descending leaves. // 3. The target is set as the candidate that is less fresh. // - // Input `leaves` are assumed to be already ordered by "freshness" (fresher first). + // Input `leaves` are assumed to be already ordered by "freshness" (less fresh first). // // Returns the index of the target fresher leaf within `leaves` and the route from target to // such leaf. @@ -190,9 +190,7 @@ where number: NumberFor, leaves: &[Block::Hash], ) -> Option> { - let mut candidate_freshest_leaf_idx = usize::MAX; - let mut candidate_freshest_route = None; - + let mut target_info: Option> = None; let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; @@ -201,50 +199,64 @@ where None => return None, }; - for blk_hash in level.iter() { - // Start checking from the most fresh leaf (the last). Because of the leaves ordering, - // here leaf index is synonym of its freshness, that is the greater the index the - // fresher it is. - for (leaf_idx, leaf_hash) in leaves.iter().enumerate().rev() { - match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => { - // Skip this block if it is the ancestor of the best block or if it has - // a descendant leaf fresher (or equally fresh) than the current candidate. - if leaf_idx < candidate_freshest_leaf_idx && - route.common_block().hash != best_hash && - route.enacted().iter().all(|entry| entry.hash != best_hash) - { - // We have a new candidate - candidate_freshest_leaf_idx = leaf_idx; - candidate_freshest_route = Some(route); - } - break - }, - Err(err) => { - log::warn!( - target: "parachain", - "Unable getting route from {:?} to {:?}: {}", - blk_hash, leaf_hash, err, - ); - }, - _ => (), - }; - } - if candidate_freshest_leaf_idx == 0 { - // We can't find a candidate with an older leaf that the current one. - break + for blk_hash in level.iter().filter(|hash| **hash != best_hash) { + // Search for the fresher leaf information for this block + let candidate_info = + leaves.iter().enumerate().rev().find_map(|(leaf_idx, leaf_hash)| { + match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => + Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route: route }), + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {:?} to {:?}: {}", + blk_hash, leaf_hash, err, + ); + None + }, + _ => None, + } + }); + + let candidate_info = match candidate_info { + Some(candidate_info) => candidate_info, + None => { + log::warn!( + target: "parachain", + "Unable getting route to any leaf from {:?}", + blk_hash, + ); + continue + }, + }; + + // Found fresher leaf for this block. + // This block is the new target if its fresher leaf is less fresh than the + // previous target fresher leaf AND if best block is not in its route. + if target_info + .as_ref() + .map(|ti| candidate_info.freshest_leaf_idx < ti.freshest_leaf_idx) + .unwrap_or(true) && candidate_info + .freshest_route + .enacted() + .iter() + .all(|entry| entry.hash != best_hash) + { + let early_stop = candidate_info.freshest_leaf_idx == 0; + target_info = Some(candidate_info); + if early_stop { + // We will not find a candidate with an older leaf than this. + break + } } } - candidate_freshest_route.map(|route| TargetInfo { - freshest_leaf_idx: candidate_freshest_leaf_idx, - freshest_route: route, - }) + target_info } // Remove the target block and all its descendants. // - // Leaves should have already been ordered by "freshness" (older first). + // Leaves should have already been ordered by "freshness" (less fresh first). fn remove_target(&mut self, target: TargetInfo, leaves: &[Block::Hash]) { let mut remove_leaf = |number, hash| { if self.backend.remove_leaf_block(&hash).is_err() { From 1029cffa1e80be33ee1241a5cce595a0b9937479 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 28 Sep 2022 10:10:27 +0200 Subject: [PATCH 36/59] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/consensus/common/src/level_monitor.rs | 21 ++++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index b2a51b8cd03..c45ebada378 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -27,7 +27,7 @@ use std::{ pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; // Counter threshold after which we are going to eventually cleanup our internal data. -const CLEANUP_THRESHOLD: u64 = 32; +const CLEANUP_THRESHOLD: u32 = 32; /// Upper bound to the number of leaves allowed for each level of the blockchain. /// @@ -38,7 +38,7 @@ const CLEANUP_THRESHOLD: u64 = 32; /// setting an upper bound helps keeping the chain health by dropping old (presumably) stale /// leaves and prevents discarding new blocks because we've reached the backend max value. pub enum LevelLimit { - /// Limit set to `MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`. + /// Limit set to [`MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT`]. Default, /// No explicit limit, however a limit may be implicitly imposed by the backend implementation. None, @@ -76,11 +76,11 @@ impl LevelMonitor { } } -// Internal support structure containing information about the target scheduled for removal. +/// Contains information about the target scheduled for removal. struct TargetInfo { - // Index of freshest leaf in the leaves array. + /// Index of freshest leaf in the leaves array. freshest_leaf_idx: usize, - // Route from target to its freshest leaf. + /// Route from target to its freshest leaf. freshest_route: TreeRoute, } @@ -116,13 +116,11 @@ where self.update(elem.number, elem.hash); } }); - if self.import_counter > counter_max { - counter_max = self.import_counter; - } + counter_max = std::cmp::max(self.import_counter, counter_max); } self.import_counter = counter_max; - self.lowest_level = self.backend.blockchain().info().finalized_number; + self.lowest_level = info.finalized_number; } /// Check and enforce the limit bound at the given height. @@ -194,10 +192,7 @@ where let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; - let level = match self.levels.get(&number) { - Some(level) => level, - None => return None, - }; + let level = self.levels.get(&number)?; for blk_hash in level.iter().filter(|hash| **hash != best_hash) { // Search for the fresher leaf information for this block From 1bc4e61dcaab0f723a957faf69c60541df8b4d73 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 28 Sep 2022 10:19:55 +0200 Subject: [PATCH 37/59] Fix type --- client/consensus/common/src/level_monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index c45ebada378..5cdcb1b5732 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -303,7 +303,7 @@ where // Do cleanup once in a while, we are allowed to have some obsolete information. let finalized_num = self.backend.blockchain().info().finalized_number; - let delta: u64 = finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); + let delta: u32 = finalized_num.saturating_sub(self.lowest_level).unique_saturated_into(); if delta >= CLEANUP_THRESHOLD { for i in 0..delta { let number = self.lowest_level + i.unique_saturated_into(); From d8f1c84b7e3028eae75b1f406ba57f2b6bc1bfa8 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 28 Sep 2022 18:47:13 +0200 Subject: [PATCH 38/59] Restore monitor within the constructor Some optimizations when the target is found to be a leaf --- client/consensus/common/src/level_monitor.rs | 212 +++++++++++-------- client/consensus/common/src/lib.rs | 6 +- client/consensus/relay-chain/src/lib.rs | 1 + 3 files changed, 131 insertions(+), 88 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 5cdcb1b5732..a465bc90c95 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -46,34 +46,20 @@ pub enum LevelLimit { Some(usize), } -// Support structure to constrain the number of leaves at each level. +/// Support structure to constrain the number of leaves at each level. pub struct LevelMonitor { // Max number of leaves for each level. - pub level_limit: usize, + level_limit: usize, // Monotonic counter used to keep track of block freshness. - pub import_counter: NumberFor, + pub(crate) import_counter: NumberFor, // Map between blocks hashes and freshness. - pub freshness: HashMap>, + pub(crate) freshness: HashMap>, // Blockchain levels cache. - pub levels: HashMap, HashSet>, + pub(crate) levels: HashMap, HashSet>, // Lower level number stored by the levels map. - pub lowest_level: NumberFor, + lowest_level: NumberFor, // Backend reference to remove blocks on level saturation. - pub backend: Arc, -} - -impl LevelMonitor { - /// Instance a new monitor structure. - pub fn new(level_limit: usize, backend: Arc) -> Self { - LevelMonitor { - level_limit, - import_counter: Zero::zero(), - freshness: HashMap::new(), - levels: HashMap::new(), - lowest_level: Zero::zero(), - backend, - } - } + backend: Arc, } /// Contains information about the target scheduled for removal. @@ -81,7 +67,8 @@ struct TargetInfo { /// Index of freshest leaf in the leaves array. freshest_leaf_idx: usize, /// Route from target to its freshest leaf. - freshest_route: TreeRoute, + /// `None` if they are equal. + freshest_route: Option>, } impl LevelMonitor @@ -89,6 +76,20 @@ where Block: BlockT, BE: Backend, { + /// Instance a new monitor structure. + pub fn new(level_limit: usize, backend: Arc) -> Self { + let mut monitor = LevelMonitor { + level_limit, + import_counter: Zero::zero(), + freshness: HashMap::new(), + levels: HashMap::new(), + lowest_level: Zero::zero(), + backend, + }; + monitor.restore(); + monitor + } + /// Restore the structure using the backend. /// /// Blocks freshness values are inferred from the height and not from the effective import @@ -138,11 +139,6 @@ where /// /// The least "fresh" blocks are eventually removed. pub fn enforce_limit(&mut self, number: NumberFor) { - if self.import_counter == Zero::zero() { - // First call detected, restore using the backend persistent information. - self.restore(); - } - let level_len = self.levels.get(&number).map(|l| l.len()).unwrap_or_default(); if level_len < self.level_limit { return @@ -166,7 +162,7 @@ where let remove_count = level_len - self.level_limit + 1; (0..remove_count).all(|_| { self.find_target(number, &leaves).map_or(false, |target| { - self.remove_target(target, &leaves); + self.remove_target(target, number, &leaves); true }) }); @@ -192,29 +188,46 @@ where let blockchain = self.backend.blockchain(); let best_hash = blockchain.info().best_hash; + // Leaves that where already assigned to some node and thus can be skipped + // during the search. + let mut assigned_leaves = HashSet::new(); + let level = self.levels.get(&number)?; for blk_hash in level.iter().filter(|hash| **hash != best_hash) { // Search for the fresher leaf information for this block - let candidate_info = - leaves.iter().enumerate().rev().find_map(|(leaf_idx, leaf_hash)| { - match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => - Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route: route }), - Err(err) => { - log::warn!( - target: "parachain", - "Unable getting route from {:?} to {:?}: {}", - blk_hash, leaf_hash, err, - ); - None - }, - _ => None, + let candidate_info = leaves + .iter() + .enumerate() + .filter(|(leaf_idx, _)| !assigned_leaves.contains(leaf_idx)) + .rev() + .find_map(|(leaf_idx, leaf_hash)| { + if blk_hash == leaf_hash { + Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route: None }) + } else { + match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => Some(TargetInfo { + freshest_leaf_idx: leaf_idx, + freshest_route: Some(route), + }), + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {:?} to {:?}: {}", + blk_hash, leaf_hash, err, + ); + None + }, + _ => None, + } } }); let candidate_info = match candidate_info { - Some(candidate_info) => candidate_info, + Some(candidate_info) => { + assigned_leaves.insert(candidate_info.freshest_leaf_idx); + candidate_info + }, None => { log::warn!( target: "parachain", @@ -225,22 +238,30 @@ where }, }; - // Found fresher leaf for this block. - // This block is the new target if its fresher leaf is less fresh than the - // previous target fresher leaf AND if best block is not in its route. - if target_info - .as_ref() - .map(|ti| candidate_info.freshest_leaf_idx < ti.freshest_leaf_idx) - .unwrap_or(true) && candidate_info - .freshest_route - .enacted() - .iter() - .all(|entry| entry.hash != best_hash) - { + // Found fresher leaf for this candidate. + // This candidate is set as the new target if: + // 1. its fresher leaf is less fresh than the previous target fresher leaf AND + // 2. best block is not in its route + + let is_less_fresh = || { + target_info + .as_ref() + .map(|ti| candidate_info.freshest_leaf_idx < ti.freshest_leaf_idx) + .unwrap_or(true) + }; + let not_contains_best = || { + candidate_info + .freshest_route + .as_ref() + .map(|tr| tr.enacted().iter().all(|entry| entry.hash != best_hash)) + .unwrap_or(true) + }; + + if is_less_fresh() && not_contains_best() { let early_stop = candidate_info.freshest_leaf_idx == 0; target_info = Some(candidate_info); if early_stop { - // We will not find a candidate with an older leaf than this. + // We will never find a candidate with an worst freshest leaf than this. break } } @@ -252,7 +273,12 @@ where // Remove the target block and all its descendants. // // Leaves should have already been ordered by "freshness" (less fresh first). - fn remove_target(&mut self, target: TargetInfo, leaves: &[Block::Hash]) { + fn remove_target( + &mut self, + target: TargetInfo, + number: NumberFor, + leaves: &[Block::Hash], + ) { let mut remove_leaf = |number, hash| { if self.backend.remove_leaf_block(&hash).is_err() { return false @@ -263,36 +289,52 @@ where true }; - // Takes care of route removal. Starts from the leaf and stops as soon as an error is - // encountered. In this case an error is interpreted as the block being not a leaf - // and it will be removed while removing another route from the same block but to a - // different leaf. - let mut remove_route = |route: TreeRoute| { - route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); - }; - - let target_number = target.freshest_route.common_block().number; - let target_hash = target.freshest_route.common_block().hash; - - remove_route(target.freshest_route); + let target_hash = match target.freshest_route { + Some(freshest_route) => { + // Takes care of route removal. Starts from the leaf and stops as soon as an error is + // encountered. In this case an error is interpreted as the block being not a leaf + // and it will be removed while removing another route from the same block but to a + // different leaf. + let mut remove_route = |route: TreeRoute| { + route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); + }; + + let target_hash = freshest_route.common_block().hash; + debug_assert_eq!( + freshest_route.common_block().number, + number, + "This is a bug in LevelMonitor::find_target() or the Backend is corrupted" + ); + + // Remove freshest (cached) route first. + remove_route(freshest_route); + + // Don't bother trying with leaves we already found to not be our descendants. + let to_skip = leaves.len() - target.freshest_leaf_idx; + leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { + match sp_blockchain::tree_route( + self.backend.blockchain(), + target_hash, + *leaf_hash, + ) { + Ok(route) if route.retracted().is_empty() => remove_route(route), + Err(err) => { + log::warn!( + target: "parachain", + "Unable getting route from {:?} to {:?}: {}", + target_hash, leaf_hash, err, + ); + }, + _ => (), + }; + }); - // Don't bother trying with leaves we already found to not be our descendants. - let to_skip = leaves.len() - target.freshest_leaf_idx; - leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { - match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => remove_route(route), - Err(err) => { - log::warn!( - target: "parachain", - "Unable getting route from {:?} to {:?}: {}", - target_hash, leaf_hash, err, - ); - }, - _ => (), - }; - }); + target_hash + }, + None => leaves[target.freshest_leaf_idx], + }; - remove_leaf(target_number, target_hash); + remove_leaf(number, target_hash); } /// Add a new imported block information to the monitor. diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index d96be6771ef..d8388608796 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -29,8 +29,8 @@ mod tests; pub use parachain_consensus::run_parachain_consensus; -pub use level_monitor::LevelLimit; -use level_monitor::{LevelMonitor, MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT}; +use level_monitor::LevelMonitor; +pub use level_monitor::{LevelLimit, MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT}; /// The result of [`ParachainConsensus::produce_candidate`]. pub struct ParachainCandidate { @@ -88,7 +88,7 @@ pub struct ParachainBlockImport { level_monitor: Option>, } -impl ParachainBlockImport { +impl> ParachainBlockImport { /// Create a new instance. /// /// The number of leaves per level limit is set to `LevelLimit::Default`. diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index ecf9719b19e..fb3e22aadee 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -85,6 +85,7 @@ where B: BlockT, RCInterface: RelayChainInterface, CIDP: CreateInherentDataProviders, + BE: sc_client_api::Backend + Send + Sync, { /// Create a new instance of relay-chain provided consensus. pub fn new( From 9766f86687899bbd3c2ab640ab0972fc8f88703d Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 28 Sep 2022 18:56:04 +0200 Subject: [PATCH 39/59] Rename Monitor 'update' to 'block_imported' --- client/consensus/common/src/level_monitor.rs | 6 +++--- client/consensus/common/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index a465bc90c95..440601b2290 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -101,7 +101,7 @@ where let info = self.backend.blockchain().info(); self.import_counter = info.finalized_number; - self.update(info.finalized_number, info.finalized_hash); + self.block_imported(info.finalized_number, info.finalized_hash); for leaf in self.backend.blockchain().leaves().unwrap_or_default() { let route = @@ -114,7 +114,7 @@ where if !self.freshness.contains_key(&elem.hash) { // Use the block height value as the freshness. self.import_counter = elem.number; - self.update(elem.number, elem.hash); + self.block_imported(elem.number, elem.hash); } }); counter_max = std::cmp::max(self.import_counter, counter_max); @@ -338,7 +338,7 @@ where } /// Add a new imported block information to the monitor. - pub fn update(&mut self, number: NumberFor, hash: Block::Hash) { + pub fn block_imported(&mut self, number: NumberFor, hash: Block::Hash) { self.freshness.insert(hash, self.import_counter); self.levels.entry(number).or_default().insert(hash); self.import_counter += One::one(); diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index d8388608796..127fa937609 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -148,7 +148,7 @@ where let res = self.inner.import_block(params, cache).await?; if let Some(ref mut monitor) = self.level_monitor { - monitor.update(number, hash); + monitor.block_imported(number, hash); } Ok(res) From 19695b480e925473c5369c20d63075374b13fdf3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Sat, 1 Oct 2022 12:33:55 +0200 Subject: [PATCH 40/59] Keep track of invalidated leaves --- client/consensus/common/src/level_monitor.rs | 38 +++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 440601b2290..2205bafdd4e 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -150,9 +150,11 @@ where number, ); + // Sort leaves by freshness only once (less fresh first) and keep track of + // leaves that were invalidated on removal. let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); - // Sort leaves by freshness (less fresh first). leaves.sort_unstable_by(|a, b| self.freshness.get(a).cmp(&self.freshness.get(b))); + let mut invalidated_leaves = HashSet::new(); // This may not be the most efficient way to remove **multiple** entries, but is the easy // one :-). Should be considered that in "normal" conditions the number of blocks to remove @@ -160,9 +162,14 @@ where // trigger multiple removals (2+) is if we restart the node using an existing db and a // smaller limit wrt the one previously used. let remove_count = level_len - self.level_limit + 1; + + log::debug!( + target: "parachain", + "Enforcing limit by removing {remove_count} blocks at level {number}" + ); (0..remove_count).all(|_| { - self.find_target(number, &leaves).map_or(false, |target| { - self.remove_target(target, number, &leaves); + self.find_target(number, &leaves, &invalidated_leaves).map_or(false, |target| { + self.remove_target(target, number, &leaves, &mut invalidated_leaves); true }) }); @@ -183,6 +190,7 @@ where &self, number: NumberFor, leaves: &[Block::Hash], + invalidated_leaves: &HashSet, ) -> Option> { let mut target_info: Option> = None; let blockchain = self.backend.blockchain(); @@ -199,7 +207,9 @@ where let candidate_info = leaves .iter() .enumerate() - .filter(|(leaf_idx, _)| !assigned_leaves.contains(leaf_idx)) + .filter(|(leaf_idx, _)| { + !assigned_leaves.contains(leaf_idx) && !invalidated_leaves.contains(leaf_idx) + }) .rev() .find_map(|(leaf_idx, leaf_hash)| { if blk_hash == leaf_hash { @@ -213,7 +223,7 @@ where Err(err) => { log::warn!( target: "parachain", - "Unable getting route from {:?} to {:?}: {}", + "XXX (lookup) Unable getting route from {:?} to {:?}: {}", blk_hash, leaf_hash, err, ); None @@ -278,17 +288,21 @@ where target: TargetInfo, number: NumberFor, leaves: &[Block::Hash], + invalidated_leaves: &mut HashSet, ) { let mut remove_leaf = |number, hash| { - if self.backend.remove_leaf_block(&hash).is_err() { + log::trace!(target: "parachain", "XXX Removing block (@{}) {:?}", number, hash); + if let Err(err) = self.backend.remove_leaf_block(&hash) { + log::debug!(target: "parachain", "XXX Remove error for {}: {}", hash, err); return false } - log::debug!(target: "parachain", "Removing block {}", hash); self.levels.get_mut(&number).map(|level| level.remove(&hash)); self.freshness.remove(&hash); true }; + invalidated_leaves.insert(target.freshest_leaf_idx); + let target_hash = match target.freshest_route { Some(freshest_route) => { // Takes care of route removal. Starts from the leaf and stops as soon as an error is @@ -311,7 +325,11 @@ where // Don't bother trying with leaves we already found to not be our descendants. let to_skip = leaves.len() - target.freshest_leaf_idx; - leaves.iter().rev().skip(to_skip).for_each(|leaf_hash| { + leaves.iter().enumerate().rev().skip(to_skip).for_each(|(leaf_idx, leaf_hash)| { + if invalidated_leaves.contains(&leaf_idx) { + return + } + invalidated_leaves.insert(leaf_idx); match sp_blockchain::tree_route( self.backend.blockchain(), target_hash, @@ -321,7 +339,7 @@ where Err(err) => { log::warn!( target: "parachain", - "Unable getting route from {:?} to {:?}: {}", + "XXX (on rem) Unable getting route from {:?} to {:?}: {}", target_hash, leaf_hash, err, ); }, @@ -335,6 +353,8 @@ where }; remove_leaf(number, target_hash); + + log::warn!(target: "parachain", "XXX Removed target (@{}) {:?}", number, target_hash); } /// Add a new imported block information to the monitor. From 77e25499034703e180eeb3218cced3ce90dcf66b Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Sat, 1 Oct 2022 16:55:34 +0200 Subject: [PATCH 41/59] Check import before add block to the monitor --- client/consensus/common/src/level_monitor.rs | 14 +++++--------- client/consensus/common/src/lib.rs | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 2205bafdd4e..81cd6f968c0 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -97,12 +97,14 @@ where /// /// Level limits are not enforced during this phase. fn restore(&mut self) { - let mut counter_max = Zero::zero(); let info = self.backend.blockchain().info(); + self.lowest_level = info.finalized_number; self.import_counter = info.finalized_number; self.block_imported(info.finalized_number, info.finalized_hash); + let mut counter_max = info.finalized_number; + for leaf in self.backend.blockchain().leaves().unwrap_or_default() { let route = sp_blockchain::tree_route(self.backend.blockchain(), info.finalized_hash, leaf) @@ -121,7 +123,6 @@ where } self.import_counter = counter_max; - self.lowest_level = info.finalized_number; } /// Check and enforce the limit bound at the given height. @@ -144,12 +145,6 @@ where return } - log::debug!( - target: "parachain", - "Detected leaves overflow at height {}, removing obsolete blocks", - number, - ); - // Sort leaves by freshness only once (less fresh first) and keep track of // leaves that were invalidated on removal. let mut leaves = self.backend.blockchain().leaves().unwrap_or_default(); @@ -165,8 +160,9 @@ where log::debug!( target: "parachain", - "Enforcing limit by removing {remove_count} blocks at level {number}" + "Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", ); + (0..remove_count).all(|_| { self.find_target(number, &leaves, &invalidated_leaves).map_or(false, |target| { self.remove_target(target, number, &leaves, &mut invalidated_leaves); diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 127fa937609..1e1cdc3e2e5 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -17,7 +17,7 @@ use polkadot_primitives::v2::{Hash as PHash, PersistedValidationData}; use sc_client_api::Backend; -use sc_consensus::BlockImport; +use sc_consensus::{BlockImport, ImportResult}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use std::sync::Arc; @@ -147,7 +147,7 @@ where let res = self.inner.import_block(params, cache).await?; - if let Some(ref mut monitor) = self.level_monitor { + if let (Some(monitor), ImportResult::Imported(_)) = (self.level_monitor.as_mut(), &res) { monitor.block_imported(number, hash); } From 8ecb772776337d113d6f49d8861509f394ca0981 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Sat, 1 Oct 2022 17:05:31 +0200 Subject: [PATCH 42/59] Update test --- client/consensus/common/src/tests.rs | 39 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 23566528d99..acbb29cc77e 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -495,18 +495,20 @@ fn prune_blocks_on_level_overflow() { #[test] fn restore_limit_monitor() { // Here we are using the timestamp value to generate blocks with different hashes. - const LEVEL_LIMIT: usize = 3; + const LEVEL_LIMIT: usize = 2; const TIMESTAMP_MULTIPLIER: u64 = 60000; let backend = Arc::new(Backend::new_test(1000, 3)); let client = Arc::new(TestClientBuilder::with_backend(backend.clone()).build()); + + // Start with a block import not enforcing any limit... let mut para_import = ParachainBlockImport::new_with_limit( client.clone(), backend.clone(), - LevelLimit::Some(LEVEL_LIMIT), + LevelLimit::Some(usize::MAX), ); - let block0 = build_and_import_block_ext( + let block00 = build_and_import_block_ext( &*client, BlockOrigin::NetworkInitialSync, true, @@ -514,9 +516,9 @@ fn restore_limit_monitor() { None, None, ); - let id0 = BlockId::Hash(block0.header.hash()); + let id00 = BlockId::Hash(block00.header.hash()); - let blocks1 = (0..LEVEL_LIMIT) + let blocks1 = (0..LEVEL_LIMIT + 1) .into_iter() .map(|i| { build_and_import_block_ext( @@ -524,14 +526,14 @@ fn restore_limit_monitor() { if i == 1 { BlockOrigin::NetworkInitialSync } else { BlockOrigin::Own }, i == 1, &mut para_import, - Some(id0), + Some(id00), Some(i as u64 * TIMESTAMP_MULTIPLIER), ) }) .collect::>(); let id10 = BlockId::Hash(blocks1[0].header.hash()); - let blocks2 = (0..2) + let _ = (0..LEVEL_LIMIT) .into_iter() .map(|i| { build_and_import_block_ext( @@ -545,6 +547,15 @@ fn restore_limit_monitor() { }) .collect::>(); + // Scenario before limit application (with B11 imported as best) + // Import order (freshess): B00, B10, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TODO + // + // B00 --+-- B10 --+-- B20 + // | +-- B21 + // +-- B11 + // | + // +-- B12 + // Simulate a restart by forcing a new monitor structure instance let mut para_import = ParachainBlockImport::new_with_limit( @@ -558,23 +569,17 @@ fn restore_limit_monitor() { BlockOrigin::Own, false, &mut para_import, - Some(id0), + Some(id00), Some(LEVEL_LIMIT as u64 * TIMESTAMP_MULTIPLIER), ); // Expected scenario // - // B0 --+-- B10 --+-- B20 - // +-- B11 +-- B21 - // +--(B13) <-- B12 has been replaced + // B0 --+-- B11 + // +--(B13) let leaves = backend.blockchain().leaves().unwrap(); - let expected = vec![ - blocks2[0].header.hash(), - blocks2[1].header.hash(), - blocks1[1].header.hash(), - block13.header.hash(), - ]; + let expected = vec![blocks1[1].header.hash(), block13.header.hash()]; assert_eq!(leaves, expected); let monitor = para_import.level_monitor.unwrap(); From 3d86b2eed2813daf641559ebf5c608bfea4ca942 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Sat, 1 Oct 2022 17:20:36 +0200 Subject: [PATCH 43/59] Adjust log levels --- client/consensus/common/src/level_monitor.rs | 4 ++-- client/consensus/common/src/lib.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 81cd6f968c0..032d579db32 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -287,7 +287,7 @@ where invalidated_leaves: &mut HashSet, ) { let mut remove_leaf = |number, hash| { - log::trace!(target: "parachain", "XXX Removing block (@{}) {:?}", number, hash); + log::debug!(target: "parachain", "XXX Removing block (@{}) {:?}", number, hash); if let Err(err) = self.backend.remove_leaf_block(&hash) { log::debug!(target: "parachain", "XXX Remove error for {}: {}", hash, err); return false @@ -350,7 +350,7 @@ where remove_leaf(number, target_hash); - log::warn!(target: "parachain", "XXX Removed target (@{}) {:?}", number, target_hash); + log::debug!(target: "parachain", "XXX Removed target (@{}) {:?}", number, target_hash); } /// Add a new imported block information to the monitor. diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 1e1cdc3e2e5..2ec543847de 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -97,6 +97,9 @@ impl> ParachainBlockImport } /// Create a new instance with an explicit limit to the number of leaves per level. + /// + /// This function alone doesn't enforce the limit on levels for old imported blocks, + /// the limit is eventually enforced only when new blocks are imported. pub fn new_with_limit(inner: BI, backend: Arc, level_leaves_max: LevelLimit) -> Self { let level_limit = match level_leaves_max { LevelLimit::None => None, From 59fcb7a6aa41eb72ba3ba1c698bd30b63285cc14 Mon Sep 17 00:00:00 2001 From: paritytech-ci Date: Sat, 1 Oct 2022 15:21:57 +0000 Subject: [PATCH 44/59] [ci] Apply cargo-fmt --- client/consensus/common/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 2ec543847de..fd20882d524 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -97,9 +97,9 @@ impl> ParachainBlockImport } /// Create a new instance with an explicit limit to the number of leaves per level. - /// - /// This function alone doesn't enforce the limit on levels for old imported blocks, - /// the limit is eventually enforced only when new blocks are imported. + /// + /// This function alone doesn't enforce the limit on levels for old imported blocks, + /// the limit is eventually enforced only when new blocks are imported. pub fn new_with_limit(inner: BI, backend: Arc, level_leaves_max: LevelLimit) -> Self { let level_limit = match level_leaves_max { LevelLimit::None => None, From 283d33b4a5b35784cb96d6e71b3182936511250b Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 5 Oct 2022 10:00:31 +0200 Subject: [PATCH 45/59] Extra debugging logs --- client/consensus/common/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index fd20882d524..acdeb2355cd 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -154,6 +154,12 @@ where monitor.block_imported(number, hash); } + // TODO: REMOVE temporary debug message + match res { + ImportResult::Imported(_) => (), + _ => log::warn!("Failed importing {}: {:?}", hash, res), + } + Ok(res) } } From fd939e9b35b693e70b79d518d8faa9d031043ac3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 5 Oct 2022 10:03:50 +0200 Subject: [PATCH 46/59] Added target to debug logs --- client/consensus/common/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index acdeb2355cd..6aee71c91b6 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -157,7 +157,7 @@ where // TODO: REMOVE temporary debug message match res { ImportResult::Imported(_) => (), - _ => log::warn!("Failed importing {}: {:?}", hash, res), + _ => log::warn!(target: "parachain", "Failed importing {}: {:?}", hash, res), } Ok(res) From bbde030e4d17ee1317160d9535c1c51ec3d22aa9 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 7 Oct 2022 10:25:21 +0200 Subject: [PATCH 47/59] Report errors as such --- client/consensus/common/src/level_monitor.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 032d579db32..83f0dfe2bc5 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -235,9 +235,10 @@ where candidate_info }, None => { - log::warn!( + // This should never happen + log::error!( target: "parachain", - "Unable getting route to any leaf from {:?}", + "Unable getting route to any leaf from {:?} (this is a bug)", blk_hash, ); continue From 7dd4ebe1250b38c7210974e57252ee299a6810ce Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 13 Oct 2022 12:37:10 +0200 Subject: [PATCH 48/59] Added extra log to the monitor restore method --- client/consensus/common/src/level_monitor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 83f0dfe2bc5..9796f511fa5 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -98,6 +98,7 @@ where /// Level limits are not enforced during this phase. fn restore(&mut self) { let info = self.backend.blockchain().info(); + log::debug!(target: "parachain", "XXX Restoring chain level monitor from last finalized block: {} {}", info.finalized_number, info.finalized_hash); self.lowest_level = info.finalized_number; self.import_counter = info.finalized_number; @@ -122,6 +123,8 @@ where counter_max = std::cmp::max(self.import_counter, counter_max); } + log::debug!(target: "parachain", "XXX Restored chain level monitor up to height {}", counter_max); + self.import_counter = counter_max; } From f08c6e400a919efcaf09255b8a10be641458d5f0 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 13 Oct 2022 14:03:26 +0200 Subject: [PATCH 49/59] Fix after master merge --- Cargo.lock | 1 + client/consensus/relay-chain/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2222a563b0b..e9ccddf37be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1634,6 +1634,7 @@ dependencies = [ "cumulus-relay-chain-interface", "futures", "parking_lot 0.12.1", + "sc-client-api", "sc-consensus", "sp-api", "sp-block-builder", diff --git a/client/consensus/relay-chain/Cargo.toml b/client/consensus/relay-chain/Cargo.toml index 86caa856ed9..994abfd745e 100644 --- a/client/consensus/relay-chain/Cargo.toml +++ b/client/consensus/relay-chain/Cargo.toml @@ -12,6 +12,7 @@ parking_lot = "0.12.1" tracing = "0.1.37" # Substrate +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } From 3cd5d313e20e00dbd361ae719a296e949ab912c3 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Thu, 13 Oct 2022 18:19:25 +0200 Subject: [PATCH 50/59] Bugfix: level monitor cache should use block 'post-hash' --- client/consensus/common/src/level_monitor.rs | 10 +++++++--- client/consensus/common/src/lib.rs | 6 +++--- client/consensus/common/src/tests.rs | 12 +++++++++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 9796f511fa5..bdc302f65b8 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -98,7 +98,11 @@ where /// Level limits are not enforced during this phase. fn restore(&mut self) { let info = self.backend.blockchain().info(); - log::debug!(target: "parachain", "XXX Restoring chain level monitor from last finalized block: {} {}", info.finalized_number, info.finalized_hash); + log::debug!( + target: "parachain", + "XXX Restoring chain level monitor from last finalized block: {} {}", + info.finalized_number, info.finalized_hash + ); self.lowest_level = info.finalized_number; self.import_counter = info.finalized_number; @@ -163,7 +167,7 @@ where log::debug!( target: "parachain", - "Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", + "XXX Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", ); (0..remove_count).all(|_| { @@ -241,7 +245,7 @@ where // This should never happen log::error!( target: "parachain", - "Unable getting route to any leaf from {:?} (this is a bug)", + "XXX Unable getting route to any leaf from {:?} (this is a bug)", blk_hash, ); continue diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 6aee71c91b6..c2e35813ecd 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -135,8 +135,9 @@ where mut params: sc_consensus::BlockImportParams, cache: std::collections::HashMap>, ) -> Result { + // Blocks are stored within the backend by using POST hash. + let hash = params.post_hash(); let number = *params.header.number(); - let hash = params.header.hash(); if let Some(ref mut monitor) = self.level_monitor { monitor.enforce_limit(number); @@ -154,10 +155,9 @@ where monitor.block_imported(number, hash); } - // TODO: REMOVE temporary debug message match res { ImportResult::Imported(_) => (), - _ => log::warn!(target: "parachain", "Failed importing {}: {:?}", hash, res), + _ => log::warn!(target: "parachain", "XXX Failed importing {}: {:?}", hash, res), } Ok(res) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index acbb29cc77e..fdbb6670965 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -131,15 +131,25 @@ fn build_and_import_block_ext>( None => builder.init_block_builder(None, Default::default()), }; - let block = builder.build().unwrap().block; + let mut block = builder.build().unwrap().block; let (header, body) = block.clone().deconstruct(); + // Simulate some form of post activity. + // This is mostly used to excercise the `LevelMonitor` correct behavior. + // (in practice we want that header post-hash != pre-hash) + let post_digest = sp_runtime::DigestItem::Other(vec![1, 2, 3]); + let mut block_import_params = BlockImportParams::new(origin, header); block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(import_as_best)); block_import_params.body = Some(body); + block_import_params.post_digests.push(post_digest.clone()); block_on(importer.import_block(block_import_params, Default::default())).unwrap(); + // In order to get a header hash compatible with block import params containing some + // form of `post_digest`, we need to manually push the post digest within the header + // digest logs. + block.header.digest.push(post_digest); block } From f0c18c1eb383456d61c018eac61d9e4d8770bded Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 18 Oct 2022 11:15:31 +0200 Subject: [PATCH 51/59] TEMPORARY --- client/consensus/common/src/lib.rs | 6 ++++-- client/consensus/common/src/tests.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index c2e35813ecd..0dc2c7ec3d9 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -156,8 +156,10 @@ where } match res { - ImportResult::Imported(_) => (), - _ => log::warn!(target: "parachain", "XXX Failed importing {}: {:?}", hash, res), + ImportResult::Imported(_) => + log::debug!(target: "parachain", "XXX Imported (@{}) {}", number, hash), + _ => + log::warn!(target: "parachain", "XXX Failed importing (@{}) {}: {:?}", number, hash, res), } Ok(res) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index fdbb6670965..0df5a2d5562 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -558,7 +558,7 @@ fn restore_limit_monitor() { .collect::>(); // Scenario before limit application (with B11 imported as best) - // Import order (freshess): B00, B10, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TODO + // Import order (freshess): B00, B10, B11, B12, B20, B21 // // B00 --+-- B10 --+-- B20 // | +-- B21 From 01c37b7da53ebbe518435f00d00a8460ecc240ec Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 21 Oct 2022 17:00:55 +0200 Subject: [PATCH 52/59] Minor tweaks --- Cargo.lock | 1 - client/consensus/aura/src/import_queue.rs | 8 ++++---- client/consensus/relay-chain/Cargo.toml | 1 - parachain-template/node/src/service.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4da481df31..48a8b4845f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1621,7 +1621,6 @@ dependencies = [ "cumulus-relay-chain-interface", "futures", "parking_lot 0.12.1", - "sc-client-api", "sc-consensus", "sp-api", "sp-block-builder", diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index f1b282a046d..87a1f2ee3b4 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -34,7 +34,7 @@ use sp_runtime::traits::Block as BlockT; use std::{fmt::Debug, hash::Hash, sync::Arc}; use substrate_prometheus_endpoint::Registry; -/// Parameters of [`import_queue`]. +/// Parameters for [`import_queue`]. pub struct ImportQueueParams<'a, I, C, CIDP, S> { /// The block import to use. pub block_import: I, @@ -51,7 +51,7 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S> { } /// Start an import queue for the Aura consensus algorithm. -pub fn import_queue<'a, P, Block, BI, C, S, CIDP>( +pub fn import_queue<'a, P, Block, I, C, S, CIDP>( ImportQueueParams { block_import, client, @@ -59,7 +59,7 @@ pub fn import_queue<'a, P, Block, BI, C, S, CIDP>( spawner, registry, telemetry, - }: ImportQueueParams<'a, BI, C, CIDP, S>, + }: ImportQueueParams<'a, I, C, CIDP, S>, ) -> Result, sp_consensus::Error> where Block: BlockT, @@ -72,7 +72,7 @@ where + AuxStore + UsageProvider + HeaderBackend, - BI: BlockImport> + I: BlockImport> + ParachainBlockImportMarker + Send + Sync diff --git a/client/consensus/relay-chain/Cargo.toml b/client/consensus/relay-chain/Cargo.toml index 9d70131e7ca..c088ee32543 100644 --- a/client/consensus/relay-chain/Cargo.toml +++ b/client/consensus/relay-chain/Cargo.toml @@ -12,7 +12,6 @@ parking_lot = "0.12.1" tracing = "0.1.37" # Substrate -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index 388a6b0fac8..eb7ddb366b7 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -311,7 +311,7 @@ async fn start_node_impl( } /// Build the import queue for the parachain runtime. -pub fn build_import_queue( +fn build_import_queue( client: Arc, block_import: ParachainBlockImport, config: &Configuration, From 61304ecc737d1d50ba2dccd4dc734f888cc84aed Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 11 Nov 2022 14:46:14 +0100 Subject: [PATCH 53/59] Small code refactory --- client/consensus/common/src/level_monitor.rs | 100 +++++++++---------- 1 file changed, 45 insertions(+), 55 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 68ddcb0de27..b753d64c0fe 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -15,7 +15,7 @@ // along with Cumulus. If not, see . use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; -use sp_blockchain::TreeRoute; +use sp_blockchain::{HashAndNumber, TreeRoute}; use sp_runtime::traits::{Block as BlockT, NumberFor, One, Saturating, UniqueSaturatedInto, Zero}; use std::{ collections::{HashMap, HashSet}, @@ -67,8 +67,7 @@ struct TargetInfo { /// Index of freshest leaf in the leaves array. freshest_leaf_idx: usize, /// Route from target to its freshest leaf. - /// `None` if they are equal. - freshest_route: Option>, + freshest_route: TreeRoute, } impl LevelMonitor @@ -216,12 +215,14 @@ where .rev() .find_map(|(leaf_idx, leaf_hash)| { if blk_hash == leaf_hash { - Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route: None }) + let entry = HashAndNumber { number, hash: *blk_hash }; + let freshest_route = TreeRoute::new(vec![entry], 0); + Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route }) } else { match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { Ok(route) if route.retracted().is_empty() => Some(TargetInfo { freshest_leaf_idx: leaf_idx, - freshest_route: Some(route), + freshest_route: route, }), Err(err) => { log::warn!( @@ -266,9 +267,9 @@ where let not_contains_best = || { candidate_info .freshest_route - .as_ref() - .map(|tr| tr.enacted().iter().all(|entry| entry.hash != best_hash)) - .unwrap_or(true) + .enacted() + .iter() + .all(|entry| entry.hash != best_hash) }; if is_less_fresh() && not_contains_best() { @@ -307,55 +308,44 @@ where invalidated_leaves.insert(target.freshest_leaf_idx); - let target_hash = match target.freshest_route { - Some(freshest_route) => { - // Takes care of route removal. Starts from the leaf and stops as soon as an error is - // encountered. In this case an error is interpreted as the block being not a leaf - // and it will be removed while removing another route from the same block but to a - // different leaf. - let mut remove_route = |route: TreeRoute| { - route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); - }; - - let target_hash = freshest_route.common_block().hash; - debug_assert_eq!( - freshest_route.common_block().number, - number, - "This is a bug in LevelMonitor::find_target() or the Backend is corrupted" - ); - - // Remove freshest (cached) route first. - remove_route(freshest_route); - - // Don't bother trying with leaves we already found to not be our descendants. - let to_skip = leaves.len() - target.freshest_leaf_idx; - leaves.iter().enumerate().rev().skip(to_skip).for_each(|(leaf_idx, leaf_hash)| { - if invalidated_leaves.contains(&leaf_idx) { - return - } - invalidated_leaves.insert(leaf_idx); - match sp_blockchain::tree_route( - self.backend.blockchain(), - target_hash, - *leaf_hash, - ) { - Ok(route) if route.retracted().is_empty() => remove_route(route), - Err(err) => { - log::warn!( - target: "parachain", - "XXX (on rem) Unable getting route from {:?} to {:?}: {}", - target_hash, leaf_hash, err, - ); - }, - _ => (), - }; - }); - - target_hash - }, - None => leaves[target.freshest_leaf_idx], + // Takes care of route removal. Starts from the leaf and stops as soon as an error is + // encountered. In this case an error is interpreted as the block being not a leaf + // and it will be removed while removing another route from the same block but to a + // different leaf. + let mut remove_route = |route: TreeRoute| { + route.enacted().iter().rev().all(|elem| remove_leaf(elem.number, elem.hash)); }; + let target_hash = target.freshest_route.common_block().hash; + debug_assert_eq!( + target.freshest_route.common_block().number, + number, + "This is a bug in LevelMonitor::find_target() or the Backend is corrupted" + ); + + // Remove freshest (cached) route first. + remove_route(target.freshest_route); + + // Don't bother trying with leaves we already found to not be our descendants. + let to_skip = leaves.len() - target.freshest_leaf_idx; + leaves.iter().enumerate().rev().skip(to_skip).for_each(|(leaf_idx, leaf_hash)| { + if invalidated_leaves.contains(&leaf_idx) { + return + } + invalidated_leaves.insert(leaf_idx); + match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { + Ok(route) if route.retracted().is_empty() => remove_route(route), + Err(err) => { + log::warn!( + target: "parachain", + "XXX (on rem) Unable getting route from {:?} to {:?}: {}", + target_hash, leaf_hash, err, + ); + }, + _ => (), + }; + }); + remove_leaf(number, target_hash); log::debug!(target: "parachain", "XXX Removed target (@{}) {:?}", number, target_hash); From e92d65118df642cd039bd36391780bc4af72b2ad Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 11 Nov 2022 15:08:44 +0100 Subject: [PATCH 54/59] Invalidate leaf only on removal --- client/consensus/common/src/level_monitor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index b753d64c0fe..f959de4e73c 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -332,9 +332,11 @@ where if invalidated_leaves.contains(&leaf_idx) { return } - invalidated_leaves.insert(leaf_idx); match sp_blockchain::tree_route(self.backend.blockchain(), target_hash, *leaf_hash) { - Ok(route) if route.retracted().is_empty() => remove_route(route), + Ok(route) if route.retracted().is_empty() => { + invalidated_leaves.insert(leaf_idx); + remove_route(route); + }, Err(err) => { log::warn!( target: "parachain", From bc1643dbaaaacfd74a90d7af8409e05a803de599 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 16 Nov 2022 10:16:17 +0100 Subject: [PATCH 55/59] Removed temporary logs --- client/consensus/common/src/level_monitor.rs | 18 ++++++++---------- client/consensus/common/src/lib.rs | 7 ------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index f959de4e73c..eb46d0f45dd 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -99,7 +99,7 @@ where let info = self.backend.blockchain().info(); log::debug!( target: "parachain", - "XXX Restoring chain level monitor from last finalized block: {} {}", + "Restoring chain level monitor from last finalized block: {} {}", info.finalized_number, info.finalized_hash ); @@ -126,7 +126,7 @@ where counter_max = std::cmp::max(self.import_counter, counter_max); } - log::debug!(target: "parachain", "XXX Restored chain level monitor up to height {}", counter_max); + log::debug!(target: "parachain", "Restored chain level monitor up to height {}", counter_max); self.import_counter = counter_max; } @@ -166,7 +166,7 @@ where log::debug!( target: "parachain", - "XXX Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", + "Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", ); (0..remove_count).all(|_| { @@ -227,7 +227,7 @@ where Err(err) => { log::warn!( target: "parachain", - "XXX (lookup) Unable getting route from {:?} to {:?}: {}", + "(Lookup) Unable getting route from {:?} to {:?}: {}", blk_hash, leaf_hash, err, ); None @@ -246,7 +246,7 @@ where // This should never happen log::error!( target: "parachain", - "XXX Unable getting route to any leaf from {:?} (this is a bug)", + "Unable getting route to any leaf from {:?} (this is a bug)", blk_hash, ); continue @@ -296,9 +296,9 @@ where invalidated_leaves: &mut HashSet, ) { let mut remove_leaf = |number, hash| { - log::debug!(target: "parachain", "XXX Removing block (@{}) {:?}", number, hash); + log::debug!(target: "parachain", "Removing block (@{}) {:?}", number, hash); if let Err(err) = self.backend.remove_leaf_block(hash) { - log::debug!(target: "parachain", "XXX Remove error for {}: {}", hash, err); + log::debug!(target: "parachain", "Remove not possible for {}: {}", hash, err); return false } self.levels.get_mut(&number).map(|level| level.remove(&hash)); @@ -340,7 +340,7 @@ where Err(err) => { log::warn!( target: "parachain", - "XXX (on rem) Unable getting route from {:?} to {:?}: {}", + "(Removal) unable getting route from {:?} to {:?}: {}", target_hash, leaf_hash, err, ); }, @@ -349,8 +349,6 @@ where }); remove_leaf(number, target_hash); - - log::debug!(target: "parachain", "XXX Removed target (@{}) {:?}", number, target_hash); } /// Add a new imported block information to the monitor. diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index e901a0e4e8a..39119f345c2 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -165,13 +165,6 @@ where monitor.block_imported(number, hash); } - match res { - ImportResult::Imported(_) => - log::debug!(target: "parachain", "XXX Imported (@{}) {}", number, hash), - _ => - log::warn!(target: "parachain", "XXX Failed importing (@{}) {}: {:?}", number, hash, res), - } - Ok(res) } } From 408580eadbc599972e0ffb70b6e14598403a43d1 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 9 Dec 2022 17:54:56 +0100 Subject: [PATCH 56/59] Explicit recovery for announced candidate blocks (#1891) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented explicit recovery for announced candidate blocks * Removed magic number * Apply suggestions from code review Co-authored-by: Bastian Köcher * Introduce a random delay before attempting blocks explicit recovery * Richer recovery request message * Rename 'pending_candidates' PoVEntry to 'candidates' * Refactory * Some comments wrt the chosen recovery delay * Prevent recovery of imported blocks * Added test to excercise explicit block recovery request * Trivial cleanup * Fix ancestry assumption that may break recovery * Apply code review suggestion Co-authored-by: Bastian Köcher --- Cargo.lock | 2 + client/consensus/common/Cargo.toml | 1 + .../common/src/parachain_consensus.rs | 72 ++++-- client/consensus/common/src/tests.rs | 149 ++++++++++--- .../src/active_candidate_recovery.rs | 8 +- client/pov-recovery/src/lib.rs | 210 ++++++++++-------- client/service/Cargo.toml | 1 + client/service/src/lib.rs | 26 ++- primitives/core/src/lib.rs | 32 +++ 9 files changed, 355 insertions(+), 146 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8582c36f74..2f5ed34b297 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1578,6 +1578,7 @@ name = "cumulus-client-consensus-common" version = "0.1.0" dependencies = [ "async-trait", + "cumulus-primitives-core", "cumulus-relay-chain-interface", "cumulus-test-client", "dyn-clone", @@ -1690,6 +1691,7 @@ dependencies = [ "cumulus-client-pov-recovery", "cumulus-primitives-core", "cumulus-relay-chain-interface", + "futures", "parking_lot 0.12.1", "polkadot-primitives", "sc-client-api", diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index bcaa7ba73b2..816a004fbbe 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -25,6 +25,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } # Cumulus +cumulus-primitives-core = { path = "../../../primitives/core" } cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } [dev-dependencies] diff --git a/client/consensus/common/src/parachain_consensus.rs b/client/consensus/common/src/parachain_consensus.rs index 860eb552c87..2db3b725c43 100644 --- a/client/consensus/common/src/parachain_consensus.rs +++ b/client/consensus/common/src/parachain_consensus.rs @@ -15,7 +15,6 @@ // along with Cumulus. If not, see . use async_trait::async_trait; -use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use sc_client_api::{ Backend, BlockBackend, BlockImportNotification, BlockchainEvents, Finalizer, UsageProvider, }; @@ -27,15 +26,25 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT}, }; +use cumulus_primitives_core::{RecoveryDelay, RecoveryKind, RecoveryRequest}; +use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; + use polkadot_primitives::v2::{Hash as PHash, Id as ParaId, OccupiedCoreAssumption}; use codec::Decode; -use futures::{select, FutureExt, Stream, StreamExt}; +use futures::{channel::mpsc::Sender, select, FutureExt, Stream, StreamExt}; -use std::{pin::Pin, sync::Arc}; +use std::{pin::Pin, sync::Arc, time::Duration}; const LOG_TARGET: &str = "cumulus-consensus"; +// Delay range to trigger explicit requests. +// The chosen value doesn't have any special meaning, a random delay within the order of +// seconds in practice should be a good enough to allow a quick recovery without DOSing +// the relay chain. +const RECOVERY_DELAY: RecoveryDelay = + RecoveryDelay { min: Duration::ZERO, max: Duration::from_secs(30) }; + /// Helper for the relay chain client. This is expected to be a lightweight handle like an `Arc`. #[async_trait] pub trait RelaychainClient: Clone + 'static { @@ -82,7 +91,7 @@ where let finalized_head = if let Some(h) = finalized_heads.next().await { h } else { - tracing::debug!(target: "cumulus-consensus", "Stopping following finalized head."); + tracing::debug!(target: LOG_TARGET, "Stopping following finalized head."); return }; @@ -90,7 +99,7 @@ where Ok(header) => header, Err(err) => { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, error = ?err, "Could not decode parachain header while following finalized heads.", ); @@ -105,12 +114,12 @@ where if let Err(e) = parachain.finalize_block(hash, None, true) { match e { ClientError::UnknownBlock(_) => tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, block_hash = ?hash, "Could not finalize block because it is unknown.", ), _ => tracing::warn!( - target: "cumulus-consensus", + target: LOG_TARGET, error = ?e, block_hash = ?hash, "Failed to finalize block", @@ -136,6 +145,7 @@ pub async fn run_parachain_consensus( parachain: Arc

, relay_chain: R, announce_block: Arc>) + Send + Sync>, + recovery_chan_tx: Option>>, ) where Block: BlockT, P: Finalizer @@ -148,8 +158,13 @@ pub async fn run_parachain_consensus( R: RelaychainClient, B: Backend, { - let follow_new_best = - follow_new_best(para_id, parachain.clone(), relay_chain.clone(), announce_block); + let follow_new_best = follow_new_best( + para_id, + parachain.clone(), + relay_chain.clone(), + announce_block, + recovery_chan_tx, + ); let follow_finalized_head = follow_finalized_head(para_id, parachain, relay_chain); select! { _ = follow_new_best.fuse() => {}, @@ -163,6 +178,7 @@ async fn follow_new_best( parachain: Arc

, relay_chain: R, announce_block: Arc>) + Send + Sync>, + recovery_chan_tx: Option>>, ) where Block: BlockT, P: Finalizer @@ -197,10 +213,11 @@ async fn follow_new_best( h, &*parachain, &mut unset_best_header, + recovery_chan_tx.clone(), ).await, None => { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, "Stopping following new best.", ); return @@ -217,7 +234,7 @@ async fn follow_new_best( ).await, None => { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, "Stopping following imported blocks.", ); return @@ -276,7 +293,7 @@ async fn handle_new_block_imported( import_block_as_new_best(unset_hash, unset_best_header, parachain).await; }, state => tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, ?unset_best_header, ?notification.header, ?state, @@ -290,6 +307,7 @@ async fn handle_new_best_parachain_head( head: Vec, parachain: &P, unset_best_header: &mut Option, + mut recovery_chan_tx: Option>>, ) where Block: BlockT, P: UsageProvider + Send + Sync + BlockBackend, @@ -299,7 +317,7 @@ async fn handle_new_best_parachain_head( Ok(header) => header, Err(err) => { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, error = ?err, "Could not decode Parachain header while following best heads.", ); @@ -311,7 +329,7 @@ async fn handle_new_best_parachain_head( if parachain.usage_info().chain.best_hash == hash { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, block_hash = ?hash, "Skipping set new best block, because block is already the best.", ) @@ -325,7 +343,7 @@ async fn handle_new_best_parachain_head( }, Ok(BlockStatus::InChainPruned) => { tracing::error!( - target: "cumulus-collator", + target: LOG_TARGET, block_hash = ?hash, "Trying to set pruned block as new best!", ); @@ -334,14 +352,30 @@ async fn handle_new_best_parachain_head( *unset_best_header = Some(parachain_head); tracing::debug!( - target: "cumulus-collator", + target: LOG_TARGET, block_hash = ?hash, "Parachain block not yet imported, waiting for import to enact as best block.", ); + + if let Some(ref mut recovery_chan_tx) = recovery_chan_tx { + // Best effort channel to actively encourage block recovery. + // An error here is not fatal; the relay chain continuously re-announces + // the best block, thus we will have other opportunities to retry. + let req = + RecoveryRequest { hash, delay: RECOVERY_DELAY, kind: RecoveryKind::Full }; + if let Err(err) = recovery_chan_tx.try_send(req) { + tracing::warn!( + target: LOG_TARGET, + block_hash = ?hash, + error = ?err, + "Unable to notify block recovery subsystem" + ) + } + } }, Err(e) => { tracing::error!( - target: "cumulus-collator", + target: LOG_TARGET, block_hash = ?hash, error = ?e, "Failed to get block status of block.", @@ -361,7 +395,7 @@ where let best_number = parachain.usage_info().chain.best_number; if *header.number() < best_number { tracing::debug!( - target: "cumulus-consensus", + target: LOG_TARGET, %best_number, block_number = %header.number(), "Skipping importing block as new best block, because there already exists a \ @@ -377,7 +411,7 @@ where if let Err(err) = (&*parachain).import_block(block_import_params, Default::default()).await { tracing::warn!( - target: "cumulus-consensus", + target: LOG_TARGET, block_hash = ?hash, error = ?err, "Failed to set new best block.", diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index fca1888e279..fc5a1011550 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -18,6 +18,7 @@ use crate::*; use async_trait::async_trait; use codec::Encode; +use cumulus_primitives_core::RecoveryKind; use cumulus_relay_chain_interface::RelayChainResult; use cumulus_test_client::{ runtime::{Block, Header}, @@ -29,7 +30,7 @@ use polkadot_primitives::v2::Id as ParaId; use sc_client_api::{blockchain::Backend as _, Backend as _, UsageProvider}; use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy}; use sp_blockchain::Error as ClientError; -use sp_consensus::BlockOrigin; +use sp_consensus::{BlockOrigin, BlockStatus}; use sp_runtime::generic::BlockId; use std::{ sync::{Arc, Mutex}, @@ -103,22 +104,8 @@ impl crate::parachain_consensus::RelaychainClient for Relaychain { } } -fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Block { - build_and_import_block_ext( - &*client.clone(), - BlockOrigin::Own, - import_as_best, - &mut client, - None, - None, - ) -} - -fn build_and_import_block_ext>( +fn build_block( builder: &B, - origin: BlockOrigin, - import_as_best: bool, - importer: &mut I, at: Option>, timestamp: Option, ) -> Block { @@ -132,27 +119,67 @@ fn build_and_import_block_ext>( }; let mut block = builder.build().unwrap().block; - let (header, body) = block.clone().deconstruct(); - // Simulate some form of post activity. + // Simulate some form of post activity (like a Seal or Other generic things). // This is mostly used to excercise the `LevelMonitor` correct behavior. // (in practice we want that header post-hash != pre-hash) - let post_digest = sp_runtime::DigestItem::Other(vec![1, 2, 3]); + block.header.digest.push(sp_runtime::DigestItem::Other(vec![1, 2, 3])); + + block +} + +async fn import_block>( + importer: &mut I, + block: Block, + origin: BlockOrigin, + import_as_best: bool, +) { + let (mut header, body) = block.deconstruct(); + + let post_digest = + header.digest.pop().expect("post digested is present in manually crafted block"); let mut block_import_params = BlockImportParams::new(origin, header); block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(import_as_best)); block_import_params.body = Some(body); - block_import_params.post_digests.push(post_digest.clone()); + block_import_params.post_digests.push(post_digest); - block_on(importer.import_block(block_import_params, Default::default())).unwrap(); + importer.import_block(block_import_params, Default::default()).await.unwrap(); +} - // In order to get a header hash compatible with block import params containing some - // form of `post_digest`, we need to manually push the post digest within the header - // digest logs. - block.header.digest.push(post_digest); +fn import_block_sync>( + importer: &mut I, + block: Block, + origin: BlockOrigin, + import_as_best: bool, +) { + block_on(import_block(importer, block, origin, import_as_best)); +} + +fn build_and_import_block_ext>( + builder: &B, + origin: BlockOrigin, + import_as_best: bool, + importer: &mut I, + at: Option>, + timestamp: Option, +) -> Block { + let block = build_block(builder, at, timestamp); + import_block_sync(importer, block.clone(), origin, import_as_best); block } +fn build_and_import_block(mut client: Arc, import_as_best: bool) -> Block { + build_and_import_block_ext( + &*client.clone(), + BlockOrigin::Own, + import_as_best, + &mut client, + None, + None, + ) +} + #[test] fn follow_new_best_works() { sp_tracing::try_init_simple(); @@ -164,7 +191,7 @@ fn follow_new_best_works() { let new_best_heads_sender = relay_chain.inner.lock().unwrap().new_best_heads_sender.clone(); let consensus = - run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {})); + run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); let work = async move { new_best_heads_sender.unbounded_send(block.header().clone()).unwrap(); @@ -187,6 +214,68 @@ fn follow_new_best_works() { }); } +#[test] +fn follow_new_best_with_dummy_recovery_works() { + sp_tracing::try_init_simple(); + + let client = Arc::new(TestClientBuilder::default().build()); + + let relay_chain = Relaychain::new(); + let new_best_heads_sender = relay_chain.inner.lock().unwrap().new_best_heads_sender.clone(); + + let (recovery_chan_tx, mut recovery_chan_rx) = futures::channel::mpsc::channel(3); + + let consensus = run_parachain_consensus( + 100.into(), + client.clone(), + relay_chain, + Arc::new(|_, _| {}), + Some(recovery_chan_tx), + ); + + let block = build_block(&*client.clone(), None, None); + let block_clone = block.clone(); + let client_clone = client.clone(); + + let work = async move { + new_best_heads_sender.unbounded_send(block.header().clone()).unwrap(); + loop { + Delay::new(Duration::from_millis(100)).await; + match client.block_status(&BlockId::Hash(block.hash())).unwrap() { + BlockStatus::Unknown => {}, + status => { + assert_eq!(block.hash(), client.usage_info().chain.best_hash); + assert_eq!(status, BlockStatus::InChainWithState); + break + }, + } + } + }; + + let dummy_block_recovery = async move { + loop { + if let Some(req) = recovery_chan_rx.next().await { + assert_eq!(req.hash, block_clone.hash()); + assert_eq!(req.kind, RecoveryKind::Full); + Delay::new(Duration::from_millis(500)).await; + import_block(&mut &*client_clone, block_clone.clone(), BlockOrigin::Own, true) + .await; + } + } + }; + + block_on(async move { + futures::pin_mut!(consensus); + futures::pin_mut!(work); + + select! { + r = consensus.fuse() => panic!("Consensus should not end: {:?}", r), + _ = dummy_block_recovery.fuse() => {}, + _ = work.fuse() => {}, + } + }); +} + #[test] fn follow_finalized_works() { sp_tracing::try_init_simple(); @@ -198,7 +287,7 @@ fn follow_finalized_works() { let finalized_sender = relay_chain.inner.lock().unwrap().finalized_heads_sender.clone(); let consensus = - run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {})); + run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); let work = async move { finalized_sender.unbounded_send(block.header().clone()).unwrap(); @@ -239,7 +328,7 @@ fn follow_finalized_does_not_stop_on_unknown_block() { let finalized_sender = relay_chain.inner.lock().unwrap().finalized_heads_sender.clone(); let consensus = - run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {})); + run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); let work = async move { for _ in 0..3usize { @@ -289,7 +378,7 @@ fn follow_new_best_sets_best_after_it_is_imported() { let new_best_heads_sender = relay_chain.inner.lock().unwrap().new_best_heads_sender.clone(); let consensus = - run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {})); + run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); let work = async move { new_best_heads_sender.unbounded_send(block.header().clone()).unwrap(); @@ -366,7 +455,7 @@ fn do_not_set_best_block_to_older_block() { let new_best_heads_sender = relay_chain.inner.lock().unwrap().new_best_heads_sender.clone(); let consensus = - run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {})); + run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); let client2 = client.clone(); let work = async move { diff --git a/client/pov-recovery/src/active_candidate_recovery.rs b/client/pov-recovery/src/active_candidate_recovery.rs index a269a26f821..caae3615a85 100644 --- a/client/pov-recovery/src/active_candidate_recovery.rs +++ b/client/pov-recovery/src/active_candidate_recovery.rs @@ -42,19 +42,19 @@ impl ActiveCandidateRecovery { Self { recoveries: Default::default(), candidates: Default::default(), overseer_handle } } - /// Recover the given `pending_candidate`. + /// Recover the given `candidate`. pub async fn recover_candidate( &mut self, block_hash: Block::Hash, - pending_candidate: crate::PendingCandidate, + candidate: &crate::Candidate, ) { let (tx, rx) = oneshot::channel(); self.overseer_handle .send_msg( AvailabilityRecoveryMessage::RecoverAvailableData( - pending_candidate.receipt, - pending_candidate.session_index, + candidate.receipt.clone(), + candidate.session_index, None, tx, ), diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 3327d4bb86b..5c9764f6a9c 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -55,11 +55,13 @@ use polkadot_primitives::v2::{ CandidateReceipt, CommittedCandidateReceipt, Id as ParaId, SessionIndex, }; -use cumulus_primitives_core::ParachainBlockData; +use cumulus_primitives_core::{ParachainBlockData, RecoveryDelay, RecoveryKind, RecoveryRequest}; use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use codec::Decode; -use futures::{select, stream::FuturesUnordered, Future, FutureExt, Stream, StreamExt}; +use futures::{ + channel::mpsc::Receiver, select, stream::FuturesUnordered, Future, FutureExt, Stream, StreamExt, +}; use futures_timer::Delay; use rand::{thread_rng, Rng}; @@ -67,7 +69,6 @@ use std::{ collections::{HashMap, VecDeque}, pin::Pin, sync::Arc, - time::Duration, }; mod active_candidate_recovery; @@ -75,38 +76,21 @@ use active_candidate_recovery::ActiveCandidateRecovery; const LOG_TARGET: &str = "cumulus-pov-recovery"; -/// Represents a pending candidate. -struct PendingCandidate { +/// Represents an outstanding block candidate. +struct Candidate { receipt: CandidateReceipt, session_index: SessionIndex, block_number: NumberFor, -} - -/// The delay between observing an unknown block and recovering this block. -#[derive(Clone, Copy)] -pub enum RecoveryDelay { - /// Start recovering the block in maximum of the given delay. - WithMax { max: Duration }, - /// Start recovering the block after at least `min` delay and in maximum `max` delay. - WithMinAndMax { min: Duration, max: Duration }, -} - -impl RecoveryDelay { - /// Return as [`Delay`]. - fn as_delay(self) -> Delay { - match self { - Self::WithMax { max } => Delay::new(max.mul_f64(thread_rng().gen())), - Self::WithMinAndMax { min, max } => - Delay::new(min + max.saturating_sub(min).mul_f64(thread_rng().gen())), - } - } + parent_hash: Block::Hash, + // Lazy recovery has been submitted. + waiting_recovery: bool, } /// Encapsulates the logic of the pov recovery. pub struct PoVRecovery { /// All the pending candidates that we are waiting for to be imported or that need to be /// recovered when `next_candidate_to_recover` tells us to do so. - pending_candidates: HashMap>, + candidates: HashMap>, /// A stream of futures that resolve to hashes of candidates that need to be recovered. /// /// The candidates to the hashes are stored in `pending_candidates`. If a candidate is not @@ -122,6 +106,8 @@ pub struct PoVRecovery { parachain_import_queue: IQ, relay_chain_interface: RC, para_id: ParaId, + /// Explicit block recovery requests channel. + recovery_chan_rx: Receiver>, } impl PoVRecovery @@ -138,9 +124,10 @@ where parachain_import_queue: IQ, relay_chain_interface: RCInterface, para_id: ParaId, + recovery_chan_rx: Receiver>, ) -> Self { Self { - pending_candidates: HashMap::new(), + candidates: HashMap::new(), next_candidate_to_recover: Default::default(), active_candidate_recovery: ActiveCandidateRecovery::new(overseer_handle), recovery_delay, @@ -149,6 +136,7 @@ where parachain_import_queue, relay_chain_interface, para_id, + recovery_chan_rx, } } @@ -175,69 +163,54 @@ where } let hash = header.hash(); - match self.parachain_client.block_status(&BlockId::Hash(hash)) { - Ok(BlockStatus::Unknown) => (), - // Any other state means, we should ignore it. - Ok(_) => return, - Err(e) => { - tracing::debug!( - target: LOG_TARGET, - error = ?e, - block_hash = ?hash, - "Failed to get block status", - ); - return - }, - } - tracing::debug!(target: LOG_TARGET, ?hash, "Adding pending candidate"); - if self - .pending_candidates - .insert( - hash, - PendingCandidate { - block_number: *header.number(), - receipt: receipt.to_plain(), - session_index, - }, - ) - .is_some() - { + if self.candidates.contains_key(&hash) { return } - // Delay the recovery by some random time to not spam the relay chain. - let delay = self.recovery_delay.as_delay(); - self.next_candidate_to_recover.push( - async move { - delay.await; - hash - } - .boxed(), + tracing::debug!(target: LOG_TARGET, block_hash = ?hash, "Adding outstanding candidate"); + self.candidates.insert( + hash, + Candidate { + block_number: *header.number(), + receipt: receipt.to_plain(), + session_index, + parent_hash: *header.parent_hash(), + waiting_recovery: false, + }, ); + + // If required, triggers a lazy recovery request that will eventually be blocked + // if in the meantime the block is imported. + self.recover(RecoveryRequest { + hash, + delay: self.recovery_delay, + kind: RecoveryKind::Simple, + }); } /// Handle an imported block. - fn handle_block_imported(&mut self, hash: &Block::Hash) { - self.pending_candidates.remove(hash); + fn handle_block_imported(&mut self, block_hash: &Block::Hash) { + self.candidates.get_mut(block_hash).map(|candidate| { + // Prevents triggering an already enqueued recovery request + candidate.waiting_recovery = false; + }); } /// Handle a finalized block with the given `block_number`. fn handle_block_finalized(&mut self, block_number: NumberFor) { - self.pending_candidates.retain(|_, pc| pc.block_number > block_number); + self.candidates.retain(|_, pc| pc.block_number > block_number); } /// Recover the candidate for the given `block_hash`. async fn recover_candidate(&mut self, block_hash: Block::Hash) { - let pending_candidate = match self.pending_candidates.remove(&block_hash) { - Some(pending_candidate) => pending_candidate, - None => return, - }; - - tracing::debug!(target: LOG_TARGET, ?block_hash, "Issuing recovery request"); - self.active_candidate_recovery - .recover_candidate(block_hash, pending_candidate) - .await; + match self.candidates.get(&block_hash) { + Some(candidate) if candidate.waiting_recovery => { + tracing::debug!(target: LOG_TARGET, ?block_hash, "Issuing recovery request"); + self.active_candidate_recovery.recover_candidate(block_hash, candidate).await; + }, + _ => (), + } } /// Clear `waiting_for_parent` from the given `hash` and do this recursively for all child @@ -349,7 +322,7 @@ where async fn import_block(&mut self, block: Block) { let mut blocks = VecDeque::new(); - tracing::debug!(target: LOG_TARGET, hash = ?block.hash(), "Importing block retrieved using pov_recovery"); + tracing::debug!(target: LOG_TARGET, block_hash = ?block.hash(), "Importing block retrieved using pov_recovery"); blocks.push_back(block); let mut incoming_blocks = Vec::new(); @@ -380,6 +353,70 @@ where .import_blocks(BlockOrigin::ConsensusBroadcast, incoming_blocks); } + /// Attempts an explicit recovery of one or more blocks. + pub fn recover(&mut self, req: RecoveryRequest) { + let RecoveryRequest { mut hash, delay, kind } = req; + let mut to_recover = Vec::new(); + + let do_recover = loop { + let candidate = match self.candidates.get_mut(&hash) { + Some(candidate) => candidate, + None => { + tracing::debug!( + target: LOG_TARGET, + block_hash = ?hash, + "Cound not recover. Block was never announced as candidate" + ); + break false + }, + }; + + match self.parachain_client.block_status(&BlockId::Hash(hash)) { + Ok(BlockStatus::Unknown) if !candidate.waiting_recovery => { + candidate.waiting_recovery = true; + to_recover.push(hash); + }, + Ok(_) => break true, + Err(e) => { + tracing::error!( + target: LOG_TARGET, + error = ?e, + block_hash = ?hash, + "Failed to get block status", + ); + break false + }, + } + + if kind == RecoveryKind::Simple { + break true + } + + hash = candidate.parent_hash; + }; + + if do_recover { + for hash in to_recover.into_iter().rev() { + let delay = + delay.min + delay.max.saturating_sub(delay.min).mul_f64(thread_rng().gen()); + tracing::debug!( + target: LOG_TARGET, + block_hash = ?hash, + "Starting {:?} block recovery in {:?} sec", + kind, + delay.as_secs(), + ); + self.next_candidate_to_recover.push( + async move { + Delay::new(delay).await; + hash + } + .boxed(), + ); + } + } + } + /// Run the pov-recovery. pub async fn run(mut self) { let mut imported_blocks = self.parachain_client.import_notification_stream().fuse(); @@ -401,10 +438,15 @@ where if let Some((receipt, session_index)) = pending_candidate { self.handle_pending_candidate(receipt, session_index); } else { - tracing::debug!( - target: LOG_TARGET, - "Pending candidates stream ended", - ); + tracing::debug!(target: LOG_TARGET, "Pending candidates stream ended"); + return; + } + }, + recovery_req = self.recovery_chan_rx.next() => { + if let Some(req) = recovery_req { + self.recover(req); + } else { + tracing::debug!(target: LOG_TARGET, "Recovery channel stream ended"); return; } }, @@ -412,10 +454,7 @@ where if let Some(imported) = imported { self.handle_block_imported(&imported.hash); } else { - tracing::debug!( - target: LOG_TARGET, - "Imported blocks stream ended", - ); + tracing::debug!(target: LOG_TARGET, "Imported blocks stream ended"); return; } }, @@ -423,10 +462,7 @@ where if let Some(finalized) = finalized { self.handle_block_finalized(*finalized.header.number()); } else { - tracing::debug!( - target: LOG_TARGET, - "Finalized blocks stream ended", - ); + tracing::debug!(target: LOG_TARGET, "Finalized blocks stream ended"); return; } }, diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index e705364a1c8..1151a978d34 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] parking_lot = "0.12.1" +futures = "0.3.24" # Substrate sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 067ca1c83f3..a7f6a16625a 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -19,9 +19,10 @@ //! Provides functions for starting a collator node or a normal full node. use cumulus_client_consensus_common::ParachainConsensus; -use cumulus_primitives_core::{CollectCollationInfo, ParaId}; +use cumulus_primitives_core::{CollectCollationInfo, ParaId, RecoveryDelay}; use cumulus_relay_chain_interface::RelayChainInterface; use polkadot_primitives::v2::CollatorPair; + use sc_client_api::{ Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, UsageProvider, }; @@ -30,6 +31,7 @@ use sc_consensus::{ BlockImport, }; use sc_service::{Configuration, TaskManager}; + use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_consensus::BlockOrigin; @@ -38,8 +40,15 @@ use sp_runtime::{ traits::{Block as BlockT, NumberFor}, Justifications, }; + +use futures::channel::mpsc; use std::{sync::Arc, time::Duration}; +// Given the sporadic nature of the explicit recovery operation and the +// possibility to retry infinite times this value is more than enough. +// In practice here we expect no more than one queued messages. +const RECOVERY_CHAN_SIZE: usize = 8; + /// Parameters given to [`start_collator`]. pub struct StartCollatorParams<'a, Block: BlockT, BS, Client, RCInterface, Spawner, IQ> { pub block_status: Arc, @@ -94,11 +103,14 @@ where Backend: BackendT + 'static, IQ: ImportQueue + 'static, { + let (recovery_chan_tx, recovery_chan_rx) = mpsc::channel(RECOVERY_CHAN_SIZE); + let consensus = cumulus_client_consensus_common::run_parachain_consensus( para_id, client.clone(), relay_chain_interface.clone(), announce_block.clone(), + Some(recovery_chan_tx), ); task_manager @@ -113,11 +125,12 @@ where overseer_handle.clone(), // We want that collators wait at maximum the relay chain slot duration before starting // to recover blocks. - cumulus_client_pov_recovery::RecoveryDelay::WithMax { max: relay_chain_slot_duration }, + RecoveryDelay { min: core::time::Duration::ZERO, max: relay_chain_slot_duration }, client.clone(), import_queue, relay_chain_interface.clone(), para_id, + recovery_chan_rx, ); task_manager @@ -178,11 +191,14 @@ where RCInterface: RelayChainInterface + Clone + 'static, IQ: ImportQueue + 'static, { + let (recovery_chan_tx, recovery_chan_rx) = mpsc::channel(RECOVERY_CHAN_SIZE); + let consensus = cumulus_client_consensus_common::run_parachain_consensus( para_id, client.clone(), relay_chain_interface.clone(), announce_block, + Some(recovery_chan_tx), ); task_manager @@ -200,14 +216,12 @@ where // the recovery way before full nodes try to recover a certain block and then share the // block with the network using "the normal way". Full nodes are just the "last resort" // for block recovery. - cumulus_client_pov_recovery::RecoveryDelay::WithMinAndMax { - min: relay_chain_slot_duration * 25, - max: relay_chain_slot_duration * 50, - }, + RecoveryDelay { min: relay_chain_slot_duration * 25, max: relay_chain_slot_duration * 50 }, client, import_queue, relay_chain_interface, para_id, + recovery_chan_rx, ); task_manager diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 516ff817dcf..2f0105248f5 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -19,6 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; +use core::time::Duration; use polkadot_parachain::primitives::HeadData; use sp_runtime::{traits::Block as BlockT, RuntimeDebug}; use sp_std::prelude::*; @@ -194,6 +195,37 @@ impl ParachainBlockData { } } +/// Type of recovery to trigger. +#[derive(Debug, PartialEq)] +pub enum RecoveryKind { + /// Single block recovery. + Simple, + /// Full ancestry recovery. + Full, +} + +/// Structure used to trigger an explicit recovery request via `PoVRecovery`. +pub struct RecoveryRequest { + /// Hash of the last block to recover. + pub hash: Block::Hash, + /// Recovery delay range. Randomizing the start of the recovery within this interval + /// can be used to prevent self-DOSing if the recovery request is part of a + /// distributed protocol and there is the possibility that multiple actors are + /// requiring to perform the recovery action at approximately the same time. + pub delay: RecoveryDelay, + /// Recovery type. + pub kind: RecoveryKind, +} + +/// The delay between observing an unknown block and triggering the recovery of a block. +#[derive(Clone, Copy)] +pub struct RecoveryDelay { + /// Start recovering after `min` delay. + pub min: Duration, + /// Start recovering before `max` delay. + pub max: Duration, +} + /// Information about a collation. /// /// This was used in version 1 of the [`CollectCollationInfo`] runtime api. From 92bb6ac415f8471344368048c7807d5e7490dbce Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 9 Dec 2022 18:36:50 +0100 Subject: [PATCH 57/59] Fix after master merge --- client/consensus/common/src/level_monitor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index eb46d0f45dd..294527f1f9f 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -216,8 +216,10 @@ where .find_map(|(leaf_idx, leaf_hash)| { if blk_hash == leaf_hash { let entry = HashAndNumber { number, hash: *blk_hash }; - let freshest_route = TreeRoute::new(vec![entry], 0); - Some(TargetInfo { freshest_leaf_idx: leaf_idx, freshest_route }) + TreeRoute::new(vec![entry], 0).ok().map(|freshest_route| TargetInfo { + freshest_leaf_idx: leaf_idx, + freshest_route, + }) } else { match sp_blockchain::tree_route(blockchain, *blk_hash, *leaf_hash) { Ok(route) if route.retracted().is_empty() => Some(TargetInfo { From 8886f6701d42b02ec952a46c0d15acf0c5ba7cc5 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 20 Dec 2022 11:21:03 +0100 Subject: [PATCH 58/59] Moved block recovery related types in pov-recovery crate --- Cargo.lock | 1 + client/consensus/common/Cargo.toml | 1 + .../common/src/parachain_consensus.rs | 2 +- client/pov-recovery/src/lib.rs | 34 ++++++++++++++++++- primitives/core/src/lib.rs | 32 ----------------- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6142682bfb1..8519f2cbf2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1673,6 +1673,7 @@ name = "cumulus-client-consensus-common" version = "0.1.0" dependencies = [ "async-trait", + "cumulus-client-pov-recovery", "cumulus-primitives-core", "cumulus-relay-chain-interface", "cumulus-test-client", diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index 9ea857103ac..c06e28c8d05 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -27,6 +27,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = # Cumulus cumulus-primitives-core = { path = "../../../primitives/core" } cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } +cumulus-client-pov-recovery = { path = "../../pov-recovery" } [dev-dependencies] futures-timer = "3.0.2" diff --git a/client/consensus/common/src/parachain_consensus.rs b/client/consensus/common/src/parachain_consensus.rs index 2db3b725c43..ffbbab5a200 100644 --- a/client/consensus/common/src/parachain_consensus.rs +++ b/client/consensus/common/src/parachain_consensus.rs @@ -26,7 +26,7 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT}, }; -use cumulus_primitives_core::{RecoveryDelay, RecoveryKind, RecoveryRequest}; +use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest}; use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use polkadot_primitives::v2::{Hash as PHash, Id as ParaId, OccupiedCoreAssumption}; diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 72781e8514c..90c0a853214 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -55,7 +55,7 @@ use polkadot_primitives::v2::{ CandidateReceipt, CommittedCandidateReceipt, Id as ParaId, SessionIndex, }; -use cumulus_primitives_core::{ParachainBlockData, RecoveryDelay, RecoveryKind, RecoveryRequest}; +use cumulus_primitives_core::ParachainBlockData; use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use codec::Decode; @@ -69,6 +69,7 @@ use std::{ collections::{HashMap, VecDeque}, pin::Pin, sync::Arc, + time::Duration, }; mod active_candidate_recovery; @@ -76,6 +77,37 @@ use active_candidate_recovery::ActiveCandidateRecovery; const LOG_TARGET: &str = "cumulus-pov-recovery"; +/// Type of recovery to trigger. +#[derive(Debug, PartialEq)] +pub enum RecoveryKind { + /// Single block recovery. + Simple, + /// Full ancestry recovery. + Full, +} + +/// Structure used to trigger an explicit recovery request via `PoVRecovery`. +pub struct RecoveryRequest { + /// Hash of the last block to recover. + pub hash: Block::Hash, + /// Recovery delay range. Randomizing the start of the recovery within this interval + /// can be used to prevent self-DOSing if the recovery request is part of a + /// distributed protocol and there is the possibility that multiple actors are + /// requiring to perform the recovery action at approximately the same time. + pub delay: RecoveryDelay, + /// Recovery type. + pub kind: RecoveryKind, +} + +/// The delay between observing an unknown block and triggering the recovery of a block. +#[derive(Clone, Copy)] +pub struct RecoveryDelay { + /// Start recovering after `min` delay. + pub min: Duration, + /// Start recovering before `max` delay. + pub max: Duration, +} + /// Represents an outstanding block candidate. struct Candidate { receipt: CandidateReceipt, diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 2f0105248f5..516ff817dcf 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -19,7 +19,6 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; -use core::time::Duration; use polkadot_parachain::primitives::HeadData; use sp_runtime::{traits::Block as BlockT, RuntimeDebug}; use sp_std::prelude::*; @@ -195,37 +194,6 @@ impl ParachainBlockData { } } -/// Type of recovery to trigger. -#[derive(Debug, PartialEq)] -pub enum RecoveryKind { - /// Single block recovery. - Simple, - /// Full ancestry recovery. - Full, -} - -/// Structure used to trigger an explicit recovery request via `PoVRecovery`. -pub struct RecoveryRequest { - /// Hash of the last block to recover. - pub hash: Block::Hash, - /// Recovery delay range. Randomizing the start of the recovery within this interval - /// can be used to prevent self-DOSing if the recovery request is part of a - /// distributed protocol and there is the possibility that multiple actors are - /// requiring to perform the recovery action at approximately the same time. - pub delay: RecoveryDelay, - /// Recovery type. - pub kind: RecoveryKind, -} - -/// The delay between observing an unknown block and triggering the recovery of a block. -#[derive(Clone, Copy)] -pub struct RecoveryDelay { - /// Start recovering after `min` delay. - pub min: Duration, - /// Start recovering before `max` delay. - pub max: Duration, -} - /// Information about a collation. /// /// This was used in version 1 of the [`CollectCollationInfo`] runtime api. From 0eff586c9493326940d8a7a6cfafe0581a27a4ce Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Tue, 20 Dec 2022 11:27:42 +0100 Subject: [PATCH 59/59] Fix after refactory --- client/consensus/common/src/tests.rs | 2 +- client/service/src/lib.rs | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index fc5a1011550..92cecc37d29 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -18,7 +18,7 @@ use crate::*; use async_trait::async_trait; use codec::Encode; -use cumulus_primitives_core::RecoveryKind; +use cumulus_client_pov_recovery::RecoveryKind; use cumulus_relay_chain_interface::RelayChainResult; use cumulus_test_client::{ runtime::{Block, Header}, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 77ed55a0ab6..4e091c033a7 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -20,7 +20,8 @@ use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_common::ParachainConsensus; -use cumulus_primitives_core::{CollectCollationInfo, ParaId, RecoveryDelay}; +use cumulus_client_pov_recovery::{PoVRecovery, RecoveryDelay}; +use cumulus_primitives_core::{CollectCollationInfo, ParaId}; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; @@ -35,10 +36,7 @@ use sc_telemetry::TelemetryWorkerHandle; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_core::traits::SpawnNamed; -use sp_runtime::{ - traits::{Block as BlockT, NumberFor}, - Justifications, -}; +use sp_runtime::traits::Block as BlockT; use futures::channel::mpsc; use std::{sync::Arc, time::Duration}; @@ -119,7 +117,7 @@ where .overseer_handle() .map_err(|e| sc_service::Error::Application(Box::new(e)))?; - let pov_recovery = cumulus_client_pov_recovery::PoVRecovery::new( + let pov_recovery = PoVRecovery::new( overseer_handle.clone(), // We want that collators wait at maximum the relay chain slot duration before starting // to recover blocks. @@ -206,7 +204,7 @@ where .overseer_handle() .map_err(|e| sc_service::Error::Application(Box::new(e)))?; - let pov_recovery = cumulus_client_pov_recovery::PoVRecovery::new( + let pov_recovery = PoVRecovery::new( overseer_handle, // Full nodes should at least wait 2.5 minutes (assuming 6 seconds slot duration) and // in maximum 5 minutes before starting to recover blocks. Collators should already start