Skip to content

Commit

Permalink
RefundRelayerForMessagesFromParachain improvements (paritytech#1895)
Browse files Browse the repository at this point in the history
* RefundRelayerForMessagesFromParachain changes

- some renamings and cosmetics
- removing the GI generic param since we can get it from the parachains
  config
- merging (Parachains Instance, Parachain Id) and (Messages Instance,
  Messages lane Id) generic params
- removing unnecessay derives
- renaming for the `TransactionFeeCalculation` and defining
  `ActualFeeRefund` concrete implementation
- adding support for multiple RefundRelayerForMessagesFromParachain
  (by adding a `StaticStrProvider` generic param)

* Revert to using RuntimeDebug
  • Loading branch information
serban300 committed Apr 10, 2024
1 parent e0c4516 commit 5ba8fa0
Show file tree
Hide file tree
Showing 6 changed files with 247 additions and 169 deletions.
28 changes: 16 additions & 12 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ pub use pallet_sudo::Call as SudoCall;
pub use pallet_timestamp::Call as TimestampCall;
pub use pallet_xcm::Call as XcmCall;

use bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages;
use bridge_runtime_common::{
generate_bridge_reject_obsolete_headers_and_messages,
refund_relayer_extension::{
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
RefundableParachain,
},
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};
Expand Down Expand Up @@ -582,17 +588,15 @@ generate_bridge_reject_obsolete_headers_and_messages! {
BridgeRialtoMessages, BridgeRialtoParachainMessages
}

bp_runtime::generate_static_str_provider!(BridgeRefundRialtoPara2000Lane0Msgs);
/// Signed extension that refunds relayers that are delivering messages from the Rialto parachain.
pub type BridgeRefundRialtoParachainRelayers =
bridge_runtime_common::refund_relayer_extension::RefundRelayerForMessagesFromParachain<
Runtime,
RialtoGrandpaInstance,
WithRialtoParachainsInstance,
WithRialtoParachainMessagesInstance,
RialtoParachainId,
RialtoParachainMessagesLane,
Runtime,
>;
pub type BridgeRefundRialtoParachainMessages = RefundBridgedParachainMessages<
Runtime,
RefundableParachain<WithRialtoParachainsInstance, RialtoParachainId>,
RefundableMessagesLane<WithRialtoParachainMessagesInstance, RialtoParachainMessagesLane>,
ActualFeeRefund<Runtime>,
StrBridgeRefundRialtoPara2000Lane0Msgs,
>;

/// The address format for describing accounts.
pub type Address = AccountId;
Expand All @@ -615,7 +619,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
BridgeRejectObsoleteHeadersAndMessages,
BridgeRefundRialtoParachainRelayers,
BridgeRefundRialtoParachainMessages,
);
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
Expand Down
6 changes: 3 additions & 3 deletions bridges/bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use crate::messages::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
};
use bp_messages::{LaneId, MessageNonce};
use frame_support::{dispatch::CallableCallFor, traits::IsSubType};
use frame_support::{dispatch::CallableCallFor, traits::IsSubType, RuntimeDebug};
use pallet_bridge_messages::{Config, Pallet};
use sp_runtime::{transaction_validity::TransactionValidity, RuntimeDebug};
use sp_runtime::transaction_validity::TransactionValidity;

/// Info about a `ReceiveMessagesProof` call which tries to update a single lane.
#[derive(Copy, Clone, PartialEq, RuntimeDebug)]
#[derive(PartialEq, RuntimeDebug)]
pub struct ReceiveMessagesProofInfo {
pub lane_id: LaneId,
pub best_proof_nonce: MessageNonce,
Expand Down
Loading

0 comments on commit 5ba8fa0

Please sign in to comment.