From a3e476df73645c5a855794ad6fc2bfe801d4b487 Mon Sep 17 00:00:00 2001 From: Oleg Kalenik Date: Fri, 1 Sep 2023 14:18:15 +0300 Subject: [PATCH 1/2] *addressing sbm m2 review requests --- pallets/dao-collective/src/benchmarking.rs | 48 ++++-------- pallets/dao-democracy/src/benchmarking.rs | 12 +-- .../dao-eth-governance/src/benchmarking.rs | 17 +---- .../dao-nft-governance/src/benchmarking.rs | 17 +---- pallets/dao-nft-governance/src/mock.rs | 12 --- pallets/dao-subscription/src/benchmarking.rs | 1 + pallets/dao-subscription/src/lib.rs | 8 +- pallets/dao/src/benchmarking.rs | 47 ++++++------ pallets/dao/src/tests.rs | 74 +++++++------------ primitives/dao/src/lib.rs | 74 ++++++++++++++++++- runtime/src/xcm_config.rs | 54 +------------- 11 files changed, 155 insertions(+), 209 deletions(-) diff --git a/pallets/dao-collective/src/benchmarking.rs b/pallets/dao-collective/src/benchmarking.rs index e5f8f2c..ef4c296 100644 --- a/pallets/dao-collective/src/benchmarking.rs +++ b/pallets/dao-collective/src/benchmarking.rs @@ -103,7 +103,8 @@ benchmarks_instance_pallet! { // Add previous proposals. for i in 0 .. p - 1 { // Proposals should be different so that different proposal hashes are generated - let proposal: T::Proposal = SystemCall::::remark { remark: vec![i as u8; b as usize] }.into(); + let proposal: T::Proposal = + SystemCall::::remark { remark: vec![i as u8; b as usize] }.into(); Collective::::propose( SystemOrigin::Signed(caller.clone()).into(), 0, @@ -114,19 +115,11 @@ benchmarks_instance_pallet! { assert_eq!(Collective::::proposals(0).len(), (p - 1) as usize); - let proposal: T::Proposal = SystemCall::::remark { remark: vec![p as u8; b as usize] }.into(); + let proposal: T::Proposal = + SystemCall::::remark { remark: vec![p as u8; b as usize] }.into(); let bounded = T::Preimages::bound(proposal.clone())?.transmute(); let proposal_hash = T::Hashing::hash_of(&bounded); - - let meta: Option> = Some("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit".into()); + let meta = Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]); }: _( SystemOrigin::Signed(caller.clone()), 0, @@ -152,11 +145,10 @@ benchmarks_instance_pallet! { } vote { + let b in 1 .. MAX_BYTES; // We choose 5 as a minimum so we always trigger a vote in the voting loop (`for j in ...`) let m in 5 .. T::MaxMembers::get(); - let p = T::MaxProposals::get(); - let b = MAX_BYTES; let bytes_in_storage = b + size_of::() as u32; create_dao::()?; @@ -230,24 +222,23 @@ benchmarks_instance_pallet! { } close_early_disapproved { + let b in 1 .. MAX_BYTES; // We choose 4 as a minimum so we always trigger a vote in the voting loop (`for j in ...`) let m in 4 .. T::MaxMembers::get(); let p in 1 .. T::MaxProposals::get(); - - let bytes = 100; - let bytes_in_storage = bytes + size_of::() as u32; + let bytes_in_storage = b + size_of::() as u32; create_dao::()?; // Construct `members`. let mut members = vec![]; - let proposer = account::("proposer", 0, SEED); + let proposer: T::AccountId = account::("proposer", 0, SEED); members.push(proposer.clone()); for i in 1 .. m - 1 { let member = account::("member", i, SEED); members.push(member); } - let voter = account::("voter", 0, SEED); + let voter: T::AccountId = account::("voter", 0, SEED); members.push(voter.clone()); Collective::::initialize_members(0, members.clone())?; @@ -255,10 +246,8 @@ benchmarks_instance_pallet! { let mut last_hash = T::Hash::default(); for i in 0 .. p { // Proposals should be different so that different proposal hashes are generated - let proposal: T::Proposal = SystemCall::::remark { - - remark: vec![i as u8; bytes as usize] - }.into(); + let proposal: T::Proposal = + SystemCall::::remark { remark: vec![i as u8; b as usize] }.into(); Collective::::propose( SystemOrigin::Signed(proposer.clone()).into(), 0, @@ -315,7 +304,6 @@ benchmarks_instance_pallet! { // We choose 4 as a minimum so we always trigger a vote in the voting loop (`for j in ...`) let m in 4 .. T::MaxMembers::get(); let p in 1 .. T::MaxProposals::get(); - let bytes_in_storage = b + size_of::() as u32; create_dao::()?; @@ -412,12 +400,11 @@ benchmarks_instance_pallet! { // TODO: get back to it in case if prime member returned back close_disapproved { + let b in 1 .. MAX_BYTES; // We choose 4 as a minimum so we always trigger a vote in the voting loop (`for j in ...`) let m in 4 .. T::MaxMembers::get(); let p in 1 .. T::MaxProposals::get(); - - let bytes = 100; - let bytes_in_storage = bytes + size_of::() as u32; + let bytes_in_storage = b + size_of::() as u32; create_dao::()?; @@ -438,10 +425,8 @@ benchmarks_instance_pallet! { let mut last_hash = T::Hash::default(); for i in 0 .. p { // Proposals should be different so that different proposal hashes are generated - let proposal: T::Proposal = SystemCall::::remark { - - remark: vec![i as u8; bytes as usize] - }.into(); + let proposal: T::Proposal = + SystemCall::::remark { remark: vec![i as u8; b as usize] }.into(); Collective::::propose( SystemOrigin::Signed(caller.clone()).into(), 0, @@ -500,7 +485,6 @@ benchmarks_instance_pallet! { // We choose 4 as a minimum so we always trigger a vote in the voting loop (`for j in ...`) let m in 4 .. T::MaxMembers::get(); let p in 1 .. T::MaxProposals::get(); - let bytes_in_storage = b + size_of::() as u32; create_dao::()?; diff --git a/pallets/dao-democracy/src/benchmarking.rs b/pallets/dao-democracy/src/benchmarking.rs index 126792f..2962d67 100644 --- a/pallets/dao-democracy/src/benchmarking.rs +++ b/pallets/dao-democracy/src/benchmarking.rs @@ -153,17 +153,7 @@ benchmarks! { let value = 10_u32.into(); whitelist_account!(caller); - let meta: Option> = Some( - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit".into() - ); + let meta = Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]); }: _(RawOrigin::Signed(caller), 0, proposal, value, meta) verify { assert_eq!(Democracy::::public_props(0).len(), p as usize, "Proposals not created."); diff --git a/pallets/dao-eth-governance/src/benchmarking.rs b/pallets/dao-eth-governance/src/benchmarking.rs index e3b9fe9..e1a787d 100644 --- a/pallets/dao-eth-governance/src/benchmarking.rs +++ b/pallets/dao-eth-governance/src/benchmarking.rs @@ -29,19 +29,6 @@ fn setup_dao_payload() -> Vec { serde_json::to_vec(&dao_json).ok().unwrap() } -fn get_proposal_metadata() -> Vec { - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit" - .into() -} - fn create_dao() -> Result { let caller: T::AccountId = account("caller", 0, SEED); @@ -93,7 +80,7 @@ fn add_proposal( Box::new(proposal.clone()), proposal_len, other_eth.into(), - Some(get_proposal_metadata()), + Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]), )?; Ok(( proposal.clone(), @@ -136,7 +123,7 @@ benchmarks! { let proposal = make_proposal::(0); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); - let meta: Option> = Some(get_proposal_metadata()); + let meta = Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]); }: _(RawOrigin::Signed(caller), 0, Box::new(proposal), proposal_len, caller_eth.into(), meta) verify { assert_eq!(PendingProposals::::get(0).len(), usize::try_from(T::MaxProposals::get()).unwrap()); diff --git a/pallets/dao-nft-governance/src/benchmarking.rs b/pallets/dao-nft-governance/src/benchmarking.rs index 3d9b6da..ef4d508 100644 --- a/pallets/dao-nft-governance/src/benchmarking.rs +++ b/pallets/dao-nft-governance/src/benchmarking.rs @@ -33,19 +33,6 @@ fn setup_dao_payload() -> Vec { serde_json::to_vec(&dao_json).ok().unwrap() } -fn get_proposal_metadata() -> Vec { - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit" - .into() -} - fn create_dao() -> Result { let caller: T::AccountId = account("caller", 0, SEED); @@ -79,7 +66,7 @@ fn add_proposal( RawOrigin::Signed(other).into(), 0, Box::new(proposal.clone()), - Some(get_proposal_metadata()), + Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]), )?; Ok(( proposal.clone(), @@ -103,7 +90,7 @@ benchmarks! { let proposal = make_proposal::(0); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); - let meta: Option> = Some(get_proposal_metadata()); + let meta = Some(vec![97_u8; T::ProposalMetadataLimit::get() as usize]); }: _(RawOrigin::Signed(caller), 0, Box::new(proposal), meta) verify { } diff --git a/pallets/dao-nft-governance/src/mock.rs b/pallets/dao-nft-governance/src/mock.rs index d95ece3..30016eb 100644 --- a/pallets/dao-nft-governance/src/mock.rs +++ b/pallets/dao-nft-governance/src/mock.rs @@ -249,10 +249,6 @@ impl DaoProvider for TestDaoProvider { type ApproveOrigin = AsEnsureOriginWithArg>; type NFTCollectionId = u32; - fn exists(_id: Self::Id) -> Result<(), DispatchError> { - Ok(()) - } - fn dao_account_id(id: Self::Id) -> AccountId { PalletId(*b"py/sctld").into_sub_account_truncating(id) } @@ -278,14 +274,6 @@ impl DaoProvider for TestDaoProvider { Ok(Some(0)) } - fn count() -> u32 { - 1 - } - - fn ensure_member(_id: Self::Id, _who: &AccountId) -> Result { - Ok(true) - } - fn ensure_approved( origin: Self::Origin, dao_id: Self::Id, diff --git a/pallets/dao-subscription/src/benchmarking.rs b/pallets/dao-subscription/src/benchmarking.rs index ace1cc5..c541fc9 100644 --- a/pallets/dao-subscription/src/benchmarking.rs +++ b/pallets/dao-subscription/src/benchmarking.rs @@ -18,6 +18,7 @@ fn setup_subscription() -> Result<(), DispatchError> { benchmarks! { + // TODO: use max length for the tier set_subscription_tier { let (tier, details) = Subscription::::get_default_tier_details(); }: _(RawOrigin::Root, tier.clone(), details.clone()) diff --git a/pallets/dao-subscription/src/lib.rs b/pallets/dao-subscription/src/lib.rs index e7b7fc0..0652264 100644 --- a/pallets/dao-subscription/src/lib.rs +++ b/pallets/dao-subscription/src/lib.rs @@ -7,7 +7,7 @@ use frame_support::{ }; pub use pallet::*; use scale_info::prelude::*; -use sp_runtime::Saturating; +use sp_runtime::{traits::One, Saturating}; use sp_std::str; use dao_primitives::*; @@ -191,7 +191,7 @@ pub mod pallet { tier: VersionedDaoSubscriptionTier, details: SubscriptionDetailsOf, ) -> DispatchResult { - ensure_root(origin.clone())?; + ensure_root(origin)?; Self::do_set_subscription_tier(tier, details) } @@ -203,7 +203,7 @@ pub mod pallet { dao_id: DaoId, reason: SuspensionReason, ) -> DispatchResult { - ensure_root(origin.clone())?; + ensure_root(origin)?; Subscriptions::::try_mutate( dao_id, @@ -296,7 +296,7 @@ pub mod pallet { extra_check(subscription)?; subscription.fn_balance = fn_balance - .checked_sub(1) + .checked_sub(One::one()) .ok_or(Error::::FunctionBalanceLow)?; let (block_number, fn_calls) = subscription.fn_per_block; diff --git a/pallets/dao/src/benchmarking.rs b/pallets/dao/src/benchmarking.rs index 5d80fbb..10286f8 100644 --- a/pallets/dao/src/benchmarking.rs +++ b/pallets/dao/src/benchmarking.rs @@ -11,6 +11,7 @@ use sp_runtime::traits::Bounded; use crate::Pallet as DaoFactory; use serde_json::{json, Value}; +use crate::string::String; use codec::alloc::string::ToString; const SEED: u32 = 0; @@ -21,16 +22,10 @@ const TECH_COMMITTEE_SEED: u32 = 2; fn setup_dao_payload(is_eth: bool, tier: Option) -> Vec { let mut dao_json = json!({ "name": "name", - "purpose": "purpose", - "metadata": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum do", + "purpose": Value::String( + String::from_utf8(vec![97_u8; T::DaoStringLimit::get() as usize]).expect("invalid utf8")), + "metadata": Value::String( + String::from_utf8(vec![97_u8; T::DaoMetadataLimit::get() as usize]).expect("invalid utf8")), "policy": { "proposal_period": 300000, "governance": { @@ -145,20 +140,12 @@ benchmarks! { update_dao_metadata { setup_dao::(false, None)?; - let new_metadata = "Lorem Lorem dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum do"; + let new_metadata = vec![1; T::DaoMetadataLimit::get() as usize]; let origin = get_dao_origin::(0)?; - }: _(origin, 0, new_metadata.as_bytes().to_vec()) + }: _(origin, 0, new_metadata.clone()) verify { let DaoConfig { metadata, .. } = Daos::::get(0).unwrap().config; - assert_eq!(metadata.to_vec(), new_metadata.as_bytes().to_vec()); + assert_eq!(metadata.to_vec(), new_metadata); } update_dao_policy { @@ -212,7 +199,23 @@ benchmarks! { setup_dao::(false, None)?; let origin = get_dao_origin::(0)?; }: _(origin, 0) - verify { } + verify { + // assert_last_event::( + // Event::DaoRegistered { + // dao_id: DaoId, + // founder: T::AccountId, + // account_id: T::AccountId, + // council: BoundedVec, + // technical_committee: BoundedVec, + // token: DaoToken>, + // config: DaoConfig< + // BoundedVec, + // BoundedVec, + // BoundedVec, + // >, + // policy: DaoPolicy, + // }.into()); + } launch_dao_referendum { setup_dao::(false, None)?; diff --git a/pallets/dao/src/tests.rs b/pallets/dao/src/tests.rs index de2b020..d4b05cb 100644 --- a/pallets/dao/src/tests.rs +++ b/pallets/dao/src/tests.rs @@ -8,11 +8,13 @@ use frame_support::{ assert_noop, assert_ok, traits::tokens::fungibles::{metadata::Inspect as MetadataInspect, Inspect}, }; +use log::info; use pallet_balances::Error as BalancesError; use pallet_dao_democracy::Error as DemocracyError; use pallet_dao_subscription::Error as SubscriptionError; use serde_json::{json, Value}; -use sp_core::{crypto::Ss58Codec, sr25519::Public}; +use sp_core::{crypto::Ss58Codec, sr25519::Public, TypedGet}; +use sp_runtime::traits::One; use super::*; @@ -54,8 +56,12 @@ fn create_dao_fails_on_string_limits() { ); dao_json = get_dao_json(); - let new_purpose = "very long purpose above the limits very long purpose above the \ - limits very long purpose above the limits"; + let new_purpose = String::from_utf8(vec![ + 97_u8; + <::DaoStringLimit as TypedGet>::get().saturating_add(One::one()) + as usize + ]) + .expect("invalid utf8"); dao_json["purpose"] = Value::String(new_purpose.to_string()); assert_noop!( DaoFactory::create_dao( @@ -68,16 +74,15 @@ fn create_dao_fails_on_string_limits() { ); dao_json = get_dao_json(); - let new_metadata = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."; - dao_json["metadata"] = Value::String(new_metadata.to_string()); + let new_metadata = vec![ + 98_u8; + <::DaoMetadataLimit as TypedGet>::get().saturating_add(One::one()) + as usize + ]; + info!("{:?}", new_metadata.clone()); + dao_json["metadata"] = + Value::String(String::from_utf8(new_metadata.clone()).expect("invalid utf8")); + info!("{:?}", Value::String(String::from_utf8(new_metadata).expect("invalid utf8"))); assert_noop!( DaoFactory::create_dao( RuntimeOrigin::signed(account.clone()), @@ -325,25 +330,14 @@ fn update_dao_metadata_too_long() { new_test_ext().execute_with(|| { create_dao(); - let new_metadata = - "Lorem Lorem dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum \ - do voluptate velit esse cillum do voluptate velit esse cillum do voluptate velit \ - esse cillum dovoluptate velit esse cillum do"; + let new_metadata = vec![ + 0; + <::DaoMetadataLimit as TypedGet>::get().saturating_add(One::one()) + as usize + ]; assert_noop!( - DaoFactory::update_dao_metadata( - RuntimeOrigin::root(), - 0, - new_metadata.as_bytes().to_vec() - ), + DaoFactory::update_dao_metadata(RuntimeOrigin::root(), 0, new_metadata), Error::::MetadataTooLong ); }) @@ -355,24 +349,12 @@ fn update_dao_metadata_works() { create_dao(); let new_metadata = - "Lorem Lorem dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ - mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ - sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum do"; - - assert_ok!(DaoFactory::update_dao_metadata( - RuntimeOrigin::root(), - 0, - new_metadata.as_bytes().to_vec() - )); + vec![1; <::DaoMetadataLimit as TypedGet>::get() as usize]; + + assert_ok!(DaoFactory::update_dao_metadata(RuntimeOrigin::root(), 0, new_metadata.clone())); let DaoConfig { metadata, .. } = DaoFactory::daos(0).unwrap().config; - assert_eq!(metadata.to_vec(), new_metadata.as_bytes().to_vec()); + assert_eq!(metadata.to_vec(), new_metadata); }) } diff --git a/primitives/dao/src/lib.rs b/primitives/dao/src/lib.rs index ed15645..e57f36e 100644 --- a/primitives/dao/src/lib.rs +++ b/primitives/dao/src/lib.rs @@ -9,7 +9,7 @@ use frame_support::{ weights::Weight, BoundedVec, }; -pub use node_primitives::Balance; +pub use node_primitives::{Balance, BlockNumber}; use scale_info::TypeInfo; use serde::{self, Deserialize, Deserializer, Serialize}; @@ -18,6 +18,9 @@ use sp_std::prelude::*; pub type DispatchResultWithDaoOrigin = Result, DispatchError>; +pub type AssetId = u128; +pub type TokenBalancesLimit = u32; + // TODO: retrieve from runtime pub const EXPECTED_BLOCK_TIME: u32 = 12; // in seconds @@ -849,6 +852,75 @@ pub struct DaoSubscriptionDetails { pub pallet_details: DaoPalletSubscriptionDetails, } +impl Default + for DaoSubscriptionDetails< + BlockNumber, + Balance, + TokenBalances, + > +{ + fn default() -> Self { + DaoSubscriptionDetails { + duration: MONTH_IN_BLOCKS.into(), + price: DEFAULT_SUBSCRIPTION_PRICE, + token_prices: BoundedVec::<(AssetId, Balance), TokenBalancesLimit>::default(), + fn_call_limit: DEFAULT_FUNCTION_CALL_LIMIT, + fn_per_block_limit: DEFAULT_FUNCTION_PER_BLOCK_LIMIT, + max_members: DEFAULT_MEMBER_COUNT_LIMIT, + pallet_details: DaoPalletSubscriptionDetails { + dao: Some(DaoPalletSubscriptionDetailsV1 { + update_dao_metadata: true, + update_dao_policy: true, + mint_dao_token: true, + }), + bounties: Some(BountiesSubscriptionDetailsV1 { + create_bounty: true, + propose_curator: true, + unassign_curator: true, + accept_curator: true, + award_bounty: true, + claim_bounty: true, + close_bounty: true, + extend_bounty_expiry: true, + }), + council: Some(CollectiveSubscriptionDetailsV1 { + propose: true, + vote: true, + close: true, + }), + council_membership: Some(MembershipSubscriptionDetailsV1 { + add_member: true, + remove_member: true, + swap_member: true, + change_key: true, + }), + tech_committee: Some(CollectiveSubscriptionDetailsV1 { + propose: false, + vote: false, + close: false, + }), + tech_committee_membership: Some(MembershipSubscriptionDetailsV1 { + add_member: true, + remove_member: true, + swap_member: true, + change_key: false, + }), + democracy: Some(DemocracySubscriptionDetailsV1 { + propose: false, + second: false, + vote: false, + delegate: false, + undelegate: false, + unlock: false, + remove_vote: false, + remove_other_vote: false, + }), + treasury: Some(TreasurySubscriptionDetailsV1 { spend: true, transfer_token: true }), + }, + } + } +} + #[derive( Encode, Decode, Clone, PartialEq, TypeInfo, RuntimeDebug, MaxEncodedLen, Serialize, Deserialize, )] diff --git a/runtime/src/xcm_config.rs b/runtime/src/xcm_config.rs index 82aaa90..b6500b9 100644 --- a/runtime/src/xcm_config.rs +++ b/runtime/src/xcm_config.rs @@ -14,9 +14,9 @@ use super::{CheckInherents, Executive}; use crate::{Assets, SocietalAssetLocationIdConverter, TreasuryAccountId, XcAssetRegistry}; use astar_primitives::xcm::{FixedRateOfForeignAsset, ReserveAssetFilter, XcmFungibleFeeHandler}; -use core::{marker::PhantomData, ops::ControlFlow}; +use core::marker::PhantomData; use frame_support::{ - log, match_types, parameter_types, + match_types, parameter_types, traits::{ConstU32, Everything, LockIdentifier, Nothing}, weights::Weight, PalletId, @@ -24,10 +24,7 @@ use frame_support::{ use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - CreateMatcher, MatchXcm, -}; +use xcm::latest::{prelude::*, Weight as XCMWeight}; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, @@ -154,54 +151,9 @@ where } } -// See issue #5233 -pub struct DenyReserveTransferToRelayChain; -impl ShouldExecute for DenyReserveTransferToRelayChain { - fn should_execute( - origin: &MultiLocation, - message: &mut [Instruction], - _max_weight: XCMWeight, - _weight_credit: &mut XCMWeight, - ) -> Result<(), ()> { - message.matcher().match_next_inst_while( - |_| true, - |inst| match inst { - InitiateReserveWithdraw { - reserve: MultiLocation { parents: 1, interior: Here }, - .. - } | - DepositReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } | - TransferReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } => { - Err(()) // Deny - }, - // An unexpected reserve transfer has arrived from the Relay Chain. Generally, - // `IsReserve` should not allow this, but we just log it here. - ReserveAssetDeposited { .. } - if matches!(origin, MultiLocation { parents: 1, interior: Here }) => - { - log::warn!( - target: "xcm::barrier", - "Unexpected ReserveAssetDeposited from the Relay Chain", - ); - Ok(ControlFlow::Continue(())) - }, - _ => Ok(ControlFlow::Continue(())), - }, - )?; - - // Permit everything else - Ok(()) - } -} - type Barrier = ( TakeWeightCredit, AllowTopLevelPaidExecutionFrom, - AllowTopLevelPaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, ); From 93a45c9dec88a9a11c8c86440de27eeb23a61b5e Mon Sep 17 00:00:00 2001 From: Oleg Kalenik Date: Wed, 6 Sep 2023 09:07:39 +0300 Subject: [PATCH 2/2] *updated weights --- pallets/dao-eth-governance/src/weights.rs | 48 ++++++------- pallets/dao-subscription/src/lib.rs | 2 +- pallets/dao-subscription/src/weights.rs | 38 +++++----- pallets/dao/src/weights.rs | 88 +++++++++++------------ 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/pallets/dao-eth-governance/src/weights.rs b/pallets/dao-eth-governance/src/weights.rs index b2c9107..03ec2b7 100644 --- a/pallets/dao-eth-governance/src/weights.rs +++ b/pallets/dao-eth-governance/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_dao_eth_governance //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `macbook-pro.lan`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -58,10 +58,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoEthGovernance PendingProposalOf (max_values: None, max_size: Some(967), added: 3442, mode: MaxEncodedLen) fn propose_with_meta() -> Weight { // Proof Size summary in bytes: - // Measured: `1968` + // Measured: `2021` // Estimated: `9606` - // Minimum execution time: 34_000_000 picoseconds. - Weight::from_parts(37_000_000, 9606) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(32_000_000, 9606) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -85,10 +85,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoEthGovernance Voting (max_values: None, max_size: Some(4974), added: 7449, mode: MaxEncodedLen) fn approve_propose() -> Weight { // Proof Size summary in bytes: - // Measured: `4127` + // Measured: `4214` // Estimated: `71275` - // Minimum execution time: 63_000_000 picoseconds. - Weight::from_parts(72_000_000, 71275) + // Minimum execution time: 62_000_000 picoseconds. + Weight::from_parts(64_000_000, 71275) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -102,7 +102,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoEthGovernance PendingVoting (max_values: None, max_size: Some(133), added: 2608, mode: MaxEncodedLen) fn vote() -> Weight { // Proof Size summary in bytes: - // Measured: `591` + // Measured: `644` // Estimated: `18049` // Minimum execution time: 26_000_000 picoseconds. Weight::from_parts(27_000_000, 18049) @@ -119,8 +119,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `501` // Estimated: `17119` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(23_000_000, 17119) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(21_000_000, 17119) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `701` // Estimated: `63098` - // Minimum execution time: 49_000_000 picoseconds. - Weight::from_parts(52_000_000, 63098) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_000_000, 63098) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -155,10 +155,10 @@ impl WeightInfo for () { /// Proof: DaoEthGovernance PendingProposalOf (max_values: None, max_size: Some(967), added: 3442, mode: MaxEncodedLen) fn propose_with_meta() -> Weight { // Proof Size summary in bytes: - // Measured: `1968` + // Measured: `2021` // Estimated: `9606` - // Minimum execution time: 34_000_000 picoseconds. - Weight::from_parts(37_000_000, 9606) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(32_000_000, 9606) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -182,10 +182,10 @@ impl WeightInfo for () { /// Proof: DaoEthGovernance Voting (max_values: None, max_size: Some(4974), added: 7449, mode: MaxEncodedLen) fn approve_propose() -> Weight { // Proof Size summary in bytes: - // Measured: `4127` + // Measured: `4214` // Estimated: `71275` - // Minimum execution time: 63_000_000 picoseconds. - Weight::from_parts(72_000_000, 71275) + // Minimum execution time: 62_000_000 picoseconds. + Weight::from_parts(64_000_000, 71275) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -199,7 +199,7 @@ impl WeightInfo for () { /// Proof: DaoEthGovernance PendingVoting (max_values: None, max_size: Some(133), added: 2608, mode: MaxEncodedLen) fn vote() -> Weight { // Proof Size summary in bytes: - // Measured: `591` + // Measured: `644` // Estimated: `18049` // Minimum execution time: 26_000_000 picoseconds. Weight::from_parts(27_000_000, 18049) @@ -216,8 +216,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `501` // Estimated: `17119` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(23_000_000, 17119) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(21_000_000, 17119) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -235,8 +235,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `701` // Estimated: `63098` - // Minimum execution time: 49_000_000 picoseconds. - Weight::from_parts(52_000_000, 63098) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_000_000, 63098) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/pallets/dao-subscription/src/lib.rs b/pallets/dao-subscription/src/lib.rs index 0652264..4eff34a 100644 --- a/pallets/dao-subscription/src/lib.rs +++ b/pallets/dao-subscription/src/lib.rs @@ -184,7 +184,7 @@ pub mod pallet { #[pallet::call] impl Pallet { - #[pallet::weight(T::WeightInfo::set_subscription_tiers())] + #[pallet::weight(T::WeightInfo::set_subscription_tier())] #[pallet::call_index(0)] pub fn set_subscription_tier( origin: OriginFor, diff --git a/pallets/dao-subscription/src/weights.rs b/pallets/dao-subscription/src/weights.rs index fe3d755..7758b96 100644 --- a/pallets/dao-subscription/src/weights.rs +++ b/pallets/dao-subscription/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_dao_subscription //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `macbook-pro.lan`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -40,7 +40,7 @@ use core::marker::PhantomData; /// Weight functions needed for pallet_dao_subscription. pub trait WeightInfo { - fn set_subscription_tiers() -> Weight; + fn set_subscription_tier() -> Weight; fn suspend_subscription() -> Weight; } @@ -48,23 +48,23 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { /// Storage: DaoSubscription SubscriptionTiers (r:0 w:1) - /// Proof: DaoSubscription SubscriptionTiers (max_values: Some(1), max_size: Some(54), added: 549, mode: MaxEncodedLen) - fn set_subscription_tiers() -> Weight { + /// Proof: DaoSubscription SubscriptionTiers (max_values: None, max_size: Some(414), added: 2889, mode: MaxEncodedLen) + fn set_subscription_tier() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: DaoSubscription Subscriptions (r:1 w:1) - /// Proof: DaoSubscription Subscriptions (max_values: None, max_size: Some(125), added: 2600, mode: MaxEncodedLen) + /// Proof: DaoSubscription Subscriptions (max_values: None, max_size: Some(462), added: 2937, mode: MaxEncodedLen) fn suspend_subscription() -> Weight { // Proof Size summary in bytes: - // Measured: `257` - // Estimated: `3590` + // Measured: `258` + // Estimated: `3927` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3590) + Weight::from_parts(13_000_000, 3927) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -73,23 +73,23 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { /// Storage: DaoSubscription SubscriptionTiers (r:0 w:1) - /// Proof: DaoSubscription SubscriptionTiers (max_values: Some(1), max_size: Some(54), added: 549, mode: MaxEncodedLen) - fn set_subscription_tiers() -> Weight { + /// Proof: DaoSubscription SubscriptionTiers (max_values: None, max_size: Some(414), added: 2889, mode: MaxEncodedLen) + fn set_subscription_tier() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: DaoSubscription Subscriptions (r:1 w:1) - /// Proof: DaoSubscription Subscriptions (max_values: None, max_size: Some(125), added: 2600, mode: MaxEncodedLen) + /// Proof: DaoSubscription Subscriptions (max_values: None, max_size: Some(462), added: 2937, mode: MaxEncodedLen) fn suspend_subscription() -> Weight { // Proof Size summary in bytes: - // Measured: `257` - // Estimated: `3590` + // Measured: `258` + // Estimated: `3927` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3590) + Weight::from_parts(13_000_000, 3927) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/dao/src/weights.rs b/pallets/dao/src/weights.rs index 6f8cc30..b07210b 100644 --- a/pallets/dao/src/weights.rs +++ b/pallets/dao/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for pallet_dao //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `macbook-pro.lan`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -93,8 +93,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `459` // Estimated: `134792` - // Minimum execution time: 200_000_000 picoseconds. - Weight::from_parts(202_000_000, 134792) + // Minimum execution time: 201_000_000 picoseconds. + Weight::from_parts(208_000_000, 134792) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(19_u64)) } @@ -118,10 +118,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoCouncil Members (max_values: None, max_size: Some(3214), added: 5689, mode: MaxEncodedLen) fn approve_dao() -> Weight { // Proof Size summary in bytes: - // Measured: `1524` + // Measured: `1618` // Estimated: `116384` // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(62_000_000, 116384) + Weight::from_parts(61_000_000, 116384) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) } @@ -131,7 +131,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: Dao Daos (max_values: None, max_size: Some(1063), added: 3538, mode: MaxEncodedLen) fn update_dao_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `1222` + // Measured: `1316` // Estimated: `8153` // Minimum execution time: 18_000_000 picoseconds. Weight::from_parts(18_000_000, 8153) @@ -149,7 +149,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `869` // Estimated: `178926` // Minimum execution time: 91_000_000 picoseconds. - Weight::from_parts(94_000_000, 178926) + Weight::from_parts(93_000_000, 178926) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -163,7 +163,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) fn mint_dao_token() -> Weight { // Proof Size summary in bytes: - // Measured: `1668` + // Measured: `1762` // Estimated: `15451` // Minimum execution time: 29_000_000 picoseconds. Weight::from_parts(30_000_000, 15451) @@ -182,8 +182,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `784` // Estimated: `14976` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_000_000, 14976) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 14976) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -209,10 +209,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoDemocracy ReferendumInfoOf (max_values: None, max_size: Some(213), added: 2688, mode: MaxEncodedLen) fn launch_dao_referendum() -> Weight { // Proof Size summary in bytes: - // Measured: `2102` + // Measured: `2196` // Estimated: `44554` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(58_000_000, 44554) + // Minimum execution time: 57_000_000 picoseconds. + Weight::from_parts(61_000_000, 44554) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -229,7 +229,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `747` // Estimated: `14265` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_000_000, 14265) + Weight::from_parts(21_000_000, 14265) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -246,7 +246,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `471` // Estimated: `17627` // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(44_000_000, 17627) + Weight::from_parts(43_000_000, 17627) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -262,7 +262,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `723` // Estimated: `17627` - // Minimum execution time: 35_000_000 picoseconds. + // Minimum execution time: 34_000_000 picoseconds. Weight::from_parts(36_000_000, 17627) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -280,7 +280,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `841` // Estimated: `17627` // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(36_000_000, 17627) + Weight::from_parts(37_000_000, 17627) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -328,10 +328,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: DaoTechnicalCommittee Members (max_values: None, max_size: Some(3214), added: 5689, mode: MaxEncodedLen) fn remove_dao() -> Weight { // Proof Size summary in bytes: - // Measured: `2328` + // Measured: `2422` // Estimated: `140130` // Minimum execution time: 116_000_000 picoseconds. - Weight::from_parts(117_000_000, 140130) + Weight::from_parts(119_000_000, 140130) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(24_u64)) } @@ -347,8 +347,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `734` // Estimated: `53493` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 53493) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 53493) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -363,7 +363,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `706` // Estimated: `49566` // Minimum execution time: 23_000_000 picoseconds. - Weight::from_parts(23_000_000, 49566) + Weight::from_parts(24_000_000, 49566) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -405,8 +405,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `459` // Estimated: `134792` - // Minimum execution time: 200_000_000 picoseconds. - Weight::from_parts(202_000_000, 134792) + // Minimum execution time: 201_000_000 picoseconds. + Weight::from_parts(208_000_000, 134792) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(19_u64)) } @@ -430,10 +430,10 @@ impl WeightInfo for () { /// Proof: DaoCouncil Members (max_values: None, max_size: Some(3214), added: 5689, mode: MaxEncodedLen) fn approve_dao() -> Weight { // Proof Size summary in bytes: - // Measured: `1524` + // Measured: `1618` // Estimated: `116384` // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(62_000_000, 116384) + Weight::from_parts(61_000_000, 116384) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) } @@ -443,7 +443,7 @@ impl WeightInfo for () { /// Proof: Dao Daos (max_values: None, max_size: Some(1063), added: 3538, mode: MaxEncodedLen) fn update_dao_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `1222` + // Measured: `1316` // Estimated: `8153` // Minimum execution time: 18_000_000 picoseconds. Weight::from_parts(18_000_000, 8153) @@ -461,7 +461,7 @@ impl WeightInfo for () { // Measured: `869` // Estimated: `178926` // Minimum execution time: 91_000_000 picoseconds. - Weight::from_parts(94_000_000, 178926) + Weight::from_parts(93_000_000, 178926) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -475,7 +475,7 @@ impl WeightInfo for () { /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) fn mint_dao_token() -> Weight { // Proof Size summary in bytes: - // Measured: `1668` + // Measured: `1762` // Estimated: `15451` // Minimum execution time: 29_000_000 picoseconds. Weight::from_parts(30_000_000, 15451) @@ -494,8 +494,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `784` // Estimated: `14976` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_000_000, 14976) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 14976) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -521,10 +521,10 @@ impl WeightInfo for () { /// Proof: DaoDemocracy ReferendumInfoOf (max_values: None, max_size: Some(213), added: 2688, mode: MaxEncodedLen) fn launch_dao_referendum() -> Weight { // Proof Size summary in bytes: - // Measured: `2102` + // Measured: `2196` // Estimated: `44554` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(58_000_000, 44554) + // Minimum execution time: 57_000_000 picoseconds. + Weight::from_parts(61_000_000, 44554) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -541,7 +541,7 @@ impl WeightInfo for () { // Measured: `747` // Estimated: `14265` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_000_000, 14265) + Weight::from_parts(21_000_000, 14265) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -558,7 +558,7 @@ impl WeightInfo for () { // Measured: `471` // Estimated: `17627` // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(44_000_000, 17627) + Weight::from_parts(43_000_000, 17627) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -574,7 +574,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `723` // Estimated: `17627` - // Minimum execution time: 35_000_000 picoseconds. + // Minimum execution time: 34_000_000 picoseconds. Weight::from_parts(36_000_000, 17627) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -592,7 +592,7 @@ impl WeightInfo for () { // Measured: `841` // Estimated: `17627` // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(36_000_000, 17627) + Weight::from_parts(37_000_000, 17627) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -640,10 +640,10 @@ impl WeightInfo for () { /// Proof: DaoTechnicalCommittee Members (max_values: None, max_size: Some(3214), added: 5689, mode: MaxEncodedLen) fn remove_dao() -> Weight { // Proof Size summary in bytes: - // Measured: `2328` + // Measured: `2422` // Estimated: `140130` // Minimum execution time: 116_000_000 picoseconds. - Weight::from_parts(117_000_000, 140130) + Weight::from_parts(119_000_000, 140130) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(24_u64)) } @@ -659,8 +659,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `734` // Estimated: `53493` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 53493) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 53493) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -675,7 +675,7 @@ impl WeightInfo for () { // Measured: `706` // Estimated: `49566` // Minimum execution time: 23_000_000 picoseconds. - Weight::from_parts(23_000_000, 49566) + Weight::from_parts(24_000_000, 49566) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) }