From 6cec40f50fefc46db4280f6bc5d0f2624bf028b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCn=20=C3=96zerk?= Date: Wed, 29 Nov 2023 14:38:09 +0300 Subject: [PATCH] remove timepoint from multisig --- substrate/frame/multisig/src/benchmarking.rs | 28 ++- substrate/frame/multisig/src/lib.rs | 90 +--------- substrate/frame/multisig/src/tests.rs | 169 ++----------------- 3 files changed, 28 insertions(+), 259 deletions(-) diff --git a/substrate/frame/multisig/src/benchmarking.rs b/substrate/frame/multisig/src/benchmarking.rs index ebe19df5dc43..98cb325a4b98 100644 --- a/substrate/frame/multisig/src/benchmarking.rs +++ b/substrate/frame/multisig/src/benchmarking.rs @@ -79,7 +79,7 @@ benchmarks! { // Whitelist caller account from further DB operations. let caller_key = frame_system::Account::::hashed_key_for(&caller); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); - }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, Weight::zero()) + }: as_multi(RawOrigin::Signed(caller), s as u16, signatories, call, Weight::zero()) verify { assert!(Multisigs::::contains_key(multi_account_id, call_hash)); } @@ -94,15 +94,13 @@ benchmarks! { let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - // before the call, get the timepoint - let timepoint = Multisig::::timepoint(); // Create the multi - Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), Weight::zero())?; + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, call.clone(), Weight::zero())?; let caller2 = signatories2.remove(0); // Whitelist caller account from further DB operations. let caller_key = frame_system::Account::::hashed_key_for(&caller2); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, Weight::zero()) + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, call, Weight::zero()) verify { let multisig = Multisigs::::get(multi_account_id, call_hash).ok_or("multisig not created")?; assert_eq!(multisig.approvals.len(), 2); @@ -118,23 +116,21 @@ benchmarks! { let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let mut signatories2 = signatories.clone(); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; - // before the call, get the timepoint - let timepoint = Multisig::::timepoint(); // Create the multi - Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), Weight::zero())?; + Multisig::::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, call.clone(), Weight::zero())?; // Everyone except the first person approves for i in 1 .. s - 1 { let mut signatories_loop = signatories2.clone(); let caller_loop = signatories_loop.remove(i as usize); let o = RawOrigin::Signed(caller_loop).into(); - Multisig::::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), Weight::zero())?; + Multisig::::as_multi(o, s as u16, signatories_loop, call.clone(), Weight::zero())?; } let caller2 = signatories2.remove(0); assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); // Whitelist caller account from further DB operations. let caller_key = frame_system::Account::::hashed_key_for(&caller2); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); - }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, Weight::MAX) + }: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, call, Weight::MAX) verify { assert!(!Multisigs::::contains_key(&multi_account_id, call_hash)); } @@ -152,7 +148,7 @@ benchmarks! { let caller_key = frame_system::Account::::hashed_key_for(&caller); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); // Create the multi - }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash, Weight::zero()) + }: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, call_hash, Weight::zero()) verify { assert!(Multisigs::::contains_key(multi_account_id, call_hash)); } @@ -167,14 +163,11 @@ benchmarks! { let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; let call_hash = call.using_encoded(blake2_256); - // before the call, get the timepoint - let timepoint = Multisig::::timepoint(); // Create the multi Multisig::::as_multi( RawOrigin::Signed(caller).into(), s as u16, signatories, - None, call, Weight::zero() )?; @@ -182,7 +175,7 @@ benchmarks! { // Whitelist caller account from further DB operations. let caller_key = frame_system::Account::::hashed_key_for(&caller2); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); - }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash, Weight::zero()) + }: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, call_hash, Weight::zero()) verify { let multisig = Multisigs::::get(multi_account_id, call_hash).ok_or("multisig not created")?; assert_eq!(multisig.approvals.len(), 2); @@ -197,15 +190,14 @@ benchmarks! { let multi_account_id = Multisig::::multi_account_id(&signatories, s.try_into().unwrap()); let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; let call_hash = call.using_encoded(blake2_256); - let timepoint = Multisig::::timepoint(); // Create the multi let o = RawOrigin::Signed(caller.clone()).into(); - Multisig::::as_multi(o, s as u16, signatories.clone(), None, call, Weight::zero())?; + Multisig::::as_multi(o, s as u16, signatories.clone(), call, Weight::zero())?; assert!(Multisigs::::contains_key(&multi_account_id, call_hash)); // Whitelist caller account from further DB operations. let caller_key = frame_system::Account::::hashed_key_for(&caller); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); - }: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash) + }: _(RawOrigin::Signed(caller), s as u16, signatories, call_hash) verify { assert!(!Multisigs::::contains_key(multi_account_id, call_hash)); } diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index e4426c64b412..5fb886a495c3 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -59,7 +59,7 @@ use frame_support::{ weights::Weight, BoundedVec, }; -use frame_system::{self as system, pallet_prelude::BlockNumberFor, RawOrigin}; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use scale_info::TypeInfo; use sp_io::hashing::blake2_256; use sp_runtime::{ @@ -88,28 +88,13 @@ macro_rules! log { type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -/// A global extrinsic index, formed as the extrinsic index within a block, together with that -/// block's height. This allows a transaction in which a multisig operation of a particular -/// composite was created to be uniquely identified. -#[derive( - Copy, Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen, -)] -pub struct Timepoint { - /// The height of the chain at the point in time. - height: BlockNumber, - /// The index of the extrinsic at the point in time. - index: u32, -} - /// An open multisig operation. #[derive(Clone, Eq, PartialEq, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen)] #[scale_info(skip_type_params(MaxApprovals))] -pub struct Multisig +pub struct Multisig where MaxApprovals: Get, { - /// The extrinsic when the multisig operation was opened. - when: Timepoint, /// The amount held in reserve of the `depositor`, to be returned once the operation ends. deposit: Balance, /// The account who opened it (i.e. the first to approve it). @@ -183,7 +168,7 @@ pub mod pallet { T::AccountId, Blake2_128Concat, [u8; 32], - Multisig, BalanceOf, T::AccountId, T::MaxSignatories>, + Multisig, T::AccountId, T::MaxSignatories>, >; #[pallet::error] @@ -206,12 +191,6 @@ pub mod pallet { NotFound, /// Only the account that originally created the multisig is able to cancel it. NotOwner, - /// No timepoint was given, yet the multisig operation is already underway. - NoTimepoint, - /// A different timepoint was given to the multisig operation that is underway. - WrongTimepoint, - /// A timepoint was given, yet no multisig operation is underway. - UnexpectedTimepoint, /// The maximum weight information provided was too low. MaxWeightTooLow, /// The data to be stored is already stored. @@ -224,27 +203,16 @@ pub mod pallet { /// A new multisig operation has begun. NewMultisig { approving: T::AccountId, multisig: T::AccountId, call_hash: CallHash }, /// A multisig operation has been approved by someone. - MultisigApproval { - approving: T::AccountId, - timepoint: Timepoint>, - multisig: T::AccountId, - call_hash: CallHash, - }, + MultisigApproval { approving: T::AccountId, multisig: T::AccountId, call_hash: CallHash }, /// A multisig operation has been executed. MultisigExecuted { approving: T::AccountId, - timepoint: Timepoint>, multisig: T::AccountId, call_hash: CallHash, result: DispatchResult, }, /// A multisig operation has been cancelled. - MultisigCancelled { - cancelling: T::AccountId, - timepoint: Timepoint>, - multisig: T::AccountId, - call_hash: CallHash, - }, + MultisigCancelled { cancelling: T::AccountId, multisig: T::AccountId, call_hash: CallHash }, } #[pallet::hooks] @@ -327,9 +295,6 @@ pub mod pallet { /// - `threshold`: The total number of approvals for this dispatch before it is executed. /// - `other_signatories`: The accounts (other than the sender) who can approve this /// dispatch. May not be empty. - /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - /// not the first approval, then it must be `Some`, with the timepoint (block number and - /// transaction index) of the first approval transaction. /// - `call`: The call to be executed. /// /// NOTE: Unless this is the final approval, you will generally want to use @@ -366,19 +331,11 @@ pub mod pallet { origin: OriginFor, threshold: u16, other_signatories: Vec, - maybe_timepoint: Option>>, call: Box<::RuntimeCall>, max_weight: Weight, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - Self::operate( - who, - threshold, - other_signatories, - maybe_timepoint, - CallOrHash::Call(*call), - max_weight, - ) + Self::operate(who, threshold, other_signatories, CallOrHash::Call(*call), max_weight) } /// Register approval for a dispatch to be made from a deterministic composite account if @@ -393,9 +350,6 @@ pub mod pallet { /// - `threshold`: The total number of approvals for this dispatch before it is executed. /// - `other_signatories`: The accounts (other than the sender) who can approve this /// dispatch. May not be empty. - /// - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - /// not the first approval, then it must be `Some`, with the timepoint (block number and - /// transaction index) of the first approval transaction. /// - `call_hash`: The hash of the call to be executed. /// /// NOTE: If this is the final approval, you will want to use `as_multi` instead. @@ -423,7 +377,6 @@ pub mod pallet { origin: OriginFor, threshold: u16, other_signatories: Vec, - maybe_timepoint: Option>>, call_hash: [u8; 32], max_weight: Weight, ) -> DispatchResultWithPostInfo { @@ -432,7 +385,6 @@ pub mod pallet { who, threshold, other_signatories, - maybe_timepoint, CallOrHash::Hash(call_hash), max_weight, ) @@ -446,8 +398,6 @@ pub mod pallet { /// - `threshold`: The total number of approvals for this dispatch before it is executed. /// - `other_signatories`: The accounts (other than the sender) who can approve this /// dispatch. May not be empty. - /// - `timepoint`: The timepoint (block number and transaction index) of the first approval - /// transaction for this dispatch. /// - `call_hash`: The hash of the call to be executed. /// /// ## Complexity @@ -465,7 +415,6 @@ pub mod pallet { origin: OriginFor, threshold: u16, other_signatories: Vec, - timepoint: Timepoint>, call_hash: [u8; 32], ) -> DispatchResult { let who = ensure_signed(origin)?; @@ -478,7 +427,6 @@ pub mod pallet { let id = Self::multi_account_id(&signatories, threshold); let m = >::get(&id, call_hash).ok_or(Error::::NotFound)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); ensure!(m.depositor == who, Error::::NotOwner); let err_amount = T::Currency::unreserve(&m.depositor, m.deposit); @@ -487,7 +435,6 @@ pub mod pallet { Self::deposit_event(Event::MultisigCancelled { cancelling: who, - timepoint, multisig: id, call_hash, }); @@ -511,7 +458,6 @@ impl Pallet { who: T::AccountId, threshold: u16, other_signatories: Vec, - maybe_timepoint: Option>>, call_or_hash: CallOrHash, max_weight: Weight, ) -> DispatchResultWithPostInfo { @@ -535,10 +481,6 @@ impl Pallet { // Branch on whether the operation has already started or not. if let Some(mut m) = >::get(&id, call_hash) { - // Yes; ensure that the timepoint exists and agrees. - let timepoint = maybe_timepoint.ok_or(Error::::NoTimepoint)?; - ensure!(m.when == timepoint, Error::::WrongTimepoint); - // Ensure that either we have not yet signed or that it is at threshold. let mut approvals = m.approvals.len() as u16; // We only bother with the approval if we're below threshold. @@ -564,7 +506,6 @@ impl Pallet { let result = call.dispatch(RawOrigin::Signed(id.clone()).into()); Self::deposit_event(Event::MultisigExecuted { approving: who, - timepoint, multisig: id, call_hash, result: result.map(|_| ()).map_err(|e| e.error), @@ -590,7 +531,6 @@ impl Pallet { >::insert(&id, call_hash, m); Self::deposit_event(Event::MultisigApproval { approving: who, - timepoint, multisig: id, call_hash, }); @@ -606,9 +546,6 @@ impl Pallet { Ok(Some(final_weight).into()) } } else { - // Not yet started; there should be no timepoint given. - ensure!(maybe_timepoint.is_none(), Error::::UnexpectedTimepoint); - // Just start the operation by recording it in storage. let deposit = T::DepositBase::get() + T::DepositFactor::get() * threshold.into(); @@ -620,12 +557,7 @@ impl Pallet { >::insert( &id, call_hash, - Multisig { - when: Self::timepoint(), - deposit, - depositor: who.clone(), - approvals: initial_approvals, - }, + Multisig { deposit, depositor: who.clone(), approvals: initial_approvals }, ); Self::deposit_event(Event::NewMultisig { approving: who, multisig: id, call_hash }); @@ -636,14 +568,6 @@ impl Pallet { } } - /// The current `Timepoint`. - pub fn timepoint() -> Timepoint> { - Timepoint { - height: >::block_number(), - index: >::extrinsic_index().unwrap_or_default(), - } - } - /// Check that signatories is sorted and doesn't contain sender, then insert sender. fn ensure_sorted_and_insert( other_signatories: Vec, diff --git a/substrate/frame/multisig/src/tests.rs b/substrate/frame/multisig/src/tests.rs index 179827255291..0cbcf54cd0ac 100644 --- a/substrate/frame/multisig/src/tests.rs +++ b/substrate/frame/multisig/src/tests.rs @@ -88,10 +88,6 @@ pub fn new_test_ext() -> sp_io::TestExternalities { ext } -fn now() -> Timepoint { - Multisig::timepoint() -} - fn call_transfer(dest: u64, value: u64) -> Box { Box::new(RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest, value })) } @@ -110,21 +106,13 @@ fn multisig_deposit_is_taken_and_returned() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call.clone(), Weight::zero() )); assert_eq!(Balances::free_balance(1), 2); assert_eq!(Balances::reserved_balance(1), 3); - assert_ok!(Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(now()), - call, - call_weight - )); + assert_ok!(Multisig::as_multi(RuntimeOrigin::signed(2), 2, vec![1, 3], call, call_weight)); assert_eq!(Balances::free_balance(1), 5); assert_eq!(Balances::reserved_balance(1), 0); }); @@ -139,7 +127,6 @@ fn cancel_multisig_returns_deposit() { RuntimeOrigin::signed(1), 3, vec![2, 3], - None, hash, Weight::zero() )); @@ -147,76 +134,17 @@ fn cancel_multisig_returns_deposit() { RuntimeOrigin::signed(2), 3, vec![1, 3], - Some(now()), hash, Weight::zero() )); assert_eq!(Balances::free_balance(1), 6); assert_eq!(Balances::reserved_balance(1), 4); - assert_ok!(Multisig::cancel_as_multi(RuntimeOrigin::signed(1), 3, vec![2, 3], now(), hash)); + assert_ok!(Multisig::cancel_as_multi(RuntimeOrigin::signed(1), 3, vec![2, 3], hash)); assert_eq!(Balances::free_balance(1), 10); assert_eq!(Balances::reserved_balance(1), 0); }); } -#[test] -fn timepoint_checking_works() { - new_test_ext().execute_with(|| { - let multi = Multisig::multi_account_id(&[1, 2, 3][..], 2); - assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(1), multi, 5)); - assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(2), multi, 5)); - assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(3), multi, 5)); - - let call = call_transfer(6, 15); - let hash = blake2_256(&call.encode()); - - assert_noop!( - Multisig::approve_as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(now()), - hash, - Weight::zero() - ), - Error::::UnexpectedTimepoint, - ); - - assert_ok!(Multisig::approve_as_multi( - RuntimeOrigin::signed(1), - 2, - vec![2, 3], - None, - hash, - Weight::zero() - )); - - assert_noop!( - Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - None, - call.clone(), - Weight::zero() - ), - Error::::NoTimepoint, - ); - let later = Timepoint { index: 1, ..now() }; - assert_noop!( - Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(later), - call, - Weight::zero() - ), - Error::::WrongTimepoint, - ); - }); -} - #[test] fn multisig_2_of_3_works() { new_test_ext().execute_with(|| { @@ -232,20 +160,12 @@ fn multisig_2_of_3_works() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, hash, Weight::zero() )); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(now()), - call, - call_weight - )); + assert_ok!(Multisig::as_multi(RuntimeOrigin::signed(2), 2, vec![1, 3], call, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -265,7 +185,6 @@ fn multisig_3_of_3_works() { RuntimeOrigin::signed(1), 3, vec![2, 3], - None, hash, Weight::zero() )); @@ -273,20 +192,12 @@ fn multisig_3_of_3_works() { RuntimeOrigin::signed(2), 3, vec![1, 3], - Some(now()), hash, Weight::zero() )); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi( - RuntimeOrigin::signed(3), - 3, - vec![1, 2], - Some(now()), - call, - call_weight - )); + assert_ok!(Multisig::as_multi(RuntimeOrigin::signed(3), 3, vec![1, 2], call, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -300,7 +211,6 @@ fn cancel_multisig_works() { RuntimeOrigin::signed(1), 3, vec![2, 3], - None, hash, Weight::zero() )); @@ -308,15 +218,14 @@ fn cancel_multisig_works() { RuntimeOrigin::signed(2), 3, vec![1, 3], - Some(now()), hash, Weight::zero() )); assert_noop!( - Multisig::cancel_as_multi(RuntimeOrigin::signed(2), 3, vec![1, 3], now(), hash), + Multisig::cancel_as_multi(RuntimeOrigin::signed(2), 3, vec![1, 3], hash), Error::::NotOwner, ); - assert_ok!(Multisig::cancel_as_multi(RuntimeOrigin::signed(1), 3, vec![2, 3], now(), hash),); + assert_ok!(Multisig::cancel_as_multi(RuntimeOrigin::signed(1), 3, vec![2, 3], hash),); }); } @@ -334,20 +243,12 @@ fn multisig_2_of_3_as_multi_works() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call.clone(), Weight::zero() )); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(now()), - call, - call_weight - )); + assert_ok!(Multisig::as_multi(RuntimeOrigin::signed(2), 2, vec![1, 3], call, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); } @@ -369,7 +270,6 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call1.clone(), Weight::zero() )); @@ -377,7 +277,6 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() { RuntimeOrigin::signed(2), 2, vec![1, 3], - None, call2.clone(), Weight::zero() )); @@ -385,7 +284,6 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() { RuntimeOrigin::signed(3), 2, vec![1, 2], - Some(now()), call1, call1_weight )); @@ -393,7 +291,6 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() { RuntimeOrigin::signed(3), 2, vec![1, 2], - Some(now()), call2, call2_weight )); @@ -418,7 +315,6 @@ fn multisig_2_of_3_cannot_reissue_same_call() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call.clone(), Weight::zero() )); @@ -426,7 +322,6 @@ fn multisig_2_of_3_cannot_reissue_same_call() { RuntimeOrigin::signed(2), 2, vec![1, 3], - Some(now()), call.clone(), call_weight )); @@ -436,7 +331,6 @@ fn multisig_2_of_3_cannot_reissue_same_call() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call.clone(), Weight::zero() )); @@ -444,7 +338,6 @@ fn multisig_2_of_3_cannot_reissue_same_call() { RuntimeOrigin::signed(3), 2, vec![1, 2], - Some(now()), call.clone(), call_weight )); @@ -452,7 +345,6 @@ fn multisig_2_of_3_cannot_reissue_same_call() { System::assert_last_event( pallet_multisig::Event::MultisigExecuted { approving: 3, - timepoint: now(), multisig: multi, call_hash: hash, result: Err(TokenError::FundsUnavailable.into()), @@ -467,25 +359,11 @@ fn minimum_threshold_check_works() { new_test_ext().execute_with(|| { let call = call_transfer(6, 15); assert_noop!( - Multisig::as_multi( - RuntimeOrigin::signed(1), - 0, - vec![2], - None, - call.clone(), - Weight::zero() - ), + Multisig::as_multi(RuntimeOrigin::signed(1), 0, vec![2], call.clone(), Weight::zero()), Error::::MinimumThreshold, ); assert_noop!( - Multisig::as_multi( - RuntimeOrigin::signed(1), - 1, - vec![2], - None, - call.clone(), - Weight::zero() - ), + Multisig::as_multi(RuntimeOrigin::signed(1), 1, vec![2], call.clone(), Weight::zero()), Error::::MinimumThreshold, ); }); @@ -500,7 +378,6 @@ fn too_many_signatories_fails() { RuntimeOrigin::signed(1), 2, vec![2, 3, 4], - None, call.clone(), Weight::zero() ), @@ -518,7 +395,6 @@ fn duplicate_approvals_are_ignored() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, hash, Weight::zero() )); @@ -527,7 +403,6 @@ fn duplicate_approvals_are_ignored() { RuntimeOrigin::signed(1), 2, vec![2, 3], - Some(now()), hash, Weight::zero() ), @@ -537,7 +412,6 @@ fn duplicate_approvals_are_ignored() { RuntimeOrigin::signed(2), 2, vec![1, 3], - Some(now()), hash, Weight::zero() )); @@ -546,7 +420,6 @@ fn duplicate_approvals_are_ignored() { RuntimeOrigin::signed(3), 2, vec![1, 2], - Some(now()), hash, Weight::zero() ), @@ -570,7 +443,6 @@ fn multisig_1_of_3_works() { RuntimeOrigin::signed(1), 1, vec![2, 3], - None, hash, Weight::zero() ), @@ -581,7 +453,6 @@ fn multisig_1_of_3_works() { RuntimeOrigin::signed(1), 1, vec![2, 3], - None, call.clone(), Weight::zero() ), @@ -621,21 +492,13 @@ fn weight_check_works() { RuntimeOrigin::signed(1), 2, vec![2, 3], - None, call.clone(), Weight::zero() )); assert_eq!(Balances::free_balance(6), 0); assert_noop!( - Multisig::as_multi( - RuntimeOrigin::signed(2), - 2, - vec![1, 3], - Some(now()), - call, - Weight::zero() - ), + Multisig::as_multi(RuntimeOrigin::signed(2), 2, vec![1, 3], call, Weight::zero()), Error::::MaxWeightTooLow, ); }); @@ -659,7 +522,6 @@ fn multisig_handles_no_preimage_after_all_approve() { RuntimeOrigin::signed(1), 3, vec![2, 3], - None, hash, Weight::zero() )); @@ -667,7 +529,6 @@ fn multisig_handles_no_preimage_after_all_approve() { RuntimeOrigin::signed(2), 3, vec![1, 3], - Some(now()), hash, Weight::zero() )); @@ -675,20 +536,12 @@ fn multisig_handles_no_preimage_after_all_approve() { RuntimeOrigin::signed(3), 3, vec![1, 2], - Some(now()), hash, Weight::zero() )); assert_eq!(Balances::free_balance(6), 0); - assert_ok!(Multisig::as_multi( - RuntimeOrigin::signed(3), - 3, - vec![1, 2], - Some(now()), - call, - call_weight - )); + assert_ok!(Multisig::as_multi(RuntimeOrigin::signed(3), 3, vec![1, 2], call, call_weight)); assert_eq!(Balances::free_balance(6), 15); }); }