mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Fix Clippy (#2522)
* Import Clippy config from Polkadot Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Auto clippy fix Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * No tabs in comments Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Prefer matches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Dont drop references Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Trivial Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Refactor Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * add clippy to ci * Clippy reborrow Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Partially revert 'Prefer matches' Using matches! instead of match does give less compiler checks as per review from @chevdor. Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update .cargo/config.toml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Revert revert 💩 Should be fine to use matches! macro since it is an explicit whitelist, not wildcard matching. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: alvicsam <alvicsam@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Chevdor <chevdor@users.noreply.github.com> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
b72ae577a0
commit
299d25ba4b
@@ -0,0 +1,32 @@
|
|||||||
|
#
|
||||||
|
# An auto defined `clippy` feature was introduced,
|
||||||
|
# but it was found to clash with user defined features,
|
||||||
|
# so was renamed to `cargo-clippy`.
|
||||||
|
#
|
||||||
|
# If you want standard clippy run:
|
||||||
|
# RUSTFLAGS= cargo clippy
|
||||||
|
[target.'cfg(feature = "cargo-clippy")']
|
||||||
|
rustflags = [
|
||||||
|
"-Aclippy::all",
|
||||||
|
"-Dclippy::correctness",
|
||||||
|
"-Aclippy::if-same-then-else",
|
||||||
|
"-Aclippy::clone-double-ref",
|
||||||
|
"-Dclippy::complexity",
|
||||||
|
"-Aclippy::zero-prefixed-literal", # 00_1000_000
|
||||||
|
"-Aclippy::type_complexity", # raison d'etre
|
||||||
|
"-Aclippy::nonminimal-bool", # maybe
|
||||||
|
"-Aclippy::borrowed-box", # Reasonable to fix this one
|
||||||
|
"-Aclippy::too-many-arguments", # (Turning this on would lead to)
|
||||||
|
"-Aclippy::unnecessary_cast", # Types may change
|
||||||
|
"-Aclippy::identity-op", # One case where we do 0 +
|
||||||
|
"-Aclippy::useless_conversion", # Types may change
|
||||||
|
"-Aclippy::unit_arg", # styalistic.
|
||||||
|
"-Aclippy::option-map-unit-fn", # styalistic
|
||||||
|
"-Aclippy::bind_instead_of_map", # styalistic
|
||||||
|
"-Aclippy::erasing_op", # E.g. 0 * DOLLARS
|
||||||
|
"-Aclippy::eq_op", # In tests we test equality.
|
||||||
|
"-Aclippy::while_immutable_condition", # false positives
|
||||||
|
"-Aclippy::needless_option_as_deref", # false positives
|
||||||
|
"-Aclippy::derivable_impls", # false positives
|
||||||
|
"-Aclippy::stable_sort_primitive", # prefer stable sort
|
||||||
|
]
|
||||||
@@ -182,11 +182,7 @@ where
|
|||||||
// update runtime storage
|
// update runtime storage
|
||||||
let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::<R, FI>(state_root);
|
let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::<R, FI>(state_root);
|
||||||
|
|
||||||
FromBridgedChainMessagesDeliveryProof {
|
FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane }
|
||||||
bridged_header_hash: bridged_header_hash.into(),
|
|
||||||
storage_proof,
|
|
||||||
lane,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call.
|
/// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call.
|
||||||
@@ -211,11 +207,7 @@ where
|
|||||||
let (_, bridged_header_hash) =
|
let (_, bridged_header_hash) =
|
||||||
insert_header_to_parachains_pallet::<R, PI, UnderlyingChainOf<BridgedChain<B>>>(state_root);
|
insert_header_to_parachains_pallet::<R, PI, UnderlyingChainOf<BridgedChain<B>>>(state_root);
|
||||||
|
|
||||||
FromBridgedChainMessagesDeliveryProof {
|
FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane }
|
||||||
bridged_header_hash: bridged_header_hash.into(),
|
|
||||||
storage_proof,
|
|
||||||
lane,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prepare in-memory message delivery proof, without inserting anything to the runtime storage.
|
/// Prepare in-memory message delivery proof, without inserting anything to the runtime storage.
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ where
|
|||||||
TrieDBMutBuilderV1::<RelayBlockHasher>::new(&mut mdb, &mut state_root).build();
|
TrieDBMutBuilderV1::<RelayBlockHasher>::new(&mut mdb, &mut state_root).build();
|
||||||
|
|
||||||
// insert parachain heads
|
// insert parachain heads
|
||||||
for (i, parachain) in parachains.into_iter().enumerate() {
|
for (i, parachain) in parachains.iter().enumerate() {
|
||||||
let storage_key =
|
let storage_key =
|
||||||
parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain);
|
parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain);
|
||||||
let leaf_data = if i == 0 {
|
let leaf_data = if i == 0 {
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ benchmarks_instance_pallet! {
|
|||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
|
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
|
||||||
21,
|
21,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ benchmarks_instance_pallet! {
|
|||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
|
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
|
||||||
22,
|
22,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ benchmarks_instance_pallet! {
|
|||||||
});
|
});
|
||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
let lane_state = crate::InboundLanes::<T, I>::get(&T::bench_lane_id());
|
let lane_state = crate::InboundLanes::<T, I>::get(T::bench_lane_id());
|
||||||
assert_eq!(lane_state.last_delivered_nonce(), 21);
|
assert_eq!(lane_state.last_delivered_nonce(), 21);
|
||||||
assert_eq!(lane_state.last_confirmed_nonce, 20);
|
assert_eq!(lane_state.last_confirmed_nonce, 20);
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ benchmarks_instance_pallet! {
|
|||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
|
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
|
||||||
21,
|
21,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ benchmarks_instance_pallet! {
|
|||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
|
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
|
||||||
21,
|
21,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -432,7 +432,7 @@ benchmarks_instance_pallet! {
|
|||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
|
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
|
||||||
21,
|
21,
|
||||||
);
|
);
|
||||||
assert!(T::is_message_successfully_dispatched(21));
|
assert!(T::is_message_successfully_dispatched(21));
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ impl crate::benchmarking::Config<()> for TestRuntime {
|
|||||||
// in mock run we only care about benchmarks correctness, not the benchmark results
|
// in mock run we only care about benchmarks correctness, not the benchmark results
|
||||||
// => ignore size related arguments
|
// => ignore size related arguments
|
||||||
let (messages, total_dispatch_weight) =
|
let (messages, total_dispatch_weight) =
|
||||||
params.message_nonces.into_iter().map(|n| message(n, REGULAR_PAYLOAD)).fold(
|
params.message_nonces.map(|n| message(n, REGULAR_PAYLOAD)).fold(
|
||||||
(Vec::new(), Weight::zero()),
|
(Vec::new(), Weight::zero()),
|
||||||
|(mut messages, total_dispatch_weight), message| {
|
|(mut messages, total_dispatch_weight), message| {
|
||||||
let weight = REGULAR_PAYLOAD.declared_weight;
|
let weight = REGULAR_PAYLOAD.declared_weight;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ benchmarks! {
|
|||||||
// create slash destination account
|
// create slash destination account
|
||||||
let lane = LaneId([0, 0, 0, 0]);
|
let lane = LaneId([0, 0, 0, 0]);
|
||||||
let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
|
let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
|
||||||
T::prepare_rewards_account(slash_destination.clone(), Zero::zero());
|
T::prepare_rewards_account(slash_destination, Zero::zero());
|
||||||
}: {
|
}: {
|
||||||
crate::Pallet::<T>::slash_and_deregister(&relayer, slash_destination)
|
crate::Pallet::<T>::slash_and_deregister(&relayer, slash_destination)
|
||||||
}
|
}
|
||||||
@@ -121,10 +121,10 @@ benchmarks! {
|
|||||||
let account_params =
|
let account_params =
|
||||||
RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
|
RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
|
||||||
}: {
|
}: {
|
||||||
crate::Pallet::<T>::register_relayer_reward(account_params.clone(), &relayer, One::one());
|
crate::Pallet::<T>::register_relayer_reward(account_params, &relayer, One::one());
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(RelayerRewards::<T>::get(relayer, &account_params), Some(One::one()));
|
assert_eq!(RelayerRewards::<T>::get(relayer, account_params), Some(One::one()));
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime)
|
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ impl PurgeChainCmd {
|
|||||||
io::stdin().read_line(&mut input)?;
|
io::stdin().read_line(&mut input)?;
|
||||||
let input = input.trim();
|
let input = input.trim();
|
||||||
|
|
||||||
match input.chars().nth(0) {
|
match input.chars().next() {
|
||||||
Some('y') | Some('Y') => {},
|
Some('y') | Some('Y') => {},
|
||||||
_ => {
|
_ => {
|
||||||
println!("Aborted");
|
println!("Aborted");
|
||||||
@@ -103,7 +103,7 @@ impl PurgeChainCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for db_path in &db_paths {
|
for db_path in &db_paths {
|
||||||
match fs::remove_dir_all(&db_path) {
|
match fs::remove_dir_all(db_path) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("{:?} removed.", &db_path);
|
println!("{:?} removed.", &db_path);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -270,16 +270,14 @@ where
|
|||||||
|
|
||||||
let (header, extrinsics) = candidate.block.deconstruct();
|
let (header, extrinsics) = candidate.block.deconstruct();
|
||||||
|
|
||||||
let compact_proof = match candidate
|
let compact_proof =
|
||||||
.proof
|
match candidate.proof.into_compact_proof::<HashFor<Block>>(*last_head.state_root()) {
|
||||||
.into_compact_proof::<HashFor<Block>>(last_head.state_root().clone())
|
Ok(proof) => proof,
|
||||||
{
|
Err(e) => {
|
||||||
Ok(proof) => proof,
|
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
|
||||||
Err(e) => {
|
return None
|
||||||
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
|
},
|
||||||
return None
|
};
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the parachain block data for the validators.
|
// Create the parachain block data for the validators.
|
||||||
let b = ParachainBlockData::<Block>::new(header, extrinsics, compact_proof);
|
let b = ParachainBlockData::<Block>::new(header, extrinsics, compact_proof);
|
||||||
@@ -451,7 +449,7 @@ mod tests {
|
|||||||
.build()
|
.build()
|
||||||
.expect("Builds overseer");
|
.expect("Builds overseer");
|
||||||
|
|
||||||
spawner.spawn("overseer", None, overseer.run().then(|_| async { () }).boxed());
|
spawner.spawn("overseer", None, overseer.run().then(|_| async {}).boxed());
|
||||||
|
|
||||||
let collator_start = start_collator(StartCollatorParams {
|
let collator_start = start_collator(StartCollatorParams {
|
||||||
runtime_api: client.clone(),
|
runtime_api: client.clone(),
|
||||||
@@ -461,7 +459,7 @@ mod tests {
|
|||||||
spawner,
|
spawner,
|
||||||
para_id,
|
para_id,
|
||||||
key: CollatorPair::generate().0,
|
key: CollatorPair::generate().0,
|
||||||
parachain_consensus: Box::new(DummyParachainConsensus { client: client.clone() }),
|
parachain_consensus: Box::new(DummyParachainConsensus { client }),
|
||||||
});
|
});
|
||||||
block_on(collator_start);
|
block_on(collator_start);
|
||||||
|
|
||||||
@@ -469,12 +467,10 @@ mod tests {
|
|||||||
.0
|
.0
|
||||||
.expect("message should be send by `start_collator` above.");
|
.expect("message should be send by `start_collator` above.");
|
||||||
|
|
||||||
let config = match msg {
|
let CollationGenerationMessage::Initialize(config) = msg;
|
||||||
CollationGenerationMessage::Initialize(config) => config,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut validation_data = PersistedValidationData::default();
|
let validation_data =
|
||||||
validation_data.parent_head = header.encode().into();
|
PersistedValidationData { parent_head: header.encode().into(), ..Default::default() };
|
||||||
let relay_parent = Default::default();
|
let relay_parent = Default::default();
|
||||||
|
|
||||||
let collation = block_on((config.collator)(relay_parent, &validation_data))
|
let collation = block_on((config.collator)(relay_parent, &validation_data))
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Start an import queue for the Aura consensus algorithm.
|
/// Start an import queue for the Aura consensus algorithm.
|
||||||
pub fn import_queue<'a, P, Block, I, C, S, CIDP>(
|
pub fn import_queue<P, Block, I, C, S, CIDP>(
|
||||||
ImportQueueParams {
|
ImportQueueParams {
|
||||||
block_import,
|
block_import,
|
||||||
client,
|
client,
|
||||||
@@ -59,7 +59,7 @@ pub fn import_queue<'a, P, Block, I, C, S, CIDP>(
|
|||||||
spawner,
|
spawner,
|
||||||
registry,
|
registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
}: ImportQueueParams<'a, I, C, CIDP, S>,
|
}: ImportQueueParams<'_, I, C, CIDP, S>,
|
||||||
) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error>
|
) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error>
|
||||||
where
|
where
|
||||||
Block: BlockT,
|
Block: BlockT,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
const LOG_TARGET: &'static str = "level-monitor";
|
const LOG_TARGET: &str = "level-monitor";
|
||||||
|
|
||||||
/// Value good enough to be used with parachains using the current backend implementation
|
/// Value good enough to be used with parachains using the current backend implementation
|
||||||
/// that ships with Substrate. This value may change in the future.
|
/// that ships with Substrate. This value may change in the future.
|
||||||
|
|||||||
@@ -325,7 +325,6 @@ async fn handle_new_block_imported<Block, P>(
|
|||||||
|
|
||||||
match parachain.block_status(unset_hash) {
|
match parachain.block_status(unset_hash) {
|
||||||
Ok(BlockStatus::InChainWithState) => {
|
Ok(BlockStatus::InChainWithState) => {
|
||||||
drop(unset_best_header);
|
|
||||||
let unset_best_header = unset_best_header_opt
|
let unset_best_header = unset_best_header_opt
|
||||||
.take()
|
.take()
|
||||||
.expect("We checked above that the value is set; qed");
|
.expect("We checked above that the value is set; qed");
|
||||||
@@ -433,8 +432,11 @@ async fn handle_new_best_parachain_head<Block, P>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn import_block_as_new_best<Block, P>(hash: Block::Hash, header: Block::Header, parachain: &P)
|
async fn import_block_as_new_best<Block, P>(
|
||||||
where
|
hash: Block::Hash,
|
||||||
|
header: Block::Header,
|
||||||
|
mut parachain: &P,
|
||||||
|
) where
|
||||||
Block: BlockT,
|
Block: BlockT,
|
||||||
P: UsageProvider<Block> + Send + Sync + BlockBackend<Block>,
|
P: UsageProvider<Block> + Send + Sync + BlockBackend<Block>,
|
||||||
for<'a> &'a P: BlockImport<Block>,
|
for<'a> &'a P: BlockImport<Block>,
|
||||||
@@ -456,7 +458,7 @@ where
|
|||||||
block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true));
|
block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true));
|
||||||
block_import_params.import_existing = true;
|
block_import_params.import_existing = true;
|
||||||
|
|
||||||
if let Err(err) = (&*parachain).import_block(block_import_params).await {
|
if let Err(err) = parachain.import_block(block_import_params).await {
|
||||||
tracing::warn!(
|
tracing::warn!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
block_hash = ?hash,
|
block_hash = ?hash,
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ fn follow_new_best_with_dummy_recovery_works() {
|
|||||||
Some(recovery_chan_tx),
|
Some(recovery_chan_tx),
|
||||||
);
|
);
|
||||||
|
|
||||||
let block = build_block(&*client.clone(), None, None);
|
let block = build_block(&*client, None, None);
|
||||||
let block_clone = block.clone();
|
let block_clone = block.clone();
|
||||||
let client_clone = client.clone();
|
let client_clone = client.clone();
|
||||||
|
|
||||||
@@ -547,7 +547,6 @@ fn do_not_set_best_block_to_older_block() {
|
|||||||
let client = Arc::new(TestClientBuilder::with_backend(backend).build());
|
let client = Arc::new(TestClientBuilder::with_backend(backend).build());
|
||||||
|
|
||||||
let blocks = (0..NUM_BLOCKS)
|
let blocks = (0..NUM_BLOCKS)
|
||||||
.into_iter()
|
|
||||||
.map(|_| build_and_import_block(client.clone(), true))
|
.map(|_| build_and_import_block(client.clone(), true))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
@@ -559,7 +558,6 @@ fn do_not_set_best_block_to_older_block() {
|
|||||||
let consensus =
|
let consensus =
|
||||||
run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None);
|
run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None);
|
||||||
|
|
||||||
let client2 = client.clone();
|
|
||||||
let work = async move {
|
let work = async move {
|
||||||
new_best_heads_sender
|
new_best_heads_sender
|
||||||
.unbounded_send(blocks[NUM_BLOCKS - 2].header().clone())
|
.unbounded_send(blocks[NUM_BLOCKS - 2].header().clone())
|
||||||
@@ -579,7 +577,7 @@ fn do_not_set_best_block_to_older_block() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Build and import a new best block.
|
// Build and import a new best block.
|
||||||
build_and_import_block(client2.clone(), true);
|
build_and_import_block(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -607,7 +605,6 @@ fn prune_blocks_on_level_overflow() {
|
|||||||
let id0 = block0.header.hash();
|
let id0 = block0.header.hash();
|
||||||
|
|
||||||
let blocks1 = (0..LEVEL_LIMIT)
|
let blocks1 = (0..LEVEL_LIMIT)
|
||||||
.into_iter()
|
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
build_and_import_block_ext(
|
build_and_import_block_ext(
|
||||||
&*client,
|
&*client,
|
||||||
@@ -622,7 +619,6 @@ fn prune_blocks_on_level_overflow() {
|
|||||||
let id10 = blocks1[0].header.hash();
|
let id10 = blocks1[0].header.hash();
|
||||||
|
|
||||||
let blocks2 = (0..2)
|
let blocks2 = (0..2)
|
||||||
.into_iter()
|
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
build_and_import_block_ext(
|
build_and_import_block_ext(
|
||||||
&*client,
|
&*client,
|
||||||
@@ -720,7 +716,6 @@ fn restore_limit_monitor() {
|
|||||||
let id00 = block00.header.hash();
|
let id00 = block00.header.hash();
|
||||||
|
|
||||||
let blocks1 = (0..LEVEL_LIMIT + 1)
|
let blocks1 = (0..LEVEL_LIMIT + 1)
|
||||||
.into_iter()
|
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
build_and_import_block_ext(
|
build_and_import_block_ext(
|
||||||
&*client,
|
&*client,
|
||||||
@@ -735,7 +730,6 @@ fn restore_limit_monitor() {
|
|||||||
let id10 = blocks1[0].header.hash();
|
let id10 = blocks1[0].header.hash();
|
||||||
|
|
||||||
let _ = (0..LEVEL_LIMIT)
|
let _ = (0..LEVEL_LIMIT)
|
||||||
.into_iter()
|
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
build_and_import_block_ext(
|
build_and_import_block_ext(
|
||||||
&*client,
|
&*client,
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ where
|
|||||||
relay_parent: PHash,
|
relay_parent: PHash,
|
||||||
validation_data: &PersistedValidationData,
|
validation_data: &PersistedValidationData,
|
||||||
) -> Option<ParachainCandidate<B>> {
|
) -> Option<ParachainCandidate<B>> {
|
||||||
let proposer_future = self.proposer_factory.lock().init(&parent);
|
let proposer_future = self.proposer_factory.lock().init(parent);
|
||||||
|
|
||||||
let proposer = proposer_future
|
let proposer = proposer_future
|
||||||
.await
|
.await
|
||||||
@@ -171,7 +171,7 @@ where
|
|||||||
.ok()?;
|
.ok()?;
|
||||||
|
|
||||||
let inherent_data =
|
let inherent_data =
|
||||||
self.inherent_data(parent.hash(), &validation_data, relay_parent).await?;
|
self.inherent_data(parent.hash(), validation_data, relay_parent).await?;
|
||||||
|
|
||||||
let Proposal { block, storage_changes, proof } = proposer
|
let Proposal { block, storage_changes, proof } = proposer
|
||||||
.propose(
|
.propose(
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ impl RelayChainInterface for DummyRelayChainInterface {
|
|||||||
para_id: 0u32.into(),
|
para_id: 0u32.into(),
|
||||||
relay_parent: PHash::random(),
|
relay_parent: PHash::random(),
|
||||||
collator: CollatorPair::generate().0.public(),
|
collator: CollatorPair::generate().0.public(),
|
||||||
persisted_validation_data_hash: PHash::random().into(),
|
persisted_validation_data_hash: PHash::random(),
|
||||||
pov_hash: PHash::random(),
|
pov_hash: PHash::random(),
|
||||||
erasure_root: PHash::random(),
|
erasure_root: PHash::random(),
|
||||||
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
||||||
@@ -293,7 +293,7 @@ async fn make_gossip_message_and_header(
|
|||||||
para_id: 0u32.into(),
|
para_id: 0u32.into(),
|
||||||
relay_parent,
|
relay_parent,
|
||||||
collator: CollatorPair::generate().0.public(),
|
collator: CollatorPair::generate().0.public(),
|
||||||
persisted_validation_data_hash: PHash::random().into(),
|
persisted_validation_data_hash: PHash::random(),
|
||||||
pov_hash: PHash::random(),
|
pov_hash: PHash::random(),
|
||||||
erasure_root: PHash::random(),
|
erasure_root: PHash::random(),
|
||||||
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
||||||
@@ -484,7 +484,7 @@ async fn check_statement_seconded() {
|
|||||||
para_id: 0u32.into(),
|
para_id: 0u32.into(),
|
||||||
relay_parent: PHash::random(),
|
relay_parent: PHash::random(),
|
||||||
collator: CollatorPair::generate().0.public(),
|
collator: CollatorPair::generate().0.public(),
|
||||||
persisted_validation_data_hash: PHash::random().into(),
|
persisted_validation_data_hash: PHash::random(),
|
||||||
pov_hash: PHash::random(),
|
pov_hash: PHash::random(),
|
||||||
erasure_root: PHash::random(),
|
erasure_root: PHash::random(),
|
||||||
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
signature: sp_core::sr25519::Signature([0u8; 64]).into(),
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
//! 4a. After it is recovered, we restore the block and import it.
|
//! 4a. After it is recovered, we restore the block and import it.
|
||||||
//!
|
//!
|
||||||
//! 4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block
|
//! 4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block
|
||||||
//! PoV is not yet available, we retry.
|
//! PoV is not yet available, we retry.
|
||||||
//!
|
//!
|
||||||
//! If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we
|
//! If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we
|
||||||
//! make sure that the blocks are imported in the correct order.
|
//! make sure that the blocks are imported in the correct order.
|
||||||
@@ -190,7 +190,7 @@ impl<Block: BlockT> RecoveryQueue<Block> {
|
|||||||
/// Get the next hash for block recovery.
|
/// Get the next hash for block recovery.
|
||||||
pub async fn next_recovery(&mut self) -> Block::Hash {
|
pub async fn next_recovery(&mut self) -> Block::Hash {
|
||||||
loop {
|
loop {
|
||||||
if let Some(_) = self.signaling_queue.next().await {
|
if self.signaling_queue.next().await.is_some() {
|
||||||
if let Some(hash) = self.recovery_queue.pop_front() {
|
if let Some(hash) = self.recovery_queue.pop_front() {
|
||||||
return hash
|
return hash
|
||||||
} else {
|
} else {
|
||||||
@@ -309,10 +309,10 @@ where
|
|||||||
|
|
||||||
/// Block is no longer waiting for recovery
|
/// Block is no longer waiting for recovery
|
||||||
fn clear_waiting_recovery(&mut self, block_hash: &Block::Hash) {
|
fn clear_waiting_recovery(&mut self, block_hash: &Block::Hash) {
|
||||||
self.candidates.get_mut(block_hash).map(|candidate| {
|
if let Some(candidate) = self.candidates.get_mut(block_hash) {
|
||||||
// Prevents triggering an already enqueued recovery request
|
// Prevents triggering an already enqueued recovery request
|
||||||
candidate.waiting_recovery = false;
|
candidate.waiting_recovery = false;
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle a finalized block with the given `block_number`.
|
/// Handle a finalized block with the given `block_number`.
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ where
|
|||||||
self.full_client
|
self.full_client
|
||||||
.import_notification_stream()
|
.import_notification_stream()
|
||||||
.filter_map(|notification| async move {
|
.filter_map(|notification| async move {
|
||||||
notification.is_new_best.then(|| notification.header)
|
notification.is_new_best.then_some(notification.header)
|
||||||
});
|
});
|
||||||
Ok(Box::pin(notifications_stream))
|
Ok(Box::pin(notifications_stream))
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ mod tests {
|
|||||||
(
|
(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
block,
|
block,
|
||||||
RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, mock_handle),
|
RelayChainInProcessInterface::new(client, backend, dummy_network, mock_handle),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ mod tests {
|
|||||||
let hash = block.hash();
|
let hash = block.hash();
|
||||||
|
|
||||||
let ext = construct_transfer_extrinsic(
|
let ext = construct_transfer_extrinsic(
|
||||||
&*client,
|
&client,
|
||||||
sp_keyring::Sr25519Keyring::Alice,
|
sp_keyring::Sr25519Keyring::Alice,
|
||||||
sp_keyring::Sr25519Keyring::Bob,
|
sp_keyring::Sr25519Keyring::Bob,
|
||||||
1000,
|
1000,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ pub(crate) struct CollatorOverseerGenArgs<'a> {
|
|||||||
pub peer_set_protocol_names: PeerSetProtocolNames,
|
pub peer_set_protocol_names: PeerSetProtocolNames,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_overseer<'a>(
|
fn build_overseer(
|
||||||
connector: OverseerConnector,
|
connector: OverseerConnector,
|
||||||
CollatorOverseerGenArgs {
|
CollatorOverseerGenArgs {
|
||||||
runtime_client,
|
runtime_client,
|
||||||
@@ -90,7 +90,7 @@ fn build_overseer<'a>(
|
|||||||
collator_pair,
|
collator_pair,
|
||||||
req_protocol_names,
|
req_protocol_names,
|
||||||
peer_set_protocol_names,
|
peer_set_protocol_names,
|
||||||
}: CollatorOverseerGenArgs<'a>,
|
}: CollatorOverseerGenArgs<'_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
(Overseer<SpawnGlue<sc_service::SpawnTaskHandle>, Arc<BlockChainRpcClient>>, OverseerHandle),
|
(Overseer<SpawnGlue<sc_service::SpawnTaskHandle>, Arc<BlockChainRpcClient>>, OverseerHandle),
|
||||||
RelayChainError,
|
RelayChainError,
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ where
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("{e:?}"))?
|
.map_err(|e| format!("{e:?}"))?
|
||||||
.ok_or_else(|| "Could not find parachain head in relay chain")?;
|
.ok_or("Could not find parachain head in relay chain")?;
|
||||||
|
|
||||||
let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..])
|
let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..])
|
||||||
.map_err(|e| format!("Failed to decode parachain head: {e}"))?;
|
.map_err(|e| format!("Failed to decode parachain head: {e}"))?;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ benchmarks! {
|
|||||||
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||||
}: {
|
}: {
|
||||||
assert_ok!(
|
assert_ok!(
|
||||||
<CollatorSelection<T>>::set_desired_candidates(origin, max.clone())
|
<CollatorSelection<T>>::set_desired_candidates(origin, max)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
@@ -142,7 +142,7 @@ benchmarks! {
|
|||||||
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||||
}: {
|
}: {
|
||||||
assert_ok!(
|
assert_ok!(
|
||||||
<CollatorSelection<T>>::set_candidacy_bond(origin, bond_amount.clone())
|
<CollatorSelection<T>>::set_candidacy_bond(origin, bond_amount)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
@@ -162,7 +162,7 @@ benchmarks! {
|
|||||||
|
|
||||||
let caller: T::AccountId = whitelisted_caller();
|
let caller: T::AccountId = whitelisted_caller();
|
||||||
let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
|
let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
|
||||||
T::Currency::make_free_balance_be(&caller, bond.clone());
|
T::Currency::make_free_balance_be(&caller, bond);
|
||||||
|
|
||||||
<session::Pallet<T>>::set_keys(
|
<session::Pallet<T>>::set_keys(
|
||||||
RawOrigin::Signed(caller.clone()).into(),
|
RawOrigin::Signed(caller.clone()).into(),
|
||||||
|
|||||||
@@ -238,8 +238,8 @@ pub mod pallet {
|
|||||||
"genesis desired_candidates are more than T::MaxCandidates",
|
"genesis desired_candidates are more than T::MaxCandidates",
|
||||||
);
|
);
|
||||||
|
|
||||||
<DesiredCandidates<T>>::put(&self.desired_candidates);
|
<DesiredCandidates<T>>::put(self.desired_candidates);
|
||||||
<CandidacyBond<T>>::put(&self.candidacy_bond);
|
<CandidacyBond<T>>::put(self.candidacy_bond);
|
||||||
<Invulnerables<T>>::put(bounded_invulnerables);
|
<Invulnerables<T>>::put(bounded_invulnerables);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ pub mod pallet {
|
|||||||
if max > T::MaxCandidates::get() {
|
if max > T::MaxCandidates::get() {
|
||||||
log::warn!("max > T::MaxCandidates; you might need to run benchmarks again");
|
log::warn!("max > T::MaxCandidates; you might need to run benchmarks again");
|
||||||
}
|
}
|
||||||
<DesiredCandidates<T>>::put(&max);
|
<DesiredCandidates<T>>::put(max);
|
||||||
Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max });
|
Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max });
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ pub mod pallet {
|
|||||||
bond: BalanceOf<T>,
|
bond: BalanceOf<T>,
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResultWithPostInfo {
|
||||||
T::UpdateOrigin::ensure_origin(origin)?;
|
T::UpdateOrigin::ensure_origin(origin)?;
|
||||||
<CandidacyBond<T>>::put(&bond);
|
<CandidacyBond<T>>::put(bond);
|
||||||
Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond });
|
Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond });
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,12 +152,12 @@ pub struct TestSessionHandler;
|
|||||||
impl pallet_session::SessionHandler<u64> for TestSessionHandler {
|
impl pallet_session::SessionHandler<u64> for TestSessionHandler {
|
||||||
const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID];
|
const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID];
|
||||||
fn on_genesis_session<Ks: OpaqueKeys>(keys: &[(u64, Ks)]) {
|
fn on_genesis_session<Ks: OpaqueKeys>(keys: &[(u64, Ks)]) {
|
||||||
SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::<Vec<_>>())
|
SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::<Vec<_>>())
|
||||||
}
|
}
|
||||||
fn on_new_session<Ks: OpaqueKeys>(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) {
|
fn on_new_session<Ks: OpaqueKeys>(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) {
|
||||||
SessionChangeBlock::set(System::block_number());
|
SessionChangeBlock::set(System::block_number());
|
||||||
dbg!(keys.len());
|
dbg!(keys.len());
|
||||||
SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::<Vec<_>>())
|
SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::<Vec<_>>())
|
||||||
}
|
}
|
||||||
fn on_before_session_ending() {}
|
fn on_before_session_ending() {}
|
||||||
fn on_disabled(_: u32) {}
|
fn on_disabled(_: u32) {}
|
||||||
@@ -195,11 +195,7 @@ parameter_types! {
|
|||||||
pub struct IsRegistered;
|
pub struct IsRegistered;
|
||||||
impl ValidatorRegistration<u64> for IsRegistered {
|
impl ValidatorRegistration<u64> for IsRegistered {
|
||||||
fn is_registered(id: &u64) -> bool {
|
fn is_registered(id: &u64) -> bool {
|
||||||
if *id == 7u64 {
|
*id != 7u64
|
||||||
false
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ fn it_should_set_invulnerables() {
|
|||||||
|
|
||||||
// cannot set with non-root.
|
// cannot set with non-root.
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set.clone()),
|
CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set),
|
||||||
BadOrigin
|
BadOrigin
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ fn it_should_set_invulnerables() {
|
|||||||
assert_noop!(
|
assert_noop!(
|
||||||
CollatorSelection::set_invulnerables(
|
CollatorSelection::set_invulnerables(
|
||||||
RuntimeOrigin::signed(RootAccount::get()),
|
RuntimeOrigin::signed(RootAccount::get()),
|
||||||
invulnerables.clone()
|
invulnerables
|
||||||
),
|
),
|
||||||
Error::<Test>::ValidatorNotRegistered
|
Error::<Test>::ValidatorNotRegistered
|
||||||
);
|
);
|
||||||
@@ -184,8 +184,8 @@ fn cannot_register_dupe_candidate() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn cannot_register_as_candidate_if_poor() {
|
fn cannot_register_as_candidate_if_poor() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
assert_eq!(Balances::free_balance(&3), 100);
|
assert_eq!(Balances::free_balance(3), 100);
|
||||||
assert_eq!(Balances::free_balance(&33), 0);
|
assert_eq!(Balances::free_balance(33), 0);
|
||||||
|
|
||||||
// works
|
// works
|
||||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||||
@@ -208,14 +208,14 @@ fn register_as_candidate_works() {
|
|||||||
assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);
|
assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);
|
||||||
|
|
||||||
// take two endowed, non-invulnerables accounts.
|
// take two endowed, non-invulnerables accounts.
|
||||||
assert_eq!(Balances::free_balance(&3), 100);
|
assert_eq!(Balances::free_balance(3), 100);
|
||||||
assert_eq!(Balances::free_balance(&4), 100);
|
assert_eq!(Balances::free_balance(4), 100);
|
||||||
|
|
||||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||||
|
|
||||||
assert_eq!(Balances::free_balance(&3), 90);
|
assert_eq!(Balances::free_balance(3), 90);
|
||||||
assert_eq!(Balances::free_balance(&4), 90);
|
assert_eq!(Balances::free_balance(4), 90);
|
||||||
|
|
||||||
assert_eq!(CollatorSelection::candidates().len(), 2);
|
assert_eq!(CollatorSelection::candidates().len(), 2);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,93 +39,91 @@ pub trait WeightInfo {
|
|||||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||||
fn set_invulnerables(b: u32) -> Weight {
|
fn set_invulnerables(b: u32) -> Weight {
|
||||||
Weight::from_parts(18_563_000 as u64, 0)
|
Weight::from_parts(18_563_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64))
|
.saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
fn set_desired_candidates() -> Weight {
|
fn set_desired_candidates() -> Weight {
|
||||||
Weight::from_parts(16_363_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64))
|
Weight::from_parts(16_363_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
fn set_candidacy_bond() -> Weight {
|
fn set_candidacy_bond() -> Weight {
|
||||||
Weight::from_parts(16_840_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64))
|
Weight::from_parts(16_840_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
fn register_as_candidate(c: u32) -> Weight {
|
fn register_as_candidate(c: u32) -> Weight {
|
||||||
Weight::from_parts(71_196_000 as u64, 0)
|
Weight::from_parts(71_196_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||||
}
|
}
|
||||||
fn leave_intent(c: u32) -> Weight {
|
fn leave_intent(c: u32) -> Weight {
|
||||||
Weight::from_parts(55_336_000 as u64, 0)
|
Weight::from_parts(55_336_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||||
}
|
}
|
||||||
fn note_author() -> Weight {
|
fn note_author() -> Weight {
|
||||||
Weight::from_parts(71_461_000 as u64, 0)
|
Weight::from_parts(71_461_000_u64, 0)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||||
}
|
}
|
||||||
fn new_session(r: u32, c: u32) -> Weight {
|
fn new_session(r: u32, c: u32) -> Weight {
|
||||||
Weight::from_parts(0 as u64, 0)
|
Weight::from_parts(0_u64, 0)
|
||||||
// Standard Error: 1_010_000
|
// Standard Error: 1_010_000
|
||||||
.saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64))
|
.saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64))
|
||||||
// Standard Error: 1_010_000
|
// Standard Error: 1_010_000
|
||||||
.saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))
|
.saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(r as u64)))
|
||||||
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
|
.saturating_add(T::DbWeight::get().reads(2_u64.saturating_mul(c as u64)))
|
||||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64)))
|
.saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(r as u64)))
|
||||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
|
.saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(c as u64)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For backwards compatibility and tests
|
// For backwards compatibility and tests
|
||||||
impl WeightInfo for () {
|
impl WeightInfo for () {
|
||||||
fn set_invulnerables(b: u32) -> Weight {
|
fn set_invulnerables(b: u32) -> Weight {
|
||||||
Weight::from_parts(18_563_000 as u64, 0)
|
Weight::from_parts(18_563_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64))
|
.saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
fn set_desired_candidates() -> Weight {
|
fn set_desired_candidates() -> Weight {
|
||||||
Weight::from_parts(16_363_000 as u64, 0)
|
Weight::from_parts(16_363_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
|
||||||
}
|
}
|
||||||
fn set_candidacy_bond() -> Weight {
|
fn set_candidacy_bond() -> Weight {
|
||||||
Weight::from_parts(16_840_000 as u64, 0)
|
Weight::from_parts(16_840_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
|
||||||
}
|
}
|
||||||
fn register_as_candidate(c: u32) -> Weight {
|
fn register_as_candidate(c: u32) -> Weight {
|
||||||
Weight::from_parts(71_196_000 as u64, 0)
|
Weight::from_parts(71_196_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||||
}
|
}
|
||||||
fn leave_intent(c: u32) -> Weight {
|
fn leave_intent(c: u32) -> Weight {
|
||||||
Weight::from_parts(55_336_000 as u64, 0)
|
Weight::from_parts(55_336_000_u64, 0)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||||
}
|
}
|
||||||
fn note_author() -> Weight {
|
fn note_author() -> Weight {
|
||||||
Weight::from_parts(71_461_000 as u64, 0)
|
Weight::from_parts(71_461_000_u64, 0)
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as u64))
|
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||||
}
|
}
|
||||||
fn new_session(r: u32, c: u32) -> Weight {
|
fn new_session(r: u32, c: u32) -> Weight {
|
||||||
Weight::from_parts(0 as u64, 0)
|
Weight::from_parts(0_u64, 0)
|
||||||
// Standard Error: 1_010_000
|
// Standard Error: 1_010_000
|
||||||
.saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64))
|
.saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64))
|
||||||
// Standard Error: 1_010_000
|
// Standard Error: 1_010_000
|
||||||
.saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64))
|
.saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64))
|
||||||
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64)))
|
.saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(r as u64)))
|
||||||
.saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
|
.saturating_add(RocksDbWeight::get().reads(2_u64.saturating_mul(c as u64)))
|
||||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64)))
|
.saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(r as u64)))
|
||||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
|
.saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(c as u64)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -766,19 +766,19 @@ mod tests {
|
|||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
let enqueued = vec![msg(1000), msg(1001)];
|
let enqueued = vec![msg(1000), msg(1001)];
|
||||||
enqueue(&enqueued);
|
enqueue(&enqueued);
|
||||||
let weight_used = handle_messages(&vec![msg(1002)], Weight::from_parts(1500, 1500));
|
let weight_used = handle_messages(&[msg(1002)], Weight::from_parts(1500, 1500));
|
||||||
assert_eq!(weight_used, Weight::from_parts(1000, 1000));
|
assert_eq!(weight_used, Weight::from_parts(1000, 1000));
|
||||||
assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]);
|
assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]);
|
||||||
assert_eq!(pages_queued(), 2);
|
assert_eq!(pages_queued(), 2);
|
||||||
assert_eq!(PageIndex::<Test>::get().begin_used, 0);
|
assert_eq!(PageIndex::<Test>::get().begin_used, 0);
|
||||||
|
|
||||||
let weight_used = handle_messages(&vec![msg(1003)], Weight::from_parts(1500, 1500));
|
let weight_used = handle_messages(&[msg(1003)], Weight::from_parts(1500, 1500));
|
||||||
assert_eq!(weight_used, Weight::from_parts(1001, 1001));
|
assert_eq!(weight_used, Weight::from_parts(1001, 1001));
|
||||||
assert_eq!(take_trace(), vec![msg_complete(1001), msg_limit_reached(1002),]);
|
assert_eq!(take_trace(), vec![msg_complete(1001), msg_limit_reached(1002),]);
|
||||||
assert_eq!(pages_queued(), 2);
|
assert_eq!(pages_queued(), 2);
|
||||||
assert_eq!(PageIndex::<Test>::get().begin_used, 1);
|
assert_eq!(PageIndex::<Test>::get().begin_used, 1);
|
||||||
|
|
||||||
let weight_used = handle_messages(&vec![msg(1004)], Weight::from_parts(1500, 1500));
|
let weight_used = handle_messages(&[msg(1004)], Weight::from_parts(1500, 1500));
|
||||||
assert_eq!(weight_used, Weight::from_parts(1002, 1002));
|
assert_eq!(weight_used, Weight::from_parts(1002, 1002));
|
||||||
assert_eq!(take_trace(), vec![msg_complete(1002), msg_limit_reached(1003),]);
|
assert_eq!(take_trace(), vec![msg_complete(1002), msg_limit_reached(1003),]);
|
||||||
assert_eq!(pages_queued(), 2);
|
assert_eq!(pages_queued(), 2);
|
||||||
@@ -877,9 +877,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn on_idle_should_service_queue() {
|
fn on_idle_should_service_queue() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
enqueue(&vec![msg(1000), msg(1001)]);
|
enqueue(&[msg(1000), msg(1001)]);
|
||||||
enqueue(&vec![msg(1002), msg(1003)]);
|
enqueue(&[msg(1002), msg(1003)]);
|
||||||
enqueue(&vec![msg(1004), msg(1005)]);
|
enqueue(&[msg(1004), msg(1005)]);
|
||||||
|
|
||||||
let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000));
|
let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000));
|
||||||
assert_eq!(weight_used, Weight::from_parts(5010, 5010));
|
assert_eq!(weight_used, Weight::from_parts(5010, 5010));
|
||||||
@@ -901,20 +901,17 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn handle_max_messages_per_block() {
|
fn handle_max_messages_per_block() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
enqueue(&vec![msg(1000), msg(1001)]);
|
enqueue(&[msg(1000), msg(1001)]);
|
||||||
enqueue(&vec![msg(1002), msg(1003)]);
|
enqueue(&[msg(1002), msg(1003)]);
|
||||||
enqueue(&vec![msg(1004), msg(1005)]);
|
enqueue(&[msg(1004), msg(1005)]);
|
||||||
|
|
||||||
let incoming = (0..MAX_MESSAGES_PER_BLOCK)
|
let incoming =
|
||||||
.into_iter()
|
(0..MAX_MESSAGES_PER_BLOCK).map(|i| msg(1006 + i as u64)).collect::<Vec<_>>();
|
||||||
.map(|i| msg(1006 + i as u64))
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
handle_messages(&incoming, Weight::from_parts(25000, 25000));
|
handle_messages(&incoming, Weight::from_parts(25000, 25000));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
take_trace(),
|
take_trace(),
|
||||||
(0..MAX_MESSAGES_PER_BLOCK)
|
(0..MAX_MESSAGES_PER_BLOCK)
|
||||||
.into_iter()
|
|
||||||
.map(|i| msg_complete(1000 + i as u64))
|
.map(|i| msg_complete(1000 + i as u64))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
);
|
);
|
||||||
@@ -924,7 +921,6 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
take_trace(),
|
take_trace(),
|
||||||
(MAX_MESSAGES_PER_BLOCK..MAX_MESSAGES_PER_BLOCK + 6)
|
(MAX_MESSAGES_PER_BLOCK..MAX_MESSAGES_PER_BLOCK + 6)
|
||||||
.into_iter()
|
|
||||||
.map(|i| msg_complete(1000 + i as u64))
|
.map(|i| msg_complete(1000 + i as u64))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ pub fn migrate_to_v1<T: Config>() -> Weight {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(_) = Configuration::<T>::translate(|pre| pre.map(translate)) {
|
if Configuration::<T>::translate(|pre| pre.map(translate)).is_err() {
|
||||||
log::error!(
|
log::error!(
|
||||||
target: "dmp_queue",
|
target: "dmp_queue",
|
||||||
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
||||||
|
|||||||
@@ -473,10 +473,7 @@ pub mod pallet {
|
|||||||
check_version: bool,
|
check_version: bool,
|
||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
ensure_root(origin)?;
|
ensure_root(origin)?;
|
||||||
AuthorizedUpgrade::<T>::put(CodeUpgradeAuthorization {
|
AuthorizedUpgrade::<T>::put(CodeUpgradeAuthorization { code_hash, check_version });
|
||||||
code_hash: code_hash.clone(),
|
|
||||||
check_version,
|
|
||||||
});
|
|
||||||
|
|
||||||
Self::deposit_event(Event::UpgradeAuthorized { code_hash });
|
Self::deposit_event(Event::UpgradeAuthorized { code_hash });
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -753,7 +750,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
let authorization = AuthorizedUpgrade::<T>::get().ok_or(Error::<T>::NothingAuthorized)?;
|
let authorization = AuthorizedUpgrade::<T>::get().ok_or(Error::<T>::NothingAuthorized)?;
|
||||||
|
|
||||||
// ensure that the actual hash matches the authorized hash
|
// ensure that the actual hash matches the authorized hash
|
||||||
let actual_hash = T::Hashing::hash(&code[..]);
|
let actual_hash = T::Hashing::hash(code);
|
||||||
ensure!(actual_hash == authorization.code_hash, Error::<T>::Unauthorized);
|
ensure!(actual_hash == authorization.code_hash, Error::<T>::Unauthorized);
|
||||||
|
|
||||||
// check versions if required as part of the authorization
|
// check versions if required as part of the authorization
|
||||||
@@ -941,10 +938,10 @@ impl<T: Config> Pallet<T> {
|
|||||||
// `running_mqc_heads`. Otherwise, in a block where no messages were sent in a channel
|
// `running_mqc_heads`. Otherwise, in a block where no messages were sent in a channel
|
||||||
// it won't get into next block's `last_mqc_heads` and thus will be all zeros, which
|
// it won't get into next block's `last_mqc_heads` and thus will be all zeros, which
|
||||||
// would corrupt the message queue chain.
|
// would corrupt the message queue chain.
|
||||||
for &(ref sender, ref channel) in ingress_channels {
|
for (sender, channel) in ingress_channels {
|
||||||
let cur_head = running_mqc_heads
|
let cur_head = running_mqc_heads
|
||||||
.entry(sender)
|
.entry(sender)
|
||||||
.or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default())
|
.or_insert_with(|| last_mqc_heads.get(sender).cloned().unwrap_or_default())
|
||||||
.head();
|
.head();
|
||||||
let target_head = channel.mqc_head.unwrap_or_default();
|
let target_head = channel.mqc_head.unwrap_or_default();
|
||||||
|
|
||||||
@@ -1090,22 +1087,20 @@ impl<T: Config> Pallet<T> {
|
|||||||
// may change so that the message is no longer valid.
|
// may change so that the message is no longer valid.
|
||||||
//
|
//
|
||||||
// However, changing this setting is expected to be rare.
|
// However, changing this setting is expected to be rare.
|
||||||
match Self::host_configuration() {
|
if let Some(cfg) = Self::host_configuration() {
|
||||||
Some(cfg) =>
|
if message.len() > cfg.max_upward_message_size as usize {
|
||||||
if message.len() > cfg.max_upward_message_size as usize {
|
return Err(MessageSendError::TooBig)
|
||||||
return Err(MessageSendError::TooBig)
|
}
|
||||||
},
|
} else {
|
||||||
None => {
|
// This storage field should carry over from the previous block. So if it's None
|
||||||
// This storage field should carry over from the previous block. So if it's None
|
// then it must be that this is an edge-case where a message is attempted to be
|
||||||
// then it must be that this is an edge-case where a message is attempted to be
|
// sent at the first block.
|
||||||
// sent at the first block.
|
//
|
||||||
//
|
// Let's pass this message through. I think it's not unreasonable to expect that
|
||||||
// Let's pass this message through. I think it's not unreasonable to expect that
|
// the message is not huge and it comes through, but if it doesn't it can be
|
||||||
// the message is not huge and it comes through, but if it doesn't it can be
|
// returned back to the sender.
|
||||||
// returned back to the sender.
|
//
|
||||||
//
|
// Thus fall through here.
|
||||||
// Thus fall through here.
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
<PendingUpwardMessages<T>>::append(message.clone());
|
<PendingUpwardMessages<T>>::append(message.clone());
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ impl BlockTests {
|
|||||||
|
|
||||||
// begin initialization
|
// begin initialization
|
||||||
System::reset_events();
|
System::reset_events();
|
||||||
System::initialize(&n, &Default::default(), &Default::default());
|
System::initialize(n, &Default::default(), &Default::default());
|
||||||
|
|
||||||
// now mess with the storage the way validate_block does
|
// now mess with the storage the way validate_block does
|
||||||
let mut sproof_builder = RelayStateSproofBuilder::default();
|
let mut sproof_builder = RelayStateSproofBuilder::default();
|
||||||
@@ -357,10 +357,8 @@ impl BlockTests {
|
|||||||
ParachainSystem::on_finalize(*n);
|
ParachainSystem::on_finalize(*n);
|
||||||
|
|
||||||
// did block execution set new validation code?
|
// did block execution set new validation code?
|
||||||
if NewValidationCode::<Test>::exists() {
|
if NewValidationCode::<Test>::exists() && self.pending_upgrade.is_some() {
|
||||||
if self.pending_upgrade.is_some() {
|
panic!("attempted to set validation code while upgrade was pending");
|
||||||
panic!("attempted to set validation code while upgrade was pending");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
@@ -404,7 +402,7 @@ fn events() {
|
|||||||
let events = System::events();
|
let events = System::events();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
events[0].event,
|
events[0].event,
|
||||||
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored.into())
|
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -415,10 +413,9 @@ fn events() {
|
|||||||
let events = System::events();
|
let events = System::events();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
events[0].event,
|
events[0].event,
|
||||||
RuntimeEvent::ParachainSystem(
|
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionApplied {
|
||||||
crate::Event::ValidationFunctionApplied { relay_chain_block_num: 1234 }
|
relay_chain_block_num: 1234
|
||||||
.into()
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -491,7 +488,7 @@ fn aborted_upgrade() {
|
|||||||
let events = System::events();
|
let events = System::events();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
events[0].event,
|
events[0].event,
|
||||||
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into())
|
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ fn call_validate_block_encoded_header(
|
|||||||
relay_parent_number: 1,
|
relay_parent_number: 1,
|
||||||
relay_parent_storage_root,
|
relay_parent_storage_root,
|
||||||
},
|
},
|
||||||
&WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"),
|
WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"),
|
||||||
)
|
)
|
||||||
.map(|v| v.head_data.0)
|
.map(|v| v.head_data.0)
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ fn validate_block_invalid_parent_hash() {
|
|||||||
.unwrap_err();
|
.unwrap_err();
|
||||||
} else {
|
} else {
|
||||||
let output = Command::new(env::current_exe().unwrap())
|
let output = Command::new(env::current_exe().unwrap())
|
||||||
.args(&["validate_block_invalid_parent_hash", "--", "--nocapture"])
|
.args(["validate_block_invalid_parent_hash", "--", "--nocapture"])
|
||||||
.env("RUN_TEST", "1")
|
.env("RUN_TEST", "1")
|
||||||
.output()
|
.output()
|
||||||
.expect("Runs the test");
|
.expect("Runs the test");
|
||||||
@@ -213,7 +213,7 @@ fn validate_block_fails_on_invalid_validation_data() {
|
|||||||
call_validate_block(parent_head, block, Hash::random()).unwrap_err();
|
call_validate_block(parent_head, block, Hash::random()).unwrap_err();
|
||||||
} else {
|
} else {
|
||||||
let output = Command::new(env::current_exe().unwrap())
|
let output = Command::new(env::current_exe().unwrap())
|
||||||
.args(&["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"])
|
.args(["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"])
|
||||||
.env("RUN_TEST", "1")
|
.env("RUN_TEST", "1")
|
||||||
.output()
|
.output()
|
||||||
.expect("Runs the test");
|
.expect("Runs the test");
|
||||||
@@ -242,7 +242,7 @@ fn check_inherent_fails_on_validate_block_as_expected() {
|
|||||||
.unwrap_err();
|
.unwrap_err();
|
||||||
} else {
|
} else {
|
||||||
let output = Command::new(env::current_exe().unwrap())
|
let output = Command::new(env::current_exe().unwrap())
|
||||||
.args(&["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"])
|
.args(["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"])
|
||||||
.env("RUN_TEST", "1")
|
.env("RUN_TEST", "1")
|
||||||
.output()
|
.output()
|
||||||
.expect("Runs the test");
|
.expect("Runs the test");
|
||||||
@@ -276,7 +276,7 @@ fn check_inherents_are_unsigned_and_before_all_other_extrinsics() {
|
|||||||
.unwrap_err();
|
.unwrap_err();
|
||||||
} else {
|
} else {
|
||||||
let output = Command::new(env::current_exe().unwrap())
|
let output = Command::new(env::current_exe().unwrap())
|
||||||
.args(&[
|
.args([
|
||||||
"check_inherents_are_unsigned_and_before_all_other_extrinsics",
|
"check_inherents_are_unsigned_and_before_all_other_extrinsics",
|
||||||
"--",
|
"--",
|
||||||
"--nocapture",
|
"--nocapture",
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
s.extend_from_slice(&data[..]);
|
s.extend_from_slice(&data[..]);
|
||||||
return true
|
true
|
||||||
});
|
});
|
||||||
if appended {
|
if appended {
|
||||||
Ok((details.last_index - details.first_index - 1) as u32)
|
Ok((details.last_index - details.first_index - 1) as u32)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ pub fn migrate_to_v2<T: Config>() -> Weight {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(_) = QueueConfig::<T>::translate(|pre| pre.map(translate)) {
|
if QueueConfig::<T>::translate(|pre| pre.map(translate)).is_err() {
|
||||||
log::error!(
|
log::error!(
|
||||||
target: super::LOG_TARGET,
|
target: super::LOG_TARGET,
|
||||||
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ impl cumulus_pallet_parachain_system::Config for Test {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const RelayChain: MultiLocation = MultiLocation::parent();
|
pub const RelayChain: MultiLocation = MultiLocation::parent();
|
||||||
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32.into())).into();
|
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32));
|
||||||
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024);
|
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024);
|
||||||
pub const MaxInstructions: u32 = 100;
|
pub const MaxInstructions: u32 = 100;
|
||||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use sp_runtime::traits::BadOrigin;
|
|||||||
fn one_message_does_not_panic() {
|
fn one_message_does_not_panic() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
let message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
let message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
||||||
let messages = vec![(Default::default(), 1u32.into(), message_format.as_slice())];
|
let messages = vec![(Default::default(), 1u32, message_format.as_slice())];
|
||||||
|
|
||||||
// This shouldn't cause a panic
|
// This shouldn't cause a panic
|
||||||
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
||||||
@@ -128,7 +128,7 @@ fn suspend_xcm_execution_works() {
|
|||||||
.encode();
|
.encode();
|
||||||
let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
||||||
message_format.extend(xcm.clone());
|
message_format.extend(xcm.clone());
|
||||||
let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())];
|
let messages = vec![(ParaId::from(999), 1u32, message_format.as_slice())];
|
||||||
|
|
||||||
// This should have executed the incoming XCM, because it came from a system parachain
|
// This should have executed the incoming XCM, because it came from a system parachain
|
||||||
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
||||||
@@ -136,7 +136,7 @@ fn suspend_xcm_execution_works() {
|
|||||||
let queued_xcm = InboundXcmpMessages::<Test>::get(ParaId::from(999), 1u32);
|
let queued_xcm = InboundXcmpMessages::<Test>::get(ParaId::from(999), 1u32);
|
||||||
assert!(queued_xcm.is_empty());
|
assert!(queued_xcm.is_empty());
|
||||||
|
|
||||||
let messages = vec![(ParaId::from(2000), 1u32.into(), message_format.as_slice())];
|
let messages = vec![(ParaId::from(2000), 1u32, message_format.as_slice())];
|
||||||
|
|
||||||
// This shouldn't have executed the incoming XCM
|
// This shouldn't have executed the incoming XCM
|
||||||
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX);
|
||||||
@@ -294,7 +294,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() {
|
|||||||
|
|
||||||
// XcmpQueue - check dest is really not applicable
|
// XcmpQueue - check dest is really not applicable
|
||||||
let dest = (Parent, Parent, Parent);
|
let dest = (Parent, Parent, Parent);
|
||||||
let mut dest_wrapper = Some(dest.clone().into());
|
let mut dest_wrapper = Some(dest.into());
|
||||||
let mut msg_wrapper = Some(message.clone());
|
let mut msg_wrapper = Some(message.clone());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Err(SendError::NotApplicable),
|
Err(SendError::NotApplicable),
|
||||||
@@ -302,7 +302,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// check wrapper were not consumed
|
// check wrapper were not consumed
|
||||||
assert_eq!(Some(dest.clone().into()), dest_wrapper.take());
|
assert_eq!(Some(dest.into()), dest_wrapper.take());
|
||||||
assert_eq!(Some(message.clone()), msg_wrapper.take());
|
assert_eq!(Some(message.clone()), msg_wrapper.take());
|
||||||
|
|
||||||
// another try with router chain with asserting sender
|
// another try with router chain with asserting sender
|
||||||
@@ -322,7 +322,7 @@ fn xcmp_queue_consumes_dest_and_msg_on_ok_validate() {
|
|||||||
|
|
||||||
// XcmpQueue - check dest/msg is valid
|
// XcmpQueue - check dest/msg is valid
|
||||||
let dest = (Parent, X1(Parachain(5555)));
|
let dest = (Parent, X1(Parachain(5555)));
|
||||||
let mut dest_wrapper = Some(dest.clone().into());
|
let mut dest_wrapper = Some(dest.into());
|
||||||
let mut msg_wrapper = Some(message.clone());
|
let mut msg_wrapper = Some(message.clone());
|
||||||
assert!(<XcmpQueue as SendXcm>::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok());
|
assert!(<XcmpQueue as SendXcm>::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok());
|
||||||
|
|
||||||
|
|||||||
@@ -18,31 +18,31 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
|
|||||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||||
fn set_config_with_u32() -> Weight {
|
fn set_config_with_u32() -> Weight {
|
||||||
Weight::from_parts(2_717_000 as u64, 0)
|
Weight::from_parts(2_717_000_u64, 0)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||||
fn set_config_with_weight() -> Weight {
|
fn set_config_with_weight() -> Weight {
|
||||||
Weight::from_parts(2_717_000 as u64, 0)
|
Weight::from_parts(2_717_000_u64, 0)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WeightInfo for () {
|
impl WeightInfo for () {
|
||||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||||
fn set_config_with_u32() -> Weight {
|
fn set_config_with_u32() -> Weight {
|
||||||
Weight::from_parts(2_717_000 as u64, 0)
|
Weight::from_parts(2_717_000_u64, 0)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||||
fn set_config_with_weight() -> Weight {
|
fn set_config_with_weight() -> Weight {
|
||||||
Weight::from_parts(2_717_000 as u64, 0)
|
Weight::from_parts(2_717_000_u64, 0)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,13 +268,13 @@ pub fn run() -> Result<()> {
|
|||||||
runner.run_node_until_exit(|config| async move {
|
runner.run_node_until_exit(|config| async move {
|
||||||
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
||||||
config.database.path().map(|database_path| {
|
config.database.path().map(|database_path| {
|
||||||
let _ = std::fs::create_dir_all(&database_path);
|
let _ = std::fs::create_dir_all(database_path);
|
||||||
sc_sysinfo::gather_hwbench(Some(database_path))
|
sc_sysinfo::gather_hwbench(Some(database_path))
|
||||||
})).flatten();
|
})).flatten();
|
||||||
|
|
||||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||||
.map(|e| e.para_id)
|
.map(|e| e.para_id)
|
||||||
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;
|
.ok_or("Could not find parachain ID in chain-spec.")?;
|
||||||
|
|
||||||
let polkadot_cli = RelayChainCli::new(
|
let polkadot_cli = RelayChainCli::new(
|
||||||
&config,
|
&config,
|
||||||
@@ -301,7 +301,7 @@ pub fn run() -> Result<()> {
|
|||||||
info!("Parachain genesis state: {}", genesis_state);
|
info!("Parachain genesis state: {}", genesis_state);
|
||||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||||
|
|
||||||
if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relay_chain_args.len() > 0 {
|
if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() {
|
||||||
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -686,13 +686,13 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
config: frame_benchmarking::BenchmarkConfig
|
config: frame_benchmarking::BenchmarkConfig
|
||||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
use frame_benchmarking::{Benchmarking, BenchmarkBatch};
|
||||||
|
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
impl frame_system_benchmarking::Config for Runtime {}
|
impl frame_system_benchmarking::Config for Runtime {}
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let asset_location = SomeSiblingParachain::get()
|
let asset_location = SomeSiblingParachain::get()
|
||||||
.clone()
|
|
||||||
.pushed_with_interior(GeneralIndex(42))
|
.pushed_with_interior(GeneralIndex(42))
|
||||||
.expect("multilocation will only have 2 junctions; qed");
|
.expect("multilocation will only have 2 junctions; qed");
|
||||||
let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() };
|
let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() };
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub mod pallet {
|
|||||||
#[pallet::genesis_build]
|
#[pallet::genesis_build]
|
||||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||||
fn build(&self) {
|
fn build(&self) {
|
||||||
<ParachainId<T>>::put(&self.parachain_id);
|
<ParachainId<T>>::put(self.parachain_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ where
|
|||||||
asset_location: &MultiLocation,
|
asset_location: &MultiLocation,
|
||||||
) -> sp_std::result::Result<Self::Success, RuntimeOrigin> {
|
) -> sp_std::result::Result<Self::Success, RuntimeOrigin> {
|
||||||
let origin_location = EnsureXcm::<Everything>::try_origin(origin.clone())?;
|
let origin_location = EnsureXcm::<Everything>::try_origin(origin.clone())?;
|
||||||
if !IsForeign::contains(&asset_location, &origin_location) {
|
if !IsForeign::contains(asset_location, &origin_location) {
|
||||||
return Err(origin)
|
return Err(origin)
|
||||||
}
|
}
|
||||||
AccountOf::convert(origin_location).map_err(|_| origin)
|
AccountOf::convert(origin_location).map_err(|_| origin)
|
||||||
@@ -51,6 +51,6 @@ where
|
|||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
fn try_successful_origin(a: &MultiLocation) -> Result<RuntimeOrigin, ()> {
|
fn try_successful_origin(a: &MultiLocation) -> Result<RuntimeOrigin, ()> {
|
||||||
Ok(pallet_xcm::Origin::Xcm(a.clone()).into())
|
Ok(pallet_xcm::Origin::Xcm(*a).into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,7 @@ impl<Network: Get<NetworkId>> Contains<MultiLocation>
|
|||||||
for StartsWithExplicitGlobalConsensus<Network>
|
for StartsWithExplicitGlobalConsensus<Network>
|
||||||
{
|
{
|
||||||
fn contains(t: &MultiLocation) -> bool {
|
fn contains(t: &MultiLocation) -> bool {
|
||||||
match t.interior.global_consensus() {
|
matches!(t.interior.global_consensus(), Ok(requested_network) if requested_network.eq(&Network::get()))
|
||||||
Ok(requested_network) if requested_network.eq(&Network::get()) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +58,7 @@ impl<IsForeign: ContainsPair<MultiLocation, MultiLocation>> ContainsPair<MultiAs
|
|||||||
{
|
{
|
||||||
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
|
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
|
||||||
log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin);
|
log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin);
|
||||||
matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, &origin))
|
matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, origin))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,18 +70,14 @@ impl<SelfParaId: Get<ParaId>> ContainsPair<MultiLocation, MultiLocation>
|
|||||||
{
|
{
|
||||||
fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool {
|
fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool {
|
||||||
// `a` needs to be from `b` at least
|
// `a` needs to be from `b` at least
|
||||||
if !a.starts_with(&b) {
|
if !a.starts_with(b) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we check if sibling
|
// here we check if sibling
|
||||||
match a {
|
match a {
|
||||||
MultiLocation { parents: 1, interior } => match interior.first() {
|
MultiLocation { parents: 1, interior } =>
|
||||||
Some(Parachain(sibling_para_id))
|
matches!(interior.first(), Some(Parachain(sibling_para_id)) if sibling_para_id.ne(&u32::from(SelfParaId::get()))),
|
||||||
if sibling_para_id.ne(&u32::from(SelfParaId::get())) =>
|
|
||||||
true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -1026,7 +1026,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -1062,7 +1062,6 @@ impl_runtime_apis! {
|
|||||||
id: Concrete(GeneralIndex(i as u128).into()),
|
id: Concrete(GeneralIndex(i as u128).into()),
|
||||||
fun: Fungible(fungibles_amount * i as u128),
|
fun: Fungible(fungibles_amount * i as u128),
|
||||||
}
|
}
|
||||||
.into()
|
|
||||||
})
|
})
|
||||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||||
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
||||||
@@ -1082,7 +1081,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
KsmLocation::get(),
|
KsmLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
|
|
||||||
@@ -1097,7 +1096,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(KsmLocation::get()),
|
id: Concrete(KsmLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1201,7 +1200,7 @@ cumulus_pallet_parachain_system::register_validate_block! {
|
|||||||
#[cfg(feature = "state-trie-version-1")]
|
#[cfg(feature = "state-trie-version-1")]
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
|
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
|
||||||
pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS;
|
pub const MigrationSignedDepositPerItem: Balance = CENTS;
|
||||||
pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS;
|
pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS;
|
||||||
pub const MigrationMaxKeyLen: u32 = 512;
|
pub const MigrationMaxKeyLen: u32 = 512;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -123,7 +122,7 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,151 +197,146 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
||||||
RuntimeCall::DmpQueue(..) |
|
RuntimeCall::Assets(
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
pallet_assets::Call::create { .. } |
|
||||||
RuntimeCall::Assets(
|
pallet_assets::Call::force_create { .. } |
|
||||||
|
pallet_assets::Call::start_destroy { .. } |
|
||||||
|
pallet_assets::Call::destroy_accounts { .. } |
|
||||||
|
pallet_assets::Call::destroy_approvals { .. } |
|
||||||
|
pallet_assets::Call::finish_destroy { .. } |
|
||||||
|
pallet_assets::Call::mint { .. } |
|
||||||
|
pallet_assets::Call::burn { .. } |
|
||||||
|
pallet_assets::Call::transfer { .. } |
|
||||||
|
pallet_assets::Call::transfer_keep_alive { .. } |
|
||||||
|
pallet_assets::Call::force_transfer { .. } |
|
||||||
|
pallet_assets::Call::freeze { .. } |
|
||||||
|
pallet_assets::Call::thaw { .. } |
|
||||||
|
pallet_assets::Call::freeze_asset { .. } |
|
||||||
|
pallet_assets::Call::thaw_asset { .. } |
|
||||||
|
pallet_assets::Call::transfer_ownership { .. } |
|
||||||
|
pallet_assets::Call::set_team { .. } |
|
||||||
|
pallet_assets::Call::clear_metadata { .. } |
|
||||||
|
pallet_assets::Call::force_clear_metadata { .. } |
|
||||||
|
pallet_assets::Call::force_asset_status { .. } |
|
||||||
|
pallet_assets::Call::approve_transfer { .. } |
|
||||||
|
pallet_assets::Call::cancel_approval { .. } |
|
||||||
|
pallet_assets::Call::force_cancel_approval { .. } |
|
||||||
|
pallet_assets::Call::transfer_approved { .. } |
|
||||||
|
pallet_assets::Call::touch { .. } |
|
||||||
|
pallet_assets::Call::refund { .. },
|
||||||
|
) | RuntimeCall::ForeignAssets(
|
||||||
pallet_assets::Call::create { .. } |
|
pallet_assets::Call::create { .. } |
|
||||||
pallet_assets::Call::force_create { .. } |
|
pallet_assets::Call::force_create { .. } |
|
||||||
pallet_assets::Call::start_destroy { .. } |
|
pallet_assets::Call::start_destroy { .. } |
|
||||||
pallet_assets::Call::destroy_accounts { .. } |
|
pallet_assets::Call::destroy_accounts { .. } |
|
||||||
pallet_assets::Call::destroy_approvals { .. } |
|
pallet_assets::Call::destroy_approvals { .. } |
|
||||||
pallet_assets::Call::finish_destroy { .. } |
|
pallet_assets::Call::finish_destroy { .. } |
|
||||||
pallet_assets::Call::mint { .. } |
|
pallet_assets::Call::mint { .. } |
|
||||||
pallet_assets::Call::burn { .. } |
|
pallet_assets::Call::burn { .. } |
|
||||||
pallet_assets::Call::transfer { .. } |
|
pallet_assets::Call::transfer { .. } |
|
||||||
pallet_assets::Call::transfer_keep_alive { .. } |
|
pallet_assets::Call::transfer_keep_alive { .. } |
|
||||||
pallet_assets::Call::force_transfer { .. } |
|
pallet_assets::Call::force_transfer { .. } |
|
||||||
pallet_assets::Call::freeze { .. } |
|
pallet_assets::Call::freeze { .. } |
|
||||||
pallet_assets::Call::thaw { .. } |
|
pallet_assets::Call::thaw { .. } |
|
||||||
pallet_assets::Call::freeze_asset { .. } |
|
pallet_assets::Call::freeze_asset { .. } |
|
||||||
pallet_assets::Call::thaw_asset { .. } |
|
pallet_assets::Call::thaw_asset { .. } |
|
||||||
pallet_assets::Call::transfer_ownership { .. } |
|
pallet_assets::Call::transfer_ownership { .. } |
|
||||||
pallet_assets::Call::set_team { .. } |
|
pallet_assets::Call::set_team { .. } |
|
||||||
pallet_assets::Call::clear_metadata { .. } |
|
pallet_assets::Call::set_metadata { .. } |
|
||||||
pallet_assets::Call::force_clear_metadata { .. } |
|
pallet_assets::Call::clear_metadata { .. } |
|
||||||
pallet_assets::Call::force_asset_status { .. } |
|
pallet_assets::Call::force_clear_metadata { .. } |
|
||||||
pallet_assets::Call::approve_transfer { .. } |
|
pallet_assets::Call::force_asset_status { .. } |
|
||||||
pallet_assets::Call::cancel_approval { .. } |
|
pallet_assets::Call::approve_transfer { .. } |
|
||||||
pallet_assets::Call::force_cancel_approval { .. } |
|
pallet_assets::Call::cancel_approval { .. } |
|
||||||
pallet_assets::Call::transfer_approved { .. } |
|
pallet_assets::Call::force_cancel_approval { .. } |
|
||||||
pallet_assets::Call::touch { .. } |
|
pallet_assets::Call::transfer_approved { .. } |
|
||||||
pallet_assets::Call::refund { .. },
|
pallet_assets::Call::touch { .. } |
|
||||||
) |
|
pallet_assets::Call::refund { .. },
|
||||||
RuntimeCall::ForeignAssets(
|
) | RuntimeCall::Nfts(
|
||||||
pallet_assets::Call::create { .. } |
|
|
||||||
pallet_assets::Call::force_create { .. } |
|
|
||||||
pallet_assets::Call::start_destroy { .. } |
|
|
||||||
pallet_assets::Call::destroy_accounts { .. } |
|
|
||||||
pallet_assets::Call::destroy_approvals { .. } |
|
|
||||||
pallet_assets::Call::finish_destroy { .. } |
|
|
||||||
pallet_assets::Call::mint { .. } |
|
|
||||||
pallet_assets::Call::burn { .. } |
|
|
||||||
pallet_assets::Call::transfer { .. } |
|
|
||||||
pallet_assets::Call::transfer_keep_alive { .. } |
|
|
||||||
pallet_assets::Call::force_transfer { .. } |
|
|
||||||
pallet_assets::Call::freeze { .. } |
|
|
||||||
pallet_assets::Call::thaw { .. } |
|
|
||||||
pallet_assets::Call::freeze_asset { .. } |
|
|
||||||
pallet_assets::Call::thaw_asset { .. } |
|
|
||||||
pallet_assets::Call::transfer_ownership { .. } |
|
|
||||||
pallet_assets::Call::set_team { .. } |
|
|
||||||
pallet_assets::Call::set_metadata { .. } |
|
|
||||||
pallet_assets::Call::clear_metadata { .. } |
|
|
||||||
pallet_assets::Call::force_clear_metadata { .. } |
|
|
||||||
pallet_assets::Call::force_asset_status { .. } |
|
|
||||||
pallet_assets::Call::approve_transfer { .. } |
|
|
||||||
pallet_assets::Call::cancel_approval { .. } |
|
|
||||||
pallet_assets::Call::force_cancel_approval { .. } |
|
|
||||||
pallet_assets::Call::transfer_approved { .. } |
|
|
||||||
pallet_assets::Call::touch { .. } |
|
|
||||||
pallet_assets::Call::refund { .. },
|
|
||||||
) |
|
|
||||||
RuntimeCall::Nfts(
|
|
||||||
pallet_nfts::Call::create { .. } |
|
pallet_nfts::Call::create { .. } |
|
||||||
pallet_nfts::Call::force_create { .. } |
|
pallet_nfts::Call::force_create { .. } |
|
||||||
pallet_nfts::Call::destroy { .. } |
|
pallet_nfts::Call::destroy { .. } |
|
||||||
pallet_nfts::Call::mint { .. } |
|
pallet_nfts::Call::mint { .. } |
|
||||||
pallet_nfts::Call::force_mint { .. } |
|
pallet_nfts::Call::force_mint { .. } |
|
||||||
pallet_nfts::Call::burn { .. } |
|
pallet_nfts::Call::burn { .. } |
|
||||||
pallet_nfts::Call::transfer { .. } |
|
pallet_nfts::Call::transfer { .. } |
|
||||||
pallet_nfts::Call::lock_item_transfer { .. } |
|
pallet_nfts::Call::lock_item_transfer { .. } |
|
||||||
pallet_nfts::Call::unlock_item_transfer { .. } |
|
pallet_nfts::Call::unlock_item_transfer { .. } |
|
||||||
pallet_nfts::Call::lock_collection { .. } |
|
pallet_nfts::Call::lock_collection { .. } |
|
||||||
pallet_nfts::Call::transfer_ownership { .. } |
|
pallet_nfts::Call::transfer_ownership { .. } |
|
||||||
pallet_nfts::Call::set_team { .. } |
|
pallet_nfts::Call::set_team { .. } |
|
||||||
pallet_nfts::Call::force_collection_owner { .. } |
|
pallet_nfts::Call::force_collection_owner { .. } |
|
||||||
pallet_nfts::Call::force_collection_config { .. } |
|
pallet_nfts::Call::force_collection_config { .. } |
|
||||||
pallet_nfts::Call::approve_transfer { .. } |
|
pallet_nfts::Call::approve_transfer { .. } |
|
||||||
pallet_nfts::Call::cancel_approval { .. } |
|
pallet_nfts::Call::cancel_approval { .. } |
|
||||||
pallet_nfts::Call::clear_all_transfer_approvals { .. } |
|
pallet_nfts::Call::clear_all_transfer_approvals { .. } |
|
||||||
pallet_nfts::Call::lock_item_properties { .. } |
|
pallet_nfts::Call::lock_item_properties { .. } |
|
||||||
pallet_nfts::Call::set_attribute { .. } |
|
pallet_nfts::Call::set_attribute { .. } |
|
||||||
pallet_nfts::Call::force_set_attribute { .. } |
|
pallet_nfts::Call::force_set_attribute { .. } |
|
||||||
pallet_nfts::Call::clear_attribute { .. } |
|
pallet_nfts::Call::clear_attribute { .. } |
|
||||||
pallet_nfts::Call::approve_item_attributes { .. } |
|
pallet_nfts::Call::approve_item_attributes { .. } |
|
||||||
pallet_nfts::Call::cancel_item_attributes_approval { .. } |
|
pallet_nfts::Call::cancel_item_attributes_approval { .. } |
|
||||||
pallet_nfts::Call::set_metadata { .. } |
|
pallet_nfts::Call::set_metadata { .. } |
|
||||||
pallet_nfts::Call::clear_metadata { .. } |
|
pallet_nfts::Call::clear_metadata { .. } |
|
||||||
pallet_nfts::Call::set_collection_metadata { .. } |
|
pallet_nfts::Call::set_collection_metadata { .. } |
|
||||||
pallet_nfts::Call::clear_collection_metadata { .. } |
|
pallet_nfts::Call::clear_collection_metadata { .. } |
|
||||||
pallet_nfts::Call::set_accept_ownership { .. } |
|
pallet_nfts::Call::set_accept_ownership { .. } |
|
||||||
pallet_nfts::Call::set_collection_max_supply { .. } |
|
pallet_nfts::Call::set_collection_max_supply { .. } |
|
||||||
pallet_nfts::Call::update_mint_settings { .. } |
|
pallet_nfts::Call::update_mint_settings { .. } |
|
||||||
pallet_nfts::Call::set_price { .. } |
|
pallet_nfts::Call::set_price { .. } |
|
||||||
pallet_nfts::Call::buy_item { .. } |
|
pallet_nfts::Call::buy_item { .. } |
|
||||||
pallet_nfts::Call::pay_tips { .. } |
|
pallet_nfts::Call::pay_tips { .. } |
|
||||||
pallet_nfts::Call::create_swap { .. } |
|
pallet_nfts::Call::create_swap { .. } |
|
||||||
pallet_nfts::Call::cancel_swap { .. } |
|
pallet_nfts::Call::cancel_swap { .. } |
|
||||||
pallet_nfts::Call::claim_swap { .. },
|
pallet_nfts::Call::claim_swap { .. },
|
||||||
) |
|
) | RuntimeCall::Uniques(
|
||||||
RuntimeCall::Uniques(
|
|
||||||
pallet_uniques::Call::create { .. } |
|
pallet_uniques::Call::create { .. } |
|
||||||
pallet_uniques::Call::force_create { .. } |
|
pallet_uniques::Call::force_create { .. } |
|
||||||
pallet_uniques::Call::destroy { .. } |
|
pallet_uniques::Call::destroy { .. } |
|
||||||
pallet_uniques::Call::mint { .. } |
|
pallet_uniques::Call::mint { .. } |
|
||||||
pallet_uniques::Call::burn { .. } |
|
pallet_uniques::Call::burn { .. } |
|
||||||
pallet_uniques::Call::transfer { .. } |
|
pallet_uniques::Call::transfer { .. } |
|
||||||
pallet_uniques::Call::freeze { .. } |
|
pallet_uniques::Call::freeze { .. } |
|
||||||
pallet_uniques::Call::thaw { .. } |
|
pallet_uniques::Call::thaw { .. } |
|
||||||
pallet_uniques::Call::freeze_collection { .. } |
|
pallet_uniques::Call::freeze_collection { .. } |
|
||||||
pallet_uniques::Call::thaw_collection { .. } |
|
pallet_uniques::Call::thaw_collection { .. } |
|
||||||
pallet_uniques::Call::transfer_ownership { .. } |
|
pallet_uniques::Call::transfer_ownership { .. } |
|
||||||
pallet_uniques::Call::set_team { .. } |
|
pallet_uniques::Call::set_team { .. } |
|
||||||
pallet_uniques::Call::approve_transfer { .. } |
|
pallet_uniques::Call::approve_transfer { .. } |
|
||||||
pallet_uniques::Call::cancel_approval { .. } |
|
pallet_uniques::Call::cancel_approval { .. } |
|
||||||
pallet_uniques::Call::force_item_status { .. } |
|
pallet_uniques::Call::force_item_status { .. } |
|
||||||
pallet_uniques::Call::set_attribute { .. } |
|
pallet_uniques::Call::set_attribute { .. } |
|
||||||
pallet_uniques::Call::clear_attribute { .. } |
|
pallet_uniques::Call::clear_attribute { .. } |
|
||||||
pallet_uniques::Call::set_metadata { .. } |
|
pallet_uniques::Call::set_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_metadata { .. } |
|
pallet_uniques::Call::clear_metadata { .. } |
|
||||||
pallet_uniques::Call::set_collection_metadata { .. } |
|
pallet_uniques::Call::set_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_collection_metadata { .. } |
|
pallet_uniques::Call::clear_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::set_accept_ownership { .. } |
|
pallet_uniques::Call::set_accept_ownership { .. } |
|
||||||
pallet_uniques::Call::set_collection_max_supply { .. } |
|
pallet_uniques::Call::set_collection_max_supply { .. } |
|
||||||
pallet_uniques::Call::set_price { .. } |
|
pallet_uniques::Call::set_price { .. } |
|
||||||
pallet_uniques::Call::buy_item { .. },
|
pallet_uniques::Call::buy_item { .. }
|
||||||
) => true,
|
)
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,19 +77,16 @@ fn test_asset_xcm_trader() {
|
|||||||
// Lets pay with: asset_amount_needed + asset_amount_extra
|
// Lets pay with: asset_amount_needed + asset_amount_extra
|
||||||
let asset_amount_extra = 100_u128;
|
let asset_amount_extra = 100_u128;
|
||||||
let asset: MultiAsset =
|
let asset: MultiAsset =
|
||||||
(asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into();
|
(asset_multilocation, asset_amount_needed + asset_amount_extra).into();
|
||||||
|
|
||||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||||
|
|
||||||
// Lets buy_weight and make sure buy_weight does not return an error
|
// Lets buy_weight and make sure buy_weight does not return an error
|
||||||
match trader.buy_weight(bought, asset.into()) {
|
let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok");
|
||||||
Ok(unused_assets) => {
|
// Check whether a correct amount of unused assets is returned
|
||||||
// Check whether a correct amount of unused assets is returned
|
assert_ok!(
|
||||||
assert_ok!(unused_assets
|
unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into())
|
||||||
.ensure_contains(&(asset_multilocation, asset_amount_extra).into()));
|
);
|
||||||
},
|
|
||||||
Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop trader
|
// Drop trader
|
||||||
drop(trader);
|
drop(trader);
|
||||||
@@ -150,7 +147,7 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
// lets calculate amount needed
|
// lets calculate amount needed
|
||||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Make sure buy_weight does not return an error
|
// Make sure buy_weight does not return an error
|
||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
||||||
@@ -224,7 +221,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
|
|||||||
"we are testing what happens when the amount does not exceed ED"
|
"we are testing what happens when the amount does not exceed ED"
|
||||||
);
|
);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Buy weight should return an error
|
// Buy weight should return an error
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
@@ -277,11 +274,11 @@ fn test_that_buying_ed_refund_does_not_refund() {
|
|||||||
|
|
||||||
// We know we will have to buy at least ED, so lets make sure first it will
|
// We know we will have to buy at least ED, so lets make sure first it will
|
||||||
// fail with a payment of less than ED
|
// fail with a payment of less than ED
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
|
|
||||||
// Now lets buy ED at least
|
// Now lets buy ED at least
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into();
|
let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into();
|
||||||
|
|
||||||
// Buy weight should work
|
// Buy weight should work
|
||||||
assert_ok!(trader.buy_weight(bought, asset.into()));
|
assert_ok!(trader.buy_weight(bought, asset.into()));
|
||||||
@@ -416,7 +413,7 @@ fn test_assets_balances_api_works() {
|
|||||||
let foreign_asset_minimum_asset_balance = 3333333_u128;
|
let foreign_asset_minimum_asset_balance = 3333333_u128;
|
||||||
assert_ok!(ForeignAssets::force_create(
|
assert_ok!(ForeignAssets::force_create(
|
||||||
RuntimeHelper::<Runtime>::root_origin(),
|
RuntimeHelper::<Runtime>::root_origin(),
|
||||||
foreign_asset_id_multilocation.clone().into(),
|
foreign_asset_id_multilocation,
|
||||||
AccountId::from(SOME_ASSET_ADMIN).into(),
|
AccountId::from(SOME_ASSET_ADMIN).into(),
|
||||||
false,
|
false,
|
||||||
foreign_asset_minimum_asset_balance
|
foreign_asset_minimum_asset_balance
|
||||||
@@ -425,7 +422,7 @@ fn test_assets_balances_api_works() {
|
|||||||
// We first mint enough asset for the account to exist for assets
|
// We first mint enough asset for the account to exist for assets
|
||||||
assert_ok!(ForeignAssets::mint(
|
assert_ok!(ForeignAssets::mint(
|
||||||
RuntimeHelper::<Runtime>::origin_of(AccountId::from(SOME_ASSET_ADMIN)),
|
RuntimeHelper::<Runtime>::origin_of(AccountId::from(SOME_ASSET_ADMIN)),
|
||||||
foreign_asset_id_multilocation.clone().into(),
|
foreign_asset_id_multilocation,
|
||||||
AccountId::from(ALICE).into(),
|
AccountId::from(ALICE).into(),
|
||||||
6 * foreign_asset_minimum_asset_balance
|
6 * foreign_asset_minimum_asset_balance
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -925,7 +925,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -960,7 +960,6 @@ impl_runtime_apis! {
|
|||||||
id: Concrete(GeneralIndex(i as u128).into()),
|
id: Concrete(GeneralIndex(i as u128).into()),
|
||||||
fun: Fungible(fungibles_amount * i as u128),
|
fun: Fungible(fungibles_amount * i as u128),
|
||||||
}
|
}
|
||||||
.into()
|
|
||||||
})
|
})
|
||||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||||
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
||||||
@@ -980,7 +979,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
DotLocation::get(),
|
DotLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(DotLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
}
|
}
|
||||||
@@ -994,7 +993,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(DotLocation::get()),
|
id: Concrete(DotLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -123,7 +122,7 @@ impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,85 +166,82 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. } |
|
||||||
pallet_collator_selection::Call::leave_intent { .. } |
|
pallet_collator_selection::Call::set_invulnerables { .. },
|
||||||
pallet_collator_selection::Call::set_invulnerables { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
||||||
RuntimeCall::DmpQueue(..) |
|
RuntimeCall::Assets(
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
pallet_assets::Call::create { .. } |
|
||||||
RuntimeCall::Assets(
|
pallet_assets::Call::force_create { .. } |
|
||||||
pallet_assets::Call::create { .. } |
|
pallet_assets::Call::start_destroy { .. } |
|
||||||
pallet_assets::Call::force_create { .. } |
|
pallet_assets::Call::destroy_accounts { .. } |
|
||||||
pallet_assets::Call::start_destroy { .. } |
|
pallet_assets::Call::destroy_approvals { .. } |
|
||||||
pallet_assets::Call::destroy_accounts { .. } |
|
pallet_assets::Call::finish_destroy { .. } |
|
||||||
pallet_assets::Call::destroy_approvals { .. } |
|
pallet_assets::Call::mint { .. } |
|
||||||
pallet_assets::Call::finish_destroy { .. } |
|
pallet_assets::Call::burn { .. } |
|
||||||
pallet_assets::Call::mint { .. } |
|
pallet_assets::Call::transfer { .. } |
|
||||||
pallet_assets::Call::burn { .. } |
|
pallet_assets::Call::transfer_keep_alive { .. } |
|
||||||
pallet_assets::Call::transfer { .. } |
|
pallet_assets::Call::force_transfer { .. } |
|
||||||
pallet_assets::Call::transfer_keep_alive { .. } |
|
pallet_assets::Call::freeze { .. } |
|
||||||
pallet_assets::Call::force_transfer { .. } |
|
pallet_assets::Call::thaw { .. } |
|
||||||
pallet_assets::Call::freeze { .. } |
|
pallet_assets::Call::freeze_asset { .. } |
|
||||||
pallet_assets::Call::thaw { .. } |
|
pallet_assets::Call::thaw_asset { .. } |
|
||||||
pallet_assets::Call::freeze_asset { .. } |
|
pallet_assets::Call::transfer_ownership { .. } |
|
||||||
pallet_assets::Call::thaw_asset { .. } |
|
pallet_assets::Call::set_team { .. } |
|
||||||
pallet_assets::Call::transfer_ownership { .. } |
|
pallet_assets::Call::clear_metadata { .. } |
|
||||||
pallet_assets::Call::set_team { .. } |
|
pallet_assets::Call::force_clear_metadata { .. } |
|
||||||
pallet_assets::Call::clear_metadata { .. } |
|
pallet_assets::Call::force_asset_status { .. } |
|
||||||
pallet_assets::Call::force_clear_metadata { .. } |
|
pallet_assets::Call::approve_transfer { .. } |
|
||||||
pallet_assets::Call::force_asset_status { .. } |
|
pallet_assets::Call::cancel_approval { .. } |
|
||||||
pallet_assets::Call::approve_transfer { .. } |
|
pallet_assets::Call::force_cancel_approval { .. } |
|
||||||
pallet_assets::Call::cancel_approval { .. } |
|
pallet_assets::Call::transfer_approved { .. } |
|
||||||
pallet_assets::Call::force_cancel_approval { .. } |
|
pallet_assets::Call::touch { .. } |
|
||||||
pallet_assets::Call::transfer_approved { .. } |
|
pallet_assets::Call::refund { .. },
|
||||||
pallet_assets::Call::touch { .. } |
|
) | RuntimeCall::Uniques(
|
||||||
pallet_assets::Call::refund { .. },
|
|
||||||
) |
|
|
||||||
RuntimeCall::Uniques(
|
|
||||||
pallet_uniques::Call::create { .. } |
|
pallet_uniques::Call::create { .. } |
|
||||||
pallet_uniques::Call::force_create { .. } |
|
pallet_uniques::Call::force_create { .. } |
|
||||||
pallet_uniques::Call::destroy { .. } |
|
pallet_uniques::Call::destroy { .. } |
|
||||||
pallet_uniques::Call::mint { .. } |
|
pallet_uniques::Call::mint { .. } |
|
||||||
pallet_uniques::Call::burn { .. } |
|
pallet_uniques::Call::burn { .. } |
|
||||||
pallet_uniques::Call::transfer { .. } |
|
pallet_uniques::Call::transfer { .. } |
|
||||||
pallet_uniques::Call::freeze { .. } |
|
pallet_uniques::Call::freeze { .. } |
|
||||||
pallet_uniques::Call::thaw { .. } |
|
pallet_uniques::Call::thaw { .. } |
|
||||||
pallet_uniques::Call::freeze_collection { .. } |
|
pallet_uniques::Call::freeze_collection { .. } |
|
||||||
pallet_uniques::Call::thaw_collection { .. } |
|
pallet_uniques::Call::thaw_collection { .. } |
|
||||||
pallet_uniques::Call::transfer_ownership { .. } |
|
pallet_uniques::Call::transfer_ownership { .. } |
|
||||||
pallet_uniques::Call::set_team { .. } |
|
pallet_uniques::Call::set_team { .. } |
|
||||||
pallet_uniques::Call::approve_transfer { .. } |
|
pallet_uniques::Call::approve_transfer { .. } |
|
||||||
pallet_uniques::Call::cancel_approval { .. } |
|
pallet_uniques::Call::cancel_approval { .. } |
|
||||||
pallet_uniques::Call::force_item_status { .. } |
|
pallet_uniques::Call::force_item_status { .. } |
|
||||||
pallet_uniques::Call::set_attribute { .. } |
|
pallet_uniques::Call::set_attribute { .. } |
|
||||||
pallet_uniques::Call::clear_attribute { .. } |
|
pallet_uniques::Call::clear_attribute { .. } |
|
||||||
pallet_uniques::Call::set_metadata { .. } |
|
pallet_uniques::Call::set_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_metadata { .. } |
|
pallet_uniques::Call::clear_metadata { .. } |
|
||||||
pallet_uniques::Call::set_collection_metadata { .. } |
|
pallet_uniques::Call::set_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_collection_metadata { .. } |
|
pallet_uniques::Call::clear_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::set_accept_ownership { .. } |
|
pallet_uniques::Call::set_accept_ownership { .. } |
|
||||||
pallet_uniques::Call::set_collection_max_supply { .. } |
|
pallet_uniques::Call::set_collection_max_supply { .. } |
|
||||||
pallet_uniques::Call::set_price { .. } |
|
pallet_uniques::Call::set_price { .. } |
|
||||||
pallet_uniques::Call::buy_item { .. },
|
pallet_uniques::Call::buy_item { .. },
|
||||||
) => true,
|
)
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,19 +80,16 @@ fn test_asset_xcm_trader() {
|
|||||||
// Lets pay with: asset_amount_needed + asset_amount_extra
|
// Lets pay with: asset_amount_needed + asset_amount_extra
|
||||||
let asset_amount_extra = 100_u128;
|
let asset_amount_extra = 100_u128;
|
||||||
let asset: MultiAsset =
|
let asset: MultiAsset =
|
||||||
(asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into();
|
(asset_multilocation, asset_amount_needed + asset_amount_extra).into();
|
||||||
|
|
||||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||||
|
|
||||||
// Lets buy_weight and make sure buy_weight does not return an error
|
// Lets buy_weight and make sure buy_weight does not return an error
|
||||||
match trader.buy_weight(bought, asset.into()) {
|
let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok");
|
||||||
Ok(unused_assets) => {
|
// Check whether a correct amount of unused assets is returned
|
||||||
// Check whether a correct amount of unused assets is returned
|
assert_ok!(
|
||||||
assert_ok!(unused_assets
|
unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into())
|
||||||
.ensure_contains(&(asset_multilocation, asset_amount_extra).into()));
|
);
|
||||||
},
|
|
||||||
Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop trader
|
// Drop trader
|
||||||
drop(trader);
|
drop(trader);
|
||||||
@@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
// lets calculate amount needed
|
// lets calculate amount needed
|
||||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Make sure buy_weight does not return an error
|
// Make sure buy_weight does not return an error
|
||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
||||||
@@ -233,7 +230,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
|
|||||||
"we are testing what happens when the amount does not exceed ED"
|
"we are testing what happens when the amount does not exceed ED"
|
||||||
);
|
);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Buy weight should return an error
|
// Buy weight should return an error
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
@@ -286,11 +283,11 @@ fn test_that_buying_ed_refund_does_not_refund() {
|
|||||||
|
|
||||||
// We know we will have to buy at least ED, so lets make sure first it will
|
// We know we will have to buy at least ED, so lets make sure first it will
|
||||||
// fail with a payment of less than ED
|
// fail with a payment of less than ED
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
|
|
||||||
// Now lets buy ED at least
|
// Now lets buy ED at least
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into();
|
let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into();
|
||||||
|
|
||||||
// Buy weight should work
|
// Buy weight should work
|
||||||
assert_ok!(trader.buy_weight(bought, asset.into()));
|
assert_ok!(trader.buy_weight(bought, asset.into()));
|
||||||
|
|||||||
@@ -134,12 +134,12 @@ impl<
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pallet_balances::GenesisConfig::<Runtime> { balances: self.balances.into() }
|
pallet_balances::GenesisConfig::<Runtime> { balances: self.balances }
|
||||||
.assimilate_storage(&mut t)
|
.assimilate_storage(&mut t)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
pallet_collator_selection::GenesisConfig::<Runtime> {
|
pallet_collator_selection::GenesisConfig::<Runtime> {
|
||||||
invulnerables: self.collators.clone().into(),
|
invulnerables: self.collators.clone(),
|
||||||
candidacy_bond: Default::default(),
|
candidacy_bond: Default::default(),
|
||||||
desired_candidates: Default::default(),
|
desired_candidates: Default::default(),
|
||||||
}
|
}
|
||||||
@@ -303,11 +303,10 @@ impl<Runtime: frame_system::Config + pallet_xcm::Config> RuntimeHelper<Runtime>
|
|||||||
.find_map(|e| match e {
|
.find_map(|e| match e {
|
||||||
pallet_xcm::Event::Attempted(outcome) => Some(outcome),
|
pallet_xcm::Event::Attempted(outcome) => Some(outcome),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
})
|
||||||
match outcome {
|
.expect("No `pallet_xcm::Event::Attempted(outcome)` event found!");
|
||||||
Some(outcome) => assert_outcome(outcome),
|
|
||||||
None => assert!(false, "No `pallet_xcm::Event::Attempted(outcome)` event found!"),
|
assert_outcome(outcome);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,8 +361,11 @@ pub fn mock_open_hrmp_channel<
|
|||||||
recipient: ParaId,
|
recipient: ParaId,
|
||||||
) {
|
) {
|
||||||
let n = 1_u32;
|
let n = 1_u32;
|
||||||
let mut sproof_builder = RelayStateSproofBuilder::default();
|
let mut sproof_builder = RelayStateSproofBuilder {
|
||||||
sproof_builder.para_id = sender;
|
para_id: sender,
|
||||||
|
hrmp_egress_channel_index: Some(vec![recipient]),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
sproof_builder.hrmp_channels.insert(
|
sproof_builder.hrmp_channels.insert(
|
||||||
HrmpChannelId { sender, recipient },
|
HrmpChannelId { sender, recipient },
|
||||||
AbridgedHrmpChannel {
|
AbridgedHrmpChannel {
|
||||||
@@ -375,7 +377,6 @@ pub fn mock_open_hrmp_channel<
|
|||||||
mqc_head: None,
|
mqc_head: None,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
sproof_builder.hrmp_egress_channel_index = Some(vec![recipient]);
|
|
||||||
|
|
||||||
let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof();
|
let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof();
|
||||||
let vfp = PersistedValidationData {
|
let vfp = PersistedValidationData {
|
||||||
@@ -388,7 +389,7 @@ pub fn mock_open_hrmp_channel<
|
|||||||
let inherent_data = {
|
let inherent_data = {
|
||||||
let mut inherent_data = InherentData::default();
|
let mut inherent_data = InherentData::default();
|
||||||
let system_inherent_data = ParachainInherentData {
|
let system_inherent_data = ParachainInherentData {
|
||||||
validation_data: vfp.clone(),
|
validation_data: vfp,
|
||||||
relay_chain_state,
|
relay_chain_state,
|
||||||
downward_messages: Default::default(),
|
downward_messages: Default::default(),
|
||||||
horizontal_messages: Default::default(),
|
horizontal_messages: Default::default(),
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ pub fn teleports_for_native_asset_works<
|
|||||||
BuyExecution {
|
BuyExecution {
|
||||||
fees: MultiAsset {
|
fees: MultiAsset {
|
||||||
id: Concrete(native_asset_id),
|
id: Concrete(native_asset_id),
|
||||||
fun: Fungible(buy_execution_fee_amount_eta.into()),
|
fun: Fungible(buy_execution_fee_amount_eta),
|
||||||
},
|
},
|
||||||
weight_limit: Limited(Weight::from_parts(303531000, 65536)),
|
weight_limit: Limited(Weight::from_parts(303531000, 65536)),
|
||||||
},
|
},
|
||||||
@@ -190,7 +190,7 @@ pub fn teleports_for_native_asset_works<
|
|||||||
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
||||||
dest,
|
dest,
|
||||||
dest_beneficiary,
|
dest_beneficiary,
|
||||||
(native_asset_id, native_asset_to_teleport_away.clone().into()),
|
(native_asset_id, native_asset_to_teleport_away.into()),
|
||||||
None,
|
None,
|
||||||
));
|
));
|
||||||
// check balances
|
// check balances
|
||||||
@@ -235,7 +235,7 @@ pub fn teleports_for_native_asset_works<
|
|||||||
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
||||||
dest,
|
dest,
|
||||||
dest_beneficiary,
|
dest_beneficiary,
|
||||||
(native_asset_id, native_asset_to_teleport_away.clone().into()),
|
(native_asset_id, native_asset_to_teleport_away.into()),
|
||||||
Some((runtime_para_id, other_para_id)),
|
Some((runtime_para_id, other_para_id)),
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ pub fn teleports_for_foreign_assets_works<
|
|||||||
WeightToFee::weight_to_fee(&Weight::from_parts(90_000_000_000, 0));
|
WeightToFee::weight_to_fee(&Weight::from_parts(90_000_000_000, 0));
|
||||||
let buy_execution_fee = MultiAsset {
|
let buy_execution_fee = MultiAsset {
|
||||||
id: Concrete(MultiLocation::parent()),
|
id: Concrete(MultiLocation::parent()),
|
||||||
fun: Fungible(buy_execution_fee_amount.into()),
|
fun: Fungible(buy_execution_fee_amount),
|
||||||
};
|
};
|
||||||
|
|
||||||
let teleported_foreign_asset_amount = 10000000000000;
|
let teleported_foreign_asset_amount = 10000000000000;
|
||||||
@@ -376,7 +376,7 @@ pub fn teleports_for_foreign_assets_works<
|
|||||||
.with_session_keys(collator_session_keys.session_keys())
|
.with_session_keys(collator_session_keys.session_keys())
|
||||||
.with_balances(vec![
|
.with_balances(vec![
|
||||||
(
|
(
|
||||||
foreign_creator_as_account_id.clone(),
|
foreign_creator_as_account_id,
|
||||||
existential_deposit + (buy_execution_fee_amount * 2).into(),
|
existential_deposit + (buy_execution_fee_amount * 2).into(),
|
||||||
),
|
),
|
||||||
(target_account.clone(), existential_deposit),
|
(target_account.clone(), existential_deposit),
|
||||||
@@ -441,7 +441,7 @@ pub fn teleports_for_foreign_assets_works<
|
|||||||
BuyExecution {
|
BuyExecution {
|
||||||
fees: MultiAsset {
|
fees: MultiAsset {
|
||||||
id: Concrete(MultiLocation::parent()),
|
id: Concrete(MultiLocation::parent()),
|
||||||
fun: Fungible(buy_execution_fee_amount.into()),
|
fun: Fungible(buy_execution_fee_amount),
|
||||||
},
|
},
|
||||||
weight_limit: Limited(Weight::from_parts(403531000, 65536)),
|
weight_limit: Limited(Weight::from_parts(403531000, 65536)),
|
||||||
},
|
},
|
||||||
@@ -536,7 +536,7 @@ pub fn teleports_for_foreign_assets_works<
|
|||||||
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
RuntimeHelper::<Runtime>::origin_of(target_account.clone()),
|
||||||
dest,
|
dest,
|
||||||
dest_beneficiary,
|
dest_beneficiary,
|
||||||
(foreign_asset_id_multilocation, asset_to_teleport_away.clone().into()),
|
(foreign_asset_id_multilocation, asset_to_teleport_away),
|
||||||
Some((runtime_para_id, foreign_para_id)),
|
Some((runtime_para_id, foreign_para_id)),
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -788,7 +788,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
|||||||
.execute_with(|| {
|
.execute_with(|| {
|
||||||
// create some asset class
|
// create some asset class
|
||||||
let asset_minimum_asset_balance = 3333333_u128;
|
let asset_minimum_asset_balance = 3333333_u128;
|
||||||
let asset_id_as_multilocation = AssetIdConverter::reverse_ref(&asset_id).unwrap();
|
let asset_id_as_multilocation = AssetIdConverter::reverse_ref(asset_id).unwrap();
|
||||||
assert_ok!(<pallet_assets::Pallet<Runtime, AssetsPalletInstance>>::force_create(
|
assert_ok!(<pallet_assets::Pallet<Runtime, AssetsPalletInstance>>::force_create(
|
||||||
RuntimeHelper::<Runtime>::root_origin(),
|
RuntimeHelper::<Runtime>::root_origin(),
|
||||||
asset_id.into(),
|
asset_id.into(),
|
||||||
@@ -869,7 +869,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
|||||||
id: charlie_account.clone().into()
|
id: charlie_account.clone().into()
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
(asset_id_as_multilocation, 1 * asset_minimum_asset_balance),
|
(asset_id_as_multilocation, asset_minimum_asset_balance),
|
||||||
),
|
),
|
||||||
XcmError::FailedToTransactAsset(Into::<&str>::into(
|
XcmError::FailedToTransactAsset(Into::<&str>::into(
|
||||||
sp_runtime::TokenError::CannotCreate
|
sp_runtime::TokenError::CannotCreate
|
||||||
@@ -890,7 +890,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
|||||||
parents: 0,
|
parents: 0,
|
||||||
interior: X1(AccountId32 { network: None, id: bob_account.clone().into() }),
|
interior: X1(AccountId32 { network: None, id: bob_account.clone().into() }),
|
||||||
},
|
},
|
||||||
(asset_id_as_multilocation, 1 * asset_minimum_asset_balance),
|
(asset_id_as_multilocation, asset_minimum_asset_balance),
|
||||||
),
|
),
|
||||||
Ok(_)
|
Ok(_)
|
||||||
));
|
));
|
||||||
@@ -908,7 +908,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
|||||||
asset_id.into(),
|
asset_id.into(),
|
||||||
&bob_account
|
&bob_account
|
||||||
),
|
),
|
||||||
(1 * asset_minimum_asset_balance).into()
|
asset_minimum_asset_balance.into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
<pallet_assets::Pallet<Runtime, AssetsPalletInstance>>::balance(
|
<pallet_assets::Pallet<Runtime, AssetsPalletInstance>>::balance(
|
||||||
@@ -1130,7 +1130,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
|||||||
// lets simulate this was triggered by relay chain from local consensus sibling parachain
|
// lets simulate this was triggered by relay chain from local consensus sibling parachain
|
||||||
let xcm = Xcm(vec![
|
let xcm = Xcm(vec![
|
||||||
WithdrawAsset(buy_execution_fee.clone().into()),
|
WithdrawAsset(buy_execution_fee.clone().into()),
|
||||||
BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited },
|
BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited },
|
||||||
Transact {
|
Transact {
|
||||||
origin_kind: OriginKind::Xcm,
|
origin_kind: OriginKind::Xcm,
|
||||||
require_weight_at_most: Weight::from_parts(40_000_000_000, 8000),
|
require_weight_at_most: Weight::from_parts(40_000_000_000, 8000),
|
||||||
@@ -1247,7 +1247,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
|||||||
});
|
});
|
||||||
let xcm = Xcm(vec![
|
let xcm = Xcm(vec![
|
||||||
WithdrawAsset(buy_execution_fee.clone().into()),
|
WithdrawAsset(buy_execution_fee.clone().into()),
|
||||||
BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited },
|
BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited },
|
||||||
Transact {
|
Transact {
|
||||||
origin_kind: OriginKind::Xcm,
|
origin_kind: OriginKind::Xcm,
|
||||||
require_weight_at_most: Weight::from_parts(20_000_000_000, 8000),
|
require_weight_at_most: Weight::from_parts(20_000_000_000, 8000),
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -1038,7 +1038,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -1073,7 +1073,6 @@ impl_runtime_apis! {
|
|||||||
id: Concrete(GeneralIndex(i as u128).into()),
|
id: Concrete(GeneralIndex(i as u128).into()),
|
||||||
fun: Fungible(fungibles_amount * i as u128),
|
fun: Fungible(fungibles_amount * i as u128),
|
||||||
}
|
}
|
||||||
.into()
|
|
||||||
})
|
})
|
||||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||||
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
|
||||||
@@ -1093,7 +1092,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
WestendLocation::get(),
|
WestendLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(WestendLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
|
|
||||||
@@ -1108,7 +1107,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(WestendLocation::get()),
|
id: Concrete(WestendLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -123,7 +122,7 @@ impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,155 +191,149 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(
|
||||||
RuntimeCall::DmpQueue(..) |
|
pallet_utility::Call::as_derivative { .. } |
|
||||||
RuntimeCall::Utility(
|
pallet_utility::Call::batch { .. } |
|
||||||
pallet_utility::Call::as_derivative { .. } |
|
pallet_utility::Call::batch_all { .. },
|
||||||
pallet_utility::Call::batch { .. } |
|
) | RuntimeCall::Assets(
|
||||||
pallet_utility::Call::batch_all { .. },
|
|
||||||
) |
|
|
||||||
RuntimeCall::Assets(
|
|
||||||
pallet_assets::Call::create { .. } |
|
pallet_assets::Call::create { .. } |
|
||||||
pallet_assets::Call::force_create { .. } |
|
pallet_assets::Call::force_create { .. } |
|
||||||
pallet_assets::Call::start_destroy { .. } |
|
pallet_assets::Call::start_destroy { .. } |
|
||||||
pallet_assets::Call::destroy_accounts { .. } |
|
pallet_assets::Call::destroy_accounts { .. } |
|
||||||
pallet_assets::Call::destroy_approvals { .. } |
|
pallet_assets::Call::destroy_approvals { .. } |
|
||||||
pallet_assets::Call::finish_destroy { .. } |
|
pallet_assets::Call::finish_destroy { .. } |
|
||||||
pallet_assets::Call::mint { .. } |
|
pallet_assets::Call::mint { .. } |
|
||||||
pallet_assets::Call::burn { .. } |
|
pallet_assets::Call::burn { .. } |
|
||||||
pallet_assets::Call::transfer { .. } |
|
pallet_assets::Call::transfer { .. } |
|
||||||
pallet_assets::Call::transfer_keep_alive { .. } |
|
pallet_assets::Call::transfer_keep_alive { .. } |
|
||||||
pallet_assets::Call::force_transfer { .. } |
|
pallet_assets::Call::force_transfer { .. } |
|
||||||
pallet_assets::Call::freeze { .. } |
|
pallet_assets::Call::freeze { .. } |
|
||||||
pallet_assets::Call::thaw { .. } |
|
pallet_assets::Call::thaw { .. } |
|
||||||
pallet_assets::Call::freeze_asset { .. } |
|
pallet_assets::Call::freeze_asset { .. } |
|
||||||
pallet_assets::Call::thaw_asset { .. } |
|
pallet_assets::Call::thaw_asset { .. } |
|
||||||
pallet_assets::Call::transfer_ownership { .. } |
|
pallet_assets::Call::transfer_ownership { .. } |
|
||||||
pallet_assets::Call::set_team { .. } |
|
pallet_assets::Call::set_team { .. } |
|
||||||
pallet_assets::Call::clear_metadata { .. } |
|
pallet_assets::Call::clear_metadata { .. } |
|
||||||
pallet_assets::Call::force_clear_metadata { .. } |
|
pallet_assets::Call::force_clear_metadata { .. } |
|
||||||
pallet_assets::Call::force_asset_status { .. } |
|
pallet_assets::Call::force_asset_status { .. } |
|
||||||
pallet_assets::Call::approve_transfer { .. } |
|
pallet_assets::Call::approve_transfer { .. } |
|
||||||
pallet_assets::Call::cancel_approval { .. } |
|
pallet_assets::Call::cancel_approval { .. } |
|
||||||
pallet_assets::Call::force_cancel_approval { .. } |
|
pallet_assets::Call::force_cancel_approval { .. } |
|
||||||
pallet_assets::Call::transfer_approved { .. } |
|
pallet_assets::Call::transfer_approved { .. } |
|
||||||
pallet_assets::Call::touch { .. } |
|
pallet_assets::Call::touch { .. } |
|
||||||
pallet_assets::Call::refund { .. },
|
pallet_assets::Call::refund { .. },
|
||||||
) |
|
) | RuntimeCall::ForeignAssets(
|
||||||
RuntimeCall::ForeignAssets(
|
|
||||||
pallet_assets::Call::create { .. } |
|
pallet_assets::Call::create { .. } |
|
||||||
pallet_assets::Call::force_create { .. } |
|
pallet_assets::Call::force_create { .. } |
|
||||||
pallet_assets::Call::start_destroy { .. } |
|
pallet_assets::Call::start_destroy { .. } |
|
||||||
pallet_assets::Call::destroy_accounts { .. } |
|
pallet_assets::Call::destroy_accounts { .. } |
|
||||||
pallet_assets::Call::destroy_approvals { .. } |
|
pallet_assets::Call::destroy_approvals { .. } |
|
||||||
pallet_assets::Call::finish_destroy { .. } |
|
pallet_assets::Call::finish_destroy { .. } |
|
||||||
pallet_assets::Call::mint { .. } |
|
pallet_assets::Call::mint { .. } |
|
||||||
pallet_assets::Call::burn { .. } |
|
pallet_assets::Call::burn { .. } |
|
||||||
pallet_assets::Call::transfer { .. } |
|
pallet_assets::Call::transfer { .. } |
|
||||||
pallet_assets::Call::transfer_keep_alive { .. } |
|
pallet_assets::Call::transfer_keep_alive { .. } |
|
||||||
pallet_assets::Call::force_transfer { .. } |
|
pallet_assets::Call::force_transfer { .. } |
|
||||||
pallet_assets::Call::freeze { .. } |
|
pallet_assets::Call::freeze { .. } |
|
||||||
pallet_assets::Call::thaw { .. } |
|
pallet_assets::Call::thaw { .. } |
|
||||||
pallet_assets::Call::freeze_asset { .. } |
|
pallet_assets::Call::freeze_asset { .. } |
|
||||||
pallet_assets::Call::thaw_asset { .. } |
|
pallet_assets::Call::thaw_asset { .. } |
|
||||||
pallet_assets::Call::transfer_ownership { .. } |
|
pallet_assets::Call::transfer_ownership { .. } |
|
||||||
pallet_assets::Call::set_team { .. } |
|
pallet_assets::Call::set_team { .. } |
|
||||||
pallet_assets::Call::set_metadata { .. } |
|
pallet_assets::Call::set_metadata { .. } |
|
||||||
pallet_assets::Call::clear_metadata { .. } |
|
pallet_assets::Call::clear_metadata { .. } |
|
||||||
pallet_assets::Call::force_clear_metadata { .. } |
|
pallet_assets::Call::force_clear_metadata { .. } |
|
||||||
pallet_assets::Call::force_asset_status { .. } |
|
pallet_assets::Call::force_asset_status { .. } |
|
||||||
pallet_assets::Call::approve_transfer { .. } |
|
pallet_assets::Call::approve_transfer { .. } |
|
||||||
pallet_assets::Call::cancel_approval { .. } |
|
pallet_assets::Call::cancel_approval { .. } |
|
||||||
pallet_assets::Call::force_cancel_approval { .. } |
|
pallet_assets::Call::force_cancel_approval { .. } |
|
||||||
pallet_assets::Call::transfer_approved { .. } |
|
pallet_assets::Call::transfer_approved { .. } |
|
||||||
pallet_assets::Call::touch { .. } |
|
pallet_assets::Call::touch { .. } |
|
||||||
pallet_assets::Call::refund { .. },
|
pallet_assets::Call::refund { .. },
|
||||||
) |
|
) | RuntimeCall::Nfts(
|
||||||
RuntimeCall::Nfts(
|
|
||||||
pallet_nfts::Call::create { .. } |
|
pallet_nfts::Call::create { .. } |
|
||||||
pallet_nfts::Call::force_create { .. } |
|
pallet_nfts::Call::force_create { .. } |
|
||||||
pallet_nfts::Call::destroy { .. } |
|
pallet_nfts::Call::destroy { .. } |
|
||||||
pallet_nfts::Call::mint { .. } |
|
pallet_nfts::Call::mint { .. } |
|
||||||
pallet_nfts::Call::force_mint { .. } |
|
pallet_nfts::Call::force_mint { .. } |
|
||||||
pallet_nfts::Call::burn { .. } |
|
pallet_nfts::Call::burn { .. } |
|
||||||
pallet_nfts::Call::transfer { .. } |
|
pallet_nfts::Call::transfer { .. } |
|
||||||
pallet_nfts::Call::lock_item_transfer { .. } |
|
pallet_nfts::Call::lock_item_transfer { .. } |
|
||||||
pallet_nfts::Call::unlock_item_transfer { .. } |
|
pallet_nfts::Call::unlock_item_transfer { .. } |
|
||||||
pallet_nfts::Call::lock_collection { .. } |
|
pallet_nfts::Call::lock_collection { .. } |
|
||||||
pallet_nfts::Call::transfer_ownership { .. } |
|
pallet_nfts::Call::transfer_ownership { .. } |
|
||||||
pallet_nfts::Call::set_team { .. } |
|
pallet_nfts::Call::set_team { .. } |
|
||||||
pallet_nfts::Call::force_collection_owner { .. } |
|
pallet_nfts::Call::force_collection_owner { .. } |
|
||||||
pallet_nfts::Call::force_collection_config { .. } |
|
pallet_nfts::Call::force_collection_config { .. } |
|
||||||
pallet_nfts::Call::approve_transfer { .. } |
|
pallet_nfts::Call::approve_transfer { .. } |
|
||||||
pallet_nfts::Call::cancel_approval { .. } |
|
pallet_nfts::Call::cancel_approval { .. } |
|
||||||
pallet_nfts::Call::clear_all_transfer_approvals { .. } |
|
pallet_nfts::Call::clear_all_transfer_approvals { .. } |
|
||||||
pallet_nfts::Call::lock_item_properties { .. } |
|
pallet_nfts::Call::lock_item_properties { .. } |
|
||||||
pallet_nfts::Call::set_attribute { .. } |
|
pallet_nfts::Call::set_attribute { .. } |
|
||||||
pallet_nfts::Call::force_set_attribute { .. } |
|
pallet_nfts::Call::force_set_attribute { .. } |
|
||||||
pallet_nfts::Call::clear_attribute { .. } |
|
pallet_nfts::Call::clear_attribute { .. } |
|
||||||
pallet_nfts::Call::approve_item_attributes { .. } |
|
pallet_nfts::Call::approve_item_attributes { .. } |
|
||||||
pallet_nfts::Call::cancel_item_attributes_approval { .. } |
|
pallet_nfts::Call::cancel_item_attributes_approval { .. } |
|
||||||
pallet_nfts::Call::set_metadata { .. } |
|
pallet_nfts::Call::set_metadata { .. } |
|
||||||
pallet_nfts::Call::clear_metadata { .. } |
|
pallet_nfts::Call::clear_metadata { .. } |
|
||||||
pallet_nfts::Call::set_collection_metadata { .. } |
|
pallet_nfts::Call::set_collection_metadata { .. } |
|
||||||
pallet_nfts::Call::clear_collection_metadata { .. } |
|
pallet_nfts::Call::clear_collection_metadata { .. } |
|
||||||
pallet_nfts::Call::set_accept_ownership { .. } |
|
pallet_nfts::Call::set_accept_ownership { .. } |
|
||||||
pallet_nfts::Call::set_collection_max_supply { .. } |
|
pallet_nfts::Call::set_collection_max_supply { .. } |
|
||||||
pallet_nfts::Call::update_mint_settings { .. } |
|
pallet_nfts::Call::update_mint_settings { .. } |
|
||||||
pallet_nfts::Call::set_price { .. } |
|
pallet_nfts::Call::set_price { .. } |
|
||||||
pallet_nfts::Call::buy_item { .. } |
|
pallet_nfts::Call::buy_item { .. } |
|
||||||
pallet_nfts::Call::pay_tips { .. } |
|
pallet_nfts::Call::pay_tips { .. } |
|
||||||
pallet_nfts::Call::create_swap { .. } |
|
pallet_nfts::Call::create_swap { .. } |
|
||||||
pallet_nfts::Call::cancel_swap { .. } |
|
pallet_nfts::Call::cancel_swap { .. } |
|
||||||
pallet_nfts::Call::claim_swap { .. },
|
pallet_nfts::Call::claim_swap { .. },
|
||||||
) |
|
) | RuntimeCall::Uniques(
|
||||||
RuntimeCall::Uniques(
|
|
||||||
pallet_uniques::Call::create { .. } |
|
pallet_uniques::Call::create { .. } |
|
||||||
pallet_uniques::Call::force_create { .. } |
|
pallet_uniques::Call::force_create { .. } |
|
||||||
pallet_uniques::Call::destroy { .. } |
|
pallet_uniques::Call::destroy { .. } |
|
||||||
pallet_uniques::Call::mint { .. } |
|
pallet_uniques::Call::mint { .. } |
|
||||||
pallet_uniques::Call::burn { .. } |
|
pallet_uniques::Call::burn { .. } |
|
||||||
pallet_uniques::Call::transfer { .. } |
|
pallet_uniques::Call::transfer { .. } |
|
||||||
pallet_uniques::Call::freeze { .. } |
|
pallet_uniques::Call::freeze { .. } |
|
||||||
pallet_uniques::Call::thaw { .. } |
|
pallet_uniques::Call::thaw { .. } |
|
||||||
pallet_uniques::Call::freeze_collection { .. } |
|
pallet_uniques::Call::freeze_collection { .. } |
|
||||||
pallet_uniques::Call::thaw_collection { .. } |
|
pallet_uniques::Call::thaw_collection { .. } |
|
||||||
pallet_uniques::Call::transfer_ownership { .. } |
|
pallet_uniques::Call::transfer_ownership { .. } |
|
||||||
pallet_uniques::Call::set_team { .. } |
|
pallet_uniques::Call::set_team { .. } |
|
||||||
pallet_uniques::Call::approve_transfer { .. } |
|
pallet_uniques::Call::approve_transfer { .. } |
|
||||||
pallet_uniques::Call::cancel_approval { .. } |
|
pallet_uniques::Call::cancel_approval { .. } |
|
||||||
pallet_uniques::Call::force_item_status { .. } |
|
pallet_uniques::Call::force_item_status { .. } |
|
||||||
pallet_uniques::Call::set_attribute { .. } |
|
pallet_uniques::Call::set_attribute { .. } |
|
||||||
pallet_uniques::Call::clear_attribute { .. } |
|
pallet_uniques::Call::clear_attribute { .. } |
|
||||||
pallet_uniques::Call::set_metadata { .. } |
|
pallet_uniques::Call::set_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_metadata { .. } |
|
pallet_uniques::Call::clear_metadata { .. } |
|
||||||
pallet_uniques::Call::set_collection_metadata { .. } |
|
pallet_uniques::Call::set_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::clear_collection_metadata { .. } |
|
pallet_uniques::Call::clear_collection_metadata { .. } |
|
||||||
pallet_uniques::Call::set_accept_ownership { .. } |
|
pallet_uniques::Call::set_accept_ownership { .. } |
|
||||||
pallet_uniques::Call::set_collection_max_supply { .. } |
|
pallet_uniques::Call::set_collection_max_supply { .. } |
|
||||||
pallet_uniques::Call::set_price { .. } |
|
pallet_uniques::Call::set_price { .. } |
|
||||||
pallet_uniques::Call::buy_item { .. },
|
pallet_uniques::Call::buy_item { .. },
|
||||||
) => true,
|
)
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,19 +84,16 @@ fn test_asset_xcm_trader() {
|
|||||||
// Lets pay with: asset_amount_needed + asset_amount_extra
|
// Lets pay with: asset_amount_needed + asset_amount_extra
|
||||||
let asset_amount_extra = 100_u128;
|
let asset_amount_extra = 100_u128;
|
||||||
let asset: MultiAsset =
|
let asset: MultiAsset =
|
||||||
(asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into();
|
(asset_multilocation, asset_amount_needed + asset_amount_extra).into();
|
||||||
|
|
||||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||||
|
|
||||||
// Lets buy_weight and make sure buy_weight does not return an error
|
// Lets buy_weight and make sure buy_weight does not return an error
|
||||||
match trader.buy_weight(bought, asset.into()) {
|
let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok");
|
||||||
Ok(unused_assets) => {
|
// Check whether a correct amount of unused assets is returned
|
||||||
// Check whether a correct amount of unused assets is returned
|
assert_ok!(
|
||||||
assert_ok!(unused_assets
|
unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into())
|
||||||
.ensure_contains(&(asset_multilocation, asset_amount_extra).into()));
|
);
|
||||||
},
|
|
||||||
Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop trader
|
// Drop trader
|
||||||
drop(trader);
|
drop(trader);
|
||||||
@@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
// lets calculate amount needed
|
// lets calculate amount needed
|
||||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Make sure buy_weight does not return an error
|
// Make sure buy_weight does not return an error
|
||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
||||||
@@ -230,7 +227,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
|
|||||||
"we are testing what happens when the amount does not exceed ED"
|
"we are testing what happens when the amount does not exceed ED"
|
||||||
);
|
);
|
||||||
|
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
|
|
||||||
// Buy weight should return an error
|
// Buy weight should return an error
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
@@ -282,11 +279,11 @@ fn test_that_buying_ed_refund_does_not_refund() {
|
|||||||
|
|
||||||
// We know we will have to buy at least ED, so lets make sure first it will
|
// We know we will have to buy at least ED, so lets make sure first it will
|
||||||
// fail with a payment of less than ED
|
// fail with a payment of less than ED
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
let asset: MultiAsset = (asset_multilocation, amount_bought).into();
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||||
|
|
||||||
// Now lets buy ED at least
|
// Now lets buy ED at least
|
||||||
let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into();
|
let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into();
|
||||||
|
|
||||||
// Buy weight should work
|
// Buy weight should work
|
||||||
assert_ok!(trader.buy_weight(bought, asset.into()));
|
assert_ok!(trader.buy_weight(bought, asset.into()));
|
||||||
@@ -421,7 +418,7 @@ fn test_assets_balances_api_works() {
|
|||||||
let foreign_asset_minimum_asset_balance = 3333333_u128;
|
let foreign_asset_minimum_asset_balance = 3333333_u128;
|
||||||
assert_ok!(ForeignAssets::force_create(
|
assert_ok!(ForeignAssets::force_create(
|
||||||
RuntimeHelper::<Runtime>::root_origin(),
|
RuntimeHelper::<Runtime>::root_origin(),
|
||||||
foreign_asset_id_multilocation.clone().into(),
|
foreign_asset_id_multilocation,
|
||||||
AccountId::from(SOME_ASSET_ADMIN).into(),
|
AccountId::from(SOME_ASSET_ADMIN).into(),
|
||||||
false,
|
false,
|
||||||
foreign_asset_minimum_asset_balance
|
foreign_asset_minimum_asset_balance
|
||||||
@@ -430,7 +427,7 @@ fn test_assets_balances_api_works() {
|
|||||||
// We first mint enough asset for the account to exist for assets
|
// We first mint enough asset for the account to exist for assets
|
||||||
assert_ok!(ForeignAssets::mint(
|
assert_ok!(ForeignAssets::mint(
|
||||||
RuntimeHelper::<Runtime>::origin_of(AccountId::from(SOME_ASSET_ADMIN)),
|
RuntimeHelper::<Runtime>::origin_of(AccountId::from(SOME_ASSET_ADMIN)),
|
||||||
foreign_asset_id_multilocation.clone().into(),
|
foreign_asset_id_multilocation,
|
||||||
AccountId::from(ALICE).into(),
|
AccountId::from(ALICE).into(),
|
||||||
6 * foreign_asset_minimum_asset_balance
|
6 * foreign_asset_minimum_asset_balance
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -615,7 +615,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -653,7 +653,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
KsmRelayLocation::get(),
|
KsmRelayLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmRelayLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(KsmRelayLocation::get()),
|
id: Concrete(KsmRelayLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubKusamaXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -123,7 +122,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubKusamaXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,29 +129,27 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. })
|
||||||
RuntimeCall::DmpQueue(..) |
|
)
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -615,7 +615,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -653,7 +653,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
DotRelayLocation::get(),
|
DotRelayLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotRelayLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(DotRelayLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(DotRelayLocation::get()),
|
id: Concrete(DotRelayLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubPolkadotXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -123,7 +122,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubPolkadotXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubPolkadotXcmWeight<Call> {
|
|||||||
_xcm: &Xcm<()>,
|
_xcm: &Xcm<()>,
|
||||||
) -> Weight {
|
) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(200_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(200_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,29 +132,27 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. })
|
||||||
RuntimeCall::DmpQueue(..) |
|
)
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -888,7 +888,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -926,7 +926,7 @@ impl_runtime_apis! {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
RelayLocation::get(),
|
RelayLocation::get(),
|
||||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::get()) },
|
MultiAsset { fun: Fungible(UNITS), id: Concrete(RelayLocation::get()) },
|
||||||
));
|
));
|
||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||||
}
|
}
|
||||||
@@ -940,7 +940,7 @@ impl_runtime_apis! {
|
|||||||
fn get_multi_asset() -> MultiAsset {
|
fn get_multi_asset() -> MultiAsset {
|
||||||
MultiAsset {
|
MultiAsset {
|
||||||
id: Concrete(RelayLocation::get()),
|
id: Concrete(RelayLocation::get()),
|
||||||
fun: Fungible(1 * UNITS),
|
fun: Fungible(UNITS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ const MAX_ASSETS: u64 = 100;
|
|||||||
impl WeighMultiAssets for MultiAssetFilter {
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
match self {
|
match self {
|
||||||
Self::Definite(assets) =>
|
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||||
weight.saturating_mul(assets.inner().into_iter().count() as u64),
|
|
||||||
Self::Wild(asset) => match asset {
|
Self::Wild(asset) => match asset {
|
||||||
All => weight.saturating_mul(MAX_ASSETS),
|
All => weight.saturating_mul(MAX_ASSETS),
|
||||||
AllOf { fun, .. } => match fun {
|
AllOf { fun, .. } => match fun {
|
||||||
@@ -54,7 +53,7 @@ impl WeighMultiAssets for MultiAssetFilter {
|
|||||||
|
|
||||||
impl WeighMultiAssets for MultiAssets {
|
impl WeighMultiAssets for MultiAssets {
|
||||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||||
weight.saturating_mul(self.inner().into_iter().count() as u64)
|
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubRococoXcmWeight<Call> {
|
|||||||
// Currently there is no trusted reserve
|
// Currently there is no trusted reserve
|
||||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||||
Weight::from_parts(1_000_000_000 as u64, 0)
|
Weight::from_parts(1_000_000_000_u64, 0)
|
||||||
}
|
}
|
||||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||||
@@ -124,7 +123,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubRococoXcmWeight<Call> {
|
|||||||
|
|
||||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||||
// Hardcoded till the XCM pallet is fixed
|
// Hardcoded till the XCM pallet is fixed
|
||||||
let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0);
|
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||||
hardcoded_weight.min(weight)
|
hardcoded_weight.min(weight)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -347,11 +347,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Storage: BridgeWococoMessages OutboundMessages (r:0 w:1)
|
// Storage: BridgeWococoMessages OutboundMessages (r:0 w:1)
|
||||||
// Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen)
|
// Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen)
|
||||||
pub(crate) fn export_message(x: u32, ) -> Weight {
|
pub(crate) fn export_message(x: u32, ) -> Weight {
|
||||||
Weight::from_parts(31_677_716 as u64, 0)
|
Weight::from_parts(31_677_716_u64, 0)
|
||||||
// Standard Error: 4_158
|
// Standard Error: 4_158
|
||||||
.saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64))
|
.saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64))
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||||
}
|
}
|
||||||
pub fn unpaid_execution() -> Weight {
|
pub fn unpaid_execution() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
|
|||||||
@@ -152,41 +152,35 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
||||||
RuntimeCall::DmpQueue(..) |
|
RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::<
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
Runtime,
|
||||||
RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::<
|
BridgeGrandpaRococoInstance,
|
||||||
Runtime,
|
>::initialize { .. }) |
|
||||||
BridgeGrandpaRococoInstance,
|
RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::<
|
||||||
>::initialize {
|
Runtime,
|
||||||
..
|
BridgeGrandpaWococoInstance,
|
||||||
}) |
|
>::initialize { .. })
|
||||||
RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::<
|
)
|
||||||
Runtime,
|
|
||||||
BridgeGrandpaWococoInstance,
|
|
||||||
>::initialize {
|
|
||||||
..
|
|
||||||
}) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
|
|||||||
// check queue before
|
// check queue before
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pallet_bridge_messages::OutboundLanes::<Runtime, MessagesPalletInstance>::try_get(
|
pallet_bridge_messages::OutboundLanes::<Runtime, MessagesPalletInstance>::try_get(
|
||||||
&expected_lane_id
|
expected_lane_id
|
||||||
),
|
),
|
||||||
Err(())
|
Err(())
|
||||||
);
|
);
|
||||||
@@ -190,7 +190,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
|
|||||||
// check queue after
|
// check queue after
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pallet_bridge_messages::OutboundLanes::<Runtime, MessagesPalletInstance>::try_get(
|
pallet_bridge_messages::OutboundLanes::<Runtime, MessagesPalletInstance>::try_get(
|
||||||
&expected_lane_id
|
expected_lane_id
|
||||||
),
|
),
|
||||||
Ok(OutboundLaneData {
|
Ok(OutboundLaneData {
|
||||||
oldest_unpruned_nonce: 1,
|
oldest_unpruned_nonce: 1,
|
||||||
@@ -243,8 +243,8 @@ macro_rules! include_handle_export_message_from_system_parachain_to_outbound_que
|
|||||||
/// Test-case makes sure that Runtime can route XCM messages received in inbound queue,
|
/// Test-case makes sure that Runtime can route XCM messages received in inbound queue,
|
||||||
/// We just test here `MessageDispatch` configuration.
|
/// We just test here `MessageDispatch` configuration.
|
||||||
/// We expect that runtime can route messages:
|
/// We expect that runtime can route messages:
|
||||||
/// 1. to Parent (relay chain)
|
/// 1. to Parent (relay chain)
|
||||||
/// 2. to Sibling parachain
|
/// 2. to Sibling parachain
|
||||||
pub fn message_dispatch_routing_works<
|
pub fn message_dispatch_routing_works<
|
||||||
Runtime,
|
Runtime,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ pub(crate) mod import_kusama_fellowship {
|
|||||||
#[cfg(feature = "try-runtime")]
|
#[cfg(feature = "try-runtime")]
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
|
||||||
const TARGET: &'static str = "runtime::migration::import_fellowship";
|
const TARGET: &str = "runtime::migration::import_fellowship";
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
// The Fellowship addresses from Kusama state.
|
// The Fellowship addresses from Kusama state.
|
||||||
@@ -250,7 +250,7 @@ pub mod tests {
|
|||||||
assert!(IdToIndex::<Runtime, Fellowship>::get(0, &who).is_some());
|
assert!(IdToIndex::<Runtime, Fellowship>::get(0, &who).is_some());
|
||||||
assert!(IdToIndex::<Runtime, Fellowship>::get(rank + 1, &who).is_none());
|
assert!(IdToIndex::<Runtime, Fellowship>::get(rank + 1, &who).is_none());
|
||||||
let index = IdToIndex::<Runtime, Fellowship>::get(rank, &who).unwrap();
|
let index = IdToIndex::<Runtime, Fellowship>::get(rank, &who).unwrap();
|
||||||
assert_eq!(IndexToId::<Runtime, Fellowship>::get(rank, &index).unwrap(), who);
|
assert_eq!(IndexToId::<Runtime, Fellowship>::get(rank, index).unwrap(), who);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Members::<Runtime, Fellowship>::get(&who).unwrap(),
|
Members::<Runtime, Fellowship>::get(&who).unwrap(),
|
||||||
MemberRecord::new(rank)
|
MemberRecord::new(rank)
|
||||||
|
|||||||
+15
-15
@@ -54,7 +54,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -76,7 +76,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -98,7 +98,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -120,7 +120,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -142,7 +142,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -160,11 +160,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "experts",
|
name: "experts",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 1 * DOLLARS,
|
decision_deposit: DOLLARS,
|
||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -182,11 +182,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "senior experts",
|
name: "senior experts",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 1 * DOLLARS,
|
decision_deposit: DOLLARS,
|
||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -204,11 +204,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "masters",
|
name: "masters",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 1 * DOLLARS,
|
decision_deposit: DOLLARS,
|
||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -226,11 +226,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "senior masters",
|
name: "senior masters",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 1 * DOLLARS,
|
decision_deposit: DOLLARS,
|
||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -248,11 +248,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "grand masters",
|
name: "grand masters",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 1 * DOLLARS,
|
decision_deposit: DOLLARS,
|
||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 1 * MINUTES,
|
min_enactment_period: MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ where
|
|||||||
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
|
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
|
||||||
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();
|
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();
|
||||||
|
|
||||||
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc.clone(), amount);
|
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc, amount);
|
||||||
|
|
||||||
let result = <pallet_xcm::Pallet<T>>::teleport_assets(
|
let result = <pallet_xcm::Pallet<T>>::teleport_assets(
|
||||||
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
|
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
|
||||||
@@ -73,10 +73,9 @@ where
|
|||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
match result {
|
if let Err(err) = result {
|
||||||
Err(err) => log::warn!("Failed to teleport slashed assets: {:?}", err),
|
log::warn!("Failed to teleport slashed assets: {:?}", err);
|
||||||
_ => (),
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Relay Chain `TransactionByteFee` / 10
|
/// Relay Chain `TransactionByteFee` / 10
|
||||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
pub const TransactionByteFee: Balance = MILLICENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
@@ -843,7 +843,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
@@ -899,7 +899,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
|
|||||||
.create_inherent_data()
|
.create_inherent_data()
|
||||||
.expect("Could not create the timestamp inherent data");
|
.expect("Could not create the timestamp inherent data");
|
||||||
|
|
||||||
inherent_data.check_extrinsics(&block)
|
inherent_data.check_extrinsics(block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,58 +137,54 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match call {
|
matches!(
|
||||||
|
call,
|
||||||
RuntimeCall::System(
|
RuntimeCall::System(
|
||||||
frame_system::Call::set_heap_pages { .. } |
|
frame_system::Call::set_heap_pages { .. } |
|
||||||
frame_system::Call::set_code { .. } |
|
frame_system::Call::set_code { .. } |
|
||||||
frame_system::Call::set_code_without_checks { .. } |
|
frame_system::Call::set_code_without_checks { .. } |
|
||||||
frame_system::Call::kill_prefix { .. },
|
frame_system::Call::kill_prefix { .. },
|
||||||
) |
|
) | RuntimeCall::ParachainSystem(..) |
|
||||||
RuntimeCall::ParachainSystem(..) |
|
RuntimeCall::Timestamp(..) |
|
||||||
RuntimeCall::Timestamp(..) |
|
RuntimeCall::Balances(..) |
|
||||||
RuntimeCall::Balances(..) |
|
RuntimeCall::CollatorSelection(
|
||||||
RuntimeCall::CollatorSelection(
|
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
||||||
pallet_collator_selection::Call::set_desired_candidates { .. } |
|
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
||||||
pallet_collator_selection::Call::set_candidacy_bond { .. } |
|
pallet_collator_selection::Call::register_as_candidate { .. } |
|
||||||
pallet_collator_selection::Call::register_as_candidate { .. } |
|
pallet_collator_selection::Call::leave_intent { .. },
|
||||||
pallet_collator_selection::Call::leave_intent { .. },
|
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||||
) |
|
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
||||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
RuntimeCall::XcmpQueue(..) |
|
||||||
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
|
RuntimeCall::DmpQueue(..) |
|
||||||
RuntimeCall::XcmpQueue(..) |
|
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
||||||
RuntimeCall::DmpQueue(..) |
|
RuntimeCall::Alliance(
|
||||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
// `init_members` accepts unbounded vecs as arguments,
|
||||||
RuntimeCall::Alliance(
|
// but the call can be initiated only by root origin.
|
||||||
// `init_members` accepts unbounded vecs as arguments,
|
pallet_alliance::Call::init_members { .. } |
|
||||||
// but the call can be initiated only by root origin.
|
pallet_alliance::Call::vote { .. } |
|
||||||
pallet_alliance::Call::init_members { .. } |
|
pallet_alliance::Call::disband { .. } |
|
||||||
pallet_alliance::Call::vote { .. } |
|
pallet_alliance::Call::set_rule { .. } |
|
||||||
pallet_alliance::Call::disband { .. } |
|
pallet_alliance::Call::announce { .. } |
|
||||||
pallet_alliance::Call::set_rule { .. } |
|
pallet_alliance::Call::remove_announcement { .. } |
|
||||||
pallet_alliance::Call::announce { .. } |
|
pallet_alliance::Call::join_alliance { .. } |
|
||||||
pallet_alliance::Call::remove_announcement { .. } |
|
pallet_alliance::Call::nominate_ally { .. } |
|
||||||
pallet_alliance::Call::join_alliance { .. } |
|
pallet_alliance::Call::elevate_ally { .. } |
|
||||||
pallet_alliance::Call::nominate_ally { .. } |
|
pallet_alliance::Call::give_retirement_notice { .. } |
|
||||||
pallet_alliance::Call::elevate_ally { .. } |
|
pallet_alliance::Call::retire { .. } |
|
||||||
pallet_alliance::Call::give_retirement_notice { .. } |
|
pallet_alliance::Call::kick_member { .. } |
|
||||||
pallet_alliance::Call::retire { .. } |
|
pallet_alliance::Call::close { .. } |
|
||||||
pallet_alliance::Call::kick_member { .. } |
|
pallet_alliance::Call::abdicate_fellow_status { .. },
|
||||||
pallet_alliance::Call::close { .. } |
|
) | RuntimeCall::AllianceMotion(
|
||||||
pallet_alliance::Call::abdicate_fellow_status { .. },
|
|
||||||
) |
|
|
||||||
RuntimeCall::AllianceMotion(
|
|
||||||
pallet_collective::Call::vote { .. } |
|
pallet_collective::Call::vote { .. } |
|
||||||
pallet_collective::Call::disapprove_proposal { .. } |
|
pallet_collective::Call::disapprove_proposal { .. } |
|
||||||
pallet_collective::Call::close { .. },
|
pallet_collective::Call::close { .. },
|
||||||
) |
|
) | RuntimeCall::FellowshipCollective(
|
||||||
RuntimeCall::FellowshipCollective(
|
|
||||||
pallet_ranked_collective::Call::add_member { .. } |
|
pallet_ranked_collective::Call::add_member { .. } |
|
||||||
pallet_ranked_collective::Call::promote_member { .. } |
|
pallet_ranked_collective::Call::promote_member { .. } |
|
||||||
pallet_ranked_collective::Call::demote_member { .. } |
|
pallet_ranked_collective::Call::demote_member { .. } |
|
||||||
pallet_ranked_collective::Call::remove_member { .. },
|
pallet_ranked_collective::Call::remove_member { .. },
|
||||||
) => true,
|
)
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned {
|
|||||||
info: &DispatchInfoOf<Self::Call>,
|
info: &DispatchInfoOf<Self::Call>,
|
||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<Self::Pre, TransactionValidityError> {
|
) -> Result<Self::Pre, TransactionValidityError> {
|
||||||
Ok(self.validate(who, call, info, len).map(|_| ())?)
|
self.validate(who, call, info, len).map(|_| ())
|
||||||
}
|
}
|
||||||
fn validate(
|
fn validate(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@@ -783,7 +783,7 @@ impl_runtime_apis! {
|
|||||||
list_benchmarks!(list, extra);
|
list_benchmarks!(list, extra);
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
return (list, storage_info)
|
(list, storage_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
|
|||||||
@@ -225,12 +225,12 @@ pub trait Reserve {
|
|||||||
// Takes the chain part of a MultiAsset
|
// Takes the chain part of a MultiAsset
|
||||||
impl Reserve for MultiAsset {
|
impl Reserve for MultiAsset {
|
||||||
fn reserve(&self) -> Option<MultiLocation> {
|
fn reserve(&self) -> Option<MultiLocation> {
|
||||||
if let AssetId::Concrete(location) = self.id.clone() {
|
if let AssetId::Concrete(location) = self.id {
|
||||||
let first_interior = location.first_interior();
|
let first_interior = location.first_interior();
|
||||||
let parents = location.parent_count();
|
let parents = location.parent_count();
|
||||||
match (parents, first_interior.clone()) {
|
match (parents, first_interior) {
|
||||||
(0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(id.clone())))),
|
(0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(*id)))),
|
||||||
(1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(id.clone())))),
|
(1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(*id)))),
|
||||||
(1, _) => Some(MultiLocation::parent()),
|
(1, _) => Some(MultiLocation::parent()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,10 +219,10 @@ impl pallet_timestamp::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u128 = 1 * MILLIROC;
|
pub const ExistentialDeposit: u128 = MILLIROC;
|
||||||
pub const TransferFee: u128 = 1 * MILLIROC;
|
pub const TransferFee: u128 = MILLIROC;
|
||||||
pub const CreationFee: u128 = 1 * MILLIROC;
|
pub const CreationFee: u128 = MILLIROC;
|
||||||
pub const TransactionByteFee: u128 = 1 * MICROROC;
|
pub const TransactionByteFee: u128 = MICROROC;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Config for Runtime {
|
impl pallet_balances::Config for Runtime {
|
||||||
@@ -505,11 +505,11 @@ impl cumulus_ping::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const AssetDeposit: Balance = 1 * ROC;
|
pub const AssetDeposit: Balance = ROC;
|
||||||
pub const AssetAccountDeposit: Balance = 1 * ROC;
|
pub const AssetAccountDeposit: Balance = ROC;
|
||||||
pub const ApprovalDeposit: Balance = 100 * MILLIROC;
|
pub const ApprovalDeposit: Balance = 100 * MILLIROC;
|
||||||
pub const AssetsStringLimit: u32 = 50;
|
pub const AssetsStringLimit: u32 = 50;
|
||||||
pub const MetadataDepositBase: Balance = 1 * ROC;
|
pub const MetadataDepositBase: Balance = ROC;
|
||||||
pub const MetadataDepositPerByte: Balance = 10 * MILLIROC;
|
pub const MetadataDepositPerByte: Balance = 10 * MILLIROC;
|
||||||
pub const UnitBody: BodyId = BodyId::Unit;
|
pub const UnitBody: BodyId = BodyId::Unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ pub mod rococo {
|
|||||||
para_id,
|
para_id,
|
||||||
bridges_pallet_owner_seed
|
bridges_pallet_owner_seed
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|seed| get_account_id_from_seed::<sr25519::Public>(&seed)),
|
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ impl RuntimeResolver for PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn runtime(id: &str) -> Runtime {
|
fn runtime(id: &str) -> Runtime {
|
||||||
let id = id.replace("_", "-");
|
let id = id.replace('_', "-");
|
||||||
let (_, id, para_id) = extract_parachain_id(&id);
|
let (_, id, para_id) = extract_parachain_id(&id);
|
||||||
|
|
||||||
if id.starts_with("shell") {
|
if id.starts_with("shell") {
|
||||||
@@ -240,7 +240,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
|||||||
Runtime::ContractsRococo =>
|
Runtime::ContractsRococo =>
|
||||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
|
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
|
||||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||||
bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?,
|
bridge_hub_runtime_type.chain_spec_from_json_file(path)?,
|
||||||
Runtime::Penpal(_para_id) =>
|
Runtime::Penpal(_para_id) =>
|
||||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||||
Runtime::Default => Box::new(
|
Runtime::Default => Box::new(
|
||||||
@@ -258,12 +258,10 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option<ParaId>) {
|
|||||||
const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-";
|
const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-";
|
||||||
const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-";
|
const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-";
|
||||||
|
|
||||||
let (norm_id, orig_id, para) = if id.starts_with(KUSAMA_TEST_PARA_PREFIX) {
|
let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) {
|
||||||
let suffix = &id[KUSAMA_TEST_PARA_PREFIX.len()..];
|
|
||||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||||
(&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
(&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||||
} else if id.starts_with(POLKADOT_TEST_PARA_PREFIX) {
|
} else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) {
|
||||||
let suffix = &id[POLKADOT_TEST_PARA_PREFIX.len()..];
|
|
||||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||||
(&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
(&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||||
} else {
|
} else {
|
||||||
@@ -813,13 +811,13 @@ pub fn run() -> Result<()> {
|
|||||||
runner.run_node_until_exit(|config| async move {
|
runner.run_node_until_exit(|config| async move {
|
||||||
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
||||||
config.database.path().map(|database_path| {
|
config.database.path().map(|database_path| {
|
||||||
let _ = std::fs::create_dir_all(&database_path);
|
let _ = std::fs::create_dir_all(database_path);
|
||||||
sc_sysinfo::gather_hwbench(Some(database_path))
|
sc_sysinfo::gather_hwbench(Some(database_path))
|
||||||
})).flatten();
|
})).flatten();
|
||||||
|
|
||||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||||
.map(|e| e.para_id)
|
.map(|e| e.para_id)
|
||||||
.ok_or_else(|| "Could not find parachain extension in chain-spec.")?;
|
.ok_or("Could not find parachain extension in chain-spec.")?;
|
||||||
|
|
||||||
let polkadot_cli = RelayChainCli::new(
|
let polkadot_cli = RelayChainCli::new(
|
||||||
&config,
|
&config,
|
||||||
@@ -848,7 +846,7 @@ pub fn run() -> Result<()> {
|
|||||||
info!("Parachain genesis state: {}", genesis_state);
|
info!("Parachain genesis state: {}", genesis_state);
|
||||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||||
|
|
||||||
if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relaychain_args.len() > 0 {
|
if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() {
|
||||||
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ where
|
|||||||
|
|
||||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||||
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||||
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
|
module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?;
|
||||||
|
|
||||||
Ok(module)
|
Ok(module)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -858,7 +858,7 @@ where
|
|||||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
{
|
{
|
||||||
cumulus_client_consensus_relay_chain::import_queue(
|
cumulus_client_consensus_relay_chain::import_queue(
|
||||||
client.clone(),
|
client,
|
||||||
block_import,
|
block_import,
|
||||||
|_, _| async { Ok(()) },
|
|_, _| async { Ok(()) },
|
||||||
&task_manager.spawn_essential_handle(),
|
&task_manager.spawn_essential_handle(),
|
||||||
@@ -1103,7 +1103,7 @@ where
|
|||||||
Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>;
|
Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>;
|
||||||
|
|
||||||
let verifier = Verifier {
|
let verifier = Verifier {
|
||||||
client: client.clone(),
|
client,
|
||||||
relay_chain_verifier,
|
relay_chain_verifier,
|
||||||
aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))),
|
aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))),
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use std::{
|
|||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
/// The runtimes that this command supports.
|
/// The runtimes that this command supports.
|
||||||
static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"];
|
static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"];
|
||||||
|
|
||||||
/// The `benchmark storage` command works for the dev runtimes.
|
/// The `benchmark storage` command works for the dev runtimes.
|
||||||
#[test]
|
#[test]
|
||||||
@@ -31,7 +31,7 @@ fn benchmark_storage_works() {
|
|||||||
/// Invoke the `benchmark storage` sub-command for the given database and runtime.
|
/// Invoke the `benchmark storage` sub-command for the given database and runtime.
|
||||||
fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus {
|
fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus {
|
||||||
Command::new(cargo_bin("polkadot-parachain"))
|
Command::new(cargo_bin("polkadot-parachain"))
|
||||||
.args(&["benchmark", "storage", "--chain", runtime])
|
.args(["benchmark", "storage", "--chain", runtime])
|
||||||
.arg("--db")
|
.arg("--db")
|
||||||
.arg(db)
|
.arg(db)
|
||||||
.arg("--weight-path")
|
.arg("--weight-path")
|
||||||
|
|||||||
@@ -117,12 +117,12 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
|
|||||||
line.expect("failed to obtain next line from stdout for WS address discovery");
|
line.expect("failed to obtain next line from stdout for WS address discovery");
|
||||||
|
|
||||||
data.push_str(&line);
|
data.push_str(&line);
|
||||||
data.push_str("\n");
|
data.push('\n');
|
||||||
|
|
||||||
// does the line contain our port (we expect this specific output from substrate).
|
// does the line contain our port (we expect this specific output from substrate).
|
||||||
let sock_addr = match line.split_once("Running JSON-RPC server: addr=") {
|
let sock_addr = match line.split_once("Running JSON-RPC server: addr=") {
|
||||||
None => return None,
|
None => return None,
|
||||||
Some((_, after)) => after.split_once(",").unwrap().0,
|
Some((_, after)) => after.split_once(',').unwrap().0,
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(format!("ws://{}", sock_addr))
|
Some(format!("ws://{}", sock_addr))
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ async fn purge_chain_works() {
|
|||||||
assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists());
|
assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists());
|
||||||
|
|
||||||
let status = Command::new(cargo_bin("polkadot-parachain"))
|
let status = Command::new(cargo_bin("polkadot-parachain"))
|
||||||
.args(&["purge-chain", "-d"])
|
.args(["purge-chain", "-d"])
|
||||||
.arg(base_dir.path())
|
.arg(base_dir.path())
|
||||||
.arg("-y")
|
.arg("-y")
|
||||||
.status()
|
.status()
|
||||||
|
|||||||
@@ -92,18 +92,19 @@ async fn collect_relay_storage_proof(
|
|||||||
.ok()?
|
.ok()?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let mut relevant_keys = Vec::new();
|
let mut relevant_keys = vec![
|
||||||
relevant_keys.push(relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec());
|
relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec(),
|
||||||
relevant_keys.push(relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec());
|
relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec(),
|
||||||
relevant_keys.push(relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec());
|
relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec(),
|
||||||
relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec());
|
relay_well_known_keys::CURRENT_SLOT.to_vec(),
|
||||||
relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec());
|
relay_well_known_keys::ACTIVE_CONFIG.to_vec(),
|
||||||
relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id));
|
relay_well_known_keys::dmq_mqc_head(para_id),
|
||||||
relevant_keys.push(relay_well_known_keys::relay_dispatch_queue_size(para_id));
|
relay_well_known_keys::relay_dispatch_queue_size(para_id),
|
||||||
relevant_keys.push(relay_well_known_keys::hrmp_ingress_channel_index(para_id));
|
relay_well_known_keys::hrmp_ingress_channel_index(para_id),
|
||||||
relevant_keys.push(relay_well_known_keys::hrmp_egress_channel_index(para_id));
|
relay_well_known_keys::hrmp_egress_channel_index(para_id),
|
||||||
relevant_keys.push(relay_well_known_keys::upgrade_go_ahead_signal(para_id));
|
relay_well_known_keys::upgrade_go_ahead_signal(para_id),
|
||||||
relevant_keys.push(relay_well_known_keys::upgrade_restriction_signal(para_id));
|
relay_well_known_keys::upgrade_restriction_signal(para_id),
|
||||||
|
];
|
||||||
relevant_keys.extend(ingress_channels.into_iter().map(|sender| {
|
relevant_keys.extend(ingress_channels.into_iter().map(|sender| {
|
||||||
relay_well_known_keys::hrmp_channels(HrmpChannelId { sender, recipient: para_id })
|
relay_well_known_keys::hrmp_channels(HrmpChannelId { sender, recipient: para_id })
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ impl<R: Send + Sync + GenerateRandomness<u64>> InherentDataProvider
|
|||||||
self.relay_offset + self.relay_blocks_per_para_block * self.current_para_block;
|
self.relay_offset + self.relay_blocks_per_para_block * self.current_para_block;
|
||||||
|
|
||||||
// Use the "sproof" (spoof proof) builder to build valid mock state root and proof.
|
// Use the "sproof" (spoof proof) builder to build valid mock state root and proof.
|
||||||
let mut sproof_builder = RelayStateSproofBuilder::default();
|
let mut sproof_builder =
|
||||||
sproof_builder.para_id = self.xcm_config.para_id;
|
RelayStateSproofBuilder { para_id: self.xcm_config.para_id, ..Default::default() };
|
||||||
|
|
||||||
// Process the downward messages and set up the correct head
|
// Process the downward messages and set up the correct head
|
||||||
let mut downward_messages = Vec::new();
|
let mut downward_messages = Vec::new();
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ mod tests {
|
|||||||
relay_parent_number: 1,
|
relay_parent_number: 1,
|
||||||
relay_parent_storage_root,
|
relay_parent_storage_root,
|
||||||
},
|
},
|
||||||
&WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"),
|
WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"),
|
||||||
)
|
)
|
||||||
.map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`."))
|
.map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`."))
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ mod tests {
|
|||||||
(slot_timestamp * 10, false),
|
(slot_timestamp * 10, false),
|
||||||
] {
|
] {
|
||||||
let output = Command::new(env::current_exe().unwrap())
|
let output = Command::new(env::current_exe().unwrap())
|
||||||
.args(&["check_timestamp_inherent_works", "--", "--nocapture"])
|
.args(["check_timestamp_inherent_works", "--", "--nocapture"])
|
||||||
.env("RUN_TEST", "1")
|
.env("RUN_TEST", "1")
|
||||||
.env("TIMESTAMP", timestamp.to_string())
|
.env("TIMESTAMP", timestamp.to_string())
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ impl<
|
|||||||
|
|
||||||
// Get the local asset id in which we can pay for fees
|
// Get the local asset id in which we can pay for fees
|
||||||
let (local_asset_id, _) =
|
let (local_asset_id, _) =
|
||||||
Matcher::matches_fungibles(&first).map_err(|_| XcmError::AssetNotFound)?;
|
Matcher::matches_fungibles(first).map_err(|_| XcmError::AssetNotFound)?;
|
||||||
|
|
||||||
// Calculate how much we should charge in the asset_id for such amount of weight
|
// Calculate how much we should charge in the asset_id for such amount of weight
|
||||||
// Require at least a payment of minimum_balance
|
// Require at least a payment of minimum_balance
|
||||||
@@ -181,7 +181,7 @@ impl<
|
|||||||
.map_err(|_| XcmError::Overflow)?;
|
.map_err(|_| XcmError::Overflow)?;
|
||||||
|
|
||||||
// Convert to the same kind of multiasset, with the required fungible balance
|
// Convert to the same kind of multiasset, with the required fungible balance
|
||||||
let required = first.id.clone().into_multiasset(asset_balance.into());
|
let required = first.id.into_multiasset(asset_balance.into());
|
||||||
|
|
||||||
// Substract payment
|
// Substract payment
|
||||||
let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?;
|
let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?;
|
||||||
@@ -204,7 +204,7 @@ impl<
|
|||||||
{
|
{
|
||||||
// Get the local asset id in which we can refund fees
|
// Get the local asset id in which we can refund fees
|
||||||
let (local_asset_id, outstanding_balance) =
|
let (local_asset_id, outstanding_balance) =
|
||||||
Matcher::matches_fungibles(&(id.clone(), fun).into()).ok()?;
|
Matcher::matches_fungibles(&(id, fun).into()).ok()?;
|
||||||
|
|
||||||
let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id);
|
let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id);
|
||||||
|
|
||||||
@@ -233,8 +233,7 @@ impl<
|
|||||||
let asset_balance: u128 = asset_balance.saturated_into();
|
let asset_balance: u128 = asset_balance.saturated_into();
|
||||||
|
|
||||||
// Construct outstanding_concrete_asset with the same location id and substracted balance
|
// Construct outstanding_concrete_asset with the same location id and substracted balance
|
||||||
let outstanding_concrete_asset: MultiAsset =
|
let outstanding_concrete_asset: MultiAsset = (id, outstanding_minus_substracted).into();
|
||||||
(id.clone(), outstanding_minus_substracted).into();
|
|
||||||
|
|
||||||
// Substract from existing weight and balance
|
// Substract from existing weight and balance
|
||||||
weight_outstanding = weight_outstanding.saturating_sub(weight);
|
weight_outstanding = weight_outstanding.saturating_sub(weight);
|
||||||
@@ -365,7 +364,7 @@ mod tests {
|
|||||||
|
|
||||||
// ParentAsUmp - check dest is really not applicable
|
// ParentAsUmp - check dest is really not applicable
|
||||||
let dest = (Parent, Parent, Parent);
|
let dest = (Parent, Parent, Parent);
|
||||||
let mut dest_wrapper = Some(dest.clone().into());
|
let mut dest_wrapper = Some(dest.into());
|
||||||
let mut msg_wrapper = Some(message.clone());
|
let mut msg_wrapper = Some(message.clone());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Err(SendError::NotApplicable),
|
Err(SendError::NotApplicable),
|
||||||
@@ -373,7 +372,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// check wrapper were not consumed
|
// check wrapper were not consumed
|
||||||
assert_eq!(Some(dest.clone().into()), dest_wrapper.take());
|
assert_eq!(Some(dest.into()), dest_wrapper.take());
|
||||||
assert_eq!(Some(message.clone()), msg_wrapper.take());
|
assert_eq!(Some(message.clone()), msg_wrapper.take());
|
||||||
|
|
||||||
// another try with router chain with asserting sender
|
// another try with router chain with asserting sender
|
||||||
@@ -393,7 +392,7 @@ mod tests {
|
|||||||
|
|
||||||
// ParentAsUmp - check dest/msg is valid
|
// ParentAsUmp - check dest/msg is valid
|
||||||
let dest = (Parent, Here);
|
let dest = (Parent, Here);
|
||||||
let mut dest_wrapper = Some(dest.clone().into());
|
let mut dest_wrapper = Some(dest.into());
|
||||||
let mut msg_wrapper = Some(message.clone());
|
let mut msg_wrapper = Some(message.clone());
|
||||||
assert!(<ParentAsUmp<(), (), ()> as SendXcm>::validate(
|
assert!(<ParentAsUmp<(), (), ()> as SendXcm>::validate(
|
||||||
&mut dest_wrapper,
|
&mut dest_wrapper,
|
||||||
@@ -529,16 +528,13 @@ mod tests {
|
|||||||
|
|
||||||
// prepare test data
|
// prepare test data
|
||||||
let asset: MultiAsset = (Here, AMOUNT).into();
|
let asset: MultiAsset = (Here, AMOUNT).into();
|
||||||
let payment = Assets::from(asset.clone());
|
let payment = Assets::from(asset);
|
||||||
let weight_to_buy = Weight::from_parts(1_000, 1_000);
|
let weight_to_buy = Weight::from_parts(1_000, 1_000);
|
||||||
|
|
||||||
// lets do first call (success)
|
// lets do first call (success)
|
||||||
assert_ok!(trader.buy_weight(weight_to_buy, payment.clone()));
|
assert_ok!(trader.buy_weight(weight_to_buy, payment.clone()));
|
||||||
|
|
||||||
// lets do second call (error)
|
// lets do second call (error)
|
||||||
assert_eq!(
|
assert_eq!(trader.buy_weight(weight_to_buy, payment), Err(XcmError::NotWithdrawable));
|
||||||
trader.buy_weight(weight_to_buy, payment.clone()),
|
|
||||||
Err(XcmError::NotWithdrawable)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,3 +97,11 @@ cargo-check-benches:
|
|||||||
artifacts: false
|
artifacts: false
|
||||||
script:
|
script:
|
||||||
- time cargo check --all --benches
|
- time cargo check --all --benches
|
||||||
|
|
||||||
|
cargo-clippy:
|
||||||
|
stage: test
|
||||||
|
extends:
|
||||||
|
- .docker-env
|
||||||
|
- .common-refs
|
||||||
|
script:
|
||||||
|
- SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ pub trait InitBlockBuilder {
|
|||||||
) -> sc_block_builder::BlockBuilder<Block, Client, Backend>;
|
) -> sc_block_builder::BlockBuilder<Block, Client, Backend>;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_block_builder<'a>(
|
fn init_block_builder(
|
||||||
client: &'a Client,
|
client: &Client,
|
||||||
at: Hash,
|
at: Hash,
|
||||||
validation_data: Option<PersistedValidationData<PHash, PBlockNumber>>,
|
validation_data: Option<PersistedValidationData<PHash, PBlockNumber>>,
|
||||||
relay_sproof_builder: RelayStateSproofBuilder,
|
relay_sproof_builder: RelayStateSproofBuilder,
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
) -> BlockBuilder<'a, Block, Client, Backend> {
|
) -> BlockBuilder<'_, Block, Client, Backend> {
|
||||||
let mut block_builder = client
|
let mut block_builder = client
|
||||||
.new_block_at(at, Default::default(), true)
|
.new_block_at(at, Default::default(), true)
|
||||||
.expect("Creates new block builder for test runtime");
|
.expect("Creates new block builder for test runtime");
|
||||||
|
|||||||
@@ -199,5 +199,4 @@ pub fn validate_block(
|
|||||||
&validation_params.encode(),
|
&validation_params.encode(),
|
||||||
)
|
)
|
||||||
.map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`."))
|
.map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`."))
|
||||||
.map_err(|err| err.into())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ impl RelayStateSproofBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let root = backend.root().clone();
|
let root = *backend.root();
|
||||||
let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read");
|
let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read");
|
||||||
(root, proof)
|
(root, proof)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
|||||||
accounts
|
accounts
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, a)| {
|
.flat_map(|(i, a)| {
|
||||||
vec![
|
vec![
|
||||||
// Reset the nonce by removing any funds
|
// Reset the nonce by removing any funds
|
||||||
construct_extrinsic(
|
construct_extrinsic(
|
||||||
@@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
|||||||
SudoCall::sudo {
|
SudoCall::sudo {
|
||||||
call: Box::new(
|
call: Box::new(
|
||||||
BalancesCall::force_set_balance {
|
BalancesCall::force_set_balance {
|
||||||
who: AccountId::from(a.public()).into(),
|
who: AccountId::from(a.public()),
|
||||||
new_free: 0,
|
new_free: 0,
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
@@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
|||||||
SudoCall::sudo {
|
SudoCall::sudo {
|
||||||
call: Box::new(
|
call: Box::new(
|
||||||
BalancesCall::force_set_balance {
|
BalancesCall::force_set_balance {
|
||||||
who: AccountId::from(a.public()).into(),
|
who: AccountId::from(a.public()),
|
||||||
new_free: 1_000_000_000_000 * ExistentialDeposit::get(),
|
new_free: 1_000_000_000_000 * ExistentialDeposit::get(),
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
@@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.flatten()
|
|
||||||
.map(OpaqueExtrinsic::from)
|
.map(OpaqueExtrinsic::from)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
@@ -92,20 +91,19 @@ fn create_benchmark_extrinsics(
|
|||||||
) -> Vec<OpaqueExtrinsic> {
|
) -> Vec<OpaqueExtrinsic> {
|
||||||
accounts
|
accounts
|
||||||
.iter()
|
.iter()
|
||||||
.map(|account| {
|
.flat_map(|account| {
|
||||||
(0..extrinsics_per_account).map(move |nonce| {
|
(0..extrinsics_per_account).map(move |nonce| {
|
||||||
construct_extrinsic(
|
construct_extrinsic(
|
||||||
client,
|
client,
|
||||||
BalancesCall::transfer_allow_death {
|
BalancesCall::transfer_allow_death {
|
||||||
dest: Bob.to_account_id().into(),
|
dest: Bob.to_account_id(),
|
||||||
value: 1 * ExistentialDeposit::get(),
|
value: ExistentialDeposit::get(),
|
||||||
},
|
},
|
||||||
account.clone(),
|
account.clone(),
|
||||||
Some(nonce as u32),
|
Some(nonce as u32),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.flatten()
|
|
||||||
.map(OpaqueExtrinsic::from)
|
.map(OpaqueExtrinsic::from)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
@@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) {
|
|||||||
|b| {
|
|b| {
|
||||||
b.iter_batched(
|
b.iter_batched(
|
||||||
|| {
|
|| {
|
||||||
let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts);
|
let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts);
|
||||||
|
|
||||||
benchmark_handle.block_on(future::join_all(
|
benchmark_handle.block_on(future::join_all(
|
||||||
prepare_extrinsics.into_iter().map(|tx| {
|
prepare_extrinsics.into_iter().map(|tx| {
|
||||||
submit_tx_and_wait_for_inclusion(
|
submit_tx_and_wait_for_inclusion(
|
||||||
&dave.transaction_pool,
|
&dave.transaction_pool,
|
||||||
tx,
|
tx,
|
||||||
&*dave.client,
|
&dave.client,
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
|
|
||||||
create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account)
|
create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account)
|
||||||
},
|
},
|
||||||
|extrinsics| {
|
|extrinsics| {
|
||||||
benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
|
benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
|
||||||
submit_tx_and_wait_for_inclusion(
|
submit_tx_and_wait_for_inclusion(
|
||||||
&dave.transaction_pool,
|
&dave.transaction_pool,
|
||||||
tx,
|
tx,
|
||||||
&*dave.client,
|
&dave.client,
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
})));
|
})));
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ pub struct GenesisExt {
|
|||||||
impl sp_runtime::BuildStorage for GenesisExt {
|
impl sp_runtime::BuildStorage for GenesisExt {
|
||||||
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
|
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
|
||||||
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
|
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
|
||||||
sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]);
|
sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]);
|
||||||
cumulus_test_runtime::ParachainId::set(&self.para_id);
|
cumulus_test_runtime::ParachainId::set(&self.para_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -125,7 +125,6 @@ fn testnet_genesis(
|
|||||||
code: cumulus_test_runtime::WASM_BINARY
|
code: cumulus_test_runtime::WASM_BINARY
|
||||||
.expect("WASM binary was not build, please build it!")
|
.expect("WASM binary was not build, please build it!")
|
||||||
.to_vec(),
|
.to_vec(),
|
||||||
..Default::default()
|
|
||||||
},
|
},
|
||||||
parachain_system: Default::default(),
|
parachain_system: Default::default(),
|
||||||
balances: cumulus_test_runtime::BalancesConfig {
|
balances: cumulus_test_runtime::BalancesConfig {
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ impl TestNodeBuilder {
|
|||||||
let parachain_config = node_config(
|
let parachain_config = node_config(
|
||||||
self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())),
|
self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())),
|
||||||
self.tokio_handle.clone(),
|
self.tokio_handle.clone(),
|
||||||
self.key.clone(),
|
self.key,
|
||||||
self.parachain_nodes,
|
self.parachain_nodes,
|
||||||
self.parachain_nodes_exclusive,
|
self.parachain_nodes_exclusive,
|
||||||
self.para_id,
|
self.para_id,
|
||||||
@@ -667,7 +667,7 @@ impl TestNodeBuilder {
|
|||||||
.await
|
.await
|
||||||
.expect("could not create Cumulus test service");
|
.expect("could not create Cumulus test service");
|
||||||
|
|
||||||
let peer_id = network.local_peer_id().clone();
|
let peer_id = network.local_peer_id();
|
||||||
let addr = MultiaddrWithPeerId { multiaddr, peer_id };
|
let addr = MultiaddrWithPeerId { multiaddr, peer_id };
|
||||||
|
|
||||||
TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool }
|
TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool }
|
||||||
@@ -690,7 +690,7 @@ pub fn node_config(
|
|||||||
is_collator: bool,
|
is_collator: bool,
|
||||||
) -> Result<Configuration, ServiceError> {
|
) -> Result<Configuration, ServiceError> {
|
||||||
let base_path = BasePath::new_temp_dir()?;
|
let base_path = BasePath::new_temp_dir()?;
|
||||||
let root = base_path.path().join(format!("cumulus_test_service_{}", key.to_string()));
|
let root = base_path.path().join(format!("cumulus_test_service_{}", key));
|
||||||
let role = if is_collator { Role::Authority } else { Role::Full };
|
let role = if is_collator { Role::Authority } else { Role::Full };
|
||||||
let key_seed = key.to_seed();
|
let key_seed = key.to_seed();
|
||||||
let mut spec = Box::new(chain_spec::get_chain_spec(para_id));
|
let mut spec = Box::new(chain_spec::get_chain_spec(para_id));
|
||||||
@@ -786,7 +786,7 @@ impl TestNode {
|
|||||||
function: impl Into<runtime::RuntimeCall>,
|
function: impl Into<runtime::RuntimeCall>,
|
||||||
caller: Sr25519Keyring,
|
caller: Sr25519Keyring,
|
||||||
) -> Result<RpcTransactionOutput, RpcTransactionError> {
|
) -> Result<RpcTransactionOutput, RpcTransactionError> {
|
||||||
let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0));
|
let extrinsic = construct_extrinsic(&self.client, function, caller.pair(), Some(0));
|
||||||
|
|
||||||
self.rpc_handlers.send_transaction(extrinsic.into()).await
|
self.rpc_handlers.send_transaction(extrinsic.into()).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user