BridgeHub[Rococo/Wococo] test batched relaying of messages and their dispatch (#2578)

Added some tests that aim to cover the runtime configuration
that is exercised when BH receives relayed complex message.

* checks correct importing of proofs for:
  bridged chain finality, bridged para heads, bridged messages,
* checks relayer extension correctly configured to reward
  submitting relayer,
* checks relayed message is successfully dispatched.

Also moved generic test-utils from
  `asset-test-utils: parachains/runtimes/assets/test-utils`
one level up to new crate
  `parachains-runtimes-test-utils: parachains/runtimes/test-utils`
to be reused by BridgeHubs.

Signed-off-by: acatangiu <adrian@parity.io>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
This commit is contained in:
Adrian Catangiu
2023-05-18 18:10:36 +03:00
committed by GitHub
parent 93cf3908e0
commit 4e4799927a
21 changed files with 1723 additions and 980 deletions
@@ -28,12 +28,12 @@ pub mod messages;
pub mod messages_api;
pub mod messages_benchmarking;
pub mod messages_call_ext;
pub mod messages_generation;
pub mod messages_xcm_extension;
pub mod parachains_benchmarking;
pub mod priority_calculator;
pub mod refund_relayer_extension;
mod messages_generation;
mod mock;
#[cfg(feature = "integrity-test")]
@@ -16,8 +16,6 @@
//! Helpers for generating message storage proofs, that are used by tests and by benchmarks.
#![cfg(any(feature = "runtime-benchmarks", test))]
use crate::messages::{BridgedChain, HashOf, HasherOf, MessageBridge};
use bp_messages::{
@@ -29,19 +27,19 @@ use sp_std::{ops::RangeInclusive, prelude::*};
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
/// Simple and correct message data encode function.
pub(crate) fn encode_all_messages(_: MessageNonce, m: &MessagePayload) -> Option<Vec<u8>> {
pub fn encode_all_messages(_: MessageNonce, m: &MessagePayload) -> Option<Vec<u8>> {
Some(m.encode())
}
/// Simple and correct outbound lane data encode function.
pub(crate) fn encode_lane_data(d: &OutboundLaneData) -> Vec<u8> {
pub fn encode_lane_data(d: &OutboundLaneData) -> Vec<u8> {
d.encode()
}
/// Prepare storage proof of given messages.
///
/// Returns state trie root and nodes with prepared messages.
pub(crate) fn prepare_messages_storage_proof<B>(
pub fn prepare_messages_storage_proof<B>(
lane: LaneId,
message_nonces: RangeInclusive<MessageNonce>,
outbound_lane_data: Option<OutboundLaneData>,