Skip to content

Commit

Permalink
Multiple instances for pallet-bridge-relayers fix (paritytech#6684)
Browse files Browse the repository at this point in the history
Previously, we added multi-instance pallet support for
`pallet-bridge-relayers`, but missed fixing it in this one place.

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
  • Loading branch information
3 people authored and Krayt78 committed Dec 18, 2024
1 parent 43e4d82 commit 1a1d665
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions bridges/modules/relayers/src/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub struct BridgeRelayersTransactionExtension<Runtime, Config, LaneId>(
impl<R, C, LaneId> BridgeRelayersTransactionExtension<R, C, LaneId>
where
Self: 'static + Send + Sync,
R: RelayersConfig<LaneId = LaneId>
R: RelayersConfig<C::BridgeRelayersPalletInstance, LaneId = LaneId>
+ BridgeMessagesConfig<C::BridgeMessagesPalletInstance, LaneId = LaneId>
+ TransactionPaymentConfig,
C: ExtensionConfig<Runtime = R, LaneId = LaneId>,
Expand Down Expand Up @@ -250,7 +250,7 @@ where
// let's also replace the weight of slashing relayer with the weight of rewarding relayer
if call_info.is_receive_messages_proof_call() {
post_info_weight = post_info_weight.saturating_sub(
<R as RelayersConfig>::WeightInfo::extra_weight_of_successful_receive_messages_proof_call(),
<R as RelayersConfig<C::BridgeRelayersPalletInstance>>::WeightInfo::extra_weight_of_successful_receive_messages_proof_call(),
);
}

Expand Down Expand Up @@ -278,7 +278,7 @@ impl<R, C, LaneId> TransactionExtension<R::RuntimeCall>
for BridgeRelayersTransactionExtension<R, C, LaneId>
where
Self: 'static + Send + Sync,
R: RelayersConfig<LaneId = LaneId>
R: RelayersConfig<C::BridgeRelayersPalletInstance, LaneId = LaneId>
+ BridgeMessagesConfig<C::BridgeMessagesPalletInstance, LaneId = LaneId>
+ TransactionPaymentConfig,
C: ExtensionConfig<Runtime = R, LaneId = LaneId>,
Expand Down Expand Up @@ -326,7 +326,9 @@ where
};

// we only boost priority if relayer has staked required balance
if !RelayersPallet::<R>::is_registration_active(&data.relayer) {
if !RelayersPallet::<R, C::BridgeRelayersPalletInstance>::is_registration_active(
&data.relayer,
) {
return Ok((Default::default(), Some(data), origin))
}

Expand Down Expand Up @@ -382,7 +384,11 @@ where
match call_result {
RelayerAccountAction::None => (),
RelayerAccountAction::Reward(relayer, reward_account, reward) => {
RelayersPallet::<R>::register_relayer_reward(reward_account, &relayer, reward);
RelayersPallet::<R, C::BridgeRelayersPalletInstance>::register_relayer_reward(
reward_account,
&relayer,
reward,
);

log::trace!(
target: LOG_TARGET,
Expand All @@ -394,7 +400,7 @@ where
);
},
RelayerAccountAction::Slash(relayer, slash_account) =>
RelayersPallet::<R>::slash_and_deregister(
RelayersPallet::<R, C::BridgeRelayersPalletInstance>::slash_and_deregister(
&relayer,
ExplicitOrAccountParams::Params(slash_account),
),
Expand Down

0 comments on commit 1a1d665

Please sign in to comment.