From d577bedfa9c8bd7afcee5e07143cc83e128577fb Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 1 Mar 2023 15:19:23 +0300 Subject: [PATCH 1/3] verify with-parachain message benchmarks on CI --- bin/millau/runtime/src/lib.rs | 77 +++++++++++++++++++++++++++++------ scripts/update-weights.sh | 2 +- 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/bin/millau/runtime/src/lib.rs b/bin/millau/runtime/src/lib.rs index 3e46d6ba15a..beb2a4063a8 100644 --- a/bin/millau/runtime/src/lib.rs +++ b/bin/millau/runtime/src/lib.rs @@ -933,9 +933,10 @@ impl_runtime_apis! { let mut list = Vec::::new(); - list_benchmark!(list, extra, pallet_bridge_messages, MessagesBench::); + list_benchmark!(list, extra, RialtoParachainMessages, MessagesBench::); + list_benchmark!(list, extra, RialtoMessages, MessagesBench::); list_benchmark!(list, extra, pallet_bridge_grandpa, BridgeRialtoGrandpa); - list_benchmark!(list, extra, pallet_bridge_parachains, ParachainsBench::); + list_benchmark!(list, extra, pallet_bridge_parachains, ParachainsBench::); list_benchmark!(list, extra, pallet_bridge_relayers, RelayersBench::); let storage_info = AllPalletsWithSystem::storage_info(); @@ -964,7 +965,12 @@ impl_runtime_apis! { let mut batches = Vec::::new(); let params = (&config, &whitelist); - use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof_from_grandpa_chain, prepare_message_proof_from_grandpa_chain}; + use bridge_runtime_common::messages_benchmarking::{ + prepare_message_delivery_proof_from_grandpa_chain, + prepare_message_delivery_proof_from_parachain, + prepare_message_proof_from_grandpa_chain, + prepare_message_proof_from_parachain, + }; use pallet_bridge_messages::benchmarking::{ Pallet as MessagesBench, Config as MessagesConfig, @@ -980,28 +986,66 @@ impl_runtime_apis! { Config as RelayersConfig, }; use rialto_messages::WithRialtoMessageBridge; + use rialto_parachain_messages::WithRialtoParachainMessageBridge; + + impl MessagesConfig for Runtime { + fn prepare_message_proof( + params: MessageProofParams, + ) -> (rialto_messages::FromRialtoMessagesProof, Weight) { + prepare_message_proof_from_parachain::< + Runtime, + WithRialtoParachainsInstance, + WithRialtoParachainMessageBridge, + >(params) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams, + ) -> rialto_messages::ToRialtoMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + WithRialtoParachainsInstance, + WithRialtoParachainMessageBridge, + >(params) + } + + fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool { + use bridge_runtime_common::messages::MessageBridge; + + let lane = >::bench_lane_id(); + let bridged_chain_id = WithRialtoParachainMessageBridge::BRIDGED_CHAIN_ID; + pallet_bridge_relayers::Pallet::::relayer_reward( + relayer, + RewardsAccountParams::new(lane, bridged_chain_id, RewardsAccountOwner::BridgedChain) + ).is_some() + } + } impl MessagesConfig for Runtime { fn prepare_message_proof( params: MessageProofParams, ) -> (rialto_messages::FromRialtoMessagesProof, Weight) { - prepare_message_proof_from_grandpa_chain::( - params, - ) + prepare_message_proof_from_grandpa_chain::< + Runtime, + RialtoGrandpaInstance, + WithRialtoMessageBridge, + >(params) } fn prepare_message_delivery_proof( params: MessageDeliveryProofParams, ) -> rialto_messages::ToRialtoMessagesDeliveryProof { - prepare_message_delivery_proof_from_grandpa_chain::( - params, - ) + prepare_message_delivery_proof_from_grandpa_chain::< + Runtime, + RialtoGrandpaInstance, + WithRialtoMessageBridge, + >(params) } fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool { use bridge_runtime_common::messages::MessageBridge; - let lane = Self::bench_lane_id(); + let lane = >::bench_lane_id(); let bridged_chain_id = WithRialtoMessageBridge::BRIDGED_CHAIN_ID; pallet_bridge_relayers::Pallet::::relayer_reward( relayer, @@ -1026,7 +1070,10 @@ impl_runtime_apis! { bp_polkadot_core::parachains::ParaHeadsProof, Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, ) { - bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof::( + bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof::< + Runtime, + WithRialtoParachainsInstance, + >( parachains, parachain_head_size, proof_size, @@ -1051,7 +1098,13 @@ impl_runtime_apis! { add_benchmark!( params, batches, - pallet_bridge_messages, + RialtoParachainMessages, + MessagesBench:: + ); + add_benchmark!( + params, + batches, + RialtoMessages, MessagesBench:: ); add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa); diff --git a/scripts/update-weights.sh b/scripts/update-weights.sh index ac24da62b3c..84ddf0cdaae 100755 --- a/scripts/update-weights.sh +++ b/scripts/update-weights.sh @@ -10,7 +10,7 @@ time cargo run --release -p millau-bridge-node --features=runtime-benchmarks -- --chain=dev \ --steps=50 \ --repeat=20 \ - --pallet=pallet_bridge_messages \ + --pallet=RialtoMessages \ --extrinsic=* \ --execution=wasm \ --wasm-execution=Compiled \ From 188cd01563bc8b3537d042c6c8d5181b7cfcdac8 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 1 Mar 2023 17:31:29 +0300 Subject: [PATCH 2/3] trigger CI --- relays/messages/src/message_race_delivery.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relays/messages/src/message_race_delivery.rs b/relays/messages/src/message_race_delivery.rs index 8b8e690ec4a..2154ab63b2b 100644 --- a/relays/messages/src/message_race_delivery.rs +++ b/relays/messages/src/message_race_delivery.rs @@ -997,7 +997,7 @@ mod tests { ); assert_eq!(strategy.required_source_header_at_target(&header_id(2)), None); } - +aaa #[async_std::test] async fn relayer_uses_flattened_view_of_the_source_queue_to_select_nonces() { // Real scenario that has happened on test deployments: From 4a14f7006b69329e8e868948da0fdabce8121666 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 1 Mar 2023 17:31:36 +0300 Subject: [PATCH 3/3] Revert "trigger CI" This reverts commit 188cd01563bc8b3537d042c6c8d5181b7cfcdac8. --- relays/messages/src/message_race_delivery.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relays/messages/src/message_race_delivery.rs b/relays/messages/src/message_race_delivery.rs index 2154ab63b2b..8b8e690ec4a 100644 --- a/relays/messages/src/message_race_delivery.rs +++ b/relays/messages/src/message_race_delivery.rs @@ -997,7 +997,7 @@ mod tests { ); assert_eq!(strategy.required_source_header_at_target(&header_id(2)), None); } -aaa + #[async_std::test] async fn relayer_uses_flattened_view_of_the_source_queue_to_select_nonces() { // Real scenario that has happened on test deployments: