Cleanup bridges tests: with-parachain case (#2772)

related to
https://github.com/paritytech/parity-bridges-common/issues/2739
This commit is contained in:
Svyatoslav Nikolsky
2023-12-21 21:16:08 +03:00
committed by GitHub
parent 69434d9a32
commit 94759738f0
5 changed files with 290 additions and 315 deletions
@@ -138,6 +138,7 @@ mod bridge_hub_westend_tests {
use bridge_common_config::{
BridgeGrandpaWestendInstance, BridgeParachainWestendInstance, DeliveryRewardInBalance,
};
use bridge_hub_test_utils::test_cases::from_parachain;
use bridge_to_westend_config::{
BridgeHubWestendChainId, BridgeHubWestendLocation, WestendGlobalConsensusNetwork,
WithBridgeHubWestendMessageBridge, WithBridgeHubWestendMessagesInstance,
@@ -147,6 +148,16 @@ mod bridge_hub_westend_tests {
// Para id of sibling chain used in tests.
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
// Runtime from tests PoV
type RuntimeTestsAdapter = from_parachain::WithRemoteParachainHelperAdapter<
Runtime,
AllPalletsWithoutSystem,
BridgeGrandpaWestendInstance,
BridgeParachainWestendInstance,
WithBridgeHubWestendMessagesInstance,
WithBridgeHubWestendMessageBridge,
>;
#[test]
fn initialize_bridge_by_governance_works() {
// for RococoBulletin finality
@@ -275,15 +286,7 @@ mod bridge_hub_westend_tests {
#[test]
fn relayed_incoming_message_works() {
// from Westend
bridge_hub_test_utils::test_cases::from_parachain::relayed_incoming_message_works::<
Runtime,
AllPalletsWithoutSystem,
ParachainSystem,
BridgeGrandpaWestendInstance,
BridgeParachainWestendInstance,
WithBridgeHubWestendMessagesInstance,
WithBridgeHubWestendMessageBridge,
>(
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
@@ -299,16 +302,7 @@ mod bridge_hub_westend_tests {
#[test]
pub fn complex_relay_extrinsic_works() {
// for Westend
bridge_hub_test_utils::test_cases::from_parachain::complex_relay_extrinsic_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
BridgeGrandpaWestendInstance,
BridgeParachainWestendInstance,
WithBridgeHubWestendMessagesInstance,
WithBridgeHubWestendMessageBridge,
>(
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
@@ -341,16 +335,9 @@ mod bridge_hub_westend_tests {
#[test]
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::<
Runtime,
BridgeGrandpaWestendInstance,
BridgeParachainWestendInstance,
WithBridgeHubWestendMessagesInstance,
WithBridgeHubWestendMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated = from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
// check if estimated value is sane
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseDeliveryFeeInRocs::get();
@@ -364,16 +351,10 @@ mod bridge_hub_westend_tests {
#[test]
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::<
Runtime,
BridgeGrandpaWestendInstance,
BridgeParachainWestendInstance,
WithBridgeHubWestendMessagesInstance,
WithBridgeHubWestendMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated =
from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
// check if estimated value is sane
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseConfirmationFeeInRocs::get();
@@ -18,6 +18,7 @@
use bp_polkadot_core::Signature;
use bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
use bridge_hub_test_utils::test_cases::from_parachain;
use bridge_hub_westend_runtime::{
bridge_common_config, bridge_to_rococo_config,
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
@@ -43,6 +44,16 @@ use xcm::latest::prelude::*;
// Para id of sibling chain used in tests.
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
// Runtime from tests PoV
type RuntimeTestsAdapter = from_parachain::WithRemoteParachainHelperAdapter<
Runtime,
AllPalletsWithoutSystem,
BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
WithBridgeHubRococoMessageBridge,
>;
parameter_types! {
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
}
@@ -239,15 +250,7 @@ fn message_dispatch_routing_works() {
#[test]
fn relayed_incoming_message_works() {
bridge_hub_test_utils::test_cases::from_parachain::relayed_incoming_message_works::<
Runtime,
AllPalletsWithoutSystem,
ParachainSystem,
BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
WithBridgeHubRococoMessageBridge,
>(
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
@@ -262,16 +265,7 @@ fn relayed_incoming_message_works() {
#[test]
pub fn complex_relay_extrinsic_works() {
bridge_hub_test_utils::test_cases::from_parachain::complex_relay_extrinsic_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
WithBridgeHubRococoMessageBridge,
>(
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_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]
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::<
Runtime,
BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
WithBridgeHubRococoMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated = from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
// check if estimated value is sane
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds::get();
@@ -327,16 +314,9 @@ pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
#[test]
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::<
Runtime,
BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
WithBridgeHubRococoMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated = from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
// check if estimated value is sane
let max_expected = bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds::get();
@@ -49,9 +49,9 @@ use xcm::latest::prelude::*;
/// 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 {
/// This chaiin runtime.
/// This chain runtime.
type Runtime: BasicParachainRuntime
+ cumulus_pallet_xcmp_queue::Config
+ BridgeGrandpaConfig<
@@ -74,7 +74,7 @@ pub trait WithRemoteGrandpaChainHelper {
type MB: MessageBridge;
}
/// Adapter struct that implements `WithRemoteGrandpaChainHelper`
/// Adapter struct that implements [`WithRemoteGrandpaChainHelper`].
pub struct WithRemoteGrandpaChainHelperAdapter<Runtime, AllPalletsWithoutSystem, GPI, MPI, MB>(
sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI, MB)>,
);
@@ -22,43 +22,102 @@ use crate::{
test_data,
};
use bp_header_chain::ChainWithGrandpa;
use bp_messages::{
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
UnrewardedRelayersState,
};
use bp_polkadot_core::parachains::ParaHash;
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::{Parachain, UnderlyingChainOf};
use bp_runtime::{HashOf, Parachain, UnderlyingChainOf};
use bridge_runtime_common::{
messages::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
BridgedChain as MessageBridgedChain, MessageBridge,
BridgedChain as MessageBridgedChain, MessageBridge, ThisChain as MessageThisChain,
},
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 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::{
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, ValidatorIdOf,
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf,
};
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
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,
/// with proofs (finality, para heads, message) independently submitted.
/// Also verifies relayer transaction signed extensions work as intended.
pub fn relayed_incoming_message_works<
Runtime,
AllPalletsWithoutSystem,
HrmpChannelOpener,
GPI,
PPI,
MPI,
MB,
>(
collator_session_key: CollatorSessionKeys<Runtime>,
pub fn relayed_incoming_message_works<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
runtime_para_id: u32,
bridged_para_id: u32,
bridged_chain_id: bp_runtime::ChainId,
@@ -68,46 +127,30 @@ pub fn relayed_incoming_message_works<
prepare_configuration: impl Fn(),
construct_and_apply_extrinsic: fn(
sp_keyring::AccountKeyring,
<Runtime as frame_system::Config>::RuntimeCall,
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> sp_runtime::DispatchOutcome,
) where
Runtime: BasicParachainRuntime
+ cumulus_pallet_xcmp_queue::Config
+ cumulus_pallet_parachain_system::Config
+ pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_parachains::Config<PPI>
+ pallet_bridge_messages::Config<MPI>
+ pallet_bridge_relayers::Config,
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
GPI: 'static,
PPI: 'static,
MPI: 'static,
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,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
Call = cumulus_pallet_parachain_system::Call<Runtime>,
RuntimeHelper: WithRemoteParachainHelper,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
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,
runtime_para_id,
sibling_parachain_id,
@@ -124,8 +167,8 @@ pub fn relayed_incoming_message_works<
prepare_configuration();
// start with bridged relay chain block#0
helpers::initialize_bridge_grandpa_pallet::<Runtime, GPI>(
test_data::initialization_data::<Runtime, GPI>(0),
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(0),
);
// generate bridged relay chain finality, parachain heads and message proofs,
@@ -138,8 +181,8 @@ pub fn relayed_incoming_message_works<
para_heads_proof,
message_proof,
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
MB,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
lane_id,
@@ -156,30 +199,38 @@ pub fn relayed_incoming_message_works<
let relay_chain_header_number = *relay_chain_header.number();
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),
justification: grandpa_justification,
}.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),
parachains: parachain_heads,
parachain_heads_proof: para_heads_proof,
}.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,
proof: message_proof,
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}.into(),
Box::new((
helpers::VerifySubmitMessagesProofOutcome::<Runtime, MPI>::expect_last_delivered_nonce(lane_id, 1),
helpers::VerifyRelayerRewarded::<Runtime>::expect_relayer_reward(
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,
RewardsAccountParams::new(
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,
/// with proofs (finality, para heads, message) batched together in signed extrinsic.
/// Also verifies relayer transaction signed extensions work as intended.
pub fn complex_relay_extrinsic_works<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
HrmpChannelOpener,
GPI,
PPI,
MPI,
MB,
>(
collator_session_key: CollatorSessionKeys<Runtime>,
pub fn complex_relay_extrinsic_works<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
runtime_para_id: u32,
bridged_para_id: u32,
sibling_parachain_id: u32,
@@ -217,48 +259,33 @@ pub fn complex_relay_extrinsic_works<
prepare_configuration: impl Fn(),
construct_and_apply_extrinsic: fn(
sp_keyring::AccountKeyring,
<Runtime as frame_system::Config>::RuntimeCall,
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> sp_runtime::DispatchOutcome,
) where
Runtime: BasicParachainRuntime
+ cumulus_pallet_xcmp_queue::Config
+ cumulus_pallet_parachain_system::Config
+ pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_parachains::Config<PPI>
+ pallet_bridge_messages::Config<MPI>
+ pallet_bridge_relayers::Config
+ pallet_utility::Config,
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
GPI: 'static,
PPI: 'static,
MPI: 'static,
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,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
Call = cumulus_pallet_parachain_system::Call<Runtime>,
RuntimeHelper: WithRemoteParachainHelper,
RuntimeHelper::Runtime:
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>
+ From<pallet_utility::Call<RuntimeHelper::Runtime>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
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,
runtime_para_id,
sibling_parachain_id,
@@ -275,8 +302,8 @@ pub fn complex_relay_extrinsic_works<
prepare_configuration();
// start with bridged relay chain block#0
helpers::initialize_bridge_grandpa_pallet::<Runtime, GPI>(
test_data::initialization_data::<Runtime, GPI>(0),
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(0),
);
// generate bridged relay chain finality, parachain heads and message proofs,
@@ -289,8 +316,8 @@ pub fn complex_relay_extrinsic_works<
para_heads_proof,
message_proof,
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
MB,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
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_number = *relay_chain_header.number();
vec![(
pallet_utility::Call::<Runtime>::batch_all {
pallet_utility::Call::<RuntimeHelper::Runtime>::batch_all {
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),
justification: grandpa_justification,
}.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),
parachains: parachain_heads,
parachain_heads_proof: para_heads_proof,
}.into(),
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_proof {
BridgeMessagesCall::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::receive_messages_proof {
relayer_id_at_bridged_chain,
proof: message_proof,
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}.into(),
],
}.into(),
}
.into(),
Box::new((
helpers::VerifySubmitGrandpaFinalityProofOutcome::<Runtime, GPI>::expect_best_header_hash(relay_chain_header_hash),
helpers::VerifySubmitParachainHeaderProofOutcome::<Runtime, PPI>::expect_best_header_hash(bridged_para_id, parachain_head_hash),
helpers::VerifySubmitMessagesProofOutcome::<Runtime, MPI>::expect_last_delivered_nonce(lane_id, 1),
helpers::VerifyRelayerRewarded::<Runtime>::expect_relayer_reward(
helpers::VerifySubmitGrandpaFinalityProofOutcome::<
RuntimeHelper::Runtime,
RuntimeHelper::GPI,
>::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,
RewardsAccountParams::new(
lane_id,
@@ -345,45 +382,29 @@ pub fn complex_relay_extrinsic_works<
/// Estimates transaction fee for default message delivery transaction (batched with required
/// proofs) from bridged parachain.
pub fn can_calculate_fee_for_complex_message_delivery_transaction<Runtime, GPI, PPI, MPI, MB>(
collator_session_key: CollatorSessionKeys<Runtime>,
compute_extrinsic_fee: fn(pallet_utility::Call::<Runtime>) -> u128,
pub fn can_calculate_fee_for_complex_message_delivery_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(pallet_utility::Call<RuntimeHelper::Runtime>) -> u128,
) -> u128
where
Runtime: frame_system::Config
+ pallet_balances::Config
+ pallet_session::Config
+ pallet_xcm::Config
+ parachain_info::Config
+ pallet_collator_selection::Config
+ cumulus_pallet_parachain_system::Config
+ pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_parachains::Config<PPI>
+ pallet_bridge_messages::Config<MPI, InboundPayload = XcmAsPlainPayload>
+ pallet_utility::Config,
GPI: 'static,
PPI: 'static,
MPI: 'static,
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>>,
RuntimeHelper: WithRemoteParachainHelper,
RuntimeHelper::Runtime:
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
>,
{
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,
// to be submitted by relayer to this chain.
//
@@ -398,8 +419,8 @@ where
para_heads_proof,
message_proof,
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
MB,
<RuntimeHelper::Runtime as pallet_bridge_grandpa::Config<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
LaneId::default(),
@@ -414,17 +435,18 @@ where
// generate batch call that provides finality for bridged relay and parachains + message
// proof
let batch = test_data::from_parachain::make_complex_relayer_delivery_batch::<
Runtime,
GPI,
PPI,
MPI,
RuntimeHelper::Runtime,
RuntimeHelper::GPI,
RuntimeHelper::PPI,
RuntimeHelper::MPI,
_,
>(
relay_chain_header,
grandpa_justification,
parachain_heads,
para_heads_proof,
message_proof,
Dave.public().into(),
helpers::relayer_id_at_bridged_chain::<RuntimeHelper::Runtime, RuntimeHelper::MPI>(),
);
let estimated_fee = compute_extrinsic_fee(batch);
@@ -432,7 +454,7 @@ where
target: "bridges::estimate",
"Estimate fee: {:?} for single message delivery for runtime: {:?}",
estimated_fee,
Runtime::Version::get(),
<RuntimeHelper::Runtime as frame_system::Config>::Version::get(),
);
estimated_fee
@@ -441,50 +463,34 @@ where
/// Estimates transaction fee for default message confirmation transaction (batched with required
/// proofs) from bridged parachain.
pub fn can_calculate_fee_for_complex_message_confirmation_transaction<Runtime, GPI, PPI, MPI, MB>(
collator_session_key: CollatorSessionKeys<Runtime>,
compute_extrinsic_fee: fn(pallet_utility::Call::<Runtime>) -> u128,
pub fn can_calculate_fee_for_complex_message_confirmation_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(pallet_utility::Call<RuntimeHelper::Runtime>) -> u128,
) -> u128
where
Runtime: frame_system::Config
+ pallet_balances::Config
+ pallet_session::Config
+ pallet_xcm::Config
+ parachain_info::Config
+ pallet_collator_selection::Config
+ cumulus_pallet_parachain_system::Config
+ pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_parachains::Config<PPI>
+ pallet_bridge_messages::Config<MPI, OutboundPayload = XcmAsPlainPayload>
+ pallet_utility::Config,
GPI: 'static,
PPI: 'static,
MPI: 'static,
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,
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<
RuntimeHelper: WithRemoteParachainHelper,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
RuntimeHelper::Runtime:
pallet_utility::Config<RuntimeCall = RuntimeCallOf<RuntimeHelper::Runtime>>,
MessageThisChain<RuntimeHelper::MB>:
bp_runtime::Chain<AccountId = AccountIdOf<RuntimeHelper::Runtime>>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::TargetHeaderChain:
TargetHeaderChain<
XcmAsPlainPayload,
Runtime::AccountId,
>>::MessagesDeliveryProof: From<FromBridgedChainMessagesDeliveryProof<ParaHash>>,
<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>>,
AccountIdOf<RuntimeHelper::Runtime>,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<
HashOf<UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>>,
>,
>,
{
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,
// to be submitted by relayer to this chain.
let unrewarded_relayers = UnrewardedRelayersState {
@@ -500,18 +506,25 @@ where
para_heads_proof,
message_delivery_proof,
) = test_data::from_parachain::make_complex_relayer_confirmation_proofs::<
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain,
MB,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
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
// proof
let batch = test_data::from_parachain::make_complex_relayer_confirmation_batch::<
Runtime,
GPI,
PPI,
MPI,
RuntimeHelper::Runtime,
RuntimeHelper::GPI,
RuntimeHelper::PPI,
RuntimeHelper::MPI,
>(
relay_chain_header,
grandpa_justification,
@@ -526,7 +539,7 @@ where
target: "bridges::estimate",
"Estimate fee: {:?} for single message confirmation for runtime: {:?}",
estimated_fee,
Runtime::Version::get(),
<RuntimeHelper::Runtime as frame_system::Config>::Version::get(),
);
estimated_fee
@@ -22,12 +22,14 @@ use bp_messages::{
source_chain::TargetHeaderChain, target_chain::SourceHeaderChain, LaneId,
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 bridge_runtime_common::{
messages::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
BridgedChain as MessageBridgedChain, MessageBridge,
BridgedChain as MessageBridgedChain, MessageBridge, ThisChain as MessageThisChain,
},
messages_generation::{
encode_all_messages, encode_lane_data, prepare_message_delivery_storage_proof,
@@ -38,7 +40,7 @@ use bridge_runtime_common::{
use codec::Encode;
use pallet_bridge_grandpa::BridgedHeader;
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 bp_header_chain::{justification::GrandpaJustification, ChainWithGrandpa};
@@ -47,17 +49,21 @@ use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
use sp_runtime::SaturatedConversion;
/// 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>,
grandpa_justification: GrandpaJustification<BridgedHeader<Runtime, GPI>>,
parachain_heads: Vec<(ParaId, ParaHash)>,
para_heads_proof: ParaHeadsProof,
message_proof: FromBridgedChainMessagesProof<ParaHash>,
relayer_id_at_bridged_chain: AccountId32,
relayer_id_at_bridged_chain: InboundRelayer,
) -> pallet_utility::Call<Runtime> where
Runtime:pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_parachains::Config<PPI>
+ pallet_bridge_messages::Config<MPI, InboundPayload = XcmAsPlainPayload>
+ pallet_bridge_messages::Config<
MPI,
InboundPayload = XcmAsPlainPayload,
InboundRelayer = InboundRelayer,
>
+ pallet_utility::Config,
GPI: '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_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
From<FromBridgedChainMessagesProof<ParaHash>>,
<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>>
@@ -117,10 +122,11 @@ where
MPI: 'static,
<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain:
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,
Runtime::AccountId,
>>::MessagesDeliveryProof: From<FromBridgedChainMessagesDeliveryProof<ParaHash>>,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<ParaHash>,
>,
<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>>,
@@ -141,7 +147,7 @@ where
};
let submit_message_delivery_proof =
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_delivery_proof {
proof: message_delivery_proof.into(),
proof: message_delivery_proof,
relayers_state,
};
pallet_utility::Call::<Runtime>::batch_all {
@@ -174,8 +180,6 @@ where
BridgedRelayChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
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,
{
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,
relay_header_number: u32,
bridged_para_id: u32,
relayer_id_at_this_chain: AccountId32,
relayer_id_at_this_chain: AccountIdOf<MessageThisChain<MB>>,
relayers_state: UnrewardedRelayersState,
) -> (
HeaderOf<BridgedRelayChain>,
@@ -237,9 +241,6 @@ where
BridgedRelayChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
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,
{
// prepare para storage proof containing message delivery proof