BHK/P alignments (#2115)

* Constants

* Unused import?

* Cargo.lock

* Unused deps

* TODO: fix doc or reimport?

* Try to aviod redefine para_id constant for `RefundableParachainId`

* Checked and removed TODOs
This commit is contained in:
Branislav Kontur
2023-05-11 10:16:43 +02:00
committed by Bastian Köcher
parent d479232c34
commit 7188765244
18 changed files with 58 additions and 45 deletions
@@ -24,7 +24,7 @@ use crate::messages_call_ext::{
};
use bp_messages::{LaneId, MessageNonce};
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::{RangeInclusiveExt, StaticStrProvider};
use bp_runtime::{Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider};
use codec::{Decode, Encode};
use frame_support::{
dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo},
@@ -71,9 +71,9 @@ pub trait RefundableParachainId {
}
/// Default implementation of `RefundableParachainId`.
pub struct RefundableParachain<Instance, Id>(PhantomData<(Instance, Id)>);
pub struct DefaultRefundableParachainId<Instance, Id>(PhantomData<(Instance, Id)>);
impl<Instance, Id> RefundableParachainId for RefundableParachain<Instance, Id>
impl<Instance, Id> RefundableParachainId for DefaultRefundableParachainId<Instance, Id>
where
Id: Get<u32>,
{
@@ -81,6 +81,17 @@ where
type Id = Id;
}
/// Implementation of `RefundableParachainId` for `trait Parachain`.
pub struct RefundableParachain<Instance, Para>(PhantomData<(Instance, Para)>);
impl<Instance, Para> RefundableParachainId for RefundableParachain<Instance, Para>
where
Para: Parachain,
{
type Instance = Instance;
type Id = ParachainIdOf<Para>;
}
/// Trait identifying a bridged messages lane. A relayer might be refunded for delivering messages
/// coming from this lane.
pub trait RefundableMessagesLaneId {
@@ -682,7 +693,7 @@ mod tests {
bp_runtime::generate_static_str_provider!(TestExtension);
type TestExtension = RefundBridgedParachainMessages<
TestRuntime,
RefundableParachain<(), TestParachain>,
DefaultRefundableParachainId<(), TestParachain>,
RefundableMessagesLane<(), TestLaneId>,
ActualFeeRefund<TestRuntime>,
ConstU64<1>,