diff --git a/frame/collective/src/benchmarking.rs b/frame/collective/src/benchmarking.rs index 1f78f07cf9234..7faaa31dc8012 100644 --- a/frame/collective/src/benchmarking.rs +++ b/frame/collective/src/benchmarking.rs @@ -250,8 +250,7 @@ benchmarks_instance! { let index = p - 1; // Have almost everyone vote aye on last proposal, while keeping it from passing. - // Proposer already voted aye so we start at 1. - for j in 1 .. m - 3 { + for j in 0 .. m - 3 { let voter = &members[j as usize]; let approve = true; Collective::::vote( @@ -326,8 +325,7 @@ benchmarks_instance! { let index = p - 1; // Have most everyone vote aye on last proposal, while keeping it from passing. - // Proposer already voted aye so we start at 1. - for j in 1 .. m - 2 { + for j in 0 .. m - 2 { let voter = &members[j as usize]; let approve = true; Collective::::vote( @@ -560,6 +558,14 @@ benchmarks_instance! { last_hash = T::Hashing::hash_of(&proposal); } + // The prime member votes aye, so abstentions default to aye. + Collective::::vote( + SystemOrigin::Signed(caller.clone()).into(), + last_hash.clone(), + p - 1, + true // Vote aye. + )?; + // Have almost everyone vote nay on last proposal, while keeping it from failing. // A few abstainers will be the aye votes needed to pass the vote. for j in 2 .. m - 1 { diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index c14ef9df64fee..00e976bfb9f65 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -476,8 +476,10 @@ decl_module! { let index = Self::proposal_count(); >::mutate(|i| *i += 1); >::insert(proposal_hash, *proposal); - let end = system::Pallet::::block_number() + T::MotionDuration::get(); - let votes = Votes { index, threshold, ayes: vec![who.clone()], nays: vec![], end }; + let votes = { + let end = system::Pallet::::block_number() + T::MotionDuration::get(); + Votes { index, threshold, ayes: vec![], nays: vec![], end } + }; >::insert(proposal_hash, votes); Self::deposit_event(RawEvent::Proposed(who, index, proposal_hash, threshold)); @@ -1094,6 +1096,7 @@ mod tests { let hash = BlakeTwo256::hash_of(&proposal); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); System::set_block_number(3); @@ -1108,6 +1111,7 @@ mod tests { let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::Collective(RawEvent::Proposed(1, 0, hash.clone(), 3))), + record(Event::Collective(RawEvent::Voted(1, hash.clone(), true, 1, 0))), record(Event::Collective(RawEvent::Voted(2, hash.clone(), true, 2, 0))), record(Event::Collective(RawEvent::Closed(hash.clone(), 2, 1))), record(Event::Collective(RawEvent::Disapproved(hash.clone()))) @@ -1125,6 +1129,7 @@ mod tests { // Set 1 as prime voter Prime::::set(Some(1)); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); // With 1's prime vote, this should pass System::set_block_number(4); assert_noop!( @@ -1162,6 +1167,7 @@ mod tests { assert_ok!(Collective::set_members(Origin::root(), vec![1, 2, 3], Some(3), MaxMembers::get())); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); System::set_block_number(4); @@ -1170,6 +1176,7 @@ mod tests { let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::Collective(RawEvent::Proposed(1, 0, hash.clone(), 3))), + record(Event::Collective(RawEvent::Voted(1, hash.clone(), true, 1, 0))), record(Event::Collective(RawEvent::Voted(2, hash.clone(), true, 2, 0))), record(Event::Collective(RawEvent::Closed(hash.clone(), 2, 1))), record(Event::Collective(RawEvent::Disapproved(hash.clone()))) @@ -1187,6 +1194,7 @@ mod tests { assert_ok!(Collective::set_members(Origin::root(), vec![1, 2, 3], Some(1), MaxMembers::get())); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); System::set_block_number(4); @@ -1195,6 +1203,7 @@ mod tests { let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::Collective(RawEvent::Proposed(1, 0, hash.clone(), 3))), + record(Event::Collective(RawEvent::Voted(1, hash.clone(), true, 1, 0))), record(Event::Collective(RawEvent::Voted(2, hash.clone(), true, 2, 0))), record(Event::Collective(RawEvent::Closed(hash.clone(), 3, 0))), record(Event::Collective(RawEvent::Approved(hash.clone()))), @@ -1213,6 +1222,7 @@ mod tests { assert_ok!(CollectiveMajority::set_members(Origin::root(), vec![1, 2, 3, 4, 5], Some(5), MaxMembers::get())); assert_ok!(CollectiveMajority::propose(Origin::signed(1), 5, Box::new(proposal.clone()), proposal_len)); + assert_ok!(CollectiveMajority::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(CollectiveMajority::vote(Origin::signed(2), hash.clone(), 0, true)); assert_ok!(CollectiveMajority::vote(Origin::signed(3), hash.clone(), 0, true)); @@ -1222,6 +1232,7 @@ mod tests { let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::CollectiveMajority(RawEvent::Proposed(1, 0, hash.clone(), 5))), + record(Event::CollectiveMajority(RawEvent::Voted(1, hash.clone(), true, 1, 0))), record(Event::CollectiveMajority(RawEvent::Voted(2, hash.clone(), true, 2, 0))), record(Event::CollectiveMajority(RawEvent::Voted(3, hash.clone(), true, 3, 0))), record(Event::CollectiveMajority(RawEvent::Closed(hash.clone(), 5, 0))), @@ -1239,6 +1250,7 @@ mod tests { let hash = BlakeTwo256::hash_of(&proposal); let end = 4; assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); assert_eq!( Collective::voting(&hash), @@ -1254,6 +1266,7 @@ mod tests { let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash = BlakeTwo256::hash_of(&proposal); assert_ok!(Collective::propose(Origin::signed(2), 2, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 1, true)); assert_ok!(Collective::vote(Origin::signed(3), hash.clone(), 1, false)); assert_eq!( Collective::voting(&hash), @@ -1275,6 +1288,7 @@ mod tests { let hash = BlakeTwo256::hash_of(&proposal); let end = 4; assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); assert_eq!( Collective::voting(&hash), @@ -1290,6 +1304,7 @@ mod tests { let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash = BlakeTwo256::hash_of(&proposal); assert_ok!(Collective::propose(Origin::signed(2), 2, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 1, true)); assert_ok!(Collective::vote(Origin::signed(3), hash.clone(), 1, false)); assert_eq!( Collective::voting(&hash), @@ -1315,7 +1330,7 @@ mod tests { assert_eq!(Collective::proposal_of(&hash), Some(proposal)); assert_eq!( Collective::voting(&hash), - Some(Votes { index: 0, threshold: 3, ayes: vec![1], nays: vec![], end }) + Some(Votes { index: 0, threshold: 3, ayes: vec![], nays: vec![], end }) ); assert_eq!(System::events(), vec![ @@ -1336,10 +1351,15 @@ mod tests { #[test] fn limit_active_proposals() { new_test_ext().execute_with(|| { - for i in 0..MaxProposals::get() { + for i in 0 .. MaxProposals::get() { let proposal = make_proposal(i as u64); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); - assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::propose( + Origin::signed(1), + 3, + Box::new(proposal.clone()), + proposal_len + )); } let proposal = make_proposal(MaxProposals::get() as u64 + 1); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); @@ -1421,26 +1441,36 @@ mod tests { } #[test] - fn motions_revoting_works() { + fn motions_vote_after_works() { new_test_ext().execute_with(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); let end = 4; assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone()), proposal_len)); + // Initially there a no votes when the motion is proposed. + assert_eq!( + Collective::voting(&hash), + Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![], end }) + ); + // Cast first aye vote. + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_eq!( Collective::voting(&hash), Some(Votes { index: 0, threshold: 2, ayes: vec![1], nays: vec![], end }) ); + // Try to cast a duplicate aye vote. assert_noop!( Collective::vote(Origin::signed(1), hash.clone(), 0, true), Error::::DuplicateVote, ); + // Cast a nay vote. assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, false)); assert_eq!( Collective::voting(&hash), Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![1], end }) ); + // Try to cast a duplicate nay vote. assert_noop!( Collective::vote(Origin::signed(1), hash.clone(), 0, false), Error::::DuplicateVote, @@ -1457,6 +1487,18 @@ mod tests { )), topics: vec![], }, + EventRecord { + phase: Phase::Initialization, + event: Event::Collective(RawEvent::Voted( + 1, + hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"] + .into(), + true, + 1, + 0, + )), + topics: vec![], + }, EventRecord { phase: Phase::Initialization, event: Event::Collective(RawEvent::Voted( @@ -1489,7 +1531,7 @@ mod tests { ); assert_eq!( Collective::voting(&hash), - Some(Votes { index: 0, threshold: 2, ayes: vec![1], nays: vec![], end }) + Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![], end }) ); // For the motion, acc 2's first vote, expecting Ok with Pays::No. @@ -1586,6 +1628,7 @@ mod tests { let proposal_weight = proposal.get_dispatch_info().weight; let hash: H256 = proposal.blake2_256().into(); assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, false)); assert_ok!(Collective::close(Origin::signed(2), hash.clone(), 0, proposal_weight, proposal_len)); @@ -1601,6 +1644,17 @@ mod tests { )), topics: vec![], }, + EventRecord { + phase: Phase::Initialization, + event: Event::Collective(RawEvent::Voted( + 1, + hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(), + true, + 1, + 0, + )), + topics: vec![], + }, EventRecord { phase: Phase::Initialization, event: Event::Collective(RawEvent::Voted( @@ -1638,6 +1692,7 @@ mod tests { let proposal_weight = proposal.get_dispatch_info().weight; let hash: H256 = proposal.blake2_256().into(); assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone()), proposal_len)); + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); assert_ok!(Collective::close(Origin::signed(2), hash.clone(), 0, proposal_weight, proposal_len)); @@ -1652,6 +1707,17 @@ mod tests { )), topics: vec![], }, + EventRecord { + phase: Phase::Initialization, + event: Event::Collective(RawEvent::Voted( + 1, + hex!["68eea8f20b542ec656c6ac2d10435ae3bd1729efc34d1354ab85af840aad2d35"].into(), + true, + 1, + 0, + )), + topics: vec![], + }, EventRecord { phase: Phase::Initialization, event: Event::Collective(RawEvent::Voted( @@ -1689,6 +1755,37 @@ mod tests { }); } + #[test] + fn motion_with_no_votes_closes_with_disapproval() { + new_test_ext().execute_with(|| { + let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; + let proposal = make_proposal(42); + let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); + let proposal_weight = proposal.get_dispatch_info().weight; + let hash: H256 = proposal.blake2_256().into(); + assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone()), proposal_len)); + assert_eq!(System::events()[0], record(Event::Collective(RawEvent::Proposed(1, 0, hash.clone(), 3)))); + + // Closing the motion too early is not possible because it has neither + // an approving or disapproving simple majority due to the lack of votes. + assert_noop!( + Collective::close(Origin::signed(2), hash.clone(), 0, proposal_weight, proposal_len), + Error::::TooEarly + ); + + // Once the motion duration passes, + let closing_block = System::block_number() + MotionDuration::get(); + System::set_block_number(closing_block); + // we can successfully close the motion. + assert_ok!(Collective::close(Origin::signed(2), hash.clone(), 0, proposal_weight, proposal_len)); + + // Events show that the close ended in a disapproval. + assert_eq!(System::events()[1], record(Event::Collective(RawEvent::Closed(hash.clone(), 0, 3)))); + assert_eq!(System::events()[2], record(Event::Collective(RawEvent::Disapproved(hash.clone())))); + }) + + } + #[test] fn close_disapprove_does_not_care_about_weight_or_len() { // This test confirms that if you close a proposal that would be disapproved, @@ -1700,6 +1797,7 @@ mod tests { let hash: H256 = proposal.blake2_256().into(); assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone()), proposal_len)); // First we make the proposal succeed + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); // It will not close with bad weight/len information assert_noop!( @@ -1726,12 +1824,14 @@ mod tests { let hash: H256 = proposal.blake2_256().into(); assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone()), proposal_len)); // Proposal would normally succeed + assert_ok!(Collective::vote(Origin::signed(1), hash.clone(), 0, true)); assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, true)); // But Root can disapprove and remove it anyway assert_ok!(Collective::disapprove_proposal(Origin::root(), hash.clone())); let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] }; assert_eq!(System::events(), vec![ record(Event::Collective(RawEvent::Proposed(1, 0, hash.clone(), 2))), + record(Event::Collective(RawEvent::Voted(1, hash.clone(), true, 1, 0))), record(Event::Collective(RawEvent::Voted(2, hash.clone(), true, 2, 0))), record(Event::Collective(RawEvent::Disapproved(hash.clone()))), ]); diff --git a/frame/collective/src/weights.rs b/frame/collective/src/weights.rs index 46bd999344add..2bbec4d7cc3d8 100644 --- a/frame/collective/src/weights.rs +++ b/frame/collective/src/weights.rs @@ -17,8 +17,8 @@ //! Autogenerated weights for pallet_collective //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-19, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-07-13, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -62,94 +62,94 @@ impl WeightInfo for SubstrateWeight { fn set_members(m: u32, n: u32, p: u32, ) -> Weight { (0 as Weight) // Standard Error: 5_000 - .saturating_add((15_266_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((14_534_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 5_000 - .saturating_add((39_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((160_000 as Weight).saturating_mul(n as Weight)) // Standard Error: 5_000 - .saturating_add((20_899_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((20_189_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) } fn execute(b: u32, m: u32, ) -> Weight { - (21_945_000 as Weight) + (23_177_000 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 0 - .saturating_add((93_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((89_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } fn propose_execute(b: u32, m: u32, ) -> Weight { - (26_316_000 as Weight) + (28_063_000 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 0 - .saturating_add((184_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((174_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) } fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (42_664_000 as Weight) + (46_515_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((5_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 2_000 - .saturating_add((166_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((91_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 2_000 - .saturating_add((435_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((486_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn vote(m: u32, ) -> Weight { - (43_750_000 as Weight) - // Standard Error: 3_000 - .saturating_add((198_000 as Weight).saturating_mul(m as Weight)) + (38_491_000 as Weight) + // Standard Error: 0 + .saturating_add((209_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (44_153_000 as Weight) + (44_903_000 as Weight) // Standard Error: 0 - .saturating_add((185_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((181_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 0 - .saturating_add((454_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((350_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (65_478_000 as Weight) + (57_416_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 2_000 - .saturating_add((167_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 2_000 - .saturating_add((434_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 1_000 + .saturating_add((217_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 1_000 + .saturating_add((485_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn close_disapproved(m: u32, p: u32, ) -> Weight { - (49_001_000 as Weight) + (50_134_000 as Weight) // Standard Error: 0 .saturating_add((189_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 0 - .saturating_add((464_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((487_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (65_049_000 as Weight) + (65_901_000 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 1_000 - .saturating_add((192_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((186_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 1_000 - .saturating_add((469_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((482_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn disapprove_proposal(p: u32, ) -> Weight { - (27_288_000 as Weight) + (28_849_000 as Weight) // Standard Error: 1_000 - .saturating_add((477_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((494_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -160,94 +160,94 @@ impl WeightInfo for () { fn set_members(m: u32, n: u32, p: u32, ) -> Weight { (0 as Weight) // Standard Error: 5_000 - .saturating_add((15_266_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((14_534_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 5_000 - .saturating_add((39_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((160_000 as Weight).saturating_mul(n as Weight)) // Standard Error: 5_000 - .saturating_add((20_899_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((20_189_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) } fn execute(b: u32, m: u32, ) -> Weight { - (21_945_000 as Weight) + (23_177_000 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 0 - .saturating_add((93_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((89_000 as Weight).saturating_mul(m as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } fn propose_execute(b: u32, m: u32, ) -> Weight { - (26_316_000 as Weight) + (28_063_000 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 0 - .saturating_add((184_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((174_000 as Weight).saturating_mul(m as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) } fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (42_664_000 as Weight) + (46_515_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((5_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 2_000 - .saturating_add((166_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((91_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 2_000 - .saturating_add((435_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((486_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn vote(m: u32, ) -> Weight { - (43_750_000 as Weight) - // Standard Error: 3_000 - .saturating_add((198_000 as Weight).saturating_mul(m as Weight)) + (38_491_000 as Weight) + // Standard Error: 0 + .saturating_add((209_000 as Weight).saturating_mul(m as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (44_153_000 as Weight) + (44_903_000 as Weight) // Standard Error: 0 - .saturating_add((185_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((181_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 0 - .saturating_add((454_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((350_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (65_478_000 as Weight) + (57_416_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 2_000 - .saturating_add((167_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 2_000 - .saturating_add((434_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 1_000 + .saturating_add((217_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 1_000 + .saturating_add((485_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn close_disapproved(m: u32, p: u32, ) -> Weight { - (49_001_000 as Weight) + (50_134_000 as Weight) // Standard Error: 0 .saturating_add((189_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 0 - .saturating_add((464_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((487_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (65_049_000 as Weight) + (65_901_000 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) // Standard Error: 1_000 - .saturating_add((192_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((186_000 as Weight).saturating_mul(m as Weight)) // Standard Error: 1_000 - .saturating_add((469_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((482_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn disapprove_proposal(p: u32, ) -> Weight { - (27_288_000 as Weight) + (28_849_000 as Weight) // Standard Error: 1_000 - .saturating_add((477_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((494_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } diff --git a/frame/treasury/src/weights.rs b/frame/treasury/src/weights.rs index b22380e3c476c..d293399e7b480 100644 --- a/frame/treasury/src/weights.rs +++ b/frame/treasury/src/weights.rs @@ -17,8 +17,8 @@ //! Autogenerated weights for pallet_treasury //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-19, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-07-13, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -54,26 +54,26 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { fn propose_spend() -> Weight { - (41_763_000 as Weight) + (42_325_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn reject_proposal() -> Weight { - (39_049_000 as Weight) + (39_633_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn approve_proposal(p: u32, ) -> Weight { - (13_547_000 as Weight) - // Standard Error: 0 - .saturating_add((124_000 as Weight).saturating_mul(p as Weight)) + (14_337_000 as Weight) + // Standard Error: 2_000 + .saturating_add((116_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn on_initialize_proposals(p: u32, ) -> Weight { - (48_990_000 as Weight) - // Standard Error: 19_000 - .saturating_add((59_621_000 as Weight).saturating_mul(p as Weight)) + (50_379_000 as Weight) + // Standard Error: 18_000 + .saturating_add((59_595_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -84,26 +84,26 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { fn propose_spend() -> Weight { - (41_763_000 as Weight) + (42_325_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } fn reject_proposal() -> Weight { - (39_049_000 as Weight) + (39_633_000 as Weight) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } fn approve_proposal(p: u32, ) -> Weight { - (13_547_000 as Weight) - // Standard Error: 0 - .saturating_add((124_000 as Weight).saturating_mul(p as Weight)) + (14_337_000 as Weight) + // Standard Error: 2_000 + .saturating_add((116_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn on_initialize_proposals(p: u32, ) -> Weight { - (48_990_000 as Weight) - // Standard Error: 19_000 - .saturating_add((59_621_000 as Weight).saturating_mul(p as Weight)) + (50_379_000 as Weight) + // Standard Error: 18_000 + .saturating_add((59_595_000 as Weight).saturating_mul(p as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight))