mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Use same fmt and clippy configs as in Polkadot (#3004)
* Copy rustfmt.toml from Polkadot master Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Format with new config Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add Polkadot clippy config Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update Cargo.lock Looks like https://github.com/paritytech/polkadot/pull/7611 did not correctly update the lockfile. Maybe a different Rust Version?! Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
61480a1881
commit
6c79b58567
@@ -29,4 +29,5 @@ rustflags = [
|
|||||||
"-Aclippy::needless_option_as_deref", # false positives
|
"-Aclippy::needless_option_as_deref", # false positives
|
||||||
"-Aclippy::derivable_impls", # false positives
|
"-Aclippy::derivable_impls", # false positives
|
||||||
"-Aclippy::stable_sort_primitive", # prefer stable sort
|
"-Aclippy::stable_sort_primitive", # prefer stable sort
|
||||||
|
"-Aclippy::extra-unused-type-parameters", # stylistic
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -11,14 +11,18 @@ reorder_imports = true
|
|||||||
# Consistency
|
# Consistency
|
||||||
newline_style = "Unix"
|
newline_style = "Unix"
|
||||||
|
|
||||||
|
# Format comments
|
||||||
|
comment_width = 100
|
||||||
|
wrap_comments = true
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
binop_separator = "Back"
|
|
||||||
chain_width = 80
|
chain_width = 80
|
||||||
match_arm_blocks = false
|
|
||||||
match_arm_leading_pipes = "Preserve"
|
|
||||||
match_block_trailing_comma = true
|
|
||||||
reorder_impl_items = false
|
|
||||||
spaces_around_ranges = false
|
spaces_around_ranges = false
|
||||||
|
binop_separator = "Back"
|
||||||
|
reorder_impl_items = false
|
||||||
|
match_arm_leading_pipes = "Preserve"
|
||||||
|
match_arm_blocks = false
|
||||||
|
match_block_trailing_comma = true
|
||||||
trailing_comma = "Vertical"
|
trailing_comma = "Vertical"
|
||||||
trailing_semicolon = false
|
trailing_semicolon = false
|
||||||
use_field_init_shorthand = true
|
use_field_init_shorthand = true
|
||||||
|
|||||||
@@ -307,7 +307,8 @@ pub struct RunCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RunCmd {
|
impl RunCmd {
|
||||||
/// Create a [`NormalizedRunCmd`] which merges the `collator` cli argument into `validator` to have only one.
|
/// Create a [`NormalizedRunCmd`] which merges the `collator` cli argument into `validator` to
|
||||||
|
/// have only one.
|
||||||
pub fn normalize(&self) -> NormalizedRunCmd {
|
pub fn normalize(&self) -> NormalizedRunCmd {
|
||||||
let mut new_base = self.base.clone();
|
let mut new_base = self.base.clone();
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ where
|
|||||||
|
|
||||||
/// Fetch the collation info from the runtime.
|
/// Fetch the collation info from the runtime.
|
||||||
///
|
///
|
||||||
/// Returns `Ok(Some(_))` on success, `Err(_)` on error or `Ok(None)` if the runtime api isn't implemented by the runtime.
|
/// Returns `Ok(Some(_))` on success, `Err(_)` on error or `Ok(None)` if the runtime api isn't
|
||||||
|
/// implemented by the runtime.
|
||||||
pub fn fetch_collation_info(
|
pub fn fetch_collation_info(
|
||||||
&self,
|
&self,
|
||||||
block_hash: Block::Hash,
|
block_hash: Block::Hash,
|
||||||
|
|||||||
@@ -53,12 +53,14 @@ pub struct ParachainCandidate<B> {
|
|||||||
pub proof: sp_trie::StorageProof,
|
pub proof: sp_trie::StorageProof,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A specific parachain consensus implementation that can be used by a collator to produce candidates.
|
/// A specific parachain consensus implementation that can be used by a collator to produce
|
||||||
|
/// candidates.
|
||||||
///
|
///
|
||||||
/// The collator will call [`Self::produce_candidate`] every time there is a free core for the parachain
|
/// The collator will call [`Self::produce_candidate`] every time there is a free core for the
|
||||||
/// this collator is collating for. It is the job of the consensus implementation to decide if this
|
/// parachain this collator is collating for. It is the job of the consensus implementation to
|
||||||
/// specific collator should build a candidate for the given relay chain block. The consensus
|
/// decide if this specific collator should build a candidate for the given relay chain block. The
|
||||||
/// implementation could, for example, check whether this specific collator is part of a staked set.
|
/// consensus implementation could, for example, check whether this specific collator is part of a
|
||||||
|
/// staked set.
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait ParachainConsensus<B: BlockT>: Send + Sync + dyn_clone::DynClone {
|
pub trait ParachainConsensus<B: BlockT>: Send + Sync + dyn_clone::DynClone {
|
||||||
/// Produce a new candidate at the given parent block and relay-parent blocks.
|
/// Produce a new candidate at the given parent block and relay-parent blocks.
|
||||||
@@ -94,8 +96,8 @@ impl<B: BlockT> ParachainConsensus<B> for Box<dyn ParachainConsensus<B> + Send +
|
|||||||
/// Parachain specific block import.
|
/// Parachain specific block import.
|
||||||
///
|
///
|
||||||
/// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is
|
/// This is used to set `block_import_params.fork_choice` to `false` as long as the block origin is
|
||||||
/// not `NetworkInitialSync`. The best block for parachains is determined by the relay chain. Meaning
|
/// not `NetworkInitialSync`. The best block for parachains is determined by the relay chain.
|
||||||
/// we will update the best block, as it is included by the relay-chain.
|
/// Meaning we will update the best block, as it is included by the relay-chain.
|
||||||
pub struct ParachainBlockImport<Block: BlockT, BI, BE> {
|
pub struct ParachainBlockImport<Block: BlockT, BI, BE> {
|
||||||
inner: BI,
|
inner: BI,
|
||||||
monitor: Option<SharedData<LevelMonitor<Block, BE>>>,
|
monitor: Option<SharedData<LevelMonitor<Block, BE>>>,
|
||||||
@@ -232,8 +234,8 @@ pub struct PotentialParent<B: BlockT> {
|
|||||||
/// a set of [`PotentialParent`]s which could be potential parents of a new block with this
|
/// a set of [`PotentialParent`]s which could be potential parents of a new block with this
|
||||||
/// relay-parent according to the search parameters.
|
/// relay-parent according to the search parameters.
|
||||||
///
|
///
|
||||||
/// A parachain block is a potential parent if it is either the last included parachain block, the pending
|
/// A parachain block is a potential parent if it is either the last included parachain block, the
|
||||||
/// parachain block (when `max_depth` >= 1), or all of the following hold:
|
/// pending parachain block (when `max_depth` >= 1), or all of the following hold:
|
||||||
/// * its parent is a potential parent
|
/// * its parent is a potential parent
|
||||||
/// * its relay-parent is within `ancestry_lookback` of the targeted relay-parent.
|
/// * its relay-parent is within `ancestry_lookback` of the targeted relay-parent.
|
||||||
/// * the block number is within `max_depth` blocks of the included block
|
/// * the block number is within `max_depth` blocks of the included block
|
||||||
|
|||||||
@@ -176,8 +176,8 @@ where
|
|||||||
///
|
///
|
||||||
/// # Note
|
/// # Note
|
||||||
///
|
///
|
||||||
/// This will access the backend of the parachain and thus, this future should be spawned as blocking
|
/// This will access the backend of the parachain and thus, this future should be spawned as
|
||||||
/// task.
|
/// blocking task.
|
||||||
pub async fn run_parachain_consensus<P, R, Block, B>(
|
pub async fn run_parachain_consensus<P, R, Block, B>(
|
||||||
para_id: ParaId,
|
para_id: ParaId,
|
||||||
parachain: Arc<P>,
|
parachain: Arc<P>,
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ pub trait ProposerInterface<Block: BlockT> {
|
|||||||
/// `ParachainInherentData`.
|
/// `ParachainInherentData`.
|
||||||
///
|
///
|
||||||
/// Also specify any required inherent digests, the maximum proposal duration,
|
/// Also specify any required inherent digests, the maximum proposal duration,
|
||||||
/// and the block size limit in bytes. See the documentation on [`sp_consensus::Proposer::propose`]
|
/// and the block size limit in bytes. See the documentation on
|
||||||
/// for more details on how to interpret these parameters.
|
/// [`sp_consensus::Proposer::propose`] for more details on how to interpret these parameters.
|
||||||
///
|
///
|
||||||
/// The `InherentData` and `Digest` are left deliberately general in order to accommodate
|
/// The `InherentData` and `Digest` are left deliberately general in order to accommodate
|
||||||
/// all possible collator selection algorithms or inherent creation mechanisms,
|
/// all possible collator selection algorithms or inherent creation mechanisms,
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
//!
|
//!
|
||||||
//! 1. Each node that sees itself as a collator is free to build a parachain candidate.
|
//! 1. Each node that sees itself as a collator is free to build a parachain candidate.
|
||||||
//!
|
//!
|
||||||
//! 2. This parachain candidate is send to the parachain validators that are part of the relay chain.
|
//! 2. This parachain candidate is send to the parachain validators that are part of the relay
|
||||||
|
//! chain.
|
||||||
//!
|
//!
|
||||||
//! 3. The parachain validators validate at most X different parachain candidates, where X is the
|
//! 3. The parachain validators validate at most X different parachain candidates, where X is the
|
||||||
//! total number of parachain validators.
|
//! total number of parachain validators.
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ impl Decode for BlockAnnounceData {
|
|||||||
impl BlockAnnounceData {
|
impl BlockAnnounceData {
|
||||||
/// Validate that the receipt, statement and announced header match.
|
/// Validate that the receipt, statement and announced header match.
|
||||||
///
|
///
|
||||||
/// This will not check the signature, for this you should use [`BlockAnnounceData::check_signature`].
|
/// This will not check the signature, for this you should use
|
||||||
|
/// [`BlockAnnounceData::check_signature`].
|
||||||
fn validate(&self, encoded_header: Vec<u8>) -> Result<(), Validation> {
|
fn validate(&self, encoded_header: Vec<u8>) -> Result<(), Validation> {
|
||||||
let candidate_hash =
|
let candidate_hash =
|
||||||
if let CompactStatement::Seconded(h) = self.statement.unchecked_payload() {
|
if let CompactStatement::Seconded(h) = self.statement.unchecked_payload() {
|
||||||
@@ -192,9 +193,9 @@ pub type BlockAnnounceValidator<Block, RCInterface> =
|
|||||||
|
|
||||||
/// Parachain specific block announce validator.
|
/// Parachain specific block announce validator.
|
||||||
///
|
///
|
||||||
/// This is not required when the collation mechanism itself is sybil-resistant, as it is a spam protection
|
/// This is not required when the collation mechanism itself is sybil-resistant, as it is a spam
|
||||||
/// mechanism used to prevent nodes from dealing with unbounded numbers of blocks. For sybil-resistant
|
/// protection mechanism used to prevent nodes from dealing with unbounded numbers of blocks. For
|
||||||
/// collation mechanisms, this will only slow things down.
|
/// sybil-resistant collation mechanisms, this will only slow things down.
|
||||||
///
|
///
|
||||||
/// This block announce validator is required if the parachain is running
|
/// This block announce validator is required if the parachain is running
|
||||||
/// with the relay chain provided consensus to make sure each node only
|
/// with the relay chain provided consensus to make sure each node only
|
||||||
@@ -472,8 +473,8 @@ impl AssumeSybilResistance {
|
|||||||
/// announcements which come tagged with seconded messages.
|
/// announcements which come tagged with seconded messages.
|
||||||
///
|
///
|
||||||
/// This is useful for backwards compatibility when upgrading nodes: old nodes will continue
|
/// This is useful for backwards compatibility when upgrading nodes: old nodes will continue
|
||||||
/// to broadcast announcements with seconded messages, so these announcements shouldn't be rejected
|
/// to broadcast announcements with seconded messages, so these announcements shouldn't be
|
||||||
/// and the peers not punished.
|
/// rejected and the peers not punished.
|
||||||
pub fn allow_seconded_messages() -> Self {
|
pub fn allow_seconded_messages() -> Self {
|
||||||
AssumeSybilResistance(true)
|
AssumeSybilResistance(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,19 @@
|
|||||||
//! A parachain needs to build PoVs that are send to the relay chain to progress. These PoVs are
|
//! A parachain needs to build PoVs that are send to the relay chain to progress. These PoVs are
|
||||||
//! erasure encoded and one piece of it is stored by each relay chain validator. As the relay chain
|
//! erasure encoded and one piece of it is stored by each relay chain validator. As the relay chain
|
||||||
//! decides on which PoV per parachain to include and thus, to progess the parachain it can happen
|
//! decides on which PoV per parachain to include and thus, to progess the parachain it can happen
|
||||||
//! that the block corresponding to this PoV isn't propagated in the parachain network. This can have
|
//! that the block corresponding to this PoV isn't propagated in the parachain network. This can
|
||||||
//! several reasons, either a malicious collator that managed to include its own PoV and doesn't want
|
//! have several reasons, either a malicious collator that managed to include its own PoV and
|
||||||
//! to share it with the rest of the network or maybe a collator went down before it could distribute
|
//! doesn't want to share it with the rest of the network or maybe a collator went down before it
|
||||||
//! the block in the network. When something like this happens we can use the PoV recovery algorithm
|
//! could distribute the block in the network. When something like this happens we can use the PoV
|
||||||
//! implemented in this crate to recover a PoV and to propagate it with the rest of the network.
|
//! recovery algorithm implemented in this crate to recover a PoV and to propagate it with the rest
|
||||||
|
//! of the network.
|
||||||
//!
|
//!
|
||||||
//! It works in the following way:
|
//! It works in the following way:
|
||||||
//!
|
//!
|
||||||
//! 1. For every included relay chain block we note the backed candidate of our parachain. If the
|
//! 1. For every included relay chain block we note the backed candidate of our parachain. If the
|
||||||
//! block belonging to the PoV is already known, we do nothing. Otherwise we start
|
//! block belonging to the PoV is already known, we do nothing. Otherwise we start
|
||||||
//! a timer that waits for a randomized time inside a specified interval before starting to recover
|
//! a timer that waits for a randomized time inside a specified interval before starting to
|
||||||
//! the PoV.
|
//! recover the PoV.
|
||||||
//!
|
//!
|
||||||
//! 2. If between starting and firing the timer the block is imported, we skip the recovery of the
|
//! 2. If between starting and firing the timer the block is imported, we skip the recovery of the
|
||||||
//! PoV.
|
//! PoV.
|
||||||
@@ -39,8 +40,8 @@
|
|||||||
//!
|
//!
|
||||||
//! 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
|
||||||
//! PoV is not yet available, we retry.
|
//! block 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.
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ use sp_state_machine::{Backend as StateBackend, StorageValue};
|
|||||||
/// The timeout in seconds after that the waiting for a block should be aborted.
|
/// The timeout in seconds after that the waiting for a block should be aborted.
|
||||||
const TIMEOUT_IN_SECONDS: u64 = 6;
|
const TIMEOUT_IN_SECONDS: u64 = 6;
|
||||||
|
|
||||||
/// Provides an implementation of the [`RelayChainInterface`] using a local in-process relay chain node.
|
/// Provides an implementation of the [`RelayChainInterface`] using a local in-process relay chain
|
||||||
|
/// node.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RelayChainInProcessInterface {
|
pub struct RelayChainInProcessInterface {
|
||||||
full_client: Arc<FullClient>,
|
full_client: Arc<FullClient>,
|
||||||
@@ -188,8 +189,8 @@ impl RelayChainInterface for RelayChainInProcessInterface {
|
|||||||
|
|
||||||
/// Wait for a given relay chain block in an async way.
|
/// Wait for a given relay chain block in an async way.
|
||||||
///
|
///
|
||||||
/// The caller needs to pass the hash of a block it waits for and the function will return when the
|
/// The caller needs to pass the hash of a block it waits for and the function will return when
|
||||||
/// block is available or an error occurred.
|
/// the block is available or an error occurred.
|
||||||
///
|
///
|
||||||
/// The waiting for the block is implemented as follows:
|
/// The waiting for the block is implemented as follows:
|
||||||
///
|
///
|
||||||
@@ -199,10 +200,11 @@ impl RelayChainInterface for RelayChainInProcessInterface {
|
|||||||
///
|
///
|
||||||
/// 3. If the block isn't imported yet, add an import notification listener.
|
/// 3. If the block isn't imported yet, add an import notification listener.
|
||||||
///
|
///
|
||||||
/// 4. Poll the import notification listener until the block is imported or the timeout is fired.
|
/// 4. Poll the import notification listener until the block is imported or the timeout is
|
||||||
|
/// fired.
|
||||||
///
|
///
|
||||||
/// The timeout is set to 6 seconds. This should be enough time to import the block in the current
|
/// The timeout is set to 6 seconds. This should be enough time to import the block in the
|
||||||
/// round and if not, the new round of the relay chain already started anyway.
|
/// current round and if not, the new round of the relay chain already started anyway.
|
||||||
async fn wait_for_block(&self, hash: PHash) -> RelayChainResult<()> {
|
async fn wait_for_block(&self, hash: PHash) -> RelayChainResult<()> {
|
||||||
let mut listener =
|
let mut listener =
|
||||||
match check_block_in_chain(self.backend.clone(), self.full_client.clone(), hash)? {
|
match check_block_in_chain(self.backend.clone(), self.full_client.clone(), hash)? {
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ impl RelayChainInterface for RelayChainRpcInterface {
|
|||||||
|
|
||||||
/// Wait for a given relay chain block
|
/// Wait for a given relay chain block
|
||||||
///
|
///
|
||||||
/// The hash of the block to wait for is passed. We wait for the block to arrive or return after a timeout.
|
/// The hash of the block to wait for is passed. We wait for the block to arrive or return after
|
||||||
|
/// a timeout.
|
||||||
///
|
///
|
||||||
/// Implementation:
|
/// Implementation:
|
||||||
/// 1. Register a listener to all new blocks.
|
/// 1. Register a listener to all new blocks.
|
||||||
|
|||||||
@@ -403,9 +403,11 @@ impl ReconnectingWebsocketWorker {
|
|||||||
|
|
||||||
/// Run this worker to drive notification streams.
|
/// Run this worker to drive notification streams.
|
||||||
/// The worker does the following:
|
/// The worker does the following:
|
||||||
/// - Listen for [`RpcDispatcherMessage`], perform requests and register new listeners for the notification streams
|
/// - Listen for [`RpcDispatcherMessage`], perform requests and register new listeners for the
|
||||||
/// - Distribute incoming import, best head and finalization notifications to registered listeners.
|
/// notification streams
|
||||||
/// If an error occurs during sending, the receiver has been closed and we remove the sender from the list.
|
/// - Distribute incoming import, best head and finalization notifications to registered
|
||||||
|
/// listeners. If an error occurs during sending, the receiver has been closed and we remove
|
||||||
|
/// the sender from the list.
|
||||||
/// - Find a new valid RPC server to connect to in case the websocket connection is terminated.
|
/// - Find a new valid RPC server to connect to in case the websocket connection is terminated.
|
||||||
/// If the worker is not able to connec to an RPC server from the list, the worker shuts down.
|
/// If the worker is not able to connec to an RPC server from the list, the worker shuts down.
|
||||||
async fn run(mut self) {
|
async fn run(mut self) {
|
||||||
|
|||||||
@@ -399,7 +399,8 @@ impl RelayChainRpcClient {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch the hash of the validation code used by a para, making the given `OccupiedCoreAssumption`.
|
/// Fetch the hash of the validation code used by a para, making the given
|
||||||
|
/// `OccupiedCoreAssumption`.
|
||||||
pub async fn parachain_host_validation_code_hash(
|
pub async fn parachain_host_validation_code_hash(
|
||||||
&self,
|
&self,
|
||||||
at: RelayHash,
|
at: RelayHash,
|
||||||
|
|||||||
@@ -377,7 +377,8 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new background task to wait for the relay chain to sync up and retrieve the parachain header
|
/// Creates a new background task to wait for the relay chain to sync up and retrieve the parachain
|
||||||
|
/// header
|
||||||
fn warp_sync_get<B, RCInterface>(
|
fn warp_sync_get<B, RCInterface>(
|
||||||
para_id: ParaId,
|
para_id: ParaId,
|
||||||
relay_chain_interface: RCInterface,
|
relay_chain_interface: RCInterface,
|
||||||
@@ -413,7 +414,8 @@ where
|
|||||||
receiver
|
receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Waits for the relay chain to have finished syncing and then gets the parachain header that corresponds to the last finalized relay chain block.
|
/// Waits for the relay chain to have finished syncing and then gets the parachain header that
|
||||||
|
/// corresponds to the last finalized relay chain block.
|
||||||
async fn wait_for_target_block<B, RCInterface>(
|
async fn wait_for_target_block<B, RCInterface>(
|
||||||
sender: oneshot::Sender<<B as BlockT>::Header>,
|
sender: oneshot::Sender<<B as BlockT>::Header>,
|
||||||
para_id: ParaId,
|
para_id: ParaId,
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
//! check the constructed block on the relay chain.
|
//! check the constructed block on the relay chain.
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//!# struct Runtime;
|
//! # struct Runtime;
|
||||||
//!# struct Executive;
|
//! # struct Executive;
|
||||||
//!# struct CheckInherents;
|
//! # struct CheckInherents;
|
||||||
//! cumulus_pallet_parachain_system::register_validate_block! {
|
//! cumulus_pallet_parachain_system::register_validate_block! {
|
||||||
//! Runtime = Runtime,
|
//! Runtime = Runtime,
|
||||||
//! BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
|
//! BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
|
||||||
@@ -75,8 +75,8 @@ pub mod pallet {
|
|||||||
/// Serves as cache for the authorities.
|
/// Serves as cache for the authorities.
|
||||||
///
|
///
|
||||||
/// The authorities in AuRa are overwritten in `on_initialize` when we switch to a new session,
|
/// The authorities in AuRa are overwritten in `on_initialize` when we switch to a new session,
|
||||||
/// but we require the old authorities to verify the seal when validating a PoV. This will always
|
/// but we require the old authorities to verify the seal when validating a PoV. This will
|
||||||
/// be updated to the latest AuRa authorities in `on_finalize`.
|
/// always be updated to the latest AuRa authorities in `on_finalize`.
|
||||||
#[pallet::storage]
|
#[pallet::storage]
|
||||||
pub(crate) type Authorities<T: Config> = StorageValue<
|
pub(crate) type Authorities<T: Config> = StorageValue<
|
||||||
_,
|
_,
|
||||||
|
|||||||
@@ -85,12 +85,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
/// Storage: Session NextKeys (r:1 w:0)
|
/// Storage: Session NextKeys (r:1 w:0)
|
||||||
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
|
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
|
||||||
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added:
|
||||||
/// Storage: CollatorSelection Candidates (r:1 w:1)
|
/// 1136, mode: MaxEncodedLen) Storage: CollatorSelection Candidates (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297,
|
||||||
/// Storage: System Account (r:1 w:1)
|
/// mode: MaxEncodedLen) Storage: System Account (r:1 w:1)
|
||||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode:
|
||||||
/// The range of component `b` is `[1, 19]`.
|
/// MaxEncodedLen) The range of component `b` is `[1, 19]`.
|
||||||
/// The range of component `c` is `[1, 99]`.
|
/// The range of component `c` is `[1, 99]`.
|
||||||
fn add_invulnerable(b: u32, c: u32) -> Weight {
|
fn add_invulnerable(b: u32, c: u32) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
@@ -109,8 +109,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
|
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
|
||||||
}
|
}
|
||||||
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added:
|
||||||
/// The range of component `b` is `[1, 100]`.
|
/// 3697, mode: MaxEncodedLen) The range of component `b` is `[1, 100]`.
|
||||||
fn remove_invulnerable(b: u32) -> Weight {
|
fn remove_invulnerable(b: u32) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `119 + b * (32 ±0)`
|
// Measured: `119 + b * (32 ±0)`
|
||||||
@@ -172,12 +172,12 @@ impl WeightInfo for () {
|
|||||||
/// Storage: Session NextKeys (r:1 w:0)
|
/// Storage: Session NextKeys (r:1 w:0)
|
||||||
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
|
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
|
||||||
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added:
|
||||||
/// Storage: CollatorSelection Candidates (r:1 w:1)
|
/// 1136, mode: MaxEncodedLen) Storage: CollatorSelection Candidates (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297,
|
||||||
/// Storage: System Account (r:1 w:1)
|
/// mode: MaxEncodedLen) Storage: System Account (r:1 w:1)
|
||||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode:
|
||||||
/// The range of component `b` is `[1, 19]`.
|
/// MaxEncodedLen) The range of component `b` is `[1, 19]`.
|
||||||
/// The range of component `c` is `[1, 99]`.
|
/// The range of component `c` is `[1, 99]`.
|
||||||
fn add_invulnerable(b: u32, c: u32) -> Weight {
|
fn add_invulnerable(b: u32, c: u32) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
@@ -196,8 +196,8 @@ impl WeightInfo for () {
|
|||||||
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
|
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
|
||||||
}
|
}
|
||||||
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
/// Storage: CollatorSelection Invulnerables (r:1 w:1)
|
||||||
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen)
|
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added:
|
||||||
/// The range of component `b` is `[1, 100]`.
|
/// 3697, mode: MaxEncodedLen) The range of component `b` is `[1, 100]`.
|
||||||
fn remove_invulnerable(b: u32) -> Weight {
|
fn remove_invulnerable(b: u32) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `119 + b * (32 ±0)`
|
// Measured: `119 + b * (32 ±0)`
|
||||||
|
|||||||
@@ -306,8 +306,8 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// For an incoming downward message, this just adapts an XCM executor and executes DMP messages
|
/// For an incoming downward message, this just adapts an XCM executor and executes DMP messages
|
||||||
/// immediately up until some `MaxWeight` at which point it errors. Their origin is asserted to be
|
/// immediately up until some `MaxWeight` at which point it errors. Their origin is asserted to
|
||||||
/// the `Parent` location.
|
/// be the `Parent` location.
|
||||||
impl<T: Config> DmpMessageHandler for Pallet<T> {
|
impl<T: Config> DmpMessageHandler for Pallet<T> {
|
||||||
fn handle_dmp_messages(
|
fn handle_dmp_messages(
|
||||||
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
||||||
@@ -367,8 +367,9 @@ pub mod pallet {
|
|||||||
required_weight,
|
required_weight,
|
||||||
});
|
});
|
||||||
page_index.overweight_count += 1;
|
page_index.overweight_count += 1;
|
||||||
// Not needed for control flow, but only to ensure that the compiler
|
// Not needed for control flow, but only to ensure that the
|
||||||
// understands that we won't attempt to re-use `data` later.
|
// compiler understands that we won't attempt to re-use `data`
|
||||||
|
// later.
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
// not overweight. stop executing inline and enqueue normally
|
// not overweight. stop executing inline and enqueue normally
|
||||||
|
|||||||
@@ -547,10 +547,12 @@ pub mod pallet {
|
|||||||
Unauthorized,
|
Unauthorized,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// In case of a scheduled upgrade, this storage field contains the validation code to be applied.
|
/// In case of a scheduled upgrade, this storage field contains the validation code to be
|
||||||
|
/// applied.
|
||||||
///
|
///
|
||||||
/// As soon as the relay chain gives us the go-ahead signal, we will overwrite the [`:code`][sp_core::storage::well_known_keys::CODE]
|
/// As soon as the relay chain gives us the go-ahead signal, we will overwrite the
|
||||||
/// which will result the next block process with the new validation code. This concludes the upgrade process.
|
/// [`:code`][sp_core::storage::well_known_keys::CODE] which will result the next block process
|
||||||
|
/// with the new validation code. This concludes the upgrade process.
|
||||||
#[pallet::storage]
|
#[pallet::storage]
|
||||||
#[pallet::getter(fn new_validation_function)]
|
#[pallet::getter(fn new_validation_function)]
|
||||||
pub(super) type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
|
pub(super) type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
|
||||||
@@ -871,8 +873,8 @@ impl<T: Config> Pallet<T> {
|
|||||||
|
|
||||||
/// Process all inbound horizontal messages relayed by the collator.
|
/// Process all inbound horizontal messages relayed by the collator.
|
||||||
///
|
///
|
||||||
/// This is similar to `Pallet::process_inbound_downward_messages`, but works on multiple inbound
|
/// This is similar to `Pallet::process_inbound_downward_messages`, but works on multiple
|
||||||
/// channels.
|
/// inbound channels.
|
||||||
///
|
///
|
||||||
/// **Panics** if either any of horizontal messages submitted by the collator was sent from
|
/// **Panics** if either any of horizontal messages submitted by the collator was sent from
|
||||||
/// a para which has no open channel to this parachain or if after processing
|
/// a para which has no open channel to this parachain or if after processing
|
||||||
@@ -988,7 +990,8 @@ impl<T: Config> Pallet<T> {
|
|||||||
/// The implementation of the runtime upgrade functionality for parachains.
|
/// The implementation of the runtime upgrade functionality for parachains.
|
||||||
pub fn schedule_code_upgrade(validation_function: Vec<u8>) -> DispatchResult {
|
pub fn schedule_code_upgrade(validation_function: Vec<u8>) -> DispatchResult {
|
||||||
// Ensure that `ValidationData` exists. We do not care about the validation data per se,
|
// Ensure that `ValidationData` exists. We do not care about the validation data per se,
|
||||||
// but we do care about the [`UpgradeRestrictionSignal`] which arrives with the same inherent.
|
// but we do care about the [`UpgradeRestrictionSignal`] which arrives with the same
|
||||||
|
// inherent.
|
||||||
ensure!(<ValidationData<T>>::exists(), Error::<T>::ValidationDataNotAvailable,);
|
ensure!(<ValidationData<T>>::exists(), Error::<T>::ValidationDataNotAvailable,);
|
||||||
ensure!(<UpgradeRestrictionSignal<T>>::get().is_none(), Error::<T>::ProhibitedByPolkadot);
|
ensure!(<UpgradeRestrictionSignal<T>>::get().is_none(), Error::<T>::ProhibitedByPolkadot);
|
||||||
|
|
||||||
@@ -1012,7 +1015,8 @@ impl<T: Config> Pallet<T> {
|
|||||||
|
|
||||||
/// Returns the [`CollationInfo`] of the current active block.
|
/// Returns the [`CollationInfo`] of the current active block.
|
||||||
///
|
///
|
||||||
/// The given `header` is the header of the built block we are collecting the collation info for.
|
/// The given `header` is the header of the built block we are collecting the collation info
|
||||||
|
/// for.
|
||||||
///
|
///
|
||||||
/// This is expected to be used by the
|
/// This is expected to be used by the
|
||||||
/// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api.
|
/// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api.
|
||||||
@@ -1175,7 +1179,8 @@ pub trait CheckInherents<Block: BlockT> {
|
|||||||
pub trait OnSystemEvent {
|
pub trait OnSystemEvent {
|
||||||
/// Called in each blocks once when the validation data is set by the inherent.
|
/// Called in each blocks once when the validation data is set by the inherent.
|
||||||
fn on_validation_data(data: &PersistedValidationData);
|
fn on_validation_data(data: &PersistedValidationData);
|
||||||
/// Called when the validation code is being applied, aka from the next block on this is the new runtime.
|
/// Called when the validation code is being applied, aka from the next block on this is the new
|
||||||
|
/// runtime.
|
||||||
fn on_validation_code_applied();
|
fn on_validation_code_applied();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1198,8 +1203,8 @@ pub trait RelaychainStateProvider {
|
|||||||
fn current_relay_chain_state() -> RelayChainState;
|
fn current_relay_chain_state() -> RelayChainState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implements [`BlockNumberProvider`] that returns relay chain block number fetched from validation data.
|
/// Implements [`BlockNumberProvider`] that returns relay chain block number fetched from validation
|
||||||
/// When validation data is not available (e.g. within on_initialize), 0 will be returned.
|
/// data. When validation data is not available (e.g. within on_initialize), 0 will be returned.
|
||||||
///
|
///
|
||||||
/// **NOTE**: This has been deprecated, please use [`RelaychainDataProvider`]
|
/// **NOTE**: This has been deprecated, please use [`RelaychainDataProvider`]
|
||||||
#[deprecated = "Use `RelaychainDataProvider` instead"]
|
#[deprecated = "Use `RelaychainDataProvider` instead"]
|
||||||
@@ -1241,9 +1246,10 @@ impl<T: Config> RelaychainStateProvider for RelaychainDataProvider<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implements [`BlockNumberProvider`] and [`RelaychainStateProvider`] that returns relevant relay data fetched from
|
/// Implements [`BlockNumberProvider`] and [`RelaychainStateProvider`] that returns relevant relay
|
||||||
/// validation data.
|
/// data fetched from validation data.
|
||||||
/// NOTE: When validation data is not available (e.g. within on_initialize), default values will be returned.
|
/// NOTE: When validation data is not available (e.g. within on_initialize), default values will be
|
||||||
|
/// returned.
|
||||||
pub struct RelaychainDataProvider<T>(sp_std::marker::PhantomData<T>);
|
pub struct RelaychainDataProvider<T>(sp_std::marker::PhantomData<T>);
|
||||||
|
|
||||||
impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> {
|
impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> {
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ pub struct MessagingStateSnapshot {
|
|||||||
/// If the value is absent on the relay chain this will be set to all zeros.
|
/// If the value is absent on the relay chain this will be set to all zeros.
|
||||||
pub dmq_mqc_head: relay_chain::Hash,
|
pub dmq_mqc_head: relay_chain::Hash,
|
||||||
|
|
||||||
/// The current capacity of the upward message queue of the current parachain on the relay chain.
|
/// The current capacity of the upward message queue of the current parachain on the relay
|
||||||
|
/// chain.
|
||||||
pub relay_dispatch_queue_remaining_capacity: RelayDispatchQueueRemainingCapacity,
|
pub relay_dispatch_queue_remaining_capacity: RelayDispatchQueueRemainingCapacity,
|
||||||
|
|
||||||
/// Information about all the inbound HRMP channels.
|
/// Information about all the inbound HRMP channels.
|
||||||
@@ -195,9 +196,10 @@ impl RelayChainStateProof {
|
|||||||
|
|
||||||
// TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size`
|
// TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size`
|
||||||
//
|
//
|
||||||
// When the relay chain and all parachains support `relay_dispatch_queue_remaining_capacity`,
|
// When the relay chain and all parachains support
|
||||||
// this code here needs to be removed and above needs to be changed to `read_entry` that
|
// `relay_dispatch_queue_remaining_capacity`, this code here needs to be removed and above
|
||||||
// returns an error if `relay_dispatch_queue_remaining_capacity` can not be found/decoded.
|
// needs to be changed to `read_entry` that returns an error if
|
||||||
|
// `relay_dispatch_queue_remaining_capacity` can not be found/decoded.
|
||||||
//
|
//
|
||||||
// For now we just fallback to the old dispatch queue size on `ReadEntryErr::Absent`.
|
// For now we just fallback to the old dispatch queue size on `ReadEntryErr::Absent`.
|
||||||
// `ReadEntryErr::Decode` and `ReadEntryErr::Proof` are potentially subject to meddling
|
// `ReadEntryErr::Decode` and `ReadEntryErr::Proof` are potentially subject to meddling
|
||||||
@@ -259,8 +261,9 @@ impl RelayChainStateProof {
|
|||||||
egress_channels.push((recipient, hrmp_channel));
|
egress_channels.push((recipient, hrmp_channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE that ingress_channels and egress_channels promise to be sorted. We satisfy this property
|
// NOTE that ingress_channels and egress_channels promise to be sorted. We satisfy this
|
||||||
// by relying on the fact that `ingress_channel_index` and `egress_channel_index` are themselves sorted.
|
// property by relying on the fact that `ingress_channel_index` and `egress_channel_index`
|
||||||
|
// are themselves sorted.
|
||||||
Ok(MessagingStateSnapshot {
|
Ok(MessagingStateSnapshot {
|
||||||
dmq_mqc_head,
|
dmq_mqc_head,
|
||||||
relay_dispatch_queue_remaining_capacity,
|
relay_dispatch_queue_remaining_capacity,
|
||||||
@@ -320,12 +323,12 @@ impl RelayChainStateProof {
|
|||||||
.map_err(Error::UpgradeRestriction)
|
.map_err(Error::UpgradeRestriction)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read an entry given by the key and try to decode it. If the value specified by the key according
|
/// Read an entry given by the key and try to decode it. If the value specified by the key
|
||||||
/// to the proof is empty, the `fallback` value will be returned.
|
/// according to the proof is empty, the `fallback` value will be returned.
|
||||||
///
|
///
|
||||||
/// Returns `Err` in case the backend can't return the value under the specific key (likely due to
|
/// Returns `Err` in case the backend can't return the value under the specific key (likely due
|
||||||
/// a malformed proof), in case the decoding fails, or in case where the value is empty in the relay
|
/// to a malformed proof), in case the decoding fails, or in case where the value is empty in
|
||||||
/// chain state and no fallback was provided.
|
/// the relay chain state and no fallback was provided.
|
||||||
pub fn read_entry<T>(&self, key: &[u8], fallback: Option<T>) -> Result<T, Error>
|
pub fn read_entry<T>(&self, key: &[u8], fallback: Option<T>) -> Result<T, Error>
|
||||||
where
|
where
|
||||||
T: Decode,
|
T: Decode,
|
||||||
@@ -335,8 +338,8 @@ impl RelayChainStateProof {
|
|||||||
|
|
||||||
/// Read an optional entry given by the key and try to decode it.
|
/// Read an optional entry given by the key and try to decode it.
|
||||||
///
|
///
|
||||||
/// Returns `Err` in case the backend can't return the value under the specific key (likely due to
|
/// Returns `Err` in case the backend can't return the value under the specific key (likely due
|
||||||
/// a malformed proof) or if the value couldn't be decoded.
|
/// to a malformed proof) or if the value couldn't be decoded.
|
||||||
pub fn read_optional_entry<T>(&self, key: &[u8]) -> Result<Option<T>, Error>
|
pub fn read_optional_entry<T>(&self, key: &[u8]) -> Result<Option<T>, Error>
|
||||||
where
|
where
|
||||||
T: Decode,
|
T: Decode,
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ pub mod pallet {
|
|||||||
#[pallet::without_storage_info]
|
#[pallet::without_storage_info]
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
/// In case of a scheduled migration, this storage field contains the custom head data to be applied.
|
/// In case of a scheduled migration, this storage field contains the custom head data to be
|
||||||
|
/// applied.
|
||||||
#[pallet::storage]
|
#[pallet::storage]
|
||||||
pub(super) type PendingCustomValidationHeadData<T: Config> =
|
pub(super) type PendingCustomValidationHeadData<T: Config> =
|
||||||
StorageValue<_, Vec<u8>, OptionQuery>;
|
StorageValue<_, Vec<u8>, OptionQuery>;
|
||||||
@@ -48,7 +49,8 @@ pub mod pallet {
|
|||||||
pub enum Event {
|
pub enum Event {
|
||||||
/// The custom validation head data has been scheduled to apply.
|
/// The custom validation head data has been scheduled to apply.
|
||||||
CustomValidationHeadDataStored,
|
CustomValidationHeadDataStored,
|
||||||
/// The custom validation head data was applied as of the contained relay chain block number.
|
/// The custom validation head data was applied as of the contained relay chain block
|
||||||
|
/// number.
|
||||||
CustomValidationHeadDataApplied,
|
CustomValidationHeadDataApplied,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +85,8 @@ pub mod pallet {
|
|||||||
Self::deposit_event(Event::CustomValidationHeadDataStored);
|
Self::deposit_event(Event::CustomValidationHeadDataStored);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set pending custom head data as head data that will be returned by `validate_block`. on the relay chain.
|
/// Set pending custom head data as head data that will be returned by `validate_block`. on
|
||||||
|
/// the relay chain.
|
||||||
fn set_pending_custom_validation_head_data() {
|
fn set_pending_custom_validation_head_data() {
|
||||||
if let Some(head_data) = <PendingCustomValidationHeadData<T>>::take() {
|
if let Some(head_data) = <PendingCustomValidationHeadData<T>>::take() {
|
||||||
parachain_system::Pallet::<T>::set_custom_validation_head_data(head_data);
|
parachain_system::Pallet::<T>::set_custom_validation_head_data(head_data);
|
||||||
|
|||||||
@@ -187,8 +187,8 @@ pub mod pallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites the number of pages of messages which must be in the queue for the other side to be told to
|
/// Overwrites the number of pages of messages which must be in the queue for the other side
|
||||||
/// suspend their sending.
|
/// to be told to suspend their sending.
|
||||||
///
|
///
|
||||||
/// - `origin`: Must pass `Root`.
|
/// - `origin`: Must pass `Root`.
|
||||||
/// - `new`: Desired value for `QueueConfigData.suspend_value`
|
/// - `new`: Desired value for `QueueConfigData.suspend_value`
|
||||||
@@ -201,8 +201,8 @@ pub mod pallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites the number of pages of messages which must be in the queue after which we drop any further
|
/// Overwrites the number of pages of messages which must be in the queue after which we
|
||||||
/// messages from the channel.
|
/// drop any further messages from the channel.
|
||||||
///
|
///
|
||||||
/// - `origin`: Must pass `Root`.
|
/// - `origin`: Must pass `Root`.
|
||||||
/// - `new`: Desired value for `QueueConfigData.drop_threshold`
|
/// - `new`: Desired value for `QueueConfigData.drop_threshold`
|
||||||
@@ -215,8 +215,8 @@ pub mod pallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites the number of pages of messages which the queue must be reduced to before it signals that
|
/// Overwrites the number of pages of messages which the queue must be reduced to before it
|
||||||
/// message sending may recommence after it has been suspended.
|
/// signals that message sending may recommence after it has been suspended.
|
||||||
///
|
///
|
||||||
/// - `origin`: Must pass `Root`.
|
/// - `origin`: Must pass `Root`.
|
||||||
/// - `new`: Desired value for `QueueConfigData.resume_threshold`
|
/// - `new`: Desired value for `QueueConfigData.resume_threshold`
|
||||||
@@ -243,7 +243,8 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites the speed to which the available weight approaches the maximum weight.
|
/// Overwrites the speed to which the available weight approaches the maximum weight.
|
||||||
/// A lower number results in a faster progression. A value of 1 makes the entire weight available initially.
|
/// A lower number results in a faster progression. A value of 1 makes the entire weight
|
||||||
|
/// available initially.
|
||||||
///
|
///
|
||||||
/// - `origin`: Must pass `Root`.
|
/// - `origin`: Must pass `Root`.
|
||||||
/// - `new`: Desired value for `QueueConfigData.weight_restrict_decay`.
|
/// - `new`: Desired value for `QueueConfigData.weight_restrict_decay`.
|
||||||
@@ -257,7 +258,8 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrite the maximum amount of weight any individual message may consume.
|
/// Overwrite the maximum amount of weight any individual message may consume.
|
||||||
/// Messages above this weight go into the overweight queue and may only be serviced explicitly.
|
/// Messages above this weight go into the overweight queue and may only be serviced
|
||||||
|
/// explicitly.
|
||||||
///
|
///
|
||||||
/// - `origin`: Must pass `Root`.
|
/// - `origin`: Must pass `Root`.
|
||||||
/// - `new`: Desired value for `QueueConfigData.xcmp_max_individual_weight`.
|
/// - `new`: Desired value for `QueueConfigData.xcmp_max_individual_weight`.
|
||||||
@@ -679,8 +681,8 @@ impl<T: Config> Pallet<T> {
|
|||||||
Overweight::<T>::count() < MAX_OVERWEIGHT_MESSAGES;
|
Overweight::<T>::count() < MAX_OVERWEIGHT_MESSAGES;
|
||||||
weight_used.saturating_accrue(T::DbWeight::get().reads(1));
|
weight_used.saturating_accrue(T::DbWeight::get().reads(1));
|
||||||
if is_under_limit {
|
if is_under_limit {
|
||||||
// overweight - add to overweight queue and continue with message
|
// overweight - add to overweight queue and continue with
|
||||||
// execution consuming the message.
|
// message execution consuming the message.
|
||||||
let msg_len = last_remaining_fragments
|
let msg_len = last_remaining_fragments
|
||||||
.len()
|
.len()
|
||||||
.saturating_sub(remaining_fragments.len());
|
.saturating_sub(remaining_fragments.len());
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ fn bad_message_is_handled() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tests that a blob message is handled. Currently this isn't implemented and panics when debug assertions
|
/// Tests that a blob message is handled. Currently this isn't implemented and panics when debug
|
||||||
/// are enabled. When this feature is enabled, this test should be rewritten properly.
|
/// assertions are enabled. When this feature is enabled, this test should be rewritten properly.
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic = "Blob messages not handled."]
|
#[should_panic = "Blob messages not handled."]
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|||||||
+10
-5
@@ -161,7 +161,8 @@ fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> Dispa
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work
|
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't
|
||||||
|
/// work
|
||||||
#[test]
|
#[test]
|
||||||
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
||||||
// Init values for Relay Chain
|
// Init values for Relay Chain
|
||||||
@@ -299,14 +300,16 @@ fn limited_reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubKusama>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubKusama>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubKusama>(system_para_to_para_limited_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubKusama>(system_para_to_para_limited_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
||||||
@@ -329,14 +332,16 @@ fn reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubKusama>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubKusama>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubKusama>(system_para_to_para_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubKusama>(system_para_to_para_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
||||||
|
|||||||
+10
-5
@@ -161,7 +161,8 @@ fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> Dispa
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work
|
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't
|
||||||
|
/// work
|
||||||
#[test]
|
#[test]
|
||||||
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
||||||
// Init values for Relay Chain
|
// Init values for Relay Chain
|
||||||
@@ -299,14 +300,16 @@ fn limited_reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubPolkadot>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubPolkadot>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubPolkadot>(system_para_to_para_limited_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubPolkadot>(system_para_to_para_limited_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
||||||
@@ -329,14 +332,16 @@ fn reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubPolkadot>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubPolkadot>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubPolkadot>(system_para_to_para_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubPolkadot>(system_para_to_para_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
||||||
|
|||||||
+10
-5
@@ -161,7 +161,8 @@ fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> Dispa
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work
|
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't
|
||||||
|
/// work
|
||||||
#[test]
|
#[test]
|
||||||
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
|
||||||
// Init values for Relay Chain
|
// Init values for Relay Chain
|
||||||
@@ -299,14 +300,16 @@ fn limited_reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubWestend>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubWestend>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubWestend>(system_para_to_para_limited_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubWestend>(system_para_to_para_limited_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
/// Reserve Transfers of native asset from System Parachain to Parachain should work
|
||||||
@@ -329,14 +332,16 @@ fn reserve_transfer_native_asset_from_system_para_to_para() {
|
|||||||
let sender_balance_before = test.sender.balance;
|
let sender_balance_before = test.sender.balance;
|
||||||
|
|
||||||
test.set_assertion::<AssetHubWestend>(system_para_to_para_assertions);
|
test.set_assertion::<AssetHubWestend>(system_para_to_para_assertions);
|
||||||
// TODO: Add assertion for Penpal runtime. Right now message is failing with `UntrustedReserveLocation`
|
// TODO: Add assertion for Penpal runtime. Right now message is failing with
|
||||||
|
// `UntrustedReserveLocation`
|
||||||
test.set_dispatchable::<AssetHubWestend>(system_para_to_para_reserve_transfer_assets);
|
test.set_dispatchable::<AssetHubWestend>(system_para_to_para_reserve_transfer_assets);
|
||||||
test.assert();
|
test.assert();
|
||||||
|
|
||||||
let sender_balance_after = test.sender.balance;
|
let sender_balance_after = test.sender.balance;
|
||||||
|
|
||||||
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
|
||||||
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve transfers
|
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
|
||||||
|
// transfers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
|
||||||
|
|||||||
@@ -112,8 +112,10 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte
|
|||||||
// Ignore `TrustBackedAssets` explicitly
|
// Ignore `TrustBackedAssets` explicitly
|
||||||
StartsWith<TrustBackedAssetsPalletLocation>,
|
StartsWith<TrustBackedAssetsPalletLocation>,
|
||||||
// Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means:
|
// Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means:
|
||||||
// - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)}`
|
// - foreign assets from our consensus should be: `MultiLocation {parents: 1,
|
||||||
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't be accepted here
|
// X*(Parachain(xyz), ..)}`
|
||||||
|
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't
|
||||||
|
// be accepted here
|
||||||
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
||||||
),
|
),
|
||||||
Balance,
|
Balance,
|
||||||
@@ -355,7 +357,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Allow XCMs with some computed origins to pass through.
|
// Allow XCMs with some computed origins to pass through.
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
@@ -455,7 +458,8 @@ impl pallet_xcm::Config for Runtime {
|
|||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
// We support local origins dispatching XCM executions in principle...
|
// We support local origins dispatching XCM executions in principle...
|
||||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||||
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
|
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are
|
||||||
|
// allowed.
|
||||||
type XcmExecuteFilter = Nothing;
|
type XcmExecuteFilter = Nothing;
|
||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
type XcmTeleportFilter = Everything;
|
type XcmTeleportFilter = Everything;
|
||||||
|
|||||||
@@ -183,7 +183,8 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
||||||
|
|
||||||
// Make sure again buy_weight does return an error
|
// Make sure again buy_weight does return an error
|
||||||
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader` tuple chain, which cannot be called twice
|
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader`
|
||||||
|
// tuple chain, which cannot be called twice
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
||||||
|
|
||||||
// We actually use half of the weight
|
// We actually use half of the weight
|
||||||
|
|||||||
@@ -113,8 +113,10 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte
|
|||||||
// Ignore `TrustBackedAssets` explicitly
|
// Ignore `TrustBackedAssets` explicitly
|
||||||
StartsWith<TrustBackedAssetsPalletLocation>,
|
StartsWith<TrustBackedAssetsPalletLocation>,
|
||||||
// Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means:
|
// Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means:
|
||||||
// - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)}`
|
// - foreign assets from our consensus should be: `MultiLocation {parents: 1,
|
||||||
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't be accepted here
|
// X*(Parachain(xyz), ..)}`
|
||||||
|
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't
|
||||||
|
// be accepted here
|
||||||
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
||||||
),
|
),
|
||||||
Balance,
|
Balance,
|
||||||
@@ -466,7 +468,8 @@ impl pallet_xcm::Config for Runtime {
|
|||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
// We support local origins dispatching XCM executions in principle...
|
// We support local origins dispatching XCM executions in principle...
|
||||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||||
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
|
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are
|
||||||
|
// allowed.
|
||||||
type XcmExecuteFilter = Nothing;
|
type XcmExecuteFilter = Nothing;
|
||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
type XcmTeleportFilter = Everything;
|
type XcmTeleportFilter = Everything;
|
||||||
|
|||||||
@@ -190,7 +190,8 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
||||||
|
|
||||||
// Make sure again buy_weight does return an error
|
// Make sure again buy_weight does return an error
|
||||||
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader` tuple chain, which cannot be called twice
|
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader`
|
||||||
|
// tuple chain, which cannot be called twice
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
||||||
|
|
||||||
// We actually use half of the weight
|
// We actually use half of the weight
|
||||||
|
|||||||
@@ -1392,8 +1392,9 @@ pub mod migrations {
|
|||||||
use sp_runtime::{traits::StaticLookup, Saturating};
|
use sp_runtime::{traits::StaticLookup, Saturating};
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
|
|
||||||
/// Temporary migration because of bug with native asset, it can be removed once applied on `AssetHubWestend`.
|
/// Temporary migration because of bug with native asset, it can be removed once applied on
|
||||||
/// Migrates pools with `MultiLocation { parents: 0, interior: Here }` to `MultiLocation { parents: 1, interior: Here }`
|
/// `AssetHubWestend`. Migrates pools with `MultiLocation { parents: 0, interior: Here }` to
|
||||||
|
/// `MultiLocation { parents: 1, interior: Here }`
|
||||||
pub struct NativeAssetParents0ToParents1Migration<T>(sp_std::marker::PhantomData<T>);
|
pub struct NativeAssetParents0ToParents1Migration<T>(sp_std::marker::PhantomData<T>);
|
||||||
impl<
|
impl<
|
||||||
T: pallet_asset_conversion::Config<
|
T: pallet_asset_conversion::Config<
|
||||||
|
|||||||
@@ -118,8 +118,10 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte
|
|||||||
// Ignore `TrustBackedAssets` explicitly
|
// Ignore `TrustBackedAssets` explicitly
|
||||||
StartsWith<TrustBackedAssetsPalletLocation>,
|
StartsWith<TrustBackedAssetsPalletLocation>,
|
||||||
// Ignore asset which starts explicitly with our `GlobalConsensus(NetworkId)`, means:
|
// Ignore asset which starts explicitly with our `GlobalConsensus(NetworkId)`, means:
|
||||||
// - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)}
|
// - foreign assets from our consensus should be: `MultiLocation {parents: 1,
|
||||||
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` wont be accepted here
|
// X*(Parachain(xyz), ..)}
|
||||||
|
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` wont
|
||||||
|
// be accepted here
|
||||||
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
|
||||||
),
|
),
|
||||||
Balance,
|
Balance,
|
||||||
@@ -417,7 +419,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Allow XCMs with some computed origins to pass through.
|
// Allow XCMs with some computed origins to pass through.
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
|
|||||||
@@ -193,7 +193,8 @@ fn test_asset_xcm_trader_with_refund() {
|
|||||||
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx));
|
||||||
|
|
||||||
// Make sure again buy_weight does return an error
|
// Make sure again buy_weight does return an error
|
||||||
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader` tuple chain, which cannot be called twice
|
// This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader`
|
||||||
|
// tuple chain, which cannot be called twice
|
||||||
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive);
|
||||||
|
|
||||||
// We actually use half of the weight
|
// We actually use half of the weight
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ pub type MultiLocationConvertedConcreteId<MultiLocationFilter, Balance> =
|
|||||||
JustTry,
|
JustTry,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// [`MatchedConvertedConcreteId`] converter dedicated for storing `ForeignAssets` with `AssetId` as `MultiLocation`.
|
/// [`MatchedConvertedConcreteId`] converter dedicated for storing `ForeignAssets` with `AssetId` as
|
||||||
|
/// `MultiLocation`.
|
||||||
///
|
///
|
||||||
/// Excludes by default:
|
/// Excludes by default:
|
||||||
/// - parent as relay chain
|
/// - parent as relay chain
|
||||||
@@ -68,7 +69,8 @@ pub type ForeignAssetsConvertedConcreteId<AdditionalMultiLocationExclusionFilter
|
|||||||
// Excludes relay/parent chain currency
|
// Excludes relay/parent chain currency
|
||||||
Equals<ParentLocation>,
|
Equals<ParentLocation>,
|
||||||
// Here we rely on fact that something like this works:
|
// Here we rely on fact that something like this works:
|
||||||
// assert!(MultiLocation::new(1, X1(Parachain(100))).starts_with(&MultiLocation::parent()));
|
// assert!(MultiLocation::new(1,
|
||||||
|
// X1(Parachain(100))).starts_with(&MultiLocation::parent()));
|
||||||
// assert!(X1(Parachain(100)).starts_with(&Here));
|
// assert!(X1(Parachain(100)).starts_with(&Here));
|
||||||
StartsWith<LocalMultiLocationPattern>,
|
StartsWith<LocalMultiLocationPattern>,
|
||||||
// Here we can exclude more stuff or leave it as `()`
|
// Here we can exclude more stuff or leave it as `()`
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ macro_rules! include_teleports_for_native_asset_works(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Test-case makes sure that `Runtime` can receive teleported assets from sibling parachain relay chain
|
/// Test-case makes sure that `Runtime` can receive teleported assets from sibling parachain relay
|
||||||
|
/// chain
|
||||||
pub fn teleports_for_foreign_assets_works<
|
pub fn teleports_for_foreign_assets_works<
|
||||||
Runtime,
|
Runtime,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
@@ -595,7 +596,8 @@ macro_rules! include_teleports_for_foreign_assets_works(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Test-case makes sure that `Runtime`'s `xcm::AssetTransactor` can handle native relay chain currency
|
/// Test-case makes sure that `Runtime`'s `xcm::AssetTransactor` can handle native relay chain
|
||||||
|
/// currency
|
||||||
pub fn asset_transactor_transfer_with_local_consensus_currency_works<Runtime, XcmConfig>(
|
pub fn asset_transactor_transfer_with_local_consensus_currency_works<Runtime, XcmConfig>(
|
||||||
collator_session_keys: CollatorSessionKeys<Runtime>,
|
collator_session_keys: CollatorSessionKeys<Runtime>,
|
||||||
source_account: AccountIdOf<Runtime>,
|
source_account: AccountIdOf<Runtime>,
|
||||||
@@ -707,7 +709,8 @@ macro_rules! include_asset_transactor_transfer_with_local_consensus_currency_wor
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
///Test-case makes sure that `Runtime`'s `xcm::AssetTransactor` can handle native relay chain currency
|
///Test-case makes sure that `Runtime`'s `xcm::AssetTransactor` can handle native relay chain
|
||||||
|
/// currency
|
||||||
pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
||||||
Runtime,
|
Runtime,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
@@ -827,7 +830,8 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works<
|
|||||||
);
|
);
|
||||||
additional_checks_before();
|
additional_checks_before();
|
||||||
|
|
||||||
// transfer_asset (deposit/withdraw) ALICE -> CHARLIE (not ok - Charlie does not have ExistentialDeposit)
|
// transfer_asset (deposit/withdraw) ALICE -> CHARLIE (not ok - Charlie does not have
|
||||||
|
// ExistentialDeposit)
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
RuntimeHelper::<XcmConfig>::do_transfer(
|
RuntimeHelper::<XcmConfig>::do_transfer(
|
||||||
MultiLocation {
|
MultiLocation {
|
||||||
@@ -1103,7 +1107,8 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
|||||||
freezer: bob_account.clone().into(),
|
freezer: bob_account.clone().into(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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(), weight_limit: Unlimited },
|
BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited },
|
||||||
@@ -1206,7 +1211,8 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
|||||||
pallet_assets::Error::<Runtime, ForeignAssetsPalletInstance>::NoPermission
|
pallet_assets::Error::<Runtime, ForeignAssetsPalletInstance>::NoPermission
|
||||||
);
|
);
|
||||||
|
|
||||||
// lets try create asset for different parachain(3333) (foreign_creator(2222) can create just his assets)
|
// lets try create asset for different parachain(3333) (foreign_creator(2222) can create
|
||||||
|
// just his assets)
|
||||||
let foreign_asset_id_multilocation =
|
let foreign_asset_id_multilocation =
|
||||||
MultiLocation { parents: 1, interior: X2(Parachain(3333), GeneralIndex(1234567)) };
|
MultiLocation { parents: 1, interior: X2(Parachain(3333), GeneralIndex(1234567)) };
|
||||||
let asset_id = AssetIdConverter::convert(&foreign_asset_id_multilocation).unwrap();
|
let asset_id = AssetIdConverter::convert(&foreign_asset_id_multilocation).unwrap();
|
||||||
|
|||||||
@@ -163,7 +163,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
AllowKnownQueryResponses<PolkadotXcm>,
|
AllowKnownQueryResponses<PolkadotXcm>,
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
|
|||||||
@@ -166,9 +166,11 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
AllowKnownQueryResponses<PolkadotXcm>,
|
AllowKnownQueryResponses<PolkadotXcm>,
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution.
|
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality
|
||||||
|
// get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
|
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
AllowKnownQueryResponses<PolkadotXcm>,
|
AllowKnownQueryResponses<PolkadotXcm>,
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
@@ -230,8 +231,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type XcmSender = XcmRouter;
|
type XcmSender = XcmRouter;
|
||||||
type AssetTransactor = CurrencyTransactor;
|
type AssetTransactor = CurrencyTransactor;
|
||||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||||
// BridgeHub does not recognize a reserve location for any asset. Users must teleport Native token
|
// BridgeHub does not recognize a reserve location for any asset. Users must teleport Native
|
||||||
// where allowed (e.g. with the Relay Chain).
|
// token where allowed (e.g. with the Relay Chain).
|
||||||
type IsReserve = ();
|
type IsReserve = ();
|
||||||
/// Only allow teleportation of NativeToken of relay chain.
|
/// Only allow teleportation of NativeToken of relay chain.
|
||||||
type IsTeleporter = ConcreteNativeAssetFrom<RelayLocation>;
|
type IsTeleporter = ConcreteNativeAssetFrom<RelayLocation>;
|
||||||
@@ -317,7 +318,8 @@ impl cumulus_pallet_xcm::Config for Runtime {
|
|||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hacky switch implementation, because we have just one runtime for Rococo and Wococo BridgeHub, so it means we have just one XcmConfig
|
/// Hacky switch implementation, because we have just one runtime for Rococo and Wococo BridgeHub,
|
||||||
|
/// so it means we have just one XcmConfig
|
||||||
pub struct BridgeHubRococoOrBridgeHubWococoSwitchExporter;
|
pub struct BridgeHubRococoOrBridgeHubWococoSwitchExporter;
|
||||||
impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter {
|
impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter {
|
||||||
type Ticket = (NetworkId, (sp_std::prelude::Vec<u8>, XcmHash));
|
type Ticket = (NetworkId, (sp_std::prelude::Vec<u8>, XcmHash));
|
||||||
|
|||||||
@@ -243,7 +243,8 @@ pub fn message_dispatch_routing_works<
|
|||||||
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
||||||
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
||||||
>,
|
>,
|
||||||
// MessageDispatcher: MessageDispatch<AccountIdOf<Runtime>, DispatchLevelResult = XcmBlobMessageDispatchResult, DispatchPayload = XcmAsPlainPayload>,
|
// MessageDispatcher: MessageDispatch<AccountIdOf<Runtime>, DispatchLevelResult =
|
||||||
|
// XcmBlobMessageDispatchResult, DispatchPayload = XcmAsPlainPayload>,
|
||||||
RuntimeNetwork: Get<NetworkId>,
|
RuntimeNetwork: Get<NetworkId>,
|
||||||
BridgedNetwork: Get<NetworkId>,
|
BridgedNetwork: Get<NetworkId>,
|
||||||
{
|
{
|
||||||
@@ -839,7 +840,8 @@ pub mod test_data {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper that creates InitializationData mock data, that can be used to initialize bridge GRANDPA pallet
|
/// Helper that creates InitializationData mock data, that can be used to initialize bridge
|
||||||
|
/// GRANDPA pallet
|
||||||
pub fn initialization_data<
|
pub fn initialization_data<
|
||||||
Runtime: pallet_bridge_grandpa::Config<GrandpaPalletInstance>,
|
Runtime: pallet_bridge_grandpa::Config<GrandpaPalletInstance>,
|
||||||
GrandpaPalletInstance: 'static,
|
GrandpaPalletInstance: 'static,
|
||||||
|
|||||||
+20
-20
@@ -171,43 +171,43 @@ pub mod tests {
|
|||||||
fn check_fellowship_addresses() {
|
fn check_fellowship_addresses() {
|
||||||
let fellowship_addresses = FellowshipAddresses::get();
|
let fellowship_addresses = FellowshipAddresses::get();
|
||||||
let kusama_fellowship_ss58: [(Rank, _); 47] = [
|
let kusama_fellowship_ss58: [(Rank, _); 47] = [
|
||||||
(6, "16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna"), // proof https://kusama.subscan.io/extrinsic/16832707-4
|
(6, "16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna"), /* proof https://kusama.subscan.io/extrinsic/16832707-4 */
|
||||||
(6, "12MrP337azmkTdfCUKe5XLnSQrbgEKqqfZ4PQC7CZTJKAWR3"), // proof https://kusama.subscan.io/extrinsic/16967809-2
|
(6, "12MrP337azmkTdfCUKe5XLnSQrbgEKqqfZ4PQC7CZTJKAWR3"), /* proof https://kusama.subscan.io/extrinsic/16967809-2 */
|
||||||
(6, "FFFF3gBSSDFSvK2HBq4qgLH75DHqXWPHeCnR1BSksAMacBs"),
|
(6, "FFFF3gBSSDFSvK2HBq4qgLH75DHqXWPHeCnR1BSksAMacBs"),
|
||||||
(5, "G7YVCdxZb8JLpAm9WMnJdNuojNT84AzU62zmvx5P1FMNtg2"),
|
(5, "G7YVCdxZb8JLpAm9WMnJdNuojNT84AzU62zmvx5P1FMNtg2"),
|
||||||
(5, "15G1iXDLgFyfnJ51FKq1ts44TduMyUtekvzQi9my4hgYt2hs"), // proof https://kusama.subscan.io/extrinsic/16917610-2
|
(5, "15G1iXDLgFyfnJ51FKq1ts44TduMyUtekvzQi9my4hgYt2hs"), /* proof https://kusama.subscan.io/extrinsic/16917610-2 */
|
||||||
(5, "Dcm1BqR4N7nHuV43TXdET7pNibt1Nzm42FggPHpxKRven53"),
|
(5, "Dcm1BqR4N7nHuV43TXdET7pNibt1Nzm42FggPHpxKRven53"),
|
||||||
(5, "1363HWTPzDrzAQ6ChFiMU6mP4b6jmQid2ae55JQcKtZnpLGv"), // proof https://kusama.subscan.io/extrinsic/16961180-2
|
(5, "1363HWTPzDrzAQ6ChFiMU6mP4b6jmQid2ae55JQcKtZnpLGv"), /* proof https://kusama.subscan.io/extrinsic/16961180-2 */
|
||||||
(4, "EGVQCe73TpFyAZx5uKfE1222XfkT3BSKozjgcqzLBnc5eYo"),
|
(4, "EGVQCe73TpFyAZx5uKfE1222XfkT3BSKozjgcqzLBnc5eYo"),
|
||||||
(4, "1eTPAR2TuqLyidmPT9rMmuycHVm9s9czu78sePqg2KHMDrE"), // proof https://kusama.subscan.io/extrinsic/16921712-3
|
(4, "1eTPAR2TuqLyidmPT9rMmuycHVm9s9czu78sePqg2KHMDrE"), /* proof https://kusama.subscan.io/extrinsic/16921712-3 */
|
||||||
(4, "14DsLzVyTUTDMm2eP3czwPbH53KgqnQRp3CJJZS9GR7yxGDP"), // proof https://kusama.subscan.io/extrinsic/16917519-2
|
(4, "14DsLzVyTUTDMm2eP3czwPbH53KgqnQRp3CJJZS9GR7yxGDP"), /* proof https://kusama.subscan.io/extrinsic/16917519-2 */
|
||||||
(3, "13aYUFHB3umoPoxBEAHSv451iR3RpsNi3t5yBZjX2trCtTp6"), // proof https://kusama.subscan.io/extrinsic/16917832-3
|
(3, "13aYUFHB3umoPoxBEAHSv451iR3RpsNi3t5yBZjX2trCtTp6"), /* proof https://kusama.subscan.io/extrinsic/16917832-3 */
|
||||||
(3, "H25aCspunTUqAt4D1gC776vKZ8FX3MvQJ3Jde6qDXPQaFxk"),
|
(3, "H25aCspunTUqAt4D1gC776vKZ8FX3MvQJ3Jde6qDXPQaFxk"),
|
||||||
(3, "GtLQoW4ZqcjExMPq6qB22bYc6NaX1yMzRuGWpSRiHqnzRb9"),
|
(3, "GtLQoW4ZqcjExMPq6qB22bYc6NaX1yMzRuGWpSRiHqnzRb9"),
|
||||||
(3, "15db5ksZgmhWE9U8MDq4wLKUdFivLVBybztWV8nmaJvv3NU1"), // proof https://kusama.subscan.io/extrinsic/16876631-2
|
(3, "15db5ksZgmhWE9U8MDq4wLKUdFivLVBybztWV8nmaJvv3NU1"), /* proof https://kusama.subscan.io/extrinsic/16876631-2 */
|
||||||
(3, "HfFpz4QUxfbocHudf8UU7cMgHqkHpf855Me5X846PZAsAYE"),
|
(3, "HfFpz4QUxfbocHudf8UU7cMgHqkHpf855Me5X846PZAsAYE"),
|
||||||
(3, "14ShUZUYUR35RBZW6uVVt1zXDxmSQddkeDdXf1JkMA6P721N"), // proof https://kusama.subscan.io/extrinsic/16918890-8
|
(3, "14ShUZUYUR35RBZW6uVVt1zXDxmSQddkeDdXf1JkMA6P721N"), /* proof https://kusama.subscan.io/extrinsic/16918890-8 */
|
||||||
(3, "12YzxR5TvGzfMVZNnhAJ5Hwi5zExpRWMKv2MuMwZTrddvgoi"), // proof https://kusama.subscan.io/extrinsic/16924324-3
|
(3, "12YzxR5TvGzfMVZNnhAJ5Hwi5zExpRWMKv2MuMwZTrddvgoi"), /* proof https://kusama.subscan.io/extrinsic/16924324-3 */
|
||||||
(2, "Ddb9puChKMHq4gM6o47E551wAmaNeu6kHngX1jzNNqAw782"),
|
(2, "Ddb9puChKMHq4gM6o47E551wAmaNeu6kHngX1jzNNqAw782"),
|
||||||
(2, "15DCWHQknBjc5YPFoVj8Pn2KoqrqYywJJ95BYNYJ4Fj3NLqz"), // proof https://kusama.subscan.io/extrinsic/16834952-2
|
(2, "15DCWHQknBjc5YPFoVj8Pn2KoqrqYywJJ95BYNYJ4Fj3NLqz"), /* proof https://kusama.subscan.io/extrinsic/16834952-2 */
|
||||||
(2, "14ajTQdrtCA8wZmC4PgD8Y1B2Gy8L4Z3oi2fodxq9FehcFrM"), // proof https://kusama.subscan.io/extrinsic/16944257-2
|
(2, "14ajTQdrtCA8wZmC4PgD8Y1B2Gy8L4Z3oi2fodxq9FehcFrM"), /* proof https://kusama.subscan.io/extrinsic/16944257-2 */
|
||||||
(2, "HxhDbS3grLurk1dhDgPiuDaRowHY1xHCU8Vu8on3fdg85tx"),
|
(2, "HxhDbS3grLurk1dhDgPiuDaRowHY1xHCU8Vu8on3fdg85tx"),
|
||||||
(2, "HTk3eccL7WBkiyxz1gBcqQRghsJigoDMD7mnQaz1UAbMpQV"),
|
(2, "HTk3eccL7WBkiyxz1gBcqQRghsJigoDMD7mnQaz1UAbMpQV"),
|
||||||
(2, "EcNWrSPSDcVBRymwr26kk4JVFg92PdoU5Xwp87W2FgFSt9c"),
|
(2, "EcNWrSPSDcVBRymwr26kk4JVFg92PdoU5Xwp87W2FgFSt9c"),
|
||||||
(2, "D8sM6vKjWaeKy2zCPYWGkLLbWdUtWQrXBTQqr4dSYnVQo21"),
|
(2, "D8sM6vKjWaeKy2zCPYWGkLLbWdUtWQrXBTQqr4dSYnVQo21"),
|
||||||
(1, "GfbnnEgRU94n9ed4RFZ6Z9dBAWs5obykigJSwXKU9hsT2uU"),
|
(1, "GfbnnEgRU94n9ed4RFZ6Z9dBAWs5obykigJSwXKU9hsT2uU"),
|
||||||
(1, "HA5NtttvyZsxo4wGxGoJJSMaWtdEFZAuGUMFHVWD7fgenPv"),
|
(1, "HA5NtttvyZsxo4wGxGoJJSMaWtdEFZAuGUMFHVWD7fgenPv"),
|
||||||
(1, "14mDeKZ7qp9hqBjjDg51c8BFrf9o69om8piSSRwj2fT5Yb1i"), // proof https://kusama.subscan.io/extrinsic/16919020-4
|
(1, "14mDeKZ7qp9hqBjjDg51c8BFrf9o69om8piSSRwj2fT5Yb1i"), /* proof https://kusama.subscan.io/extrinsic/16919020-4 */
|
||||||
(1, "16a357f5Sxab3V2ne4emGQvqJaCLeYpTMx3TCjnQhmJQ71DX"), // proof https://kusama.subscan.io/extrinsic/16836396-5
|
(1, "16a357f5Sxab3V2ne4emGQvqJaCLeYpTMx3TCjnQhmJQ71DX"), /* proof https://kusama.subscan.io/extrinsic/16836396-5 */
|
||||||
(1, "14Ak9rrF6RKHHoLLRUYMnzcvvi1t8E1yAMa7tcmiwUfaqzYK"), // proof https://kusama.subscan.io/extrinsic/16921990-3
|
(1, "14Ak9rrF6RKHHoLLRUYMnzcvvi1t8E1yAMa7tcmiwUfaqzYK"), /* proof https://kusama.subscan.io/extrinsic/16921990-3 */
|
||||||
(1, "FJq9JpA9P7EXbmfsN9YiewJaDbQyL6vQyksGtJvzfbn6zf8"),
|
(1, "FJq9JpA9P7EXbmfsN9YiewJaDbQyL6vQyksGtJvzfbn6zf8"),
|
||||||
(1, "15oLanodWWweiZJSoDTEBtrX7oGfq6e8ct5y5E6fVRDPhUgj"), // proof https://kusama.subscan.io/extrinsic/16876423-7
|
(1, "15oLanodWWweiZJSoDTEBtrX7oGfq6e8ct5y5E6fVRDPhUgj"), /* proof https://kusama.subscan.io/extrinsic/16876423-7 */
|
||||||
(1, "EaBqDJJNsZmYdQ4xn1vomPJVNh7fjA6UztZeEjn7ZzdeT7V"),
|
(1, "EaBqDJJNsZmYdQ4xn1vomPJVNh7fjA6UztZeEjn7ZzdeT7V"),
|
||||||
(1, "HTxCvXKVvUZ7PQq175kCRRLu7XkGfTfErrdNXr1ZuuwVZWv"),
|
(1, "HTxCvXKVvUZ7PQq175kCRRLu7XkGfTfErrdNXr1ZuuwVZWv"),
|
||||||
(1, "HZe91A6a1xqbKaw6ofx3GFepJjhVXHrwHEwn6YUDDFphpX9"),
|
(1, "HZe91A6a1xqbKaw6ofx3GFepJjhVXHrwHEwn6YUDDFphpX9"),
|
||||||
(1, "GRy2P3kBEzSHCbmDJfquku1cyUyhZaAqojRcNE4A4U3MnLd"),
|
(1, "GRy2P3kBEzSHCbmDJfquku1cyUyhZaAqojRcNE4A4U3MnLd"),
|
||||||
(1, "HYwiBo7Mcv7uUDg4MUoKm2fxzv4dMLAtmmNfzHV8qcQJpAE"),
|
(1, "HYwiBo7Mcv7uUDg4MUoKm2fxzv4dMLAtmmNfzHV8qcQJpAE"),
|
||||||
(1, "1ThiBx5DDxFhoD9GY6tz5Fp4Y7Xn1xfLmDddcoFQghDvvjg"), // proof https://kusama.subscan.io/extrinsic/16918130-2
|
(1, "1ThiBx5DDxFhoD9GY6tz5Fp4Y7Xn1xfLmDddcoFQghDvvjg"), /* proof https://kusama.subscan.io/extrinsic/16918130-2 */
|
||||||
(1, "DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS"),
|
(1, "DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS"),
|
||||||
(1, "EnpgVWGGQVrFdSB2qeXRVdtccV6U5ZscNELBoERbkFD8Wi6"),
|
(1, "EnpgVWGGQVrFdSB2qeXRVdtccV6U5ZscNELBoERbkFD8Wi6"),
|
||||||
(1, "H5BuqCmucJhUUuvjAzPazeVwVCtUSXVQdc5Dnx2q5zD7rVn"),
|
(1, "H5BuqCmucJhUUuvjAzPazeVwVCtUSXVQdc5Dnx2q5zD7rVn"),
|
||||||
@@ -215,9 +215,9 @@ pub mod tests {
|
|||||||
(1, "CzuUtvKhZNZBjyAXeYviaRXwrLhVrsupJ9PrWmdq7BJTjGR"),
|
(1, "CzuUtvKhZNZBjyAXeYviaRXwrLhVrsupJ9PrWmdq7BJTjGR"),
|
||||||
(1, "FCunn2Rx8JqfT5g6noUKKazph4jLDba5rUee7o3ZmJ362Ju"),
|
(1, "FCunn2Rx8JqfT5g6noUKKazph4jLDba5rUee7o3ZmJ362Ju"),
|
||||||
(1, "HyPMjWRHCpJS7x2SZ2R6M2XG5ZiCiZag4U4r7gBHRsE5mTc"),
|
(1, "HyPMjWRHCpJS7x2SZ2R6M2XG5ZiCiZag4U4r7gBHRsE5mTc"),
|
||||||
(1, "1682A5hxfiS1Kn1jrUnMYv14T9EuEnsgnBbujGfYbeEbSK3w"), // proof https://kusama.subscan.io/extrinsic/16919077-2
|
(1, "1682A5hxfiS1Kn1jrUnMYv14T9EuEnsgnBbujGfYbeEbSK3w"), /* proof https://kusama.subscan.io/extrinsic/16919077-2 */
|
||||||
(1, "13xS6fK6MHjApLnjdX7TJYw1niZmiXasSN91bNtiXQjgEtNx"), // proof https://kusama.subscan.io/extrinsic/16918212-7
|
(1, "13xS6fK6MHjApLnjdX7TJYw1niZmiXasSN91bNtiXQjgEtNx"), /* proof https://kusama.subscan.io/extrinsic/16918212-7 */
|
||||||
(1, "15qE2YAQCs5Y962RHE7RzNjQxU6Pei21nhkkSM9Sojq1hHps"), // https://kusama.subscan.io/extrinsic/17352973-2
|
(1, "15qE2YAQCs5Y962RHE7RzNjQxU6Pei21nhkkSM9Sojq1hHps"), /* https://kusama.subscan.io/extrinsic/17352973-2 */
|
||||||
];
|
];
|
||||||
|
|
||||||
for (index, val) in kusama_fellowship_ss58.iter().enumerate() {
|
for (index, val) in kusama_fellowship_ss58.iter().enumerate() {
|
||||||
|
|||||||
@@ -113,14 +113,16 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime
|
|||||||
// Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance.
|
// Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance.
|
||||||
type PromoteOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
|
type PromoteOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
|
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will
|
||||||
|
// pass.
|
||||||
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||||
|
|
||||||
// Demotion is by any of:
|
// Demotion is by any of:
|
||||||
// - Root can demote arbitrarily.
|
// - Root can demote arbitrarily.
|
||||||
// - the FellowshipAdmin origin (i.e. token holder referendum);
|
// - the FellowshipAdmin origin (i.e. token holder referendum);
|
||||||
//
|
//
|
||||||
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
|
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will
|
||||||
|
// pass.
|
||||||
type DemoteOrigin = EitherOf<
|
type DemoteOrigin = EitherOf<
|
||||||
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
|
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
|
||||||
MapSuccess<
|
MapSuccess<
|
||||||
|
|||||||
+2
-1
@@ -68,7 +68,8 @@ impl Convert<TrackId, Rank> for MinRankOfClass {
|
|||||||
regular @ 1..=9 => regular,
|
regular @ 1..=9 => regular,
|
||||||
// A retention vote; the track ID turns out to be 8 more than the minimum required rank.
|
// A retention vote; the track ID turns out to be 8 more than the minimum required rank.
|
||||||
retention @ 11..=16 => retention - 8,
|
retention @ 11..=16 => retention - 8,
|
||||||
// A promotion vote; the track ID turns out to be 18 more than the minimum required rank.
|
// A promotion vote; the track ID turns out to be 18 more than the minimum required
|
||||||
|
// rank.
|
||||||
promotion @ 21..=26 => promotion - 18,
|
promotion @ 21..=26 => promotion - 18,
|
||||||
_ => Rank::max_value(),
|
_ => Rank::max_value(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ type HashOf<T> = <T as frame_system::Config>::Hash;
|
|||||||
pub type BalanceOf<T> =
|
pub type BalanceOf<T> =
|
||||||
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||||
|
|
||||||
/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury account.
|
/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury
|
||||||
|
/// account.
|
||||||
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
|
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
|
||||||
PhantomData<(TreasuryAccount, PalletAccount, T)>,
|
PhantomData<(TreasuryAccount, PalletAccount, T)>,
|
||||||
);
|
);
|
||||||
@@ -187,8 +188,9 @@ pub mod benchmarks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type that wraps a type implementing the [`Pay`] trait to decorate its [`Pay::ensure_successful`]
|
/// Type that wraps a type implementing the [`Pay`] trait to decorate its
|
||||||
/// function with a provided implementation of the [`EnsureSuccessful`] trait.
|
/// [`Pay::ensure_successful`] function with a provided implementation of the
|
||||||
|
/// [`EnsureSuccessful`] trait.
|
||||||
pub struct PayWithEnsure<O, E>(PhantomData<(O, E)>);
|
pub struct PayWithEnsure<O, E>(PhantomData<(O, E)>);
|
||||||
impl<O, E> Pay for PayWithEnsure<O, E>
|
impl<O, E> Pay for PayWithEnsure<O, E>
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -20,15 +20,14 @@
|
|||||||
//!
|
//!
|
||||||
//! ### Governance
|
//! ### Governance
|
||||||
//!
|
//!
|
||||||
//! As a common good parachain, Collectives defers its governance (namely, its `Root` origin), to its
|
//! As a common good parachain, Collectives defers its governance (namely, its `Root` origin), to
|
||||||
//! Relay Chain parent, Polkadot.
|
//! its Relay Chain parent, Polkadot.
|
||||||
//!
|
//!
|
||||||
//! ### Collator Selection
|
//! ### Collator Selection
|
||||||
//!
|
//!
|
||||||
//! Collectives uses `pallet-collator-selection`, a simple first-come-first-served registration
|
//! Collectives uses `pallet-collator-selection`, a simple first-come-first-served registration
|
||||||
//! system where collators can reserve a small bond to join the block producer set. There is no
|
//! system where collators can reserve a small bond to join the block producer set. There is no
|
||||||
//! slashing. Collective members are generally expected to run collators.
|
//! slashing. Collective members are generally expected to run collators.
|
||||||
//!
|
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
|
|||||||
@@ -213,7 +213,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Allow XCMs with some computed origins to pass through.
|
// Allow XCMs with some computed origins to pass through.
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Allow XCMs with some computed origins to pass through.
|
// Allow XCMs with some computed origins to pass through.
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
@@ -196,7 +197,8 @@ impl pallet_xcm::Config for Runtime {
|
|||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
// We support local origins dispatching XCM executions in principle...
|
// We support local origins dispatching XCM executions in principle...
|
||||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||||
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
|
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are
|
||||||
|
// allowed.
|
||||||
type XcmExecuteFilter = Nothing;
|
type XcmExecuteFilter = Nothing;
|
||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
type XcmTeleportFilter = Everything;
|
type XcmTeleportFilter = Everything;
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
//!
|
//!
|
||||||
//! One of the main uses of the penpal chain will be to be a benefactor of reserve asset transfers
|
//! One of the main uses of the penpal chain will be to be a benefactor of reserve asset transfers
|
||||||
//! with Asset Hub as the reserve. At present no derivative tokens are minted on receipt of a
|
//! with Asset Hub as the reserve. At present no derivative tokens are minted on receipt of a
|
||||||
//! `ReserveAssetTransferDeposited` message but that will but the intension will be to support this soon.
|
//! `ReserveAssetTransferDeposited` message but that will but the intension will be to support this
|
||||||
|
//! soon.
|
||||||
use super::{
|
use super::{
|
||||||
AccountId, AllPalletsWithSystem, AssetId as AssetIdPalletAssets, Assets, Balance, Balances,
|
AccountId, AllPalletsWithSystem, AssetId as AssetIdPalletAssets, Assets, Balance, Balances,
|
||||||
ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
|
ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
|
||||||
@@ -159,9 +160,11 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Allow XCMs with some computed origins to pass through.
|
// Allow XCMs with some computed origins to pass through.
|
||||||
WithComputedOrigin<
|
WithComputedOrigin<
|
||||||
(
|
(
|
||||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Common Good Assets parachain, parent and its exec plurality get free execution
|
// Common Good Assets parachain, parent and its exec plurality get free
|
||||||
|
// execution
|
||||||
AllowExplicitUnpaidExecutionFrom<(
|
AllowExplicitUnpaidExecutionFrom<(
|
||||||
CommonGoodAssetsParachain,
|
CommonGoodAssetsParachain,
|
||||||
ParentOrParentsExecutivePlurality,
|
ParentOrParentsExecutivePlurality,
|
||||||
|
|||||||
@@ -331,7 +331,8 @@ where
|
|||||||
|
|
||||||
/// Start a shell node with the given parachain `Configuration` and relay chain `Configuration`.
|
/// Start a shell node with the given parachain `Configuration` and relay chain `Configuration`.
|
||||||
///
|
///
|
||||||
/// This is the actual implementation that is abstract over the executor and the runtime api for shell nodes.
|
/// This is the actual implementation that is abstract over the executor and the runtime api for
|
||||||
|
/// shell nodes.
|
||||||
#[sc_tracing::logging::prefix_logs_with("Parachain")]
|
#[sc_tracing::logging::prefix_logs_with("Parachain")]
|
||||||
async fn start_shell_node_impl<RuntimeApi, RB, BIQ, BIC>(
|
async fn start_shell_node_impl<RuntimeApi, RB, BIQ, BIC>(
|
||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
|
|||||||
@@ -140,9 +140,9 @@ impl XcmpMessageSource for () {
|
|||||||
/// The "quality of service" considerations for message sending.
|
/// The "quality of service" considerations for message sending.
|
||||||
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
|
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
|
||||||
pub enum ServiceQuality {
|
pub enum ServiceQuality {
|
||||||
/// Ensure that this message is dispatched in the same relative order as any other messages that
|
/// Ensure that this message is dispatched in the same relative order as any other messages
|
||||||
/// were also sent with `Ordered`. This only guarantees message ordering on the dispatch side,
|
/// that were also sent with `Ordered`. This only guarantees message ordering on the dispatch
|
||||||
/// and not necessarily on the execution side.
|
/// side, and not necessarily on the execution side.
|
||||||
Ordered,
|
Ordered,
|
||||||
/// Ensure that the message is dispatched as soon as possible, which could result in it being
|
/// Ensure that the message is dispatched as soon as possible, which could result in it being
|
||||||
/// dispatched before other messages which are larger and/or rely on relative ordering.
|
/// dispatched before other messages which are larger and/or rely on relative ordering.
|
||||||
@@ -269,8 +269,8 @@ pub mod rpsr_digest {
|
|||||||
DigestItem::Consensus(RPSR_CONSENSUS_ID, (storage_root, number.into()).encode())
|
DigestItem::Consensus(RPSR_CONSENSUS_ID, (storage_root, number.into()).encode())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the relay-parent storage root and number from the provided header digest. Returns `None`
|
/// Extract the relay-parent storage root and number from the provided header digest. Returns
|
||||||
/// if none were found.
|
/// `None` if none were found.
|
||||||
pub fn extract_relay_parent_storage_root(
|
pub fn extract_relay_parent_storage_root(
|
||||||
digest: &Digest,
|
digest: &Digest,
|
||||||
) -> Option<(relay_chain::Hash, relay_chain::BlockNumber)> {
|
) -> Option<(relay_chain::Hash, relay_chain::BlockNumber)> {
|
||||||
@@ -299,7 +299,8 @@ pub struct CollationInfoV1 {
|
|||||||
pub new_validation_code: Option<relay_chain::ValidationCode>,
|
pub new_validation_code: Option<relay_chain::ValidationCode>,
|
||||||
/// The number of messages processed from the DMQ.
|
/// The number of messages processed from the DMQ.
|
||||||
pub processed_downward_messages: u32,
|
pub processed_downward_messages: u32,
|
||||||
/// The mark which specifies the block number up to which all inbound HRMP messages are processed.
|
/// The mark which specifies the block number up to which all inbound HRMP messages are
|
||||||
|
/// processed.
|
||||||
pub hrmp_watermark: relay_chain::BlockNumber,
|
pub hrmp_watermark: relay_chain::BlockNumber,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +329,8 @@ pub struct CollationInfo {
|
|||||||
pub new_validation_code: Option<relay_chain::ValidationCode>,
|
pub new_validation_code: Option<relay_chain::ValidationCode>,
|
||||||
/// The number of messages processed from the DMQ.
|
/// The number of messages processed from the DMQ.
|
||||||
pub processed_downward_messages: u32,
|
pub processed_downward_messages: u32,
|
||||||
/// The mark which specifies the block number up to which all inbound HRMP messages are processed.
|
/// The mark which specifies the block number up to which all inbound HRMP messages are
|
||||||
|
/// processed.
|
||||||
pub hrmp_watermark: relay_chain::BlockNumber,
|
pub hrmp_watermark: relay_chain::BlockNumber,
|
||||||
/// The head data, aka encoded header, of the block that corresponds to the collation.
|
/// The head data, aka encoded header, of the block that corresponds to the collation.
|
||||||
pub head_data: HeadData,
|
pub head_data: HeadData,
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ async fn collect_relay_storage_proof(
|
|||||||
relay_well_known_keys::ACTIVE_CONFIG.to_vec(),
|
relay_well_known_keys::ACTIVE_CONFIG.to_vec(),
|
||||||
relay_well_known_keys::dmq_mqc_head(para_id),
|
relay_well_known_keys::dmq_mqc_head(para_id),
|
||||||
// TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size`
|
// TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size`
|
||||||
// We need to keep this here until all parachains have migrated to `relay_dispatch_queue_remaining_capacity`.
|
// We need to keep this here until all parachains have migrated to
|
||||||
|
// `relay_dispatch_queue_remaining_capacity`.
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
relay_well_known_keys::relay_dispatch_queue_size(para_id),
|
relay_well_known_keys::relay_dispatch_queue_size(para_id),
|
||||||
relay_well_known_keys::relay_dispatch_queue_remaining_capacity(para_id).key,
|
relay_well_known_keys::relay_dispatch_queue_remaining_capacity(para_id).key,
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
//! Cumulus parachain inherent
|
//! Cumulus parachain inherent
|
||||||
//!
|
//!
|
||||||
//! The [`ParachainInherentData`] is the data that is passed by the collator to the parachain runtime.
|
//! The [`ParachainInherentData`] is the data that is passed by the collator to the parachain
|
||||||
//! The runtime will use this data to execute messages from other parachains/the relay chain or to
|
//! runtime. The runtime will use this data to execute messages from other parachains/the relay
|
||||||
//! read data from the relay chain state. When the parachain is validated by a parachain validator on
|
//! chain or to read data from the relay chain state. When the parachain is validated by a parachain
|
||||||
//! the relay chain, this data is checked for correctnes. If the data passed by the collator to the
|
//! validator on the relay chain, this data is checked for correctnes. If the data passed by the
|
||||||
//! runtime isn't correct, the parachain candidate is considered invalid.
|
//! collator to the runtime isn't correct, the parachain candidate is considered invalid.
|
||||||
//!
|
//!
|
||||||
//! Use [`ParachainInherentData::create_at`] to create the [`ParachainInherentData`] at a given
|
//! Use [`ParachainInherentData::create_at`] to create the [`ParachainInherentData`] at a given
|
||||||
//! relay chain block to include it in a parachain block.
|
//! relay chain block to include it in a parachain block.
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ pub struct MockXcmConfig {
|
|||||||
|
|
||||||
/// The name of the parachain system in the runtime.
|
/// The name of the parachain system in the runtime.
|
||||||
///
|
///
|
||||||
/// This name is used by frame to prefix storage items and will be required to read data from the storage.
|
/// This name is used by frame to prefix storage items and will be required to read data from the
|
||||||
|
/// storage.
|
||||||
///
|
///
|
||||||
/// The `Default` implementation sets the name to `ParachainSystem`.
|
/// The `Default` implementation sets the name to `ParachainSystem`.
|
||||||
pub struct ParachainSystemName(pub Vec<u8>);
|
pub struct ParachainSystemName(pub Vec<u8>);
|
||||||
|
|||||||
@@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
//! Cumulus timestamp related primitives.
|
//! Cumulus timestamp related primitives.
|
||||||
//!
|
//!
|
||||||
//! Provides a [`InherentDataProvider`] that should be used in the validation phase of the parachain.
|
//! Provides a [`InherentDataProvider`] that should be used in the validation phase of the
|
||||||
//! It will be used to create the inherent data and that will be used to check the inherents inside
|
//! parachain. It will be used to create the inherent data and that will be used to check the
|
||||||
//! the parachain block (in this case the timestamp inherent). As we don't have access to any clock
|
//! inherents inside the parachain block (in this case the timestamp inherent). As we don't have
|
||||||
//! from the runtime the timestamp is always passed as an inherent into the runtime. To check this
|
//! access to any clock from the runtime the timestamp is always passed as an inherent into the
|
||||||
//! inherent when validating the block, we will use the relay chain slot. As the relay chain slot
|
//! runtime. To check this inherent when validating the block, we will use the relay chain slot. As
|
||||||
//! is derived from a timestamp, we can easily convert it back to a timestamp by muliplying it with
|
//! the relay chain slot is derived from a timestamp, we can easily convert it back to a timestamp
|
||||||
//! the slot duration. By comparing the relay chain slot derived timestamp with the timestamp we can
|
//! by muliplying it with the slot duration. By comparing the relay chain slot derived timestamp
|
||||||
//! ensure that the parachain timestamp is reasonable.
|
//! with the timestamp we can ensure that the parachain timestamp is reasonable.
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,8 @@ impl<
|
|||||||
outstanding_minus_substracted.saturated_into();
|
outstanding_minus_substracted.saturated_into();
|
||||||
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 = (id, outstanding_minus_substracted).into();
|
let outstanding_concrete_asset: MultiAsset = (id, outstanding_minus_substracted).into();
|
||||||
|
|
||||||
// Substract from existing weight and balance
|
// Substract from existing weight and balance
|
||||||
@@ -271,8 +272,8 @@ impl<
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// XCM fee depositor to which we implement the TakeRevenue trait
|
/// XCM fee depositor to which we implement the TakeRevenue trait
|
||||||
/// It receives a Transact implemented argument, a 32 byte convertible acocuntId, and the fee receiver account
|
/// It receives a Transact implemented argument, a 32 byte convertible acocuntId, and the fee
|
||||||
/// FungiblesMutateAdapter should be identical to that implemented by WithdrawAsset
|
/// receiver account FungiblesMutateAdapter should be identical to that implemented by WithdrawAsset
|
||||||
pub struct XcmFeesTo32ByteAccount<FungiblesMutateAdapter, AccountId, ReceiverAccount>(
|
pub struct XcmFeesTo32ByteAccount<FungiblesMutateAdapter, AccountId, ReceiverAccount>(
|
||||||
PhantomData<(FungiblesMutateAdapter, AccountId, ReceiverAccount)>,
|
PhantomData<(FungiblesMutateAdapter, AccountId, ReceiverAccount)>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -150,7 +150,8 @@ impl InitBlockBuilder for Client {
|
|||||||
/// Extension trait for the [`BlockBuilder`](sc_block_builder::BlockBuilder) to build directly a
|
/// Extension trait for the [`BlockBuilder`](sc_block_builder::BlockBuilder) to build directly a
|
||||||
/// [`ParachainBlockData`].
|
/// [`ParachainBlockData`].
|
||||||
pub trait BuildParachainBlockData {
|
pub trait BuildParachainBlockData {
|
||||||
/// Directly build the [`ParachainBlockData`] from the block that comes out of the block builder.
|
/// Directly build the [`ParachainBlockData`] from the block that comes out of the block
|
||||||
|
/// builder.
|
||||||
fn build_parachain_block(self, parent_state_root: Hash) -> ParachainBlockData<Block>;
|
fn build_parachain_block(self, parent_state_root: Hash) -> ParachainBlockData<Block>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ impl Default for RelayStateSproofBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RelayStateSproofBuilder {
|
impl RelayStateSproofBuilder {
|
||||||
/// Returns a mutable reference to HRMP channel metadata for a channel (`sender`, `self.para_id`).
|
/// Returns a mutable reference to HRMP channel metadata for a channel (`sender`,
|
||||||
|
/// `self.para_id`).
|
||||||
///
|
///
|
||||||
/// If there is no channel, a new default one is created.
|
/// If there is no channel, a new default one is created.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -154,7 +154,8 @@ fn build_project(cargo_toml: &Path) {
|
|||||||
.arg("build")
|
.arg("build")
|
||||||
.arg("--release")
|
.arg("--release")
|
||||||
.arg(format!("--manifest-path={}", cargo_toml.display()))
|
.arg(format!("--manifest-path={}", cargo_toml.display()))
|
||||||
// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir exclusive).
|
// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir
|
||||||
|
// exclusive).
|
||||||
.env_remove("CARGO_TARGET_DIR")
|
.env_remove("CARGO_TARGET_DIR")
|
||||||
// Do not call us recursively.
|
// Do not call us recursively.
|
||||||
.env(SKIP_ENV, "1")
|
.env(SKIP_ENV, "1")
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ impl_opaque_keys! {
|
|||||||
pub const TEST_RUNTIME_UPGRADE_KEY: &[u8] = b"+test_runtime_upgrade_key+";
|
pub const TEST_RUNTIME_UPGRADE_KEY: &[u8] = b"+test_runtime_upgrade_key+";
|
||||||
|
|
||||||
// The only difference between the two declarations below is the `spec_version`. With the
|
// The only difference between the two declarations below is the `spec_version`. With the
|
||||||
// `increment-spec-version` feature enabled `spec_version` should be greater than the one of without the
|
// `increment-spec-version` feature enabled `spec_version` should be greater than the one of without
|
||||||
// `increment-spec-version` feature.
|
// the `increment-spec-version` feature.
|
||||||
//
|
//
|
||||||
// The duplication here is unfortunate necessity.
|
// The duplication here is unfortunate necessity.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -473,8 +473,8 @@ pub struct TestNode {
|
|||||||
pub client: Arc<Client>,
|
pub client: Arc<Client>,
|
||||||
/// Node's network.
|
/// Node's network.
|
||||||
pub network: Arc<NetworkService<Block, H256>>,
|
pub network: Arc<NetworkService<Block, H256>>,
|
||||||
/// The `MultiaddrWithPeerId` to this node. This is useful if you want to pass it as "boot node"
|
/// The `MultiaddrWithPeerId` to this node. This is useful if you want to pass it as "boot
|
||||||
/// to other nodes.
|
/// node" to other nodes.
|
||||||
pub addr: MultiaddrWithPeerId,
|
pub addr: MultiaddrWithPeerId,
|
||||||
/// RPCHandlers to make RPC queries.
|
/// RPCHandlers to make RPC queries.
|
||||||
pub rpc_handlers: RpcHandlers,
|
pub rpc_handlers: RpcHandlers,
|
||||||
@@ -512,7 +512,8 @@ impl TestNodeBuilder {
|
|||||||
///
|
///
|
||||||
/// `para_id` - The parachain id this node is running for.
|
/// `para_id` - The parachain id this node is running for.
|
||||||
/// `tokio_handle` - The tokio handler to use.
|
/// `tokio_handle` - The tokio handler to use.
|
||||||
/// `key` - The key that will be used to generate the name and that will be passed as `dev_seed`.
|
/// `key` - The key that will be used to generate the name and that will be passed as
|
||||||
|
/// `dev_seed`.
|
||||||
pub fn new(para_id: ParaId, tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring) -> Self {
|
pub fn new(para_id: ParaId, tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring) -> Self {
|
||||||
TestNodeBuilder {
|
TestNodeBuilder {
|
||||||
key,
|
key,
|
||||||
|
|||||||
@@ -1301,8 +1301,9 @@ pub struct TestContext<T> {
|
|||||||
/// These arguments can be easily reused and shared between the assertions functions
|
/// These arguments can be easily reused and shared between the assertions functions
|
||||||
/// and dispatchables functions, which are also stored in `Test`.
|
/// and dispatchables functions, which are also stored in `Test`.
|
||||||
/// `Origin` corresponds to the chain where the XCM interaction starts with an initial execution.
|
/// `Origin` corresponds to the chain where the XCM interaction starts with an initial execution.
|
||||||
/// `Destination` corresponds to the last chain where an effect of the intial execution is expected happen.
|
/// `Destination` corresponds to the last chain where an effect of the intial execution is expected
|
||||||
/// `Hops` refer all the ordered intermediary chains an initial XCM execution can provoke some effect.
|
/// happen. `Hops` refer all the ordered intermediary chains an initial XCM execution can provoke
|
||||||
|
/// some effect.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Test<Origin, Destination, Hops = (), Args = TestArgs>
|
pub struct Test<Origin, Destination, Hops = (), Args = TestArgs>
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user