Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Bump bridges #2602

Merged
merged 3 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,696 changes: 15,696 additions & 0 deletions bridges/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bridges/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ To run a Rialto node for example, you can use the following command:
```bash
docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 \
-it paritytech/rialto-bridge-node --dev --tmp \
--rpc-cors=all --unsafe-rpc-external --unsafe-ws-external
--rpc-cors=all --unsafe-rpc-external
```

## Community
Expand Down
12 changes: 10 additions & 2 deletions bridges/bin/runtime-common/src/messages_benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ where
// update runtime storage
let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::<R, FI>(state_root);

FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane }
FromBridgedChainMessagesDeliveryProof {
bridged_header_hash: bridged_header_hash.into(),
storage_proof,
lane,
}
}

/// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call.
Expand All @@ -207,7 +211,11 @@ where
let (_, bridged_header_hash) =
insert_header_to_parachains_pallet::<R, PI, UnderlyingChainOf<BridgedChain<B>>>(state_root);

FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane }
FromBridgedChainMessagesDeliveryProof {
bridged_header_hash: bridged_header_hash.into(),
storage_proof,
lane,
}
}

/// Prepare in-memory message delivery proof, without inserting anything to the runtime storage.
Expand Down
2 changes: 1 addition & 1 deletion bridges/bin/runtime-common/src/parachains_benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
TrieDBMutBuilderV1::<RelayBlockHasher>::new(&mut mdb, &mut state_root).build();

// insert parachain heads
for (i, parachain) in parachains.iter().enumerate() {
for (i, parachain) in parachains.into_iter().enumerate() {
let storage_key =
parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain);
let leaf_data = if i == 0 {
Expand Down
12 changes: 6 additions & 6 deletions bridges/modules/messages/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ benchmarks_instance_pallet! {
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
verify {
assert_eq!(
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
21,
);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ benchmarks_instance_pallet! {
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight)
verify {
assert_eq!(
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
22,
);
}
Expand Down Expand Up @@ -208,7 +208,7 @@ benchmarks_instance_pallet! {
});
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
verify {
let lane_state = crate::InboundLanes::<T, I>::get(T::bench_lane_id());
let lane_state = crate::InboundLanes::<T, I>::get(&T::bench_lane_id());
assert_eq!(lane_state.last_delivered_nonce(), 21);
assert_eq!(lane_state.last_confirmed_nonce, 20);
}
Expand Down Expand Up @@ -240,7 +240,7 @@ benchmarks_instance_pallet! {
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
verify {
assert_eq!(
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
21,
);
}
Expand Down Expand Up @@ -274,7 +274,7 @@ benchmarks_instance_pallet! {
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
verify {
assert_eq!(
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
21,
);
}
Expand Down Expand Up @@ -432,7 +432,7 @@ benchmarks_instance_pallet! {
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
verify {
assert_eq!(
crate::InboundLanes::<T, I>::get(T::bench_lane_id()).last_delivered_nonce(),
crate::InboundLanes::<T, I>::get(&T::bench_lane_id()).last_delivered_nonce(),
21,
);
assert!(T::is_message_successfully_dispatched(21));
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/messages/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl crate::benchmarking::Config<()> for TestRuntime {
// in mock run we only care about benchmarks correctness, not the benchmark results
// => ignore size related arguments
let (messages, total_dispatch_weight) =
params.message_nonces.map(|n| message(n, REGULAR_PAYLOAD)).fold(
params.message_nonces.into_iter().map(|n| message(n, REGULAR_PAYLOAD)).fold(
(Vec::new(), Weight::zero()),
|(mut messages, total_dispatch_weight), message| {
let weight = REGULAR_PAYLOAD.declared_weight;
Expand Down
7 changes: 4 additions & 3 deletions bridges/modules/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,10 @@ impl pallet_bridge_parachains::benchmarking::Config<()> for TestRuntime {
) {
// in mock run we only care about benchmarks correctness, not the benchmark results
// => ignore size related arguments
let (state_root, proof, parachains) = crate::tests::prepare_parachain_heads_proof(
parachains.iter().map(|p| (p.0, crate::tests::head_data(p.0, 1))).collect(),
);
let (state_root, proof, parachains) =
bp_test_utils::prepare_parachain_heads_proof::<RegularParachainHeader>(
parachains.iter().map(|p| (p.0, crate::tests::head_data(p.0, 1))).collect(),
);
let relay_genesis_hash = crate::tests::initialize(state_root);
(0, relay_genesis_hash, proof, parachains)
}
Expand Down
6 changes: 3 additions & 3 deletions bridges/modules/relayers/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ benchmarks! {
// create slash destination account
let lane = LaneId([0, 0, 0, 0]);
let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
T::prepare_rewards_account(slash_destination, Zero::zero());
T::prepare_rewards_account(slash_destination.clone(), Zero::zero());
}: {
crate::Pallet::<T>::slash_and_deregister(&relayer, slash_destination)
}
Expand All @@ -121,10 +121,10 @@ benchmarks! {
let account_params =
RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain);
}: {
crate::Pallet::<T>::register_relayer_reward(account_params, &relayer, One::one());
crate::Pallet::<T>::register_relayer_reward(account_params.clone(), &relayer, One::one());
}
verify {
assert_eq!(RelayerRewards::<T>::get(relayer, account_params), Some(One::one()));
assert_eq!(RelayerRewards::<T>::get(relayer, &account_params), Some(One::one()));
}

impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime)
Expand Down