mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Remove bridges subtree (#5752)
* remove bridges folder * remove BRIDGES.md * remove bridges mentions from top Cargo.toml * remove bridges from CODEOWNERS * remove bridges mentions from testing.md * remove bridge pallets from Rococo/Wococo runtime * also remove from node
This commit is contained in:
committed by
GitHub
parent
2e42da645f
commit
3f29fd04e1
@@ -58,7 +58,7 @@ use sp_runtime::{
|
||||
OpaqueKeys, SaturatedConversion, Verify,
|
||||
},
|
||||
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult, FixedU128, KeyTypeId,
|
||||
ApplyExtrinsicResult, KeyTypeId,
|
||||
};
|
||||
use sp_staking::SessionIndex;
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
@@ -74,16 +74,11 @@ use runtime_parachains::{
|
||||
session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump,
|
||||
};
|
||||
|
||||
use bridge_runtime_common::messages::{
|
||||
source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
|
||||
};
|
||||
|
||||
pub use frame_system::Call as SystemCall;
|
||||
|
||||
/// Constant values used within the runtime.
|
||||
use rococo_runtime_constants::{currency::*, fee::*, time::*};
|
||||
|
||||
mod bridge_messages;
|
||||
mod validator_manager;
|
||||
mod weights;
|
||||
pub mod xcm_config;
|
||||
@@ -231,19 +226,6 @@ construct_runtime! {
|
||||
// Validator Manager pallet.
|
||||
ValidatorManager: validator_manager,
|
||||
|
||||
// It might seem strange that we add both sides of the bridge to the same runtime. We do this because this
|
||||
// runtime as shared by both the Rococo and Wococo chains. When running as Rococo we only use
|
||||
// `BridgeWococoGrandpa`, and vice versa.
|
||||
BridgeRococoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage, Config<T>} = 40,
|
||||
BridgeWococoGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Storage, Config<T>} = 41,
|
||||
|
||||
// Bridge messages support. The same story as with the bridge grandpa pallet above ^^^ - when we're
|
||||
// running as Rococo we only use `BridgeWococoMessages`/`BridgeWococoMessagesDispatch`, and vice versa.
|
||||
BridgeRococoMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event<T>, Config<T>} = 43,
|
||||
BridgeWococoMessages: pallet_bridge_messages::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 44,
|
||||
BridgeRococoMessagesDispatch: pallet_bridge_dispatch::{Pallet, Event<T>} = 45,
|
||||
BridgeWococoMessagesDispatch: pallet_bridge_dispatch::<Instance1>::{Pallet, Event<T>} = 46,
|
||||
|
||||
// A "council"
|
||||
Collective: pallet_collective = 80,
|
||||
Membership: pallet_membership = 81,
|
||||
@@ -748,137 +730,6 @@ parameter_types! {
|
||||
pub const HeadersToKeep: u32 = 7 * DAYS as u32;
|
||||
}
|
||||
|
||||
pub type RococoGrandpaInstance = ();
|
||||
impl pallet_bridge_grandpa::Config for Runtime {
|
||||
type BridgedChain = bp_rococo::Rococo;
|
||||
type MaxRequests = MaxRequests;
|
||||
type HeadersToKeep = HeadersToKeep;
|
||||
|
||||
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
|
||||
}
|
||||
|
||||
pub type WococoGrandpaInstance = pallet_bridge_grandpa::Instance1;
|
||||
impl pallet_bridge_grandpa::Config<WococoGrandpaInstance> for Runtime {
|
||||
type BridgedChain = bp_wococo::Wococo;
|
||||
type MaxRequests = MaxRequests;
|
||||
type HeadersToKeep = HeadersToKeep;
|
||||
|
||||
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
|
||||
}
|
||||
|
||||
// Instance that is "deployed" at Wococo chain. Responsible for dispatching Rococo -> Wococo messages.
|
||||
pub type AtWococoFromRococoMessagesDispatch = ();
|
||||
impl pallet_bridge_dispatch::Config<AtWococoFromRococoMessagesDispatch> for Runtime {
|
||||
type Event = Event;
|
||||
type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||
type Call = Call;
|
||||
type CallFilter = frame_support::traits::Everything;
|
||||
type EncodedCall = bridge_messages::FromRococoEncodedCall;
|
||||
type SourceChainAccountId = bp_wococo::AccountId;
|
||||
type TargetChainAccountPublic = sp_runtime::MultiSigner;
|
||||
type TargetChainSignature = sp_runtime::MultiSignature;
|
||||
type AccountIdConverter = bp_rococo::AccountIdConverter;
|
||||
}
|
||||
|
||||
// Instance that is "deployed" at Rococo chain. Responsible for dispatching Wococo -> Rococo messages.
|
||||
pub type AtRococoFromWococoMessagesDispatch = pallet_bridge_dispatch::Instance1;
|
||||
impl pallet_bridge_dispatch::Config<AtRococoFromWococoMessagesDispatch> for Runtime {
|
||||
type Event = Event;
|
||||
type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
|
||||
type Call = Call;
|
||||
type CallFilter = frame_support::traits::Everything;
|
||||
type EncodedCall = bridge_messages::FromWococoEncodedCall;
|
||||
type SourceChainAccountId = bp_rococo::AccountId;
|
||||
type TargetChainAccountPublic = sp_runtime::MultiSigner;
|
||||
type TargetChainSignature = sp_runtime::MultiSignature;
|
||||
type AccountIdConverter = bp_wococo::AccountIdConverter;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MaxMessagesToPruneAtOnce: bp_messages::MessageNonce = 8;
|
||||
pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
pub const RococoChainId: bp_runtime::ChainId = bp_runtime::ROCOCO_CHAIN_ID;
|
||||
pub const WococoChainId: bp_runtime::ChainId = bp_runtime::WOCOCO_CHAIN_ID;
|
||||
}
|
||||
|
||||
// Instance that is "deployed" at Wococo chain. Responsible for sending Wococo -> Rococo messages
|
||||
// and receiving Rococo -> Wococo messages.
|
||||
pub type AtWococoWithRococoMessagesInstance = ();
|
||||
impl pallet_bridge_messages::Config<AtWococoWithRococoMessagesInstance> for Runtime {
|
||||
type Event = Event;
|
||||
type BridgedChainId = RococoChainId;
|
||||
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
|
||||
type Parameter = ();
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
|
||||
type OutboundPayload = crate::bridge_messages::ToRococoMessagePayload;
|
||||
type OutboundMessageFee = bp_wococo::Balance;
|
||||
|
||||
type InboundPayload = crate::bridge_messages::FromRococoMessagePayload;
|
||||
type InboundMessageFee = bp_rococo::Balance;
|
||||
type InboundRelayer = bp_rococo::AccountId;
|
||||
|
||||
type AccountIdConverter = bp_wococo::AccountIdConverter;
|
||||
|
||||
type TargetHeaderChain = crate::bridge_messages::RococoAtWococo;
|
||||
type LaneMessageVerifier = crate::bridge_messages::ToRococoMessageVerifier;
|
||||
type MessageDeliveryAndDispatchPayment =
|
||||
pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
|
||||
Runtime,
|
||||
AtWococoWithRococoMessagesInstance,
|
||||
pallet_balances::Pallet<Runtime>,
|
||||
crate::bridge_messages::GetDeliveryConfirmationTransactionFee,
|
||||
>;
|
||||
type OnDeliveryConfirmed = ();
|
||||
type OnMessageAccepted = ();
|
||||
|
||||
type SourceHeaderChain = crate::bridge_messages::RococoAtWococo;
|
||||
type MessageDispatch = crate::bridge_messages::FromRococoMessageDispatch;
|
||||
}
|
||||
|
||||
// Instance that is "deployed" at Rococo chain. Responsible for sending Rococo -> Wococo messages
|
||||
// and receiving Wococo -> Rococo messages.
|
||||
pub type AtRococoWithWococoMessagesInstance = pallet_bridge_messages::Instance1;
|
||||
impl pallet_bridge_messages::Config<AtRococoWithWococoMessagesInstance> for Runtime {
|
||||
type Event = Event;
|
||||
type BridgedChainId = WococoChainId;
|
||||
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
|
||||
type Parameter = ();
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
|
||||
type OutboundPayload = crate::bridge_messages::ToWococoMessagePayload;
|
||||
type OutboundMessageFee = bp_rococo::Balance;
|
||||
|
||||
type InboundPayload = crate::bridge_messages::FromWococoMessagePayload;
|
||||
type InboundMessageFee = bp_wococo::Balance;
|
||||
type InboundRelayer = bp_wococo::AccountId;
|
||||
|
||||
type AccountIdConverter = bp_rococo::AccountIdConverter;
|
||||
|
||||
type TargetHeaderChain = crate::bridge_messages::WococoAtRococo;
|
||||
type LaneMessageVerifier = crate::bridge_messages::ToWococoMessageVerifier;
|
||||
type MessageDeliveryAndDispatchPayment =
|
||||
pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
|
||||
Runtime,
|
||||
AtRococoWithWococoMessagesInstance,
|
||||
pallet_balances::Pallet<Runtime>,
|
||||
crate::bridge_messages::GetDeliveryConfirmationTransactionFee,
|
||||
>;
|
||||
type OnDeliveryConfirmed = ();
|
||||
type OnMessageAccepted = ();
|
||||
|
||||
type SourceHeaderChain = crate::bridge_messages::WococoAtRococo;
|
||||
type MessageDispatch = crate::bridge_messages::FromWococoMessageDispatch;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const EndingPeriod: BlockNumber = 1 * HOURS;
|
||||
pub const SampleLength: BlockNumber = 1;
|
||||
@@ -1452,90 +1303,6 @@ sp_api::impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rococo::RococoFinalityApi<Block> for Runtime {
|
||||
fn best_finalized() -> (bp_rococo::BlockNumber, bp_rococo::Hash) {
|
||||
let header = BridgeRococoGrandpa::best_finalized();
|
||||
(header.number, header.hash())
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_wococo::WococoFinalityApi<Block> for Runtime {
|
||||
fn best_finalized() -> (bp_wococo::BlockNumber, bp_wococo::Hash) {
|
||||
let header = BridgeWococoGrandpa::best_finalized();
|
||||
(header.number, header.hash())
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rococo::ToRococoOutboundLaneApi<Block, Balance, bridge_messages::ToRococoMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: bridge_messages::ToWococoMessagePayload,
|
||||
rococo_to_wococo_conversion_rate: Option<FixedU128>,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<bridge_messages::AtWococoWithRococoMessageBridge>(
|
||||
&payload,
|
||||
bridge_messages::AtWococoWithRococoMessageBridge::RELAYER_FEE_PERCENT,
|
||||
rococo_to_wococo_conversion_rate,
|
||||
).ok()
|
||||
}
|
||||
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<bp_messages::MessageDetails<Balance>> {
|
||||
(begin..=end).filter_map(|nonce| {
|
||||
let message_data = BridgeRococoMessages::outbound_message_data(lane, nonce)?;
|
||||
let decoded_payload = bridge_messages::ToRococoMessagePayload::decode(
|
||||
&mut &message_data.payload[..]
|
||||
).ok()?;
|
||||
Some(bp_messages::MessageDetails {
|
||||
nonce,
|
||||
dispatch_weight: decoded_payload.weight,
|
||||
size: message_data.payload.len() as _,
|
||||
delivery_and_dispatch_fee: message_data.fee,
|
||||
dispatch_fee_payment: decoded_payload.dispatch_fee_payment,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_wococo::ToWococoOutboundLaneApi<Block, Balance, bridge_messages::ToWococoMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: bridge_messages::ToWococoMessagePayload,
|
||||
wococo_to_rococo_conversion_rate: Option<FixedU128>,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<bridge_messages::AtRococoWithWococoMessageBridge>(
|
||||
&payload,
|
||||
bridge_messages::AtRococoWithWococoMessageBridge::RELAYER_FEE_PERCENT,
|
||||
wococo_to_rococo_conversion_rate,
|
||||
).ok()
|
||||
}
|
||||
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<bp_messages::MessageDetails<Balance>> {
|
||||
(begin..=end).filter_map(|nonce| {
|
||||
let message_data = BridgeWococoMessages::outbound_message_data(lane, nonce)?;
|
||||
let decoded_payload = bridge_messages::ToWococoMessagePayload::decode(
|
||||
&mut &message_data.payload[..]
|
||||
).ok()?;
|
||||
Some(bp_messages::MessageDetails {
|
||||
nonce,
|
||||
dispatch_weight: decoded_payload.weight,
|
||||
size: message_data.payload.len() as _,
|
||||
delivery_and_dispatch_fee: message_data.fee,
|
||||
dispatch_fee_payment: decoded_payload.dispatch_fee_payment,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
|
||||
fn account_nonce(account: AccountId) -> Nonce {
|
||||
System::account_nonce(account)
|
||||
|
||||
Reference in New Issue
Block a user