@@ -57,7 +57,7 @@ use frame_support::{
5757 traits:: {
5858 Backing , ChangeMembers , EnsureOrigin , Get , GetBacking , InitializeMembers , StorageVersion ,
5959 } ,
60- weights:: { OldWeight , Weight } ,
60+ weights:: Weight ,
6161} ;
6262
6363#[ cfg( test) ]
@@ -620,20 +620,17 @@ pub mod pallet {
620620 . max( T :: WeightInfo :: close_early_disapproved( m, p2) )
621621 . max( T :: WeightInfo :: close_approved( b, m, p2) )
622622 . max( T :: WeightInfo :: close_disapproved( m, p2) )
623- . saturating_add( p1. into ( ) )
623+ . saturating_add( p1)
624624 } ,
625625 DispatchClass :: Operational
626626 ) ) ]
627- #[ allow( deprecated) ]
628- #[ deprecated( note = "1D weight is used in this extrinsic, please migrate to `close`" ) ]
629- pub fn close_old_weight (
627+ pub fn close (
630628 origin : OriginFor < T > ,
631629 proposal_hash : T :: Hash ,
632630 #[ pallet:: compact] index : ProposalIndex ,
633- #[ pallet:: compact] proposal_weight_bound : OldWeight ,
631+ #[ pallet:: compact] proposal_weight_bound : Weight ,
634632 #[ pallet:: compact] length_bound : u32 ,
635633 ) -> DispatchResultWithPostInfo {
636- let proposal_weight_bound: Weight = proposal_weight_bound. into ( ) ;
637634 let _ = ensure_signed ( origin) ?;
638635
639636 Self :: do_close ( proposal_hash, index, proposal_weight_bound, length_bound)
@@ -662,64 +659,6 @@ pub mod pallet {
662659 let proposal_count = Self :: do_disapprove_proposal ( proposal_hash) ;
663660 Ok ( Some ( T :: WeightInfo :: disapprove_proposal ( proposal_count) ) . into ( ) )
664661 }
665-
666- /// Close a vote that is either approved, disapproved or whose voting period has ended.
667- ///
668- /// May be called by any signed account in order to finish voting and close the proposal.
669- ///
670- /// If called before the end of the voting period it will only close the vote if it is
671- /// has enough votes to be approved or disapproved.
672- ///
673- /// If called after the end of the voting period abstentions are counted as rejections
674- /// unless there is a prime member set and the prime member cast an approval.
675- ///
676- /// If the close operation completes successfully with disapproval, the transaction fee will
677- /// be waived. Otherwise execution of the approved operation will be charged to the caller.
678- ///
679- /// + `proposal_weight_bound`: The maximum amount of weight consumed by executing the closed
680- /// proposal.
681- /// + `length_bound`: The upper bound for the length of the proposal in storage. Checked via
682- /// `storage::read` so it is `size_of::<u32>() == 4` larger than the pure length.
683- ///
684- /// # <weight>
685- /// ## Weight
686- /// - `O(B + M + P1 + P2)` where:
687- /// - `B` is `proposal` size in bytes (length-fee-bounded)
688- /// - `M` is members-count (code- and governance-bounded)
689- /// - `P1` is the complexity of `proposal` preimage.
690- /// - `P2` is proposal-count (code-bounded)
691- /// - DB:
692- /// - 2 storage reads (`Members`: codec `O(M)`, `Prime`: codec `O(1)`)
693- /// - 3 mutations (`Voting`: codec `O(M)`, `ProposalOf`: codec `O(B)`, `Proposals`: codec
694- /// `O(P2)`)
695- /// - any mutations done while executing `proposal` (`P1`)
696- /// - up to 3 events
697- /// # </weight>
698- #[ pallet:: weight( (
699- {
700- let b = * length_bound;
701- let m = T :: MaxMembers :: get( ) ;
702- let p1 = * proposal_weight_bound;
703- let p2 = T :: MaxProposals :: get( ) ;
704- T :: WeightInfo :: close_early_approved( b, m, p2)
705- . max( T :: WeightInfo :: close_early_disapproved( m, p2) )
706- . max( T :: WeightInfo :: close_approved( b, m, p2) )
707- . max( T :: WeightInfo :: close_disapproved( m, p2) )
708- . saturating_add( p1)
709- } ,
710- DispatchClass :: Operational
711- ) ) ]
712- pub fn close (
713- origin : OriginFor < T > ,
714- proposal_hash : T :: Hash ,
715- #[ pallet:: compact] index : ProposalIndex ,
716- proposal_weight_bound : Weight ,
717- #[ pallet:: compact] length_bound : u32 ,
718- ) -> DispatchResultWithPostInfo {
719- let _ = ensure_signed ( origin) ?;
720-
721- Self :: do_close ( proposal_hash, index, proposal_weight_bound, length_bound)
722- }
723662 }
724663}
725664
0 commit comments