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

Commit 4093836

Browse files
committed
Merge branch 'master' into ao-subsystem-do-not-use-ourviewchange
* master: Companion PR for warp sync support. (#3382) Companion for #9373 (Refactor Benchmarks for Wasm Memory) (#3549) XCM simulator (#3538) Parachains scheduler.rs to FrameV2 (#3529) Parachains session_info.rs to FrameV2 (#3521) Companion for substrate #9319 (#3456)
2 parents 05b6ea7 + 4debdcd commit 4093836

File tree

30 files changed

+2251
-876
lines changed

30 files changed

+2251
-876
lines changed

Cargo.lock

+225-187
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ members = [
3939
"xcm",
4040
"xcm/xcm-builder",
4141
"xcm/xcm-executor",
42+
"xcm/xcm-simulator",
43+
"xcm/xcm-simulator/example",
4244
"xcm/pallet-xcm",
4345
"node/client",
4446
"node/collation-generation",

bridges/bin/millau/node/src/service.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn new_partial(
6161
FullClient,
6262
FullBackend,
6363
FullSelectChain,
64-
sp_consensus::DefaultImportQueue<Block, FullClient>,
64+
sc_consensus::DefaultImportQueue<Block, FullClient>,
6565
sc_transaction_pool::FullPool<Block, FullClient>,
6666
(
6767
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,

bridges/bin/rialto/node/src/service.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn new_partial(
6363
FullClient,
6464
FullBackend,
6565
FullSelectChain,
66-
sp_consensus::DefaultImportQueue<Block, FullClient>,
66+
sc_consensus::DefaultImportQueue<Block, FullClient>,
6767
sc_transaction_pool::FullPool<Block, FullClient>,
6868
(
6969
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,

bridges/bin/rialto/runtime/src/lib.rs

+91-38
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@ pub mod rialto_poa;
4040

4141
use crate::millau_messages::{ToMillauMessagePayload, WithMillauMessageBridge};
4242

43-
use bridge_runtime_common::messages::{source::estimate_message_dispatch_and_delivery_fee, MessageBridge};
43+
use bridge_runtime_common::messages::{
44+
source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
45+
};
4446
use codec::Decode;
45-
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
47+
use pallet_grandpa::{
48+
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
49+
};
4650
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
4751
use sp_api::impl_runtime_apis;
4852
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
4953
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
50-
use sp_runtime::traits::{Block as BlockT, IdentityLookup, NumberFor, OpaqueKeys};
5154
use sp_runtime::{
5255
create_runtime_str, generic, impl_opaque_keys,
56+
traits::{Block as BlockT, IdentityLookup, NumberFor, OpaqueKeys},
5357
transaction_validity::{TransactionSource, TransactionValidity},
5458
ApplyExtrinsicResult, MultiSignature, MultiSigner,
5559
};
@@ -146,10 +150,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
146150
/// The version information used to identify this runtime when compiled natively.
147151
#[cfg(feature = "std")]
148152
pub fn native_version() -> NativeVersion {
149-
NativeVersion {
150-
runtime_version: VERSION,
151-
can_author_with: Default::default(),
152-
}
153+
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
153154
}
154155

155156
parameter_types! {
@@ -278,10 +279,15 @@ impl bp_currency_exchange::DepositInto for DepositInto {
278279
type Recipient = AccountId;
279280
type Amount = Balance;
280281

281-
fn deposit_into(recipient: Self::Recipient, amount: Self::Amount) -> bp_currency_exchange::Result<()> {
282+
fn deposit_into(
283+
recipient: Self::Recipient,
284+
amount: Self::Amount,
285+
) -> bp_currency_exchange::Result<()> {
282286
// let balances module make all checks for us (it won't allow depositing lower than existential
283287
// deposit, balance overflow, ...)
284-
let deposited = <pallet_balances::Pallet<Runtime> as Currency<AccountId>>::deposit_creating(&recipient, amount);
288+
let deposited = <pallet_balances::Pallet<Runtime> as Currency<AccountId>>::deposit_creating(
289+
&recipient, amount,
290+
);
285291

286292
// I'm dropping deposited here explicitly to illustrate the fact that it'll update `TotalIssuance`
287293
// on drop
@@ -302,7 +308,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
302308
);
303309

304310
Ok(())
305-
}
311+
},
306312
_ if deposited_amount == 0 => {
307313
log::error!(
308314
target: "runtime",
@@ -312,7 +318,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
312318
);
313319

314320
Err(bp_currency_exchange::Error::DepositFailed)
315-
}
321+
},
316322
_ => {
317323
log::error!(
318324
target: "runtime",
@@ -324,7 +330,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
324330

325331
// we can't return DepositFailed error here, because storage changes were made
326332
Err(bp_currency_exchange::Error::DepositPartiallyFailed)
327-
}
333+
},
328334
}
329335
}
330336
}
@@ -333,9 +339,12 @@ impl pallet_grandpa::Config for Runtime {
333339
type Event = Event;
334340
type Call = Call;
335341
type KeyOwnerProofSystem = ();
336-
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
337-
type KeyOwnerIdentification =
338-
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::IdentificationTuple;
342+
type KeyOwnerProof =
343+
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
344+
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
345+
KeyTypeId,
346+
GrandpaId,
347+
)>>::IdentificationTuple;
339348
type HandleEquivocation = ();
340349
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
341350
type WeightInfo = ();
@@ -485,12 +494,13 @@ impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
485494

486495
type TargetHeaderChain = crate::millau_messages::Millau;
487496
type LaneMessageVerifier = crate::millau_messages::ToMillauMessageVerifier;
488-
type MessageDeliveryAndDispatchPayment = pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
489-
Runtime,
490-
pallet_balances::Pallet<Runtime>,
491-
GetDeliveryConfirmationTransactionFee,
492-
RootAccountForPayments,
493-
>;
497+
type MessageDeliveryAndDispatchPayment =
498+
pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
499+
Runtime,
500+
pallet_balances::Pallet<Runtime>,
501+
GetDeliveryConfirmationTransactionFee,
502+
RootAccountForPayments,
503+
>;
494504
type OnDeliveryConfirmed = ();
495505

496506
type SourceHeaderChain = crate::millau_messages::Millau;
@@ -550,8 +560,13 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
550560
/// Extrinsic type that has already been checked.
551561
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
552562
/// Executive: handles dispatch to the various modules.
553-
pub type Executive =
554-
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPallets>;
563+
pub type Executive = frame_executive::Executive<
564+
Runtime,
565+
Block,
566+
frame_system::ChainContext<Runtime>,
567+
Runtime,
568+
AllPallets,
569+
>;
555570

556571
impl_runtime_apis! {
557572
impl sp_api::Core<Block> for Runtime {
@@ -802,10 +817,36 @@ impl_runtime_apis! {
802817

803818
#[cfg(feature = "runtime-benchmarks")]
804819
impl frame_benchmarking::Benchmark<Block> for Runtime {
820+
fn benchmark_metadata(extra: bool) -> (
821+
Vec<frame_benchmarking::BenchmarkList>,
822+
Vec<frame_support::traits::StorageInfo>,
823+
) {
824+
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
825+
use frame_support::traits::StorageInfoTrait;
826+
827+
list_benchmark!(
828+
list,
829+
extra,
830+
pallet_bridge_currency_exchange,
831+
BridgeCurrencyExchangeBench::<Runtime, KovanCurrencyExchange>
832+
);
833+
list_benchmark!(
834+
list,
835+
extra,
836+
pallet_bridge_messages,
837+
MessagesBench::<Runtime, WithMillauMessagesInstance>
838+
);
839+
list_benchmark!(list, extra, pallet_bridge_grandpa, BridgeMillauGrandpa);
840+
841+
let storage_info = AllPalletsWithSystem::storage_info();
842+
843+
return (list, storage_info)
844+
}
845+
805846
fn dispatch_benchmark(
806847
config: frame_benchmarking::BenchmarkConfig,
807848
) -> Result<
808-
(Vec<frame_benchmarking::BenchmarkBatch>, Vec<frame_support::traits::StorageInfo>),
849+
Vec<frame_benchmarking::BenchmarkBatch>,
809850
sp_runtime::RuntimeString,
810851
> {
811852
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
@@ -1051,8 +1092,7 @@ impl_runtime_apis! {
10511092
add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeMillauGrandpa);
10521093

10531094
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
1054-
let storage_info = AllPalletsWithSystem::storage_info();
1055-
Ok((batches, storage_info))
1095+
Ok(batches)
10561096
}
10571097
}
10581098
}
@@ -1088,7 +1128,8 @@ mod tests {
10881128
use bridge_runtime_common::messages;
10891129

10901130
fn run_deposit_into_test(test: impl Fn(AccountId) -> Balance) {
1091-
let mut ext: sp_io::TestExternalities = SystemConfig::default().build_storage::<Runtime>().unwrap().into();
1131+
let mut ext: sp_io::TestExternalities =
1132+
SystemConfig::default().build_storage::<Runtime>().unwrap().into();
10921133
ext.execute_with(|| {
10931134
// initially issuance is zero
10941135
assert_eq!(
@@ -1100,7 +1141,10 @@ mod tests {
11001141
let account: AccountId = [1u8; 32].into();
11011142
let initial_amount = ExistentialDeposit::get();
11021143
let deposited =
1103-
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::deposit_creating(&account, initial_amount);
1144+
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::deposit_creating(
1145+
&account,
1146+
initial_amount,
1147+
);
11041148
drop(deposited);
11051149
assert_eq!(
11061150
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::total_issuance(),
@@ -1140,15 +1184,18 @@ mod tests {
11401184
bp_rialto::max_extrinsic_size(),
11411185
bp_rialto::max_extrinsic_weight(),
11421186
max_incoming_message_proof_size,
1143-
messages::target::maximal_incoming_message_dispatch_weight(bp_rialto::max_extrinsic_weight()),
1187+
messages::target::maximal_incoming_message_dispatch_weight(
1188+
bp_rialto::max_extrinsic_weight(),
1189+
),
11441190
);
11451191

1146-
let max_incoming_inbound_lane_data_proof_size = bp_messages::InboundLaneData::<()>::encoded_size_hint(
1147-
bp_rialto::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
1148-
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE as _,
1149-
bp_millau::MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE as _,
1150-
)
1151-
.unwrap_or(u32::MAX);
1192+
let max_incoming_inbound_lane_data_proof_size =
1193+
bp_messages::InboundLaneData::<()>::encoded_size_hint(
1194+
bp_rialto::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
1195+
bp_millau::MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE as _,
1196+
bp_millau::MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE as _,
1197+
)
1198+
.unwrap_or(u32::MAX);
11521199
pallet_bridge_messages::ensure_able_to_receive_confirmation::<Weights>(
11531200
bp_rialto::max_extrinsic_size(),
11541201
bp_rialto::max_extrinsic_weight(),
@@ -1162,15 +1209,19 @@ mod tests {
11621209
fn deposit_into_existing_account_works() {
11631210
run_deposit_into_test(|existing_account| {
11641211
let initial_amount =
1165-
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(&existing_account);
1212+
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(
1213+
&existing_account,
1214+
);
11661215
let additional_amount = 10_000;
11671216
<Runtime as pallet_bridge_currency_exchange::Config<KovanCurrencyExchange>>::DepositInto::deposit_into(
11681217
existing_account.clone(),
11691218
additional_amount,
11701219
)
11711220
.unwrap();
11721221
assert_eq!(
1173-
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(&existing_account),
1222+
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(
1223+
&existing_account
1224+
),
11741225
initial_amount + additional_amount,
11751226
);
11761227
additional_amount
@@ -1189,7 +1240,9 @@ mod tests {
11891240
)
11901241
.unwrap();
11911242
assert_eq!(
1192-
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(&new_account),
1243+
<pallet_balances::Pallet<Runtime> as Currency<AccountId>>::free_balance(
1244+
&new_account
1245+
),
11931246
initial_amount + additional_amount,
11941247
);
11951248
additional_amount

erasure-coding/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub enum Error {
5656
#[error("Too many chunks present")]
5757
TooManyChunks,
5858
/// Chunks not of uniform length or the chunks are empty.
59-
#[error("Chunks are not unform, mismatch in length or are zero sized")]
59+
#[error("Chunks are not uniform, mismatch in length or are zero sized")]
6060
NonUniformChunks,
6161
/// An uneven byte-length of a shard is not valid for `GF(2^16)` encoding.
6262
#[error("Uneven length is not valid for field GF(2^16)")]

node/client/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch
2222
sp-offchain = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master" }
2323
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
2424

25+
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
2526
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
2627
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
2728
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

node/service/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ sc-consensus-uncles = { git = "https://github.com/paritytech/substrate", branch
1919
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
2020
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" }
2121
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
22-
sc-finality-grandpa-warp-sync = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
2322
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
2423
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
2524
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -146,7 +145,6 @@ full-node = [
146145
"polkadot-node-core-runtime-api",
147146
"polkadot-statement-distribution",
148147
"polkadot-approval-distribution",
149-
"sc-finality-grandpa-warp-sync",
150148
"kvdb-rocksdb"
151149
]
152150

0 commit comments

Comments
 (0)