prepare benchmarks and update default weights
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
5dd0c73f7a
commit
4e1a3de6de
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ghost-slow-clap"
|
name = "ghost-slow-clap"
|
||||||
version = "0.4.16"
|
version = "0.4.17"
|
||||||
description = "Applause protocol for the EVM bridge"
|
description = "Applause protocol for the EVM bridge"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|||||||
@ -114,6 +114,36 @@ benchmarks! {
|
|||||||
assert_eq!(stored_commitment.last_updated, 1337);
|
assert_eq!(stored_commitment.last_updated, 1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try_offend_validators {
|
||||||
|
let n in 4 .. T::MaxAuthorities::get();
|
||||||
|
|
||||||
|
let session_index = T::ValidatorSet::session_index();
|
||||||
|
let mut validators_vec = Vec::new();
|
||||||
|
|
||||||
|
for i in 0..T::MaxAuthorities::get() {
|
||||||
|
let v = account("validator", i, 0);
|
||||||
|
validators_vec.push(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
let validators = WeakBoundedVec::<ValidatorId<T>, T::MaxAuthorities>::try_from(validators_vec)
|
||||||
|
.expect("weak bounded vec should be constructed; qed");
|
||||||
|
|
||||||
|
let offence_type = OffenceType::CommitmentOffence;
|
||||||
|
let disabled_bitmap = BitMap::new(T::MaxAuthorities::get());
|
||||||
|
let mut offence_bitmap = BitMap::new(T::MaxAuthorities::get());
|
||||||
|
for i in 0 .. (n / 3) {
|
||||||
|
offence_bitmap.set(i);
|
||||||
|
}
|
||||||
|
}: {
|
||||||
|
let _ = Pallet::<T>::try_offend_validators(
|
||||||
|
&session_index,
|
||||||
|
&validators,
|
||||||
|
offence_bitmap,
|
||||||
|
disabled_bitmap,
|
||||||
|
offence_type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
impl_benchmark_test_suite!(
|
impl_benchmark_test_suite!(
|
||||||
Pallet,
|
Pallet,
|
||||||
crate::mock::new_test_ext(),
|
crate::mock::new_test_ext(),
|
||||||
|
|||||||
@ -84,11 +84,28 @@ impl WeightInfo for () {
|
|||||||
.saturating_add(RocksDbWeight::get().writes(7))
|
.saturating_add(RocksDbWeight::get().writes(7))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit_block()-> Weight {
|
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
|
||||||
Default::default()
|
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
|
/// Storage: `GhostSlowClaps::BlockCommitments` (r:1 w:1)
|
||||||
|
/// Proof: `GhostSlowClaps::BlockCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
|
/// Storage: `Session::CurrentIndex` (r:1 w:0)
|
||||||
|
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
|
/// Storage: `GhostSlowClaps::Validators` (r:1 w:0)
|
||||||
|
/// Proof: `GhostSlowClaps::Validators` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
|
/// Storage: `GhostSlowClaps::DisabledAuthorityIndexes` (r:1 w:0)
|
||||||
|
/// Proof: `GhostSlowClaps::DisabledAuthorityIndexes` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
|
fn commit_block() -> Weight {
|
||||||
|
// Proof Size summary in bytes:
|
||||||
|
// Measured: `859`
|
||||||
|
// Estimated: `4324`
|
||||||
|
// Minimum execution time: 108_966_000 picoseconds.
|
||||||
|
Weight::from_parts(110_454_000, 0)
|
||||||
|
.saturating_add(Weight::from_parts(0, 4324))
|
||||||
|
.saturating_add(RocksDbWeight::get().reads(5))
|
||||||
|
.saturating_add(RocksDbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_offend_validators(offenders_len: u32) -> Weight {
|
fn try_offend_validators(_offenders_len: u32) -> Weight {
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user