Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into bernhard-malus-fx
Browse files Browse the repository at this point in the history
* master:
  Add tests and modify as_vec implementation (#3715)
  Bump structopt from 0.3.22 to 0.3.23 (#3770)
  bump substrate and beefy (#3789)
  set `DisputesHandler` in initializer (#3788)
  Bump futures from 0.3.16 to 0.3.17 (#3742)
  Convert rococo chainspec to raw chainspec (#3785)
  feat/overseer: introduce closure init (#3775)
  comment out bridges runtime modules (broken) and update Rococo chain-spec (#3780)
  Add VoteLocking config (#3734)
  Enable disputes on rococo (#3764)
  XCM: Automatic Version Negotiation (#3736)
  • Loading branch information
ordian committed Sep 6, 2021
2 parents ee0d312 + 06f00a4 commit 720c91a
Show file tree
Hide file tree
Showing 89 changed files with 2,544 additions and 1,153 deletions.
763 changes: 352 additions & 411 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
log = "0.4.13"
thiserror = "1.0.26"
structopt = { version = "0.3.21", optional = true }
futures = "0.3.15"
structopt = { version = "0.3.23", optional = true }
futures = "0.3.17"

service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true }
polkadot-node-core-pvf = { path = "../node/core/pvf", optional = true }
Expand Down
38 changes: 25 additions & 13 deletions erasure-coding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ where

/// Verify a merkle branch, yielding the chunk hash meant to be present at that
/// index.
pub fn branch_hash(root: &H256, branch_nodes: &[Vec<u8>], index: usize) -> Result<H256, Error> {
pub fn branch_hash(root: &H256, branch_nodes: &Proof, index: usize) -> Result<H256, Error> {
let mut trie_storage: MemoryDB<Blake2Hasher> = MemoryDB::default();
for node in branch_nodes.iter() {
(&mut trie_storage as &mut trie::HashDB<_>).insert(EMPTY_PREFIX, node.as_slice());
(&mut trie_storage as &mut trie::HashDB<_>).insert(EMPTY_PREFIX, node);
}

let trie = TrieDB::new(&trie_storage, &root).map_err(|_| Error::InvalidBranchProof)?;
Expand Down Expand Up @@ -372,6 +372,10 @@ mod tests {
use super::*;
use polkadot_primitives::v0::{AvailableData, BlockData, PoVBlock};

// In order to adequately compute the number of entries in the Merkle
// trie, we must account for the fixed 16-ary trie structure.
const KEY_INDEX_NIBBLE_SIZE: usize = 4;

#[test]
fn field_order_is_right_size() {
assert_eq!(MAX_VALIDATORS, 65536);
Expand Down Expand Up @@ -404,28 +408,36 @@ mod tests {
assert_eq!(reconstructed, Err(Error::NotEnoughValidators));
}

#[test]
fn construct_valid_branches() {
let pov_block = PoVBlock { block_data: BlockData(vec![2; 256]) };
fn generate_trie_and_generate_proofs(magnitude: u32) {
let n_validators = 2_u32.pow(magnitude) as usize;
let pov_block =
PoVBlock { block_data: BlockData(vec![2; n_validators / KEY_INDEX_NIBBLE_SIZE]) };

let available_data = AvailableData { pov_block, omitted_validation: Default::default() };

let chunks = obtain_chunks(10, &available_data).unwrap();
let chunks = obtain_chunks(magnitude as usize, &available_data).unwrap();

assert_eq!(chunks.len(), 10);
assert_eq!(chunks.len() as u32, magnitude);

let branches = branches(chunks.as_ref());
let root = branches.root();

let proofs: Vec<_> = branches.map(|(proof, _)| proof).collect();
assert_eq!(proofs.len() as u32, magnitude);
for (i, proof) in proofs.into_iter().enumerate() {
let encode = Encode::encode(&proof);
let decode = Decode::decode(&mut &encode[..]).unwrap();
assert_eq!(proof, decode);
assert_eq!(encode, Encode::encode(&decode));

assert_eq!(proofs.len(), 10);
assert_eq!(branch_hash(&root, &proof, i).unwrap(), BlakeTwo256::hash(&chunks[i]));
}
}

for (i, proof) in proofs.into_iter().enumerate() {
assert_eq!(
branch_hash(&root, &proof.as_vec(), i).unwrap(),
BlakeTwo256::hash(&chunks[i])
);
#[test]
fn roundtrip_proof_encoding() {
for i in 2..16 {
generate_trie_and_generate_proofs(i);
}
}
}
2 changes: 1 addition & 1 deletion node/collation-generation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
polkadot-erasure-coding = { path = "../../erasure-coding" }
polkadot-node-primitives = { path = "../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }
tracing = "0.1.26"
Expand Down
2 changes: 1 addition & 1 deletion node/core/av-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"
kvdb = "0.10.0"
thiserror = "1.0.26"
Expand Down
4 changes: 2 additions & 2 deletions node/core/backing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
Expand All @@ -23,6 +23,6 @@ sp-application-crypto = { git = "https://github.com/paritytech/substrate", branc
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.15", features = ["thread-pool"] }
futures = { version = "0.3.17", features = ["thread-pool"] }
assert_matches = "1.4.0"
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
2 changes: 1 addition & 1 deletion node/core/bitfield-signing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
Expand Down
4 changes: 2 additions & 2 deletions node/core/candidate-validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
async-trait = "0.1.51"
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"

sp-maybe-compressed-blob = { package = "sp-maybe-compressed-blob", git = "https://github.com/paritytech/substrate", branch = "master" }
Expand All @@ -23,7 +23,7 @@ polkadot-node-core-pvf = { path = "../pvf" }

[dev-dependencies]
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.15", features = ["thread-pool"] }
futures = { version = "0.3.17", features = ["thread-pool"] }
assert_matches = "1.4.0"
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
6 changes: 4 additions & 2 deletions node/core/candidate-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ pub struct Config {

/// The candidate validation subsystem.
pub struct CandidateValidationSubsystem {
metrics: Metrics,
pvf_metrics: polkadot_node_core_pvf::Metrics,
#[allow(missing_docs)]
pub metrics: Metrics,
#[allow(missing_docs)]
pub pvf_metrics: polkadot_node_core_pvf::Metrics,
config: Config,
}

Expand Down
4 changes: 2 additions & 2 deletions node/core/chain-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-primitives = { path = "../../../primitives" }
Expand All @@ -15,7 +15,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }

[dev-dependencies]
futures = { version = "0.3.15", features = ["thread-pool"] }
futures = { version = "0.3.17", features = ["thread-pool"] }
maplit = "1.0.2"
parity-scale-codec = "2.0.0"
polkadot-node-primitives = { path = "../../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion node/core/chain-selection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion node/core/dispute-coordinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
futures = "0.3.12"
futures = "0.3.17"
tracing = "0.1.26"
parity-scale-codec = "2"
kvdb = "0.10.0"
Expand Down
2 changes: 1 addition & 1 deletion node/core/dispute-participation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.12"
futures = "0.3.17"
thiserror = "1.0.26"
tracing = "0.1.26"

Expand Down
2 changes: 1 addition & 1 deletion node/core/parachains-inherent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"
tracing = "0.1.26"
thiserror = "1.0.26"
Expand Down
2 changes: 1 addition & 1 deletion node/core/provisioner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
thiserror = "1.0.26"
polkadot-primitives = { path = "../../../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion node/core/pvf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ always-assert = "0.1"
async-std = { version = "1.8.0", features = ["attributes"] }
async-process = "1.1.0"
assert_matches = "1.4.0"
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"
libc = "0.2.101"
slotmap = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions node/core/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
memory-lru = "0.1.0"
parity-util-mem = { version = "0.10.0", default-features = false }
Expand All @@ -21,6 +21,6 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }

[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.15", features = ["thread-pool"] }
futures = { version = "0.3.17", features = ["thread-pool"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
polkadot-node-primitives = { path = "../../primitives" }
2 changes: 1 addition & 1 deletion node/malus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ polkadot-node-core-pvf = { path = "../core/pvf" }
parity-util-mem = { version = "0.10.0", default-features = false, features = ["jemalloc-global"] }
color-eyre = { version = "0.5.11", default-features = false }
assert_matches = "1.5"
structopt = "0.3.21"
structopt = "0.3.23"
async-trait = "0.1.51"
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = "0.3.16"
Expand Down
4 changes: 2 additions & 2 deletions node/metered-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ edition = "2018"
description = "Channels with attached Meters"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"
derive_more = "0.99"

[dev-dependencies]
futures = { version = "0.3.15", features = ["thread-pool"] }
futures = { version = "0.3.17", features = ["thread-pool"] }
2 changes: 1 addition & 1 deletion node/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
description = "Subsystem traits and message definitions"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3.0.2"

metered-channel = { path = "../metered-channel" }
Expand Down
2 changes: 1 addition & 1 deletion node/network/approval-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-primitives = { path = "../../../primitives" }

futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion node/network/availability-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
parity-scale-codec = { version = "2.0.0", features = ["std"] }
polkadot-primitives = { path = "../../../primitives" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl RunningTask {

fn validate_chunk(&self, validator: &AuthorityDiscoveryId, chunk: &ErasureChunk) -> bool {
let anticipated_hash =
match branch_hash(&self.erasure_root, &chunk.proof_as_vec(), chunk.index.0 as usize) {
match branch_hash(&self.erasure_root, chunk.proof(), chunk.index.0 as usize) {
Ok(hash) => hash,
Err(e) => {
tracing::warn!(
Expand Down
2 changes: 1 addition & 1 deletion node/network/availability-recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
lru = "0.6.6"
rand = "0.8.3"
thiserror = "1.0.26"
Expand Down
8 changes: 3 additions & 5 deletions node/network/availability-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,9 @@ impl RequestChunksPhase {

let validator_index = chunk.index;

if let Ok(anticipated_hash) = branch_hash(
&params.erasure_root,
&chunk.proof_as_vec(),
chunk.index.0 as usize,
) {
if let Ok(anticipated_hash) =
branch_hash(&params.erasure_root, chunk.proof(), chunk.index.0 as usize)
{
let erasure_chunk_hash = BlakeTwo256::hash(&chunk.chunk);

if erasure_chunk_hash != anticipated_hash {
Expand Down
2 changes: 1 addition & 1 deletion node/network/bitfield-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
Expand Down
2 changes: 1 addition & 1 deletion node/network/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
async-trait = "0.1.51"
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion node/network/collator-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
always-assert = "0.1.2"
derive_more = "0.99.14"
futures = "0.3.15"
futures = "0.3.17"
futures-timer = "3"
thiserror = "1.0.26"
tracing = "0.1.26"
Expand Down
2 changes: 1 addition & 1 deletion node/network/dispute-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
derive_more = "0.99.14"
parity-scale-codec = { version = "2.0.0", features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion node/network/gossip-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-primitives = { path = "../../../primitives" }

futures = "0.3.15"
futures = "0.3.17"
rand = { version = "0.8.3", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
tracing = "0.1.26"
Expand Down
2 changes: 1 addition & 1 deletion node/network/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "master
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
strum = { version = "0.21", features = ["derive"] }
derive_more = "0.99.11"
futures = "0.3.15"
futures = "0.3.17"
thiserror = "1.0.26"
2 changes: 1 addition & 1 deletion node/network/statement-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Statement Distribution Subsystem"
edition = "2018"

[dependencies]
futures = "0.3.15"
futures = "0.3.17"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
Loading

0 comments on commit 720c91a

Please sign in to comment.