Skip to content

Commit 9f5221c

Browse files
svyatonikbkontur
andauthored
Cleanup bridges tests: with-grandpa-chain case (#2763)
related to paritytech/parity-bridges-common#2739 Co-authored-by: Branislav Kontur <[email protected]>
1 parent d84e135 commit 9f5221c

File tree

7 files changed

+225
-254
lines changed

7 files changed

+225
-254
lines changed

bridges/primitives/runtime/src/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub trait Chain: Send + Sync + 'static {
199199
}
200200

201201
/// A trait that provides the type of the underlying chain.
202-
pub trait UnderlyingChainProvider {
202+
pub trait UnderlyingChainProvider: Send + Sync + 'static {
203203
/// Underlying chain type.
204204
type Chain: Chain;
205205
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ mod bridge_hub_westend_tests {
373373
mod bridge_hub_bulletin_tests {
374374
use super::*;
375375
use bridge_common_config::BridgeGrandpaRococoBulletinInstance;
376+
use bridge_hub_test_utils::test_cases::from_grandpa_chain;
376377
use bridge_to_bulletin_config::{
377378
RococoBulletinChainId, RococoBulletinGlobalConsensusNetwork,
378379
RococoBulletinGlobalConsensusNetworkLocation, WithRococoBulletinMessageBridge,
@@ -382,6 +383,15 @@ mod bridge_hub_bulletin_tests {
382383
// Para id of sibling chain used in tests.
383384
pub const SIBLING_PARACHAIN_ID: u32 = rococo_runtime_constants::system_parachain::PEOPLE_ID;
384385

386+
// Runtime from tests PoV
387+
type RuntimeTestsAdapter = from_grandpa_chain::WithRemoteGrandpaChainHelperAdapter<
388+
Runtime,
389+
AllPalletsWithoutSystem,
390+
BridgeGrandpaRococoBulletinInstance,
391+
WithRococoBulletinMessagesInstance,
392+
WithRococoBulletinMessageBridge,
393+
>;
394+
385395
#[test]
386396
fn initialize_bridge_by_governance_works() {
387397
// for Bulletin finality
@@ -474,14 +484,7 @@ mod bridge_hub_bulletin_tests {
474484
#[test]
475485
fn relayed_incoming_message_works() {
476486
// from Bulletin
477-
bridge_hub_test_utils::test_cases::from_grandpa_chain::relayed_incoming_message_works::<
478-
Runtime,
479-
AllPalletsWithoutSystem,
480-
ParachainSystem,
481-
BridgeGrandpaRococoBulletinInstance,
482-
WithRococoBulletinMessagesInstance,
483-
WithRococoBulletinMessageBridge,
484-
>(
487+
from_grandpa_chain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
485488
collator_session_keys(),
486489
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
487490
RococoBulletinChainId::get(),
@@ -496,15 +499,7 @@ mod bridge_hub_bulletin_tests {
496499
#[test]
497500
pub fn complex_relay_extrinsic_works() {
498501
// for Bulletin
499-
bridge_hub_test_utils::test_cases::from_grandpa_chain::complex_relay_extrinsic_works::<
500-
Runtime,
501-
AllPalletsWithoutSystem,
502-
XcmConfig,
503-
ParachainSystem,
504-
BridgeGrandpaRococoBulletinInstance,
505-
WithRococoBulletinMessagesInstance,
506-
WithRococoBulletinMessageBridge,
507-
>(
502+
from_grandpa_chain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
508503
collator_session_keys(),
509504
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
510505
SIBLING_PARACHAIN_ID,
@@ -536,15 +531,10 @@ mod bridge_hub_bulletin_tests {
536531

537532
#[test]
538533
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
539-
let estimated = bridge_hub_test_utils::test_cases::from_grandpa_chain::can_calculate_fee_for_complex_message_delivery_transaction::<
540-
Runtime,
541-
BridgeGrandpaRococoBulletinInstance,
542-
WithRococoBulletinMessagesInstance,
543-
WithRococoBulletinMessageBridge,
544-
>(
545-
collator_session_keys(),
546-
construct_and_estimate_extrinsic_fee
547-
);
534+
let estimated =
535+
from_grandpa_chain::can_calculate_fee_for_complex_message_delivery_transaction::<
536+
RuntimeTestsAdapter,
537+
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
548538

549539
// check if estimated value is sane
550540
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseDeliveryFeeInRocs::get();
@@ -558,15 +548,10 @@ mod bridge_hub_bulletin_tests {
558548

559549
#[test]
560550
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
561-
let estimated = bridge_hub_test_utils::test_cases::from_grandpa_chain::can_calculate_fee_for_complex_message_confirmation_transaction::<
562-
Runtime,
563-
BridgeGrandpaRococoBulletinInstance,
564-
WithRococoBulletinMessagesInstance,
565-
WithRococoBulletinMessageBridge,
566-
>(
567-
collator_session_keys(),
568-
construct_and_estimate_extrinsic_fee
569-
);
551+
let estimated =
552+
from_grandpa_chain::can_calculate_fee_for_complex_message_confirmation_transaction::<
553+
RuntimeTestsAdapter,
554+
>(collator_session_keys(), construct_and_estimate_extrinsic_fee);
570555

571556
// check if estimated value is sane
572557
let max_expected = bp_bridge_hub_rococo::BridgeHubRococoBaseConfirmationFeeInRocs::get();

0 commit comments

Comments
 (0)