From 19c87db1398973f407ab67d22cf2ff35276e295c Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Sat, 30 Jan 2021 00:25:33 +0300 Subject: [PATCH] Add proof-size related benchmarks to message lane module (#675) * fix benchmakrs + proof-size related benchmarks * Update modules/message-lane/src/benchmarking.rs Co-authored-by: Hernando Castano Co-authored-by: Hernando Castano --- bridges/bin/rialto/runtime/src/lib.rs | 4 +- .../src/messages_benchmarking.rs | 48 ++++++- .../modules/message-lane/src/benchmarking.rs | 130 +++++++++++++++--- bridges/modules/message-lane/src/lib.rs | 4 +- bridges/modules/message-lane/src/weights.rs | 106 ++++++++------ 5 files changed, 220 insertions(+), 72 deletions(-) diff --git a/bridges/bin/rialto/runtime/src/lib.rs b/bridges/bin/rialto/runtime/src/lib.rs index 35f16540d4..d45164f6ad 100644 --- a/bridges/bin/rialto/runtime/src/lib.rs +++ b/bridges/bin/rialto/runtime/src/lib.rs @@ -847,7 +847,7 @@ impl_runtime_apis! { fn endow_account(account: &Self::AccountId) { pallet_balances::Module::::make_free_balance_be( account, - 1_000_000_000_000, + Balance::MAX / 100, ); } @@ -865,7 +865,7 @@ impl_runtime_apis! { origin: dispatch_origin, call: message_payload, }; - (message, 1_000_000_000) + (message, pallet_message_lane::benchmarking::MESSAGE_FEE.into()) } fn prepare_message_proof( diff --git a/bridges/bin/runtime-common/src/messages_benchmarking.rs b/bridges/bin/runtime-common/src/messages_benchmarking.rs index 70cbb76f43..fdae3a7fcc 100644 --- a/bridges/bin/runtime-common/src/messages_benchmarking.rs +++ b/bridges/bin/runtime-common/src/messages_benchmarking.rs @@ -28,11 +28,13 @@ use bp_message_lane::{LaneId, MessageData, MessageKey, MessagePayload}; use codec::Encode; use ed25519_dalek::{PublicKey, SecretKey, Signer, KEYPAIR_LENGTH, SECRET_KEY_LENGTH}; use frame_support::weights::Weight; -use pallet_message_lane::benchmarking::{MessageDeliveryProofParams, MessageProofParams}; +use pallet_message_lane::benchmarking::{MessageDeliveryProofParams, MessageProofParams, ProofSize}; use sp_core::Hasher; use sp_runtime::traits::Header; use sp_std::prelude::*; -use sp_trie::{read_trie_value_with, trie_types::TrieDBMut, Layout, MemoryDB, Recorder, StorageProof, TrieMut}; +use sp_trie::{ + read_trie_value_with, record_all_keys, trie_types::TrieDBMut, Layout, MemoryDB, Recorder, StorageProof, TrieMut, +}; /// Generate ed25519 signature to be used in `pallet_brdige_call_dispatch::CallOrigin::TargetAccount`. /// @@ -117,14 +119,13 @@ where storage_keys.push(storage_key); } } + root = grow_trie(root, &mut mdb, params.size); // generate storage proof to be delivered to This chain let mut proof_recorder = Recorder::::new(); - for storage_key in storage_keys { - read_trie_value_with::, _, _>(&mdb, &root, &storage_key, &mut proof_recorder) - .map_err(|_| "read_trie_value_with has failed") - .expect("read_trie_value_with should not fail in benchmarks"); - } + record_all_keys::, _>(&mdb, &root, &mut proof_recorder) + .map_err(|_| "record_all_keys has failed") + .expect("record_all_keys should not fail in benchmarks"); let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect(); // prepare Bridged chain header and insert it into the Substrate pallet @@ -189,3 +190,36 @@ where params.lane, ) } + +/// Populate trie with dummy keys+values until trie has (approximately) at least given size. +fn grow_trie(mut root: H::Out, mdb: &mut MemoryDB, trie_size: ProofSize) -> H::Out { + let (iterations, leaf_size, minimal_trie_size) = match trie_size { + ProofSize::Minimal => return root, + ProofSize::HasLargeLeaf(size) => (1, size, size), + ProofSize::HasExtraNodes(size) => (8, 1, size), + }; + + let mut key_index = 0; + loop { + // generate storage proof to be delivered to This chain + let mut proof_recorder = Recorder::::new(); + record_all_keys::, _>(mdb, &root, &mut proof_recorder) + .map_err(|_| "record_all_keys has failed") + .expect("record_all_keys should not fail in benchmarks"); + let size: usize = proof_recorder.drain().into_iter().map(|n| n.data.len()).sum(); + if size > minimal_trie_size as _ { + return root; + } + + let mut trie = TrieDBMut::::from_existing(mdb, &mut root) + .map_err(|_| "TrieDBMut::from_existing has failed") + .expect("TrieDBMut::from_existing should not fail in benchmarks"); + for _ in 0..iterations { + trie.insert(&key_index.encode(), &vec![42u8; leaf_size as _]) + .map_err(|_| "TrieMut::insert has failed") + .expect("TrieMut::insert should not fail in benchmarks"); + key_index += 1; + } + trie.commit(); + } +} diff --git a/bridges/modules/message-lane/src/benchmarking.rs b/bridges/modules/message-lane/src/benchmarking.rs index c9a27a4d9e..0ad445385f 100644 --- a/bridges/modules/message-lane/src/benchmarking.rs +++ b/bridges/modules/message-lane/src/benchmarking.rs @@ -28,13 +28,25 @@ use frame_system::RawOrigin; use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, ops::RangeInclusive, prelude::*}; /// Fee paid by submitter for single message delivery. -const MESSAGE_FEE: u32 = 1_000_000; +pub const MESSAGE_FEE: u64 = 10_000_000_000; const SEED: u32 = 0; /// Module we're benchmarking here. pub struct Module, I: crate::Instance>(crate::Module); +/// Proof size requirements. +pub enum ProofSize { + /// The proof is expected to be minimal. + Minimal, + /// The proof is expected to have at least given size and grow by increasing number of trie nodes + /// included in the proof. + HasExtraNodes(u32), + /// The proof is expected to have at least given size and grow by increasing value that is stored + /// in the trie. + HasLargeLeaf(u32), +} + /// Benchmark-specific message parameters. pub struct MessageParams { /// Size of the message payload. @@ -51,6 +63,8 @@ pub struct MessageProofParams { pub message_nonces: RangeInclusive, /// If `Some`, the proof needs to include this outbound lane data. pub outbound_lane_data: Option, + /// Proof size requirements. + pub size: ProofSize, } /// Benchmark-specific message delivery proof parameters. @@ -214,6 +228,7 @@ benchmarks_instance! { lane: bench_lane_id(), message_nonces: 1..=1, outbound_lane_data: None, + size: ProofSize::Minimal, }); }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { @@ -241,6 +256,7 @@ benchmarks_instance! { lane: bench_lane_id(), message_nonces: 1..=2, outbound_lane_data: None, + size: ProofSize::Minimal, }); }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight) verify { @@ -275,6 +291,7 @@ benchmarks_instance! { latest_received_nonce: 20, latest_generated_nonce: 21, }), + size: ProofSize::Minimal, }); }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { @@ -353,10 +370,7 @@ benchmarks_instance! { }); }: receive_messages_delivery_proof(RawOrigin::Signed(relayer_id.clone()), proof, relayers_state) verify { - assert_eq!( - T::account_balance(&relayer_id), - relayer_balance + (MESSAGE_FEE * 2).into(), - ); + ensure_relayer_rewarded::(&relayer_id, &relayer_balance); } // Benchmark `receive_messages_delivery_proof` extrinsic with following conditions: @@ -395,14 +409,8 @@ benchmarks_instance! { }); }: receive_messages_delivery_proof(RawOrigin::Signed(relayer1_id.clone()), proof, relayers_state) verify { - assert_eq!( - T::account_balance(&relayer1_id), - relayer1_balance + MESSAGE_FEE.into(), - ); - assert_eq!( - T::account_balance(&relayer2_id), - relayer2_balance + MESSAGE_FEE.into(), - ); + ensure_relayer_rewarded::(&relayer1_id, &relayer1_balance); + ensure_relayer_rewarded::(&relayer2_id, &relayer2_balance); } // @@ -461,6 +469,7 @@ benchmarks_instance! { lane: bench_lane_id(), message_nonces: 1..=i as _, outbound_lane_data: None, + size: ProofSize::Minimal, }); }: receive_messages_proof( RawOrigin::Signed(relayer_id_on_target), @@ -503,6 +512,7 @@ benchmarks_instance! { latest_received_nonce: 20, latest_generated_nonce: 21, }), + size: ProofSize::Minimal, }); }: receive_messages_proof( RawOrigin::Signed(relayer_id_on_target), @@ -522,6 +532,80 @@ benchmarks_instance! { ); } + // Benchmark `receive_messages_proof` extrinsic with single minimal-weight message and following conditions: + // * proof does not include outbound lane state proof; + // * inbound lane already has state, so it needs to be read and decoded; + // * message is successfully dispatched; + // * message requires all heavy checks done by dispatcher. + // + // Results of this benchmark may be used to check how extra nodes in proof affect transaction performance. + receive_message_proofs_with_extra_nodes { + let i in 0..T::maximal_message_size(); + + let relayer_id_on_source = T::bridged_relayer_id(); + let relayer_id_on_target = account("relayer", 0, SEED); + let messages_count = 1u32; + + // mark messages 1..=20 as delivered + receive_messages::(20); + + let (proof, dispatch_weight) = T::prepare_message_proof(MessageProofParams { + lane: bench_lane_id(), + message_nonces: 21..=21, + outbound_lane_data: None, + size: ProofSize::HasExtraNodes(i as _), + }); + }: receive_messages_proof( + RawOrigin::Signed(relayer_id_on_target), + relayer_id_on_source, + proof, + messages_count, + dispatch_weight + ) + verify { + assert_eq!( + crate::Module::::inbound_latest_received_nonce(bench_lane_id()), + 21, + ); + } + + // Benchmark `receive_messages_proof` extrinsic with single minimal-weight message and following conditions: + // * proof does not include outbound lane state proof; + // * inbound lane already has state, so it needs to be read and decoded; + // * message is successfully dispatched; + // * message requires all heavy checks done by dispatcher. + // + // Results of this benchmark may be used to check how large (extra) leaf in proof affect transaction performance. + receive_message_proofs_with_large_leaf { + let i in 0..T::maximal_message_size(); + + let relayer_id_on_source = T::bridged_relayer_id(); + let relayer_id_on_target = account("relayer", 0, SEED); + let messages_count = 1u32; + + // mark messages 1..=20 as delivered + receive_messages::(20); + + let (proof, dispatch_weight) = T::prepare_message_proof(MessageProofParams { + lane: bench_lane_id(), + message_nonces: 21..=21, + outbound_lane_data: None, + size: ProofSize::HasLargeLeaf(i as _), + }); + }: receive_messages_proof( + RawOrigin::Signed(relayer_id_on_target), + relayer_id_on_source, + proof, + messages_count, + dispatch_weight + ) + verify { + assert_eq!( + crate::Module::::inbound_latest_received_nonce(bench_lane_id()), + 21, + ); + } + // Benchmark `receive_messages_delivery_proof` extrinsic where single relayer delivers multiple messages. receive_delivery_proof_for_multiple_messages_by_single_relayer { // there actually should be used value of `MaxUnrewardedRelayerEntriesAtInboundLane` from the bridged @@ -554,10 +638,7 @@ benchmarks_instance! { }); }: receive_messages_delivery_proof(RawOrigin::Signed(relayer_id.clone()), proof, relayers_state) verify { - assert_eq!( - T::account_balance(&relayer_id), - relayer_balance + (MESSAGE_FEE * i).into(), - ); + ensure_relayer_rewarded::(&relayer_id, &relayer_balance); } // Benchmark `receive_messages_delivery_proof` extrinsic where every relayer delivers single messages. @@ -603,10 +684,7 @@ benchmarks_instance! { }: receive_messages_delivery_proof(RawOrigin::Signed(confirmation_relayer_id), proof, relayers_state) verify { for (relayer_id, prev_balance) in relayers { - assert_eq!( - T::account_balance(&relayer_id), - prev_balance + MESSAGE_FEE.into(), - ); + ensure_relayer_rewarded::(&relayer_id, &prev_balance); } } } @@ -635,3 +713,13 @@ fn receive_messages, I: Instance>(nonce: MessageNonce) { last_confirmed_nonce: 0, }); } + +fn ensure_relayer_rewarded, I: Instance>(relayer_id: &T::AccountId, old_balance: &T::OutboundMessageFee) { + let new_balance = T::account_balance(relayer_id); + assert!( + new_balance > *old_balance, + "Relayer haven't received reward for relaying message: old balance = {:?}, new balance = {:?}", + old_balance, + new_balance, + ); +} diff --git a/bridges/modules/message-lane/src/lib.rs b/bridges/modules/message-lane/src/lib.rs index 9c44e7289b..eccebc1fcc 100644 --- a/bridges/modules/message-lane/src/lib.rs +++ b/bridges/modules/message-lane/src/lib.rs @@ -57,7 +57,7 @@ use frame_support::{ use frame_system::{ensure_signed, RawOrigin}; use num_traits::{SaturatingAdd, Zero}; use sp_runtime::{traits::BadOrigin, DispatchResult}; -use sp_std::{cell::RefCell, marker::PhantomData, prelude::*}; +use sp_std::{cell::RefCell, cmp::PartialOrd, marker::PhantomData, prelude::*}; mod inbound_lane; mod outbound_lane; @@ -110,7 +110,7 @@ pub trait Config: frame_system::Config { /// Payload type of outbound messages. This payload is dispatched on the bridged chain. type OutboundPayload: Parameter + Size; /// Message fee type of outbound messages. This fee is paid on this chain. - type OutboundMessageFee: Default + From + Parameter + SaturatingAdd + Zero; + type OutboundMessageFee: Default + From + PartialOrd + Parameter + SaturatingAdd + Zero; /// Payload type of inbound messages. This payload is dispatched on this chain. type InboundPayload: Decode; diff --git a/bridges/modules/message-lane/src/weights.rs b/bridges/modules/message-lane/src/weights.rs index 016af708a6..33a84ecbaf 100644 --- a/bridges/modules/message-lane/src/weights.rs +++ b/bridges/modules/message-lane/src/weights.rs @@ -16,8 +16,8 @@ //! Autogenerated weights for pallet_message_lane //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-12-28, STEPS: [50, ], REPEAT: 20 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.1 +//! DATE: 2021-01-25, STEPS: [50, ], REPEAT: 20 //! LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled //! CHAIN: Some("local"), DB CACHE: 128 @@ -60,6 +60,8 @@ pub trait WeightInfo { fn send_messages_of_various_lengths(i: u32) -> Weight; fn receive_multiple_messages_proof(i: u32) -> Weight; fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight; + fn receive_message_proofs_with_extra_nodes(i: u32) -> Weight; + fn receive_message_proofs_with_large_leaf(i: u32) -> Weight; fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight; fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight; } @@ -68,81 +70,93 @@ pub trait WeightInfo { pub struct RialtoWeight(PhantomData); impl WeightInfo for RialtoWeight { fn send_minimal_message_worst_case() -> Weight { - (249_486_000 as Weight) + (123_511_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn send_1_kb_message_worst_case() -> Weight { - (257_454_000 as Weight) + (132_218_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn send_16_kb_message_worst_case() -> Weight { - (344_817_000 as Weight) + (187_458_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn receive_single_message_proof() -> Weight { - (197_341_000 as Weight) + (156_005_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_two_messages_proof() -> Weight { - (341_056_000 as Weight) + (266_292_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_with_outbound_lane_state() -> Weight { - (227_735_000 as Weight) + (171_319_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_single_message() -> Weight { - (208_305_000 as Weight) + (127_537_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { - (239_511_000 as Weight) + (135_281_000 as Weight) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { - (341_307_000 as Weight) + (180_862_000 as Weight) .saturating_add(T::DbWeight::get().reads(8 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn send_messages_of_various_lengths(i: u32) -> Weight { - (206_352_000 as Weight) - .saturating_add((5_000 as Weight).saturating_mul(i as Weight)) + (98_452_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(12 as Weight)) } fn receive_multiple_messages_proof(i: u32) -> Weight { (0 as Weight) - .saturating_add((157_613_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((124_098_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight { (0 as Weight) - .saturating_add((166_416_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((128_267_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn receive_message_proofs_with_extra_nodes(i: u32) -> Weight { + (437_756_000 as Weight) + .saturating_add((10_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn receive_message_proofs_with_large_leaf(i: u32) -> Weight { + (164_484_000 as Weight) + .saturating_add((7_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight { - (107_561_000 as Weight) - .saturating_add((12_218_000 as Weight).saturating_mul(i as Weight)) + (122_609_000 as Weight) + .saturating_add((7_289_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight { - (124_619_000 as Weight) - .saturating_add((104_750_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) + (129_622_000 as Weight) + .saturating_add((53_214_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } } @@ -150,81 +164,93 @@ impl WeightInfo for RialtoWeight { // For backwards compatibility and tests impl WeightInfo for () { fn send_minimal_message_worst_case() -> Weight { - (249_486_000 as Weight) + (123_511_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn send_1_kb_message_worst_case() -> Weight { - (257_454_000 as Weight) + (132_218_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn send_16_kb_message_worst_case() -> Weight { - (344_817_000 as Weight) + (187_458_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn receive_single_message_proof() -> Weight { - (197_341_000 as Weight) + (156_005_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_two_messages_proof() -> Weight { - (341_056_000 as Weight) + (266_292_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_single_message_proof_with_outbound_lane_state() -> Weight { - (227_735_000 as Weight) + (171_319_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_single_message() -> Weight { - (208_305_000 as Weight) + (127_537_000 as Weight) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { - (239_511_000 as Weight) + (135_281_000 as Weight) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { - (341_307_000 as Weight) + (180_862_000 as Weight) .saturating_add(RocksDbWeight::get().reads(8 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn send_messages_of_various_lengths(i: u32) -> Weight { - (206_352_000 as Weight) - .saturating_add((5_000 as Weight).saturating_mul(i as Weight)) + (98_452_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(12 as Weight)) } fn receive_multiple_messages_proof(i: u32) -> Weight { (0 as Weight) - .saturating_add((157_613_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((124_098_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight { (0 as Weight) - .saturating_add((166_416_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((128_267_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn receive_message_proofs_with_extra_nodes(i: u32) -> Weight { + (437_756_000 as Weight) + .saturating_add((10_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn receive_message_proofs_with_large_leaf(i: u32) -> Weight { + (164_484_000 as Weight) + .saturating_add((7_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight { - (107_561_000 as Weight) - .saturating_add((12_218_000 as Weight).saturating_mul(i as Weight)) + (122_609_000 as Weight) + .saturating_add((7_289_000 as Weight).saturating_mul(i as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight { - (124_619_000 as Weight) - .saturating_add((104_750_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + (129_622_000 as Weight) + .saturating_add((53_214_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } }