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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into erasure_chunk_proof…
Browse files Browse the repository at this point in the history
…_bounded
  • Loading branch information
Lldenaurois committed Aug 24, 2021
2 parents f442c43 + 2a0b6ff commit 5a4ad8e
Show file tree
Hide file tree
Showing 34 changed files with 631 additions and 478 deletions.
467 changes: 193 additions & 274 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bridges/primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: sp_version::create_runtime_str!("rococo"),
impl_name: sp_version::create_runtime_str!("parity-rococo-v1.6"),
authoring_version: 0,
spec_version: 9004,
spec_version: 9100,
impl_version: 0,
apis: sp_version::create_apis_vec![[]],
transaction_version: 0,
Expand Down
13 changes: 11 additions & 2 deletions node/network/availability-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use std::{
collections::{HashMap, VecDeque},
pin::Pin,
time::Duration,
};

use futures::{
Expand All @@ -43,7 +44,7 @@ use polkadot_node_network_protocol::{
IfDisconnected, UnifiedReputationChange as Rep,
};
use polkadot_node_primitives::{AvailableData, ErasureChunk};
use polkadot_node_subsystem_util::request_session_info;
use polkadot_node_subsystem_util::{request_session_info, TimeoutExt};
use polkadot_primitives::v1::{
AuthorityDiscoveryId, BlakeTwo256, BlockNumber, CandidateHash, CandidateReceipt, GroupIndex,
Hash, HashT, SessionIndex, SessionInfo, ValidatorId, ValidatorIndex,
Expand Down Expand Up @@ -72,6 +73,10 @@ const LRU_SIZE: usize = 16;

const COST_INVALID_REQUEST: Rep = Rep::CostMajor("Peer sent unparsable request");

/// Max time we want to wait for responses, before calling `launch_parallel_requests` again to fill
/// up slots.
const MAX_CHUNK_WAIT: Duration = Duration::from_secs(1);

/// The Availability Recovery Subsystem.
pub struct AvailabilityRecoverySubsystem {
fast_path: bool,
Expand Down Expand Up @@ -285,7 +290,11 @@ impl RequestChunksPhase {

async fn wait_for_chunks(&mut self, params: &InteractionParams) {
// Wait for all current requests to conclude or time-out, or until we reach enough chunks.
while let Some(request_result) = self.requesting_chunks.next().await {
// We will also stop, if there has not been a response for `MAX_CHUNK_WAIT`, so
// `launch_parallel_requests` cann fill up slots again.
while let Some(request_result) =
self.requesting_chunks.next().timeout(MAX_CHUNK_WAIT).await.flatten()
{
match request_result {
Ok(Some(chunk)) => {
// Check merkle proofs of any received chunks.
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub use self::overseer::{
create_default_subsystems, OverseerGen, OverseerGenArgs, RealOverseerGen,
};

#[cfg(test)]
#[cfg(all(test, feature = "disputes"))]
mod tests;

#[cfg(feature = "full-node")]
Expand Down
67 changes: 25 additions & 42 deletions node/service/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(dead_code)]
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

Expand Down Expand Up @@ -138,15 +137,6 @@ fn garbage_vrf() -> (VRFOutput, VRFProof) {
(VRFOutput(o.to_output()), VRFProof(p))
}

// nice to have
const A1: Hash = Hash::repeat_byte(0xA1);
const A2: Hash = Hash::repeat_byte(0xA2);
const A3: Hash = Hash::repeat_byte(0xA3);
const A5: Hash = Hash::repeat_byte(0xA5);

const B2: Hash = Hash::repeat_byte(0xB2);
const B3: Hash = Hash::repeat_byte(0xB3);

/// Representation of a local representation
/// to extract information for finalization target
/// extraction.
Expand Down Expand Up @@ -543,11 +533,11 @@ fn chain_0() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A1,
best_chain_containing_block: Some(A5),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a1,
best_chain_containing_block: Some(a5),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand All @@ -571,11 +561,11 @@ fn chain_1() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A1,
best_chain_containing_block: Some(B3),
highest_approved_ancestor_block: Some(B2),
undisputed_chain: Some(B2),
expected_finality_target_result: Some(B2),
target_block: a1,
best_chain_containing_block: Some(b3),
highest_approved_ancestor_block: Some(b2),
undisputed_chain: Some(b2),
expected_finality_target_result: Some(b2),
}
}

Expand All @@ -599,11 +589,11 @@ fn chain_2() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A3,
best_chain_containing_block: Some(A3),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A1),
expected_finality_target_result: Some(A1),
target_block: a3,
best_chain_containing_block: Some(a3),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a1),
expected_finality_target_result: Some(a1),
}
}

Expand All @@ -627,11 +617,11 @@ fn chain_3() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A2,
best_chain_containing_block: Some(A3),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a2,
best_chain_containing_block: Some(a3),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand Down Expand Up @@ -680,11 +670,11 @@ fn chain_5() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A2,
best_chain_containing_block: Some(A2),
highest_approved_ancestor_block: Some(A2),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a2,
best_chain_containing_block: Some(a2),
highest_approved_ancestor_block: Some(a2),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand Down Expand Up @@ -725,43 +715,36 @@ fn chain_6() -> CaseVars {
}
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_0() {
run_specialized_test_w_harness(chain_0);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_1() {
run_specialized_test_w_harness(chain_1);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_2() {
run_specialized_test_w_harness(chain_2);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_3() {
run_specialized_test_w_harness(chain_3);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_4_target_hash_value_not_contained() {
run_specialized_test_w_harness(chain_4);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_5_best_is_target_hash() {
run_specialized_test_w_harness(chain_5);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_6_approval_lag() {
run_specialized_test_w_harness(chain_6);
Expand Down
4 changes: 2 additions & 2 deletions node/test/polkadot-simnet/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ where
use sc_cli::{CliConfiguration, SubstrateCli};
use structopt::StructOpt;

let mut tokio_runtime = build_runtime()?;
let tokio_runtime = build_runtime()?;
let task_executor = task_executor(tokio_runtime.handle().clone());
// parse cli args
let cmd = <polkadot_cli::Cli as StructOpt>::from_args();
Expand Down Expand Up @@ -391,7 +391,7 @@ mod tests {

#[test]
fn test_runner() {
let mut runtime = build_runtime().unwrap();
let runtime = build_runtime().unwrap();
let task_executor = task_executor(runtime.handle().clone());
let (rpc, task_manager, client, pool, command_sink, backend) =
client_parts::<PolkadotChainInfo>(ConfigOrChainSpec::ChainSpec(
Expand Down
4 changes: 2 additions & 2 deletions node/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ substrate-test-client = { git = "https://github.com/paritytech/substrate", branc

[dev-dependencies]
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
serde_json = "1.0.61"
serde_json = "1.0.66"
substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "1.10", features = ["macros"] }
2 changes: 1 addition & 1 deletion parachain/test-parachains/adder/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }

tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "1.10", features = ["macros"] }
2 changes: 1 addition & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate",
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
trie-db = "0.22.3"
serde_json = "1.0.61"
serde_json = "1.0.66"
libsecp256k1 = "0.6.0"

[features]
Expand Down
3 changes: 2 additions & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ mod tests {
}

parameter_types! {
pub const MinVestedTransfer: u64 = 0;
pub const MinVestedTransfer: u64 = 1;
}

impl pallet_vesting::Config for Test {
Expand All @@ -782,6 +782,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
const MAX_VESTING_SCHEDULES: u32 = 28;
}

parameter_types! {
Expand Down
3 changes: 2 additions & 1 deletion runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ mod tests {
}

parameter_types! {
pub const MinVestedTransfer: u64 = 0;
pub const MinVestedTransfer: u64 = 1;
}

impl pallet_vesting::Config for Test {
Expand All @@ -548,6 +548,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
const MAX_VESTING_SCHEDULES: u32 = 28;
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ tiny-keccak = "2.0.2"
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
separator = "0.4.1"
serde_json = "1.0.61"
serde_json = "1.0.66"

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
3 changes: 2 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 9090,
spec_version: 9100,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down Expand Up @@ -951,6 +951,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

parameter_types! {
Expand Down
Loading

0 comments on commit 5a4ad8e

Please sign in to comment.