Skip to content

Commit

Permalink
fix benchmarking trait bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Aug 28, 2024
1 parent 53715c0 commit 7cec013
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions democracy/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
use crate::{Pallet as EncointerDemocracy, *};
use encointer_primitives::{
ceremonies::Reputation,
communities::CommunityIdentifier,
democracy::{ProposalState, Tally, Vote},
storage::{current_ceremony_index_key, global_reputation_count, participant_reputation},
ceremonies::Reputation,
communities::CommunityIdentifier,
democracy::{ProposalState, Tally, Vote},
storage::{current_ceremony_index_key, global_reputation_count, participant_reputation},
};
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite};
use frame_support::{
assert_ok,
traits::{OnFinalize, OriginTrait},
BoundedVec,
assert_ok,
traits::{OnFinalize, OriginTrait},
BoundedVec,
};
use frame_system::RawOrigin;
use parity_scale_codec::Encode;
#[cfg(not(feature = "std"))]
use sp_std::vec;

fn advance_timestamp_equivalent_to_n_blocks<T: Config>(n: u64) {
let offset: T::Moment = (n * 6000u64)
.try_into()
.unwrap_or_else(|_| panic!("Something went horribly wrong!"));
let new_time: T::Moment = pallet_timestamp::Pallet::<T>::get() + offset;
let _ = pallet_timestamp::Pallet::<T>::set(T::RuntimeOrigin::none(), new_time);
pallet_timestamp::Pallet::<T>::on_finalize(frame_system::Pallet::<T>::block_number());
let offset: T::Moment = (n * 6000u64)
.try_into()
.unwrap_or_else(|_| panic!("Something went horribly wrong!"));
let new_time: T::Moment = pallet_timestamp::Pallet::<T>::get() + offset;
let _ = pallet_timestamp::Pallet::<T>::set(T::RuntimeOrigin::none(), new_time);
pallet_timestamp::Pallet::<T>::on_finalize(frame_system::Pallet::<T>::block_number());
}

benchmarks! {

where_clause {
where
sp_core::H256: From<<T as frame_system::Config>::Hash>,
T::AccountId: AsRef<[u8; 32]>,
}
submit_proposal {
let zoran = account("zoran", 1, 1);
let cid = CommunityIdentifier::default();
Expand Down

0 comments on commit 7cec013

Please sign in to comment.