Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup bridges tests: with-grandpa-chain case #2763

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridges/primitives/runtime/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ pub trait Chain: Send + Sync + 'static {
}

/// A trait that provides the type of the underlying chain.
pub trait UnderlyingChainProvider {
pub trait UnderlyingChainProvider: Send + Sync + 'static {
bkontur marked this conversation as resolved.
Show resolved Hide resolved
/// Underlying chain type.
type Chain: Chain;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ mod bridge_hub_westend_tests {
mod bridge_hub_bulletin_tests {
use super::*;
use bridge_common_config::BridgeGrandpaRococoBulletinInstance;
use bridge_hub_test_utils::test_cases::from_grandpa_chain;
use bridge_to_bulletin_config::{
RococoBulletinChainId, RococoBulletinGlobalConsensusNetwork,
RococoBulletinGlobalConsensusNetworkLocation, WithRococoBulletinMessageBridge,
Expand All @@ -382,6 +383,15 @@ mod bridge_hub_bulletin_tests {
// Para id of sibling chain used in tests.
pub const SIBLING_PARACHAIN_ID: u32 = rococo_runtime_constants::system_parachain::PEOPLE_ID;

// Runtime from tests PoV
type RuntimeTestsAdapter = from_grandpa_chain::WithRemoteGrandpaChainHelperAdapter<
Runtime,
AllPalletsWithoutSystem,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
WithRococoBulletinMessageBridge,
>;

#[test]
fn initialize_bridge_by_governance_works() {
// for Bulletin finality
Expand Down Expand Up @@ -474,14 +484,7 @@ mod bridge_hub_bulletin_tests {
#[test]
fn relayed_incoming_message_works() {
// from Bulletin
bridge_hub_test_utils::test_cases::from_grandpa_chain::relayed_incoming_message_works::<
Runtime,
AllPalletsWithoutSystem,
ParachainSystem,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
WithRococoBulletinMessageBridge,
>(
from_grandpa_chain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
RococoBulletinChainId::get(),
Expand All @@ -496,15 +499,7 @@ mod bridge_hub_bulletin_tests {
#[test]
pub fn complex_relay_extrinsic_works() {
// for Bulletin
bridge_hub_test_utils::test_cases::from_grandpa_chain::complex_relay_extrinsic_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
WithRococoBulletinMessageBridge,
>(
from_grandpa_chain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
collator_session_keys(),
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
SIBLING_PARACHAIN_ID,
Expand Down Expand Up @@ -536,15 +531,10 @@ mod bridge_hub_bulletin_tests {

#[test]
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
let estimated = bridge_hub_test_utils::test_cases::from_grandpa_chain::can_calculate_fee_for_complex_message_delivery_transaction::<
Runtime,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
WithRococoBulletinMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated =
from_grandpa_chain::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();
Expand All @@ -558,15 +548,10 @@ mod bridge_hub_bulletin_tests {

#[test]
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
let estimated = bridge_hub_test_utils::test_cases::from_grandpa_chain::can_calculate_fee_for_complex_message_confirmation_transaction::<
Runtime,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
WithRococoBulletinMessageBridge,
>(
collator_session_keys(),
construct_and_estimate_extrinsic_fee
);
let estimated =
from_grandpa_chain::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();
Expand Down
Loading