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:
Muharem Ismailov
2023-02-08 09:33:34 +01:00
committed by GitHub
parent 45f7f5b572
commit cc766cc1c5
13 changed files with 1367 additions and 350 deletions
+25 -1
View File
@@ -33,7 +33,6 @@ use sp_runtime::traits::Bounded as ArithBounded;
const SEED: u32 = 0;
#[allow(dead_code)]
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
@@ -631,6 +630,31 @@ benchmarks_instance_pallet! {
assert_matches!(info, ReferendumInfo::Rejected(..));
}
set_some_metadata {
use sp_std::borrow::Cow;
let origin = T::SubmitOrigin::try_successful_origin()
.expect("SubmitOrigin has no successful origin required for the benchmark");
let index = create_referendum::<T, I>(origin.clone());
let hash = T::Preimages::note(Cow::from(vec![5, 6])).unwrap();
}: set_metadata<T::RuntimeOrigin>(origin, index, Some(hash))
verify {
assert_last_event::<T, I>(Event::MetadataSet { index, hash }.into());
}
clear_metadata {
use sp_std::borrow::Cow;
let origin = T::SubmitOrigin::try_successful_origin()
.expect("SubmitOrigin has no successful origin required for the benchmark");
let index = create_referendum::<T, I>(origin.clone());
let hash = T::Preimages::note(Cow::from(vec![6, 7, 8])).unwrap();
assert_ok!(
Referenda::<T, I>::set_metadata(origin.clone(), index, Some(hash))
);
}: set_metadata<T::RuntimeOrigin>(origin, index, None)
verify {
assert_last_event::<T, I>(Event::MetadataCleared { index, hash }.into());
}
impl_benchmark_test_suite!(
Referenda,
crate::mock::new_test_ext(),
+70 -2
View File
@@ -72,8 +72,8 @@ use frame_support::{
v3::{Anon as ScheduleAnon, Named as ScheduleNamed},
DispatchTime,
},
Currency, LockIdentifier, OnUnbalanced, OriginTrait, PollStatus, Polling, QueryPreimage,
ReservableCurrency, StorePreimage, VoteTally,
Currency, Hash as PreimageHash, LockIdentifier, OnUnbalanced, OriginTrait, PollStatus,
Polling, QueryPreimage, ReservableCurrency, StorePreimage, VoteTally,
},
BoundedVec,
};
@@ -251,6 +251,16 @@ pub mod pallet {
pub type DecidingCount<T: Config<I>, I: 'static = ()> =
StorageMap<_, Twox64Concat, TrackIdOf<T, I>, u32, ValueQuery>;
/// The metadata is a general information concerning the 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<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, ReferendumIndex, PreimageHash>;
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
@@ -356,6 +366,20 @@ pub mod pallet {
/// The amount placed by the account.
amount: BalanceOf<T, I>,
},
/// Metadata for a referendum has been set.
MetadataSet {
/// Index of the referendum.
index: ReferendumIndex,
/// Preimage hash.
hash: PreimageHash,
},
/// Metadata for a referendum has been cleared.
MetadataCleared {
/// Index of the referendum.
index: ReferendumIndex,
/// Preimage hash.
hash: PreimageHash,
},
}
#[pallet::error]
@@ -384,6 +408,8 @@ pub mod pallet {
NoDeposit,
/// The referendum status is invalid for this operation.
BadStatus,
/// The preimage does not exist.
PreimageNotExist,
}
#[pallet::call]
@@ -540,6 +566,7 @@ pub mod pallet {
Self::deposit_event(Event::<T, I>::Killed { index, tally: status.tally });
Self::slash_deposit(Some(status.submission_deposit.clone()));
Self::slash_deposit(status.decision_deposit.clone());
Self::do_clear_metadata(index);
let info = ReferendumInfo::Killed(frame_system::Pallet::<T>::block_number());
ReferendumInfoFor::<T, I>::insert(index, info);
Ok(())
@@ -633,6 +660,40 @@ pub mod pallet {
Self::deposit_event(e);
Ok(())
}
/// Set or clear metadata of a referendum.
///
/// Parameters:
/// - `origin`: Must be `Signed` by a creator of a referendum or by anyone to clear a
/// metadata of a finished referendum.
/// - `index`: The index of a referendum to set or clear metadata for.
/// - `maybe_hash`: The hash of an on-chain stored preimage. `None` to clear a metadata.
#[pallet::call_index(8)]
#[pallet::weight(
maybe_hash.map_or(
T::WeightInfo::clear_metadata(), |_| T::WeightInfo::set_some_metadata())
)]
pub fn set_metadata(
origin: OriginFor<T>,
index: ReferendumIndex,
maybe_hash: Option<PreimageHash>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
if let Some(hash) = maybe_hash {
let status = Self::ensure_ongoing(index)?;
ensure!(status.submission_deposit.who == who, Error::<T, I>::NoPermission);
ensure!(T::Preimages::len(&hash).is_some(), Error::<T, I>::PreimageNotExist);
MetadataOf::<T, I>::insert(index, hash);
Self::deposit_event(Event::<T, I>::MetadataSet { index, hash });
Ok(())
} else {
if let Some(status) = Self::ensure_ongoing(index).ok() {
ensure!(status.submission_deposit.who == who, Error::<T, I>::NoPermission);
}
Self::do_clear_metadata(index);
Ok(())
}
}
}
}
@@ -1204,4 +1265,11 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
support_needed.passing(x, tally.support(id)) &&
approval_needed.passing(x, tally.approval(id))
}
/// Clear metadata if exist for a given referendum index.
fn do_clear_metadata(index: ReferendumIndex) {
if let Some(hash) = MetadataOf::<T, I>::take(index) {
Self::deposit_event(Event::<T, I>::MetadataCleared { index, hash });
}
}
}
+13 -1
View File
@@ -32,7 +32,7 @@ use frame_system::{EnsureRoot, EnsureSignedBy};
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
traits::{BlakeTwo256, Hash, IdentityLookup},
DispatchResult, Perbill,
};
@@ -470,3 +470,15 @@ impl RefState {
index
}
}
/// note a new preimage without registering.
pub 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
}
+72
View File
@@ -578,3 +578,75 @@ fn curve_handles_all_inputs() {
let threshold = test_curve.threshold(Perbill::one());
assert_eq!(threshold, Perbill::zero());
}
#[test]
fn set_metadata_works() {
new_test_ext().execute_with(|| {
use frame_support::traits::Hash as PreimageHash;
// invalid preimage hash.
let invalid_hash: PreimageHash = [1u8; 32].into();
// fails to set metadata for a finished referendum.
assert_ok!(Referenda::submit(
RuntimeOrigin::signed(1),
Box::new(RawOrigin::Root.into()),
set_balance_proposal_bounded(1),
DispatchTime::At(1),
));
let index = ReferendumCount::<Test>::get() - 1;
assert_ok!(Referenda::kill(RuntimeOrigin::root(), index));
assert_noop!(
Referenda::set_metadata(RuntimeOrigin::signed(1), index, Some(invalid_hash)),
Error::<Test>::NotOngoing,
);
// no permission to set metadata.
assert_ok!(Referenda::submit(
RuntimeOrigin::signed(1),
Box::new(RawOrigin::Root.into()),
set_balance_proposal_bounded(1),
DispatchTime::At(1),
));
let index = ReferendumCount::<Test>::get() - 1;
assert_noop!(
Referenda::set_metadata(RuntimeOrigin::signed(2), index, Some(invalid_hash)),
Error::<Test>::NoPermission,
);
// preimage does not exist.
let index = ReferendumCount::<Test>::get() - 1;
assert_noop!(
Referenda::set_metadata(RuntimeOrigin::signed(1), index, Some(invalid_hash)),
Error::<Test>::PreimageNotExist,
);
// metadata set.
let index = ReferendumCount::<Test>::get() - 1;
let hash = note_preimage(1);
assert_ok!(Referenda::set_metadata(RuntimeOrigin::signed(1), index, Some(hash)));
System::assert_last_event(RuntimeEvent::Referenda(crate::Event::MetadataSet {
index,
hash,
}));
});
}
#[test]
fn clear_metadata_works() {
new_test_ext().execute_with(|| {
let hash = note_preimage(1);
assert_ok!(Referenda::submit(
RuntimeOrigin::signed(1),
Box::new(RawOrigin::Root.into()),
set_balance_proposal_bounded(1),
DispatchTime::At(1),
));
let index = ReferendumCount::<Test>::get() - 1;
assert_ok!(Referenda::set_metadata(RuntimeOrigin::signed(1), index, Some(hash)));
assert_noop!(
Referenda::set_metadata(RuntimeOrigin::signed(2), index, None),
Error::<Test>::NoPermission,
);
assert_ok!(Referenda::set_metadata(RuntimeOrigin::signed(1), index, None),);
System::assert_last_event(RuntimeEvent::Referenda(crate::Event::MetadataCleared {
index,
hash,
}));
});
}
+185 -122
View File
@@ -18,25 +18,26 @@
//! Autogenerated weights for pallet_referenda
//!
//! 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_referenda
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/referenda/src/weights.rs
// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet_referenda
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/referenda/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
@@ -76,6 +77,8 @@ pub trait WeightInfo {
fn nudge_referendum_continue_confirming() -> Weight;
fn nudge_referendum_approved() -> Weight;
fn nudge_referendum_rejected() -> Weight;
fn set_some_metadata() -> Weight;
fn clear_metadata() -> Weight;
}
/// Weights for pallet_referenda using the Substrate node and recommended hardware.
@@ -91,8 +94,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `251`
// Estimated: `109996`
// Minimum execution time: 32_207 nanoseconds.
Weight::from_parts(32_639_000, 109996)
// Minimum execution time: 34_540 nanoseconds.
Weight::from_parts(36_144_000, 109996)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -104,8 +107,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `221835`
// Minimum execution time: 43_766 nanoseconds.
Weight::from_parts(44_494_000, 221835)
// Minimum execution time: 46_963 nanoseconds.
Weight::from_parts(48_459_000, 221835)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -119,8 +122,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `3203`
// Estimated: `9817`
// Minimum execution time: 41_561 nanoseconds.
Weight::from_parts(42_180_000, 9817)
// Minimum execution time: 55_798 nanoseconds.
Weight::from_parts(58_260_000, 9817)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -134,8 +137,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `3223`
// Estimated: `9817`
// Minimum execution time: 41_039 nanoseconds.
Weight::from_parts(41_673_000, 9817)
// Minimum execution time: 53_888 nanoseconds.
Weight::from_parts(57_919_000, 9817)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -149,8 +152,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `224324`
// Minimum execution time: 52_922 nanoseconds.
Weight::from_parts(53_395_000, 224324)
// Minimum execution time: 56_121 nanoseconds.
Weight::from_parts(58_301_000, 224324)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -164,8 +167,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `224324`
// Minimum execution time: 51_050 nanoseconds.
Weight::from_parts(51_736_000, 224324)
// Minimum execution time: 54_237 nanoseconds.
Weight::from_parts(55_681_000, 224324)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -175,8 +178,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `415`
// Estimated: `2841`
// Minimum execution time: 24_102 nanoseconds.
Weight::from_parts(24_372_000, 2841)
// Minimum execution time: 25_734 nanoseconds.
Weight::from_parts(26_429_000, 2841)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -186,8 +189,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `405`
// Estimated: `2841`
// Minimum execution time: 24_162 nanoseconds.
Weight::from_parts(24_547_000, 2841)
// Minimum execution time: 26_000 nanoseconds.
Weight::from_parts(26_786_000, 2841)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -199,8 +202,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `221835`
// Minimum execution time: 32_247 nanoseconds.
Weight::from_parts(32_731_000, 221835)
// Minimum execution time: 34_567 nanoseconds.
Weight::from_parts(35_939_000, 221835)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -208,13 +211,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:1 w:0)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn kill() -> Weight {
// Proof Size summary in bytes:
// Measured: `717`
// Estimated: `221835`
// Minimum execution time: 59_900 nanoseconds.
Weight::from_parts(60_659_000, 221835)
.saturating_add(T::DbWeight::get().reads(3_u64))
// Estimated: `224362`
// Minimum execution time: 67_744 nanoseconds.
Weight::from_parts(70_047_000, 224362)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: Referenda TrackQueue (r:1 w:0)
@@ -225,8 +230,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6976`
// Minimum execution time: 9_322 nanoseconds.
Weight::from_parts(9_638_000, 6976)
// Minimum execution time: 9_886 nanoseconds.
Weight::from_parts(10_406_000, 6976)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -240,8 +245,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4661`
// Estimated: `226322`
// Minimum execution time: 76_976 nanoseconds.
Weight::from_parts(77_597_000, 226322)
// Minimum execution time: 100_449 nanoseconds.
Weight::from_parts(101_812_000, 226322)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -255,8 +260,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4661`
// Estimated: `226322`
// Minimum execution time: 78_405 nanoseconds.
Weight::from_parts(78_972_000, 226322)
// Minimum execution time: 101_430 nanoseconds.
Weight::from_parts(103_704_000, 226322)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -270,8 +275,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4682`
// Estimated: `116825`
// Minimum execution time: 51_360 nanoseconds.
Weight::from_parts(51_737_000, 116825)
// Minimum execution time: 67_224 nanoseconds.
Weight::from_parts(70_596_000, 116825)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -285,8 +290,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4668`
// Estimated: `116825`
// Minimum execution time: 50_485 nanoseconds.
Weight::from_parts(51_601_000, 116825)
// Minimum execution time: 65_461 nanoseconds.
Weight::from_parts(69_624_000, 116825)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -302,8 +307,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4642`
// Estimated: `119314`
// Minimum execution time: 53_075 nanoseconds.
Weight::from_parts(54_014_000, 119314)
// Minimum execution time: 69_848 nanoseconds.
Weight::from_parts(74_480_000, 119314)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -319,8 +324,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `4676`
// Estimated: `119314`
// Minimum execution time: 52_916 nanoseconds.
Weight::from_parts(53_716_000, 119314)
// Minimum execution time: 70_042 nanoseconds.
Weight::from_parts(72_912_000, 119314)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -332,8 +337,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `364`
// Estimated: `112338`
// Minimum execution time: 21_920 nanoseconds.
Weight::from_parts(22_172_000, 112338)
// Minimum execution time: 23_008 nanoseconds.
Weight::from_parts(23_767_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -345,8 +350,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `112338`
// Minimum execution time: 22_094 nanoseconds.
Weight::from_parts(22_314_000, 112338)
// Minimum execution time: 23_550 nanoseconds.
Weight::from_parts(24_081_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -356,8 +361,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `310`
// Estimated: `2841`
// Minimum execution time: 15_696 nanoseconds.
Weight::from_parts(15_964_000, 2841)
// Minimum execution time: 15_850 nanoseconds.
Weight::from_parts(16_773_000, 2841)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -371,8 +376,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `114827`
// Minimum execution time: 30_604 nanoseconds.
Weight::from_parts(31_126_000, 114827)
// Minimum execution time: 32_126 nanoseconds.
Weight::from_parts(33_313_000, 114827)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -386,8 +391,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `114827`
// Minimum execution time: 32_961 nanoseconds.
Weight::from_parts(33_295_000, 114827)
// Minimum execution time: 34_698 nanoseconds.
Weight::from_parts(35_802_000, 114827)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -399,8 +404,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 27_072 nanoseconds.
Weight::from_parts(27_405_000, 112338)
// Minimum execution time: 28_710 nanoseconds.
Weight::from_parts(29_574_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -412,8 +417,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `448`
// Estimated: `112338`
// Minimum execution time: 27_056 nanoseconds.
Weight::from_parts(27_768_000, 112338)
// Minimum execution time: 29_030 nanoseconds.
Weight::from_parts(30_308_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -425,8 +430,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 24_599 nanoseconds.
Weight::from_parts(25_170_000, 112338)
// Minimum execution time: 26_382 nanoseconds.
Weight::from_parts(27_219_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -438,8 +443,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `469`
// Estimated: `112338`
// Minimum execution time: 23_737 nanoseconds.
Weight::from_parts(24_184_000, 112338)
// Minimum execution time: 25_445 nanoseconds.
Weight::from_parts(26_010_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -453,8 +458,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `469`
// Estimated: `224358`
// Minimum execution time: 37_880 nanoseconds.
Weight::from_parts(38_537_000, 224358)
// Minimum execution time: 41_064 nanoseconds.
Weight::from_parts(42_895_000, 224358)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -466,11 +471,39 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 26_898 nanoseconds.
Weight::from_parts(27_496_000, 112338)
// Minimum execution time: 29_472 nanoseconds.
Weight::from_parts(30_011_000, 112338)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: Referenda ReferendumInfoFor (r:1 w:0)
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Preimage StatusFor (r:1 w:0)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:0 w:1)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn set_some_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `454`
// Estimated: `5407`
// Minimum execution time: 19_389 nanoseconds.
Weight::from_parts(20_490_000, 5407)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Referenda ReferendumInfoFor (r:1 w:0)
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:1 w:1)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `387`
// Estimated: `5368`
// Minimum execution time: 18_195 nanoseconds.
Weight::from_parts(19_917_000, 5368)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
// For backwards compatibility and tests
@@ -485,8 +518,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `251`
// Estimated: `109996`
// Minimum execution time: 32_207 nanoseconds.
Weight::from_parts(32_639_000, 109996)
// Minimum execution time: 34_540 nanoseconds.
Weight::from_parts(36_144_000, 109996)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -498,8 +531,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `221835`
// Minimum execution time: 43_766 nanoseconds.
Weight::from_parts(44_494_000, 221835)
// Minimum execution time: 46_963 nanoseconds.
Weight::from_parts(48_459_000, 221835)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -513,8 +546,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `3203`
// Estimated: `9817`
// Minimum execution time: 41_561 nanoseconds.
Weight::from_parts(42_180_000, 9817)
// Minimum execution time: 55_798 nanoseconds.
Weight::from_parts(58_260_000, 9817)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -528,8 +561,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `3223`
// Estimated: `9817`
// Minimum execution time: 41_039 nanoseconds.
Weight::from_parts(41_673_000, 9817)
// Minimum execution time: 53_888 nanoseconds.
Weight::from_parts(57_919_000, 9817)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -543,8 +576,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `224324`
// Minimum execution time: 52_922 nanoseconds.
Weight::from_parts(53_395_000, 224324)
// Minimum execution time: 56_121 nanoseconds.
Weight::from_parts(58_301_000, 224324)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -558,8 +591,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `536`
// Estimated: `224324`
// Minimum execution time: 51_050 nanoseconds.
Weight::from_parts(51_736_000, 224324)
// Minimum execution time: 54_237 nanoseconds.
Weight::from_parts(55_681_000, 224324)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -569,8 +602,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `415`
// Estimated: `2841`
// Minimum execution time: 24_102 nanoseconds.
Weight::from_parts(24_372_000, 2841)
// Minimum execution time: 25_734 nanoseconds.
Weight::from_parts(26_429_000, 2841)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -580,8 +613,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `405`
// Estimated: `2841`
// Minimum execution time: 24_162 nanoseconds.
Weight::from_parts(24_547_000, 2841)
// Minimum execution time: 26_000 nanoseconds.
Weight::from_parts(26_786_000, 2841)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -593,8 +626,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `221835`
// Minimum execution time: 32_247 nanoseconds.
Weight::from_parts(32_731_000, 221835)
// Minimum execution time: 34_567 nanoseconds.
Weight::from_parts(35_939_000, 221835)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -602,13 +635,15 @@ impl WeightInfo for () {
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:1 w:0)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn kill() -> Weight {
// Proof Size summary in bytes:
// Measured: `717`
// Estimated: `221835`
// Minimum execution time: 59_900 nanoseconds.
Weight::from_parts(60_659_000, 221835)
.saturating_add(RocksDbWeight::get().reads(3_u64))
// Estimated: `224362`
// Minimum execution time: 67_744 nanoseconds.
Weight::from_parts(70_047_000, 224362)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: Referenda TrackQueue (r:1 w:0)
@@ -619,8 +654,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6976`
// Minimum execution time: 9_322 nanoseconds.
Weight::from_parts(9_638_000, 6976)
// Minimum execution time: 9_886 nanoseconds.
Weight::from_parts(10_406_000, 6976)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -634,8 +669,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4661`
// Estimated: `226322`
// Minimum execution time: 76_976 nanoseconds.
Weight::from_parts(77_597_000, 226322)
// Minimum execution time: 100_449 nanoseconds.
Weight::from_parts(101_812_000, 226322)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -649,8 +684,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4661`
// Estimated: `226322`
// Minimum execution time: 78_405 nanoseconds.
Weight::from_parts(78_972_000, 226322)
// Minimum execution time: 101_430 nanoseconds.
Weight::from_parts(103_704_000, 226322)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -664,8 +699,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4682`
// Estimated: `116825`
// Minimum execution time: 51_360 nanoseconds.
Weight::from_parts(51_737_000, 116825)
// Minimum execution time: 67_224 nanoseconds.
Weight::from_parts(70_596_000, 116825)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -679,8 +714,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4668`
// Estimated: `116825`
// Minimum execution time: 50_485 nanoseconds.
Weight::from_parts(51_601_000, 116825)
// Minimum execution time: 65_461 nanoseconds.
Weight::from_parts(69_624_000, 116825)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -696,8 +731,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4642`
// Estimated: `119314`
// Minimum execution time: 53_075 nanoseconds.
Weight::from_parts(54_014_000, 119314)
// Minimum execution time: 69_848 nanoseconds.
Weight::from_parts(74_480_000, 119314)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -713,8 +748,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `4676`
// Estimated: `119314`
// Minimum execution time: 52_916 nanoseconds.
Weight::from_parts(53_716_000, 119314)
// Minimum execution time: 70_042 nanoseconds.
Weight::from_parts(72_912_000, 119314)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -726,8 +761,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `364`
// Estimated: `112338`
// Minimum execution time: 21_920 nanoseconds.
Weight::from_parts(22_172_000, 112338)
// Minimum execution time: 23_008 nanoseconds.
Weight::from_parts(23_767_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -739,8 +774,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `112338`
// Minimum execution time: 22_094 nanoseconds.
Weight::from_parts(22_314_000, 112338)
// Minimum execution time: 23_550 nanoseconds.
Weight::from_parts(24_081_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -750,8 +785,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `310`
// Estimated: `2841`
// Minimum execution time: 15_696 nanoseconds.
Weight::from_parts(15_964_000, 2841)
// Minimum execution time: 15_850 nanoseconds.
Weight::from_parts(16_773_000, 2841)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -765,8 +800,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `114827`
// Minimum execution time: 30_604 nanoseconds.
Weight::from_parts(31_126_000, 114827)
// Minimum execution time: 32_126 nanoseconds.
Weight::from_parts(33_313_000, 114827)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -780,8 +815,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `412`
// Estimated: `114827`
// Minimum execution time: 32_961 nanoseconds.
Weight::from_parts(33_295_000, 114827)
// Minimum execution time: 34_698 nanoseconds.
Weight::from_parts(35_802_000, 114827)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -793,8 +828,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 27_072 nanoseconds.
Weight::from_parts(27_405_000, 112338)
// Minimum execution time: 28_710 nanoseconds.
Weight::from_parts(29_574_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -806,8 +841,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `448`
// Estimated: `112338`
// Minimum execution time: 27_056 nanoseconds.
Weight::from_parts(27_768_000, 112338)
// Minimum execution time: 29_030 nanoseconds.
Weight::from_parts(30_308_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -819,8 +854,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 24_599 nanoseconds.
Weight::from_parts(25_170_000, 112338)
// Minimum execution time: 26_382 nanoseconds.
Weight::from_parts(27_219_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -832,8 +867,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `469`
// Estimated: `112338`
// Minimum execution time: 23_737 nanoseconds.
Weight::from_parts(24_184_000, 112338)
// Minimum execution time: 25_445 nanoseconds.
Weight::from_parts(26_010_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -847,8 +882,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `469`
// Estimated: `224358`
// Minimum execution time: 37_880 nanoseconds.
Weight::from_parts(38_537_000, 224358)
// Minimum execution time: 41_064 nanoseconds.
Weight::from_parts(42_895_000, 224358)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -860,9 +895,37 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `465`
// Estimated: `112338`
// Minimum execution time: 26_898 nanoseconds.
Weight::from_parts(27_496_000, 112338)
// Minimum execution time: 29_472 nanoseconds.
Weight::from_parts(30_011_000, 112338)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: Referenda ReferendumInfoFor (r:1 w:0)
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Preimage StatusFor (r:1 w:0)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:0 w:1)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn set_some_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `454`
// Estimated: `5407`
// Minimum execution time: 19_389 nanoseconds.
Weight::from_parts(20_490_000, 5407)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Referenda ReferendumInfoFor (r:1 w:0)
/// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(366), added: 2841, mode: MaxEncodedLen)
/// Storage: Referenda MetadataOf (r:1 w:1)
/// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `387`
// Estimated: `5368`
// Minimum execution time: 18_195 nanoseconds.
Weight::from_parts(19_917_000, 5368)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}