diff --git a/Cargo.lock b/Cargo.lock index 6266d4df26e..bb4e9685c2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1084,7 +1084,7 @@ dependencies = [ [[package]] name = "bp-asset-hub-rococo" -version = "0.1.0" +version = "0.4.0" dependencies = [ "bp-xcm-bridge-hub-router", "frame-support", @@ -1094,7 +1094,7 @@ dependencies = [ [[package]] name = "bp-asset-hub-westend" -version = "0.1.0" +version = "0.3.0" dependencies = [ "bp-xcm-bridge-hub-router", "frame-support", @@ -1121,7 +1121,7 @@ dependencies = [ [[package]] name = "bp-bridge-hub-cumulus" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-messages", "bp-polkadot-core", @@ -1135,7 +1135,7 @@ dependencies = [ [[package]] name = "bp-bridge-hub-kusama" -version = "0.1.0" +version = "0.6.0" dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", @@ -1148,7 +1148,7 @@ dependencies = [ [[package]] name = "bp-bridge-hub-polkadot" -version = "0.1.0" +version = "0.6.0" dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", @@ -1161,7 +1161,7 @@ dependencies = [ [[package]] name = "bp-bridge-hub-rococo" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", @@ -1174,7 +1174,7 @@ dependencies = [ [[package]] name = "bp-bridge-hub-westend" -version = "0.1.0" +version = "0.3.0" dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", @@ -1187,7 +1187,7 @@ dependencies = [ [[package]] name = "bp-header-chain" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-runtime", "bp-test-utils", @@ -1206,7 +1206,7 @@ dependencies = [ [[package]] name = "bp-kusama" -version = "0.1.0" +version = "0.5.0" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1218,7 +1218,7 @@ dependencies = [ [[package]] name = "bp-messages" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-runtime", @@ -1234,7 +1234,7 @@ dependencies = [ [[package]] name = "bp-parachains" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1250,7 +1250,7 @@ dependencies = [ [[package]] name = "bp-polkadot" -version = "0.1.0" +version = "0.5.0" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1262,7 +1262,7 @@ dependencies = [ [[package]] name = "bp-polkadot-bulletin" -version = "0.1.0" +version = "0.4.0" dependencies = [ "bp-header-chain", "bp-messages", @@ -1279,7 +1279,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-messages", "bp-runtime", @@ -1297,7 +1297,7 @@ dependencies = [ [[package]] name = "bp-relayers" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-messages", "bp-runtime", @@ -1312,7 +1312,7 @@ dependencies = [ [[package]] name = "bp-rococo" -version = "0.1.0" +version = "0.6.0" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1324,7 +1324,7 @@ dependencies = [ [[package]] name = "bp-runtime" -version = "0.1.0" +version = "0.7.0" dependencies = [ "frame-support", "frame-system", @@ -1347,7 +1347,7 @@ dependencies = [ [[package]] name = "bp-test-utils" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-parachains", @@ -1366,7 +1366,7 @@ dependencies = [ [[package]] name = "bp-westend" -version = "0.1.0" +version = "0.3.0" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1378,14 +1378,14 @@ dependencies = [ [[package]] name = "bp-xcm-bridge-hub" -version = "0.1.0" +version = "0.2.0" dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=master)", ] [[package]] name = "bp-xcm-bridge-hub-router" -version = "0.1.0" +version = "0.6.0" dependencies = [ "parity-scale-codec", "scale-info", @@ -1395,7 +1395,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-messages", @@ -5413,7 +5413,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-runtime", @@ -5435,7 +5435,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-messages", "bp-runtime", @@ -5455,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-header-chain", "bp-parachains", @@ -5478,7 +5478,7 @@ dependencies = [ [[package]] name = "pallet-bridge-relayers" -version = "0.1.0" +version = "0.7.0" dependencies = [ "bp-messages", "bp-relayers", @@ -5626,7 +5626,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" -version = "0.1.0" +version = "0.2.0" dependencies = [ "bp-header-chain", "bp-messages", @@ -5651,7 +5651,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" -version = "0.1.0" +version = "0.5.0" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", diff --git a/bin/runtime-common/Cargo.toml b/bin/runtime-common/Cargo.toml index b642f738d6e..88bd3422d0e 100644 --- a/bin/runtime-common/Cargo.toml +++ b/bin/runtime-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bridge-runtime-common" -version = "0.1.0" +version = "0.7.0" description = "Common types and functions that may be used by substrate-based runtimes of all bridged chains" authors.workspace = true edition.workspace = true diff --git a/modules/grandpa/Cargo.toml b/modules/grandpa/Cargo.toml index e7e8c5c6fe7..b1480c70246 100644 --- a/modules/grandpa/Cargo.toml +++ b/modules/grandpa/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-bridge-grandpa" -version = "0.1.0" +version = "0.7.0" description = "Module implementing GRANDPA on-chain light client used for bridging consensus of substrate-based chains." authors.workspace = true edition.workspace = true diff --git a/modules/messages/Cargo.toml b/modules/messages/Cargo.toml index 01dd3dbcbde..9d7a1e3b9d3 100644 --- a/modules/messages/Cargo.toml +++ b/modules/messages/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallet-bridge-messages" description = "Module that allows bridged chains to exchange messages using lane concept." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/modules/parachains/Cargo.toml b/modules/parachains/Cargo.toml index 239f5262c8b..d44b434bff7 100644 --- a/modules/parachains/Cargo.toml +++ b/modules/parachains/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-bridge-parachains" -version = "0.1.0" +version = "0.7.0" description = "Module that allows bridged relay chains to exchange information on their parachains' heads." authors.workspace = true edition.workspace = true diff --git a/modules/relayers/Cargo.toml b/modules/relayers/Cargo.toml index 73cc343a193..b0c32f4c7df 100644 --- a/modules/relayers/Cargo.toml +++ b/modules/relayers/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallet-bridge-relayers" description = "Module used to store relayer rewards and coordinate relayers set." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/modules/xcm-bridge-hub-router/Cargo.toml b/modules/xcm-bridge-hub-router/Cargo.toml index 6d3e1c5ab45..56e9ae8f08c 100644 --- a/modules/xcm-bridge-hub-router/Cargo.toml +++ b/modules/xcm-bridge-hub-router/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallet-xcm-bridge-hub-router" description = "Bridge hub interface for sibling/parent chains with dynamic fees support." -version = "0.1.0" +version = "0.5.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/modules/xcm-bridge-hub/Cargo.toml b/modules/xcm-bridge-hub/Cargo.toml index 4dac474413a..86644f8e4c9 100644 --- a/modules/xcm-bridge-hub/Cargo.toml +++ b/modules/xcm-bridge-hub/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallet-xcm-bridge-hub" description = "Module that adds dynamic bridges/lanes support to XCM infrastucture at the bridge hub." -version = "0.1.0" +version = "0.2.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-asset-hub-rococo/Cargo.toml b/primitives/chain-asset-hub-rococo/Cargo.toml index c4da8ee0eaf..ad0eb39f9e3 100644 --- a/primitives/chain-asset-hub-rococo/Cargo.toml +++ b/primitives/chain-asset-hub-rococo/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-asset-hub-rococo" description = "Primitives of AssetHubRococo parachain runtime." -version = "0.1.0" +version = "0.4.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-asset-hub-westend/Cargo.toml b/primitives/chain-asset-hub-westend/Cargo.toml index a148cf31ca7..15b17f4d02d 100644 --- a/primitives/chain-asset-hub-westend/Cargo.toml +++ b/primitives/chain-asset-hub-westend/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-asset-hub-westend" description = "Primitives of AssetHubWestend parachain runtime." -version = "0.1.0" +version = "0.3.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-cumulus/Cargo.toml b/primitives/chain-bridge-hub-cumulus/Cargo.toml index 08f561b4f5c..82c87d8bc13 100644 --- a/primitives/chain-bridge-hub-cumulus/Cargo.toml +++ b/primitives/chain-bridge-hub-cumulus/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-bridge-hub-cumulus" description = "Primitives for BridgeHub parachain runtimes." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-cumulus/src/lib.rs b/primitives/chain-bridge-hub-cumulus/src/lib.rs index 285f0020481..c49aa4b8563 100644 --- a/primitives/chain-bridge-hub-cumulus/src/lib.rs +++ b/primitives/chain-bridge-hub-cumulus/src/lib.rs @@ -57,6 +57,12 @@ const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(constants::WEIGHT_REF_TI .saturating_div(2) .set_proof_size(polkadot_primitives::MAX_POV_SIZE as u64); +/// We allow for 2 seconds of compute with a 6 second average block. +const MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING: Weight = Weight::from_parts( + constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + polkadot_primitives::MAX_POV_SIZE as u64, +); + /// All cumulus bridge hubs assume that about 5 percent of the block weight is consumed by /// `on_initialize` handlers. This is used to limit the maximal weight of a single extrinsic. /// @@ -96,6 +102,26 @@ parameter_types! { }) .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); + + /// Weight limit of the Cumulus-based bridge hub blocks when async backing is enabled. + pub BlockWeightsForAsyncBacking: limits::BlockWeights = limits::BlockWeights::builder() + .base_block(BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING); + // Operational transactions have an extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING, + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); } /// Public key of the chain account that may be used to verify signatures. diff --git a/primitives/chain-bridge-hub-kusama/Cargo.toml b/primitives/chain-bridge-hub-kusama/Cargo.toml index 4e1b3a6334c..2075fe2543c 100644 --- a/primitives/chain-bridge-hub-kusama/Cargo.toml +++ b/primitives/chain-bridge-hub-kusama/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-bridge-hub-kusama" description = "Primitives of BridgeHubKusama parachain runtime." -version = "0.1.0" +version = "0.6.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-polkadot/Cargo.toml b/primitives/chain-bridge-hub-polkadot/Cargo.toml index 2f53cca46a8..edef6e61237 100644 --- a/primitives/chain-bridge-hub-polkadot/Cargo.toml +++ b/primitives/chain-bridge-hub-polkadot/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-bridge-hub-polkadot" description = "Primitives of BridgeHubPolkadot parachain runtime." -version = "0.1.0" +version = "0.6.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-rococo/Cargo.toml b/primitives/chain-bridge-hub-rococo/Cargo.toml index e4bbc1a0898..0370fa1c6bb 100644 --- a/primitives/chain-bridge-hub-rococo/Cargo.toml +++ b/primitives/chain-bridge-hub-rococo/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-bridge-hub-rococo" description = "Primitives of BridgeHubRococo parachain runtime." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-rococo/src/lib.rs b/primitives/chain-bridge-hub-rococo/src/lib.rs index 7b109f30fe0..c4e697fbe95 100644 --- a/primitives/chain-bridge-hub-rococo/src/lib.rs +++ b/primitives/chain-bridge-hub-rococo/src/lib.rs @@ -50,7 +50,7 @@ impl Chain for BridgeHubRococo { } fn max_extrinsic_weight() -> Weight { - BlockWeights::get() + BlockWeightsForAsyncBacking::get() .get(DispatchClass::Normal) .max_extrinsic .unwrap_or(Weight::MAX) @@ -99,7 +99,7 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Rococo /// BridgeHub. /// (initially was calculated by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubRococoBaseXcmFeeInRocs: u128 = 1_640_102_205; + pub const BridgeHubRococoBaseXcmFeeInRocs: u128 = 59_034_266; /// Transaction fee that is paid at the Rococo BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubRococo::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) @@ -107,5 +107,5 @@ frame_support::parameter_types! { /// Transaction fee that is paid at the Rococo BridgeHub for delivering single outbound message confirmation. /// (initially was calculated by test `BridgeHubRococo::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`) - pub const BridgeHubRococoBaseConfirmationFeeInRocs: u128 = 4_045_736_577; + pub const BridgeHubRococoBaseConfirmationFeeInRocs: u128 = 5_380_829_647; } diff --git a/primitives/chain-bridge-hub-westend/Cargo.toml b/primitives/chain-bridge-hub-westend/Cargo.toml index 333e49883f8..ea452d89dba 100644 --- a/primitives/chain-bridge-hub-westend/Cargo.toml +++ b/primitives/chain-bridge-hub-westend/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-bridge-hub-westend" description = "Primitives of BridgeHubWestend parachain runtime." -version = "0.1.0" +version = "0.3.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-bridge-hub-westend/src/lib.rs b/primitives/chain-bridge-hub-westend/src/lib.rs index 83d4d6e33a7..4af895cc6d3 100644 --- a/primitives/chain-bridge-hub-westend/src/lib.rs +++ b/primitives/chain-bridge-hub-westend/src/lib.rs @@ -49,7 +49,7 @@ impl Chain for BridgeHubWestend { } fn max_extrinsic_weight() -> Weight { - BlockWeights::get() + BlockWeightsForAsyncBacking::get() .get(DispatchClass::Normal) .max_extrinsic .unwrap_or(Weight::MAX) @@ -90,7 +90,7 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Westend /// BridgeHub. /// (initially was calculated by test `BridgeHubWestend::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubWestendBaseXcmFeeInWnds: u128 = 492_077_333_333; + pub const BridgeHubWestendBaseXcmFeeInWnds: u128 = 17_756_830_000; /// Transaction fee that is paid at the Westend BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubWestend::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) diff --git a/primitives/chain-kusama/Cargo.toml b/primitives/chain-kusama/Cargo.toml index ed057098813..465acf121d4 100644 --- a/primitives/chain-kusama/Cargo.toml +++ b/primitives/chain-kusama/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-kusama" description = "Primitives of Kusama runtime." -version = "0.1.0" +version = "0.5.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-polkadot-bulletin/Cargo.toml b/primitives/chain-polkadot-bulletin/Cargo.toml index 3fe83b8cae7..86f05624d01 100644 --- a/primitives/chain-polkadot-bulletin/Cargo.toml +++ b/primitives/chain-polkadot-bulletin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-polkadot-bulletin" description = "Primitives of Polkadot Bulletin chain runtime." -version = "0.1.0" +version = "0.4.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-polkadot/Cargo.toml b/primitives/chain-polkadot/Cargo.toml index 5180c34d932..20080a7901b 100644 --- a/primitives/chain-polkadot/Cargo.toml +++ b/primitives/chain-polkadot/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-polkadot" description = "Primitives of Polkadot runtime." -version = "0.1.0" +version = "0.5.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-rococo/Cargo.toml b/primitives/chain-rococo/Cargo.toml index 7d78b3ff513..459ee6f9f05 100644 --- a/primitives/chain-rococo/Cargo.toml +++ b/primitives/chain-rococo/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-rococo" description = "Primitives of Rococo runtime." -version = "0.1.0" +version = "0.6.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/chain-westend/Cargo.toml b/primitives/chain-westend/Cargo.toml index 23cfc8de9d7..4710da7bb33 100644 --- a/primitives/chain-westend/Cargo.toml +++ b/primitives/chain-westend/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-westend" description = "Primitives of Westend runtime." -version = "0.1.0" +version = "0.3.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/header-chain/Cargo.toml b/primitives/header-chain/Cargo.toml index 415b165101d..e42959164e4 100644 --- a/primitives/header-chain/Cargo.toml +++ b/primitives/header-chain/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-header-chain" description = "A common interface for describing what a bridge pallet should be able to do." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/messages/Cargo.toml b/primitives/messages/Cargo.toml index 02388a30e74..1092be13d89 100644 --- a/primitives/messages/Cargo.toml +++ b/primitives/messages/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-messages" description = "Primitives of messages module." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/parachains/Cargo.toml b/primitives/parachains/Cargo.toml index 524b95e3b6f..e62ae6a8d42 100644 --- a/primitives/parachains/Cargo.toml +++ b/primitives/parachains/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-parachains" description = "Primitives of parachains module." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/polkadot-core/Cargo.toml b/primitives/polkadot-core/Cargo.toml index 7b8b92b62fc..5ef9920d7f1 100644 --- a/primitives/polkadot-core/Cargo.toml +++ b/primitives/polkadot-core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-polkadot-core" description = "Primitives of Polkadot-like runtime." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/relayers/Cargo.toml b/primitives/relayers/Cargo.toml index 5eedf738a41..19aed6b038b 100644 --- a/primitives/relayers/Cargo.toml +++ b/primitives/relayers/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-relayers" description = "Primitives of relayers module." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index 08749268958..211737e4efc 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-runtime" description = "Primitives that may be used at (bridges) runtime level." -version = "0.1.0" +version = "0.7.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/test-utils/Cargo.toml b/primitives/test-utils/Cargo.toml index 3c24e1fed0f..1b3ac9ee697 100644 --- a/primitives/test-utils/Cargo.toml +++ b/primitives/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bp-test-utils" -version = "0.1.0" +version = "0.7.0" description = "Utilities for testing substrate-based runtime bridge code" authors.workspace = true edition.workspace = true diff --git a/primitives/xcm-bridge-hub-router/Cargo.toml b/primitives/xcm-bridge-hub-router/Cargo.toml index 8000e48992c..a9f584e2a03 100644 --- a/primitives/xcm-bridge-hub-router/Cargo.toml +++ b/primitives/xcm-bridge-hub-router/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-xcm-bridge-hub-router" description = "Primitives of the xcm-bridge-hub fee pallet." -version = "0.1.0" +version = "0.6.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/primitives/xcm-bridge-hub/Cargo.toml b/primitives/xcm-bridge-hub/Cargo.toml index b2dc09bdf8c..1a5bb742eed 100644 --- a/primitives/xcm-bridge-hub/Cargo.toml +++ b/primitives/xcm-bridge-hub/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bp-xcm-bridge-hub" description = "Primitives of the xcm-bridge-hub pallet." -version = "0.1.0" +version = "0.2.0" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/zombienet/helpers/chains/rococo-at-westend.js b/zombienet/helpers/chains/rococo-at-westend.js new file mode 100644 index 00000000000..bcce3b3a303 --- /dev/null +++ b/zombienet/helpers/chains/rococo-at-westend.js @@ -0,0 +1,6 @@ +module.exports = { + grandpaPalletName: "bridgeRococoGrandpa", + parachainsPalletName: "bridgeRococoParachains", + messagesPalletName: "bridgeRococoMessages", + bridgedBridgeHubParaId: 1013, +} diff --git a/zombienet/helpers/chains/westend-at-rotoco.js b/zombienet/helpers/chains/westend-at-rotoco.js new file mode 100644 index 00000000000..6a15b64a23b --- /dev/null +++ b/zombienet/helpers/chains/westend-at-rotoco.js @@ -0,0 +1,6 @@ +module.exports = { + grandpaPalletName: "bridgeWestendGrandpa", + parachainsPalletName: "bridgeWestendParachains", + messagesPalletName: "bridgeWestendMessages", + bridgedBridgeHubParaId: 1002, +} diff --git a/zombienet/helpers/only-mandatory-headers-synced-when-idle.js b/zombienet/helpers/only-mandatory-headers-synced-when-idle.js new file mode 100644 index 00000000000..3a3432cfaf3 --- /dev/null +++ b/zombienet/helpers/only-mandatory-headers-synced-when-idle.js @@ -0,0 +1,44 @@ +const utils = require("./utils"); + +async function run(nodeName, networkInfo, args) { + const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName]; + const api = await zombie.connect(wsUri, userDefinedTypes); + + // parse arguments + const exitAfterSeconds = Number(args[0]); + const bridgedChain = require("./chains/" + args[1]); + + // start listening to new blocks + let totalGrandpaHeaders = 0; + let totalParachainHeaders = 0; + api.rpc.chain.subscribeNewHeads(async function (header) { + const apiAtParent = await api.at(header.parentHash); + const apiAtCurrent = await api.at(header.hash); + const currentEvents = await apiAtCurrent.query.system.events(); + + totalGrandpaHeaders += await utils.ensureOnlyMandatoryGrandpaHeadersImported( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ); + totalParachainHeaders += await utils.ensureOnlyInitialParachainHeaderImported( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ); + }); + + // wait given time + await new Promise(resolve => setTimeout(resolve, exitAfterSeconds * 1000)); + // if we haven't seen any new GRANDPA or parachain headers => fail + if (totalGrandpaHeaders == 0) { + throw new Error("No bridged relay chain headers imported"); + } + if (totalParachainHeaders == 0) { + throw new Error("No bridged parachain headers imported"); + } +} + +module.exports = { run } diff --git a/zombienet/helpers/only-required-headers-synced-when-idle.js b/zombienet/helpers/only-required-headers-synced-when-idle.js new file mode 100644 index 00000000000..8c3130e4fd9 --- /dev/null +++ b/zombienet/helpers/only-required-headers-synced-when-idle.js @@ -0,0 +1,81 @@ +const utils = require("./utils"); + +async function run(nodeName, networkInfo, args) { + const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName]; + const api = await zombie.connect(wsUri, userDefinedTypes); + + // parse arguments + const exitAfterSeconds = Number(args[0]); + const bridgedChain = require("./chains/" + args[1]); + + // start listening to new blocks + let atLeastOneMessageReceived = false; + let atLeastOneMessageDelivered = false; + const unsubscribe = await api.rpc.chain.subscribeNewHeads(async function (header) { + const apiAtParent = await api.at(header.parentHash); + const apiAtCurrent = await api.at(header.hash); + const currentEvents = await apiAtCurrent.query.system.events(); + + const messagesReceived = currentEvents.find((record) => { + return record.event.section == bridgedChain.messagesPalletName + && record.event.method == "MessagesReceived"; + }) != undefined; + const messagesDelivered = currentEvents.find((record) => { + return record.event.section == bridgedChain.messagesPalletName && + record.event.method == "MessagesDelivered"; + }) != undefined; + const hasMessageUpdates = messagesReceived || messagesDelivered; + atLeastOneMessageReceived = atLeastOneMessageReceived || messagesReceived; + atLeastOneMessageDelivered = atLeastOneMessageDelivered || messagesDelivered; + + if (!hasMessageUpdates) { + // if there are no any message update transactions, we only expect mandatory GRANDPA + // headers and initial parachain headers + await utils.ensureOnlyMandatoryGrandpaHeadersImported( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ); + await utils.ensureOnlyInitialParachainHeaderImported( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ); + } else { + const messageTransactions = (messagesReceived ? 1 : 0) + (messagesDelivered ? 1 : 0); + + // otherwise we only accept at most one GRANDPA header + const newGrandpaHeaders = utils.countGrandpaHeaderImports(bridgedChain, currentEvents); + if (newGrandpaHeaders > 1) { + utils.logEvents(currentEvents); + throw new Error("Unexpected relay chain header import: " + newGrandpaHeaders + " / " + messageTransactions); + } + + // ...and at most one parachain header + const newParachainHeaders = utils.countParachainHeaderImports(bridgedChain, currentEvents); + if (newParachainHeaders > 1) { + utils.logEvents(currentEvents); + throw new Error("Unexpected parachain header import: " + newParachainHeaders + " / " + messageTransactions); + } + } + }); + + // wait until we have received + delivered messages OR until timeout + await utils.pollUntil( + exitAfterSeconds, + () => { return atLeastOneMessageReceived && atLeastOneMessageDelivered; }, + () => { unsubscribe(); }, + () => { + if (!atLeastOneMessageReceived) { + throw new Error("No messages received from bridged chain"); + } + if (!atLeastOneMessageDelivered) { + throw new Error("No messages delivered to bridged chain"); + } + }, + ); +} + +module.exports = { run } diff --git a/zombienet/helpers/utils.js b/zombienet/helpers/utils.js new file mode 100644 index 00000000000..5a5542b56df --- /dev/null +++ b/zombienet/helpers/utils.js @@ -0,0 +1,103 @@ +module.exports = { + logEvents: function(events) { + let stringifiedEvents = ""; + events.forEach((record) => { + if (stringifiedEvents != "") { + stringifiedEvents += ", "; + } + stringifiedEvents += record.event.section + "::" + record.event.method; + }); + console.log("Block events: " + stringifiedEvents); + }, + countGrandpaHeaderImports: function(bridgedChain, events) { + return events.reduce( + (count, record) => { + const { event } = record; + if (event.section == bridgedChain.grandpaPalletName && event.method == "UpdatedBestFinalizedHeader") { + count += 1; + } + return count; + }, + 0, + ); + }, + countParachainHeaderImports: function(bridgedChain, events) { + return events.reduce( + (count, record) => { + const { event } = record; + if (event.section == bridgedChain.parachainsPalletName && event.method == "UpdatedParachainHead") { + count += 1; + } + return count; + }, + 0, + ); + }, + pollUntil: async function( + timeoutInSecs, + predicate, + cleanup, + onFailure, + ) { + const begin = new Date().getTime(); + const end = begin + timeoutInSecs * 1000; + while (new Date().getTime() < end) { + if (predicate()) { + cleanup(); + return; + } + await new Promise(resolve => setTimeout(resolve, 100)); + } + + cleanup(); + onFailure(); + }, + ensureOnlyMandatoryGrandpaHeadersImported: async function( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ) { + // remember id of bridged relay chain GRANDPA authorities set at parent block + const authoritySetAtParent = await apiAtParent.query[bridgedChain.grandpaPalletName].currentAuthoritySet(); + const authoritySetIdAtParent = authoritySetAtParent["setId"]; + + // now read the id of bridged relay chain GRANDPA authorities set at current block + const authoritySetAtCurrent = await apiAtCurrent.query[bridgedChain.grandpaPalletName].currentAuthoritySet(); + const authoritySetIdAtCurrent = authoritySetAtCurrent["setId"]; + + // we expect to see no more than `authoritySetIdAtCurrent - authoritySetIdAtParent` new GRANDPA headers + const maxNewGrandpaHeaders = authoritySetIdAtCurrent - authoritySetIdAtParent; + const newGrandpaHeaders = module.exports.countGrandpaHeaderImports(bridgedChain, currentEvents); + + // check that our assumptions are correct + if (newGrandpaHeaders > maxNewGrandpaHeaders) { + module.exports.logEvents(currentEvents); + throw new Error("Unexpected relay chain header import: " + newGrandpaHeaders + " / " + maxNewGrandpaHeaders); + } + + return newGrandpaHeaders; + }, + ensureOnlyInitialParachainHeaderImported: async function( + bridgedChain, + apiAtParent, + apiAtCurrent, + currentEvents, + ) { + // remember whether we already know bridged parachain header at a parent block + const bestBridgedParachainHeader = await apiAtParent.query[bridgedChain.parachainsPalletName].parasInfo(bridgedChain.bridgedBridgeHubParaId);; + const hasBestBridgedParachainHeader = bestBridgedParachainHeader.isSome; + + // we expect to see: no more than `1` bridged parachain header if there were no parachain header before. + const maxNewParachainHeaders = hasBestBridgedParachainHeader ? 0 : 1; + const newParachainHeaders = module.exports.countParachainHeaderImports(bridgedChain, currentEvents); + + // check that our assumptions are correct + if (newParachainHeaders > maxNewParachainHeaders) { + module.exports.logEvents(currentEvents); + throw new Error("Unexpected parachain header import: " + newParachainHeaders + " / " + maxNewParachainHeaders); + } + + return newParachainHeaders; + }, +} diff --git a/zombienet/run-tests.sh b/zombienet/run-tests.sh index 34487e13261..cf3b529e6a9 100755 --- a/zombienet/run-tests.sh +++ b/zombienet/run-tests.sh @@ -1,10 +1,12 @@ #!/bin/bash -#set -eu set -x shopt -s nullglob -trap "trap - SIGINT SIGTERM EXIT && kill -- -$$" SIGINT SIGTERM EXIT +trap "trap - SIGINT SIGTERM EXIT && killall -q -9 substrate-relay && kill -- -$$" SIGINT SIGTERM EXIT +# run tests in range [TESTS_BEGIN; TESTS_END) +TESTS_BEGIN=1 +TESTS_END=1000 # whether to use paths for zombienet+bridges tests container or for local testing ZOMBIENET_DOCKER_PATHS=0 while [ $# -ne 0 ] @@ -14,6 +16,11 @@ do --docker) ZOMBIENET_DOCKER_PATHS=1 ;; + --test) + shift + TESTS_BEGIN="$1" + TESTS_END="$1" + ;; esac shift done @@ -57,7 +64,8 @@ ALL_TESTS_FOLDER=`mktemp -d /tmp/bridges-zombienet-tests.XXXXX` function start_coproc() { local command=$1 local name=$2 - local coproc_log=`mktemp -p $TEST_FOLDER` + local logname=`basename $name` + local coproc_log=`mktemp -p $TEST_FOLDER $logname.XXXXX` coproc COPROC { # otherwise zombienet uses some hardcoded paths unset RUN_IN_CONTAINER @@ -73,7 +81,7 @@ function start_coproc() { } # execute every test from tests folder -TEST_INDEX=1 +TEST_INDEX=$TESTS_BEGIN while true do declare -A TEST_COPROCS @@ -81,7 +89,7 @@ do TEST_PREFIX=$(printf "%04d" $TEST_INDEX) # it'll be used by the `sync-exit.sh` script - export TEST_FOLDER=`mktemp -d -p $ALL_TESTS_FOLDER` + export TEST_FOLDER=`mktemp -d -p $ALL_TESTS_FOLDER test-$TEST_PREFIX.XXXXX` # check if there are no more tests zndsl_files=($BRIDGE_TESTS_FOLDER/$TEST_PREFIX-*.zndsl) @@ -89,12 +97,6 @@ do break fi - # start relay - if [ -f $BRIDGE_TESTS_FOLDER/$TEST_PREFIX-start-relay.sh ]; then - start_coproc "${BRIDGE_TESTS_FOLDER}/${TEST_PREFIX}-start-relay.sh" "relay" - RELAY_COPROC=$COPROC_PID - ((TEST_COPROCS_COUNT++)) - fi # start tests for zndsl_file in "${zndsl_files[@]}"; do start_coproc "$ZOMBIENET_BINARY_PATH --provider native test $zndsl_file" "$zndsl_file" @@ -102,7 +104,6 @@ do ((TEST_COPROCS_COUNT++)) done # wait until all tests are completed - relay_exited=0 for n in `seq 1 $TEST_COPROCS_COUNT`; do if [ "$IS_BASH_5_1" -eq 1 ]; then wait -n -p COPROC_PID @@ -110,7 +111,6 @@ do coproc_name=${TEST_COPROCS[$COPROC_PID, 0]} coproc_log=${TEST_COPROCS[$COPROC_PID, 1]} coproc_stdout=$(cat $coproc_log) - relay_exited=$(expr "${coproc_name}" == "relay") else wait -n exit_code=$? @@ -124,18 +124,20 @@ do echo "=====================================================================" echo "=== Shutting down. Log of failed process below ===" echo "=====================================================================" - echo $coproc_stdout + echo "$coproc_stdout" exit 1 fi - - # if last test has exited, exit relay too - if [ $n -eq $(($TEST_COPROCS_COUNT - 1)) ] && [ $relay_exited -eq 0 ]; then - kill $RELAY_COPROC - break - fi done + + # proceed to next index ((TEST_INDEX++)) + if [ "$TEST_INDEX" -ge "$TESTS_END" ]; then + break + fi + + # kill relay here - it is started manually by tests + killall substrate-relay done echo "=====================================================================" diff --git a/zombienet/scripts/invoke-script.sh b/zombienet/scripts/invoke-script.sh index 6a3754a8824..835b4fe500f 100755 --- a/zombienet/scripts/invoke-script.sh +++ b/zombienet/scripts/invoke-script.sh @@ -1,5 +1,7 @@ #!/bin/bash +INVOKE_LOG=`mktemp -p $TEST_FOLDER invoke.XXXXX` + pushd $POLKADOT_SDK_FOLDER/cumulus/scripts -./bridges_rococo_westend.sh $1 +./bridges_rococo_westend.sh $1 >$INVOKE_LOG 2>&1 popd diff --git a/zombienet/scripts/start-relayer.sh b/zombienet/scripts/start-relayer.sh new file mode 100755 index 00000000000..2f72b5ee556 --- /dev/null +++ b/zombienet/scripts/start-relayer.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +RELAY_LOG=`mktemp -p $TEST_FOLDER relay.XXXXX` + +pushd $POLKADOT_SDK_FOLDER/cumulus/scripts +./bridges_rococo_westend.sh run-relay >$RELAY_LOG 2>&1& +popd diff --git a/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl b/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl index fe7dc26b001..82d1eee2f45 100644 --- a/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl +++ b/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl @@ -2,31 +2,36 @@ Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml Creds: config +# step 0: start relayer +# (started by sibling 0001-asset-transfer-works-westend-to-rococo.zndsl test) + # step 1: initialize Westend AH -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-westend-local" within 240 seconds -asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 400 seconds +asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-westend-local" within 60 seconds # step 2: initialize Westend bridge hub -bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 120 seconds +bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds + +# step 3: ensure that initialization has completed +asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds -# step 3: relay is started elsewhere - let's wait until with-Rococo GRANPDA pallet is initialized at Westend +# step 4: relay is already started - let's wait until with-Rococo GRANPDA pallet is initialized at Westend bridge-hub-westend-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds -# step 4: send WND to //Alice on Rococo AH +# step 5: send WND to //Alice on Rococo AH # (that's a required part of a sibling 0001-asset-transfer-works-westend-to-rococo.zndsl test) -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 120 seconds +asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 60 seconds -# step 5: elsewhere Rococo has sent ROC to //Alice - let's wait for it +# step 6: elsewhere Rococo has sent ROC to //Alice - let's wait for it asset-hub-westend-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Rococo" within 600 seconds -# step 6: check that the relayer //Charlie is rewarded by both our AH and target AH +# step 7: check that the relayer //Charlie is rewarded by both our AH and target AH bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726f,BridgedChain,0" within 300 seconds bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 300 seconds -# step 7: send wROC back to Alice at Rococo AH -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-westend-local" within 120 seconds +# step 8: send wROC back to Alice at Rococo AH +asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-westend-local" within 60 seconds -# step 8: elsewhere Rococo has sent wWND to //Alice - let's wait for it +# step 9: elsewhere Rococo has sent wWND to //Alice - let's wait for it # (we wait until //Alice account increases here - there are no other transactionc that may increase it) asset-hub-westend-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds diff --git a/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl b/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl index 610b4ca7acd..acfe0df03d2 100644 --- a/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl +++ b/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl @@ -2,31 +2,36 @@ Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml Creds: config +# step 0: start relayer +bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds + # step 1: initialize Rococo AH -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-rococo-local" within 240 seconds -asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 400 seconds +asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-rococo-local" within 60 seconds # step 2: initialize Rococo bridge hub -bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 120 seconds +bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds + +# step 3: ensure that initialization has completed +asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 600 seconds -# step 3: relay is started elsewhere - let's wait until with-Westend GRANPDA pallet is initialized at Rococo +# step 4: relay is already started - let's wait until with-Westend GRANPDA pallet is initialized at Rococo bridge-hub-rococo-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds -# step 4: send ROC to //Alice on Westend AH +# step 5: send ROC to //Alice on Westend AH # (that's a required part of a sibling 0001-asset-transfer-works-rococo-to-westend.zndsl test) -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 120 seconds +asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 60 seconds -# step 5: elsewhere Westend has sent WND to //Alice - let's wait for it +# step 6: elsewhere Westend has sent WND to //Alice - let's wait for it asset-hub-rococo-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Westend" within 600 seconds -# step 6: check that the relayer //Charlie is rewarded by both our AH and target AH +# step 7: check that the relayer //Charlie is rewarded by both our AH and target AH bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,BridgedChain,0" within 300 seconds bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 300 seconds -# step 7: send wWND back to Alice at Westend AH -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-rococo-local" within 120 seconds +# step 8: send wWND back to Alice at Westend AH +asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-rococo-local" within 60 seconds -# step 8: elsewhere Westend has sent wROC to //Alice - let's wait for it +# step 9: elsewhere Westend has sent wROC to //Alice - let's wait for it # (we wait until //Alice account increases here - there are no other transactionc that may increase it) asset-hub-rococo-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds diff --git a/zombienet/tests/0001-start-relay.sh b/zombienet/tests/0001-start-relay.sh deleted file mode 100755 index 7be2cf4d593..00000000000 --- a/zombienet/tests/0001-start-relay.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -pushd $POLKADOT_SDK_FOLDER/cumulus/scripts -./bridges_rococo_westend.sh run-relay -popd diff --git a/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl b/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl new file mode 100644 index 00000000000..eb6a75c373c --- /dev/null +++ b/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl @@ -0,0 +1,26 @@ +Description: While relayer is idle, we only sync mandatory Rococo (and a single Rococo BH) headers to Westend BH. +Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Creds: config + +# step 1: initialize Westend bridge hub +bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds + +# step 2: sleep some time before starting relayer. We want to sleep for at least 1 session, which is expected to +# be 60 seconds for test environment. +sleep 120 seconds + +# step 3: start relayer +# (it is started by the sibling 0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl test file) + +# it also takes some time for relayer to initialize bridge, so let's sleep for 5 minutes to be sure that parachain +# header has been synced + +# step 4: ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were +# born while relay was offline and those in the next 100 seconds while script is active. +bridge-hub-westend-collator1: js-script ../helpers/only-mandatory-headers-synced-when-idle.js with "300,rococo-at-westend" within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl b/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl new file mode 100644 index 00000000000..728d54d586a --- /dev/null +++ b/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl @@ -0,0 +1,26 @@ +Description: While relayer is idle, we only sync mandatory Westend (and a single Westend BH) headers to Rococo BH. +Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +Creds: config + +# step 1: initialize Rococo bridge hub +bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds + +# step 2: sleep some time before starting relayer. We want to sleep for at least 1 session, which is expected to +# be 60 seconds for test environment. +sleep 120 seconds + +# step 3: start relayer +bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds + +# it also takes some time for relayer to initialize bridge, so let's sleep for 5 minutes to be sure that parachain +# header has been synced + +# step 4: ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were +# born while relay was offline and those in the next 100 seconds while script is active. +bridge-hub-rococo-collator1: js-script ../helpers/only-mandatory-headers-synced-when-idle.js with "300,westend-at-rococo" within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl b/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl new file mode 100644 index 00000000000..a4960344f0a --- /dev/null +++ b/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl @@ -0,0 +1,26 @@ +Description: While relayer is active, we only sync mandatory and required Rococo (and Rococo BH) headers to Westend BH. +Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Creds: config + +# step 1: initialize Westend AH +asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-westend-local" within 60 seconds + +# step 2: initialize Westend bridge hub +bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds + +# step 3: ensure that initialization has completed +asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds + +# step 4: send message from Westend to Rococo +asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 60 seconds + +# step 5: start relayer +# (we are starting it after sending the message to be sure that relayer won't relay messages before our js script +# will be started at step 6) +# (it is started by sibling 0003-required-headers-synced-while-active-westend-to-rococo.zndsl) + +# step 6: ensure that relayer won't sync any extra headers while delivering messages and confirmations +bridge-hub-westend-collator1: js-script ../helpers/only-required-headers-synced-when-active.js with "500,rococo-at-westend" within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl b/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl new file mode 100644 index 00000000000..33c3ceebcf8 --- /dev/null +++ b/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl @@ -0,0 +1,26 @@ +Description: While relayer is active, we only sync mandatory and required Westend (and Westend BH) headers to Rococo BH. +Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +Creds: config + +# step 1: initialize Rococo AH +asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-rococo-local" within 60 seconds + +# step 2: initialize Rococo bridge hub +bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds + +# step 3: ensure that initialization has completed +asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 600 seconds + +# step 4: send message from Rococo to Westend +asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 60 seconds + +# step 5: start relayer +# (we are starting it after sending the message to be sure that relayer won't relay messages before our js script +# will be started at step 6) +bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds + +# step 6: ensure that relayer won't sync any extra headers while delivering messages and confirmations +bridge-hub-rococo-collator1: js-script ../helpers/only-required-headers-synced-when-active.js with "500,westend-at-rococo" within 600 seconds + +# wait until other network test has completed OR exit with an error too +asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds