Token swap pallet benchmarks (#1174)

* token swap benchmarks

* spellcheck
This commit is contained in:
Svyatoslav Nikolsky
2021-10-08 12:35:11 +03:00
committed by Bastian Köcher
parent c0df990b90
commit 4b525f4fe1
14 changed files with 500 additions and 49 deletions
@@ -135,6 +135,15 @@ pub trait MessageDeliveryAndDispatchPayment<AccountId, Balance> {
);
}
/// Send message artifacts.
#[derive(RuntimeDebug, PartialEq)]
pub struct SendMessageArtifacts {
/// Nonce of the message.
pub nonce: MessageNonce,
/// Actual weight of send message call.
pub weight: Weight,
}
/// Messages bridge API to be used from other pallets.
pub trait MessagesBridge<AccountId, Balance, Payload> {
/// Error type.
@@ -148,7 +157,26 @@ pub trait MessagesBridge<AccountId, Balance, Payload> {
lane: LaneId,
message: Payload,
delivery_and_dispatch_fee: Balance,
) -> Result<MessageNonce, Self::Error>;
) -> Result<SendMessageArtifacts, Self::Error>;
}
/// Bridge that does nothing when message is being sent.
#[derive(RuntimeDebug, PartialEq)]
pub struct NoopMessagesBridge;
impl<AccountId, Balance, Payload> MessagesBridge<AccountId, Balance, Payload>
for NoopMessagesBridge
{
type Error = &'static str;
fn send_message(
_sender: Sender<AccountId>,
_lane: LaneId,
_message: Payload,
_delivery_and_dispatch_fee: Balance,
) -> Result<SendMessageArtifacts, Self::Error> {
Ok(SendMessageArtifacts { nonce: 0, weight: 0 })
}
}
/// Handler for messages delivery confirmation.