pallet_messenger

Struct Pallet

source
pub struct Pallet<T>(/* private fields */);
Expand description

Pallet messenger used to communicate between chains and other blockchains.

Implementations§

source§

impl<T: Config> Pallet<T>

source

pub fn get_block_messages() -> BlockMessagesWithStorageKey

source§

impl<T: Config> Pallet<T>

source

pub fn initiate_channel( origin: OriginFor<T>, dst_chain_id: ChainId, params: InitiateChannelParams, ) -> DispatchResult

A new Channel is initiated with a foreign chain. Next Channel ID is used to assign the new channel. Channel is set to initiated and do not accept or receive any messages.

source

pub fn close_channel( origin: OriginFor<T>, chain_id: ChainId, channel_id: ChannelId, ) -> DispatchResult

An open channel is closed with a foreign chain. Channel is set to Closed and do not accept or receive any messages.

source

pub fn relay_message( origin: OriginFor<T>, msg: CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, ) -> DispatchResult

Receives an Inbox message that needs to be validated and processed.

source

pub fn relay_message_response( origin: OriginFor<T>, msg: CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, ) -> DispatchResult

Receives a response from the dst_chain for a message in Outbox.

source

pub fn update_consensus_chain_allowlist( origin: OriginFor<T>, update: ChainAllowlistUpdate, ) -> DispatchResult

A call to update consensus chain allow list.

source

pub fn initiate_domain_update_chain_allowlist( origin: OriginFor<T>, domain_id: DomainId, update: ChainAllowlistUpdate, ) -> DispatchResult

A call to initiate chain allowlist update on domains

source

pub fn update_domain_allowlist( origin: OriginFor<T>, updates: DomainAllowlistUpdates, ) -> DispatchResult

An inherent call to update allowlist for domain.

source§

impl<T: Config> Pallet<T>

source

pub fn get_open_channel_for_chain( dst_chain_id: ChainId, ) -> Option<(ChannelId, FeeModel<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>)>

Returns the last open channel for a given chain.

source

pub fn validate_relay_message( xdm: &CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, pre_dispatch: bool, consensus_state_root: <<T as Config>::Hashing as Hash>::Output, ) -> Result<ValidatedRelayMessage, TransactionValidityError>

source

pub fn validate_relay_message_response( xdm: &CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, pre_dispatch: bool, consensus_state_root: <<T as Config>::Hashing as Hash>::Output, ) -> Result<ValidatedRelayMessage, TransactionValidityError>

source

pub fn outbox_storage_key(message_key: MessageKey) -> Vec<u8>

source

pub fn inbox_response_storage_key(message_key: MessageKey) -> Vec<u8>

source

pub fn channel_storage_key(chain_id: ChainId, channel_id: ChannelId) -> Vec<u8>

source

pub fn domain_chains_allowlist_update( domain_id: DomainId, ) -> Option<DomainAllowlistUpdates>

source

pub fn domain_allow_list_update_storage_key(domain_id: DomainId) -> Vec<u8>

source

pub fn updated_channels() -> BTreeSet<(ChainId, ChannelId)>

source

pub fn pre_dispatch_with_trusted_mmr_proof( call: &Call<T>, ) -> Result<(), TransactionValidityError>

source§

impl<T: Config> Pallet<T>

source

pub fn next_channel_id<KArg>(k: KArg) -> ChannelId
where KArg: EncodeLike<ChainId>,

An auto-generated getter for NextChannelId.

source§

impl<T: Config> Pallet<T>

source

pub fn channels<KArg1, KArg2>( k1: KArg1, k2: KArg2, ) -> Option<Channel<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance, T::AccountId>>
where KArg1: EncodeLike<ChainId>, KArg2: EncodeLike<ChannelId>,

An auto-generated getter for Channels.

source§

impl<T: Config> Pallet<T>

source

pub fn inbox() -> Option<Message<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>>

An auto-generated getter for Inbox.

source§

impl<T: Config> Pallet<T>

source

pub fn inbox_fees<KArg>( k: KArg, ) -> Option<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>
where KArg: EncodeLike<(ChainId, MessageId)>,

An auto-generated getter for InboxFee.

source§

impl<T: Config> Pallet<T>

source

pub fn outbox_fees<KArg>( k: KArg, ) -> Option<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>
where KArg: EncodeLike<(ChainId, MessageId)>,

An auto-generated getter for OutboxFee.

source§

impl<T: Config> Pallet<T>

source

pub fn inbox_responses<KArg>( k: KArg, ) -> Option<Message<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>>
where KArg: EncodeLike<(ChainId, ChannelId, Nonce)>,

An auto-generated getter for InboxResponses.

source§

impl<T: Config> Pallet<T>

source

pub fn outbox<KArg>( k: KArg, ) -> Option<Message<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>>
where KArg: EncodeLike<(ChainId, ChannelId, Nonce)>,

An auto-generated getter for Outbox.

source§

impl<T: Config> Pallet<T>

source

pub fn outbox_responses() -> Option<Message<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>>

An auto-generated getter for OutboxResponses.

source§

impl<T: Config> Pallet<T>

source

pub fn message_weight_tags() -> Option<MessageWeightTags>

An auto-generated getter for MessageWeightTags.

source§

impl<T: Config> Pallet<T>

source

pub fn chain_allowlist() -> BTreeSet<ChainId>

An auto-generated getter for ChainAllowlist.

source§

impl<T: Config> Pallet<T>

source

pub fn domain_chain_allowlist_updates<KArg>( k: KArg, ) -> Option<DomainAllowlistUpdates>
where KArg: EncodeLike<DomainId>,

An auto-generated getter for DomainChainAllowlistUpdate.

source§

impl<T> Pallet<T>
where T: Config + SendTransactionTypes<Call<T>>,

source

pub fn outbox_message_unsigned( msg: CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, ) -> Option<T::Extrinsic>

source

pub fn inbox_response_message_unsigned( msg: CrossDomainMessage<BlockNumberFor<T>, T::Hash, T::MmrHash>, ) -> Option<T::Extrinsic>

source

pub fn should_relay_outbox_message( dst_chain_id: ChainId, msg_id: MessageId, ) -> bool

Returns true if the outbox message has not received the response yet.

source

pub fn should_relay_inbox_message_response( dst_chain_id: ChainId, msg_id: MessageId, ) -> bool

Returns true if the inbox message response has not received acknowledgement yet.

Trait Implementations§

source§

impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>

source§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
source§

impl<T: Config> Callable<T> for Pallet<T>

source§

impl<T> Clone for Pallet<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Pallet<T>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Config> DomainBundleSubmitted for Pallet<T>

source§

fn domain_bundle_submitted(domain_id: DomainId)

Called in the next block initialisation if there was a domain bundle in the previous block. This hook if called for domain represents that there is a new domain block for parent consensus block.
source§

impl<T: Config> GetStorageVersion for Pallet<T>

source§

type InCodeStorageVersion = NoStorageVersionSet

This type is generated by the pallet macro. Read more
source§

fn in_code_storage_version() -> Self::InCodeStorageVersion

Returns the in-code storage version as specified in the storage_version attribute, or [NoStorageVersionSet] if the attribute is missing.
source§

fn on_chain_storage_version() -> StorageVersion

Returns the storage version of the pallet as last set in the actual on-chain storage.
§

fn current_storage_version() -> Self::InCodeStorageVersion

👎Deprecated: This method has been renamed to in_code_storage_version and will be removed after March 2024.
DEPRECATED: Use [Self::current_storage_version] instead. Read more
source§

impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(_n: BlockNumberFor<T>) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before [Hooks::on_finalize]). Read more
§

fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)

A hook to run logic after inherent application. Read more
§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by the FRAME Executive pallet. Read more
§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main blockchain execution. Read more
§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
source§

impl<T: Config> IntegrityTest for Pallet<T>

source§

fn integrity_test()

See [Hooks::integrity_test].
source§

impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn offchain_worker(n: BlockNumberFor<T>)

This function is being called after every block import (when fully synced). Read more
source§

impl<T: Config> OnDomainInstantiated for Pallet<T>

source§

fn on_domain_instantiated(domain_id: DomainId)

source§

impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_finalize(n: BlockNumberFor<T>)

See [Hooks::on_finalize].
source§

impl<T: Config> OnGenesis for Pallet<T>

source§

fn on_genesis()

Something that should happen at genesis.
source§

impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight

See [Hooks::on_idle].
source§

impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(n: BlockNumberFor<T>) -> Weight

See [Hooks::on_initialize].
source§

impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_poll(n: BlockNumberFor<T>, weight: &mut WeightMeter)

Code to execute every now and then at the beginning of the block after inherent application. Read more
source§

impl<T: Config> OnRuntimeUpgrade for Pallet<T>

source§

fn on_runtime_upgrade() -> Weight

See [Hooks::on_runtime_upgrade].
source§

impl<T: Config> PalletInfoAccess for Pallet<T>

source§

fn index() -> usize

Index of the pallet as configured in the runtime.
source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
source§

fn name_hash() -> [u8; 16]

Two128 hash of name.
source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
source§

impl<T: Config> PalletsInfoAccess for Pallet<T>

source§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
source§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
source§

impl<T> PartialEq for Pallet<T>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Config> ProvideInherent for Pallet<T>

source§

const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER

The inherent identifier used by this inherent.
source§

type Call = Call<T>

The call type of the pallet.
source§

type Error = InherentError

The error returned by check_inherent.
source§

fn create_inherent(data: &InherentData) -> Option<Self::Call>

Create an inherent out of the given InherentData. Read more
source§

fn is_inherent_required( data: &InherentData, ) -> Result<Option<Self::Error>, Self::Error>

Determines whether this inherent is required in this block. Read more
source§

fn check_inherent( call: &Self::Call, data: &InherentData, ) -> Result<(), Self::Error>

Check whether the given inherent is valid. Checking the inherent is optional and can be omitted by using the default implementation. Read more
source§

fn is_inherent(call: &Self::Call) -> bool

Return whether the call is an inherent call. Read more
source§

impl<T: Config> Sender<<T as Config>::AccountId> for Pallet<T>

source§

type MessageId = (U256, U256)

Unique Id of the message between dst_chain and src_chain.
source§

fn send_message( sender: &T::AccountId, dst_chain_id: ChainId, req: EndpointRequest, ) -> Result<Self::MessageId, DispatchError>

Sends a message to dst_chain_id.
source§

impl<T: Config> StorageInfoTrait for Pallet<T>

source§

fn storage_info() -> Vec<StorageInfo>

source§

impl<T: Config> ValidateUnsigned for Pallet<T>

source§

fn validate_unsigned( _source: TransactionSource, call: &Self::Call, ) -> TransactionValidity

Validate unsigned call to this module.

source§

type Call = Call<T>

The call to validate
source§

fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>

Validate the call right before dispatch. Read more
source§

impl<T: Config> WhitelistedStorageKeys for Pallet<T>

source§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a Vec<TrackedStorageKey> indicating the storage keys that should be whitelisted during benchmarking. This means that those keys will be excluded from the benchmarking performance calculation.
source§

impl<T> Eq for Pallet<T>

Auto Trait Implementations§

§

impl<T> Freeze for Pallet<T>

§

impl<T> RefUnwindSafe for Pallet<T>
where T: RefUnwindSafe,

§

impl<T> Send for Pallet<T>
where T: Send,

§

impl<T> Sync for Pallet<T>
where T: Sync,

§

impl<T> Unpin for Pallet<T>
where T: Unpin,

§

impl<T> UnwindSafe for Pallet<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, U> IntoKey<U> for T
where U: FromKey<T>,

§

fn into_key(self) -> U

§

impl<T> IsType<T> for T

§

fn from_ref(t: &T) -> &T

Cast reference.
§

fn into_ref(&self) -> &T

Cast reference.
§

fn from_mut(t: &mut T) -> &mut T

Cast mutable reference.
§

fn into_mut(&mut self) -> &mut T

Cast mutable reference.
§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> SaturatedConversion for T

§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> TryIntoKey<U> for T
where U: TryFromKey<T>,

§

type Error = <U as TryFromKey<T>>::Error

§

fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>

§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> MaybeRefUnwindSafe for T
where T: RefUnwindSafe,

§

impl<T> Member for T
where T: Send + Sync + Debug + Eq + PartialEq + Clone + 'static,