mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
Referendum proposal's metadata (#12568)
* referenda metadata * todo comment * remove TODO, update rustdocs * referenda clear_metadata origin signed or root * referenda metadata unit tests * drop schema type for referenda metadata * remove metadata type * referenda metadata benches * note different preimages * metadata for democracy pallet * metadata democracy pallet tests and benches * fix cargo clippy * update docs * ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy * ".git/.scripts/bench-bot.sh" pallet dev pallet_referenda * Update the doc frame/democracy/src/lib.rs Co-authored-by: Roman Useinov <roman.useinov@gmail.com> * Update the doc frame/democracy/src/lib.rs Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> * reference instead clone for take Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> * error rename BadMetadata to PreimageNotExist * clear metadata within internal_cancel_referendum fn * remove redundant clone * collapse metadata api into one set_metadata method * fmt * review fixes * not request preimage on set_metadata * rename events and update docs * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_democracy * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_referenda * rename reset_metadata to transfer_metadata --------- Co-authored-by: command-bot <> Co-authored-by: Roman Useinov <roman.useinov@gmail.com> Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
This commit is contained in:
@@ -54,19 +54,20 @@ fn add_proposal<T: Config>(n: u32) -> Result<H256, &'static str> {
|
||||
Ok(proposal.hash())
|
||||
}
|
||||
|
||||
fn add_referendum<T: Config>(n: u32) -> (ReferendumIndex, H256) {
|
||||
// add a referendum with a metadata.
|
||||
fn add_referendum<T: Config>(n: u32) -> (ReferendumIndex, H256, PreimageHash) {
|
||||
let vote_threshold = VoteThreshold::SimpleMajority;
|
||||
let proposal = make_proposal::<T>(n);
|
||||
let hash = proposal.hash();
|
||||
(
|
||||
Democracy::<T>::inject_referendum(
|
||||
T::LaunchPeriod::get(),
|
||||
proposal,
|
||||
vote_threshold,
|
||||
0u32.into(),
|
||||
),
|
||||
hash,
|
||||
)
|
||||
let index = Democracy::<T>::inject_referendum(
|
||||
T::LaunchPeriod::get(),
|
||||
proposal,
|
||||
vote_threshold,
|
||||
0u32.into(),
|
||||
);
|
||||
let preimage_hash = note_preimage::<T>();
|
||||
MetadataOf::<T>::insert(crate::MetadataOwner::Referendum(index), preimage_hash.clone());
|
||||
(index, hash, preimage_hash)
|
||||
}
|
||||
|
||||
fn account_vote<T: Config>(b: BalanceOf<T>) -> AccountVote<BalanceOf<T>> {
|
||||
@@ -75,6 +76,25 @@ fn account_vote<T: Config>(b: BalanceOf<T>) -> AccountVote<BalanceOf<T>> {
|
||||
AccountVote::Standard { vote: v, balance: b }
|
||||
}
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
frame_system::Pallet::<T>::assert_has_event(generic_event.into());
|
||||
}
|
||||
|
||||
// note a new preimage.
|
||||
fn note_preimage<T: Config>() -> PreimageHash {
|
||||
use core::sync::atomic::{AtomicU8, Ordering};
|
||||
use sp_std::borrow::Cow;
|
||||
// note a new preimage on every function invoke.
|
||||
static COUNTER: AtomicU8 = AtomicU8::new(0);
|
||||
let data = Cow::from(vec![COUNTER.fetch_add(1, Ordering::Relaxed)]);
|
||||
let hash = <T as Config>::Preimages::note(data).unwrap();
|
||||
hash
|
||||
}
|
||||
|
||||
benchmarks! {
|
||||
propose {
|
||||
let p = T::MaxProposals::get();
|
||||
@@ -179,7 +199,7 @@ benchmarks! {
|
||||
emergency_cancel {
|
||||
let origin =
|
||||
T::CancellationOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let ref_index = add_referendum::<T>(0).0;
|
||||
let (ref_index, _, preimage_hash) = add_referendum::<T>(0);
|
||||
assert_ok!(Democracy::<T>::referendum_status(ref_index));
|
||||
}: _<T::RuntimeOrigin>(origin, ref_index)
|
||||
verify {
|
||||
@@ -188,6 +208,10 @@ benchmarks! {
|
||||
Democracy::<T>::referendum_status(ref_index),
|
||||
Error::<T>::ReferendumInvalid,
|
||||
);
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner: MetadataOwner::Referendum(ref_index),
|
||||
hash: preimage_hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
blacklist {
|
||||
@@ -198,7 +222,7 @@ benchmarks! {
|
||||
// We should really add a lot of seconds here, but we're not doing it elsewhere.
|
||||
|
||||
// Add a referendum of our proposal.
|
||||
let (ref_index, hash) = add_referendum::<T>(0);
|
||||
let (ref_index, hash, preimage_hash) = add_referendum::<T>(0);
|
||||
assert_ok!(Democracy::<T>::referendum_status(ref_index));
|
||||
// Place our proposal in the external queue, too.
|
||||
assert_ok!(Democracy::<T>::external_propose(
|
||||
@@ -215,6 +239,10 @@ benchmarks! {
|
||||
Democracy::<T>::referendum_status(ref_index),
|
||||
Error::<T>::ReferendumInvalid
|
||||
);
|
||||
assert_has_event::<T>(crate::Event::MetadataCleared {
|
||||
owner: MetadataOwner::Referendum(ref_index),
|
||||
hash: preimage_hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
// Worst case scenario, we external propose a previously blacklisted proposal
|
||||
@@ -262,8 +290,13 @@ benchmarks! {
|
||||
.expect("ExternalDefaultOrigin has no successful origin required for the benchmark");
|
||||
let proposal = make_proposal::<T>(0);
|
||||
let proposal_hash = proposal.hash();
|
||||
Democracy::<T>::external_propose_default(origin_propose, proposal)?;
|
||||
|
||||
Democracy::<T>::external_propose_default(origin_propose.clone(), proposal)?;
|
||||
// Set metadata to the external proposal.
|
||||
let preimage_hash = note_preimage::<T>();
|
||||
assert_ok!(Democracy::<T>::set_metadata(
|
||||
origin_propose,
|
||||
MetadataOwner::External,
|
||||
Some(preimage_hash)));
|
||||
// NOTE: Instant origin may invoke a little bit more logic, but may not always succeed.
|
||||
let origin_fast_track =
|
||||
T::FastTrackOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
@@ -271,7 +304,12 @@ benchmarks! {
|
||||
let delay = 0u32;
|
||||
}: _<T::RuntimeOrigin>(origin_fast_track, proposal_hash, voting_period, delay.into())
|
||||
verify {
|
||||
assert_eq!(Democracy::<T>::referendum_count(), 1, "referendum not created")
|
||||
assert_eq!(Democracy::<T>::referendum_count(), 1, "referendum not created");
|
||||
assert_last_event::<T>(crate::Event::MetadataTransferred {
|
||||
prev_owner: MetadataOwner::External,
|
||||
owner: MetadataOwner::Referendum(0),
|
||||
hash: preimage_hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
veto_external {
|
||||
@@ -280,7 +318,14 @@ benchmarks! {
|
||||
|
||||
let origin_propose = T::ExternalDefaultOrigin::try_successful_origin()
|
||||
.expect("ExternalDefaultOrigin has no successful origin required for the benchmark");
|
||||
Democracy::<T>::external_propose_default(origin_propose, proposal)?;
|
||||
Democracy::<T>::external_propose_default(origin_propose.clone(), proposal)?;
|
||||
|
||||
let preimage_hash = note_preimage::<T>();
|
||||
assert_ok!(Democracy::<T>::set_metadata(
|
||||
origin_propose,
|
||||
MetadataOwner::External,
|
||||
Some(preimage_hash))
|
||||
);
|
||||
|
||||
let mut vetoers: BoundedVec<T::AccountId, _> = Default::default();
|
||||
for i in 0 .. (T::MaxBlacklisted::get() - 1) {
|
||||
@@ -303,13 +348,32 @@ benchmarks! {
|
||||
for i in 0 .. T::MaxProposals::get() {
|
||||
add_proposal::<T>(i)?;
|
||||
}
|
||||
// Add metadata to the first proposal.
|
||||
let proposer = funded_account::<T>("proposer", 0);
|
||||
let preimage_hash = note_preimage::<T>();
|
||||
assert_ok!(Democracy::<T>::set_metadata(
|
||||
RawOrigin::Signed(proposer).into(),
|
||||
MetadataOwner::Proposal(0),
|
||||
Some(preimage_hash)));
|
||||
let cancel_origin = T::CancelProposalOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
}: _<T::RuntimeOrigin>(cancel_origin, 0)
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner: MetadataOwner::Proposal(0),
|
||||
hash: preimage_hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
cancel_referendum {
|
||||
let ref_index = add_referendum::<T>(0).0;
|
||||
let (ref_index, _, preimage_hash) = add_referendum::<T>(0);
|
||||
}: _(RawOrigin::Root, ref_index)
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner: MetadataOwner::Referendum(0),
|
||||
hash: preimage_hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
#[extra]
|
||||
on_initialize_external {
|
||||
@@ -678,6 +742,111 @@ benchmarks! {
|
||||
assert_eq!(votes.len(), (r - 1) as usize, "Vote was not removed");
|
||||
}
|
||||
|
||||
set_external_metadata {
|
||||
let origin = T::ExternalOrigin::try_successful_origin()
|
||||
.expect("ExternalOrigin has no successful origin required for the benchmark");
|
||||
assert_ok!(
|
||||
Democracy::<T>::external_propose(origin.clone(), make_proposal::<T>(0))
|
||||
);
|
||||
let owner = MetadataOwner::External;
|
||||
let hash = note_preimage::<T>();
|
||||
}: set_metadata<T::RuntimeOrigin>(origin, owner.clone(), Some(hash))
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataSet {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
clear_external_metadata {
|
||||
let origin = T::ExternalOrigin::try_successful_origin()
|
||||
.expect("ExternalOrigin has no successful origin required for the benchmark");
|
||||
assert_ok!(
|
||||
Democracy::<T>::external_propose(origin.clone(), make_proposal::<T>(0))
|
||||
);
|
||||
let owner = MetadataOwner::External;
|
||||
let proposer = funded_account::<T>("proposer", 0);
|
||||
let hash = note_preimage::<T>();
|
||||
assert_ok!(Democracy::<T>::set_metadata(origin.clone(), owner.clone(), Some(hash)));
|
||||
}: set_metadata<T::RuntimeOrigin>(origin, owner.clone(), None)
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
set_proposal_metadata {
|
||||
// Place our proposal at the end to make sure it's worst case.
|
||||
for i in 0 .. T::MaxProposals::get() {
|
||||
add_proposal::<T>(i)?;
|
||||
}
|
||||
let owner = MetadataOwner::Proposal(0);
|
||||
let proposer = funded_account::<T>("proposer", 0);
|
||||
let hash = note_preimage::<T>();
|
||||
}: set_metadata<T::RuntimeOrigin>(RawOrigin::Signed(proposer).into(), owner.clone(), Some(hash))
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataSet {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
clear_proposal_metadata {
|
||||
// Place our proposal at the end to make sure it's worst case.
|
||||
for i in 0 .. T::MaxProposals::get() {
|
||||
add_proposal::<T>(i)?;
|
||||
}
|
||||
let proposer = funded_account::<T>("proposer", 0);
|
||||
let owner = MetadataOwner::Proposal(0);
|
||||
let hash = note_preimage::<T>();
|
||||
assert_ok!(Democracy::<T>::set_metadata(
|
||||
RawOrigin::Signed(proposer.clone()).into(),
|
||||
owner.clone(),
|
||||
Some(hash)));
|
||||
}: set_metadata<T::RuntimeOrigin>(RawOrigin::Signed(proposer).into(), owner.clone(), None)
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
set_referendum_metadata {
|
||||
// create not ongoing referendum.
|
||||
ReferendumInfoOf::<T>::insert(
|
||||
0,
|
||||
ReferendumInfo::Finished { end: T::BlockNumber::zero(), approved: true },
|
||||
);
|
||||
let owner = MetadataOwner::Referendum(0);
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
let hash = note_preimage::<T>();
|
||||
}: set_metadata<T::RuntimeOrigin>(RawOrigin::Root.into(), owner.clone(), Some(hash))
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataSet {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
clear_referendum_metadata {
|
||||
// create not ongoing referendum.
|
||||
ReferendumInfoOf::<T>::insert(
|
||||
0,
|
||||
ReferendumInfo::Finished { end: T::BlockNumber::zero(), approved: true },
|
||||
);
|
||||
let owner = MetadataOwner::Referendum(0);
|
||||
let hash = note_preimage::<T>();
|
||||
MetadataOf::<T>::insert(owner.clone(), hash);
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
}: set_metadata<T::RuntimeOrigin>(RawOrigin::Signed(caller).into(), owner.clone(), None)
|
||||
verify {
|
||||
assert_last_event::<T>(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}.into());
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Democracy,
|
||||
crate::tests::new_test_ext(),
|
||||
|
||||
@@ -155,14 +155,17 @@
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
ensure,
|
||||
error::BadOrigin,
|
||||
traits::{
|
||||
defensive_prelude::*,
|
||||
schedule::{v3::Named as ScheduleNamed, DispatchTime},
|
||||
Bounded, Currency, Get, LockIdentifier, LockableCurrency, OnUnbalanced, QueryPreimage,
|
||||
ReservableCurrency, StorePreimage, WithdrawReasons,
|
||||
Bounded, Currency, EnsureOrigin, Get, Hash as PreimageHash, LockIdentifier,
|
||||
LockableCurrency, OnUnbalanced, QueryPreimage, ReservableCurrency, StorePreimage,
|
||||
WithdrawReasons,
|
||||
},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_system::pallet_prelude::OriginFor;
|
||||
use sp_runtime::{
|
||||
traits::{Bounded as ArithBounded, One, Saturating, StaticLookup, Zero},
|
||||
ArithmeticError, DispatchError, DispatchResult,
|
||||
@@ -176,7 +179,10 @@ mod vote_threshold;
|
||||
pub mod weights;
|
||||
pub use conviction::Conviction;
|
||||
pub use pallet::*;
|
||||
pub use types::{Delegations, ReferendumInfo, ReferendumStatus, Tally, UnvoteScope};
|
||||
pub use types::{
|
||||
Delegations, MetadataOwner, PropIndex, ReferendumIndex, ReferendumInfo, ReferendumStatus,
|
||||
Tally, UnvoteScope,
|
||||
};
|
||||
pub use vote::{AccountVote, Vote, Voting};
|
||||
pub use vote_threshold::{Approved, VoteThreshold};
|
||||
pub use weights::WeightInfo;
|
||||
@@ -191,12 +197,6 @@ pub mod migrations;
|
||||
|
||||
const DEMOCRACY_ID: LockIdentifier = *b"democrac";
|
||||
|
||||
/// A proposal index.
|
||||
pub type PropIndex = u32;
|
||||
|
||||
/// A referendum index.
|
||||
pub type ReferendumIndex = u32;
|
||||
|
||||
type BalanceOf<T> =
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<
|
||||
@@ -425,6 +425,15 @@ pub mod pallet {
|
||||
#[pallet::storage]
|
||||
pub type Cancellations<T: Config> = StorageMap<_, Identity, H256, bool, ValueQuery>;
|
||||
|
||||
/// General information concerning any proposal or referendum.
|
||||
/// The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||
/// dump or IPFS hash of a JSON file.
|
||||
///
|
||||
/// Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||
/// large preimages.
|
||||
#[pallet::storage]
|
||||
pub type MetadataOf<T: Config> = StorageMap<_, Blake2_128Concat, MetadataOwner, PreimageHash>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
_phantom: sp_std::marker::PhantomData<T>,
|
||||
@@ -477,6 +486,29 @@ pub mod pallet {
|
||||
Seconded { seconder: T::AccountId, prop_index: PropIndex },
|
||||
/// A proposal got canceled.
|
||||
ProposalCanceled { prop_index: PropIndex },
|
||||
/// Metadata for a proposal or a referendum has been set.
|
||||
MetadataSet {
|
||||
/// Metadata owner.
|
||||
owner: MetadataOwner,
|
||||
/// Preimage hash.
|
||||
hash: PreimageHash,
|
||||
},
|
||||
/// Metadata for a proposal or a referendum has been cleared.
|
||||
MetadataCleared {
|
||||
/// Metadata owner.
|
||||
owner: MetadataOwner,
|
||||
/// Preimage hash.
|
||||
hash: PreimageHash,
|
||||
},
|
||||
/// Metadata has been transferred to new owner.
|
||||
MetadataTransferred {
|
||||
/// Previous metadata owner.
|
||||
prev_owner: MetadataOwner,
|
||||
/// New metadata owner.
|
||||
owner: MetadataOwner,
|
||||
/// Preimage hash.
|
||||
hash: PreimageHash,
|
||||
},
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
@@ -528,6 +560,8 @@ pub mod pallet {
|
||||
TooMany,
|
||||
/// Voting period too low
|
||||
VotingPeriodLow,
|
||||
/// The preimage does not exist.
|
||||
PreimageNotExist,
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
@@ -773,12 +807,13 @@ pub mod pallet {
|
||||
|
||||
<NextExternal<T>>::kill();
|
||||
let now = <frame_system::Pallet<T>>::block_number();
|
||||
Self::inject_referendum(
|
||||
let ref_index = Self::inject_referendum(
|
||||
now.saturating_add(voting_period),
|
||||
ext_proposal,
|
||||
threshold,
|
||||
delay,
|
||||
);
|
||||
Self::transfer_metadata(MetadataOwner::External, MetadataOwner::Referendum(ref_index));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -816,6 +851,7 @@ pub mod pallet {
|
||||
|
||||
Self::deposit_event(Event::<T>::Vetoed { who, proposal_hash, until });
|
||||
<NextExternal<T>>::kill();
|
||||
Self::clear_metadata(MetadataOwner::External);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1025,12 +1061,14 @@ pub mod pallet {
|
||||
T::Slash::on_unbalanced(T::Currency::slash_reserved(&who, amount).0);
|
||||
}
|
||||
}
|
||||
Self::clear_metadata(MetadataOwner::Proposal(prop_index));
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the external queued referendum, if it's there.
|
||||
if matches!(NextExternal::<T>::get(), Some((p, ..)) if p.hash() == proposal_hash) {
|
||||
NextExternal::<T>::kill();
|
||||
Self::clear_metadata(MetadataOwner::External);
|
||||
}
|
||||
|
||||
// Remove the referendum, if it's there.
|
||||
@@ -1067,8 +1105,68 @@ pub mod pallet {
|
||||
T::Slash::on_unbalanced(T::Currency::slash_reserved(&who, amount).0);
|
||||
}
|
||||
}
|
||||
|
||||
Self::deposit_event(Event::<T>::ProposalCanceled { prop_index });
|
||||
Self::clear_metadata(MetadataOwner::Proposal(prop_index));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set or clear a metadata of a proposal or a referendum.
|
||||
///
|
||||
/// Parameters:
|
||||
/// - `origin`: Must correspond to the `MetadataOwner`.
|
||||
/// - `ExternalOrigin` for an external proposal with the `SuperMajorityApprove`
|
||||
/// threshold.
|
||||
/// - `ExternalDefaultOrigin` for an external proposal with the `SuperMajorityAgainst`
|
||||
/// threshold.
|
||||
/// - `ExternalMajorityOrigin` for an external proposal with the `SimpleMajority`
|
||||
/// threshold.
|
||||
/// - `Signed` by a creator for a public proposal.
|
||||
/// - `Signed` to clear a metadata for a finished referendum.
|
||||
/// - `Root` to set a metadata for an ongoing referendum.
|
||||
/// - `owner`: an identifier of a metadata owner.
|
||||
/// - `maybe_hash`: The hash of an on-chain stored preimage. `None` to clear a metadata.
|
||||
#[pallet::call_index(18)]
|
||||
#[pallet::weight(
|
||||
match (owner, maybe_hash) {
|
||||
(MetadataOwner::External, Some(_)) => T::WeightInfo::set_external_metadata(),
|
||||
(MetadataOwner::External, None) => T::WeightInfo::clear_external_metadata(),
|
||||
(MetadataOwner::Proposal(_), Some(_)) => T::WeightInfo::set_proposal_metadata(),
|
||||
(MetadataOwner::Proposal(_), None) => T::WeightInfo::clear_proposal_metadata(),
|
||||
(MetadataOwner::Referendum(_), Some(_)) => T::WeightInfo::set_referendum_metadata(),
|
||||
(MetadataOwner::Referendum(_), None) => T::WeightInfo::clear_referendum_metadata(),
|
||||
}
|
||||
)]
|
||||
pub fn set_metadata(
|
||||
origin: OriginFor<T>,
|
||||
owner: MetadataOwner,
|
||||
maybe_hash: Option<PreimageHash>,
|
||||
) -> DispatchResult {
|
||||
match owner {
|
||||
MetadataOwner::External => {
|
||||
let (_, threshold) = <NextExternal<T>>::get().ok_or(Error::<T>::NoProposal)?;
|
||||
Self::ensure_external_origin(threshold, origin)?;
|
||||
},
|
||||
MetadataOwner::Proposal(index) => {
|
||||
let who = ensure_signed(origin)?;
|
||||
let (_, _, proposer) = Self::proposal(index)?;
|
||||
ensure!(proposer == who, Error::<T>::NoPermission);
|
||||
},
|
||||
MetadataOwner::Referendum(index) => {
|
||||
let is_root = ensure_signed_or_root(origin)?.is_none();
|
||||
ensure!(is_root || maybe_hash.is_none(), Error::<T>::NoPermission);
|
||||
ensure!(
|
||||
is_root || Self::referendum_status(index).is_err(),
|
||||
Error::<T>::NoPermission
|
||||
);
|
||||
},
|
||||
}
|
||||
if let Some(hash) = maybe_hash {
|
||||
ensure!(T::Preimages::len(&hash).is_some(), Error::<T>::PreimageNotExist);
|
||||
MetadataOf::<T>::insert(owner.clone(), hash);
|
||||
Self::deposit_event(Event::<T>::MetadataSet { owner, hash });
|
||||
} else {
|
||||
Self::clear_metadata(owner);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1146,6 +1244,7 @@ impl<T: Config> Pallet<T> {
|
||||
pub fn internal_cancel_referendum(ref_index: ReferendumIndex) {
|
||||
Self::deposit_event(Event::<T>::Cancelled { ref_index });
|
||||
ReferendumInfoOf::<T>::remove(ref_index);
|
||||
Self::clear_metadata(MetadataOwner::Referendum(ref_index));
|
||||
}
|
||||
|
||||
// private.
|
||||
@@ -1432,12 +1531,13 @@ impl<T: Config> Pallet<T> {
|
||||
if let Some((proposal, threshold)) = <NextExternal<T>>::take() {
|
||||
LastTabledWasExternal::<T>::put(true);
|
||||
Self::deposit_event(Event::<T>::ExternalTabled);
|
||||
Self::inject_referendum(
|
||||
let ref_index = Self::inject_referendum(
|
||||
now.saturating_add(T::VotingPeriod::get()),
|
||||
proposal,
|
||||
threshold,
|
||||
T::EnactmentPeriod::get(),
|
||||
);
|
||||
Self::transfer_metadata(MetadataOwner::External, MetadataOwner::Referendum(ref_index));
|
||||
Ok(())
|
||||
} else {
|
||||
return Err(Error::<T>::NoneWaiting.into())
|
||||
@@ -1460,12 +1560,16 @@ impl<T: Config> Pallet<T> {
|
||||
T::Currency::unreserve(d, deposit);
|
||||
}
|
||||
Self::deposit_event(Event::<T>::Tabled { proposal_index: prop_index, deposit });
|
||||
Self::inject_referendum(
|
||||
let ref_index = Self::inject_referendum(
|
||||
now.saturating_add(T::VotingPeriod::get()),
|
||||
proposal,
|
||||
VoteThreshold::SuperMajorityApprove,
|
||||
T::EnactmentPeriod::get(),
|
||||
);
|
||||
Self::transfer_metadata(
|
||||
MetadataOwner::Proposal(prop_index),
|
||||
MetadataOwner::Referendum(ref_index),
|
||||
)
|
||||
}
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -1578,6 +1682,52 @@ impl<T: Config> Pallet<T> {
|
||||
// `Compact<u32>`.
|
||||
decode_compact_u32_at(&<DepositOf<T>>::hashed_key_for(proposal))
|
||||
}
|
||||
|
||||
/// Return a proposal of an index.
|
||||
fn proposal(index: PropIndex) -> Result<(PropIndex, BoundedCallOf<T>, T::AccountId), Error<T>> {
|
||||
PublicProps::<T>::get()
|
||||
.into_iter()
|
||||
.find(|(prop_index, _, _)| prop_index == &index)
|
||||
.ok_or(Error::<T>::ProposalMissing)
|
||||
}
|
||||
|
||||
/// Clear metadata if exist for a given owner.
|
||||
fn clear_metadata(owner: MetadataOwner) {
|
||||
if let Some(hash) = MetadataOf::<T>::take(&owner) {
|
||||
Self::deposit_event(Event::<T>::MetadataCleared { owner, hash });
|
||||
}
|
||||
}
|
||||
|
||||
/// Transfer the metadata of an `owner` to a `new_owner`.
|
||||
fn transfer_metadata(owner: MetadataOwner, new_owner: MetadataOwner) {
|
||||
if let Some(hash) = MetadataOf::<T>::take(&owner) {
|
||||
MetadataOf::<T>::insert(&new_owner, hash);
|
||||
Self::deposit_event(Event::<T>::MetadataTransferred {
|
||||
prev_owner: owner,
|
||||
owner: new_owner,
|
||||
hash,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Ensure external origin for corresponding vote threshold.
|
||||
fn ensure_external_origin(
|
||||
threshold: VoteThreshold,
|
||||
origin: OriginFor<T>,
|
||||
) -> Result<(), BadOrigin> {
|
||||
match threshold {
|
||||
VoteThreshold::SuperMajorityApprove => {
|
||||
let _ = T::ExternalOrigin::ensure_origin(origin)?;
|
||||
},
|
||||
VoteThreshold::SuperMajorityAgainst => {
|
||||
let _ = T::ExternalDefaultOrigin::ensure_origin(origin)?;
|
||||
},
|
||||
VoteThreshold::SimpleMajority => {
|
||||
let _ = T::ExternalMajorityOrigin::ensure_origin(origin)?;
|
||||
},
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Decode `Compact<u32>` from the trie at given key.
|
||||
|
||||
@@ -32,7 +32,7 @@ use pallet_balances::{BalanceLock, Error as BalancesError};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
|
||||
traits::{BadOrigin, BlakeTwo256, Hash, IdentityLookup},
|
||||
Perbill,
|
||||
};
|
||||
mod cancellation;
|
||||
@@ -41,6 +41,7 @@ mod delegation;
|
||||
mod external_proposing;
|
||||
mod fast_tracking;
|
||||
mod lock_voting;
|
||||
mod metadata;
|
||||
mod public_proposals;
|
||||
mod scheduling;
|
||||
mod voting;
|
||||
@@ -276,3 +277,15 @@ fn big_nay(who: u64) -> AccountVote<u64> {
|
||||
fn tally(r: ReferendumIndex) -> Tally<u64> {
|
||||
Democracy::referendum_status(r).unwrap().tally
|
||||
}
|
||||
|
||||
/// note a new preimage without registering.
|
||||
fn note_preimage(who: u64) -> PreimageHash {
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
// note a new preimage on every function invoke.
|
||||
static COUNTER: AtomicU8 = AtomicU8::new(0);
|
||||
let data = vec![COUNTER.fetch_add(1, Ordering::Relaxed)];
|
||||
assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(who), data.clone()));
|
||||
let hash = BlakeTwo256::hash(&data);
|
||||
assert!(!Preimage::is_requested(&hash));
|
||||
hash
|
||||
}
|
||||
|
||||
@@ -32,6 +32,14 @@ fn fast_track_referendum_works() {
|
||||
RuntimeOrigin::signed(3),
|
||||
set_balance_proposal(2)
|
||||
));
|
||||
let hash = note_preimage(1);
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::External).is_none());
|
||||
assert_ok!(Democracy::set_metadata(
|
||||
RuntimeOrigin::signed(3),
|
||||
MetadataOwner::External,
|
||||
Some(hash),
|
||||
),);
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::External).is_some());
|
||||
assert_noop!(Democracy::fast_track(RuntimeOrigin::signed(1), h, 3, 2), BadOrigin);
|
||||
assert_ok!(Democracy::fast_track(RuntimeOrigin::signed(5), h, 2, 0));
|
||||
assert_eq!(
|
||||
@@ -44,6 +52,9 @@ fn fast_track_referendum_works() {
|
||||
tally: Tally { ayes: 0, nays: 0, turnout: 0 },
|
||||
})
|
||||
);
|
||||
// metadata reset from the external proposal to the referendum.
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::External).is_none());
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::Referendum(0)).is_some());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! The tests for functionality concerning the metadata.
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn set_external_metadata_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
use frame_support::traits::Hash as PreimageHash;
|
||||
// invalid preimage hash.
|
||||
let invalid_hash: PreimageHash = [1u8; 32].into();
|
||||
// metadata owner is an external proposal.
|
||||
let owner = MetadataOwner::External;
|
||||
// fails to set metadata if an external proposal does not exist.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(invalid_hash)),
|
||||
Error::<Test>::NoProposal,
|
||||
);
|
||||
// create an external proposal.
|
||||
assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2),));
|
||||
assert!(<NextExternal<Test>>::exists());
|
||||
// fails to set metadata with non external origin.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(invalid_hash)),
|
||||
BadOrigin,
|
||||
);
|
||||
// fails to set non-existing preimage.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(invalid_hash)),
|
||||
Error::<Test>::PreimageNotExist,
|
||||
);
|
||||
// set metadata successful.
|
||||
let hash = note_preimage(1);
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash),),);
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clear_metadata_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// metadata owner is an external proposal.
|
||||
let owner = MetadataOwner::External;
|
||||
// create an external proposal.
|
||||
assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2),));
|
||||
assert!(<NextExternal<Test>>::exists());
|
||||
// set metadata.
|
||||
let hash = note_preimage(1);
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash),));
|
||||
// fails to clear metadata with a wrong origin.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), None),
|
||||
BadOrigin,
|
||||
);
|
||||
// clear metadata successful.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), None));
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_proposal_metadata_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
use frame_support::traits::Hash as PreimageHash;
|
||||
// invalid preimage hash.
|
||||
let invalid_hash: PreimageHash = [1u8; 32].into();
|
||||
// create an external proposal.
|
||||
assert_ok!(propose_set_balance(1, 2, 5));
|
||||
// metadata owner is a public proposal.
|
||||
let owner = MetadataOwner::Proposal(Democracy::public_prop_count() - 1);
|
||||
// fails to set non-existing preimage.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(invalid_hash),),
|
||||
Error::<Test>::PreimageNotExist,
|
||||
);
|
||||
// note preimage.
|
||||
let hash = note_preimage(1);
|
||||
// fails to set a preimage if an origin is not a proposer.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash),),
|
||||
Error::<Test>::NoPermission,
|
||||
);
|
||||
// set metadata successful.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash),),);
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clear_proposal_metadata_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// create an external proposal.
|
||||
assert_ok!(propose_set_balance(1, 2, 5));
|
||||
// metadata owner is a public proposal.
|
||||
let owner = MetadataOwner::Proposal(Democracy::public_prop_count() - 1);
|
||||
// set metadata.
|
||||
let hash = note_preimage(1);
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash),));
|
||||
// fails to clear metadata with a wrong origin.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), None),
|
||||
Error::<Test>::NoPermission,
|
||||
);
|
||||
// clear metadata successful.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), None));
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_referendum_metadata_by_root() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let index = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal(2),
|
||||
VoteThreshold::SuperMajorityApprove,
|
||||
0,
|
||||
);
|
||||
// metadata owner is a referendum.
|
||||
let owner = MetadataOwner::Referendum(index);
|
||||
// note preimage.
|
||||
let hash = note_preimage(1);
|
||||
// fails to set if not a root.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash),),
|
||||
Error::<Test>::NoPermission,
|
||||
);
|
||||
// fails to clear if not a root.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), None,),
|
||||
Error::<Test>::NoPermission,
|
||||
);
|
||||
// succeed to set metadata by a root for an ongoing referendum.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::root(), owner.clone(), Some(hash),));
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet {
|
||||
owner: owner.clone(),
|
||||
hash,
|
||||
}));
|
||||
// succeed to clear metadata by a root for an ongoing referendum.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::root(), owner.clone(), None));
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clear_referendum_metadata_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// create a referendum.
|
||||
let index = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal(2),
|
||||
VoteThreshold::SuperMajorityApprove,
|
||||
0,
|
||||
);
|
||||
// metadata owner is a referendum.
|
||||
let owner = MetadataOwner::Referendum(index);
|
||||
// set metadata.
|
||||
let hash = note_preimage(1);
|
||||
// referendum finished.
|
||||
MetadataOf::<Test>::insert(owner.clone(), hash);
|
||||
// no permission to clear metadata of an ongoing referendum.
|
||||
assert_noop!(
|
||||
Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), None),
|
||||
Error::<Test>::NoPermission,
|
||||
);
|
||||
// referendum finished.
|
||||
ReferendumInfoOf::<Test>::insert(
|
||||
index,
|
||||
ReferendumInfo::Finished { end: 1, approved: true },
|
||||
);
|
||||
// clear metadata successful.
|
||||
assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), None));
|
||||
System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataCleared {
|
||||
owner,
|
||||
hash,
|
||||
}));
|
||||
});
|
||||
}
|
||||
@@ -91,8 +91,20 @@ fn cancel_proposal_should_work() {
|
||||
assert_ok!(propose_set_balance(1, 2, 2));
|
||||
assert_ok!(propose_set_balance(1, 4, 4));
|
||||
assert_noop!(Democracy::cancel_proposal(RuntimeOrigin::signed(1), 0), BadOrigin);
|
||||
let hash = note_preimage(1);
|
||||
assert_ok!(Democracy::set_metadata(
|
||||
RuntimeOrigin::signed(1),
|
||||
MetadataOwner::Proposal(0),
|
||||
Some(hash)
|
||||
));
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::Proposal(0)).is_some());
|
||||
assert_ok!(Democracy::cancel_proposal(RuntimeOrigin::root(), 0));
|
||||
System::assert_last_event(crate::Event::ProposalCanceled { prop_index: 0 }.into());
|
||||
// metadata cleared, preimage unrequested.
|
||||
assert!(<MetadataOf<Test>>::get(MetadataOwner::Proposal(0)).is_none());
|
||||
System::assert_has_event(crate::Event::ProposalCanceled { prop_index: 0 }.into());
|
||||
System::assert_last_event(
|
||||
crate::Event::MetadataCleared { owner: MetadataOwner::Proposal(0), hash }.into(),
|
||||
);
|
||||
assert_eq!(Democracy::backing_for(0), None);
|
||||
assert_eq!(Democracy::backing_for(1), Some(4));
|
||||
});
|
||||
|
||||
@@ -25,6 +25,12 @@ use sp_runtime::{
|
||||
RuntimeDebug,
|
||||
};
|
||||
|
||||
/// A proposal index.
|
||||
pub type PropIndex = u32;
|
||||
|
||||
/// A referendum index.
|
||||
pub type ReferendumIndex = u32;
|
||||
|
||||
/// Info regarding an ongoing referendum.
|
||||
#[derive(Encode, MaxEncodedLen, Decode, Default, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
|
||||
pub struct Tally<Balance> {
|
||||
@@ -206,3 +212,14 @@ pub enum UnvoteScope {
|
||||
/// Permitted to do only the changes that do not need the owner's permission.
|
||||
OnlyExpired,
|
||||
}
|
||||
|
||||
/// Identifies an owner of a metadata.
|
||||
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
|
||||
pub enum MetadataOwner {
|
||||
/// External proposal.
|
||||
External,
|
||||
/// Public proposal of the index.
|
||||
Proposal(PropIndex),
|
||||
/// Referendum of the index.
|
||||
Referendum(ReferendumIndex),
|
||||
}
|
||||
|
||||
@@ -18,25 +18,26 @@
|
||||
//! Autogenerated weights for pallet_democracy
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-01-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! HOSTNAME: `runner-b3zmxxc-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/substrate
|
||||
// target/production/substrate
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet_democracy
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --output=./frame/democracy/src/weights.rs
|
||||
// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_democracy
|
||||
// --chain=dev
|
||||
// --header=./HEADER-APACHE2
|
||||
// --output=./frame/democracy/src/weights.rs
|
||||
// --template=./.maintain/frame-weight-template.hbs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
@@ -70,6 +71,12 @@ pub trait WeightInfo {
|
||||
fn unlock_set(r: u32, ) -> Weight;
|
||||
fn remove_vote(r: u32, ) -> Weight;
|
||||
fn remove_other_vote(r: u32, ) -> Weight;
|
||||
fn set_external_metadata() -> Weight;
|
||||
fn clear_external_metadata() -> Weight;
|
||||
fn set_proposal_metadata() -> Weight;
|
||||
fn clear_proposal_metadata() -> Weight;
|
||||
fn set_referendum_metadata() -> Weight;
|
||||
fn clear_referendum_metadata() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for pallet_democracy using the Substrate node and recommended hardware.
|
||||
@@ -87,8 +94,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4864`
|
||||
// Estimated: `23409`
|
||||
// Minimum execution time: 34_509 nanoseconds.
|
||||
Weight::from_parts(34_781_000, 23409)
|
||||
// Minimum execution time: 42_939 nanoseconds.
|
||||
Weight::from_parts(43_543_000, 23409)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -98,8 +105,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3620`
|
||||
// Estimated: `5705`
|
||||
// Minimum execution time: 31_151 nanoseconds.
|
||||
Weight::from_parts(31_566_000, 5705)
|
||||
// Minimum execution time: 36_475 nanoseconds.
|
||||
Weight::from_parts(37_863_000, 5705)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -111,10 +118,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
|
||||
fn vote_new() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3555`
|
||||
// Measured: `3565`
|
||||
// Estimated: `12720`
|
||||
// Minimum execution time: 42_618 nanoseconds.
|
||||
Weight::from_parts(43_231_000, 12720)
|
||||
// Minimum execution time: 56_372 nanoseconds.
|
||||
Weight::from_parts(57_483_000, 12720)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -126,10 +133,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
|
||||
fn vote_existing() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3577`
|
||||
// Measured: `3587`
|
||||
// Estimated: `12720`
|
||||
// Minimum execution time: 42_875 nanoseconds.
|
||||
Weight::from_parts(43_338_000, 12720)
|
||||
// Minimum execution time: 56_789 nanoseconds.
|
||||
Weight::from_parts(57_737_000, 12720)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -137,14 +144,16 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy Cancellations (r:1 w:1)
|
||||
/// Proof: Democracy Cancellations (max_values: None, max_size: Some(33), added: 2508, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn emergency_cancel() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `320`
|
||||
// Estimated: `5184`
|
||||
// Minimum execution time: 16_543 nanoseconds.
|
||||
Weight::from_parts(16_762_000, 5184)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
// Measured: `398`
|
||||
// Estimated: `7712`
|
||||
// Minimum execution time: 24_379 nanoseconds.
|
||||
Weight::from_parts(25_302_000, 7712)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:1)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
@@ -152,6 +161,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen)
|
||||
/// Storage: System Account (r:1 w:1)
|
||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:3 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:1 w:1)
|
||||
@@ -160,12 +171,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen)
|
||||
fn blacklist() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `5958`
|
||||
// Estimated: `28808`
|
||||
// Minimum execution time: 70_135 nanoseconds.
|
||||
Weight::from_parts(70_616_000, 28808)
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
// Measured: `6036`
|
||||
// Estimated: `36392`
|
||||
// Minimum execution time: 100_345 nanoseconds.
|
||||
Weight::from_parts(102_233_000, 36392)
|
||||
.saturating_add(T::DbWeight::get().reads(8_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(7_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
@@ -175,8 +186,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3448`
|
||||
// Estimated: `6340`
|
||||
// Minimum execution time: 12_580 nanoseconds.
|
||||
Weight::from_parts(12_987_000, 6340)
|
||||
// Minimum execution time: 13_155 nanoseconds.
|
||||
Weight::from_parts(14_158_000, 6340)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -186,8 +197,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_320 nanoseconds.
|
||||
Weight::from_ref_time(3_513_000)
|
||||
// Minimum execution time: 2_961 nanoseconds.
|
||||
Weight::from_ref_time(3_139_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:0 w:1)
|
||||
@@ -196,37 +207,41 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_407 nanoseconds.
|
||||
Weight::from_ref_time(3_565_000)
|
||||
// Minimum execution time: 3_040 nanoseconds.
|
||||
Weight::from_ref_time(3_261_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumCount (r:1 w:1)
|
||||
/// Proof: Democracy ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:2)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:0 w:1)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
fn fast_track() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `212`
|
||||
// Estimated: `1126`
|
||||
// Minimum execution time: 16_831 nanoseconds.
|
||||
Weight::from_parts(17_155_000, 1126)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
// Measured: `286`
|
||||
// Estimated: `3654`
|
||||
// Minimum execution time: 26_666 nanoseconds.
|
||||
Weight::from_parts(28_014_000, 3654)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy Blacklist (r:1 w:1)
|
||||
/// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn veto_external() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3477`
|
||||
// Estimated: `6340`
|
||||
// Minimum execution time: 22_072 nanoseconds.
|
||||
Weight::from_parts(22_517_000, 6340)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
// Measured: `3551`
|
||||
// Estimated: `8868`
|
||||
// Minimum execution time: 30_180 nanoseconds.
|
||||
Weight::from_parts(31_593_000, 8868)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:1)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
@@ -234,24 +249,29 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen)
|
||||
/// Storage: System Account (r:1 w:1)
|
||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn cancel_proposal() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `5837`
|
||||
// Estimated: `25505`
|
||||
// Minimum execution time: 56_925 nanoseconds.
|
||||
Weight::from_parts(57_253_000, 25505)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
// Measured: `5915`
|
||||
// Estimated: `28033`
|
||||
// Minimum execution time: 80_780 nanoseconds.
|
||||
Weight::from_parts(82_070_000, 28033)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||
}
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:0 w:1)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
fn cancel_referendum() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_582 nanoseconds.
|
||||
Weight::from_ref_time(8_754_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
// Measured: `271`
|
||||
// Estimated: `2528`
|
||||
// Minimum execution time: 18_117 nanoseconds.
|
||||
Weight::from_parts(19_027_000, 2528)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: Democracy LowestUnbaked (r:1 w:1)
|
||||
/// Proof: Democracy LowestUnbaked (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
@@ -262,12 +282,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn on_initialize_base(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `207 + r * (117 ±0)`
|
||||
// Measured: `244 + r * (117 ±0)`
|
||||
// Estimated: `998 + r * (2676 ±0)`
|
||||
// Minimum execution time: 6_665 nanoseconds.
|
||||
Weight::from_parts(9_219_932, 998)
|
||||
// Standard Error: 4_236
|
||||
.saturating_add(Weight::from_ref_time(2_194_623).saturating_mul(r.into()))
|
||||
// Minimum execution time: 7_093 nanoseconds.
|
||||
Weight::from_parts(8_792_955, 998)
|
||||
// Standard Error: 6_630
|
||||
.saturating_add(Weight::from_ref_time(3_091_565).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
@@ -288,12 +308,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn on_initialize_base_with_launch_period(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `207 + r * (117 ±0)`
|
||||
// Measured: `244 + r * (117 ±0)`
|
||||
// Estimated: `19318 + r * (2676 ±0)`
|
||||
// Minimum execution time: 9_842 nanoseconds.
|
||||
Weight::from_parts(11_932_535, 19318)
|
||||
// Standard Error: 4_413
|
||||
.saturating_add(Weight::from_ref_time(2_199_644).saturating_mul(r.into()))
|
||||
// Minimum execution time: 10_372 nanoseconds.
|
||||
Weight::from_parts(10_961_165, 19318)
|
||||
// Standard Error: 7_284
|
||||
.saturating_add(Weight::from_ref_time(3_112_573).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
@@ -308,12 +328,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn delegate(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `948 + r * (139 ±0)`
|
||||
// Measured: `958 + r * (139 ±0)`
|
||||
// Estimated: `22584 + r * (2676 ±0)`
|
||||
// Minimum execution time: 34_740 nanoseconds.
|
||||
Weight::from_parts(38_366_374, 22584)
|
||||
// Standard Error: 4_868
|
||||
.saturating_add(Weight::from_ref_time(3_286_516).saturating_mul(r.into()))
|
||||
// Minimum execution time: 36_618 nanoseconds.
|
||||
Weight::from_parts(42_803_184, 22584)
|
||||
// Standard Error: 7_268
|
||||
.saturating_add(Weight::from_ref_time(4_537_902).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||
@@ -327,12 +347,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn undelegate(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `547 + r * (139 ±0)`
|
||||
// Measured: `557 + r * (139 ±0)`
|
||||
// Estimated: `12540 + r * (2676 ±0)`
|
||||
// Minimum execution time: 19_516 nanoseconds.
|
||||
Weight::from_parts(21_629_605, 12540)
|
||||
// Standard Error: 4_401
|
||||
.saturating_add(Weight::from_ref_time(3_238_187).saturating_mul(r.into()))
|
||||
// Minimum execution time: 19_758 nanoseconds.
|
||||
Weight::from_parts(21_641_793, 12540)
|
||||
// Standard Error: 6_889
|
||||
.saturating_add(Weight::from_ref_time(4_478_884).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
@@ -345,8 +365,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_291 nanoseconds.
|
||||
Weight::from_ref_time(3_485_000)
|
||||
// Minimum execution time: 2_844 nanoseconds.
|
||||
Weight::from_ref_time(3_017_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy VotingOf (r:1 w:1)
|
||||
@@ -358,12 +378,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn unlock_remove(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `617`
|
||||
// Measured: `627`
|
||||
// Estimated: `12647`
|
||||
// Minimum execution time: 19_357 nanoseconds.
|
||||
Weight::from_parts(24_014_517, 12647)
|
||||
// Standard Error: 994
|
||||
.saturating_add(Weight::from_ref_time(17_096).saturating_mul(r.into()))
|
||||
// Minimum execution time: 20_380 nanoseconds.
|
||||
Weight::from_parts(28_295_875, 12647)
|
||||
// Standard Error: 2_331
|
||||
.saturating_add(Weight::from_ref_time(67_348).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -376,12 +396,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn unlock_set(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618 + r * (22 ±0)`
|
||||
// Measured: `628 + r * (22 ±0)`
|
||||
// Estimated: `12647`
|
||||
// Minimum execution time: 22_340 nanoseconds.
|
||||
Weight::from_parts(23_355_734, 12647)
|
||||
// Standard Error: 548
|
||||
.saturating_add(Weight::from_ref_time(64_308).saturating_mul(r.into()))
|
||||
// Minimum execution time: 24_475 nanoseconds.
|
||||
Weight::from_parts(27_102_576, 12647)
|
||||
// Standard Error: 1_464
|
||||
.saturating_add(Weight::from_ref_time(128_921).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -392,12 +412,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[1, 100]`.
|
||||
fn remove_vote(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `781 + r * (26 ±0)`
|
||||
// Measured: `791 + r * (26 ±0)`
|
||||
// Estimated: `8946`
|
||||
// Minimum execution time: 14_542 nanoseconds.
|
||||
Weight::from_parts(16_411_916, 8946)
|
||||
// Standard Error: 839
|
||||
.saturating_add(Weight::from_ref_time(73_268).saturating_mul(r.into()))
|
||||
// Minimum execution time: 15_039 nanoseconds.
|
||||
Weight::from_parts(19_252_498, 8946)
|
||||
// Standard Error: 1_798
|
||||
.saturating_add(Weight::from_ref_time(131_855).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -408,15 +428,97 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `r` is `[1, 100]`.
|
||||
fn remove_other_vote(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `781 + r * (26 ±0)`
|
||||
// Measured: `791 + r * (26 ±0)`
|
||||
// Estimated: `8946`
|
||||
// Minimum execution time: 14_463 nanoseconds.
|
||||
Weight::from_parts(16_302_901, 8946)
|
||||
// Standard Error: 809
|
||||
.saturating_add(Weight::from_ref_time(73_692).saturating_mul(r.into()))
|
||||
// Minimum execution time: 14_837 nanoseconds.
|
||||
Weight::from_parts(19_144_929, 8946)
|
||||
// Standard Error: 1_875
|
||||
.saturating_add(Weight::from_ref_time(136_819).saturating_mul(r.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:0)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_external_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `356`
|
||||
// Estimated: `3193`
|
||||
// Minimum execution time: 17_338 nanoseconds.
|
||||
Weight::from_parts(17_946_000, 3193)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:0)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_external_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `286`
|
||||
// Estimated: `3155`
|
||||
// Minimum execution time: 15_364 nanoseconds.
|
||||
Weight::from_parts(15_990_000, 3155)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:0)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_proposal_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4919`
|
||||
// Estimated: `19763`
|
||||
// Minimum execution time: 37_147 nanoseconds.
|
||||
Weight::from_parts(37_778_000, 19763)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:0)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_proposal_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4853`
|
||||
// Estimated: `19725`
|
||||
// Minimum execution time: 34_118 nanoseconds.
|
||||
Weight::from_parts(34_737_000, 19725)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_referendum_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `144`
|
||||
// Estimated: `2566`
|
||||
// Minimum execution time: 12_787 nanoseconds.
|
||||
Weight::from_parts(13_463_000, 2566)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy ReferendumInfoOf (r:1 w:0)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_referendum_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `302`
|
||||
// Estimated: `5204`
|
||||
// Minimum execution time: 17_636 nanoseconds.
|
||||
Weight::from_parts(18_399_000, 5204)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests
|
||||
@@ -433,8 +535,8 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4864`
|
||||
// Estimated: `23409`
|
||||
// Minimum execution time: 34_509 nanoseconds.
|
||||
Weight::from_parts(34_781_000, 23409)
|
||||
// Minimum execution time: 42_939 nanoseconds.
|
||||
Weight::from_parts(43_543_000, 23409)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -444,8 +546,8 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3620`
|
||||
// Estimated: `5705`
|
||||
// Minimum execution time: 31_151 nanoseconds.
|
||||
Weight::from_parts(31_566_000, 5705)
|
||||
// Minimum execution time: 36_475 nanoseconds.
|
||||
Weight::from_parts(37_863_000, 5705)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -457,10 +559,10 @@ impl WeightInfo for () {
|
||||
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
|
||||
fn vote_new() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3555`
|
||||
// Measured: `3565`
|
||||
// Estimated: `12720`
|
||||
// Minimum execution time: 42_618 nanoseconds.
|
||||
Weight::from_parts(43_231_000, 12720)
|
||||
// Minimum execution time: 56_372 nanoseconds.
|
||||
Weight::from_parts(57_483_000, 12720)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -472,10 +574,10 @@ impl WeightInfo for () {
|
||||
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
|
||||
fn vote_existing() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3577`
|
||||
// Measured: `3587`
|
||||
// Estimated: `12720`
|
||||
// Minimum execution time: 42_875 nanoseconds.
|
||||
Weight::from_parts(43_338_000, 12720)
|
||||
// Minimum execution time: 56_789 nanoseconds.
|
||||
Weight::from_parts(57_737_000, 12720)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -483,14 +585,16 @@ impl WeightInfo for () {
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy Cancellations (r:1 w:1)
|
||||
/// Proof: Democracy Cancellations (max_values: None, max_size: Some(33), added: 2508, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn emergency_cancel() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `320`
|
||||
// Estimated: `5184`
|
||||
// Minimum execution time: 16_543 nanoseconds.
|
||||
Weight::from_parts(16_762_000, 5184)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
// Measured: `398`
|
||||
// Estimated: `7712`
|
||||
// Minimum execution time: 24_379 nanoseconds.
|
||||
Weight::from_parts(25_302_000, 7712)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:1)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
@@ -498,6 +602,8 @@ impl WeightInfo for () {
|
||||
/// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen)
|
||||
/// Storage: System Account (r:1 w:1)
|
||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:3 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:1 w:1)
|
||||
@@ -506,12 +612,12 @@ impl WeightInfo for () {
|
||||
/// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen)
|
||||
fn blacklist() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `5958`
|
||||
// Estimated: `28808`
|
||||
// Minimum execution time: 70_135 nanoseconds.
|
||||
Weight::from_parts(70_616_000, 28808)
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
// Measured: `6036`
|
||||
// Estimated: `36392`
|
||||
// Minimum execution time: 100_345 nanoseconds.
|
||||
Weight::from_parts(102_233_000, 36392)
|
||||
.saturating_add(RocksDbWeight::get().reads(8_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(7_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
@@ -521,8 +627,8 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3448`
|
||||
// Estimated: `6340`
|
||||
// Minimum execution time: 12_580 nanoseconds.
|
||||
Weight::from_parts(12_987_000, 6340)
|
||||
// Minimum execution time: 13_155 nanoseconds.
|
||||
Weight::from_parts(14_158_000, 6340)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -532,8 +638,8 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_320 nanoseconds.
|
||||
Weight::from_ref_time(3_513_000)
|
||||
// Minimum execution time: 2_961 nanoseconds.
|
||||
Weight::from_ref_time(3_139_000)
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:0 w:1)
|
||||
@@ -542,37 +648,41 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_407 nanoseconds.
|
||||
Weight::from_ref_time(3_565_000)
|
||||
// Minimum execution time: 3_040 nanoseconds.
|
||||
Weight::from_ref_time(3_261_000)
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumCount (r:1 w:1)
|
||||
/// Proof: Democracy ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:2)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:0 w:1)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
fn fast_track() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `212`
|
||||
// Estimated: `1126`
|
||||
// Minimum execution time: 16_831 nanoseconds.
|
||||
Weight::from_parts(17_155_000, 1126)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
// Measured: `286`
|
||||
// Estimated: `3654`
|
||||
// Minimum execution time: 26_666 nanoseconds.
|
||||
Weight::from_parts(28_014_000, 3654)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:1)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy Blacklist (r:1 w:1)
|
||||
/// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn veto_external() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `3477`
|
||||
// Estimated: `6340`
|
||||
// Minimum execution time: 22_072 nanoseconds.
|
||||
Weight::from_parts(22_517_000, 6340)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
// Measured: `3551`
|
||||
// Estimated: `8868`
|
||||
// Minimum execution time: 30_180 nanoseconds.
|
||||
Weight::from_parts(31_593_000, 8868)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:1)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
@@ -580,24 +690,29 @@ impl WeightInfo for () {
|
||||
/// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen)
|
||||
/// Storage: System Account (r:1 w:1)
|
||||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn cancel_proposal() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `5837`
|
||||
// Estimated: `25505`
|
||||
// Minimum execution time: 56_925 nanoseconds.
|
||||
Weight::from_parts(57_253_000, 25505)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
// Measured: `5915`
|
||||
// Estimated: `28033`
|
||||
// Minimum execution time: 80_780 nanoseconds.
|
||||
Weight::from_parts(82_070_000, 28033)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||
}
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy ReferendumInfoOf (r:0 w:1)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
fn cancel_referendum() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_582 nanoseconds.
|
||||
Weight::from_ref_time(8_754_000)
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
// Measured: `271`
|
||||
// Estimated: `2528`
|
||||
// Minimum execution time: 18_117 nanoseconds.
|
||||
Weight::from_parts(19_027_000, 2528)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: Democracy LowestUnbaked (r:1 w:1)
|
||||
/// Proof: Democracy LowestUnbaked (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
@@ -608,12 +723,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn on_initialize_base(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `207 + r * (117 ±0)`
|
||||
// Measured: `244 + r * (117 ±0)`
|
||||
// Estimated: `998 + r * (2676 ±0)`
|
||||
// Minimum execution time: 6_665 nanoseconds.
|
||||
Weight::from_parts(9_219_932, 998)
|
||||
// Standard Error: 4_236
|
||||
.saturating_add(Weight::from_ref_time(2_194_623).saturating_mul(r.into()))
|
||||
// Minimum execution time: 7_093 nanoseconds.
|
||||
Weight::from_parts(8_792_955, 998)
|
||||
// Standard Error: 6_630
|
||||
.saturating_add(Weight::from_ref_time(3_091_565).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
@@ -634,12 +749,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn on_initialize_base_with_launch_period(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `207 + r * (117 ±0)`
|
||||
// Measured: `244 + r * (117 ±0)`
|
||||
// Estimated: `19318 + r * (2676 ±0)`
|
||||
// Minimum execution time: 9_842 nanoseconds.
|
||||
Weight::from_parts(11_932_535, 19318)
|
||||
// Standard Error: 4_413
|
||||
.saturating_add(Weight::from_ref_time(2_199_644).saturating_mul(r.into()))
|
||||
// Minimum execution time: 10_372 nanoseconds.
|
||||
Weight::from_parts(10_961_165, 19318)
|
||||
// Standard Error: 7_284
|
||||
.saturating_add(Weight::from_ref_time(3_112_573).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
@@ -654,12 +769,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn delegate(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `948 + r * (139 ±0)`
|
||||
// Measured: `958 + r * (139 ±0)`
|
||||
// Estimated: `22584 + r * (2676 ±0)`
|
||||
// Minimum execution time: 34_740 nanoseconds.
|
||||
Weight::from_parts(38_366_374, 22584)
|
||||
// Standard Error: 4_868
|
||||
.saturating_add(Weight::from_ref_time(3_286_516).saturating_mul(r.into()))
|
||||
// Minimum execution time: 36_618 nanoseconds.
|
||||
Weight::from_parts(42_803_184, 22584)
|
||||
// Standard Error: 7_268
|
||||
.saturating_add(Weight::from_ref_time(4_537_902).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||
@@ -673,12 +788,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn undelegate(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `547 + r * (139 ±0)`
|
||||
// Measured: `557 + r * (139 ±0)`
|
||||
// Estimated: `12540 + r * (2676 ±0)`
|
||||
// Minimum execution time: 19_516 nanoseconds.
|
||||
Weight::from_parts(21_629_605, 12540)
|
||||
// Standard Error: 4_401
|
||||
.saturating_add(Weight::from_ref_time(3_238_187).saturating_mul(r.into()))
|
||||
// Minimum execution time: 19_758 nanoseconds.
|
||||
Weight::from_parts(21_641_793, 12540)
|
||||
// Standard Error: 6_889
|
||||
.saturating_add(Weight::from_ref_time(4_478_884).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
@@ -691,8 +806,8 @@ impl WeightInfo for () {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_291 nanoseconds.
|
||||
Weight::from_ref_time(3_485_000)
|
||||
// Minimum execution time: 2_844 nanoseconds.
|
||||
Weight::from_ref_time(3_017_000)
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy VotingOf (r:1 w:1)
|
||||
@@ -704,12 +819,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn unlock_remove(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `617`
|
||||
// Measured: `627`
|
||||
// Estimated: `12647`
|
||||
// Minimum execution time: 19_357 nanoseconds.
|
||||
Weight::from_parts(24_014_517, 12647)
|
||||
// Standard Error: 994
|
||||
.saturating_add(Weight::from_ref_time(17_096).saturating_mul(r.into()))
|
||||
// Minimum execution time: 20_380 nanoseconds.
|
||||
Weight::from_parts(28_295_875, 12647)
|
||||
// Standard Error: 2_331
|
||||
.saturating_add(Weight::from_ref_time(67_348).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -722,12 +837,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[0, 99]`.
|
||||
fn unlock_set(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618 + r * (22 ±0)`
|
||||
// Measured: `628 + r * (22 ±0)`
|
||||
// Estimated: `12647`
|
||||
// Minimum execution time: 22_340 nanoseconds.
|
||||
Weight::from_parts(23_355_734, 12647)
|
||||
// Standard Error: 548
|
||||
.saturating_add(Weight::from_ref_time(64_308).saturating_mul(r.into()))
|
||||
// Minimum execution time: 24_475 nanoseconds.
|
||||
Weight::from_parts(27_102_576, 12647)
|
||||
// Standard Error: 1_464
|
||||
.saturating_add(Weight::from_ref_time(128_921).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -738,12 +853,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[1, 100]`.
|
||||
fn remove_vote(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `781 + r * (26 ±0)`
|
||||
// Measured: `791 + r * (26 ±0)`
|
||||
// Estimated: `8946`
|
||||
// Minimum execution time: 14_542 nanoseconds.
|
||||
Weight::from_parts(16_411_916, 8946)
|
||||
// Standard Error: 839
|
||||
.saturating_add(Weight::from_ref_time(73_268).saturating_mul(r.into()))
|
||||
// Minimum execution time: 15_039 nanoseconds.
|
||||
Weight::from_parts(19_252_498, 8946)
|
||||
// Standard Error: 1_798
|
||||
.saturating_add(Weight::from_ref_time(131_855).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -754,13 +869,95 @@ impl WeightInfo for () {
|
||||
/// The range of component `r` is `[1, 100]`.
|
||||
fn remove_other_vote(r: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `781 + r * (26 ±0)`
|
||||
// Measured: `791 + r * (26 ±0)`
|
||||
// Estimated: `8946`
|
||||
// Minimum execution time: 14_463 nanoseconds.
|
||||
Weight::from_parts(16_302_901, 8946)
|
||||
// Standard Error: 809
|
||||
.saturating_add(Weight::from_ref_time(73_692).saturating_mul(r.into()))
|
||||
// Minimum execution time: 14_837 nanoseconds.
|
||||
Weight::from_parts(19_144_929, 8946)
|
||||
// Standard Error: 1_875
|
||||
.saturating_add(Weight::from_ref_time(136_819).saturating_mul(r.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:0)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_external_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `356`
|
||||
// Estimated: `3193`
|
||||
// Minimum execution time: 17_338 nanoseconds.
|
||||
Weight::from_parts(17_946_000, 3193)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy NextExternal (r:1 w:0)
|
||||
/// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_external_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `286`
|
||||
// Estimated: `3155`
|
||||
// Minimum execution time: 15_364 nanoseconds.
|
||||
Weight::from_parts(15_990_000, 3155)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:0)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_proposal_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4919`
|
||||
// Estimated: `19763`
|
||||
// Minimum execution time: 37_147 nanoseconds.
|
||||
Weight::from_parts(37_778_000, 19763)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy PublicProps (r:1 w:0)
|
||||
/// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_proposal_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `4853`
|
||||
// Estimated: `19725`
|
||||
// Minimum execution time: 34_118 nanoseconds.
|
||||
Weight::from_parts(34_737_000, 19725)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Preimage StatusFor (r:1 w:0)
|
||||
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:0 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn set_referendum_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `144`
|
||||
// Estimated: `2566`
|
||||
// Minimum execution time: 12_787 nanoseconds.
|
||||
Weight::from_parts(13_463_000, 2566)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: Democracy ReferendumInfoOf (r:1 w:0)
|
||||
/// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen)
|
||||
/// Storage: Democracy MetadataOf (r:1 w:1)
|
||||
/// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen)
|
||||
fn clear_referendum_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `302`
|
||||
// Estimated: `5204`
|
||||
// Minimum execution time: 17_636 nanoseconds.
|
||||
Weight::from_parts(18_399_000, 5204)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user