Per-lane rewards in pallet-bridge-relayers (#1665)

* per-lane rewards in pallet-bridge-relayers

* add lane id to RewardPaid event

* clippy

* fix benchmarks
This commit is contained in:
Svyatoslav Nikolsky
2022-11-28 16:49:05 +03:00
committed by Bastian Köcher
parent c03d99cd09
commit ea98118031
6 changed files with 147 additions and 72 deletions
+11 -2
View File
@@ -18,7 +18,9 @@
use crate as pallet_bridge_relayers;
use bp_messages::{source_chain::ForbidOutboundMessages, target_chain::ForbidInboundMessages};
use bp_messages::{
source_chain::ForbidOutboundMessages, target_chain::ForbidInboundMessages, LaneId,
};
use bp_relayers::PaymentProcedure;
use frame_support::{parameter_types, weights::RuntimeDbWeight};
use sp_core::H256;
@@ -124,6 +126,9 @@ impl pallet_bridge_relayers::Config for TestRuntime {
type WeightInfo = ();
}
/// Message lane that we're using in tests.
pub const TEST_LANE_ID: LaneId = [0, 0, 0, 0];
/// Regular relayer that may receive rewards.
pub const REGULAR_RELAYER: AccountId = 1;
@@ -136,7 +141,11 @@ pub struct TestPaymentProcedure;
impl PaymentProcedure<AccountId, Balance> for TestPaymentProcedure {
type Error = ();
fn pay_reward(relayer: &AccountId, _reward: Balance) -> Result<(), Self::Error> {
fn pay_reward(
relayer: &AccountId,
_lane_id: LaneId,
_reward: Balance,
) -> Result<(), Self::Error> {
match *relayer {
FAILING_RELAYER => Err(()),
_ => Ok(()),