From 6000339594a7964cf2327e68af2c0f3e499143eb Mon Sep 17 00:00:00 2001 From: gatsey <42411328+f-gate@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:32:50 +0000 Subject: [PATCH 1/5] Benchmarking workflow (#290) * staging check for prs to main * remove run gcp for push to staging * Optional fellowship switch (#280) * add test for approved applicant * fmt * add ensure role to runtime --------- Co-authored-by: Sam Elamin * Foreign token minting tests (#282) * test * forign signer can mint * negative minting test * remove it (#285) * Autofinalise dispute where jury size == 1 (#279) * autocomplete dispute where jury size = 1 * refactor tests to include jury * fmt * give briefs a jury! * fmt * fix tests from merge * remove it (#285) --------- Co-authored-by: Sam Elamin * new benchmarks template * remove old script * benchmark script :) * hmm * clear votes with tests (#289) * Eoa field (#287) * new types * ensure supported currency method * brief migration, fixes * fixes * fmt * fix up benchmarks * fix brief test * update imbue image for rococo * clear votes with tests * fix merge * fix * fix * fmt * fix --------- Co-authored-by: samelamin * add default fellows to selector, fix template * fiddle * generate new weights using script * fmt * use release profile --------- Co-authored-by: Sam Elamin --- .github/workflows/build.yml | 2 - ci/jobs/build-and-test.sh | 7 - ci/jobs/clippy.sh | 7 - libs/common-types/src/tokens.rs | 5 +- pallets/briefs/src/benchmarking.rs | 13 +- pallets/briefs/src/integration_tests.rs | 1 + pallets/briefs/src/lib.rs | 9 + pallets/briefs/src/migrations.rs | 1 - pallets/briefs/src/mock.rs | 36 +++- pallets/briefs/src/tests.rs | 55 ++++- pallets/briefs/src/weights.rs | 168 +++++++++++---- pallets/disputes/src/impls.rs | 2 +- pallets/disputes/src/mock.rs | 21 -- pallets/disputes/src/weights.rs | 172 ++++++++++----- pallets/fellowship/src/impls.rs | 2 +- pallets/fellowship/src/lib.rs | 13 +- pallets/fellowship/src/mock.rs | 27 +-- pallets/fellowship/src/traits.rs | 16 +- pallets/fellowship/src/weights.rs | 216 ++++++++++++++----- pallets/grants/src/weights.rs | 72 ++++--- pallets/proposals/src/benchmarking.rs | 39 +++- pallets/proposals/src/impls/pallet_impls.rs | 6 + pallets/proposals/src/lib.rs | 22 +- pallets/proposals/src/migration.rs | 12 +- pallets/proposals/src/mock.rs | 3 + pallets/proposals/src/test_utils.rs | 3 +- pallets/proposals/src/tests/disputes.rs | 132 ++++++++++-- pallets/proposals/src/tests/foreign_asset.rs | 80 +++++++ pallets/proposals/src/tests/mod.rs | 1 + pallets/proposals/src/tests/pallet.rs | 201 ++++++++++++++--- pallets/proposals/src/tests/refunds.rs | 44 +++- pallets/proposals/src/weights.rs | 216 ++++++++++++++----- runtime/imbue-kusama/Cargo.toml | 3 +- runtime/imbue-kusama/src/lib.rs | 28 ++- scripts/frame-weight-template.hbs | 33 +-- scripts/pallet_index.rs | 57 ----- scripts/run_benchmarks.sh | 43 ++++ 37 files changed, 1297 insertions(+), 471 deletions(-) delete mode 100644 ci/jobs/build-and-test.sh delete mode 100755 ci/jobs/clippy.sh create mode 100644 pallets/proposals/src/tests/foreign_asset.rs delete mode 100644 scripts/pallet_index.rs create mode 100755 scripts/run_benchmarks.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58b35af0..bc29d304 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,6 @@ on: - "**.md" env: CARGO_TERM_COLOR: always - GCP_ZONE: europe-west3-a jobs: check_branch: @@ -41,7 +40,6 @@ jobs: image_family: ubuntu-2004-lts machine_type: e2-highcpu-32 disk_size: 100 - machine_zone: ${{ env.GCP_ZONE }} ephemeral: true test-features: diff --git a/ci/jobs/build-and-test.sh b/ci/jobs/build-and-test.sh deleted file mode 100644 index 89f85fe2..00000000 --- a/ci/jobs/build-and-test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -euo pipefail -cd -- "$(dirname -- "${BASH_SOURCE[0]}")" -cd ../.. - -echo "Starting build and test with benchmarks!" diff --git a/ci/jobs/clippy.sh b/ci/jobs/clippy.sh deleted file mode 100755 index d71748c0..00000000 --- a/ci/jobs/clippy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -euo pipefail -cd -- "$(dirname -- "${BASH_SOURCE[0]}")" -cd ../.. - -echo "Starting clippy!" -RUSTFLAGS="-D warnings" cargo clippy --all --features runtime-benchmarks \ No newline at end of file diff --git a/libs/common-types/src/tokens.rs b/libs/common-types/src/tokens.rs index bd74a9eb..d045a037 100644 --- a/libs/common-types/src/tokens.rs +++ b/libs/common-types/src/tokens.rs @@ -97,7 +97,10 @@ impl ForeignOwnedAccount { } #[cfg(feature = "runtime-benchmarks")] pub fn get_supported_currency_eoa_combo() -> (ForeignOwnedAccount, CurrencyId) { - (ForeignOwnedAccount::ETH(Default::default()), CurrencyId::ForeignAsset(ForeignAssetId::ETH)) + ( + ForeignOwnedAccount::ETH(Default::default()), + CurrencyId::ForeignAsset(ForeignAssetId::ETH), + ) } } diff --git a/pallets/briefs/src/benchmarking.rs b/pallets/briefs/src/benchmarking.rs index f3052d39..88e83fa5 100644 --- a/pallets/briefs/src/benchmarking.rs +++ b/pallets/briefs/src/benchmarking.rs @@ -42,7 +42,8 @@ mod benchmarks { brief_id, currency_id, milestones, - Some(eoa) + Some(eoa), + false, ); assert_last_event::(Event::::BriefSubmitted(caller, brief_id).into()); } @@ -68,6 +69,7 @@ mod benchmarks { currency_id, milestones, None, + false, )); let brief_owner: T::AccountId = brief_owners[0].clone(); // (brief_owner, brief_id, contribution) @@ -91,7 +93,6 @@ mod benchmarks { let brief_id = gen_hash(1); let milestones = get_max_milestones::(); - assert_ok!(Briefs::::create_brief( RawOrigin::Signed(caller).into(), brief_owners, @@ -102,6 +103,7 @@ mod benchmarks { currency_id, milestones, None, + false, )); // (origin, brief_id) #[extrinsic_call] @@ -129,6 +131,7 @@ mod benchmarks { currency_id, milestones, None, + false, )); // (origin, brief_id) #[extrinsic_call] @@ -143,7 +146,11 @@ mod benchmarks { ); } -fn create_account_id(suri: &'static str, n: u32, currency_id: CurrencyId) -> T::AccountId { +fn create_account_id( + suri: &'static str, + n: u32, + currency_id: CurrencyId, +) -> T::AccountId { let user = account(suri, n, SEED); let initial_balance = 1_000_000_000_000_000u128; assert_ok!(T::RMultiCurrency::deposit( diff --git a/pallets/briefs/src/integration_tests.rs b/pallets/briefs/src/integration_tests.rs index c43eb534..5edcd1f2 100644 --- a/pallets/briefs/src/integration_tests.rs +++ b/pallets/briefs/src/integration_tests.rs @@ -23,6 +23,7 @@ fn create_proposal_from_brief() { CurrencyId::Native, get_milestones(10), None, + false, ); assert_ok!(BriefsMod::commence_work( diff --git a/pallets/briefs/src/lib.rs b/pallets/briefs/src/lib.rs index 6748e243..fe6892a8 100644 --- a/pallets/briefs/src/lib.rs +++ b/pallets/briefs/src/lib.rs @@ -33,6 +33,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; use orml_traits::{MultiCurrency, MultiReservableCurrency}; use pallet_deposits::traits::DepositHandler; + use pallet_fellowship::traits::EnsureRole; use pallet_fellowship::traits::SelectJury; use pallet_proposals::traits::IntoProposal; use pallet_proposals::{Contribution, FundingPath, ProposedMilestone}; @@ -84,9 +85,12 @@ pub mod pallet { type MaxMilestonesPerBrief: Get; /// Storage deposits. type BriefStorageItem: Get>; + /// Handler for deposits. type DepositHandler: DepositHandler, AccountIdOf>; /// The type that selects a list of jury members. type JurySelector: SelectJury>; + /// Type for ensuring an account is of a given fellowship role. + type EnsureRole: pallet_fellowship::traits::EnsureRole>; /// The weight info for the extrinsics. type WeightInfo: WeightInfoT; } @@ -177,9 +181,14 @@ pub mod pallet { currency_id: CurrencyId, milestones: BoundedProposedMilestones, external_owned_address: Option, + require_fellowship: bool, ) -> DispatchResult { let who = ensure_signed(origin)?; + if require_fellowship { + T::EnsureRole::ensure_role(&applicant, pallet_fellowship::Role::Freelancer, None)?; + } + ensure!( Briefs::::get(brief_id).is_none(), Error::::BriefAlreadyExists diff --git a/pallets/briefs/src/migrations.rs b/pallets/briefs/src/migrations.rs index 8c527918..6f941a3c 100644 --- a/pallets/briefs/src/migrations.rs +++ b/pallets/briefs/src/migrations.rs @@ -82,7 +82,6 @@ pub(crate) mod v1 { }; v2::BriefsV2::::insert(key, migrated); - } }) } diff --git a/pallets/briefs/src/mock.rs b/pallets/briefs/src/mock.rs index 2d67a24b..de4b9ec1 100644 --- a/pallets/briefs/src/mock.rs +++ b/pallets/briefs/src/mock.rs @@ -18,6 +18,8 @@ use sp_runtime::{ }; use pallet_deposits::traits::DepositHandler; +use pallet_fellowship::traits::FellowshipHandle; +use pallet_fellowship::Role; use sp_std::{ convert::{TryFrom, TryInto}, str, @@ -57,6 +59,7 @@ frame_support::construct_runtime!( BriefsMod: pallet_briefs::{Pallet, Call, Storage, Event}, Proposals: pallet_proposals::{Pallet, Call, Storage, Event}, Identity: pallet_identity::{Pallet, Call, Storage, Event}, + Fellowship: pallet_fellowship::{Pallet, Call, Storage, Event}, } ); @@ -209,6 +212,7 @@ impl pallet_briefs::Config for Test { type DepositHandler = MockDepositHandler; type WeightInfo = pallet_briefs::WeightInfo; type JurySelector = MockJurySelector; + type EnsureRole = pallet_fellowship::impls::EnsureFellowshipRole; } parameter_types! { @@ -273,14 +277,39 @@ impl pallet_identity::Config for Test { type WeightInfo = (); } +parameter_types! { + pub MaxCandidatesPerShortlist: u32 = 100; + pub ShortlistPeriod: BlockNumber = 100; + pub MembershipDeposit: Balance = 50_000_000; + pub SlashAccount: AccountId = 1; + pub DepositCurrencyId: CurrencyId = CurrencyId::Native; +} + +impl pallet_fellowship::Config for Test { + type RuntimeEvent = RuntimeEvent; + type MultiCurrency = Tokens; + type ForceAuthority = EnsureRoot; + type MaxCandidatesPerShortlist = MaxCandidatesPerShortlist; + type ShortlistPeriod = ShortlistPeriod; + type MembershipDeposit = MembershipDeposit; + type DepositCurrencyId = DepositCurrencyId; + type SlashAccount = SlashAccount; + type Permissions = pallet_fellowship::impls::VetterAndFreelancerAllPermissions; + type WeightInfo = pallet_fellowship::weights::WeightInfo; +} + parameter_types! { pub const UnitWeightCost: u64 = 10; pub const MaxInstructions: u32 = 100; } + pub static ALICE: AccountId = 125; pub static BOB: AccountId = 126; pub static CHARLIE: AccountId = 127; +pub static FREELANCER: AccountId = 1270; pub static TREASURY: AccountId = 200; +pub static JURY_1: AccountId = 1002; +pub static JURY_2: AccountId = 1001; pub(crate) fn build_test_externality() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default() @@ -292,7 +321,7 @@ pub(crate) fn build_test_externality() -> sp_io::TestExternalities { .unwrap(); orml_tokens::GenesisConfig:: { balances: { - vec![ALICE, BOB, CHARLIE] + vec![ALICE, BOB, CHARLIE, FREELANCER] .into_iter() .map(|id| (id, CurrencyId::Native, 1000000)) .collect::>() @@ -303,6 +332,7 @@ pub(crate) fn build_test_externality() -> sp_io::TestExternalities { let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| { + pallet_fellowship::Roles::::insert(&FREELANCER, (Role::Freelancer, 10)); System::set_block_number(1); }); ext @@ -312,7 +342,9 @@ pub struct MockJurySelector; impl pallet_fellowship::traits::SelectJury for MockJurySelector { type JurySize = MaxJuryMembers; fn select_jury() -> BoundedVec { - BoundedVec::new() + vec![JURY_1, JURY_2] + .try_into() + .expect("should be below bound.") } } diff --git a/pallets/briefs/src/tests.rs b/pallets/briefs/src/tests.rs index 498479be..56320f59 100644 --- a/pallets/briefs/src/tests.rs +++ b/pallets/briefs/src/tests.rs @@ -6,16 +6,55 @@ use crate::*; use common_types::CurrencyId; use frame_support::{assert_noop, assert_ok, pallet_prelude::*}; use orml_traits::{MultiCurrency, MultiReservableCurrency}; +use pallet_fellowship::traits::EnsureRole; use pallet_proposals::{BoundedProposedMilestones, Projects, ProposedMilestone}; use sp_arithmetic::per_things::Percent; +use sp_runtime::DispatchError::BadOrigin; use std::convert::TryInto; #[test] fn create_brief_not_approved_applicant() { build_test_externality().execute_with(|| { - // TODO: - // Only accounts in the fellowship can apply for work + assert_noop!( + BriefsMod::create_brief( + RuntimeOrigin::signed(BOB), + get_brief_owners(u32::MAX), + ALICE, + 100000, + 10000, + gen_hash(1), + CurrencyId::Native, + get_milestones(10), + None, + true, + ), + BadOrigin + ); + }); +} + +#[test] +fn create_brief_approved_applicant() { + build_test_externality().execute_with(|| { + assert_ok!(::EnsureRole::ensure_role( + &FREELANCER, + pallet_fellowship::Role::Freelancer, + None + )); + + assert_ok!(BriefsMod::create_brief( + RuntimeOrigin::signed(BOB), + get_brief_owners(10), + FREELANCER, + 100000, + 10000, + gen_hash(1), + CurrencyId::Native, + get_milestones(10), + None, + true, + )); }); } @@ -33,6 +72,7 @@ fn create_brief_brief_owner_overflow() { CurrencyId::Native, get_milestones(10), None, + false, ), Error::::TooManyBriefOwners ); @@ -52,6 +92,7 @@ fn create_brief_with_no_contribution_ok() { CurrencyId::Native, get_milestones(10), None, + false, )); }); } @@ -73,6 +114,7 @@ fn create_brief_no_contribution_and_contribute() { CurrencyId::Native, get_milestones(10), None, + false, )); (0..5).for_each(|_| { @@ -115,6 +157,7 @@ fn contribute_to_brief_not_brief_owner() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_noop!( @@ -144,6 +187,7 @@ fn contribute_to_brief_more_than_total_ok() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_ok!(BriefsMod::contribute_to_brief( RuntimeOrigin::signed(BOB), @@ -169,6 +213,7 @@ fn create_brief_already_exists() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_noop!( @@ -182,6 +227,7 @@ fn create_brief_already_exists() { CurrencyId::Native, get_milestones(10), None, + false, ), Error::::BriefAlreadyExists ); @@ -204,6 +250,7 @@ fn only_applicant_can_start_work() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_noop!( @@ -234,6 +281,7 @@ fn initial_contribution_and_extra_contribution_aggregates() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_ok!(BriefsMod::contribute_to_brief( @@ -271,6 +319,7 @@ fn reserved_funds_are_transferred_to_project_kitty() { CurrencyId::Native, get_milestones(10), None, + false, ); assert_ok!(BriefsMod::commence_work( @@ -304,6 +353,7 @@ fn cancel_brief_works() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_ok!(BriefsMod::contribute_to_brief( @@ -371,6 +421,7 @@ fn cancel_brief_not_brief_owner() { CurrencyId::Native, get_milestones(10), None, + false, )); assert_noop!( diff --git a/pallets/briefs/src/weights.rs b/pallets/briefs/src/weights.rs index ddb169ec..0ef79cdc 100644 --- a/pallets/briefs/src/weights.rs +++ b/pallets/briefs/src/weights.rs @@ -2,43 +2,35 @@ //! Autogenerated weights for `pallet_briefs` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("local")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: // ./target/debug/imbue // benchmark // pallet -// --chain -// local -// --execution -// wasm -// --wasm-execution -// compiled -// --pallet -// pallet-briefs -// --extrinsic -// * -// --output -// weights.rs -// --steps -// 50 -// --repeat -// 20 +// --chain=imbue-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_briefs +// --extrinsic=* +// --output=./pallets/briefs/src/weights.rs +// --template=./scripts/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions for `pallet_briefs`. +/// Weights for `pallet_briefs` using the Substrate node and recommended hardware. pub struct WeightInfo(PhantomData); -impl crate::WeightInfoT for WeightInfo { +impl WeightInfoT for WeightInfo { /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) /// Storage: `Deposits::TicketId` (r:1 w:1) @@ -53,13 +45,12 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) fn create_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `334` + // Measured: `368` // Estimated: `6114` - // Minimum execution time: 674_565_000 picoseconds. - Weight::from_parts(699_090_000, 0) - .saturating_add(Weight::from_parts(0, 6114)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(6)) + // Minimum execution time: 1_508_486_000 picoseconds. + Weight::from_parts(1_537_968_000, 6114) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:0) /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) @@ -69,13 +60,12 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) fn contribute_to_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2119` + // Measured: `2153` // Estimated: `6114` - // Minimum execution time: 388_641_000 picoseconds. - Weight::from_parts(404_811_000, 0) - .saturating_add(Weight::from_parts(0, 6114)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) + // Minimum execution time: 874_794_000 picoseconds. + Weight::from_parts(883_738_000, 6114) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) @@ -101,13 +91,12 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) fn commence_work() -> Weight { // Proof Size summary in bytes: - // Measured: `2607` + // Measured: `2641` // Estimated: `8799` - // Minimum execution time: 1_739_406_000 picoseconds. - Weight::from_parts(1_778_978_000, 0) - .saturating_add(Weight::from_parts(0, 8799)) - .saturating_add(T::DbWeight::get().reads(11)) - .saturating_add(T::DbWeight::get().writes(13)) + // Minimum execution time: 3_922_748_000 picoseconds. + Weight::from_parts(4_133_787_000, 8799) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) @@ -121,12 +110,101 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn cancel_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2353` + // Measured: `2387` // Estimated: `6114` - // Minimum execution time: 721_794_000 picoseconds. - Weight::from_parts(753_268_000, 0) - .saturating_add(Weight::from_parts(0, 6114)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + // Minimum execution time: 1_621_533_000 picoseconds. + Weight::from_parts(1_637_811_000, 6114) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } } + +// For backwards compatibility and tests. +impl WeightInfoT for () { + /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Storage: `Deposits::TicketId` (r:1 w:1) + /// Proof: `Deposits::TicketId` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) + /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) + /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn create_brief() -> Weight { + // Proof Size summary in bytes: + // Measured: `368` + // Estimated: `6114` + // Minimum execution time: 1_508_486_000 picoseconds. + Weight::from_parts(1_537_968_000, 6114) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + /// Storage: `ImbueBriefs::Briefs` (r:1 w:0) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) + /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) + fn contribute_to_brief() -> Weight { + // Proof Size summary in bytes: + // Measured: `2153` + // Estimated: `6114` + // Minimum execution time: 874_794_000 picoseconds. + Weight::from_parts(883_738_000, 6114) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) + /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) + /// Storage: `Deposits::CurrentDeposits` (r:1 w:2) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::Roles` (r:1 w:0) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::JuryPointer` (r:1 w:1) + /// Proof: `ImbueFellowship::JuryPointer` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectCount` (r:1 w:1) + /// Proof: `ImbueProposals::ProjectCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Deposits::TicketId` (r:1 w:1) + /// Proof: `Deposits::TicketId` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) + /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Projects` (r:0 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) + /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) + fn commence_work() -> Weight { + // Proof Size summary in bytes: + // Measured: `2641` + // Estimated: `8799` + // Minimum execution time: 3_922_748_000 picoseconds. + Weight::from_parts(4_133_787_000, 8799) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) + /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) + /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) + /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn cancel_brief() -> Weight { + // Proof Size summary in bytes: + // Measured: `2387` + // Estimated: `6114` + // Minimum execution time: 1_621_533_000 picoseconds. + Weight::from_parts(1_637_811_000, 6114) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } +} \ No newline at end of file diff --git a/pallets/disputes/src/impls.rs b/pallets/disputes/src/impls.rs index 1393bdea..b9181d1d 100644 --- a/pallets/disputes/src/impls.rs +++ b/pallets/disputes/src/impls.rs @@ -3,7 +3,7 @@ use frame_support::BoundedVec; use sp_runtime::DispatchError; use crate::pallet::{AccountIdOf, Config, Dispute}; -use traits::DisputeRaiser; +use crate::traits::{DisputeHooks, DisputeRaiser}; impl DisputeRaiser> for Pallet { type DisputeKey = T::DisputeKey; diff --git a/pallets/disputes/src/mock.rs b/pallets/disputes/src/mock.rs index 049e2b98..2651566a 100644 --- a/pallets/disputes/src/mock.rs +++ b/pallets/disputes/src/mock.rs @@ -127,24 +127,3 @@ impl crate::traits::DisputeHooks for Test { ::default() } } - -impl crate::WeightInfoT for () { - fn vote_on_dispute() -> Weight { - ::default() - } - fn extend_dispute() -> Weight { - ::default() - } - fn raise_dispute() -> Weight { - ::default() - } - fn force_succeed_dispute() -> Weight { - ::default() - } - fn force_fail_dispute() -> Weight { - ::default() - } - fn calculate_winner() -> Weight { - ::default() - } -} diff --git a/pallets/disputes/src/weights.rs b/pallets/disputes/src/weights.rs index dd672737..7f79632b 100644 --- a/pallets/disputes/src/weights.rs +++ b/pallets/disputes/src/weights.rs @@ -2,43 +2,35 @@ //! Autogenerated weights for `pallet_disputes` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("local")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: // ./target/debug/imbue // benchmark // pallet -// --chain -// local -// --execution -// wasm -// --wasm-execution -// compiled -// --pallet -// pallet-disputes -// --extrinsic -// * -// --output -// weights.rs -// --steps -// 50 -// --repeat -// 20 +// --chain=imbue-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_disputes +// --extrinsic=* +// --output=./pallets/disputes/src/weights.rs +// --template=./scripts/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions for `pallet_disputes`. +/// Weights for `pallet_disputes` using the Substrate node and recommended hardware. pub struct WeightInfo(PhantomData); -impl crate::WeightInfoT for WeightInfo { +impl WeightInfoT for WeightInfo { /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) @@ -47,11 +39,10 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `76` // Estimated: `10067` - // Minimum execution time: 152_261_000 picoseconds. - Weight::from_parts(153_191_000, 0) - .saturating_add(Weight::from_parts(0, 10067)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Minimum execution time: 340_503_000 picoseconds. + Weight::from_parts(358_302_000, 10067) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) @@ -61,11 +52,10 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `250` // Estimated: `10067` - // Minimum execution time: 244_000_000 picoseconds. - Weight::from_parts(245_568_000, 0) - .saturating_add(Weight::from_parts(0, 10067)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Minimum execution time: 551_429_000 picoseconds. + Weight::from_parts(585_951_000, 10067) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) @@ -79,11 +69,10 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `292` // Estimated: `39815` - // Minimum execution time: 337_396_000 picoseconds. - Weight::from_parts(344_127_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 801_226_000 picoseconds. + Weight::from_parts(966_473_000, 39815) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) @@ -97,11 +86,10 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `292` // Estimated: `39815` - // Minimum execution time: 244_177_000 picoseconds. - Weight::from_parts(250_254_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 551_249_000 picoseconds. + Weight::from_parts(557_828_000, 39815) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) @@ -115,18 +103,104 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `292` // Estimated: `39815` - // Minimum execution time: 243_762_000 picoseconds. - Weight::from_parts(250_041_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 582_194_000 picoseconds. + Weight::from_parts(654_873_000, 39815) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn calculate_winner() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_448_000 picoseconds. - Weight::from_parts(13_334_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 26_642_000 picoseconds. + Weight::from_parts(28_049_000, 0) } } + +// For backwards compatibility and tests. +impl WeightInfoT for () { + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + fn raise_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `10067` + // Minimum execution time: 340_503_000 picoseconds. + Weight::from_parts(358_302_000, 10067) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:2 w:2) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + fn extend_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `250` + // Estimated: `10067` + // Minimum execution time: 551_429_000 picoseconds. + Weight::from_parts(585_951_000, 10067) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) + fn vote_on_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `292` + // Estimated: `39815` + // Minimum execution time: 801_226_000 picoseconds. + Weight::from_parts(966_473_000, 39815) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) + fn force_fail_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `292` + // Estimated: `39815` + // Minimum execution time: 551_249_000 picoseconds. + Weight::from_parts(557_828_000, 39815) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) + fn force_succeed_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `292` + // Estimated: `39815` + // Minimum execution time: 582_194_000 picoseconds. + Weight::from_parts(654_873_000, 39815) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + fn calculate_winner() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 26_642_000 picoseconds. + Weight::from_parts(28_049_000, 0) + } +} \ No newline at end of file diff --git a/pallets/fellowship/src/impls.rs b/pallets/fellowship/src/impls.rs index b8b5d8fd..26637312 100644 --- a/pallets/fellowship/src/impls.rs +++ b/pallets/fellowship/src/impls.rs @@ -8,7 +8,7 @@ use sp_std::{vec, vec::Vec}; /// Ensure that a account is of a given role. /// Used in other pallets like an ensure origin. pub struct EnsureFellowshipRole(T); -impl EnsureRole, Role> for EnsureFellowshipRole { +impl EnsureRole> for EnsureFellowshipRole { type Success = (); fn ensure_role( diff --git a/pallets/fellowship/src/lib.rs b/pallets/fellowship/src/lib.rs index 6791e02b..76b2008c 100644 --- a/pallets/fellowship/src/lib.rs +++ b/pallets/fellowship/src/lib.rs @@ -27,13 +27,12 @@ mod benchmarking; #[frame_support::pallet] pub mod pallet { use common_types::CurrencyId; - use frame_support::{pallet_prelude::*, BoundedBTreeMap}; + use frame_support::{pallet_prelude::*, weights::Weight, BoundedBTreeMap}; use frame_system::pallet_prelude::*; use orml_traits::{MultiCurrency, MultiReservableCurrency}; use sp_runtime::traits::Zero; use sp_std::{convert::TryInto, vec}; - use crate::traits::WeightInfoT; use crate::traits::{FellowshipHandle, FellowshipPermissions}; pub(crate) type AccountIdOf = ::AccountId; @@ -407,4 +406,14 @@ pub mod pallet { RemoveFromShortlist, None, } + + pub trait WeightInfoT { + fn add_to_fellowship() -> Weight; + fn force_add_fellowship() -> Weight; + fn leave_fellowship() -> Weight; + fn force_remove_and_slash_fellowship() -> Weight; + fn add_candidate_to_shortlist() -> Weight; + fn remove_candidate_from_shortlist() -> Weight; + fn pay_deposit_to_remove_pending_status() -> Weight; + } } diff --git a/pallets/fellowship/src/mock.rs b/pallets/fellowship/src/mock.rs index ed6abeec..e3cfe371 100644 --- a/pallets/fellowship/src/mock.rs +++ b/pallets/fellowship/src/mock.rs @@ -71,7 +71,7 @@ impl pallet_fellowship::Config for Test { type DepositCurrencyId = DepositCurrencyId; type SlashAccount = SlashAccount; type Permissions = crate::impls::VetterAndFreelancerAllPermissions; - type WeightInfo = (); + type WeightInfo = crate::weights::WeightInfo; } orml_traits::parameter_type_with_key! { @@ -121,28 +121,3 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { }); ext } - -use frame_support::pallet_prelude::Weight; -impl crate::traits::WeightInfoT for () { - fn add_to_fellowship() -> Weight { - ::default() - } - fn force_add_fellowship() -> Weight { - ::default() - } - fn leave_fellowship() -> Weight { - ::default() - } - fn force_remove_and_slash_fellowship() -> Weight { - ::default() - } - fn add_candidate_to_shortlist() -> Weight { - ::default() - } - fn remove_candidate_from_shortlist() -> Weight { - ::default() - } - fn pay_deposit_to_remove_pending_status() -> Weight { - ::default() - } -} diff --git a/pallets/fellowship/src/traits.rs b/pallets/fellowship/src/traits.rs index de1cb52a..62699166 100644 --- a/pallets/fellowship/src/traits.rs +++ b/pallets/fellowship/src/traits.rs @@ -1,6 +1,6 @@ -use crate::Rank; +use crate::{Rank, Role}; use codec::{FullCodec, FullEncode}; -use frame_support::{pallet_prelude::*, weights::Weight}; +use frame_support::pallet_prelude::*; use sp_runtime::DispatchError; use sp_std::vec::Vec; @@ -19,7 +19,7 @@ pub trait FellowshipHandle { fn revoke_fellowship(who: &AccountId, slash_deposit: bool) -> Result<(), DispatchError>; } -pub trait EnsureRole { +pub trait EnsureRole { type Success; fn ensure_role( acc: &AccountId, @@ -44,13 +44,3 @@ pub trait FellowshipPermissions { fn has_permission(role: Role, permission: Permission) -> bool; fn get_permissions(role: Role) -> Vec; } - -pub trait WeightInfoT { - fn add_to_fellowship() -> Weight; - fn force_add_fellowship() -> Weight; - fn leave_fellowship() -> Weight; - fn force_remove_and_slash_fellowship() -> Weight; - fn add_candidate_to_shortlist() -> Weight; - fn remove_candidate_from_shortlist() -> Weight; - fn pay_deposit_to_remove_pending_status() -> Weight; -} diff --git a/pallets/fellowship/src/weights.rs b/pallets/fellowship/src/weights.rs index b1a781e9..bf5ec959 100644 --- a/pallets/fellowship/src/weights.rs +++ b/pallets/fellowship/src/weights.rs @@ -2,43 +2,35 @@ //! Autogenerated weights for `pallet_fellowship` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("local")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: // ./target/debug/imbue // benchmark // pallet -// --chain -// local -// --execution -// wasm -// --wasm-execution -// compiled -// --pallet -// pallet-fellowship -// --extrinsic -// * -// --output -// weights.rs -// --steps -// 50 -// --repeat -// 20 +// --chain=imbue-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_fellowship +// --extrinsic=* +// --output=./pallets/fellowship/src/weights.rs +// --template=./scripts/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions for `pallet_fellowship`. +/// Weights for `pallet_fellowship` using the Substrate node and recommended hardware. pub struct WeightInfo(PhantomData); -impl crate::traits::WeightInfoT for WeightInfo { +impl WeightInfoT for WeightInfo { /// Storage: `ImbueFellowship::Roles` (r:1 w:1) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) @@ -51,11 +43,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3593` - // Minimum execution time: 297_927_000 picoseconds. - Weight::from_parts(299_772_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 666_362_000 picoseconds. + Weight::from_parts(674_483_000, 3593) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `ImbueFellowship::Roles` (r:1 w:1) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -63,11 +54,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3516` - // Minimum execution time: 153_043_000 picoseconds. - Weight::from_parts(154_780_000, 0) - .saturating_add(Weight::from_parts(0, 3516)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 343_825_000 picoseconds. + Weight::from_parts(346_698_000, 3516) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `ImbueFellowship::Roles` (r:1 w:1) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -83,11 +73,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3593` - // Minimum execution time: 463_315_000 picoseconds. - Weight::from_parts(479_038_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 1_025_061_000 picoseconds. + Weight::from_parts(1_033_384_000, 3593) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `ImbueFellowship::Roles` (r:1 w:1) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -103,11 +92,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `513` // Estimated: `6196` - // Minimum execution time: 894_392_000 picoseconds. - Weight::from_parts(915_373_000, 0) - .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + // Minimum execution time: 1_991_447_000 picoseconds. + Weight::from_parts(2_236_308_000, 6196) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `ImbueFellowship::Roles` (r:2 w:0) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -121,11 +109,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `289` // Estimated: `6886` - // Minimum execution time: 270_206_000 picoseconds. - Weight::from_parts(278_894_000, 0) - .saturating_add(Weight::from_parts(0, 6886)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 977_857_000 picoseconds. + Weight::from_parts(1_146_395_000, 6886) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `ImbueFellowship::Roles` (r:1 w:0) /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -137,11 +124,10 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `299` // Estimated: `6886` - // Minimum execution time: 205_598_000 picoseconds. - Weight::from_parts(207_340_000, 0) - .saturating_add(Weight::from_parts(0, 6886)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 463_826_000 picoseconds. + Weight::from_parts(467_466_000, 6886) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `ImbueFellowship::PendingFellows` (r:1 w:1) /// Proof: `ImbueFellowship::PendingFellows` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) @@ -155,10 +141,128 @@ impl crate::traits::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3593` - // Minimum execution time: 392_591_000 picoseconds. - Weight::from_parts(401_207_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 877_846_000 picoseconds. + Weight::from_parts(910_043_000, 3593) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } } + +// For backwards compatibility and tests. +impl WeightInfoT for () { + /// Storage: `ImbueFellowship::Roles` (r:1 w:1) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowToVetter` (r:0 w:1) + /// Proof: `ImbueFellowship::FellowToVetter` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowshipReserves` (r:0 w:1) + /// Proof: `ImbueFellowship::FellowshipReserves` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + fn add_to_fellowship() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3593` + // Minimum execution time: 666_362_000 picoseconds. + Weight::from_parts(674_483_000, 3593) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: `ImbueFellowship::Roles` (r:1 w:1) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + fn force_add_fellowship() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3516` + // Minimum execution time: 343_825_000 picoseconds. + Weight::from_parts(346_698_000, 3516) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `ImbueFellowship::Roles` (r:1 w:1) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::PendingFellows` (r:1 w:1) + /// Proof: `ImbueFellowship::PendingFellows` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowshipReserves` (r:1 w:0) + /// Proof: `ImbueFellowship::FellowshipReserves` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowToVetter` (r:0 w:1) + /// Proof: `ImbueFellowship::FellowToVetter` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + fn leave_fellowship() -> Weight { + // Proof Size summary in bytes: + // Measured: `410` + // Estimated: `3593` + // Minimum execution time: 1_025_061_000 picoseconds. + Weight::from_parts(1_033_384_000, 3593) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: `ImbueFellowship::Roles` (r:1 w:1) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::PendingFellows` (r:1 w:1) + /// Proof: `ImbueFellowship::PendingFellows` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowshipReserves` (r:1 w:0) + /// Proof: `ImbueFellowship::FellowshipReserves` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowToVetter` (r:0 w:1) + /// Proof: `ImbueFellowship::FellowToVetter` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + fn force_remove_and_slash_fellowship() -> Weight { + // Proof Size summary in bytes: + // Measured: `513` + // Estimated: `6196` + // Minimum execution time: 1_991_447_000 picoseconds. + Weight::from_parts(2_236_308_000, 6196) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + /// Storage: `ImbueFellowship::Roles` (r:2 w:0) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::ShortlistRound` (r:1 w:0) + /// Proof: `ImbueFellowship::ShortlistRound` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::CandidateShortlist` (r:1 w:1) + /// Proof: `ImbueFellowship::CandidateShortlist` (`max_values`: None, `max_size`: Some(3421), added: 5896, mode: `MaxEncodedLen`) + fn add_candidate_to_shortlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `289` + // Estimated: `6886` + // Minimum execution time: 977_857_000 picoseconds. + Weight::from_parts(1_146_395_000, 6886) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `ImbueFellowship::Roles` (r:1 w:0) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::ShortlistRound` (r:1 w:0) + /// Proof: `ImbueFellowship::ShortlistRound` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::CandidateShortlist` (r:1 w:1) + /// Proof: `ImbueFellowship::CandidateShortlist` (`max_values`: None, `max_size`: Some(3421), added: 5896, mode: `MaxEncodedLen`) + fn remove_candidate_from_shortlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `299` + // Estimated: `6886` + // Minimum execution time: 463_826_000 picoseconds. + Weight::from_parts(467_466_000, 6886) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `ImbueFellowship::PendingFellows` (r:1 w:1) + /// Proof: `ImbueFellowship::PendingFellows` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::Roles` (r:0 w:1) + /// Proof: `ImbueFellowship::Roles` (`max_values`: None, `max_size`: Some(51), added: 2526, mode: `MaxEncodedLen`) + /// Storage: `ImbueFellowship::FellowshipReserves` (r:0 w:1) + /// Proof: `ImbueFellowship::FellowshipReserves` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + fn pay_deposit_to_remove_pending_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `259` + // Estimated: `3593` + // Minimum execution time: 877_846_000 picoseconds. + Weight::from_parts(910_043_000, 3593) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } +} \ No newline at end of file diff --git a/pallets/grants/src/weights.rs b/pallets/grants/src/weights.rs index 4a84dc3b..b0d6f34e 100644 --- a/pallets/grants/src/weights.rs +++ b/pallets/grants/src/weights.rs @@ -2,43 +2,35 @@ //! Autogenerated weights for `pallet_grants` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("local")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: // ./target/debug/imbue // benchmark // pallet -// --chain -// local -// --execution -// wasm -// --wasm-execution -// compiled -// --pallet -// pallet-grants -// --extrinsic -// * -// --output -// weights.rs -// --steps -// 50 -// --repeat -// 20 +// --chain=imbue-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_grants +// --extrinsic=* +// --output=./pallets/grants/src/weights.rs +// --template=./scripts/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions for `pallet_grants`. +/// Weights for `pallet_grants` using the Substrate node and recommended hardware. pub struct WeightInfo(PhantomData); -impl crate::WeightInfoT for WeightInfo { +impl WeightInfoT for WeightInfo { /// Storage: `ImbueGrants::GrantsSubmitted` (r:1 w:1) /// Proof: `ImbueGrants::GrantsSubmitted` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectCount` (r:1 w:1) @@ -59,10 +51,38 @@ impl crate::WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `369` // Estimated: `3593` - // Minimum execution time: 1_038_238_000 picoseconds. - Weight::from_parts(1_072_638_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(8)) + // Minimum execution time: 3_125_367_000 picoseconds. + Weight::from_parts(3_986_489_000, 3593) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) } } + +// For backwards compatibility and tests. +impl WeightInfoT for () { + /// Storage: `ImbueGrants::GrantsSubmitted` (r:1 w:1) + /// Proof: `ImbueGrants::GrantsSubmitted` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectCount` (r:1 w:1) + /// Proof: `ImbueProposals::ProjectCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Deposits::TicketId` (r:1 w:1) + /// Proof: `Deposits::TicketId` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `ImbueGrants::GrantsSubmittedBy` (r:0 w:1) + /// Proof: `ImbueGrants::GrantsSubmittedBy` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Projects` (r:0 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) + /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) + fn create_and_convert() -> Weight { + // Proof Size summary in bytes: + // Measured: `369` + // Estimated: `3593` + // Minimum execution time: 3_125_367_000 picoseconds. + Weight::from_parts(3_986_489_000, 3593) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(8_u64)) + } +} \ No newline at end of file diff --git a/pallets/proposals/src/benchmarking.rs b/pallets/proposals/src/benchmarking.rs index b3deb780..be1f3a07 100644 --- a/pallets/proposals/src/benchmarking.rs +++ b/pallets/proposals/src/benchmarking.rs @@ -29,6 +29,8 @@ mod benchmarks { create_funded_user::("contributor", 1, 1_000_000_000_000_000_000u128); let bob: T::AccountId = create_funded_user::("initiator", 1, 1_000_000_000_000_000_000u128); + let jury = get_funded_jury::(10); + let contributions = get_contributions::(vec![alice], 100_000_000_000_000_000u128); let prop_milestones = get_max_milestones::(); let project_key = create_and_fund_project::( @@ -36,6 +38,7 @@ mod benchmarks { contributions, prop_milestones, CurrencyId::Native, + jury, ) .unwrap(); @@ -50,6 +53,8 @@ mod benchmarks { create_funded_user::("initiator", 1, 1_000_000_000_000_000_000u128); let bob: T::AccountId = create_funded_user::("contributor", 1, 1_000_000_000_000_000_000u128); + let jury = get_funded_jury::(10); + // TODO: should update the contributors list to have maximum available length let contributions = get_contributions::(vec![bob.clone()], 1_000_000_000_000u128); let prop_milestones = get_max_milestones::(); @@ -58,6 +63,7 @@ mod benchmarks { contributions, prop_milestones, CurrencyId::Native, + jury, ) .unwrap(); @@ -81,9 +87,9 @@ mod benchmarks { create_funded_user::("initiator", 1, 1_000_000_000_000_000_000u128); let bob: T::AccountId = create_funded_user::("contributor", 1, 1_000_000_000_000_000_000u128); + let jury = get_funded_jury::(10); let contributions = get_contributions::(vec![bob.clone()], 100_000_000_000_000_000u128); let raised_funds = 100_000_000_000_000_000u128.saturated_into(); - let milestone_count = ::MaxMilestonesPerProject::get(); let prop_milestones = get_milestones(milestone_count as u8); @@ -92,6 +98,7 @@ mod benchmarks { contributions, prop_milestones, CurrencyId::Native, + jury, ) .unwrap(); @@ -145,6 +152,7 @@ mod benchmarks { create_funded_user::("initiator", 1, 1_000_000_000_000_000_000u128); let bob: T::AccountId = create_funded_user::("contributor", 0, 1_000_000_000_000_000_000u128); + let jury = get_funded_jury::(10); let contributors: Vec = (0 ..::MaximumContributorsPerProject::get()) @@ -160,9 +168,14 @@ mod benchmarks { .try_into() .unwrap(); - let project_key = - create_and_fund_project::(alice, contributions, prop_milestones, CurrencyId::Native) - .unwrap(); + let project_key = create_and_fund_project::( + alice, + contributions, + prop_milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); #[extrinsic_call] raise_dispute(RawOrigin::Signed(bob), project_key, milestone_keys); @@ -175,6 +188,7 @@ mod benchmarks { create_funded_user::("initiator", 1, 1_000_000_000_000_000_000u128); let bob: T::AccountId = create_funded_user::("contributor", 0, 1_000_000_000_000_000_000u128); + let jury = get_funded_jury::(10); let contributors: Vec = (0 ..::MaximumContributorsPerProject::get()) @@ -192,9 +206,14 @@ mod benchmarks { .try_into() .unwrap(); - let project_key = - create_and_fund_project::(alice, contributions, prop_milestones, CurrencyId::Native) - .unwrap(); + let project_key = create_and_fund_project::( + alice, + contributions, + prop_milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); assert_ok!(crate::Pallet::::raise_dispute( RawOrigin::Signed(bob.clone()).into(), @@ -224,3 +243,9 @@ mod benchmarks { crate::mock::Test ); } + +fn get_funded_jury(n: u32) -> Vec> { + (0..n) + .map(|n| create_funded_user::("jury member", n, 1_000_000_000_000_000_000u128)) + .collect::>>() +} diff --git a/pallets/proposals/src/impls/pallet_impls.rs b/pallets/proposals/src/impls/pallet_impls.rs index 8685fda8..6c126738 100644 --- a/pallets/proposals/src/impls/pallet_impls.rs +++ b/pallets/proposals/src/impls/pallet_impls.rs @@ -316,7 +316,13 @@ impl Pallet { let exp_block = Rounds::::take((project_key, milestone_key), RoundType::VotingRound) .ok_or(Error::::VotingRoundNotStarted)?; // Prevent hook from calling. + // TODO: only remove project key???? RoundsExpiring::::remove(exp_block); + + MilestoneVotes::::mutate(project_key, |btree_votes| { + let _val = btree_votes.remove(&milestone_key); + }); + // Allow future votes to occur on this milestone IndividualVoteStore::::try_mutate(project_key, |maybe_individual_votes| { if let Some(individual_votes) = maybe_individual_votes { diff --git a/pallets/proposals/src/lib.rs b/pallets/proposals/src/lib.rs index 752c2299..ac350a70 100644 --- a/pallets/proposals/src/lib.rs +++ b/pallets/proposals/src/lib.rs @@ -354,6 +354,8 @@ pub mod pallet { OnlyContributorsCanInitiateRefund, /// Only the ForeignAssetSigner can mint tokens RequireForeignAssetSigner, + /// A Jury is required to create a project. + JuryRequired, } #[pallet::hooks] @@ -468,13 +470,18 @@ pub mod pallet { Error::::CannotRaiseDisputeOnApprovedMilestone ); - ::DisputeRaiser::raise_dispute( - project_key, - who, - project.jury, - milestone_keys.clone(), - )?; - ProjectsInDispute::::insert(project_key, milestone_keys); + if project.jury.len() == 1 { + // https://github.com/ImbueNetwork/imbue/issues/270 + let _ = >::on_dispute_complete(project_key, milestone_keys.to_vec(), pallet_disputes::DisputeResult::Success); + } else { + ::DisputeRaiser::raise_dispute( + project_key, + who, + project.jury, + milestone_keys.clone(), + )?; + ProjectsInDispute::::insert(project_key, milestone_keys); + } Ok(()) } @@ -642,6 +649,7 @@ pub mod pallet { on_creation_funding: FundingPath, eoa: Option, ) -> Result<(), DispatchError> { + ensure!(jury.len() > 0, Error::::JuryRequired); let project_key = crate::ProjectCount::::get().saturating_add(1); // Take storage deposit only for a Project. diff --git a/pallets/proposals/src/migration.rs b/pallets/proposals/src/migration.rs index 33946a6d..16a45f9f 100644 --- a/pallets/proposals/src/migration.rs +++ b/pallets/proposals/src/migration.rs @@ -1162,9 +1162,15 @@ mod test { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, DAVE], 100_000); let prop_milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) - .expect("project wasnt created!"); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( + ALICE, + cont, + prop_milestones, + CurrencyId::Native, + jury, + ) + .expect("project wasnt created!"); let milestone_key: MilestoneKey = 0; let expiry_block: BlockNumber = 10; let rounds_expiring: BoundedProjectKeysPerBlock = diff --git a/pallets/proposals/src/mock.rs b/pallets/proposals/src/mock.rs index db32a2ab..8ee00050 100644 --- a/pallets/proposals/src/mock.rs +++ b/pallets/proposals/src/mock.rs @@ -229,6 +229,9 @@ pub static DAVE: AccountId = 128; pub static TREASURY: AccountId = 222; pub static JOHN: AccountId = 255; +pub static JURY_1: AccountId = 1000; +pub static JURY_2: AccountId = 1001; + pub(crate) fn build_test_externality() -> sp_io::TestExternalities { let t = frame_system::GenesisConfig::::default() .build_storage() diff --git a/pallets/proposals/src/test_utils.rs b/pallets/proposals/src/test_utils.rs index eceece11..6803a5d9 100644 --- a/pallets/proposals/src/test_utils.rs +++ b/pallets/proposals/src/test_utils.rs @@ -67,6 +67,7 @@ pub fn create_and_fund_project( contributions: ContributionsFor, proposed_milestones: Vec, currency_id: CurrencyId, + jury: Vec>, ) -> Result { contributions.iter().for_each(|(acc, c)| { ::MultiCurrency::reserve(currency_id, acc, c.value).unwrap(); @@ -86,7 +87,7 @@ pub fn create_and_fund_project( beneficiary, proposed_milestones.try_into().map_err(|_|Error::::TooManyMilestones)?, refund_locations, - BoundedVec::new(), + jury.try_into().expect("Too many Jury members."), FundingPath::TakeFromReserved, None, )?; diff --git a/pallets/proposals/src/tests/disputes.rs b/pallets/proposals/src/tests/disputes.rs index 3106528e..87a76afe 100644 --- a/pallets/proposals/src/tests/disputes.rs +++ b/pallets/proposals/src/tests/disputes.rs @@ -9,11 +9,14 @@ fn raise_dispute_not_contributor() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -48,11 +51,14 @@ fn raise_dispute_milestone_already_in_dispute() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -83,9 +89,16 @@ fn raise_dispute_invalid_milestone_key() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); assert_noop!( Proposals::raise_dispute( RuntimeOrigin::signed(BOB), @@ -118,9 +131,16 @@ fn raise_dispute_cant_raise_on_approved_milestone() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); let submitted_milestone_key = 0u32; assert_ok!(Proposals::submit_milestone( @@ -165,11 +185,14 @@ fn on_dispute_complete_success_removes_dispute_status() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -196,11 +219,14 @@ fn on_dispute_complete_failure_removes_dispute_status() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -227,11 +253,14 @@ fn dispute_success_does_not_cancel_project() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -261,11 +290,14 @@ fn dispute_success_approves_milestone_for_refund_but_only_ones_specified() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (1u32 @@ -293,11 +325,14 @@ fn raise_dispute_allows_milestone_voting() { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); let submitted_milestone_key = 0; + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); @@ -338,11 +373,14 @@ fn raise_dispute_allows_milestone_voting_on_non_disputed_milestones() { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); let submitted_milestone_keys = [0, 1]; + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); @@ -390,11 +428,14 @@ fn raise_dispute_allows_submission() { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); let milestone_key = 0; + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); @@ -422,11 +463,14 @@ fn failed_dispute_tests() { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); let _milestone_key = 0; + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); @@ -461,9 +505,16 @@ fn assert_can_recall_dispute_after_success() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); // Only call the dispute on part. let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32..5_u32).collect::>().try_into().unwrap(); @@ -493,9 +544,16 @@ fn assert_can_recall_dispute_after_failure() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); // Only call the dispute on part. let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32..5_u32).collect::>().try_into().unwrap(); @@ -519,3 +577,53 @@ fn assert_can_recall_dispute_after_failure() { )); }) } + +#[test] +fn raise_dispute_with_single_jury_auto_completes() { + build_test_externality().execute_with(|| { + let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); + let milestones = get_milestones(10); + let jury = vec![JURY_1]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones.clone(), + CurrencyId::Native, + jury, + ) + .unwrap(); + + let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 + ..milestones.len() as u32) + .collect::>() + .try_into() + .unwrap(); + + assert_ok!(Proposals::raise_dispute( + RuntimeOrigin::signed(BOB), + project_key, + milestone_keys.clone() + )); + + let project = Projects::::get(project_key).unwrap(); + + project.milestones.iter().for_each(|(key, ms)| { + // if its meant to be approved for refund then check + if milestone_keys.contains(key) { + assert!( + ms.can_refund, + "the dispute should have bypassed dispute pallet and autofinalised." + ); + } else { + assert!( + !ms.can_refund, + "This milestone should not have been approved for refund." + ); + } + + // They havent been transferred yet + assert_eq!(ms.transfer_status, None) + }); + }) +} diff --git a/pallets/proposals/src/tests/foreign_asset.rs b/pallets/proposals/src/tests/foreign_asset.rs new file mode 100644 index 00000000..6d4bb6f1 --- /dev/null +++ b/pallets/proposals/src/tests/foreign_asset.rs @@ -0,0 +1,80 @@ +use crate::{mock::*, *}; +use common_types::ForeignAssetId; +use frame_support::{assert_noop, assert_ok, error::BadOrigin}; +use test_utils::*; + +#[test] +fn set_foreign_asset_signer_check_permission_for_edit() { + build_test_externality().execute_with(|| { + assert_ok!(Proposals::set_foreign_asset_signer( + RuntimeOrigin::root(), + ALICE + )); + assert_eq!( + ForeignCurrencySigner::::get().unwrap(), + ALICE, + "Alice should have been set as signer." + ); + assert_ok!(Proposals::set_foreign_asset_signer( + RuntimeOrigin::root(), + BOB + )); + assert_eq!( + ForeignCurrencySigner::::get().unwrap(), + BOB, + "Bob should be set as signer." + ); + assert_noop!( + Proposals::set_foreign_asset_signer(RuntimeOrigin::signed(BOB), ALICE), + BadOrigin + ); + }) +} + +#[test] +fn foreign_asset_signer_can_mint() { + build_test_externality().execute_with(|| { + let currency_id = CurrencyId::ForeignAsset(ForeignAssetId::ETH); + let beneficiary = BOB; + let amount = 92839572; + let _ = Proposals::set_foreign_asset_signer(RuntimeOrigin::root(), ALICE); + let asset_signer = ForeignCurrencySigner::::get().unwrap(); + assert_eq!(Tokens::free_balance(currency_id, &BOB), 0); + assert_ok!(Proposals::mint_offchain_assets( + RuntimeOrigin::signed(asset_signer), + beneficiary, + currency_id, + amount + )); + assert_eq!(Tokens::free_balance(currency_id, &BOB), amount); + }) +} + +#[test] +fn non_foreign_asset_signer_cannot_mint() { + build_test_externality().execute_with(|| { + let currency_id = CurrencyId::ForeignAsset(ForeignAssetId::ETH); + let beneficiary = BOB; + let amount = 92839572; + let _ = Proposals::set_foreign_asset_signer(RuntimeOrigin::root(), ALICE); + + assert_noop!( + Proposals::mint_offchain_assets( + RuntimeOrigin::signed(BOB), + beneficiary, + currency_id, + amount + ), + Error::::RequireForeignAssetSigner + ); + assert_noop!( + Proposals::mint_offchain_assets( + RuntimeOrigin::signed(CHARLIE), + beneficiary, + currency_id, + amount + ), + Error::::RequireForeignAssetSigner + ); + }) +} diff --git a/pallets/proposals/src/tests/mod.rs b/pallets/proposals/src/tests/mod.rs index 0eeec162..8c67f181 100644 --- a/pallets/proposals/src/tests/mod.rs +++ b/pallets/proposals/src/tests/mod.rs @@ -1,4 +1,5 @@ pub mod disputes; +pub mod foreign_asset; pub mod immutable_votes; pub mod pallet; pub mod refunds; diff --git a/pallets/proposals/src/tests/pallet.rs b/pallets/proposals/src/tests/pallet.rs index d7b85006..0e9bbb51 100644 --- a/pallets/proposals/src/tests/pallet.rs +++ b/pallets/proposals/src/tests/pallet.rs @@ -21,8 +21,10 @@ fn submit_milestone_milestone_doesnt_exist() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_noop!( Proposals::submit_milestone(RuntimeOrigin::signed(ALICE), project_key, 11), @@ -46,8 +48,10 @@ fn submit_milestone_not_initiator() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_noop!( Proposals::submit_milestone(RuntimeOrigin::signed(BOB), project_key, 1), @@ -66,6 +70,7 @@ fn submit_milestones_too_many_this_block() { let max = ::ExpiringProjectRoundsPerBlock::get(); let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; (0..=max).for_each(|i| { let project_key = create_and_fund_project::( @@ -73,6 +78,7 @@ fn submit_milestones_too_many_this_block() { cont.clone(), prop_milestones.clone(), CurrencyId::Native, + jury.clone(), ) .unwrap(); if i != max { @@ -96,8 +102,10 @@ fn submit_milestone_creates_non_bias_vote() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( RuntimeOrigin::signed(ALICE), @@ -117,8 +125,10 @@ fn submit_milestone_can_resubmit_during_voting_round() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -163,8 +173,10 @@ fn submit_milestone_can_submit_again_after_failed_vote() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( RuntimeOrigin::signed(ALICE), @@ -187,8 +199,10 @@ fn submit_milestone_cannot_submit_again_after_success_vote() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -224,8 +238,10 @@ fn ensure_milestone_vote_data_is_cleaned_after_autofinalisation_for() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -291,8 +307,10 @@ fn ensure_milestone_vote_data_is_cleaned_after_autofinalisation_against() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -357,8 +375,10 @@ fn users_can_submit_multiple_milestones_and_vote_independantly() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key_0 = 0; let milestone_key_1 = 1; @@ -416,8 +436,10 @@ fn vote_on_milestone_before_round_starts_fails() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_noop!( @@ -437,8 +459,10 @@ fn vote_on_milestone_after_round_end_fails() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; let expiring_block = frame_system::Pallet::::block_number() @@ -466,8 +490,10 @@ fn vote_on_milestone_where_voting_round_is_active_but_not_the_correct_milestone( build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( RuntimeOrigin::signed(ALICE), @@ -486,8 +512,10 @@ fn if_double_submission_and_one_finalises_voting_on_the_second_can_vote() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let expiring_block = frame_system::Pallet::::block_number() + ::MilestoneVotingWindow::get(); @@ -517,8 +545,10 @@ fn vote_on_milestone_not_contributor() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -541,10 +571,12 @@ fn vote_on_milestone_not_contributor() { #[test] fn vote_on_milestone_actually_adds_to_vote() { build_test_externality().execute_with(|| { - let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); + let cont = get_contributions::(vec![BOB, CHARLIE, DAVE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -581,8 +613,10 @@ fn vote_on_milestone_autofinalises_on_all_voted_and_fail() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE, DAVE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -615,13 +649,89 @@ fn vote_on_milestone_autofinalises_on_all_voted_and_fail() { }); } +#[test] +fn vote_struct_removed_on_autofinalisation_success() { + build_test_externality().execute_with(|| { + let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); + let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) + .unwrap(); + let milestone_key = 5; + assert_ok!(Proposals::submit_milestone( + RuntimeOrigin::signed(ALICE), + project_key, + milestone_key + )); + assert_ok!(Proposals::vote_on_milestone( + RuntimeOrigin::signed(BOB), + project_key, + milestone_key, + true + )); + assert!(MilestoneVotes::::get(project_key) + .get(&milestone_key) + .is_some()); + + assert_ok!(Proposals::vote_on_milestone( + RuntimeOrigin::signed(CHARLIE), + project_key, + milestone_key, + true + )); + assert!(MilestoneVotes::::get(project_key) + .get(&milestone_key) + .is_none()); + }); +} + +#[test] +fn vote_struct_removed_on_autofinalisation_failure() { + build_test_externality().execute_with(|| { + let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); + let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) + .unwrap(); + let milestone_key = 5; + assert_ok!(Proposals::submit_milestone( + RuntimeOrigin::signed(ALICE), + project_key, + milestone_key + )); + assert_ok!(Proposals::vote_on_milestone( + RuntimeOrigin::signed(BOB), + project_key, + milestone_key, + false + )); + assert!(MilestoneVotes::::get(project_key) + .get(&milestone_key) + .is_some()); + assert_ok!(Proposals::vote_on_milestone( + RuntimeOrigin::signed(CHARLIE), + project_key, + milestone_key, + false + )); + + assert!(MilestoneVotes::::get(project_key) + .get(&milestone_key) + .is_none()); + }); +} + #[test] fn withdraw_not_initiator() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB, CHARLIE], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_ok!(Proposals::submit_milestone( @@ -659,8 +769,10 @@ fn withdraw_only_transfers_approved_milestones() { let per_contribution = 100_000; let cont = get_contributions::(vec![BOB, CHARLIE], per_contribution); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let project_account = crate::Pallet::::project_account_id(project_key); let milestone_key = 0; @@ -708,8 +820,10 @@ fn withdraw_removes_project_after_all_funds_taken() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(1); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; let _ = @@ -740,8 +854,10 @@ fn store_project_info_after_project_is_completed() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(1); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; let _ = @@ -773,6 +889,8 @@ fn store_too_many_projects_for_account() { let max = ::MaxProjectsPerAccount::get(); let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(1); + let jury = vec![JURY_1, JURY_2]; + let milestone_key = 0; (0..=max).for_each(|i| { let project_key = create_and_fund_project::( @@ -780,6 +898,7 @@ fn store_too_many_projects_for_account() { cont.clone(), prop_milestones.clone(), CurrencyId::Native, + jury.clone(), ) .unwrap(); let _ = Proposals::submit_milestone( @@ -816,8 +935,10 @@ fn withdraw_takes_imbue_fee() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; let fee_account: AccountId = ::ImbueFeeAccount::get(); @@ -855,8 +976,10 @@ fn withdraw_cannot_double_withdraw() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; let _ = @@ -885,8 +1008,10 @@ fn withdraw_once_times_with_double_submissions() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let _ = Proposals::submit_milestone(RuntimeOrigin::signed(ALICE), project_key, 0).unwrap(); let _ = @@ -917,8 +1042,10 @@ fn withdraw_twice_with_intermitent_submission() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); // The first submission and withdraw @@ -971,8 +1098,10 @@ fn withdraw_with_variable_percentage() { percentage_to_unlock: Percent::from_percent(30u8), }, ]; + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let _ = Proposals::submit_milestone(RuntimeOrigin::signed(ALICE), project_key, 0).unwrap(); let _ = @@ -998,8 +1127,10 @@ fn withdraw_fails_before_approval() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_noop!( @@ -1021,8 +1152,10 @@ fn withdraw_assert_milestone_state_change() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); let milestone_key = 0; assert_noop!( @@ -1079,8 +1212,10 @@ fn project_in_voting_is_saved_on_submission() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( @@ -1104,8 +1239,10 @@ fn project_in_voting_is_removed_on_init_hook() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( @@ -1130,8 +1267,10 @@ fn project_in_voting_is_removed_on_milestone_autofinalisation() { build_test_externality().execute_with(|| { let cont = get_contributions::(vec![BOB], 100_000); let prop_milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = - create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native) + create_and_fund_project::(ALICE, cont, prop_milestones, CurrencyId::Native, jury) .unwrap(); assert_ok!(Proposals::submit_milestone( diff --git a/pallets/proposals/src/tests/refunds.rs b/pallets/proposals/src/tests/refunds.rs index c61c6dab..bca95eec 100644 --- a/pallets/proposals/src/tests/refunds.rs +++ b/pallets/proposals/src/tests/refunds.rs @@ -8,11 +8,14 @@ fn you_can_actually_refund_after_dispute_success() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -41,9 +44,16 @@ fn refund_assert_milestone_state_change() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB], 1_000_000u128); let milestones = get_milestones(10); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); // Only dispute some keys so that we can let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32..5_u32).collect::>().try_into().unwrap(); @@ -85,11 +95,14 @@ fn refund_not_contributor() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -119,11 +132,14 @@ fn refund_deletes_project_when_all_funds_are_refunded() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -161,11 +177,14 @@ fn withdraw_then_refund_no_double_spend() { ::MultiCurrency::free_balance(CurrencyId::Native, &ALICE); let bob_before_creation = ::MultiCurrency::free_balance(CurrencyId::Native, &ALICE); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -231,9 +250,16 @@ fn refund_then_withdraw_no_double_spend() { ::MultiCurrency::free_balance(CurrencyId::Native, &ALICE); let _bob_before_creation = ::MultiCurrency::free_balance(CurrencyId::Native, &ALICE); - let project_key = - create_and_fund_project::(ALICE, contributions, milestones, CurrencyId::Native) - .unwrap(); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones, + CurrencyId::Native, + jury, + ) + .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32..5_u32).collect::>().try_into().unwrap(); let _ = Proposals::raise_dispute( @@ -275,11 +301,14 @@ fn refund_check_refund_amount() { let per_contribution = 100000u128; let contributions = get_contributions::(vec![BOB, CHARLIE], per_contribution); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 @@ -333,11 +362,14 @@ fn refund_takes_imbue_fee() { let contributions = get_contributions::(vec![BOB, CHARLIE], per_contribution); let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let project_key = create_and_fund_project::( ALICE, contributions, milestones.clone(), CurrencyId::Native, + jury, ) .unwrap(); let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (0u32 diff --git a/pallets/proposals/src/weights.rs b/pallets/proposals/src/weights.rs index db9727fe..16a6c301 100644 --- a/pallets/proposals/src/weights.rs +++ b/pallets/proposals/src/weights.rs @@ -2,43 +2,35 @@ //! Autogenerated weights for `pallet_proposals` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("local")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: // ./target/debug/imbue // benchmark // pallet -// --chain -// local -// --execution -// wasm -// --wasm-execution -// compiled -// --pallet -// pallet-proposals -// --extrinsic -// * -// --output -// weights.rs -// --steps -// 50 -// --repeat -// 20 +// --chain=imbue-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_proposals +// --extrinsic=* +// --output=./pallets/proposals/src/weights.rs +// --template=./scripts/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions for `pallet_proposals`. +/// Weights for `pallet_proposals` using the Substrate node and recommended hardware. pub struct WeightInfo(PhantomData); -impl crate::WeightInfoT for WeightInfo { +impl WeightInfoT for WeightInfo { /// Storage: `ImbueProposals::Projects` (r:1 w:0) /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) @@ -49,15 +41,16 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::MilestoneVotes` (`max_values`: None, `max_size`: Some(375), added: 2850, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Rounds` (r:0 w:1) /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn submit_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `568` + // Measured: `888` // Estimated: `39815` - // Minimum execution time: 345_914_000 picoseconds. - Weight::from_parts(354_103_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 802_182_000 picoseconds. + Weight::from_parts(1_244_732_000, 39815) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) @@ -69,15 +62,16 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::MilestoneVotes` (`max_values`: None, `max_size`: Some(375), added: 2850, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::RoundsExpiring` (r:0 w:1) /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn vote_on_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `711` + // Measured: `1068` // Estimated: `39815` - // Minimum execution time: 460_847_000 picoseconds. - Weight::from_parts(472_559_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(5)) + // Minimum execution time: 1_678_727_000 picoseconds. + Weight::from_parts(1_932_549_000, 39815) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) @@ -89,13 +83,12 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::CompletedProjects` (`max_values`: None, `max_size`: Some(262184), added: 264659, mode: `MaxEncodedLen`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `1120` + // Measured: `1511` // Estimated: `265649` - // Minimum execution time: 1_638_213_000 picoseconds. - Weight::from_parts(1_677_055_000, 0) - .saturating_add(Weight::from_parts(0, 265649)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) + // Minimum execution time: 3_646_250_000 picoseconds. + Weight::from_parts(5_622_221_000, 265649) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) @@ -105,15 +98,16 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Rounds` (r:0 w:1) /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn on_initialize() -> Weight { // Proof Size summary in bytes: // Measured: `97` // Estimated: `20036` - // Minimum execution time: 147_964_000 picoseconds. - Weight::from_parts(151_147_000, 0) - .saturating_add(Weight::from_parts(0, 20036)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) + // Minimum execution time: 354_713_000 picoseconds. + Weight::from_parts(361_079_000, 20036) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:0) /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) @@ -125,13 +119,12 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) fn raise_dispute() -> Weight { // Proof Size summary in bytes: - // Measured: `4797` + // Measured: `5117` // Estimated: `39815` - // Minimum execution time: 346_461_000 picoseconds. - Weight::from_parts(356_015_000, 0) - .saturating_add(Weight::from_parts(0, 39815)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + // Minimum execution time: 764_754_000 picoseconds. + Weight::from_parts(995_634_000, 39815) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) @@ -139,12 +132,123 @@ impl crate::WeightInfoT for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `11381` + // Measured: `12010` // Estimated: `136346` - // Minimum execution time: 23_947_016_000 picoseconds. - Weight::from_parts(24_080_686_000, 0) - .saturating_add(Weight::from_parts(0, 136346)) - .saturating_add(T::DbWeight::get().reads(53)) - .saturating_add(T::DbWeight::get().writes(53)) + // Minimum execution time: 50_985_697_000 picoseconds. + Weight::from_parts(51_360_296_000, 136346) + .saturating_add(T::DbWeight::get().reads(53_u64)) + .saturating_add(T::DbWeight::get().writes(53_u64)) } } + +// For backwards compatibility and tests. +impl WeightInfoT for () { + /// Storage: `ImbueProposals::Projects` (r:1 w:0) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) + /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) + /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::MilestoneVotes` (r:1 w:1) + /// Proof: `ImbueProposals::MilestoneVotes` (`max_values`: None, `max_size`: Some(375), added: 2850, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Rounds` (r:0 w:1) + /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn submit_milestone() -> Weight { + // Proof Size summary in bytes: + // Measured: `888` + // Estimated: `39815` + // Minimum execution time: 802_182_000 picoseconds. + Weight::from_parts(1_244_732_000, 39815) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Rounds` (r:1 w:1) + /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) + /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::MilestoneVotes` (r:1 w:1) + /// Proof: `ImbueProposals::MilestoneVotes` (`max_values`: None, `max_size`: Some(375), added: 2850, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::RoundsExpiring` (r:0 w:1) + /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn vote_on_milestone() -> Weight { + // Proof Size summary in bytes: + // Measured: `1068` + // Estimated: `39815` + // Minimum execution time: 1_678_727_000 picoseconds. + Weight::from_parts(1_932_549_000, 39815) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::CompletedProjects` (r:1 w:1) + /// Proof: `ImbueProposals::CompletedProjects` (`max_values`: None, `max_size`: Some(262184), added: 264659, mode: `MaxEncodedLen`) + fn withdraw() -> Weight { + // Proof Size summary in bytes: + // Measured: `1511` + // Estimated: `265649` + // Minimum execution time: 3_646_250_000 picoseconds. + Weight::from_parts(5_622_221_000, 265649) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) + /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::MilestoneVotes` (r:1 w:1) + /// Proof: `ImbueProposals::MilestoneVotes` (`max_values`: None, `max_size`: Some(375), added: 2850, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) + /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::Rounds` (r:0 w:1) + /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectInVoting` (r:0 w:1) + /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + fn on_initialize() -> Weight { + // Proof Size summary in bytes: + // Measured: `97` + // Estimated: `20036` + // Minimum execution time: 354_713_000 picoseconds. + Weight::from_parts(361_079_000, 20036) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + /// Storage: `ImbueProposals::Projects` (r:1 w:0) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `ImbueProposals::ProjectsInDispute` (r:1 w:1) + /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) + /// Proof: `ImbueDisputes::Disputes` (`max_values`: None, `max_size`: Some(6602), added: 9077, mode: `MaxEncodedLen`) + /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) + /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) + fn raise_dispute() -> Weight { + // Proof Size summary in bytes: + // Measured: `5117` + // Estimated: `39815` + // Minimum execution time: 764_754_000 picoseconds. + Weight::from_parts(995_634_000, 39815) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: `ImbueProposals::Projects` (r:1 w:1) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:52 w:52) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `12010` + // Estimated: `136346` + // Minimum execution time: 50_985_697_000 picoseconds. + Weight::from_parts(51_360_296_000, 136346) + .saturating_add(RocksDbWeight::get().reads(53_u64)) + .saturating_add(RocksDbWeight::get().writes(53_u64)) + } +} \ No newline at end of file diff --git a/runtime/imbue-kusama/Cargo.toml b/runtime/imbue-kusama/Cargo.toml index 7af2a092..1031662f 100644 --- a/runtime/imbue-kusama/Cargo.toml +++ b/runtime/imbue-kusama/Cargo.toml @@ -91,7 +91,7 @@ orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-m # Used for runtime benchmarking frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", optional = true } frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", optional = true } -hex-literal = { version = "0.3.4", optional = true } +hex-literal = { version = "0.3.4"} # Local Dependencies common-traits = { path = "../../libs/common-traits", default-features = false } @@ -275,7 +275,6 @@ runtime-benchmarks = [ 'frame-benchmarking/runtime-benchmarks', 'frame-support/runtime-benchmarks', 'frame-system-benchmarking/runtime-benchmarks', - "hex-literal", 'pallet-balances/runtime-benchmarks', 'pallet-briefs/runtime-benchmarks', 'pallet-collective/runtime-benchmarks', diff --git a/runtime/imbue-kusama/src/lib.rs b/runtime/imbue-kusama/src/lib.rs index 1087e827..ffe7cdfa 100644 --- a/runtime/imbue-kusama/src/lib.rs +++ b/runtime/imbue-kusama/src/lib.rs @@ -869,6 +869,7 @@ impl pallet_briefs::Config for Runtime { type BriefStorageItem = BriefStorageItem; type DepositHandler = Deposits; type JurySelector = PointerBasedJurySelector; + type EnsureRole = pallet_fellowship::impls::EnsureFellowshipRole; } parameter_types! { @@ -1326,6 +1327,8 @@ type AccountIdOf = ::AccountId; pub struct PointerBasedJurySelector(T); impl pallet_fellowship::traits::SelectJury> for PointerBasedJurySelector +where + T: frame_system::Config, { type JurySize = MaxJurySize; fn select_jury() -> frame_support::BoundedVec, Self::JurySize> { @@ -1353,6 +1356,29 @@ impl pallet_fellowship::traits::SelectJury::put(pointer_with_bound); - out + + if out.len() == 0 { + vec![ + sp_runtime::AccountId32::new(hex_literal::hex![ + "4294eb45758b4b92b01ceffe209bbcfeb26c973d5c0e21ac6c9cfbb99201b334" + ]), + sp_runtime::AccountId32::new(hex_literal::hex![ + "328d9a97c6f7f0fbbc60be2faba4c36cd4e5d3cfcb316393b384ee1a45433034" + ]), + sp_runtime::AccountId32::new(hex_literal::hex![ + "3e064fcfd9f02b99dda26226d3d6b2d68032b1c990e7a350cd01747271356f4c" + ]), + sp_runtime::AccountId32::new(hex_literal::hex![ + "82bf733f44a840f0a5c1935a002d4e541d81298fad6d1da8124073485983860e" + ]), + sp_runtime::AccountId32::new(hex_literal::hex![ + "5a1616831e4508abf2eced2670199ab7a00e9e2bbcfc04655ba7ed138af8787d" + ]), + ] + .try_into() + .unwrap_or_default() + } else { + out + } } } diff --git a/scripts/frame-weight-template.hbs b/scripts/frame-weight-template.hbs index 16e71c46..83107d69 100644 --- a/scripts/frame-weight-template.hbs +++ b/scripts/frame-weight-template.hbs @@ -1,11 +1,11 @@ {{header}} -//! Autogenerated weights for {{pallet}} +//! Autogenerated weights for `{{pallet}}` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} //! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` //! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}` //! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` -//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} +//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}` // Executed Command: {{#each args as |arg|}} @@ -15,28 +15,15 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; +use crate::WeightInfoT; -/// Weight functions needed for {{pallet}}. -pub trait WeightInfo { - {{#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{c.name}}: u32, {{/each~}} - ) -> Weight; - {{/each}} -} - -/// Weights for {{pallet}} using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -{{#if (eq pallet "frame_system")}} -impl WeightInfo for SubstrateWeight { -{{else}} -impl WeightInfo for SubstrateWeight { -{{/if}} +/// Weights for `{{pallet}}` using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl WeightInfoT for WeightInfo { {{#each benchmarks as |benchmark|}} {{#each benchmark.comments as |comment|}} /// {{comment}} @@ -77,8 +64,8 @@ impl WeightInfo for SubstrateWeight { {{/each}} } -// For backwards compatibility and tests -impl WeightInfo for () { +// For backwards compatibility and tests. +impl WeightInfoT for () { {{#each benchmarks as |benchmark|}} {{#each benchmark.comments as |comment|}} /// {{comment}} diff --git a/scripts/pallet_index.rs b/scripts/pallet_index.rs deleted file mode 100644 index 79c29295..00000000 --- a/scripts/pallet_index.rs +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -use walkdir::WalkDir; // "2.3.2" -use regex::Regex; // "1.7.0" - -// Call with `substrate/frame` as the only argument. -fn main() { - let folder = std::env::args().nth(1).unwrap(); - let re = Regex::new(r"^(\s+)#\[pallet::weight\(").expect("Regex is known good"); - let mut modified_files = 0; - let mut modified_calls = 0; - - for f in WalkDir::new(folder).into_iter().filter_map(|e| e.ok()) { - if f.metadata().unwrap().is_file() { - // Only process Rust files: - if !f.path().to_str().unwrap().ends_with(".rs") { - continue; - } - // Exclude the pallet-ui tests: - if f.path().to_str().unwrap().contains("pallet_ui") { - continue; - } - - let content = std::fs::read_to_string(f.path()).unwrap(); - let mut new_lines = Vec::with_capacity(content.lines().count()); - let mut call_index = 0; - - for (i, line) in content.lines().enumerate() { - let m = re.captures(line); - if let Some(m) = m { - // Skip if there is already a call index before or after: - if i > 0 && content.lines().nth(i - 1).unwrap().contains("pallet::call_index") { - continue; - } - if i +1 < content.lines().count() && content.lines().nth(i + 1).unwrap().contains("pallet::call_index") { - continue; - } - - println!("{}:{} index {}", f.path().display(), i, call_index); - new_lines.push(format!("{}#[pallet::call_index({})]", m.get(1).unwrap().as_str(), call_index)); - call_index += 1; - } - new_lines.push(line.to_string()); - } - - if call_index > 0 { - std::fs::write(f.path(), new_lines.join("\n")).unwrap(); - println!("Inserted {} indices for {}", call_index, f.path().display()); - modified_files += 1; - modified_calls += call_index; - } - } - } - println!("Modified {} files and {} calls in total", modified_files, modified_calls); -} - diff --git a/scripts/run_benchmarks.sh b/scripts/run_benchmarks.sh new file mode 100755 index 00000000..0014ae74 --- /dev/null +++ b/scripts/run_benchmarks.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -eou pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +cd ../ +cargo build --release --locked --features runtime-benchmarks + +IMBUE=./target/release/imbue + +EXCLUDED_PALLETS=( + "frame_benchmarking" + "frame_system" + "pallet_balances" + "pallet_timestamp" +) + +ALL_PALLETS=($( + $IMBUE benchmark pallet --list --chain=imbue-dev |\ + tail -n+2 |\ + cut -d',' -f1 |\ + sort |\ + uniq +)); + +PALLETS=($({ printf '%s\n' "${ALL_PALLETS[@]}" "${EXCLUDED_PALLETS[@]}"; } | sort | uniq -u)) + +echo "Benchmarking ${#PALLETS[@]} Imbue pallets." +for PALLET in "${PALLETS[@]}"; do + + FOLDER="$(echo "${PALLET#*_}" | tr '_' '-')"; + WEIGHT_FILE="./pallets/${FOLDER}/src/weights.rs" + echo "Benchmarking $PALLET with weight file $WEIGHT_FILE"; + + $IMBUE benchmark pallet \ + --chain="imbue-dev" \ + --steps=50 \ + --repeat=20 \ + --pallet="$PALLET" \ + --extrinsic="*" \ + --output="$WEIGHT_FILE" \ + --template="./scripts/frame-weight-template.hbs" 2>&1 + +done +exit 0 \ No newline at end of file From 859f6831ef8bc9831fd072dd024d273edd8c2289 Mon Sep 17 00:00:00 2001 From: gatsey <42411328+f-gate@users.noreply.github.com> Date: Thu, 14 Dec 2023 18:09:54 +0000 Subject: [PATCH 2/5] Freelancer disputes (#296) * allow initiator to raise dispute * on_dispute_complete refactor, tests, test refactor * fix * fmt * fix --- pallets/disputes/src/lib.rs | 11 ++- pallets/disputes/src/mock.rs | 3 +- pallets/disputes/src/traits.rs | 3 +- pallets/grants/src/benchmarking.rs | 2 +- pallets/proposals/src/benchmarking.rs | 3 +- pallets/proposals/src/impls/pallet_impls.rs | 9 ++- pallets/proposals/src/lib.rs | 24 +++++-- pallets/proposals/src/test_utils.rs | 3 +- .../proposals/src/tests/dispute_approvals.rs | 54 +++++++++++++++ pallets/proposals/src/tests/disputes.rs | 69 ++++++++++++++++++- pallets/proposals/src/tests/refunds.rs | 8 +++ 11 files changed, 171 insertions(+), 18 deletions(-) create mode 100644 pallets/proposals/src/tests/dispute_approvals.rs diff --git a/pallets/disputes/src/lib.rs b/pallets/disputes/src/lib.rs index 31e250ea..98e266d0 100644 --- a/pallets/disputes/src/lib.rs +++ b/pallets/disputes/src/lib.rs @@ -62,7 +62,7 @@ pub mod pallet { /// The origin used to force cancel and pass disputes. type ForceOrigin: EnsureOrigin; /// External hooks to handle the completion of a dispute. - type DisputeHooks: DisputeHooks; + type DisputeHooks: DisputeHooks>; } /// Used to store the disputes that is being raised, given the dispute key it returns the Dispute @@ -145,8 +145,12 @@ pub mod pallet { let hook_weight = >::on_dispute_complete( - *dispute_id, dispute.specifiers.into_inner(), result + dispute.raised_by, + *dispute_id, + dispute.specifiers.into_inner(), + result, ); weight = weight.saturating_add(hook_weight); @@ -216,6 +220,7 @@ pub mod pallet { // Dont mind if this fails as the autofinalise will skip. }); T::DisputeHooks::on_dispute_complete( + dispute.raised_by, dispute_key, dispute.specifiers.into_inner(), DisputeResult::Failure, @@ -248,6 +253,7 @@ pub mod pallet { // Dont mind if this fails as the autofinalise will skip. }); T::DisputeHooks::on_dispute_complete( + dispute.raised_by, dispute_key, dispute.specifiers.into_inner(), DisputeResult::Success, @@ -413,6 +419,7 @@ pub mod pallet { // Dont need to return the weight here. let _ = T::DisputeHooks::on_dispute_complete( + dispute.raised_by, dispute_key, dispute.specifiers.into_inner(), result, diff --git a/pallets/disputes/src/mock.rs b/pallets/disputes/src/mock.rs index 2651566a..af4ad327 100644 --- a/pallets/disputes/src/mock.rs +++ b/pallets/disputes/src/mock.rs @@ -118,8 +118,9 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { ext } -impl crate::traits::DisputeHooks for Test { +impl crate::traits::DisputeHooks for Test { fn on_dispute_complete( + _account_id: AccountId, _dispute_key: u32, _specifics: Vec, _dispute_result: crate::pallet::DisputeResult, diff --git a/pallets/disputes/src/traits.rs b/pallets/disputes/src/traits.rs index 1f033cf5..387e697b 100644 --- a/pallets/disputes/src/traits.rs +++ b/pallets/disputes/src/traits.rs @@ -18,10 +18,11 @@ pub trait DisputeRaiser { ) -> Result<(), DispatchError>; } -pub trait DisputeHooks { +pub trait DisputeHooks { /// On the completion of a dispute, this hooks is called. /// Returning only the key that has been handled and the result of the dispute. fn on_dispute_complete( + raised_by: AccountId, dispute_key: DisputeKey, specifics: Vec, dispute_result: crate::pallet::DisputeResult, diff --git a/pallets/grants/src/benchmarking.rs b/pallets/grants/src/benchmarking.rs index eafa9410..ce780d5e 100644 --- a/pallets/grants/src/benchmarking.rs +++ b/pallets/grants/src/benchmarking.rs @@ -5,7 +5,7 @@ use super::*; use crate::test_utils::gen_grant_id; use crate::Pallet as Grants; use crate::{BoundedApprovers, BoundedPMilestones, Config}; -use common_types::{CurrencyId, TreasuryOrigin, ForeignOwnedAccount}; +use common_types::{CurrencyId, ForeignOwnedAccount, TreasuryOrigin}; use frame_benchmarking::v2::*; use frame_support::{assert_ok, traits::Get}; use frame_system::pallet_prelude::BlockNumberFor; diff --git a/pallets/proposals/src/benchmarking.rs b/pallets/proposals/src/benchmarking.rs index be1f3a07..8005f347 100644 --- a/pallets/proposals/src/benchmarking.rs +++ b/pallets/proposals/src/benchmarking.rs @@ -220,7 +220,8 @@ mod benchmarks { project_key, milestone_keys.clone() )); - let _ = as DisputeHooks>::on_dispute_complete( + let _ = as DisputeHooks>>::on_dispute_complete( + bob.clone(), project_key, milestone_keys.into_inner(), DisputeResult::Success, diff --git a/pallets/proposals/src/impls/pallet_impls.rs b/pallets/proposals/src/impls/pallet_impls.rs index 6c126738..636212ce 100644 --- a/pallets/proposals/src/impls/pallet_impls.rs +++ b/pallets/proposals/src/impls/pallet_impls.rs @@ -337,8 +337,9 @@ impl Pallet { } } -impl DisputeHooks for Pallet { +impl DisputeHooks> for Pallet { fn on_dispute_complete( + raised_by: AccountIdOf, project_key: ProjectKey, specifics: Vec, dispute_result: pallet_disputes::pallet::DisputeResult, @@ -354,7 +355,11 @@ impl DisputeHooks for Pallet { // Shouldnt be needed but nice to have this check. // Will prevent someone calling both refund and withdraw on the same milestone. if milestone.transfer_status.is_none() { - milestone.can_refund = true; + if project.initiator == raised_by { + milestone.is_approved = true; + } else { + milestone.can_refund = true; + } } } } diff --git a/pallets/proposals/src/lib.rs b/pallets/proposals/src/lib.rs index ac350a70..31f5c666 100644 --- a/pallets/proposals/src/lib.rs +++ b/pallets/proposals/src/lib.rs @@ -344,14 +344,14 @@ pub mod pallet { TooManyMilestoneVotes, /// An internal error, a collection of votes for a milestone has been lost.s IndividualVoteNotFound, - /// Only a contributor can raise a dispute. - OnlyContributorsCanRaiseDispute, + /// Only a contributor can initiate a refund. + OnlyContributorsCanInitiateRefund, /// One of these milestones is already in a dispute. MilestonesAlreadyInDispute, /// You cannot raise a dispute on an approved milestone. CannotRaiseDisputeOnApprovedMilestone, - /// Only a contributor can initiate a refund. - OnlyContributorsCanInitiateRefund, + /// Only a contributor or initiator can initiate a refund. + NotPermittedToRaiseDispute, /// Only the ForeignAssetSigner can mint tokens RequireForeignAssetSigner, /// A Jury is required to create a project. @@ -456,9 +456,10 @@ pub mod pallet { Error::::MilestoneDoesNotExist ); ensure!( - project.contributions.contains_key(&who), - Error::::OnlyContributorsCanRaiseDispute + project.contributions.contains_key(&who) || &who == &project.initiator, + Error::::NotPermittedToRaiseDispute ); + ensure!( !ProjectsInDispute::::contains_key(project_key), Error::::MilestonesAlreadyInDispute @@ -472,7 +473,16 @@ pub mod pallet { if project.jury.len() == 1 { // https://github.com/ImbueNetwork/imbue/issues/270 - let _ = >::on_dispute_complete(project_key, milestone_keys.to_vec(), pallet_disputes::DisputeResult::Success); + let _ = , + >>::on_dispute_complete( + who, + project_key, + milestone_keys.to_vec(), + pallet_disputes::DisputeResult::Success, + ); } else { ::DisputeRaiser::raise_dispute( project_key, diff --git a/pallets/proposals/src/test_utils.rs b/pallets/proposals/src/test_utils.rs index 6803a5d9..f9995202 100644 --- a/pallets/proposals/src/test_utils.rs +++ b/pallets/proposals/src/test_utils.rs @@ -140,11 +140,12 @@ pub fn create_funded_user( /// Manually call the hook OnDisputeCompleteWith a predefined result for testing> pub fn complete_dispute( + dispute_raised_by: T::AccountId, project_key: ProjectKey, milestone_keys: Vec, result: pallet_disputes::DisputeResult, ) -> crate::Weight { - >::on_dispute_complete(project_key, milestone_keys, result) + >::on_dispute_complete(dispute_raised_by, project_key, milestone_keys, result) } pub fn assert_last_event(generic_event: ::RuntimeEvent) { diff --git a/pallets/proposals/src/tests/dispute_approvals.rs b/pallets/proposals/src/tests/dispute_approvals.rs new file mode 100644 index 00000000..87ef9c85 --- /dev/null +++ b/pallets/proposals/src/tests/dispute_approvals.rs @@ -0,0 +1,54 @@ +use crate::{mock::*, *}; +use frame_support::{assert_noop, assert_ok}; +use pallet_disputes::DisputeResult; +use test_utils::*; + +#[test] +fn initiator_dispute_complete_sets_milestones_to_approved() { + build_test_externality().execute_with(|| { + let per_contribution = 100000u128; + let contributions = get_contributions::(vec![BOB, CHARLIE], per_contribution); + let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + let initiator = ALICE; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones.clone(), + CurrencyId::Native, + jury, + ) + .unwrap(); + let milestone_keys: BoundedVec::MaxMilestonesPerProject> = (1u32 + ..milestones.len() as u32) + .collect::>() + .try_into() + .unwrap(); + + assert_ok!(Proposals::raise_dispute( + RuntimeOrigin::signed(initiator), + project_key, + milestone_keys.clone() + )); + + let _ = complete_dispute::( + initiator, + project_key, + milestone_keys.into_inner(), + DisputeResult::Success, + ); + + let project = Projects::::get(project_key).unwrap(); + + for milestone in project.milestones.iter().for_each(|(key, milestone)|{ + if milestone_keys.contains(&key) { + assert!(milestone.is_approved, "dispute success for initiator should approve milestones.") + } else { + assert!(!milestone.is_approved, "other milestones should be left unapproved.") + } + }) + }) +} + + diff --git a/pallets/proposals/src/tests/disputes.rs b/pallets/proposals/src/tests/disputes.rs index 87a76afe..1c34d360 100644 --- a/pallets/proposals/src/tests/disputes.rs +++ b/pallets/proposals/src/tests/disputes.rs @@ -5,7 +5,7 @@ use pallet_disputes::DisputeResult; use test_utils::*; #[test] -fn raise_dispute_not_contributor() { +fn raise_dispute_not_contributor_or_initiator() { build_test_externality().execute_with(|| { let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); let milestones = get_milestones(10); @@ -27,7 +27,7 @@ fn raise_dispute_not_contributor() { assert_noop!( Proposals::raise_dispute(RuntimeOrigin::signed(JOHN), project_key, milestone_keys), - Error::::OnlyContributorsCanRaiseDispute + Error::::NotPermittedToRaiseDispute ); }) } @@ -206,6 +206,7 @@ fn on_dispute_complete_success_removes_dispute_status() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -240,6 +241,7 @@ fn on_dispute_complete_failure_removes_dispute_status() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Failure, @@ -275,6 +277,7 @@ fn dispute_success_does_not_cancel_project() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -312,6 +315,7 @@ fn dispute_success_approves_milestone_for_refund_but_only_ones_specified() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -485,6 +489,7 @@ fn failed_dispute_tests() { dispute_milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, dispute_milestone_keys.into_inner(), DisputeResult::Failure, @@ -525,6 +530,7 @@ fn assert_can_recall_dispute_after_success() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -564,6 +570,7 @@ fn assert_can_recall_dispute_after_failure() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Failure, @@ -627,3 +634,61 @@ fn raise_dispute_with_single_jury_auto_completes() { }); }) } + +#[test] +fn raise_dispute_as_initiator_success() { + build_test_externality().execute_with(|| { + let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); + let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones.clone(), + CurrencyId::Native, + jury, + ) + .unwrap(); + + let dispute_milestone_keys: BoundedVec::MaxMilestonesPerProject> = + (0u32..milestones.len() as u32) + .collect::>() + .try_into() + .unwrap(); + assert_ok!(Proposals::raise_dispute( + RuntimeOrigin::signed(ALICE), + project_key, + dispute_milestone_keys + )); + }) +} + +#[test] +fn raise_dispute_as_contributor_success() { + build_test_externality().execute_with(|| { + let contributions = get_contributions::(vec![BOB, CHARLIE], 1_000_000u128); + let milestones = get_milestones(10); + let jury = vec![JURY_1, JURY_2]; + + let project_key = create_and_fund_project::( + ALICE, + contributions, + milestones.clone(), + CurrencyId::Native, + jury, + ) + .unwrap(); + + let dispute_milestone_keys: BoundedVec::MaxMilestonesPerProject> = + (0u32..milestones.len() as u32) + .collect::>() + .try_into() + .unwrap(); + assert_ok!(Proposals::raise_dispute( + RuntimeOrigin::signed(BOB), + project_key, + dispute_milestone_keys + )); + }) +} diff --git a/pallets/proposals/src/tests/refunds.rs b/pallets/proposals/src/tests/refunds.rs index bca95eec..8633aa7f 100644 --- a/pallets/proposals/src/tests/refunds.rs +++ b/pallets/proposals/src/tests/refunds.rs @@ -29,6 +29,7 @@ fn you_can_actually_refund_after_dispute_success() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -63,6 +64,7 @@ fn refund_assert_milestone_state_change() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -116,6 +118,7 @@ fn refund_not_contributor() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -153,6 +156,7 @@ fn refund_deletes_project_when_all_funds_are_refunded() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -198,6 +202,7 @@ fn withdraw_then_refund_no_double_spend() { milestone_keys.clone(), ); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -268,6 +273,7 @@ fn refund_then_withdraw_no_double_spend() { milestone_keys.clone(), ); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -322,6 +328,7 @@ fn refund_check_refund_amount() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, @@ -383,6 +390,7 @@ fn refund_takes_imbue_fee() { milestone_keys.clone() )); let _ = complete_dispute::( + BOB, project_key, milestone_keys.into_inner(), DisputeResult::Success, From 2717c2210f7e3cf9e27fb863f8c9b479ea4486ef Mon Sep 17 00:00:00 2001 From: Sam Elamin Date: Wed, 20 Dec 2023 10:19:31 +0000 Subject: [PATCH 3/5] add cardano currency (#299) --- libs/common-types/src/tokens.rs | 15 ++++++++++++--- pallets/briefs/src/lib.rs | 2 +- pallets/grants/src/lib.rs | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libs/common-types/src/tokens.rs b/libs/common-types/src/tokens.rs index d045a037..1dd71c2c 100644 --- a/libs/common-types/src/tokens.rs +++ b/libs/common-types/src/tokens.rs @@ -1,8 +1,10 @@ use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +use sp_std::vec::Vec; +use frame_support::traits::ConstU32; use serde::{Deserialize, Serialize}; - +use sp_runtime::BoundedVec; #[derive( Clone, Copy, @@ -49,11 +51,12 @@ pub enum CurrencyId { pub enum ForeignAssetId { ETH, USDT, + ADA, } #[derive( Clone, - Copy, + // Copy, PartialOrd, Ord, PartialEq, @@ -70,6 +73,7 @@ pub enum ForeignAssetId { pub enum ForeignOwnedAccount { TRON([u8; 22]), ETH([u8; 20]), + ADA(BoundedVec>), } impl ForeignOwnedAccount { @@ -85,12 +89,17 @@ impl ForeignOwnedAccount { CurrencyId::MGX => false, CurrencyId::ForeignAsset(asset) => match &self { ForeignOwnedAccount::TRON(_) => match asset { - ForeignAssetId::ETH => false, ForeignAssetId::USDT => true, + default => false, }, ForeignOwnedAccount::ETH(_) => match asset { ForeignAssetId::ETH => true, ForeignAssetId::USDT => true, + default => false, + }, + ForeignOwnedAccount::ADA(_) => match asset { + ForeignAssetId::ADA => true, + default => false, }, }, } diff --git a/pallets/briefs/src/lib.rs b/pallets/briefs/src/lib.rs index fe6892a8..e206b74e 100644 --- a/pallets/briefs/src/lib.rs +++ b/pallets/briefs/src/lib.rs @@ -200,7 +200,7 @@ pub mod pallet { Error::::EoaRequiredForForeignCurrencies ); } - if let Some(eoa) = external_owned_address { + if let Some(eoa) = external_owned_address.clone() { ensure!( eoa.ensure_supported_currency(currency_id), Error::::CurrencyAccountComboNotSupported diff --git a/pallets/grants/src/lib.rs b/pallets/grants/src/lib.rs index 54ee327b..33ed7d46 100644 --- a/pallets/grants/src/lib.rs +++ b/pallets/grants/src/lib.rs @@ -130,7 +130,7 @@ pub mod pallet { Error::::EoaRequiredForForeignCurrencies ); } - if let Some(eoa) = external_owned_address { + if let Some(eoa) = external_owned_address.clone() { ensure!( eoa.ensure_supported_currency(currency_id), Error::::CurrencyAccountComboNotSupported From a05018f3f6b05361340351f8ca7457662807167c Mon Sep 17 00:00:00 2001 From: gatsey <42411328+f-gate@users.noreply.github.com> Date: Wed, 20 Dec 2023 10:19:49 +0000 Subject: [PATCH 4/5] Improve fellowship error (#298) * change error * fmt --- pallets/briefs/src/lib.rs | 5 ++++- pallets/briefs/src/tests.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pallets/briefs/src/lib.rs b/pallets/briefs/src/lib.rs index e206b74e..9d2d30db 100644 --- a/pallets/briefs/src/lib.rs +++ b/pallets/briefs/src/lib.rs @@ -162,6 +162,8 @@ pub mod pallet { EoaRequiredForForeignCurrencies, /// Currency is not supported for this external address. CurrencyAccountComboNotSupported, + /// You must be a fellow to start this work. + FellowshipRequired, } #[pallet::call] @@ -186,7 +188,8 @@ pub mod pallet { let who = ensure_signed(origin)?; if require_fellowship { - T::EnsureRole::ensure_role(&applicant, pallet_fellowship::Role::Freelancer, None)?; + T::EnsureRole::ensure_role(&applicant, pallet_fellowship::Role::Freelancer, None) + .map_err(|_| Error::::FellowshipRequired)?; } ensure!( diff --git a/pallets/briefs/src/tests.rs b/pallets/briefs/src/tests.rs index 56320f59..dad8db2a 100644 --- a/pallets/briefs/src/tests.rs +++ b/pallets/briefs/src/tests.rs @@ -29,7 +29,7 @@ fn create_brief_not_approved_applicant() { None, true, ), - BadOrigin + Error::::FellowshipRequired ); }); } From e8f29e2b1748ce6fe380c51aaa5fbe17e8491916 Mon Sep 17 00:00:00 2001 From: gatsey <42411328+f-gate@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:59:06 +0000 Subject: [PATCH 5/5] Prepare staging for 1.01 (#300) * bump spec version * fix benchmarks * finally regen weights --- pallets/briefs/src/benchmarking.rs | 9 ++- pallets/briefs/src/weights.rs | 96 +++++++++++++------------ pallets/disputes/src/weights.rs | 76 ++++++++++---------- pallets/fellowship/src/weights.rs | 60 ++++++++-------- pallets/grants/src/weights.rs | 20 +++--- pallets/proposals/src/weights.rs | 108 ++++++++++++++--------------- runtime/imbue-kusama/src/lib.rs | 2 +- 7 files changed, 190 insertions(+), 181 deletions(-) diff --git a/pallets/briefs/src/benchmarking.rs b/pallets/briefs/src/benchmarking.rs index 88e83fa5..c5322649 100644 --- a/pallets/briefs/src/benchmarking.rs +++ b/pallets/briefs/src/benchmarking.rs @@ -24,7 +24,12 @@ mod benchmarks { fn create_brief() { let (eoa, currency_id) = ForeignOwnedAccount::get_supported_currency_eoa_combo(); let brief_owners = get_max_brief_owners::(currency_id); - let caller: T::AccountId = brief_owners[0].clone(); + let caller = create_account_id::("caller", 1, currency_id); + assert_ok!(T::RMultiCurrency::deposit( + CurrencyId::Native, + &caller, + 1_000_000_000_000_000u128.saturated_into() + )); let applicant = create_account_id::("applicant", 1, currency_id); let budget = 10_000u32.into(); let initial_contribution = 5_000u32.into(); @@ -182,7 +187,7 @@ fn get_brief_owners(mut n: u32, currency: CurrencyId) -> BoundedBrief } fn get_max_brief_owners(currency_id: CurrencyId) -> BoundedBriefOwners { - let max_brief_owners: u32 = ::MaxBriefOwners::get(); + let max_brief_owners: u32 = ::MaxBriefOwners::get() - 1; get_brief_owners::(max_brief_owners, currency_id) } diff --git a/pallets/briefs/src/weights.rs b/pallets/briefs/src/weights.rs index 0ef79cdc..03ebf07a 100644 --- a/pallets/briefs/src/weights.rs +++ b/pallets/briefs/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_briefs` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: -// ./target/debug/imbue +// ./target/release/imbue // benchmark // pallet // --chain=imbue-dev @@ -32,47 +32,49 @@ use crate::WeightInfoT; pub struct WeightInfo(PhantomData); impl WeightInfoT for WeightInfo { /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `Deposits::TicketId` (r:1 w:1) /// Proof: `Deposits::TicketId` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `OrmlTokens::Accounts` (r:1 w:1) + /// Proof: `OrmlTokens::Accounts` (`max_values`: None, `max_size`: Some(106), added: 2581, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) fn create_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `368` + // Measured: `1042` // Estimated: `6114` - // Minimum execution time: 1_508_486_000 picoseconds. - Weight::from_parts(1_537_968_000, 6114) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(6_u64)) + // Minimum execution time: 122_948_000 picoseconds. + Weight::from_parts(140_489_000, 6114) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:0) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) fn contribute_to_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2153` + // Measured: `2122` // Estimated: `6114` - // Minimum execution time: 874_794_000 picoseconds. - Weight::from_parts(883_738_000, 6114) + // Minimum execution time: 66_724_000 picoseconds. + Weight::from_parts(75_703_000, 6114) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:2) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:3 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueFellowship::Roles` (r:1 w:0) @@ -86,22 +88,22 @@ impl WeightInfoT for WeightInfo { /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:0 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) fn commence_work() -> Weight { // Proof Size summary in bytes: - // Measured: `2641` + // Measured: `2610` // Estimated: `8799` - // Minimum execution time: 3_922_748_000 picoseconds. - Weight::from_parts(4_133_787_000, 8799) + // Minimum execution time: 276_193_000 picoseconds. + Weight::from_parts(282_041_000, 8799) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) @@ -110,10 +112,10 @@ impl WeightInfoT for WeightInfo { /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn cancel_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2387` + // Measured: `2356` // Estimated: `6114` - // Minimum execution time: 1_621_533_000 picoseconds. - Weight::from_parts(1_637_811_000, 6114) + // Minimum execution time: 117_915_000 picoseconds. + Weight::from_parts(126_700_000, 6114) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -122,47 +124,49 @@ impl WeightInfoT for WeightInfo { // For backwards compatibility and tests. impl WeightInfoT for () { /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `Deposits::TicketId` (r:1 w:1) /// Proof: `Deposits::TicketId` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `OrmlTokens::Accounts` (r:1 w:1) + /// Proof: `OrmlTokens::Accounts` (`max_values`: None, `max_size`: Some(106), added: 2581, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) fn create_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `368` + // Measured: `1042` // Estimated: `6114` - // Minimum execution time: 1_508_486_000 picoseconds. - Weight::from_parts(1_537_968_000, 6114) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(6_u64)) + // Minimum execution time: 122_948_000 picoseconds. + Weight::from_parts(140_489_000, 6114) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(7_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:0) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) fn contribute_to_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2153` + // Measured: `2122` // Estimated: `6114` - // Minimum execution time: 874_794_000 picoseconds. - Weight::from_parts(883_738_000, 6114) + // Minimum execution time: 66_724_000 picoseconds. + Weight::from_parts(75_703_000, 6114) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) /// Proof: `ImbueBriefs::BriefContributions` (`max_values`: None, `max_size`: Some(2649), added: 5124, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:2) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:3 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueFellowship::Roles` (r:1 w:0) @@ -176,22 +180,22 @@ impl WeightInfoT for () { /// Storage: `ImbueBriefs::CounterForBriefs` (r:1 w:1) /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:0 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) fn commence_work() -> Weight { // Proof Size summary in bytes: - // Measured: `2641` + // Measured: `2610` // Estimated: `8799` - // Minimum execution time: 3_922_748_000 picoseconds. - Weight::from_parts(4_133_787_000, 8799) + // Minimum execution time: 276_193_000 picoseconds. + Weight::from_parts(282_041_000, 8799) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// Storage: `ImbueBriefs::Briefs` (r:1 w:1) - /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1725), added: 4200, mode: `MaxEncodedLen`) + /// Proof: `ImbueBriefs::Briefs` (`max_values`: None, `max_size`: Some(1830), added: 4305, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ImbueBriefs::BriefContributions` (r:1 w:1) @@ -200,10 +204,10 @@ impl WeightInfoT for () { /// Proof: `ImbueBriefs::CounterForBriefs` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn cancel_brief() -> Weight { // Proof Size summary in bytes: - // Measured: `2387` + // Measured: `2356` // Estimated: `6114` - // Minimum execution time: 1_621_533_000 picoseconds. - Weight::from_parts(1_637_811_000, 6114) + // Minimum execution time: 117_915_000 picoseconds. + Weight::from_parts(126_700_000, 6114) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/pallets/disputes/src/weights.rs b/pallets/disputes/src/weights.rs index 7f79632b..4c5d311d 100644 --- a/pallets/disputes/src/weights.rs +++ b/pallets/disputes/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_disputes` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: -// ./target/debug/imbue +// ./target/release/imbue // benchmark // pallet // --chain=imbue-dev @@ -39,8 +39,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `76` // Estimated: `10067` - // Minimum execution time: 340_503_000 picoseconds. - Weight::from_parts(358_302_000, 10067) + // Minimum execution time: 18_345_000 picoseconds. + Weight::from_parts(18_884_000, 10067) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -52,8 +52,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `250` // Estimated: `10067` - // Minimum execution time: 551_429_000 picoseconds. - Weight::from_parts(585_951_000, 10067) + // Minimum execution time: 34_536_000 picoseconds. + Weight::from_parts(37_078_000, 10067) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -62,15 +62,15 @@ impl WeightInfoT for WeightInfo { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn vote_on_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 801_226_000 picoseconds. - Weight::from_parts(966_473_000, 39815) + // Estimated: `39920` + // Minimum execution time: 60_453_000 picoseconds. + Weight::from_parts(66_243_000, 39920) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -79,15 +79,15 @@ impl WeightInfoT for WeightInfo { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn force_fail_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 551_249_000 picoseconds. - Weight::from_parts(557_828_000, 39815) + // Estimated: `39920` + // Minimum execution time: 42_624_000 picoseconds. + Weight::from_parts(48_443_000, 39920) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -96,15 +96,15 @@ impl WeightInfoT for WeightInfo { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn force_succeed_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 582_194_000 picoseconds. - Weight::from_parts(654_873_000, 39815) + // Estimated: `39920` + // Minimum execution time: 45_635_000 picoseconds. + Weight::from_parts(56_736_000, 39920) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -112,8 +112,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 26_642_000 picoseconds. - Weight::from_parts(28_049_000, 0) + // Minimum execution time: 4_166_000 picoseconds. + Weight::from_parts(4_806_000, 0) } } @@ -127,8 +127,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `10067` - // Minimum execution time: 340_503_000 picoseconds. - Weight::from_parts(358_302_000, 10067) + // Minimum execution time: 18_345_000 picoseconds. + Weight::from_parts(18_884_000, 10067) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -140,8 +140,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `250` // Estimated: `10067` - // Minimum execution time: 551_429_000 picoseconds. - Weight::from_parts(585_951_000, 10067) + // Minimum execution time: 34_536_000 picoseconds. + Weight::from_parts(37_078_000, 10067) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -150,15 +150,15 @@ impl WeightInfoT for () { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn vote_on_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 801_226_000 picoseconds. - Weight::from_parts(966_473_000, 39815) + // Estimated: `39920` + // Minimum execution time: 60_453_000 picoseconds. + Weight::from_parts(66_243_000, 39920) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -167,15 +167,15 @@ impl WeightInfoT for () { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn force_fail_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 551_249_000 picoseconds. - Weight::from_parts(557_828_000, 39815) + // Estimated: `39920` + // Minimum execution time: 42_624_000 picoseconds. + Weight::from_parts(48_443_000, 39920) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -184,15 +184,15 @@ impl WeightInfoT for () { /// Storage: `ImbueDisputes::DisputesFinaliseOn` (r:1 w:1) /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:0 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn force_succeed_dispute() -> Weight { // Proof Size summary in bytes: // Measured: `292` - // Estimated: `39815` - // Minimum execution time: 582_194_000 picoseconds. - Weight::from_parts(654_873_000, 39815) + // Estimated: `39920` + // Minimum execution time: 45_635_000 picoseconds. + Weight::from_parts(56_736_000, 39920) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -200,7 +200,7 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 26_642_000 picoseconds. - Weight::from_parts(28_049_000, 0) + // Minimum execution time: 4_166_000 picoseconds. + Weight::from_parts(4_806_000, 0) } } \ No newline at end of file diff --git a/pallets/fellowship/src/weights.rs b/pallets/fellowship/src/weights.rs index bf5ec959..35790ac8 100644 --- a/pallets/fellowship/src/weights.rs +++ b/pallets/fellowship/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_fellowship` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: -// ./target/debug/imbue +// ./target/release/imbue // benchmark // pallet // --chain=imbue-dev @@ -43,8 +43,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3593` - // Minimum execution time: 666_362_000 picoseconds. - Weight::from_parts(674_483_000, 3593) + // Minimum execution time: 39_145_000 picoseconds. + Weight::from_parts(46_416_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -54,8 +54,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3516` - // Minimum execution time: 343_825_000 picoseconds. - Weight::from_parts(346_698_000, 3516) + // Minimum execution time: 22_070_000 picoseconds. + Weight::from_parts(25_479_000, 3516) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -73,8 +73,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3593` - // Minimum execution time: 1_025_061_000 picoseconds. - Weight::from_parts(1_033_384_000, 3593) + // Minimum execution time: 63_837_000 picoseconds. + Weight::from_parts(67_482_000, 3593) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -92,8 +92,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `513` // Estimated: `6196` - // Minimum execution time: 1_991_447_000 picoseconds. - Weight::from_parts(2_236_308_000, 6196) + // Minimum execution time: 129_010_000 picoseconds. + Weight::from_parts(165_370_000, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -109,8 +109,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `289` // Estimated: `6886` - // Minimum execution time: 977_857_000 picoseconds. - Weight::from_parts(1_146_395_000, 6886) + // Minimum execution time: 38_347_000 picoseconds. + Weight::from_parts(39_290_000, 6886) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -124,8 +124,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `299` // Estimated: `6886` - // Minimum execution time: 463_826_000 picoseconds. - Weight::from_parts(467_466_000, 6886) + // Minimum execution time: 30_543_000 picoseconds. + Weight::from_parts(31_317_000, 6886) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -141,8 +141,8 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3593` - // Minimum execution time: 877_846_000 picoseconds. - Weight::from_parts(910_043_000, 3593) + // Minimum execution time: 58_983_000 picoseconds. + Weight::from_parts(65_555_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -162,8 +162,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3593` - // Minimum execution time: 666_362_000 picoseconds. - Weight::from_parts(674_483_000, 3593) + // Minimum execution time: 39_145_000 picoseconds. + Weight::from_parts(46_416_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -173,8 +173,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3516` - // Minimum execution time: 343_825_000 picoseconds. - Weight::from_parts(346_698_000, 3516) + // Minimum execution time: 22_070_000 picoseconds. + Weight::from_parts(25_479_000, 3516) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -192,8 +192,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3593` - // Minimum execution time: 1_025_061_000 picoseconds. - Weight::from_parts(1_033_384_000, 3593) + // Minimum execution time: 63_837_000 picoseconds. + Weight::from_parts(67_482_000, 3593) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -211,8 +211,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `513` // Estimated: `6196` - // Minimum execution time: 1_991_447_000 picoseconds. - Weight::from_parts(2_236_308_000, 6196) + // Minimum execution time: 129_010_000 picoseconds. + Weight::from_parts(165_370_000, 6196) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -228,8 +228,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `289` // Estimated: `6886` - // Minimum execution time: 977_857_000 picoseconds. - Weight::from_parts(1_146_395_000, 6886) + // Minimum execution time: 38_347_000 picoseconds. + Weight::from_parts(39_290_000, 6886) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -243,8 +243,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `299` // Estimated: `6886` - // Minimum execution time: 463_826_000 picoseconds. - Weight::from_parts(467_466_000, 6886) + // Minimum execution time: 30_543_000 picoseconds. + Weight::from_parts(31_317_000, 6886) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -260,8 +260,8 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3593` - // Minimum execution time: 877_846_000 picoseconds. - Weight::from_parts(910_043_000, 3593) + // Minimum execution time: 58_983_000 picoseconds. + Weight::from_parts(65_555_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/pallets/grants/src/weights.rs b/pallets/grants/src/weights.rs index b0d6f34e..8a7811b2 100644 --- a/pallets/grants/src/weights.rs +++ b/pallets/grants/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_grants` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: -// ./target/debug/imbue +// ./target/release/imbue // benchmark // pallet // --chain=imbue-dev @@ -40,19 +40,19 @@ impl WeightInfoT for WeightInfo { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `ImbueGrants::GrantsSubmittedBy` (r:0 w:1) /// Proof: `ImbueGrants::GrantsSubmittedBy` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:0 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) fn create_and_convert() -> Weight { // Proof Size summary in bytes: // Measured: `369` // Estimated: `3593` - // Minimum execution time: 3_125_367_000 picoseconds. - Weight::from_parts(3_986_489_000, 3593) + // Minimum execution time: 173_015_000 picoseconds. + Weight::from_parts(187_411_000, 3593) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -69,19 +69,19 @@ impl WeightInfoT for () { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:0 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `ImbueGrants::GrantsSubmittedBy` (r:0 w:1) /// Proof: `ImbueGrants::GrantsSubmittedBy` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Projects` (r:0 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:0 w:1) /// Proof: `ImbueProposals::IndividualVoteStore` (`max_values`: None, `max_size`: Some(16571), added: 19046, mode: `MaxEncodedLen`) fn create_and_convert() -> Weight { // Proof Size summary in bytes: // Measured: `369` // Estimated: `3593` - // Minimum execution time: 3_125_367_000 picoseconds. - Weight::from_parts(3_986_489_000, 3593) + // Minimum execution time: 173_015_000 picoseconds. + Weight::from_parts(187_411_000, 3593) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } diff --git a/pallets/proposals/src/weights.rs b/pallets/proposals/src/weights.rs index 16a6c301..ed533ee3 100644 --- a/pallets/proposals/src/weights.rs +++ b/pallets/proposals/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_proposals` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `user`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("imbue-dev")`, DB CACHE: `1024` // Executed Command: -// ./target/debug/imbue +// ./target/release/imbue // benchmark // pallet // --chain=imbue-dev @@ -32,7 +32,7 @@ use crate::WeightInfoT; pub struct WeightInfo(PhantomData); impl WeightInfoT for WeightInfo { /// Storage: `ImbueProposals::Projects` (r:1 w:0) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) @@ -45,15 +45,15 @@ impl WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn submit_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `888` - // Estimated: `39815` - // Minimum execution time: 802_182_000 picoseconds. - Weight::from_parts(1_244_732_000, 39815) + // Measured: `889` + // Estimated: `39920` + // Minimum execution time: 61_006_000 picoseconds. + Weight::from_parts(68_916_000, 39920) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Rounds` (r:1 w:1) /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) @@ -66,27 +66,27 @@ impl WeightInfoT for WeightInfo { /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn vote_on_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `1068` - // Estimated: `39815` - // Minimum execution time: 1_678_727_000 picoseconds. - Weight::from_parts(1_932_549_000, 39815) + // Measured: `1069` + // Estimated: `39920` + // Minimum execution time: 94_587_000 picoseconds. + Weight::from_parts(112_360_000, 39920) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:3 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::CompletedProjects` (r:1 w:1) /// Proof: `ImbueProposals::CompletedProjects` (`max_values`: None, `max_size`: Some(262184), added: 264659, mode: `MaxEncodedLen`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `1511` + // Measured: `1503` // Estimated: `265649` - // Minimum execution time: 3_646_250_000 picoseconds. - Weight::from_parts(5_622_221_000, 265649) + // Minimum execution time: 252_196_000 picoseconds. + Weight::from_parts(300_488_000, 265649) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -104,13 +104,13 @@ impl WeightInfoT for WeightInfo { // Proof Size summary in bytes: // Measured: `97` // Estimated: `20036` - // Minimum execution time: 354_713_000 picoseconds. - Weight::from_parts(361_079_000, 20036) + // Minimum execution time: 20_005_000 picoseconds. + Weight::from_parts(22_550_000, 20036) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:0) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:1 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) @@ -119,23 +119,23 @@ impl WeightInfoT for WeightInfo { /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) fn raise_dispute() -> Weight { // Proof Size summary in bytes: - // Measured: `5117` - // Estimated: `39815` - // Minimum execution time: 764_754_000 picoseconds. - Weight::from_parts(995_634_000, 39815) + // Measured: `5118` + // Estimated: `39920` + // Minimum execution time: 83_336_000 picoseconds. + Weight::from_parts(85_489_000, 39920) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:52 w:52) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `12010` + // Measured: `12011` // Estimated: `136346` - // Minimum execution time: 50_985_697_000 picoseconds. - Weight::from_parts(51_360_296_000, 136346) + // Minimum execution time: 3_089_534_000 picoseconds. + Weight::from_parts(3_135_786_000, 136346) .saturating_add(T::DbWeight::get().reads(53_u64)) .saturating_add(T::DbWeight::get().writes(53_u64)) } @@ -144,7 +144,7 @@ impl WeightInfoT for WeightInfo { // For backwards compatibility and tests. impl WeightInfoT for () { /// Storage: `ImbueProposals::Projects` (r:1 w:0) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::RoundsExpiring` (r:1 w:1) /// Proof: `ImbueProposals::RoundsExpiring` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) @@ -157,15 +157,15 @@ impl WeightInfoT for () { /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn submit_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `888` - // Estimated: `39815` - // Minimum execution time: 802_182_000 picoseconds. - Weight::from_parts(1_244_732_000, 39815) + // Measured: `889` + // Estimated: `39920` + // Minimum execution time: 61_006_000 picoseconds. + Weight::from_parts(68_916_000, 39920) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::Rounds` (r:1 w:1) /// Proof: `ImbueProposals::Rounds` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::IndividualVoteStore` (r:1 w:1) @@ -178,27 +178,27 @@ impl WeightInfoT for () { /// Proof: `ImbueProposals::ProjectInVoting` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) fn vote_on_milestone() -> Weight { // Proof Size summary in bytes: - // Measured: `1068` - // Estimated: `39815` - // Minimum execution time: 1_678_727_000 picoseconds. - Weight::from_parts(1_932_549_000, 39815) + // Measured: `1069` + // Estimated: `39920` + // Minimum execution time: 94_587_000 picoseconds. + Weight::from_parts(112_360_000, 39920) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:3 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `Deposits::CurrentDeposits` (r:1 w:1) - /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Proof: `Deposits::CurrentDeposits` (`max_values`: None, `max_size`: Some(66), added: 2541, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::CompletedProjects` (r:1 w:1) /// Proof: `ImbueProposals::CompletedProjects` (`max_values`: None, `max_size`: Some(262184), added: 264659, mode: `MaxEncodedLen`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `1511` + // Measured: `1503` // Estimated: `265649` - // Minimum execution time: 3_646_250_000 picoseconds. - Weight::from_parts(5_622_221_000, 265649) + // Minimum execution time: 252_196_000 picoseconds. + Weight::from_parts(300_488_000, 265649) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -216,13 +216,13 @@ impl WeightInfoT for () { // Proof Size summary in bytes: // Measured: `97` // Estimated: `20036` - // Minimum execution time: 354_713_000 picoseconds. - Weight::from_parts(361_079_000, 20036) + // Minimum execution time: 20_005_000 picoseconds. + Weight::from_parts(22_550_000, 20036) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:0) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `ImbueProposals::ProjectsInDispute` (r:1 w:1) /// Proof: `ImbueProposals::ProjectsInDispute` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Storage: `ImbueDisputes::Disputes` (r:1 w:1) @@ -231,23 +231,23 @@ impl WeightInfoT for () { /// Proof: `ImbueDisputes::DisputesFinaliseOn` (`max_values`: None, `max_size`: Some(221), added: 2696, mode: `MaxEncodedLen`) fn raise_dispute() -> Weight { // Proof Size summary in bytes: - // Measured: `5117` - // Estimated: `39815` - // Minimum execution time: 764_754_000 picoseconds. - Weight::from_parts(995_634_000, 39815) + // Measured: `5118` + // Estimated: `39920` + // Minimum execution time: 83_336_000 picoseconds. + Weight::from_parts(85_489_000, 39920) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `ImbueProposals::Projects` (r:1 w:1) - /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36350), added: 38825, mode: `MaxEncodedLen`) + /// Proof: `ImbueProposals::Projects` (`max_values`: None, `max_size`: Some(36455), added: 38930, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:52 w:52) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `12010` + // Measured: `12011` // Estimated: `136346` - // Minimum execution time: 50_985_697_000 picoseconds. - Weight::from_parts(51_360_296_000, 136346) + // Minimum execution time: 3_089_534_000 picoseconds. + Weight::from_parts(3_135_786_000, 136346) .saturating_add(RocksDbWeight::get().reads(53_u64)) .saturating_add(RocksDbWeight::get().writes(53_u64)) } diff --git a/runtime/imbue-kusama/src/lib.rs b/runtime/imbue-kusama/src/lib.rs index 99c35102..b2ef4b33 100644 --- a/runtime/imbue-kusama/src/lib.rs +++ b/runtime/imbue-kusama/src/lib.rs @@ -101,7 +101,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("imbue"), impl_name: create_runtime_str!("imbue"), authoring_version: 2, - spec_version: 1_100_002, + spec_version: 1_100_003, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 2,