mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Cleanup bridges tests: with-parachain case (#2772)
related to https://github.com/paritytech/parity-bridges-common/issues/2739
This commit is contained in:
committed by
GitHub
parent
69434d9a32
commit
94759738f0
@@ -138,6 +138,7 @@ mod bridge_hub_westend_tests {
|
|||||||
use bridge_common_config::{
|
use bridge_common_config::{
|
||||||
BridgeGrandpaWestendInstance, BridgeParachainWestendInstance, DeliveryRewardInBalance,
|
BridgeGrandpaWestendInstance, BridgeParachainWestendInstance, DeliveryRewardInBalance,
|
||||||
};
|
};
|
||||||
|
use bridge_hub_test_utils::test_cases::from_parachain;
|
||||||
use bridge_to_westend_config::{
|
use bridge_to_westend_config::{
|
||||||
BridgeHubWestendChainId, BridgeHubWestendLocation, WestendGlobalConsensusNetwork,
|
BridgeHubWestendChainId, BridgeHubWestendLocation, WestendGlobalConsensusNetwork,
|
||||||
WithBridgeHubWestendMessageBridge, WithBridgeHubWestendMessagesInstance,
|
WithBridgeHubWestendMessageBridge, WithBridgeHubWestendMessagesInstance,
|
||||||
@@ -147,6 +148,16 @@ mod bridge_hub_westend_tests {
|
|||||||
// Para id of sibling chain used in tests.
|
// Para id of sibling chain used in tests.
|
||||||
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
|
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
|
||||||
|
|
||||||
|
// Runtime from tests PoV
|
||||||
|
type RuntimeTestsAdapter = from_parachain::WithRemoteParachainHelperAdapter<
|
||||||
|
Runtime,
|
||||||
|
AllPalletsWithoutSystem,
|
||||||
|
BridgeGrandpaWestendInstance,
|
||||||
|
BridgeParachainWestendInstance,
|
||||||
|
WithBridgeHubWestendMessagesInstance,
|
||||||
|
WithBridgeHubWestendMessageBridge,
|
||||||
|
>;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn initialize_bridge_by_governance_works() {
|
fn initialize_bridge_by_governance_works() {
|
||||||
// for RococoBulletin finality
|
// for RococoBulletin finality
|
||||||
@@ -275,15 +286,7 @@ mod bridge_hub_westend_tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn relayed_incoming_message_works() {
|
fn relayed_incoming_message_works() {
|
||||||
// from Westend
|
// from Westend
|
||||||
bridge_hub_test_utils::test_cases::from_parachain::relayed_incoming_message_works::<
|
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
|
||||||
Runtime,
|
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
ParachainSystem,
|
|
||||||
BridgeGrandpaWestendInstance,
|
|
||||||
BridgeParachainWestendInstance,
|
|
||||||
WithBridgeHubWestendMessagesInstance,
|
|
||||||
WithBridgeHubWestendMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||||
@@ -299,16 +302,7 @@ mod bridge_hub_westend_tests {
|
|||||||
#[test]
|
#[test]
|
||||||
pub fn complex_relay_extrinsic_works() {
|
pub fn complex_relay_extrinsic_works() {
|
||||||
// for Westend
|
// for Westend
|
||||||
bridge_hub_test_utils::test_cases::from_parachain::complex_relay_extrinsic_works::<
|
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
|
||||||
Runtime,
|
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
XcmConfig,
|
|
||||||
ParachainSystem,
|
|
||||||
BridgeGrandpaWestendInstance,
|
|
||||||
BridgeParachainWestendInstance,
|
|
||||||
WithBridgeHubWestendMessagesInstance,
|
|
||||||
WithBridgeHubWestendMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||||
@@ -341,16 +335,9 @@ mod bridge_hub_westend_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
|
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
|
||||||
let estimated = bridge_hub_test_utils::test_cases::from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
|
let estimated = from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
|
||||||
Runtime,
|
RuntimeTestsAdapter,
|
||||||
BridgeGrandpaWestendInstance,
|
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
|
||||||
BridgeParachainWestendInstance,
|
|
||||||
WithBridgeHubWestendMessagesInstance,
|
|
||||||
WithBridgeHubWestendMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
|
||||||
construct_and_estimate_extrinsic_fee
|
|
||||||
);
|
|
||||||
|
|
||||||
// check if estimated value is sane
|
// check if estimated value is sane
|
||||||
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseDeliveryFeeInRocs::get();
|
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseDeliveryFeeInRocs::get();
|
||||||
@@ -364,16 +351,10 @@ mod bridge_hub_westend_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
|
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
|
||||||
let estimated = bridge_hub_test_utils::test_cases::from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
|
let estimated =
|
||||||
Runtime,
|
from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
|
||||||
BridgeGrandpaWestendInstance,
|
RuntimeTestsAdapter,
|
||||||
BridgeParachainWestendInstance,
|
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
|
||||||
WithBridgeHubWestendMessagesInstance,
|
|
||||||
WithBridgeHubWestendMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
|
||||||
construct_and_estimate_extrinsic_fee
|
|
||||||
);
|
|
||||||
|
|
||||||
// check if estimated value is sane
|
// check if estimated value is sane
|
||||||
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseConfirmationFeeInRocs::get();
|
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseConfirmationFeeInRocs::get();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
use bp_polkadot_core::Signature;
|
use bp_polkadot_core::Signature;
|
||||||
use bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
|
use bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
|
||||||
|
use bridge_hub_test_utils::test_cases::from_parachain;
|
||||||
use bridge_hub_westend_runtime::{
|
use bridge_hub_westend_runtime::{
|
||||||
bridge_common_config, bridge_to_rococo_config,
|
bridge_common_config, bridge_to_rococo_config,
|
||||||
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
|
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
|
||||||
@@ -43,6 +44,16 @@ use xcm::latest::prelude::*;
|
|||||||
// Para id of sibling chain used in tests.
|
// Para id of sibling chain used in tests.
|
||||||
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
|
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
|
||||||
|
|
||||||
|
// Runtime from tests PoV
|
||||||
|
type RuntimeTestsAdapter = from_parachain::WithRemoteParachainHelperAdapter<
|
||||||
|
Runtime,
|
||||||
|
AllPalletsWithoutSystem,
|
||||||
|
BridgeGrandpaRococoInstance,
|
||||||
|
BridgeParachainRococoInstance,
|
||||||
|
WithBridgeHubRococoMessagesInstance,
|
||||||
|
WithBridgeHubRococoMessageBridge,
|
||||||
|
>;
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||||
}
|
}
|
||||||
@@ -239,15 +250,7 @@ fn message_dispatch_routing_works() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn relayed_incoming_message_works() {
|
fn relayed_incoming_message_works() {
|
||||||
bridge_hub_test_utils::test_cases::from_parachain::relayed_incoming_message_works::<
|
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
|
||||||
Runtime,
|
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
ParachainSystem,
|
|
||||||
BridgeGrandpaRococoInstance,
|
|
||||||
BridgeParachainRococoInstance,
|
|
||||||
WithBridgeHubRococoMessagesInstance,
|
|
||||||
WithBridgeHubRococoMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||||
@@ -262,16 +265,7 @@ fn relayed_incoming_message_works() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn complex_relay_extrinsic_works() {
|
pub fn complex_relay_extrinsic_works() {
|
||||||
bridge_hub_test_utils::test_cases::from_parachain::complex_relay_extrinsic_works::<
|
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
|
||||||
Runtime,
|
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
XcmConfig,
|
|
||||||
ParachainSystem,
|
|
||||||
BridgeGrandpaRococoInstance,
|
|
||||||
BridgeParachainRococoInstance,
|
|
||||||
WithBridgeHubRococoMessagesInstance,
|
|
||||||
WithBridgeHubRococoMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||||
@@ -304,16 +298,9 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
|
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
|
||||||
let estimated = bridge_hub_test_utils::test_cases::from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
|
let estimated = from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
|
||||||
Runtime,
|
RuntimeTestsAdapter,
|
||||||
BridgeGrandpaRococoInstance,
|
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
|
||||||
BridgeParachainRococoInstance,
|
|
||||||
WithBridgeHubRococoMessagesInstance,
|
|
||||||
WithBridgeHubRococoMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
|
||||||
construct_and_estimate_extrinsic_fee
|
|
||||||
);
|
|
||||||
|
|
||||||
// check if estimated value is sane
|
// check if estimated value is sane
|
||||||
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds::get();
|
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds::get();
|
||||||
@@ -327,16 +314,9 @@ pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
|
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
|
||||||
let estimated = bridge_hub_test_utils::test_cases::from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
|
let estimated = from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
|
||||||
Runtime,
|
RuntimeTestsAdapter,
|
||||||
BridgeGrandpaRococoInstance,
|
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
|
||||||
BridgeParachainRococoInstance,
|
|
||||||
WithBridgeHubRococoMessagesInstance,
|
|
||||||
WithBridgeHubRococoMessageBridge,
|
|
||||||
>(
|
|
||||||
collator_session_keys(),
|
|
||||||
construct_and_estimate_extrinsic_fee
|
|
||||||
);
|
|
||||||
|
|
||||||
// check if estimated value is sane
|
// check if estimated value is sane
|
||||||
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds::get();
|
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds::get();
|
||||||
|
|||||||
+3
-3
@@ -49,9 +49,9 @@ use xcm::latest::prelude::*;
|
|||||||
|
|
||||||
/// Helper trait to test bridges with remote GRANDPA chain.
|
/// Helper trait to test bridges with remote GRANDPA chain.
|
||||||
///
|
///
|
||||||
/// This is only used to decrease amount of lines, dedicated to bounds
|
/// This is only used to decrease amount of lines, dedicated to bounds.
|
||||||
pub trait WithRemoteGrandpaChainHelper {
|
pub trait WithRemoteGrandpaChainHelper {
|
||||||
/// This chaiin runtime.
|
/// This chain runtime.
|
||||||
type Runtime: BasicParachainRuntime
|
type Runtime: BasicParachainRuntime
|
||||||
+ cumulus_pallet_xcmp_queue::Config
|
+ cumulus_pallet_xcmp_queue::Config
|
||||||
+ BridgeGrandpaConfig<
|
+ BridgeGrandpaConfig<
|
||||||
@@ -74,7 +74,7 @@ pub trait WithRemoteGrandpaChainHelper {
|
|||||||
type MB: MessageBridge;
|
type MB: MessageBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adapter struct that implements `WithRemoteGrandpaChainHelper`
|
/// Adapter struct that implements [`WithRemoteGrandpaChainHelper`].
|
||||||
pub struct WithRemoteGrandpaChainHelperAdapter<Runtime, AllPalletsWithoutSystem, GPI, MPI, MB>(
|
pub struct WithRemoteGrandpaChainHelperAdapter<Runtime, AllPalletsWithoutSystem, GPI, MPI, MB>(
|
||||||
sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI, MB)>,
|
sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI, MB)>,
|
||||||
);
|
);
|
||||||
|
|||||||
+227
-214
@@ -22,43 +22,102 @@ use crate::{
|
|||||||
test_data,
|
test_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use bp_header_chain::ChainWithGrandpa;
|
||||||
use bp_messages::{
|
use bp_messages::{
|
||||||
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
|
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
|
||||||
UnrewardedRelayersState,
|
UnrewardedRelayersState,
|
||||||
};
|
};
|
||||||
use bp_polkadot_core::parachains::ParaHash;
|
use bp_polkadot_core::parachains::ParaHash;
|
||||||
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
|
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
|
||||||
use bp_runtime::{Parachain, UnderlyingChainOf};
|
use bp_runtime::{HashOf, Parachain, UnderlyingChainOf};
|
||||||
use bridge_runtime_common::{
|
use bridge_runtime_common::{
|
||||||
messages::{
|
messages::{
|
||||||
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
|
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
|
||||||
BridgedChain as MessageBridgedChain, MessageBridge,
|
BridgedChain as MessageBridgedChain, MessageBridge, ThisChain as MessageThisChain,
|
||||||
},
|
},
|
||||||
messages_xcm_extension::XcmAsPlainPayload,
|
messages_xcm_extension::XcmAsPlainPayload,
|
||||||
};
|
};
|
||||||
use frame_support::traits::{Get, OnFinalize, OnInitialize, OriginTrait};
|
use frame_support::traits::{Get, OnFinalize, OnInitialize};
|
||||||
use frame_system::pallet_prelude::BlockNumberFor;
|
use frame_system::pallet_prelude::BlockNumberFor;
|
||||||
use pallet_bridge_parachains::{RelayBlockHash, RelayBlockNumber};
|
use pallet_bridge_grandpa::{Call as BridgeGrandpaCall, Config as BridgeGrandpaConfig};
|
||||||
|
use pallet_bridge_messages::{Call as BridgeMessagesCall, Config as BridgeMessagesConfig};
|
||||||
|
use pallet_bridge_parachains::{
|
||||||
|
Call as BridgeParachainsCall, Config as BridgeParachainsConfig, RelayBlockHash,
|
||||||
|
RelayBlockNumber,
|
||||||
|
};
|
||||||
use parachains_runtimes_test_utils::{
|
use parachains_runtimes_test_utils::{
|
||||||
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, ValidatorIdOf,
|
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf,
|
||||||
};
|
};
|
||||||
use sp_keyring::AccountKeyring::*;
|
use sp_keyring::AccountKeyring::*;
|
||||||
use sp_runtime::{traits::Header as HeaderT, AccountId32};
|
use sp_runtime::{traits::Header as HeaderT, AccountId32};
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
|
|
||||||
|
/// Helper trait to test bridges with remote parachain.
|
||||||
|
///
|
||||||
|
/// This is only used to decrease amount of lines, dedicated to bounds.
|
||||||
|
pub trait WithRemoteParachainHelper {
|
||||||
|
/// This chain runtime.
|
||||||
|
type Runtime: BasicParachainRuntime
|
||||||
|
+ cumulus_pallet_xcmp_queue::Config
|
||||||
|
+ BridgeGrandpaConfig<Self::GPI>
|
||||||
|
+ BridgeParachainsConfig<Self::PPI>
|
||||||
|
+ BridgeMessagesConfig<
|
||||||
|
Self::MPI,
|
||||||
|
InboundPayload = XcmAsPlainPayload,
|
||||||
|
InboundRelayer = bp_runtime::AccountIdOf<MessageBridgedChain<Self::MB>>,
|
||||||
|
OutboundPayload = XcmAsPlainPayload,
|
||||||
|
> + pallet_bridge_relayers::Config;
|
||||||
|
/// All pallets of this chain, excluding system pallet.
|
||||||
|
type AllPalletsWithoutSystem: OnInitialize<BlockNumberFor<Self::Runtime>>
|
||||||
|
+ OnFinalize<BlockNumberFor<Self::Runtime>>;
|
||||||
|
/// Instance of the `pallet-bridge-grandpa`, used to bridge with remote relay chain.
|
||||||
|
type GPI: 'static;
|
||||||
|
/// Instance of the `pallet-bridge-parachains`, used to bridge with remote parachain.
|
||||||
|
type PPI: 'static;
|
||||||
|
/// Instance of the `pallet-bridge-messages`, used to bridge with remote parachain.
|
||||||
|
type MPI: 'static;
|
||||||
|
/// Messages bridge definition.
|
||||||
|
type MB: MessageBridge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Adapter struct that implements `WithRemoteParachainHelper`.
|
||||||
|
pub struct WithRemoteParachainHelperAdapter<Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI, MB>(
|
||||||
|
sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI, MB)>,
|
||||||
|
);
|
||||||
|
|
||||||
|
impl<Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI, MB> WithRemoteParachainHelper
|
||||||
|
for WithRemoteParachainHelperAdapter<Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI, MB>
|
||||||
|
where
|
||||||
|
Runtime: BasicParachainRuntime
|
||||||
|
+ cumulus_pallet_xcmp_queue::Config
|
||||||
|
+ BridgeGrandpaConfig<GPI>
|
||||||
|
+ BridgeParachainsConfig<PPI>
|
||||||
|
+ BridgeMessagesConfig<
|
||||||
|
MPI,
|
||||||
|
InboundPayload = XcmAsPlainPayload,
|
||||||
|
InboundRelayer = bp_runtime::AccountIdOf<MessageBridgedChain<MB>>,
|
||||||
|
OutboundPayload = XcmAsPlainPayload,
|
||||||
|
> + pallet_bridge_relayers::Config,
|
||||||
|
AllPalletsWithoutSystem:
|
||||||
|
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
|
||||||
|
GPI: 'static,
|
||||||
|
PPI: 'static,
|
||||||
|
MPI: 'static,
|
||||||
|
MB: MessageBridge,
|
||||||
|
{
|
||||||
|
type Runtime = Runtime;
|
||||||
|
type AllPalletsWithoutSystem = AllPalletsWithoutSystem;
|
||||||
|
type GPI = GPI;
|
||||||
|
type PPI = PPI;
|
||||||
|
type MPI = MPI;
|
||||||
|
type MB = MB;
|
||||||
|
}
|
||||||
|
|
||||||
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
|
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
|
||||||
/// with proofs (finality, para heads, message) independently submitted.
|
/// with proofs (finality, para heads, message) independently submitted.
|
||||||
/// Also verifies relayer transaction signed extensions work as intended.
|
/// Also verifies relayer transaction signed extensions work as intended.
|
||||||
pub fn relayed_incoming_message_works<
|
pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||||
Runtime,
|
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
HrmpChannelOpener,
|
|
||||||
GPI,
|
|
||||||
PPI,
|
|
||||||
MPI,
|
|
||||||
MB,
|
|
||||||
>(
|
|
||||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
|
||||||
runtime_para_id: u32,
|
runtime_para_id: u32,
|
||||||
bridged_para_id: u32,
|
bridged_para_id: u32,
|
||||||
bridged_chain_id: bp_runtime::ChainId,
|
bridged_chain_id: bp_runtime::ChainId,
|
||||||
@@ -68,46 +127,30 @@ pub fn relayed_incoming_message_works<
|
|||||||
prepare_configuration: impl Fn(),
|
prepare_configuration: impl Fn(),
|
||||||
construct_and_apply_extrinsic: fn(
|
construct_and_apply_extrinsic: fn(
|
||||||
sp_keyring::AccountKeyring,
|
sp_keyring::AccountKeyring,
|
||||||
<Runtime as frame_system::Config>::RuntimeCall,
|
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
|
||||||
) -> sp_runtime::DispatchOutcome,
|
) -> sp_runtime::DispatchOutcome,
|
||||||
) where
|
) where
|
||||||
Runtime: BasicParachainRuntime
|
RuntimeHelper: WithRemoteParachainHelper,
|
||||||
+ cumulus_pallet_xcmp_queue::Config
|
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
|
||||||
+ cumulus_pallet_parachain_system::Config
|
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
|
||||||
+ pallet_bridge_grandpa::Config<GPI>
|
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
|
||||||
+ pallet_bridge_parachains::Config<PPI>
|
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
|
||||||
+ pallet_bridge_messages::Config<MPI>
|
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
|
||||||
+ pallet_bridge_relayers::Config,
|
bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
AllPalletsWithoutSystem:
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
|
||||||
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
GPI: 'static,
|
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
|
||||||
PPI: 'static,
|
SourceHeaderChain<
|
||||||
MPI: 'static,
|
MessagesProof = FromBridgedChainMessagesProof<
|
||||||
MB: MessageBridge,
|
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
|
||||||
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
|
||||||
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
|
||||||
>,
|
>,
|
||||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain:
|
|
||||||
SourceHeaderChain<MessagesProof = FromBridgedChainMessagesProof<ParaHash>>,
|
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain:
|
|
||||||
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber>,
|
|
||||||
ParaHash: From<
|
|
||||||
<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash,
|
|
||||||
>,
|
>,
|
||||||
<Runtime as frame_system::Config>::AccountId:
|
|
||||||
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
|
|
||||||
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
|
|
||||||
<Runtime as frame_system::Config>::RuntimeCall: From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
|
||||||
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
|
||||||
{
|
{
|
||||||
helpers::relayed_incoming_message_works::<Runtime, AllPalletsWithoutSystem, MPI>(
|
helpers::relayed_incoming_message_works::<
|
||||||
|
RuntimeHelper::Runtime,
|
||||||
|
RuntimeHelper::AllPalletsWithoutSystem,
|
||||||
|
RuntimeHelper::MPI,
|
||||||
|
>(
|
||||||
collator_session_key,
|
collator_session_key,
|
||||||
runtime_para_id,
|
runtime_para_id,
|
||||||
sibling_parachain_id,
|
sibling_parachain_id,
|
||||||
@@ -124,8 +167,8 @@ pub fn relayed_incoming_message_works<
|
|||||||
prepare_configuration();
|
prepare_configuration();
|
||||||
|
|
||||||
// start with bridged relay chain block#0
|
// start with bridged relay chain block#0
|
||||||
helpers::initialize_bridge_grandpa_pallet::<Runtime, GPI>(
|
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
|
||||||
test_data::initialization_data::<Runtime, GPI>(0),
|
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(0),
|
||||||
);
|
);
|
||||||
|
|
||||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||||
@@ -138,8 +181,8 @@ pub fn relayed_incoming_message_works<
|
|||||||
para_heads_proof,
|
para_heads_proof,
|
||||||
message_proof,
|
message_proof,
|
||||||
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
|
||||||
MB,
|
RuntimeHelper::MB,
|
||||||
(),
|
(),
|
||||||
>(
|
>(
|
||||||
lane_id,
|
lane_id,
|
||||||
@@ -156,30 +199,38 @@ pub fn relayed_incoming_message_works<
|
|||||||
let relay_chain_header_number = *relay_chain_header.number();
|
let relay_chain_header_number = *relay_chain_header.number();
|
||||||
vec![
|
vec![
|
||||||
(
|
(
|
||||||
pallet_bridge_grandpa::Call::<Runtime, GPI>::submit_finality_proof {
|
BridgeGrandpaCall::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::submit_finality_proof {
|
||||||
finality_target: Box::new(relay_chain_header),
|
finality_target: Box::new(relay_chain_header),
|
||||||
justification: grandpa_justification,
|
justification: grandpa_justification,
|
||||||
}.into(),
|
}.into(),
|
||||||
helpers::VerifySubmitGrandpaFinalityProofOutcome::<Runtime, GPI>::expect_best_header_hash(relay_chain_header_hash),
|
helpers::VerifySubmitGrandpaFinalityProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::expect_best_header_hash(
|
||||||
|
relay_chain_header_hash,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
pallet_bridge_parachains::Call::<Runtime, PPI>::submit_parachain_heads {
|
BridgeParachainsCall::<RuntimeHelper::Runtime, RuntimeHelper::PPI>::submit_parachain_heads {
|
||||||
at_relay_block: (relay_chain_header_number, relay_chain_header_hash),
|
at_relay_block: (relay_chain_header_number, relay_chain_header_hash),
|
||||||
parachains: parachain_heads,
|
parachains: parachain_heads,
|
||||||
parachain_heads_proof: para_heads_proof,
|
parachain_heads_proof: para_heads_proof,
|
||||||
}.into(),
|
}.into(),
|
||||||
helpers::VerifySubmitParachainHeaderProofOutcome::<Runtime, PPI>::expect_best_header_hash(bridged_para_id, parachain_head_hash),
|
helpers::VerifySubmitParachainHeaderProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::PPI>::expect_best_header_hash(
|
||||||
|
bridged_para_id,
|
||||||
|
parachain_head_hash,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_proof {
|
BridgeMessagesCall::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::receive_messages_proof {
|
||||||
relayer_id_at_bridged_chain,
|
relayer_id_at_bridged_chain,
|
||||||
proof: message_proof,
|
proof: message_proof,
|
||||||
messages_count: 1,
|
messages_count: 1,
|
||||||
dispatch_weight: Weight::from_parts(1000000000, 0),
|
dispatch_weight: Weight::from_parts(1000000000, 0),
|
||||||
}.into(),
|
}.into(),
|
||||||
Box::new((
|
Box::new((
|
||||||
helpers::VerifySubmitMessagesProofOutcome::<Runtime, MPI>::expect_last_delivered_nonce(lane_id, 1),
|
helpers::VerifySubmitMessagesProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::expect_last_delivered_nonce(
|
||||||
helpers::VerifyRelayerRewarded::<Runtime>::expect_relayer_reward(
|
lane_id,
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
helpers::VerifyRelayerRewarded::<RuntimeHelper::Runtime>::expect_relayer_reward(
|
||||||
relayer_id_at_this_chain,
|
relayer_id_at_this_chain,
|
||||||
RewardsAccountParams::new(
|
RewardsAccountParams::new(
|
||||||
lane_id,
|
lane_id,
|
||||||
@@ -197,17 +248,8 @@ pub fn relayed_incoming_message_works<
|
|||||||
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
|
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
|
||||||
/// with proofs (finality, para heads, message) batched together in signed extrinsic.
|
/// with proofs (finality, para heads, message) batched together in signed extrinsic.
|
||||||
/// Also verifies relayer transaction signed extensions work as intended.
|
/// Also verifies relayer transaction signed extensions work as intended.
|
||||||
pub fn complex_relay_extrinsic_works<
|
pub fn complex_relay_extrinsic_works<RuntimeHelper>(
|
||||||
Runtime,
|
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||||
AllPalletsWithoutSystem,
|
|
||||||
XcmConfig,
|
|
||||||
HrmpChannelOpener,
|
|
||||||
GPI,
|
|
||||||
PPI,
|
|
||||||
MPI,
|
|
||||||
MB,
|
|
||||||
>(
|
|
||||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
|
||||||
runtime_para_id: u32,
|
runtime_para_id: u32,
|
||||||
bridged_para_id: u32,
|
bridged_para_id: u32,
|
||||||
sibling_parachain_id: u32,
|
sibling_parachain_id: u32,
|
||||||
@@ -217,48 +259,33 @@ pub fn complex_relay_extrinsic_works<
|
|||||||
prepare_configuration: impl Fn(),
|
prepare_configuration: impl Fn(),
|
||||||
construct_and_apply_extrinsic: fn(
|
construct_and_apply_extrinsic: fn(
|
||||||
sp_keyring::AccountKeyring,
|
sp_keyring::AccountKeyring,
|
||||||
<Runtime as frame_system::Config>::RuntimeCall,
|
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
|
||||||
) -> sp_runtime::DispatchOutcome,
|
) -> sp_runtime::DispatchOutcome,
|
||||||
) where
|
) where
|
||||||
Runtime: BasicParachainRuntime
|
RuntimeHelper: WithRemoteParachainHelper,
|
||||||
+ cumulus_pallet_xcmp_queue::Config
|
RuntimeHelper::Runtime:
|
||||||
+ cumulus_pallet_parachain_system::Config
|
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
|
||||||
+ pallet_bridge_grandpa::Config<GPI>
|
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
|
||||||
+ pallet_bridge_parachains::Config<PPI>
|
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
|
||||||
+ pallet_bridge_messages::Config<MPI>
|
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
|
||||||
+ pallet_bridge_relayers::Config
|
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>
|
||||||
+ pallet_utility::Config,
|
+ From<pallet_utility::Call<RuntimeHelper::Runtime>>,
|
||||||
AllPalletsWithoutSystem:
|
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
|
||||||
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
|
bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
GPI: 'static,
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
|
||||||
PPI: 'static,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
MPI: 'static,
|
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
|
||||||
MB: MessageBridge,
|
SourceHeaderChain<
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
MessagesProof = FromBridgedChainMessagesProof<
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
|
||||||
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
|
||||||
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
|
||||||
>,
|
>,
|
||||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain:
|
|
||||||
SourceHeaderChain<MessagesProof = FromBridgedChainMessagesProof<ParaHash>>,
|
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain:
|
|
||||||
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber>,
|
|
||||||
ParaHash: From<
|
|
||||||
<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash,
|
|
||||||
>,
|
>,
|
||||||
<Runtime as frame_system::Config>::AccountId:
|
|
||||||
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
|
|
||||||
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
|
|
||||||
<Runtime as pallet_utility::Config>::RuntimeCall: From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
|
||||||
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
|
||||||
<Runtime as frame_system::Config>::RuntimeCall: From<pallet_utility::Call<Runtime>>,
|
|
||||||
{
|
{
|
||||||
helpers::relayed_incoming_message_works::<Runtime, AllPalletsWithoutSystem, MPI>(
|
helpers::relayed_incoming_message_works::<
|
||||||
|
RuntimeHelper::Runtime,
|
||||||
|
RuntimeHelper::AllPalletsWithoutSystem,
|
||||||
|
RuntimeHelper::MPI,
|
||||||
|
>(
|
||||||
collator_session_key,
|
collator_session_key,
|
||||||
runtime_para_id,
|
runtime_para_id,
|
||||||
sibling_parachain_id,
|
sibling_parachain_id,
|
||||||
@@ -275,8 +302,8 @@ pub fn complex_relay_extrinsic_works<
|
|||||||
prepare_configuration();
|
prepare_configuration();
|
||||||
|
|
||||||
// start with bridged relay chain block#0
|
// start with bridged relay chain block#0
|
||||||
helpers::initialize_bridge_grandpa_pallet::<Runtime, GPI>(
|
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
|
||||||
test_data::initialization_data::<Runtime, GPI>(0),
|
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(0),
|
||||||
);
|
);
|
||||||
|
|
||||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||||
@@ -289,8 +316,8 @@ pub fn complex_relay_extrinsic_works<
|
|||||||
para_heads_proof,
|
para_heads_proof,
|
||||||
message_proof,
|
message_proof,
|
||||||
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
|
||||||
MB,
|
RuntimeHelper::MB,
|
||||||
(),
|
(),
|
||||||
>(
|
>(
|
||||||
lane_id,
|
lane_id,
|
||||||
@@ -306,30 +333,40 @@ pub fn complex_relay_extrinsic_works<
|
|||||||
let relay_chain_header_hash = relay_chain_header.hash();
|
let relay_chain_header_hash = relay_chain_header.hash();
|
||||||
let relay_chain_header_number = *relay_chain_header.number();
|
let relay_chain_header_number = *relay_chain_header.number();
|
||||||
vec![(
|
vec![(
|
||||||
pallet_utility::Call::<Runtime>::batch_all {
|
pallet_utility::Call::<RuntimeHelper::Runtime>::batch_all {
|
||||||
calls: vec![
|
calls: vec![
|
||||||
pallet_bridge_grandpa::Call::<Runtime, GPI>::submit_finality_proof {
|
BridgeGrandpaCall::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::submit_finality_proof {
|
||||||
finality_target: Box::new(relay_chain_header),
|
finality_target: Box::new(relay_chain_header),
|
||||||
justification: grandpa_justification,
|
justification: grandpa_justification,
|
||||||
}.into(),
|
}.into(),
|
||||||
pallet_bridge_parachains::Call::<Runtime, PPI>::submit_parachain_heads {
|
BridgeParachainsCall::<RuntimeHelper::Runtime, RuntimeHelper::PPI>::submit_parachain_heads {
|
||||||
at_relay_block: (relay_chain_header_number, relay_chain_header_hash),
|
at_relay_block: (relay_chain_header_number, relay_chain_header_hash),
|
||||||
parachains: parachain_heads,
|
parachains: parachain_heads,
|
||||||
parachain_heads_proof: para_heads_proof,
|
parachain_heads_proof: para_heads_proof,
|
||||||
}.into(),
|
}.into(),
|
||||||
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_proof {
|
BridgeMessagesCall::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::receive_messages_proof {
|
||||||
relayer_id_at_bridged_chain,
|
relayer_id_at_bridged_chain,
|
||||||
proof: message_proof,
|
proof: message_proof,
|
||||||
messages_count: 1,
|
messages_count: 1,
|
||||||
dispatch_weight: Weight::from_parts(1000000000, 0),
|
dispatch_weight: Weight::from_parts(1000000000, 0),
|
||||||
}.into(),
|
}.into(),
|
||||||
],
|
],
|
||||||
}.into(),
|
}
|
||||||
|
.into(),
|
||||||
Box::new((
|
Box::new((
|
||||||
helpers::VerifySubmitGrandpaFinalityProofOutcome::<Runtime, GPI>::expect_best_header_hash(relay_chain_header_hash),
|
helpers::VerifySubmitGrandpaFinalityProofOutcome::<
|
||||||
helpers::VerifySubmitParachainHeaderProofOutcome::<Runtime, PPI>::expect_best_header_hash(bridged_para_id, parachain_head_hash),
|
RuntimeHelper::Runtime,
|
||||||
helpers::VerifySubmitMessagesProofOutcome::<Runtime, MPI>::expect_last_delivered_nonce(lane_id, 1),
|
RuntimeHelper::GPI,
|
||||||
helpers::VerifyRelayerRewarded::<Runtime>::expect_relayer_reward(
|
>::expect_best_header_hash(relay_chain_header_hash),
|
||||||
|
helpers::VerifySubmitParachainHeaderProofOutcome::<
|
||||||
|
RuntimeHelper::Runtime,
|
||||||
|
RuntimeHelper::PPI,
|
||||||
|
>::expect_best_header_hash(bridged_para_id, parachain_head_hash),
|
||||||
|
helpers::VerifySubmitMessagesProofOutcome::<
|
||||||
|
RuntimeHelper::Runtime,
|
||||||
|
RuntimeHelper::MPI,
|
||||||
|
>::expect_last_delivered_nonce(lane_id, 1),
|
||||||
|
helpers::VerifyRelayerRewarded::<RuntimeHelper::Runtime>::expect_relayer_reward(
|
||||||
relayer_id_at_this_chain,
|
relayer_id_at_this_chain,
|
||||||
RewardsAccountParams::new(
|
RewardsAccountParams::new(
|
||||||
lane_id,
|
lane_id,
|
||||||
@@ -345,45 +382,29 @@ pub fn complex_relay_extrinsic_works<
|
|||||||
|
|
||||||
/// Estimates transaction fee for default message delivery transaction (batched with required
|
/// Estimates transaction fee for default message delivery transaction (batched with required
|
||||||
/// proofs) from bridged parachain.
|
/// proofs) from bridged parachain.
|
||||||
pub fn can_calculate_fee_for_complex_message_delivery_transaction<Runtime, GPI, PPI, MPI, MB>(
|
pub fn can_calculate_fee_for_complex_message_delivery_transaction<RuntimeHelper>(
|
||||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||||
compute_extrinsic_fee: fn(pallet_utility::Call::<Runtime>) -> u128,
|
compute_extrinsic_fee: fn(pallet_utility::Call<RuntimeHelper::Runtime>) -> u128,
|
||||||
) -> u128
|
) -> u128
|
||||||
where
|
where
|
||||||
Runtime: frame_system::Config
|
RuntimeHelper: WithRemoteParachainHelper,
|
||||||
+ pallet_balances::Config
|
RuntimeHelper::Runtime:
|
||||||
+ pallet_session::Config
|
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
|
||||||
+ pallet_xcm::Config
|
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
|
||||||
+ parachain_info::Config
|
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
|
||||||
+ pallet_collator_selection::Config
|
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
|
||||||
+ cumulus_pallet_parachain_system::Config
|
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
|
||||||
+ pallet_bridge_grandpa::Config<GPI>
|
bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
+ pallet_bridge_parachains::Config<PPI>
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
|
||||||
+ pallet_bridge_messages::Config<MPI, InboundPayload = XcmAsPlainPayload>
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
+ pallet_utility::Config,
|
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
|
||||||
GPI: 'static,
|
SourceHeaderChain<
|
||||||
PPI: 'static,
|
MessagesProof = FromBridgedChainMessagesProof<
|
||||||
MPI: 'static,
|
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
|
||||||
MB: MessageBridge,
|
>,
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
>,
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
|
||||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
|
||||||
<<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
|
|
||||||
From<FromBridgedChainMessagesProof<ParaHash>>,
|
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain: bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber>,
|
|
||||||
ParaHash: From<<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId:
|
|
||||||
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
|
|
||||||
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
|
|
||||||
<Runtime as pallet_utility::Config>::RuntimeCall:
|
|
||||||
From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
|
||||||
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
|
||||||
{
|
{
|
||||||
run_test::<Runtime, _>(collator_session_key, 1000, vec![], || {
|
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
|
||||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||||
// to be submitted by relayer to this chain.
|
// to be submitted by relayer to this chain.
|
||||||
//
|
//
|
||||||
@@ -398,8 +419,8 @@ where
|
|||||||
para_heads_proof,
|
para_heads_proof,
|
||||||
message_proof,
|
message_proof,
|
||||||
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
|
<RuntimeHelper::Runtime as pallet_bridge_grandpa::Config<RuntimeHelper::GPI>>::BridgedChain,
|
||||||
MB,
|
RuntimeHelper::MB,
|
||||||
(),
|
(),
|
||||||
>(
|
>(
|
||||||
LaneId::default(),
|
LaneId::default(),
|
||||||
@@ -414,17 +435,18 @@ where
|
|||||||
// generate batch call that provides finality for bridged relay and parachains + message
|
// generate batch call that provides finality for bridged relay and parachains + message
|
||||||
// proof
|
// proof
|
||||||
let batch = test_data::from_parachain::make_complex_relayer_delivery_batch::<
|
let batch = test_data::from_parachain::make_complex_relayer_delivery_batch::<
|
||||||
Runtime,
|
RuntimeHelper::Runtime,
|
||||||
GPI,
|
RuntimeHelper::GPI,
|
||||||
PPI,
|
RuntimeHelper::PPI,
|
||||||
MPI,
|
RuntimeHelper::MPI,
|
||||||
|
_,
|
||||||
>(
|
>(
|
||||||
relay_chain_header,
|
relay_chain_header,
|
||||||
grandpa_justification,
|
grandpa_justification,
|
||||||
parachain_heads,
|
parachain_heads,
|
||||||
para_heads_proof,
|
para_heads_proof,
|
||||||
message_proof,
|
message_proof,
|
||||||
Dave.public().into(),
|
helpers::relayer_id_at_bridged_chain::<RuntimeHelper::Runtime, RuntimeHelper::MPI>(),
|
||||||
);
|
);
|
||||||
let estimated_fee = compute_extrinsic_fee(batch);
|
let estimated_fee = compute_extrinsic_fee(batch);
|
||||||
|
|
||||||
@@ -432,7 +454,7 @@ where
|
|||||||
target: "bridges::estimate",
|
target: "bridges::estimate",
|
||||||
"Estimate fee: {:?} for single message delivery for runtime: {:?}",
|
"Estimate fee: {:?} for single message delivery for runtime: {:?}",
|
||||||
estimated_fee,
|
estimated_fee,
|
||||||
Runtime::Version::get(),
|
<RuntimeHelper::Runtime as frame_system::Config>::Version::get(),
|
||||||
);
|
);
|
||||||
|
|
||||||
estimated_fee
|
estimated_fee
|
||||||
@@ -441,50 +463,34 @@ where
|
|||||||
|
|
||||||
/// Estimates transaction fee for default message confirmation transaction (batched with required
|
/// Estimates transaction fee for default message confirmation transaction (batched with required
|
||||||
/// proofs) from bridged parachain.
|
/// proofs) from bridged parachain.
|
||||||
pub fn can_calculate_fee_for_complex_message_confirmation_transaction<Runtime, GPI, PPI, MPI, MB>(
|
pub fn can_calculate_fee_for_complex_message_confirmation_transaction<RuntimeHelper>(
|
||||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||||
compute_extrinsic_fee: fn(pallet_utility::Call::<Runtime>) -> u128,
|
compute_extrinsic_fee: fn(pallet_utility::Call<RuntimeHelper::Runtime>) -> u128,
|
||||||
) -> u128
|
) -> u128
|
||||||
where
|
where
|
||||||
Runtime: frame_system::Config
|
RuntimeHelper: WithRemoteParachainHelper,
|
||||||
+ pallet_balances::Config
|
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
|
||||||
+ pallet_session::Config
|
RuntimeHelper::Runtime:
|
||||||
+ pallet_xcm::Config
|
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
|
||||||
+ parachain_info::Config
|
MessageThisChain<RuntimeHelper::MB>:
|
||||||
+ pallet_collator_selection::Config
|
bp_runtime::Chain<AccountId = AccountIdOf<RuntimeHelper::Runtime>>,
|
||||||
+ cumulus_pallet_parachain_system::Config
|
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
|
||||||
+ pallet_bridge_grandpa::Config<GPI>
|
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
|
||||||
+ pallet_bridge_parachains::Config<PPI>
|
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
|
||||||
+ pallet_bridge_messages::Config<MPI, OutboundPayload = XcmAsPlainPayload>
|
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
|
||||||
+ pallet_utility::Config,
|
bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
GPI: 'static,
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
|
||||||
PPI: 'static,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
MPI: 'static,
|
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::TargetHeaderChain:
|
||||||
MB: MessageBridge,
|
TargetHeaderChain<
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
|
||||||
<<MB as MessageBridge>::ThisChain as bp_runtime::Chain>::AccountId: From<AccountId32>,
|
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
|
||||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
|
||||||
<<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
|
|
||||||
From<FromBridgedChainMessagesProof<ParaHash>>,
|
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain: bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber>,
|
|
||||||
ParaHash: From<<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId:
|
|
||||||
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
|
|
||||||
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
|
|
||||||
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
|
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
|
|
||||||
<<Runtime as pallet_bridge_messages::Config<MPI>>::TargetHeaderChain as TargetHeaderChain<
|
|
||||||
XcmAsPlainPayload,
|
XcmAsPlainPayload,
|
||||||
Runtime::AccountId,
|
AccountIdOf<RuntimeHelper::Runtime>,
|
||||||
>>::MessagesDeliveryProof: From<FromBridgedChainMessagesDeliveryProof<ParaHash>>,
|
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<
|
||||||
<Runtime as pallet_utility::Config>::RuntimeCall:
|
HashOf<UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>>,
|
||||||
From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
>,
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
>,
|
||||||
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
|
||||||
{
|
{
|
||||||
run_test::<Runtime, _>(collator_session_key, 1000, vec![], || {
|
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
|
||||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||||
// to be submitted by relayer to this chain.
|
// to be submitted by relayer to this chain.
|
||||||
let unrewarded_relayers = UnrewardedRelayersState {
|
let unrewarded_relayers = UnrewardedRelayersState {
|
||||||
@@ -500,18 +506,25 @@ where
|
|||||||
para_heads_proof,
|
para_heads_proof,
|
||||||
message_delivery_proof,
|
message_delivery_proof,
|
||||||
) = test_data::from_parachain::make_complex_relayer_confirmation_proofs::<
|
) = test_data::from_parachain::make_complex_relayer_confirmation_proofs::<
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
|
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
|
||||||
MB,
|
RuntimeHelper::MB,
|
||||||
(),
|
(),
|
||||||
>(LaneId::default(), 1, 5, 1_000, Alice.public().into(), unrewarded_relayers.clone());
|
>(
|
||||||
|
LaneId::default(),
|
||||||
|
1,
|
||||||
|
5,
|
||||||
|
1_000,
|
||||||
|
AccountId32::from(Alice.public()).into(),
|
||||||
|
unrewarded_relayers.clone(),
|
||||||
|
);
|
||||||
|
|
||||||
// generate batch call that provides finality for bridged relay and parachains + message
|
// generate batch call that provides finality for bridged relay and parachains + message
|
||||||
// proof
|
// proof
|
||||||
let batch = test_data::from_parachain::make_complex_relayer_confirmation_batch::<
|
let batch = test_data::from_parachain::make_complex_relayer_confirmation_batch::<
|
||||||
Runtime,
|
RuntimeHelper::Runtime,
|
||||||
GPI,
|
RuntimeHelper::GPI,
|
||||||
PPI,
|
RuntimeHelper::PPI,
|
||||||
MPI,
|
RuntimeHelper::MPI,
|
||||||
>(
|
>(
|
||||||
relay_chain_header,
|
relay_chain_header,
|
||||||
grandpa_justification,
|
grandpa_justification,
|
||||||
@@ -526,7 +539,7 @@ where
|
|||||||
target: "bridges::estimate",
|
target: "bridges::estimate",
|
||||||
"Estimate fee: {:?} for single message confirmation for runtime: {:?}",
|
"Estimate fee: {:?} for single message confirmation for runtime: {:?}",
|
||||||
estimated_fee,
|
estimated_fee,
|
||||||
Runtime::Version::get(),
|
<RuntimeHelper::Runtime as frame_system::Config>::Version::get(),
|
||||||
);
|
);
|
||||||
|
|
||||||
estimated_fee
|
estimated_fee
|
||||||
|
|||||||
+17
-16
@@ -22,12 +22,14 @@ use bp_messages::{
|
|||||||
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
|
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
|
||||||
UnrewardedRelayersState, Weight,
|
UnrewardedRelayersState, Weight,
|
||||||
};
|
};
|
||||||
use bp_runtime::{BlockNumberOf, HeaderOf, Parachain, StorageProofSize, UnderlyingChainOf};
|
use bp_runtime::{
|
||||||
|
AccountIdOf, BlockNumberOf, HeaderOf, Parachain, StorageProofSize, UnderlyingChainOf,
|
||||||
|
};
|
||||||
use bp_test_utils::prepare_parachain_heads_proof;
|
use bp_test_utils::prepare_parachain_heads_proof;
|
||||||
use bridge_runtime_common::{
|
use bridge_runtime_common::{
|
||||||
messages::{
|
messages::{
|
||||||
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
|
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
|
||||||
BridgedChain as MessageBridgedChain, MessageBridge,
|
BridgedChain as MessageBridgedChain, MessageBridge, ThisChain as MessageThisChain,
|
||||||
},
|
},
|
||||||
messages_generation::{
|
messages_generation::{
|
||||||
encode_all_messages, encode_lane_data, prepare_message_delivery_storage_proof,
|
encode_all_messages, encode_lane_data, prepare_message_delivery_storage_proof,
|
||||||
@@ -38,7 +40,7 @@ use bridge_runtime_common::{
|
|||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use pallet_bridge_grandpa::BridgedHeader;
|
use pallet_bridge_grandpa::BridgedHeader;
|
||||||
use pallet_bridge_parachains::{RelayBlockHash, RelayBlockNumber};
|
use pallet_bridge_parachains::{RelayBlockHash, RelayBlockNumber};
|
||||||
use sp_runtime::{traits::Header as HeaderT, AccountId32};
|
use sp_runtime::traits::Header as HeaderT;
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
|
|
||||||
use bp_header_chain::{justification::GrandpaJustification, ChainWithGrandpa};
|
use bp_header_chain::{justification::GrandpaJustification, ChainWithGrandpa};
|
||||||
@@ -47,17 +49,21 @@ use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
|
|||||||
use sp_runtime::SaturatedConversion;
|
use sp_runtime::SaturatedConversion;
|
||||||
|
|
||||||
/// Prepare a batch call with relay finality proof, parachain head proof and message proof.
|
/// Prepare a batch call with relay finality proof, parachain head proof and message proof.
|
||||||
pub fn make_complex_relayer_delivery_batch<Runtime, GPI, PPI, MPI>(
|
pub fn make_complex_relayer_delivery_batch<Runtime, GPI, PPI, MPI, InboundRelayer>(
|
||||||
relay_chain_header: BridgedHeader<Runtime, GPI>,
|
relay_chain_header: BridgedHeader<Runtime, GPI>,
|
||||||
grandpa_justification: GrandpaJustification<BridgedHeader<Runtime, GPI>>,
|
grandpa_justification: GrandpaJustification<BridgedHeader<Runtime, GPI>>,
|
||||||
parachain_heads: Vec<(ParaId, ParaHash)>,
|
parachain_heads: Vec<(ParaId, ParaHash)>,
|
||||||
para_heads_proof: ParaHeadsProof,
|
para_heads_proof: ParaHeadsProof,
|
||||||
message_proof: FromBridgedChainMessagesProof<ParaHash>,
|
message_proof: FromBridgedChainMessagesProof<ParaHash>,
|
||||||
relayer_id_at_bridged_chain: AccountId32,
|
relayer_id_at_bridged_chain: InboundRelayer,
|
||||||
) -> pallet_utility::Call<Runtime> where
|
) -> pallet_utility::Call<Runtime> where
|
||||||
Runtime:pallet_bridge_grandpa::Config<GPI>
|
Runtime:pallet_bridge_grandpa::Config<GPI>
|
||||||
+ pallet_bridge_parachains::Config<PPI>
|
+ pallet_bridge_parachains::Config<PPI>
|
||||||
+ pallet_bridge_messages::Config<MPI, InboundPayload = XcmAsPlainPayload>
|
+ pallet_bridge_messages::Config<
|
||||||
|
MPI,
|
||||||
|
InboundPayload = XcmAsPlainPayload,
|
||||||
|
InboundRelayer = InboundRelayer,
|
||||||
|
>
|
||||||
+ pallet_utility::Config,
|
+ pallet_utility::Config,
|
||||||
GPI: 'static,
|
GPI: 'static,
|
||||||
PPI: 'static,
|
PPI: 'static,
|
||||||
@@ -66,7 +72,6 @@ pub fn make_complex_relayer_delivery_batch<Runtime, GPI, PPI, MPI>(
|
|||||||
<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash: From<ParaHash>,
|
<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash: From<ParaHash>,
|
||||||
<<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
|
<<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
|
||||||
From<FromBridgedChainMessagesProof<ParaHash>>,
|
From<FromBridgedChainMessagesProof<ParaHash>>,
|
||||||
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
|
|
||||||
<Runtime as pallet_utility::Config>::RuntimeCall:
|
<Runtime as pallet_utility::Config>::RuntimeCall:
|
||||||
From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
||||||
@@ -117,10 +122,11 @@ where
|
|||||||
MPI: 'static,
|
MPI: 'static,
|
||||||
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain:
|
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain:
|
||||||
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
<<Runtime as pallet_bridge_messages::Config<MPI>>::TargetHeaderChain as TargetHeaderChain<
|
<Runtime as pallet_bridge_messages::Config<MPI>>::TargetHeaderChain: TargetHeaderChain<
|
||||||
XcmAsPlainPayload,
|
XcmAsPlainPayload,
|
||||||
Runtime::AccountId,
|
Runtime::AccountId,
|
||||||
>>::MessagesDeliveryProof: From<FromBridgedChainMessagesDeliveryProof<ParaHash>>,
|
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<ParaHash>,
|
||||||
|
>,
|
||||||
<Runtime as pallet_utility::Config>::RuntimeCall: From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
<Runtime as pallet_utility::Config>::RuntimeCall: From<pallet_bridge_grandpa::Call<Runtime, GPI>>
|
||||||
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
+ From<pallet_bridge_parachains::Call<Runtime, PPI>>
|
||||||
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
+ From<pallet_bridge_messages::Call<Runtime, MPI>>,
|
||||||
@@ -141,7 +147,7 @@ where
|
|||||||
};
|
};
|
||||||
let submit_message_delivery_proof =
|
let submit_message_delivery_proof =
|
||||||
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_delivery_proof {
|
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_delivery_proof {
|
||||||
proof: message_delivery_proof.into(),
|
proof: message_delivery_proof,
|
||||||
relayers_state,
|
relayers_state,
|
||||||
};
|
};
|
||||||
pallet_utility::Call::<Runtime>::batch_all {
|
pallet_utility::Call::<Runtime>::batch_all {
|
||||||
@@ -174,8 +180,6 @@ where
|
|||||||
BridgedRelayChain:
|
BridgedRelayChain:
|
||||||
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
MB: MessageBridge,
|
MB: MessageBridge,
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
{
|
{
|
||||||
let message_payload = prepare_inbound_xcm(xcm_message, message_destination);
|
let message_payload = prepare_inbound_xcm(xcm_message, message_destination);
|
||||||
@@ -223,7 +227,7 @@ pub fn make_complex_relayer_confirmation_proofs<BridgedRelayChain, MB, InnerXcmR
|
|||||||
para_header_number: u32,
|
para_header_number: u32,
|
||||||
relay_header_number: u32,
|
relay_header_number: u32,
|
||||||
bridged_para_id: u32,
|
bridged_para_id: u32,
|
||||||
relayer_id_at_this_chain: AccountId32,
|
relayer_id_at_this_chain: AccountIdOf<MessageThisChain<MB>>,
|
||||||
relayers_state: UnrewardedRelayersState,
|
relayers_state: UnrewardedRelayersState,
|
||||||
) -> (
|
) -> (
|
||||||
HeaderOf<BridgedRelayChain>,
|
HeaderOf<BridgedRelayChain>,
|
||||||
@@ -237,9 +241,6 @@ where
|
|||||||
BridgedRelayChain:
|
BridgedRelayChain:
|
||||||
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
|
||||||
MB: MessageBridge,
|
MB: MessageBridge,
|
||||||
<MB as MessageBridge>::BridgedChain: Send + Sync + 'static,
|
|
||||||
<MB as MessageBridge>::ThisChain: Send + Sync + 'static,
|
|
||||||
<<MB as MessageBridge>::ThisChain as bp_runtime::Chain>::AccountId: From<AccountId32>,
|
|
||||||
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
UnderlyingChainOf<MessageBridgedChain<MB>>: bp_runtime::Chain<Hash = ParaHash> + Parachain,
|
||||||
{
|
{
|
||||||
// prepare para storage proof containing message delivery proof
|
// prepare para storage proof containing message delivery proof
|
||||||
|
|||||||
Reference in New Issue
Block a user