Relayer reward metric (#1742)

* use StorageDoubleMapKeyProvider in RelayerRewards

* add metrics

* clippy

* fixed alerts that have caused missing dashboards

* fix metric name

* fix metric name again

* add new metrics to the RialtoParachain <> Millau maintenance dashboard

* remove obsolete dashboard
This commit is contained in:
Svyatoslav Nikolsky
2023-01-18 09:56:53 +03:00
committed by Bastian Köcher
parent b06cd924e9
commit d7b131646c
13 changed files with 127 additions and 21 deletions
+21 -1
View File
@@ -20,8 +20,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
use bp_messages::LaneId;
use bp_runtime::StorageDoubleMapKeyProvider;
use frame_support::{Blake2_128Concat, Identity};
use sp_runtime::{
codec::{Decode, Encode},
codec::{Codec, Decode, Encode, EncodeLike},
traits::AccountIdConversion,
};
use sp_std::{fmt::Debug, marker::PhantomData};
@@ -65,6 +67,24 @@ where
}
}
/// Can be use to access the runtime storage key within the `RelayerRewards` map of the relayers
/// pallet.
pub struct RelayerRewardsKeyProvider<AccountId, Reward>(PhantomData<(AccountId, Reward)>);
impl<AccountId, Reward> StorageDoubleMapKeyProvider for RelayerRewardsKeyProvider<AccountId, Reward>
where
AccountId: Codec + EncodeLike,
Reward: Codec + EncodeLike,
{
const MAP_NAME: &'static str = "RelayerRewards";
type Hasher1 = Blake2_128Concat;
type Key1 = AccountId;
type Hasher2 = Identity;
type Key2 = LaneId;
type Value = Reward;
}
#[cfg(test)]
mod tests {
use super::*;