diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 43cdab1a..4483ef43 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -55,8 +55,7 @@ where + sp_blockchain::HeaderMetadata, C::Api: substrate_frame_rpc_system::AccountNonceApi + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + sp_block_builder::BlockBuilder - + + sp_block_builder::BlockBuilder, P: 'static + Send + Sync + sc_transaction_pool_api::TransactionPool, { // --- paritytech --- diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index edaeeabd..2aef8ff3 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -130,18 +130,19 @@ where /// dispatch origin; /// - check that the sender has paid enough funds for both message delivery and dispatch. #[derive(RuntimeDebug)] -pub struct FromThisChainMessageVerifier(PhantomData<(B, R)>); -impl +pub struct FromThisChainMessageVerifier(PhantomData<(B, R, I)>); +impl LaneMessageVerifier< AccountIdOf>, FromThisChainMessagePayload, BalanceOf>, - > for FromThisChainMessageVerifier + > for FromThisChainMessageVerifier where B: MessageBridge, - R: pallet_fee_market::Config, + R: pallet_fee_market::Config, + I: 'static, AccountIdOf>: Clone + PartialEq, - pallet_fee_market::RingBalance: From>>, + pallet_fee_market::BalanceOf: From>>, { type Error = &'static str; @@ -173,8 +174,8 @@ where // Do the delivery_and_dispatch_fee. We assume that the delivery and dispatch fee always // greater than the fee market provided fee. - if let Some(market_fee) = pallet_fee_market::Pallet::::market_fee() { - let message_fee: pallet_fee_market::RingBalance = + if let Some(market_fee) = pallet_fee_market::Pallet::::market_fee() { + let message_fee: pallet_fee_market::BalanceOf = (*delivery_and_dispatch_fee).into(); // compare with actual fee paid diff --git a/runtime/crab-parachain/src/migrations.rs b/runtime/crab-parachain/src/migrations.rs index 437ec534..ece5346e 100644 --- a/runtime/crab-parachain/src/migrations.rs +++ b/runtime/crab-parachain/src/migrations.rs @@ -1,5 +1,9 @@ // --- paritytech --- -use frame_support::{traits::OnRuntimeUpgrade, weights::Weight}; +#[allow(unused)] +use frame_support::{migration, traits::OnRuntimeUpgrade, weights::Weight}; +// --- darwinia-network --- +#[allow(unused)] +use crate::*; pub struct CustomOnRuntimeUpgrade; impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade { diff --git a/runtime/pangolin-parachain/src/bridges_message/pangolin.rs b/runtime/pangolin-parachain/src/bridges_message/pangolin.rs index 64faf4da..a4a39e39 100644 --- a/runtime/pangolin-parachain/src/bridges_message/pangolin.rs +++ b/runtime/pangolin-parachain/src/bridges_message/pangolin.rs @@ -27,8 +27,8 @@ pub type ToPangolinMessagePayload = FromThisChainMessagePayload; /// Message verifier for PangolinParachain -> Pangolin messages. -pub type ToPangolinMessageVerifier = FromThisChainMessageVerifier; - +pub type ToPangolinMessageVerifier = + FromThisChainMessageVerifier; /// Encoded Pangolin Call as it comes from Pangolin. pub type FromPangolinEncodedCall = FromBridgedChainEncodedMessageCall; diff --git a/runtime/pangolin-parachain/src/lib.rs b/runtime/pangolin-parachain/src/lib.rs index f78638e0..a41de78d 100644 --- a/runtime/pangolin-parachain/src/lib.rs +++ b/runtime/pangolin-parachain/src/lib.rs @@ -44,6 +44,9 @@ pub mod wasm { } pub use wasm::*; +mod migrations; +use migrations::*; + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -108,6 +111,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + CustomOnRuntimeUpgrade, >; type Ring = Balances; @@ -181,7 +185,7 @@ frame_support::construct_runtime! { BridgePangolinMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event} = 21, BridgePangolinDispatch: pallet_bridge_dispatch::::{Pallet, Event} = 22, - FeeMarket: pallet_fee_market::{Pallet, Call, Storage, Event} = 23, + PangolinFeeMarket: pallet_fee_market::::{Pallet, Call, Storage, Event} = 23, } } diff --git a/runtime/pangolin-parachain/src/pallets/bridge_messages.rs b/runtime/pangolin-parachain/src/pallets/bridge_messages.rs index fffbe306..295d567e 100644 --- a/runtime/pangolin-parachain/src/pallets/bridge_messages.rs +++ b/runtime/pangolin-parachain/src/pallets/bridge_messages.rs @@ -22,36 +22,25 @@ frame_support::parameter_types! { } impl Config for Runtime { + type AccountIdConverter = bp_pangolin_parachain::AccountIdConverter; + type BridgedChainId = BridgedChainId; type Event = Event; - type WeightInfo = WeightInfo; - type Parameter = bm_pangolin::PangolinParachainToPangolinParameter; - type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; - type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; - type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; - - type OutboundPayload = bm_pangolin::ToPangolinMessagePayload; - type OutboundMessageFee = Balance; - - type InboundPayload = bm_pangolin::FromPangolinMessagePayload; type InboundMessageFee = bp_pangolin::Balance; + type InboundPayload = bm_pangolin::FromPangolinMessagePayload; type InboundRelayer = bp_pangolin::AccountId; - - type AccountIdConverter = bp_pangolin_parachain::AccountIdConverter; - - type TargetHeaderChain = bm_pangolin::Pangolin; type LaneMessageVerifier = bm_pangolin::ToPangolinMessageVerifier; - type MessageDeliveryAndDispatchPayment = FeeMarketPayment< - Runtime, - WithPangolinMessages, - Ring, - GetDeliveryConfirmationTransactionFee, - RootAccountForPayments, - >; - - type OnMessageAccepted = FeeMarketMessageAcceptedHandler; - type OnDeliveryConfirmed = (FeeMarketMessageConfirmedHandler,); - - type SourceHeaderChain = bm_pangolin::Pangolin; + type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MessageDeliveryAndDispatchPayment = + FeeMarketPayment; type MessageDispatch = bm_pangolin::FromPangolinMessageDispatch; - type BridgedChainId = BridgedChainId; + type OnDeliveryConfirmed = (FeeMarketMessageConfirmedHandler,); + type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_pangolin_parachain::Balance; + type OutboundPayload = bm_pangolin::ToPangolinMessagePayload; + type Parameter = bm_pangolin::PangolinParachainToPangolinParameter; + type SourceHeaderChain = bm_pangolin::Pangolin; + type TargetHeaderChain = bm_pangolin::Pangolin; + type WeightInfo = WeightInfo; } diff --git a/runtime/pangolin-parachain/src/pallets/fee_market.rs b/runtime/pangolin-parachain/src/pallets/fee_market.rs index 43de2710..36540516 100644 --- a/runtime/pangolin-parachain/src/pallets/fee_market.rs +++ b/runtime/pangolin-parachain/src/pallets/fee_market.rs @@ -1,3 +1,5 @@ +pub use pallet_fee_market::Instance1 as WithPangolinFeeMarket; + // --- core --- use core::cmp; // --- substrate --- @@ -5,11 +7,15 @@ use frame_support::{traits::LockIdentifier, PalletId}; use sp_runtime::{traits::UniqueSaturatedInto, Permill}; // --- darwinia --- use crate::{weights::pallet_fee_market::WeightInfo, *}; -use pallet_fee_market::{Config, RingBalance, Slasher}; +use pallet_fee_market::{BalanceOf, Config, Slasher}; pub struct FeeMarketSlasher; -impl Slasher for FeeMarketSlasher { - fn slash(locked_collateral: RingBalance, timeout: T::BlockNumber) -> RingBalance { +impl Slasher for FeeMarketSlasher +where + T: Config, + I: 'static, +{ + fn slash(locked_collateral: BalanceOf, timeout: T::BlockNumber) -> BalanceOf { let slash_each_block = 2 * COIN; let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) .saturating_mul(UniqueSaturatedInto::::unique_saturated_into( @@ -22,7 +28,6 @@ impl Slasher for FeeMarketSlasher { } frame_support::parameter_types! { - pub const FeeMarketPalletId: PalletId = PalletId(*b"da/feemk"); pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); pub const FeeMarketLockId: LockIdentifier = *b"da/feelf"; @@ -35,21 +40,17 @@ frame_support::parameter_types! { pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); } -impl Config for Runtime { - type PalletId = FeeMarketPalletId; - type TreasuryPalletId = TreasuryPalletId; - type LockId = FeeMarketLockId; - - type MinimumRelayFee = MinimumRelayFee; - type CollateralPerOrder = CollateralPerOrder; - type Slot = Slot; - +impl Config for Runtime { type AssignedRelayersRewardRatio = AssignedRelayersRewardRatio; - type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type CollateralPerOrder = CollateralPerOrder; type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; - - type Slasher = FeeMarketSlasher; - type RingCurrency = Ring; + type Currency = Ring; type Event = Event; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = MinimumRelayFee; + type Slasher = FeeMarketSlasher; + type Slot = Slot; + type TreasuryPalletId = TreasuryPalletId; type WeightInfo = WeightInfo; }