Drop Rialto <> Millau bridges (#2663) (#2694)

* drop Rialto <> Millau bridges

* clippy
This commit is contained in:
Svyatoslav Nikolsky
2023-11-14 11:50:26 +03:00
committed by Bastian Köcher
parent 1c2b6b21da
commit 7a8c87a450
114 changed files with 363 additions and 17323 deletions
+2 -21
View File
@@ -45,21 +45,8 @@ pub struct TransactionParams<TS> {
/// Tagged relay account, which balance may be exposed as metrics by the relay.
#[derive(Clone, Debug)]
pub enum TaggedAccount<AccountId> {
/// Account, used to sign headers relay transactions from given bridged chain.
Headers {
/// Account id.
id: AccountId,
/// Name of the bridged chain, which headers are relayed.
bridged_chain: String,
},
/// Account, used to sign parachains relay transactions from given bridged relay chain.
Parachains {
/// Account id.
id: AccountId,
/// Name of the bridged relay chain with parachain heads.
bridged_chain: String,
},
/// Account, used to sign message relay transactions from given bridged chain.
/// Account, used to sign message (also headers and parachains) relay transactions from given
/// bridged chain.
Messages {
/// Account id.
id: AccountId,
@@ -72,8 +59,6 @@ impl<AccountId> TaggedAccount<AccountId> {
/// Returns reference to the account id.
pub fn id(&self) -> &AccountId {
match *self {
TaggedAccount::Headers { ref id, .. } => id,
TaggedAccount::Parachains { ref id, .. } => id,
TaggedAccount::Messages { ref id, .. } => id,
}
}
@@ -81,10 +66,6 @@ impl<AccountId> TaggedAccount<AccountId> {
/// Returns stringified account tag.
pub fn tag(&self) -> String {
match *self {
TaggedAccount::Headers { ref bridged_chain, .. } => format!("{bridged_chain}Headers"),
TaggedAccount::Parachains { ref bridged_chain, .. } => {
format!("{bridged_chain}Parachains")
},
TaggedAccount::Messages { ref bridged_chain, .. } => {
format!("{bridged_chain}Messages")
},
@@ -187,8 +187,6 @@ where
{
// 2/3 is reserved for proofs and tx overhead
let max_messages_size_in_single_batch = P::TargetChain::max_extrinsic_size() / 3;
// we don't know exact weights of the Polkadot runtime. So to guess weights we'll be using
// weights from Rialto and then simply dividing it by x2.
let limits = match params.limits {
Some(limits) => limits,
None =>
@@ -555,9 +555,8 @@ fn split_msgs_to_refine<Source: Chain + ChainWithMessages, Target: Chain>(
mod tests {
use super::*;
use bp_runtime::Chain as ChainBase;
use relay_rialto_client::Rialto;
use relay_rococo_client::Rococo;
use relay_wococo_client::Wococo;
use relay_bridge_hub_rococo_client::BridgeHubRococo;
use relay_bridge_hub_wococo_client::BridgeHubWococo;
fn message_details_from_rpc(
nonces: RangeInclusive<MessageNonce>,
@@ -574,16 +573,20 @@ mod tests {
#[test]
fn validate_out_msgs_details_succeeds_if_no_messages_are_missing() {
assert!(
validate_out_msgs_details::<Wococo>(&message_details_from_rpc(1..=3), 1..=3,).is_ok()
);
assert!(validate_out_msgs_details::<BridgeHubRococo>(
&message_details_from_rpc(1..=3),
1..=3,
)
.is_ok());
}
#[test]
fn validate_out_msgs_details_succeeds_if_head_messages_are_missing() {
assert!(
validate_out_msgs_details::<Wococo>(&message_details_from_rpc(2..=3), 1..=3,).is_ok()
assert!(validate_out_msgs_details::<BridgeHubRococo>(
&message_details_from_rpc(2..=3),
1..=3,
)
.is_ok())
}
#[test]
@@ -591,7 +594,7 @@ mod tests {
let mut message_details_from_rpc = message_details_from_rpc(1..=3);
message_details_from_rpc.remove(1);
assert!(matches!(
validate_out_msgs_details::<Wococo>(&message_details_from_rpc, 1..=3,),
validate_out_msgs_details::<BridgeHubRococo>(&message_details_from_rpc, 1..=3,),
Err(SubstrateError::Custom(_))
));
}
@@ -599,7 +602,7 @@ mod tests {
#[test]
fn validate_out_msgs_details_map_fails_if_tail_messages_are_missing() {
assert!(matches!(
validate_out_msgs_details::<Wococo>(&message_details_from_rpc(1..=2), 1..=3,),
validate_out_msgs_details::<BridgeHubRococo>(&message_details_from_rpc(1..=2), 1..=3,),
Err(SubstrateError::Custom(_))
));
}
@@ -607,7 +610,7 @@ mod tests {
#[test]
fn validate_out_msgs_details_fails_if_all_messages_are_missing() {
assert!(matches!(
validate_out_msgs_details::<Wococo>(&[], 1..=3),
validate_out_msgs_details::<BridgeHubRococo>(&[], 1..=3),
Err(SubstrateError::Custom(_))
));
}
@@ -615,7 +618,7 @@ mod tests {
#[test]
fn validate_out_msgs_details_fails_if_more_messages_than_nonces() {
assert!(matches!(
validate_out_msgs_details::<Wococo>(&message_details_from_rpc(1..=5), 2..=5,),
validate_out_msgs_details::<BridgeHubRococo>(&message_details_from_rpc(1..=5), 2..=5,),
Err(SubstrateError::Custom(_))
));
}
@@ -641,8 +644,10 @@ mod tests {
msgs_to_refine.push((payload, out_msg_details));
}
let maybe_batches =
split_msgs_to_refine::<Rialto, Rococo>(LaneId([0, 0, 0, 0]), msgs_to_refine);
let maybe_batches = split_msgs_to_refine::<BridgeHubRococo, BridgeHubWococo>(
Default::default(),
msgs_to_refine,
);
match expected_batches {
Ok(expected_batches) => {
let batches = maybe_batches.unwrap();
@@ -664,7 +669,7 @@ mod tests {
#[test]
fn test_split_msgs_to_refine() {
let max_extrinsic_size = Rococo::max_extrinsic_size() as usize;
let max_extrinsic_size = BridgeHubRococo::max_extrinsic_size() as usize;
// Check that an error is returned when one of the messages is too big.
check_split_msgs_to_refine(vec![max_extrinsic_size], Err(()));