mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
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 <HCastano@users.noreply.github.com> Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
This commit is contained in:
committed by
Bastian Köcher
parent
ac1d12e607
commit
19c87db139
@@ -847,7 +847,7 @@ impl_runtime_apis! {
|
|||||||
fn endow_account(account: &Self::AccountId) {
|
fn endow_account(account: &Self::AccountId) {
|
||||||
pallet_balances::Module::<Runtime>::make_free_balance_be(
|
pallet_balances::Module::<Runtime>::make_free_balance_be(
|
||||||
account,
|
account,
|
||||||
1_000_000_000_000,
|
Balance::MAX / 100,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,7 +865,7 @@ impl_runtime_apis! {
|
|||||||
origin: dispatch_origin,
|
origin: dispatch_origin,
|
||||||
call: message_payload,
|
call: message_payload,
|
||||||
};
|
};
|
||||||
(message, 1_000_000_000)
|
(message, pallet_message_lane::benchmarking::MESSAGE_FEE.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_message_proof(
|
fn prepare_message_proof(
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ use bp_message_lane::{LaneId, MessageData, MessageKey, MessagePayload};
|
|||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use ed25519_dalek::{PublicKey, SecretKey, Signer, KEYPAIR_LENGTH, SECRET_KEY_LENGTH};
|
use ed25519_dalek::{PublicKey, SecretKey, Signer, KEYPAIR_LENGTH, SECRET_KEY_LENGTH};
|
||||||
use frame_support::weights::Weight;
|
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_core::Hasher;
|
||||||
use sp_runtime::traits::Header;
|
use sp_runtime::traits::Header;
|
||||||
use sp_std::prelude::*;
|
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`.
|
/// Generate ed25519 signature to be used in `pallet_brdige_call_dispatch::CallOrigin::TargetAccount`.
|
||||||
///
|
///
|
||||||
@@ -117,14 +119,13 @@ where
|
|||||||
storage_keys.push(storage_key);
|
storage_keys.push(storage_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
root = grow_trie(root, &mut mdb, params.size);
|
||||||
|
|
||||||
// generate storage proof to be delivered to This chain
|
// generate storage proof to be delivered to This chain
|
||||||
let mut proof_recorder = Recorder::<H::Out>::new();
|
let mut proof_recorder = Recorder::<H::Out>::new();
|
||||||
for storage_key in storage_keys {
|
record_all_keys::<Layout<H>, _>(&mdb, &root, &mut proof_recorder)
|
||||||
read_trie_value_with::<Layout<H>, _, _>(&mdb, &root, &storage_key, &mut proof_recorder)
|
.map_err(|_| "record_all_keys has failed")
|
||||||
.map_err(|_| "read_trie_value_with has failed")
|
.expect("record_all_keys should not fail in benchmarks");
|
||||||
.expect("read_trie_value_with should not fail in benchmarks");
|
|
||||||
}
|
|
||||||
let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect();
|
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
|
// prepare Bridged chain header and insert it into the Substrate pallet
|
||||||
@@ -189,3 +190,36 @@ where
|
|||||||
params.lane,
|
params.lane,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Populate trie with dummy keys+values until trie has (approximately) at least given size.
|
||||||
|
fn grow_trie<H: Hasher>(mut root: H::Out, mdb: &mut MemoryDB<H>, 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::<H::Out>::new();
|
||||||
|
record_all_keys::<Layout<H>, _>(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::<H>::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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,13 +28,25 @@ use frame_system::RawOrigin;
|
|||||||
use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, ops::RangeInclusive, prelude::*};
|
use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, ops::RangeInclusive, prelude::*};
|
||||||
|
|
||||||
/// Fee paid by submitter for single message delivery.
|
/// 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;
|
const SEED: u32 = 0;
|
||||||
|
|
||||||
/// Module we're benchmarking here.
|
/// Module we're benchmarking here.
|
||||||
pub struct Module<T: Config<I>, I: crate::Instance>(crate::Module<T, I>);
|
pub struct Module<T: Config<I>, I: crate::Instance>(crate::Module<T, I>);
|
||||||
|
|
||||||
|
/// 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.
|
/// Benchmark-specific message parameters.
|
||||||
pub struct MessageParams<ThisAccountId> {
|
pub struct MessageParams<ThisAccountId> {
|
||||||
/// Size of the message payload.
|
/// Size of the message payload.
|
||||||
@@ -51,6 +63,8 @@ pub struct MessageProofParams {
|
|||||||
pub message_nonces: RangeInclusive<MessageNonce>,
|
pub message_nonces: RangeInclusive<MessageNonce>,
|
||||||
/// If `Some`, the proof needs to include this outbound lane data.
|
/// If `Some`, the proof needs to include this outbound lane data.
|
||||||
pub outbound_lane_data: Option<OutboundLaneData>,
|
pub outbound_lane_data: Option<OutboundLaneData>,
|
||||||
|
/// Proof size requirements.
|
||||||
|
pub size: ProofSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Benchmark-specific message delivery proof parameters.
|
/// Benchmark-specific message delivery proof parameters.
|
||||||
@@ -214,6 +228,7 @@ benchmarks_instance! {
|
|||||||
lane: bench_lane_id(),
|
lane: bench_lane_id(),
|
||||||
message_nonces: 1..=1,
|
message_nonces: 1..=1,
|
||||||
outbound_lane_data: None,
|
outbound_lane_data: None,
|
||||||
|
size: ProofSize::Minimal,
|
||||||
});
|
});
|
||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
@@ -241,6 +256,7 @@ benchmarks_instance! {
|
|||||||
lane: bench_lane_id(),
|
lane: bench_lane_id(),
|
||||||
message_nonces: 1..=2,
|
message_nonces: 1..=2,
|
||||||
outbound_lane_data: None,
|
outbound_lane_data: None,
|
||||||
|
size: ProofSize::Minimal,
|
||||||
});
|
});
|
||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
@@ -275,6 +291,7 @@ benchmarks_instance! {
|
|||||||
latest_received_nonce: 20,
|
latest_received_nonce: 20,
|
||||||
latest_generated_nonce: 21,
|
latest_generated_nonce: 21,
|
||||||
}),
|
}),
|
||||||
|
size: ProofSize::Minimal,
|
||||||
});
|
});
|
||||||
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
}: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight)
|
||||||
verify {
|
verify {
|
||||||
@@ -353,10 +370,7 @@ benchmarks_instance! {
|
|||||||
});
|
});
|
||||||
}: receive_messages_delivery_proof(RawOrigin::Signed(relayer_id.clone()), proof, relayers_state)
|
}: receive_messages_delivery_proof(RawOrigin::Signed(relayer_id.clone()), proof, relayers_state)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
ensure_relayer_rewarded::<T, I>(&relayer_id, &relayer_balance);
|
||||||
T::account_balance(&relayer_id),
|
|
||||||
relayer_balance + (MESSAGE_FEE * 2).into(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Benchmark `receive_messages_delivery_proof` extrinsic with following conditions:
|
// 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)
|
}: receive_messages_delivery_proof(RawOrigin::Signed(relayer1_id.clone()), proof, relayers_state)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
ensure_relayer_rewarded::<T, I>(&relayer1_id, &relayer1_balance);
|
||||||
T::account_balance(&relayer1_id),
|
ensure_relayer_rewarded::<T, I>(&relayer2_id, &relayer2_balance);
|
||||||
relayer1_balance + MESSAGE_FEE.into(),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
T::account_balance(&relayer2_id),
|
|
||||||
relayer2_balance + MESSAGE_FEE.into(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -461,6 +469,7 @@ benchmarks_instance! {
|
|||||||
lane: bench_lane_id(),
|
lane: bench_lane_id(),
|
||||||
message_nonces: 1..=i as _,
|
message_nonces: 1..=i as _,
|
||||||
outbound_lane_data: None,
|
outbound_lane_data: None,
|
||||||
|
size: ProofSize::Minimal,
|
||||||
});
|
});
|
||||||
}: receive_messages_proof(
|
}: receive_messages_proof(
|
||||||
RawOrigin::Signed(relayer_id_on_target),
|
RawOrigin::Signed(relayer_id_on_target),
|
||||||
@@ -503,6 +512,7 @@ benchmarks_instance! {
|
|||||||
latest_received_nonce: 20,
|
latest_received_nonce: 20,
|
||||||
latest_generated_nonce: 21,
|
latest_generated_nonce: 21,
|
||||||
}),
|
}),
|
||||||
|
size: ProofSize::Minimal,
|
||||||
});
|
});
|
||||||
}: receive_messages_proof(
|
}: receive_messages_proof(
|
||||||
RawOrigin::Signed(relayer_id_on_target),
|
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::<T, I>(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::<T, I>::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::<T, I>(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::<T, I>::inbound_latest_received_nonce(bench_lane_id()),
|
||||||
|
21,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Benchmark `receive_messages_delivery_proof` extrinsic where single relayer delivers multiple messages.
|
// Benchmark `receive_messages_delivery_proof` extrinsic where single relayer delivers multiple messages.
|
||||||
receive_delivery_proof_for_multiple_messages_by_single_relayer {
|
receive_delivery_proof_for_multiple_messages_by_single_relayer {
|
||||||
// there actually should be used value of `MaxUnrewardedRelayerEntriesAtInboundLane` from the bridged
|
// 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)
|
}: receive_messages_delivery_proof(RawOrigin::Signed(relayer_id.clone()), proof, relayers_state)
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(
|
ensure_relayer_rewarded::<T, I>(&relayer_id, &relayer_balance);
|
||||||
T::account_balance(&relayer_id),
|
|
||||||
relayer_balance + (MESSAGE_FEE * i).into(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Benchmark `receive_messages_delivery_proof` extrinsic where every relayer delivers single messages.
|
// 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)
|
}: receive_messages_delivery_proof(RawOrigin::Signed(confirmation_relayer_id), proof, relayers_state)
|
||||||
verify {
|
verify {
|
||||||
for (relayer_id, prev_balance) in relayers {
|
for (relayer_id, prev_balance) in relayers {
|
||||||
assert_eq!(
|
ensure_relayer_rewarded::<T, I>(&relayer_id, &prev_balance);
|
||||||
T::account_balance(&relayer_id),
|
|
||||||
prev_balance + MESSAGE_FEE.into(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -635,3 +713,13 @@ fn receive_messages<T: Config<I>, I: Instance>(nonce: MessageNonce) {
|
|||||||
last_confirmed_nonce: 0,
|
last_confirmed_nonce: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ensure_relayer_rewarded<T: Config<I>, 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ use frame_support::{
|
|||||||
use frame_system::{ensure_signed, RawOrigin};
|
use frame_system::{ensure_signed, RawOrigin};
|
||||||
use num_traits::{SaturatingAdd, Zero};
|
use num_traits::{SaturatingAdd, Zero};
|
||||||
use sp_runtime::{traits::BadOrigin, DispatchResult};
|
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 inbound_lane;
|
||||||
mod outbound_lane;
|
mod outbound_lane;
|
||||||
@@ -110,7 +110,7 @@ pub trait Config<I = DefaultInstance>: frame_system::Config {
|
|||||||
/// Payload type of outbound messages. This payload is dispatched on the bridged chain.
|
/// Payload type of outbound messages. This payload is dispatched on the bridged chain.
|
||||||
type OutboundPayload: Parameter + Size;
|
type OutboundPayload: Parameter + Size;
|
||||||
/// Message fee type of outbound messages. This fee is paid on this chain.
|
/// Message fee type of outbound messages. This fee is paid on this chain.
|
||||||
type OutboundMessageFee: Default + From<u32> + Parameter + SaturatingAdd + Zero;
|
type OutboundMessageFee: Default + From<u64> + PartialOrd + Parameter + SaturatingAdd + Zero;
|
||||||
|
|
||||||
/// Payload type of inbound messages. This payload is dispatched on this chain.
|
/// Payload type of inbound messages. This payload is dispatched on this chain.
|
||||||
type InboundPayload: Decode;
|
type InboundPayload: Decode;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
//! Autogenerated weights for pallet_message_lane
|
//! Autogenerated weights for pallet_message_lane
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.1
|
||||||
//! DATE: 2020-12-28, STEPS: [50, ], REPEAT: 20
|
//! DATE: 2021-01-25, STEPS: [50, ], REPEAT: 20
|
||||||
//! LOW RANGE: [], HIGH RANGE: []
|
//! LOW RANGE: [], HIGH RANGE: []
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
|
||||||
//! CHAIN: Some("local"), DB CACHE: 128
|
//! CHAIN: Some("local"), DB CACHE: 128
|
||||||
@@ -60,6 +60,8 @@ pub trait WeightInfo {
|
|||||||
fn send_messages_of_various_lengths(i: u32) -> Weight;
|
fn send_messages_of_various_lengths(i: u32) -> Weight;
|
||||||
fn receive_multiple_messages_proof(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_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_single_relayer(i: u32) -> Weight;
|
||||||
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(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<T>(PhantomData<T>);
|
pub struct RialtoWeight<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
|
impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
|
||||||
fn send_minimal_message_worst_case() -> Weight {
|
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().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn send_1_kb_message_worst_case() -> 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().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn send_16_kb_message_worst_case() -> 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().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_single_message_proof() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_two_messages_proof() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_single_message_proof_with_outbound_lane_state() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_single_message() -> 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().reads(6 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> 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().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> 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().reads(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
fn send_messages_of_various_lengths(i: u32) -> Weight {
|
fn send_messages_of_various_lengths(i: u32) -> Weight {
|
||||||
(206_352_000 as Weight)
|
(98_452_000 as Weight)
|
||||||
.saturating_add((5_000 as Weight).saturating_mul(i 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().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_multiple_messages_proof(i: u32) -> Weight {
|
fn receive_multiple_messages_proof(i: u32) -> Weight {
|
||||||
(0 as 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().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight {
|
fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight {
|
||||||
(0 as 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().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight {
|
fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight {
|
||||||
(107_561_000 as Weight)
|
(122_609_000 as Weight)
|
||||||
.saturating_add((12_218_000 as Weight).saturating_mul(i 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(5 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i 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))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight {
|
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight {
|
||||||
(124_619_000 as Weight)
|
(129_622_000 as Weight)
|
||||||
.saturating_add((104_750_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((53_214_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(4 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().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)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,81 +164,93 @@ impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
|
|||||||
// For backwards compatibility and tests
|
// For backwards compatibility and tests
|
||||||
impl WeightInfo for () {
|
impl WeightInfo for () {
|
||||||
fn send_minimal_message_worst_case() -> Weight {
|
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().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn send_1_kb_message_worst_case() -> 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().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn send_16_kb_message_worst_case() -> 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().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_single_message_proof() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_two_messages_proof() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_single_message_proof_with_outbound_lane_state() -> 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().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_single_message() -> 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().reads(6 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> 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().reads(7 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> 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().reads(8 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
fn send_messages_of_various_lengths(i: u32) -> Weight {
|
fn send_messages_of_various_lengths(i: u32) -> Weight {
|
||||||
(206_352_000 as Weight)
|
(98_452_000 as Weight)
|
||||||
.saturating_add((5_000 as Weight).saturating_mul(i 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().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_multiple_messages_proof(i: u32) -> Weight {
|
fn receive_multiple_messages_proof(i: u32) -> Weight {
|
||||||
(0 as 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().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight {
|
fn receive_multiple_messages_proof_with_outbound_lane_state(i: u32) -> Weight {
|
||||||
(0 as 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().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight {
|
fn receive_delivery_proof_for_multiple_messages_by_single_relayer(i: u32) -> Weight {
|
||||||
(107_561_000 as Weight)
|
(122_609_000 as Weight)
|
||||||
.saturating_add((12_218_000 as Weight).saturating_mul(i 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(5 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight {
|
fn receive_delivery_proof_for_multiple_messages_by_multiple_relayers(i: u32) -> Weight {
|
||||||
(124_619_000 as Weight)
|
(129_622_000 as Weight)
|
||||||
.saturating_add((104_750_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((53_214_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 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().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)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user