Tests for BridgeHub(s) <> remote GRANDPA chain (#2692)
So far the `bridge-hub-test-utils` contained a tests set for testing BridgeHub runtime that is bridging with the remote **parachain**. But we have https://github.com/paritytech/polkadot-sdk/pull/2540 coming, which would add Rococo <> Bulletin chain bridge (where Bulletin = standalone chain that is using GRANDPA finality). Then it'll be expanded to Polkadot BH as well. So this PR adds the same set of tests to the `bridge-hub-test-utils`, but for the case when remote chain is the chain with GRANDPA finality. There's a lot of changes in this PR - I'll describe some: - I've added `BasicParachainRuntime` trait to decrease number of lines we need to add to `where` clause. Could revert, but imo it is useful; - `cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data` is a submodule for generating test data for the test sets. `from_parachain.rs` is used in tests for the case when remote chain is a parachain, `from_grandpa_chain.rs` - for the bridges with remote GRANDPA chains. `mod.rs` has some code, shared by both types of tests; - `cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data` is a submodule with all test cases. The `mod.rs` has tests, suitable for all cases. There's also `wth_parachain.rs` and `with_grandpa_chain.rs` with the same meaning as above; - I've merged the "core" code of two previous tests - `relayed_incoming_message_works` and `complex_relay_extrinsic_works` into one single `relayed_incoming_message_works` test. So now we are always constructing extrinsics and are dispatching them using executive module (meaning all signed extensions are also tested). New test set is used here: https://github.com/paritytech/polkadot-sdk/pull/2540. Once this PR is merged, I'll merge that other PR with master to remove duplicate changes. I'm also planning to cleanup generic constraints + remove some unnecessary assumptions about used chains in a follow-up PRs. But for now I think this PR has enough changes, so don't want to complicate it even more. --- Breaking changes for the code that have used those tests before: - the `construct_and_apply_extrinsic` callback now accepts the `RuntimeCall` instead of the `pallet_utility::Call`; - the `construct_and_apply_extrinsic` now may be called multiple times for the single test, so make sure the `frame_system::CheckNonce` is correctly constructed; - all previous tests have been moved from `bridge_hub_test_utils::test_cases` to `bridge_hub_test_utils::test_cases::from_parachain` module; - there are several changes in test arguments - please refer to https://github.com/paritytech/polkadot-sdk/compare/sv-tests-for-bridge-with-remote-grandpa-chain?expand=1#diff-79a28d4d3e1749050341c2424f00c4c139825b1a20937767f83e58b95166735c for details.
Showing
- Cargo.lock 2 additions, 0 deletionsCargo.lock
- cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs 14 additions, 18 deletions...ins/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs
- cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs 14 additions, 18 deletions...ns/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml 3 additions, 0 deletions...lus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs 2 additions, 0 deletions...lus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs 0 additions, 1588 deletions...achains/runtimes/bridge-hubs/test-utils/src/test_cases.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs 442 additions, 0 deletions...idge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs 544 additions, 0 deletions...s/bridge-hubs/test-utils/src/test_cases/from_parachain.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs 340 additions, 0 deletions...runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs 485 additions, 0 deletions...ins/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data/from_grandpa_chain.rs 244 additions, 0 deletions...ridge-hubs/test-utils/src/test_data/from_grandpa_chain.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data/from_parachain.rs 326 additions, 0 deletions...es/bridge-hubs/test-utils/src/test_data/from_parachain.rs
- cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_data/mod.rs 144 additions, 0 deletions...ains/runtimes/bridge-hubs/test-utils/src/test_data/mod.rs
- cumulus/parachains/runtimes/test-utils/src/lib.rs 28 additions, 27 deletionscumulus/parachains/runtimes/test-utils/src/lib.rs
Please register or sign in to comment