mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 20:25:40 +00:00
Get dispatch weight from the target chain (when DispatchFeePayment::AtTargetChain is used) (#1430)
* reintroduce From<SourceChain>InboundLaneApi * impl From<Chain>InboundLaneApi for testnet runtimes * use inboundlaneapi in relay * remove unused OutboundXcmWeigher * spelling * added the only test to messages pallet * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
78a43c561a
commit
f0d05de080
@@ -176,12 +176,15 @@ impl<RelayerId> InboundLaneData<RelayerId> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Message details, returned by runtime APIs.
|
||||
/// Outbound message details, returned by runtime APIs.
|
||||
#[derive(Clone, Encode, Decode, RuntimeDebug, PartialEq, Eq)]
|
||||
pub struct MessageDetails<OutboundMessageFee> {
|
||||
pub struct OutboundMessageDetails<OutboundMessageFee> {
|
||||
/// Nonce assigned to the message.
|
||||
pub nonce: MessageNonce,
|
||||
/// Message dispatch weight, declared by the submitter.
|
||||
/// Message dispatch weight.
|
||||
///
|
||||
/// Depending on messages pallet configuration, it may be declared by the message submitter,
|
||||
/// computed automatically or just be zero if dispatch fee is paid at the target chain.
|
||||
pub dispatch_weight: Weight,
|
||||
/// Size of the encoded message.
|
||||
pub size: u32,
|
||||
@@ -191,6 +194,18 @@ pub struct MessageDetails<OutboundMessageFee> {
|
||||
pub dispatch_fee_payment: DispatchFeePayment,
|
||||
}
|
||||
|
||||
/// Inbound message details, returned by runtime APIs.
|
||||
#[derive(Clone, Encode, Decode, RuntimeDebug, PartialEq, Eq)]
|
||||
pub struct InboundMessageDetails {
|
||||
/// Computed message dispatch weight.
|
||||
///
|
||||
/// Runtime API guarantees that it will match the value, returned by
|
||||
/// `target_chain::MessageDispatch::dispatch_weight`. This means that if the runtime
|
||||
/// has failed to decode the message, it will be zero - that's because `undecodable`
|
||||
/// message cannot be dispatched.
|
||||
pub dispatch_weight: Weight,
|
||||
}
|
||||
|
||||
/// Bit vector of message dispatch results.
|
||||
pub type DispatchResultsBitVec = BitVec<u8, Msb0>;
|
||||
|
||||
|
||||
@@ -93,8 +93,9 @@ pub trait MessageDispatch<AccountId, Fee> {
|
||||
|
||||
/// Estimate dispatch weight.
|
||||
///
|
||||
/// This function must: (1) be instant and (2) return correct upper bound
|
||||
/// of dispatch weight.
|
||||
/// This function must return correct upper bound of dispatch weight. The return value
|
||||
/// of this function is expected to match return value of the corresponding
|
||||
/// `From<Chain>InboundLaneApi::message_details().dispatch_weight` call.
|
||||
fn dispatch_weight(message: &mut DispatchMessage<Self::DispatchPayload, Fee>) -> Weight;
|
||||
|
||||
/// Called when inbound message is received.
|
||||
|
||||
Reference in New Issue
Block a user