Return dispatch_fee_payment from message details RPC (#1014)

This commit is contained in:
Svyatoslav Nikolsky
2021-06-21 22:48:35 +03:00
committed by Bastian Köcher
parent ee43a560f8
commit 6ff79e9959
6 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -619,7 +619,7 @@ impl_runtime_apis! {
dispatch_weight: decoded_payload.weight, dispatch_weight: decoded_payload.weight,
size: message_data.payload.len() as _, size: message_data.payload.len() as _,
delivery_and_dispatch_fee: message_data.fee, delivery_and_dispatch_fee: message_data.fee,
// TODO: include dispatch fee type (https://github.com/paritytech/parity-bridges-common/pull/911) dispatch_fee_payment: decoded_payload.dispatch_fee_payment,
}) })
}) })
.collect() .collect()
+1 -1
View File
@@ -770,7 +770,7 @@ impl_runtime_apis! {
dispatch_weight: decoded_payload.weight, dispatch_weight: decoded_payload.weight,
size: message_data.payload.len() as _, size: message_data.payload.len() as _,
delivery_and_dispatch_fee: message_data.fee, delivery_and_dispatch_fee: message_data.fee,
// TODO: include dispatch fee type (https://github.com/paritytech/parity-bridges-common/pull/911) dispatch_fee_payment: decoded_payload.dispatch_fee_payment,
}) })
}) })
.collect() .collect()
+1 -1
View File
@@ -76,7 +76,7 @@ pub struct MessageProofParams {
pub outbound_lane_data: Option<OutboundLaneData>, pub outbound_lane_data: Option<OutboundLaneData>,
/// Proof size requirements. /// Proof size requirements.
pub size: ProofSize, pub size: ProofSize,
/// If true, dispatch fee is paid at the target chain (if supported by configuration). /// Where the fee for dispatching message is paid?
pub dispatch_fee_payment: DispatchFeePayment, pub dispatch_fee_payment: DispatchFeePayment,
} }
@@ -121,7 +121,7 @@ pub struct MessagePayload<SourceChainAccountId, TargetChainAccountPublic, Target
pub weight: Weight, pub weight: Weight,
/// Call origin to be used during dispatch. /// Call origin to be used during dispatch.
pub origin: CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature>, pub origin: CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature>,
/// Where message dispatch fee is paid? /// Where the fee for dispatching message is paid?
pub dispatch_fee_payment: DispatchFeePayment, pub dispatch_fee_payment: DispatchFeePayment,
/// The call itself. /// The call itself.
pub call: Call, pub call: Call,
+4 -1
View File
@@ -23,6 +23,7 @@
#![allow(clippy::unnecessary_mut_passed)] #![allow(clippy::unnecessary_mut_passed)]
use bitvec::prelude::*; use bitvec::prelude::*;
use bp_runtime::messages::DispatchFeePayment;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::RuntimeDebug; use frame_support::RuntimeDebug;
use sp_std::{collections::vec_deque::VecDeque, prelude::*}; use sp_std::{collections::vec_deque::VecDeque, prelude::*};
@@ -169,7 +170,7 @@ impl<RelayerId> InboundLaneData<RelayerId> {
} }
/// Message details, returned by runtime APIs. /// Message details, returned by runtime APIs.
#[derive(Clone, Default, Encode, Decode, RuntimeDebug, PartialEq, Eq)] #[derive(Clone, Encode, Decode, RuntimeDebug, PartialEq, Eq)]
pub struct MessageDetails<OutboundMessageFee> { pub struct MessageDetails<OutboundMessageFee> {
/// Nonce assigned to the message. /// Nonce assigned to the message.
pub nonce: MessageNonce, pub nonce: MessageNonce,
@@ -179,6 +180,8 @@ pub struct MessageDetails<OutboundMessageFee> {
pub size: u32, pub size: u32,
/// Delivery+dispatch fee paid by the message submitter at the source chain. /// Delivery+dispatch fee paid by the message submitter at the source chain.
pub delivery_and_dispatch_fee: OutboundMessageFee, pub delivery_and_dispatch_fee: OutboundMessageFee,
/// Where the fee for dispatching message is paid?
pub dispatch_fee_payment: DispatchFeePayment,
} }
/// Bit vector of message dispatch results. /// Bit vector of message dispatch results.
@@ -363,6 +363,7 @@ fn make_message_details_map<C: Chain>(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use bp_runtime::messages::DispatchFeePayment;
fn message_details_from_rpc( fn message_details_from_rpc(
nonces: RangeInclusive<MessageNonce>, nonces: RangeInclusive<MessageNonce>,
@@ -374,6 +375,7 @@ mod tests {
dispatch_weight: 0, dispatch_weight: 0,
size: 0, size: 0,
delivery_and_dispatch_fee: 0, delivery_and_dispatch_fee: 0,
dispatch_fee_payment: DispatchFeePayment::AtSourceChain,
}) })
.collect() .collect()
} }