Skip to content

Commit 29b7c7e

Browse files
authored
RefundRelayerForMessagesFromParachain improvements (paritytech#1895)
* 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
1 parent f652269 commit 29b7c7e

6 files changed

Lines changed: 247 additions & 169 deletions

File tree

bridges/bin/millau/runtime/src/lib.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ pub use pallet_sudo::Call as SudoCall;
8080
pub use pallet_timestamp::Call as TimestampCall;
8181
pub use pallet_xcm::Call as XcmCall;
8282

83-
use bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages;
83+
use bridge_runtime_common::{
84+
generate_bridge_reject_obsolete_headers_and_messages,
85+
refund_relayer_extension::{
86+
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
87+
RefundableParachain,
88+
},
89+
};
8490
#[cfg(any(feature = "std", test))]
8591
pub use sp_runtime::BuildStorage;
8692
pub use sp_runtime::{Perbill, Permill};
@@ -582,17 +588,15 @@ generate_bridge_reject_obsolete_headers_and_messages! {
582588
BridgeRialtoMessages, BridgeRialtoParachainMessages
583589
}
584590

591+
bp_runtime::generate_static_str_provider!(BridgeRefundRialtoPara2000Lane0Msgs);
585592
/// Signed extension that refunds relayers that are delivering messages from the Rialto parachain.
586-
pub type BridgeRefundRialtoParachainRelayers =
587-
bridge_runtime_common::refund_relayer_extension::RefundRelayerForMessagesFromParachain<
588-
Runtime,
589-
RialtoGrandpaInstance,
590-
WithRialtoParachainsInstance,
591-
WithRialtoParachainMessagesInstance,
592-
RialtoParachainId,
593-
RialtoParachainMessagesLane,
594-
Runtime,
595-
>;
593+
pub type BridgeRefundRialtoParachainMessages = RefundBridgedParachainMessages<
594+
Runtime,
595+
RefundableParachain<WithRialtoParachainsInstance, RialtoParachainId>,
596+
RefundableMessagesLane<WithRialtoParachainMessagesInstance, RialtoParachainMessagesLane>,
597+
ActualFeeRefund<Runtime>,
598+
StrBridgeRefundRialtoPara2000Lane0Msgs,
599+
>;
596600

597601
/// The address format for describing accounts.
598602
pub type Address = AccountId;
@@ -615,7 +619,7 @@ pub type SignedExtra = (
615619
frame_system::CheckWeight<Runtime>,
616620
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
617621
BridgeRejectObsoleteHeadersAndMessages,
618-
BridgeRefundRialtoParachainRelayers,
622+
BridgeRefundRialtoParachainMessages,
619623
);
620624
/// The payload being signed in transactions.
621625
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;

bridges/bin/runtime-common/src/messages_call_ext.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ use crate::messages::{
1818
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
1919
};
2020
use bp_messages::{LaneId, MessageNonce};
21-
use frame_support::{dispatch::CallableCallFor, traits::IsSubType};
21+
use frame_support::{dispatch::CallableCallFor, traits::IsSubType, RuntimeDebug};
2222
use pallet_bridge_messages::{Config, Pallet};
23-
use sp_runtime::{transaction_validity::TransactionValidity, RuntimeDebug};
23+
use sp_runtime::transaction_validity::TransactionValidity;
2424

2525
/// Info about a `ReceiveMessagesProof` call which tries to update a single lane.
26-
#[derive(Copy, Clone, PartialEq, RuntimeDebug)]
26+
#[derive(PartialEq, RuntimeDebug)]
2727
pub struct ReceiveMessagesProofInfo {
2828
pub lane_id: LaneId,
2929
pub best_proof_nonce: MessageNonce,

0 commit comments

Comments
 (0)