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:
  staking-miner: remove need of a file to pass the seed (#3680)
  Companion for 9619 (Private Events) (#3712)
  Fix Try-Runtime  (#3725)
  XCM v2: Scripting, Query responses, Exception handling and Error reporting (#3629)
  Bump async-trait from 0.1.50 to 0.1.51 (#3721)
  allow some overhead in MERKLE_NODE_MAX_SIZE (#3724)
  Bump itertools from 0.10.0 to 0.10.1 (#3719)
  Bump tokio from 1.10.0 to 1.10.1 (#3717)
  Bump trybuild from 1.0.43 to 1.0.45 (#3713)
  Don't err on deactivated leaf during valiation. (#3708)
  Bump libc from 0.2.99 to 0.2.100 (#3703)
  • Loading branch information
ordian committed Aug 27, 2021
2 parents 77574c8 + 948e0f1 commit 497cf40
Show file tree
Hide file tree
Showing 64 changed files with 3,309 additions and 1,194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ polkadot.*
!.rpm/*
.DS_Store
.cargo
.env
336 changes: 168 additions & 168 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,10 @@ pub fn run() -> Result<()> {
if chain_spec.is_kusama() {
return runner.async_run(|config| {
Ok((
cmd.run::<service::kusama_runtime::Block, service::KusamaExecutor>(config)
.map_err(Error::SubstrateCli),
cmd.run::<service::kusama_runtime::Block, service::KusamaExecutorDispatch>(
config,
)
.map_err(Error::SubstrateCli),
task_manager,
))
})
Expand All @@ -431,7 +433,7 @@ pub fn run() -> Result<()> {
if chain_spec.is_westend() {
return runner.async_run(|config| {
Ok((
cmd.run::<service::westend_runtime::Block, service::WestendExecutor>(
cmd.run::<service::westend_runtime::Block, service::WestendExecutorDispatch>(
config,
)
.map_err(Error::SubstrateCli),
Expand All @@ -442,8 +444,10 @@ pub fn run() -> Result<()> {
// else we assume it is polkadot.
runner.async_run(|config| {
Ok((
cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutor>(config)
.map_err(Error::SubstrateCli),
cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutorDispatch>(
config,
)
.map_err(Error::SubstrateCli),
task_manager,
))
})
Expand Down
22 changes: 15 additions & 7 deletions node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub enum Error {
#[error(transparent)]
ValidationFailed(#[from] ValidationFailed),
#[error(transparent)]
Mpsc(#[from] mpsc::SendError),
BackgroundValidationMpsc(#[from] mpsc::SendError),
#[error(transparent)]
UtilError(#[from] util::Error),
}
Expand Down Expand Up @@ -444,7 +444,7 @@ async fn validate_and_make_available(
tx_command
.send(ValidatedCandidateCommand::AttestNoPoV(candidate.hash()))
.await
.map_err(Error::Mpsc)?;
.map_err(Error::BackgroundValidationMpsc)?;
return Ok(())
},
Err(err) => return Err(err),
Expand Down Expand Up @@ -650,11 +650,19 @@ impl CandidateBackingJob {
// spawn background task.
let bg = async move {
if let Err(e) = validate_and_make_available(params).await {
tracing::error!(
target: LOG_TARGET,
"Failed to validate and make available: {:?}",
e
);
if let Error::BackgroundValidationMpsc(error) = e {
tracing::debug!(
target: LOG_TARGET,
?error,
"Mpsc background validation mpsc died during validation- leaf no longer active?"
);
} else {
tracing::error!(
target: LOG_TARGET,
"Failed to validate and make available: {:?}",
e
);
}
}
};
sender
Expand Down
2 changes: 1 addition & 1 deletion node/core/candidate-validation/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]
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = "0.3.15"
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 @@ -9,7 +9,7 @@ futures = "0.3.15"
futures-timer = "3.0.2"
tracing = "0.1.26"
thiserror = "1.0.26"
async-trait = "0.1.47"
async-trait = "0.1.51"
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-primitives = { path = "../../../primitives" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
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 @@ -15,7 +15,7 @@ async-process = "1.1.0"
assert_matches = "1.4.0"
futures = "0.3.15"
futures-timer = "3.0.2"
libc = "0.2.99"
libc = "0.2.100"
slotmap = "1.0"
tracing = "0.1.26"
pin-project = "1.0.8"
Expand Down
4 changes: 2 additions & 2 deletions node/malus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ parity-util-mem = { version = "0.10.0", default-features = false, features = ["j
color-eyre = { version = "0.5.11", default-features = false }
assert_matches = "1.5"
structopt = "0.3.21"
async-trait = "0.1.50"
async-trait = "0.1.51"
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
tracing = "0.1.26"
futures = "0.3.16"
tracing = "0.1.26"

[features]
disputes = ["polkadot-node-core-dispute-coordinator/disputes"]
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]
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = "0.3.15"
futures-timer = "3.0.2"

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 @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = "0.3.15"
tracing = "0.1.26"
polkadot-primitives = { path = "../../../primitives" }
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 @@ -25,7 +25,7 @@ rand = "0.8.3"
lru = "0.6.6"

[dev-dependencies]
async-trait = "0.1.42"
async-trait = "0.1.51"
polkadot-subsystem-testhelpers = { package = "polkadot-node-subsystem-test-helpers", path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
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 @@ -6,7 +6,7 @@ edition = "2018"
description = "Primitives types for the Node-side"

[dependencies]
async-trait = "0.1.42"
async-trait = "0.1.51"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" }
Expand Down
2 changes: 1 addition & 1 deletion node/overseer/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]
async-trait = "0.1.42"
async-trait = "0.1.51"
client = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = "0.3.15"
Expand Down
2 changes: 1 addition & 1 deletion node/overseer/all-subsystems-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ proc-macro2 = "1.0.24"
assert_matches = "1.5.0"

[dev-dependencies]
trybuild = "1.0.42"
trybuild = "1.0.45"
2 changes: 1 addition & 1 deletion node/overseer/overseer-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ futures-timer = "3.0.2"
pin-project = "1.0"

[dev-dependencies]
trybuild = "1.0.41"
trybuild = "1.0.45"
6 changes: 4 additions & 2 deletions node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ pub use disputes::{
SignedDisputeStatement, UncheckedDisputeMessage, ValidDisputeVote,
};

// For a 16-ary Merkle Prefix Trie, we can expect at most 16 32-byte hashes per node.
const MERKLE_NODE_MAX_SIZE: usize = 512;
// For a 16-ary Merkle Prefix Trie, we can expect at most 16 32-byte hashes per node
// plus some overhead:
// header 1 + bitmap 2 + max partial_key 8 + children 16 * (32 + len 1) + value 32 + value len 1
const MERKLE_NODE_MAX_SIZE: usize = 512 + 100;
// 16-ary Merkle Prefix Trie for 32-bit ValidatorIndex has depth at most 8.
const MERKLE_PROOF_MAX_DEPTH: usize = 8;

Expand Down
2 changes: 1 addition & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ serde = { version = "1.0.123", features = ["derive"] }
thiserror = "1.0.26"
kvdb = "0.10.0"
kvdb-rocksdb = { version = "0.14.0", optional = true }
async-trait = "0.1.42"
async-trait = "0.1.51"

# Polkadot
polkadot-node-core-parachains-inherent = { path = "../core/parachains-inherent" }
Expand Down
2 changes: 1 addition & 1 deletion node/subsystem-test-helpers/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]
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = "0.3.15"
futures-timer = "3.0.2"
tracing = "0.1.26"
Expand Down
4 changes: 2 additions & 2 deletions node/subsystem-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Subsystem traits and message definitions"

[dependencies]
async-std = "1.8.0"
async-trait = "0.1.42"
async-trait = "0.1.51"
derive_more = "0.99.11"
futures = "0.3.12"
futures-timer = "3.0.2"
Expand All @@ -32,6 +32,6 @@ log = "0.4.13"

[dev-dependencies]
assert_matches = "1.4.0"
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = { version = "0.3.12", features = ["thread-pool"] }
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
4 changes: 2 additions & 2 deletions node/subsystem-util/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]
async-trait = "0.1.42"
async-trait = "0.1.51"
futures = "0.3.15"
futures-timer = "3.0.2"
itertools = "0.10"
Expand Down Expand Up @@ -36,7 +36,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate

[dev-dependencies]
assert_matches = "1.4.0"
async-trait = "0.1.42"
async-trait = "0.1.51"
env_logger = "0.9.0"
futures = { version = "0.3.15", features = ["thread-pool"] }
log = "0.4.13"
Expand Down
6 changes: 3 additions & 3 deletions node/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl PolkadotTestNode {
function: impl Into<polkadot_test_runtime::Call>,
caller: Sr25519Keyring,
) -> Result<RpcTransactionOutput, RpcTransactionError> {
let extrinsic = construct_extrinsic(&*self.client, function, caller);
let extrinsic = construct_extrinsic(&*self.client, function, caller, 0);

self.rpc_handlers.send_transaction(extrinsic.into()).await
}
Expand Down Expand Up @@ -332,12 +332,12 @@ pub fn construct_extrinsic(
client: &Client,
function: impl Into<polkadot_test_runtime::Call>,
caller: Sr25519Keyring,
nonce: u32,
) -> UncheckedExtrinsic {
let function = function.into();
let current_block_hash = client.info().best_hash;
let current_block = client.info().best_number.saturated_into();
let genesis_block = client.hash(0).unwrap().unwrap();
let nonce = 0;
let period =
BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
let tip = 0;
Expand Down Expand Up @@ -384,5 +384,5 @@ pub fn construct_transfer_extrinsic(
value,
));

construct_extrinsic(client, function, origin)
construct_extrinsic(client, function, origin, 0)
}
12 changes: 6 additions & 6 deletions runtime/common/src/xcm_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@
use parity_scale_codec::Encode;
use runtime_parachains::{configuration, dmp};
use sp_std::marker::PhantomData;
use xcm::opaque::latest::*;
use xcm::latest::prelude::*;

/// XCM sender for relay chain. It only sends downward message.
pub struct ChildParachainRouter<T, W>(PhantomData<(T, W)>);

impl<T: configuration::Config + dmp::Config, W: xcm::WrapVersion> SendXcm
for ChildParachainRouter<T, W>
{
fn send_xcm(dest: MultiLocation, msg: Xcm) -> Result {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> SendResult {
match dest {
MultiLocation { parents: 0, interior: Junctions::X1(Junction::Parachain(id)) } => {
MultiLocation { parents: 0, interior: X1(Parachain(id)) } => {
// Downward message passing.
let versioned_xcm =
W::wrap_version(&dest, msg).map_err(|()| Error::DestinationUnsupported)?;
W::wrap_version(&dest, msg).map_err(|()| SendError::DestinationUnsupported)?;
let config = <configuration::Pallet<T>>::config();
<dmp::Pallet<T>>::queue_downward_message(
&config,
id.into(),
versioned_xcm.encode(),
)
.map_err(Into::<Error>::into)?;
.map_err(Into::<SendError>::into)?;
Ok(())
},
dest => Err(Error::CannotReachDestination(dest, msg)),
dest => Err(SendError::CannotReachDestination(dest, msg)),
}
}
}
9 changes: 7 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,9 @@ type LocalOriginConverter = (
parameter_types! {
/// The amount of weight an XCM operation takes. This is a safe overestimate.
pub const BaseXcmWeight: Weight = 1_000_000_000;
/// Maximum number of instructions in a single XCM fragment. A sanity check against weight
/// calculations getting too crazy.
pub const MaxInstructions: u32 = 100;
}

/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
Expand Down Expand Up @@ -1290,7 +1293,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
// The weight trader piggybacks on the existing transaction-fee conversion logic.
type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = ();
Expand Down Expand Up @@ -1325,8 +1328,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
}

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions runtime/parachains/src/dmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use frame_support::pallet_prelude::*;
use primitives::v1::{DownwardMessage, Hash, Id as ParaId, InboundDownwardMessage};
use sp_runtime::traits::{BlakeTwo256, Hash as HashT, SaturatedConversion};
use sp_std::{fmt, prelude::*};
use xcm::latest::Error as XcmError;
use xcm::latest::SendError;

pub use pallet::*;

Expand All @@ -33,10 +33,10 @@ pub enum QueueDownwardMessageError {
ExceedsMaxMessageSize,
}

impl From<QueueDownwardMessageError> for XcmError {
impl From<QueueDownwardMessageError> for SendError {
fn from(err: QueueDownwardMessageError) -> Self {
match err {
QueueDownwardMessageError::ExceedsMaxMessageSize => XcmError::ExceedsMaxMessageSize,
QueueDownwardMessageError::ExceedsMaxMessageSize => SendError::ExceedsMaxMessageSize,
}
}
}
Expand Down
Loading

0 comments on commit 497cf40

Please sign in to comment.