diff --git a/Cargo.lock b/Cargo.lock index 82760ca..c0f8438 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "casper-runtime" -version = "3.5.31" +version = "3.5.33" dependencies = [ "casper-runtime-constants", "frame-benchmarking", @@ -3836,7 +3836,7 @@ dependencies = [ [[package]] name = "ghost-slow-clap" -version = "0.3.40" +version = "0.3.47" dependencies = [ "frame-benchmarking", "frame-support", diff --git a/pallets/slow-clap/Cargo.toml b/pallets/slow-clap/Cargo.toml index d0d47b4..0bb443e 100644 --- a/pallets/slow-clap/Cargo.toml +++ b/pallets/slow-clap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ghost-slow-clap" -version = "0.3.40" +version = "0.3.47" description = "Applause protocol for the EVM bridge" license.workspace = true authors.workspace = true diff --git a/pallets/slow-clap/src/benchmarking.rs b/pallets/slow-clap/src/benchmarking.rs index 20ca428..432ce5f 100644 --- a/pallets/slow-clap/src/benchmarking.rs +++ b/pallets/slow-clap/src/benchmarking.rs @@ -50,10 +50,15 @@ benchmarks! { self_applause { let session_index = T::ValidatorSet::session_index(); - let authorities = vec![T::AuthorityId::generate_pair(None)]; + let next_session_index = session_index.saturating_add(1); + let authorities = vec![ + T::AuthorityId::generate_pair(None), + T::AuthorityId::generate_pair(None), + ]; let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities.clone()) .map_err(|()| "more than the maximum number of keys provided")?; - Authorities::::set(&session_index, bounded_authorities); + Authorities::::set(&session_index, bounded_authorities.clone()); + Authorities::::set(&next_session_index, bounded_authorities); let minimum_balance = <::Currency>::minimum_balance(); let receiver = create_account::(); @@ -68,6 +73,7 @@ benchmarks! { &network_id, ); let storage_key = (session_index, &transaction_hash, &unique_transaction_hash); + let next_storage_key = (next_session_index, &transaction_hash, &unique_transaction_hash); >::trigger_nullification_for_benchmark(); let clap = Clap { @@ -86,11 +92,18 @@ benchmarks! { .expect("first authority should exist"); let encoded_clap = clap.encode(); let signature = authority_id.sign(&encoded_clap).unwrap(); - >::slow_clap(RawOrigin::None.into(), clap, signature)?; - >::trigger_nullification_for_benchmark(); + Pallet::::slow_clap(RawOrigin::None.into(), clap, signature)?; + Pallet::::trigger_nullification_for_benchmark(); assert_eq!(<::Currency>::total_balance(&receiver), Default::default()); assert_eq!(ApplausesForTransaction::::get(&storage_key), false); + + frame_system::Pallet::::on_initialize(1u32.into()); + + let mut fake_received_clap = + BoundedBTreeSet::::new(); + assert_eq!(fake_received_clap.try_insert(1).unwrap(), true); + pallet::ReceivedClaps::::insert(&next_storage_key, fake_received_clap); }: _(RawOrigin::Signed(receiver_clone), network_id, session_index, transaction_hash, receiver_clone.clone(), amount) verify { assert_eq!(<::Currency>::total_balance(&receiver), amount); diff --git a/pallets/slow-clap/src/lib.rs b/pallets/slow-clap/src/lib.rs index 1e2eefd..71cb56d 100644 --- a/pallets/slow-clap/src/lib.rs +++ b/pallets/slow-clap/src/lib.rs @@ -35,7 +35,11 @@ use sp_staking::{ offence::{Kind, Offence, ReportOffence}, SessionIndex, }; -use sp_std::{collections::btree_map::BTreeMap, prelude::*, vec::Vec}; +use sp_std::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet}, + prelude::*, + vec::Vec, +}; use ghost_networks::{ NetworkData, NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataMutateHandler, @@ -72,7 +76,7 @@ const LOG_TARGET: &str = "runtime::ghost-slow-clap"; const DB_PREFIX: &[u8] = b"slow_clap::"; const FETCH_TIMEOUT_PERIOD: u64 = 3_000; -const LOCK_BLOCK_EXPIRATION: u64 = 10; +const LOCK_BLOCK_EXPIRATION: u64 = 20; pub type AuthIndex = u32; @@ -166,7 +170,7 @@ type OffchainResult = Result>>; pub mod pallet { use super::*; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] @@ -238,7 +242,6 @@ pub mod pallet { #[pallet::error] pub enum Error { NotEnoughClaps, - NotAnAuthority, CurrentValidatorIsDisabled, AlreadyClapped, UnregisteredClapRemove, @@ -294,6 +297,16 @@ pub mod pallet { ValueQuery, >; + #[pallet::storage] + #[pallet::getter(fn validators)] + pub(super) type Validators = StorageMap< + _, + Twox64Concat, + SessionIndex, + WeakBoundedVec, T::MaxAuthorities>, + OptionQuery, + >; + #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { @@ -330,7 +343,7 @@ pub mod pallet { pub fn self_applause( origin: OriginFor, network_id: NetworkIdOf, - session_index: SessionIndex, + prev_session_index: SessionIndex, transaction_hash: H256, receiver: T::AccountId, amount: BalanceOf, @@ -338,7 +351,7 @@ pub mod pallet { let _ = ensure_signed(origin)?; Self::applause_if_posible( network_id, - session_index, + prev_session_index, transaction_hash, receiver, amount, @@ -378,7 +391,8 @@ pub mod pallet { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { if let Call::slow_clap { clap, signature } = call { - let authorities = Authorities::::get(&clap.session_index); + let (session_index, _) = Self::mended_session_index(&clap); + let authorities = Authorities::::get(&session_index); let authority = match authorities.get(clap.authority_index as usize) { Some(authority) => authority, None => return InvalidTransaction::BadSigner.into(), @@ -459,27 +473,49 @@ impl Pallet { hex_str } - fn try_slow_clap(clap: &Clap, BalanceOf>) -> DispatchResult { - let authorities = Authorities::::get(&clap.session_index); - ensure!( - authorities.get(clap.authority_index as usize).is_some(), - Error::::NotAnAuthority + fn mended_session_index( + clap: &Clap, BalanceOf>, + ) -> (SessionIndex, H256) { + let prev_session_index = clap.session_index.saturating_sub(1); + let clap_unique_hash = + Self::generate_unique_hash(&clap.receiver, &clap.amount, &clap.network_id); + + let received_claps_key = ( + prev_session_index, + &clap.transaction_hash, + &clap_unique_hash, ); + + let session_index = ReceivedClaps::::get(&received_claps_key) + .is_empty() + .then(|| clap.session_index) + .unwrap_or(prev_session_index); + + (session_index, clap_unique_hash) + } + + fn try_slow_clap(clap: &Clap, BalanceOf>) -> DispatchResult { + let (session_index, clap_unique_hash) = Self::mended_session_index(&clap); + let mut claps_in_session = ClapsInSession::::get(&session_index); + ensure!( - ClapsInSession::::get(&clap.session_index) + claps_in_session .get(&clap.authority_index) .map(|info| !info.disabled) .unwrap_or(true), Error::::CurrentValidatorIsDisabled ); - let clap_unique_hash = - Self::generate_unique_hash(&clap.receiver, &clap.amount, &clap.network_id); - let received_claps_key = ( - clap.session_index, - &clap.transaction_hash, - &clap_unique_hash, - ); + let disabled_authorites = claps_in_session + .values() + .filter(|info| info.disabled) + .count(); + + let active_authorities = Authorities::::get(&session_index) + .len() + .saturating_sub(disabled_authorites); + + let received_claps_key = (session_index, &clap.transaction_hash, &clap_unique_hash); let number_of_received_claps = ReceivedClaps::::try_mutate(&received_claps_key, |tree_of_claps| { @@ -498,15 +534,15 @@ impl Pallet { } })?; - ClapsInSession::::mutate(&clap.session_index, |claps_details| { - (*claps_details) - .entry(clap.authority_index) - .and_modify(|individual| (*individual).claps.saturating_inc()) - .or_insert(SessionAuthorityInfo { - claps: 1u32, - disabled: false, - }); - }); + claps_in_session + .entry(clap.authority_index) + .and_modify(|individual| individual.claps.saturating_inc()) + .or_insert(SessionAuthorityInfo { + claps: 1u32, + disabled: false, + }); + + ClapsInSession::::insert(&session_index, claps_in_session); Self::deposit_event(Event::::Clapped { authority_id: clap.authority_index, @@ -517,7 +553,7 @@ impl Pallet { }); let enough_authorities = - Perbill::from_rational(number_of_received_claps as u32, authorities.len() as u32) + Perbill::from_rational(number_of_received_claps as u32, active_authorities as u32) > Perbill::from_percent(T::ApplauseThreshold::get()); if enough_authorities { @@ -574,32 +610,61 @@ impl Pallet { fn applause_if_posible( network_id: NetworkIdOf, - session_index: SessionIndex, + prev_session_index: SessionIndex, transaction_hash: H256, receiver: T::AccountId, amount: BalanceOf, ) -> DispatchResult { + let curr_session_index = prev_session_index.saturating_add(1); let clap_unique_hash = Self::generate_unique_hash(&receiver, &amount, &network_id); - let received_claps_key = (session_index, &transaction_hash, &clap_unique_hash); + + let prev_authorities = Authorities::::get(&prev_session_index); + let curr_authorities = Authorities::::get(&curr_session_index); + + let prev_received_claps_key = (prev_session_index, &transaction_hash, &clap_unique_hash); + let curr_received_claps_key = (curr_session_index, &transaction_hash, &clap_unique_hash); + + let prev_received_claps = ReceivedClaps::::get(&prev_received_claps_key) + .into_iter() + .filter_map(|auth_index| prev_authorities.get(auth_index as usize)) + .cloned() + .collect::>(); + + let curr_received_claps = ReceivedClaps::::get(&curr_received_claps_key) + .into_iter() + .filter_map(|auth_index| curr_authorities.get(auth_index as usize)) + .cloned() + .collect::>(); + + let disabled_authorites = ClapsInSession::::get(&prev_session_index) + .values() + .filter(|info| info.disabled) + .count(); + + let active_authorities = prev_authorities.len().saturating_sub(disabled_authorites); + + let summary_authority_claps_length = curr_received_claps + .symmetric_difference(&prev_received_claps) + .count(); let clap = Clap { authority_index: Default::default(), block_number: Default::default(), - removed: false, - session_index, + removed: Default::default(), + session_index: Default::default(), + transaction_hash: Default::default(), network_id, receiver, amount, - transaction_hash, }; let enough_authorities = Perbill::from_rational( - ReceivedClaps::::get(&received_claps_key).len() as u32, - Authorities::::get(session_index).len() as u32, + summary_authority_claps_length as u32, + active_authorities as u32, ) > Perbill::from_percent(T::ApplauseThreshold::get()); ensure!(enough_authorities, Error::::NotEnoughClaps); - Self::try_applause(&clap, &received_claps_key)?; + Self::try_applause(&clap, &prev_received_claps_key)?; Ok(()) } @@ -766,14 +831,17 @@ impl Pallet { Some(_) if from_block.le(&to_block) => { let adjusted_to_block = estimated_block .checked_sub(from_block) - .map(|current_distance| current_distance - .le(&max_block_distance) - .then(|| estimated_block) - ) + .map(|current_distance| { + current_distance + .le(&max_block_distance) + .then(|| estimated_block) + }) .flatten() - .unwrap_or(from_block - .saturating_add(max_block_distance) - .min(estimated_block)); + .unwrap_or( + from_block + .saturating_add(max_block_distance) + .min(estimated_block), + ); (from_block, adjusted_to_block) } _ => (to_block, to_block), @@ -1026,16 +1094,23 @@ impl Pallet { let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities) .expect("more than the maximum number of authorities"); + let validators = T::ValidatorSet::validators(); + let bounded_validators = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(validators) + .expect("more than the maximum number of validators"); + if let Some(target_session_index) = session_index.checked_sub(T::HistoryDepth::get()) { Self::clear_history(&target_session_index); } + Validators::::insert(&session_index, bounded_validators); Authorities::::set(&session_index, bounded_authorities); ClapsInSession::::set(&session_index, Default::default()); } fn clear_history(target_session_index: &SessionIndex) { ClapsInSession::::remove(target_session_index); + Authorities::::remove(target_session_index); + Validators::::remove(target_session_index); let mut cursor = ReceivedClaps::::clear_prefix((target_session_index,), u32::MAX, None); debug_assert!(cursor.maybe_cursor.is_none()); cursor = @@ -1087,8 +1162,8 @@ impl OneSessionHandler for Pallet { } fn on_before_session_ending() { - let session_index = T::ValidatorSet::session_index(); - let validators = T::ValidatorSet::validators(); + let session_index = T::ValidatorSet::session_index().saturating_sub(1); + let validators = Validators::::get(&session_index).unwrap_or_default(); let authorities_len = Authorities::::get(&session_index).len(); let claps_in_session = ClapsInSession::::get(&session_index); @@ -1097,11 +1172,13 @@ impl OneSessionHandler for Pallet { let offenders = validators .into_iter() .enumerate() - .filter(|(index, _)| !Self::is_good_actor(*index, median_claps, &claps_in_session)) - .filter_map(|(_, id)| { - >::IdentificationOf::convert( - id.clone(), - ).map(|full_id| (id, full_id)) + .filter_map(|(index, id)| { + (!Self::is_good_actor(index, median_claps, &claps_in_session)).then(|| { + >::IdentificationOf::convert( + id.clone(), + ).map(|full_id| (id, full_id)) + }) + .flatten() }) .collect::>>(); diff --git a/pallets/slow-clap/src/tests.rs b/pallets/slow-clap/src/tests.rs index 27370b8..4ea4424 100644 --- a/pallets/slow-clap/src/tests.rs +++ b/pallets/slow-clap/src/tests.rs @@ -665,15 +665,14 @@ fn should_throw_error_if_session_index_is_not_current() { network_id, authority_prev )); - assert_ok!(do_clap_from_first_authority( - session_index_next, - network_id, - authority_next - )); + assert_err!( + do_clap_from_first_authority(session_index_next, network_id, authority_next), + DispatchError::Other("Transaction has a bad signature") + ); assert_claps_info_correct(&storage_key_curr, &session_index_curr, 1); assert_claps_info_correct(&storage_key_prev, &session_index_prev, 1); - assert_claps_info_correct(&storage_key_next, &session_index_next, 1); + assert_claps_info_correct(&storage_key_next, &session_index_next, 0); } }); } @@ -688,22 +687,12 @@ fn should_throw_error_if_signer_has_incorrect_index() { let storage_key = (session_index, transaction_hash, unique_transaction_hash); assert_claps_info_correct(&storage_key, &session_index, 0); - let clap = Clap { - block_number: 420, - removed: false, - transaction_hash, - session_index, - authority_index: 1337, - network_id, - receiver: 69, - amount: 420, - }; - let authority = UintAuthorityId::from((1) as u64); - let signature = authority.sign(&clap.encode()).unwrap(); - assert_err!( - SlowClap::slow_clap(RuntimeOrigin::none(), clap, signature), - Error::::NotAnAuthority - ); + assert_invalid_signing_address(session_index, network_id, 69); + assert_transaction_has_bad_signature(session_index, network_id, 69); + assert_invalid_signing_address(session_index, network_id, 420); + assert_transaction_has_bad_signature(session_index, network_id, 420); + assert_invalid_signing_address(session_index, network_id, 1337); + assert_transaction_has_bad_signature(session_index, network_id, 1337); assert_claps_info_correct(&storage_key, &session_index, 0); }); } @@ -956,8 +945,8 @@ fn should_avoid_applause_during_nullification_period() { } #[test] -fn should_self_applause_if_enough_received_claps() { - let zero: u64 = 0u64; +fn should_self_applause_if_enough_claps() { + let zero = 0u64; let (network_id, transaction_hash, unique_transaction_hash) = generate_unique_hash(None, None, None, None); let (_, receiver, amount) = get_mocked_metadata(); @@ -976,7 +965,7 @@ fn should_self_applause_if_enough_received_claps() { receiver, amount, ), - Error::::NotEnoughClaps + Error::::NotEnoughClaps, ); assert_eq!( @@ -984,45 +973,56 @@ fn should_self_applause_if_enough_received_claps() { false ); assert_eq!(Balances::balance(&receiver), zero); - assert_eq!( - BridgedInflationCurve::::era_payout(zero, zero, zero), - (zero, zero) - ); assert_ok!(do_clap_from(session_index, network_id, 0, false)); + advance_session(); + + let mut fake_received_clap = + BoundedBTreeSet::::MaxAuthorities>::new(); + assert_eq!(fake_received_clap.try_insert(1).unwrap(), true); + assert_eq!(fake_received_clap.try_insert(2).unwrap(), true); + + pallet::ReceivedClaps::::insert(&storage_key, fake_received_clap); + + assert_ok!(SlowClap::self_applause( + RuntimeOrigin::signed(receiver), + network_id, + session_index, + transaction_hash, + receiver, + amount, + )); + assert_eq!( + pallet::ApplausesForTransaction::::get(&storage_key), + true + ); + assert_eq!(Balances::balance(&receiver), amount); + }); +} + +#[test] +fn should_avoid_session_overlap_on_mended_session_index() { + let (network_id, transaction_hash, unique_transaction_hash) = + generate_unique_hash(None, None, None, None); + let (_, receiver, amount) = get_mocked_metadata(); + + new_test_ext().execute_with(|| { + let _ = prepare_evm_network(Some(network_id), Some(0)); + let session_index = advance_session_and_get_index(); + let storage_key = (session_index, transaction_hash, unique_transaction_hash); + + assert_ok!(do_clap_from(session_index, network_id, 0, false)); + advance_session(); + + assert_eq!( + pallet::ApplausesForTransaction::::get(&storage_key), + false + ); + assert_eq!(Balances::balance(&receiver), 0u64); + assert_ok!(do_clap_from(session_index, network_id, 1, false)); assert_ok!(do_clap_from(session_index, network_id, 2, false)); - assert_eq!( - pallet::ApplausesForTransaction::::get(&storage_key), - false - ); - assert_eq!(Balances::balance(&receiver), 0); - - assert_ok!(SlowClap::self_applause( - RuntimeOrigin::signed(receiver), - network_id, - session_index, - transaction_hash, - receiver, - amount, - )); - assert_eq!( - pallet::ApplausesForTransaction::::get(&storage_key), - false - ); - assert_eq!(Balances::balance(&receiver), 0); - - Networks::on_finalize(System::block_number()); - - assert_ok!(SlowClap::self_applause( - RuntimeOrigin::signed(receiver), - network_id, - session_index, - transaction_hash, - receiver, - amount, - )); assert_eq!( pallet::ApplausesForTransaction::::get(&storage_key), true diff --git a/pallets/slow-clap/src/weights.rs b/pallets/slow-clap/src/weights.rs index 06180f8..f103640 100644 --- a/pallets/slow-clap/src/weights.rs +++ b/pallets/slow-clap/src/weights.rs @@ -16,7 +16,7 @@ //! Autogenerated weights for `ghost_slow_clap` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-06-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-11-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml index 0c74906..104bbe1 100644 --- a/runtime/casper/Cargo.toml +++ b/runtime/casper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-runtime" -version = "3.5.31" +version = "3.5.33" build = "build.rs" description = "Runtime of the Casper Network" edition.workspace = true diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs index 42e2504..d5f9cb8 100644 --- a/runtime/casper/src/lib.rs +++ b/runtime/casper/src/lib.rs @@ -117,11 +117,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("casper"), impl_name: create_runtime_str!("casper-svengali"), authoring_version: 0, - spec_version: 2, - impl_version: 0, + spec_version: 3, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, - state_version: 0, + state_version: 1, }; /// The BABE epoch configuration at genesis. diff --git a/runtime/casper/src/weights/ghost_slow_clap.rs b/runtime/casper/src/weights/ghost_slow_clap.rs index 6530833..2fe78ca 100644 --- a/runtime/casper/src/weights/ghost_slow_clap.rs +++ b/runtime/casper/src/weights/ghost_slow_clap.rs @@ -16,7 +16,7 @@ //! Autogenerated weights for `ghost_slow_clap` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-06-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-11-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 @@ -46,12 +46,12 @@ use core::marker::PhantomData; /// Weight functions for `ghost_slow_clap`. pub struct WeightInfo(PhantomData); impl ghost_slow_clap::WeightInfo for WeightInfo { - /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0) - /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:1) /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostSlowClaps::ClapsInSession` (r:1 w:1) /// Proof: `GhostSlowClaps::ClapsInSession` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0) + /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:1) /// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostNetworks::NullifyNeeded` (r:1 w:0) @@ -68,18 +68,20 @@ impl ghost_slow_clap::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn slow_clap() -> Weight { // Proof Size summary in bytes: - // Measured: `355` - // Estimated: `3820` - // Minimum execution time: 213_817_000 picoseconds. - Weight::from_parts(216_977_000, 0) - .saturating_add(Weight::from_parts(0, 3820)) + // Measured: `387` + // Estimated: `3852` + // Minimum execution time: 220_008_000 picoseconds. + Weight::from_parts(223_058_000, 0) + .saturating_add(Weight::from_parts(0, 3852)) .saturating_add(T::DbWeight::get().reads(10)) .saturating_add(T::DbWeight::get().writes(7)) } - /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0) - /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0) + /// Storage: `GhostSlowClaps::Authorities` (r:2 w:0) /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::ReceivedClaps` (r:2 w:0) + /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::ClapsInSession` (r:1 w:0) + /// Proof: `GhostSlowClaps::ClapsInSession` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:1) /// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `GhostNetworks::NullifyNeeded` (r:1 w:0) @@ -96,12 +98,12 @@ impl ghost_slow_clap::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn self_applause() -> Weight { // Proof Size summary in bytes: - // Measured: `655` - // Estimated: `4120` - // Minimum execution time: 210_676_000 picoseconds. - Weight::from_parts(212_905_000, 0) - .saturating_add(Weight::from_parts(0, 4120)) - .saturating_add(T::DbWeight::get().reads(9)) + // Measured: `861` + // Estimated: `6801` + // Minimum execution time: 258_510_000 picoseconds. + Weight::from_parts(262_353_000, 0) + .saturating_add(Weight::from_parts(0, 6801)) + .saturating_add(T::DbWeight::get().reads(12)) .saturating_add(T::DbWeight::get().writes(5)) } }