mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Remove chain-specific dependencies from crates that will be used in Cumulus (#1783)
* leave-modules.sh * remove bp-rialto dependency from bp-relayers * update leave-modules.sh * fix Cargo.toml of pallet-bridge-relayers * update leave-modules.sh * remove bp-rialto and millau-runtime frombridge-runtime-common Cargo.toml * update leave-modules.sh * remove chain dependencies from bridge-runtime-common crate * fix tests * cleanup script * rename script * kind of success message * remove leave-modules.sh * use TargetHeaderChainAdapter and SourceHeaderChainAdapter in our testnets * update script
This commit is contained in:
committed by
Bastian Köcher
parent
9465ef6071
commit
ec9cd8ddb0
@@ -581,7 +581,7 @@ impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
|
||||
type InboundRelayer = bp_millau::AccountId;
|
||||
type DeliveryPayments = ();
|
||||
|
||||
type TargetHeaderChain = crate::millau_messages::Millau;
|
||||
type TargetHeaderChain = crate::millau_messages::MillauAsTargetHeaderChain;
|
||||
type LaneMessageVerifier = crate::millau_messages::ToMillauMessageVerifier;
|
||||
type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
|
||||
Runtime,
|
||||
@@ -589,7 +589,7 @@ impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
|
||||
frame_support::traits::ConstU128<100_000>,
|
||||
>;
|
||||
|
||||
type SourceHeaderChain = crate::millau_messages::Millau;
|
||||
type SourceHeaderChain = crate::millau_messages::MillauAsSourceHeaderChain;
|
||||
type MessageDispatch = crate::millau_messages::FromMillauMessageDispatch;
|
||||
type BridgedChainId = BridgedChainId;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,11 @@
|
||||
|
||||
use crate::{MillauGrandpaInstance, Runtime, RuntimeCall, RuntimeOrigin};
|
||||
|
||||
use bp_messages::{
|
||||
source_chain::TargetHeaderChain,
|
||||
target_chain::{ProvedMessages, SourceHeaderChain},
|
||||
InboundLaneData, LaneId, Message, MessageNonce,
|
||||
};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{ChainId, MILLAU_CHAIN_ID, RIALTO_PARACHAIN_CHAIN_ID};
|
||||
use bridge_runtime_common::messages::{self, MessageBridge};
|
||||
use bridge_runtime_common::messages::{
|
||||
self, source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter, MessageBridge,
|
||||
};
|
||||
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
|
||||
|
||||
/// Default lane that is used to send messages to Millau.
|
||||
@@ -114,6 +112,10 @@ impl messages::ThisChainWithMessages for RialtoParachain {
|
||||
/// Millau chain from message lane point of view.
|
||||
#[derive(RuntimeDebug, Clone, Copy)]
|
||||
pub struct Millau;
|
||||
/// Millau as source header chain.
|
||||
pub type MillauAsSourceHeaderChain = SourceHeaderChainAdapter<WithMillauMessageBridge>;
|
||||
/// Millau as target header chain.
|
||||
pub type MillauAsTargetHeaderChain = TargetHeaderChainAdapter<WithMillauMessageBridge>;
|
||||
|
||||
impl messages::UnderlyingChainProvider for Millau {
|
||||
type Chain = bp_millau::Millau;
|
||||
@@ -124,40 +126,3 @@ impl messages::BridgedChainWithMessages for Millau {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl TargetHeaderChain<ToMillauMessagePayload, bp_rialto_parachain::AccountId> for Millau {
|
||||
type Error = &'static str;
|
||||
// The proof is:
|
||||
// - hash of the header this proof has been created with;
|
||||
// - the storage proof of one or several keys;
|
||||
// - id of the lane we prove state of.
|
||||
type MessagesDeliveryProof = ToMillauMessagesDeliveryProof;
|
||||
|
||||
fn verify_message(payload: &ToMillauMessagePayload) -> Result<(), Self::Error> {
|
||||
messages::source::verify_chain_message::<WithMillauMessageBridge>(payload)
|
||||
}
|
||||
|
||||
fn verify_messages_delivery_proof(
|
||||
proof: Self::MessagesDeliveryProof,
|
||||
) -> Result<(LaneId, InboundLaneData<bp_rialto_parachain::AccountId>), Self::Error> {
|
||||
messages::source::verify_messages_delivery_proof::<WithMillauMessageBridge>(proof)
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceHeaderChain for Millau {
|
||||
type Error = &'static str;
|
||||
// The proof is:
|
||||
// - hash of the header this proof has been created with;
|
||||
// - the storage proof of one or several keys;
|
||||
// - id of the lane we prove messages for;
|
||||
// - inclusive range of messages nonces that are proved.
|
||||
type MessagesProof = FromMillauMessagesProof;
|
||||
|
||||
fn verify_messages_proof(
|
||||
proof: Self::MessagesProof,
|
||||
messages_count: u32,
|
||||
) -> Result<ProvedMessages<Message>, Self::Error> {
|
||||
messages::target::verify_messages_proof::<WithMillauMessageBridge>(proof, messages_count)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user