Repository: paritytech/substrate
File: frame/alliance/src/lib.rs (Rust)

Code before:
			let proposor = ensure_signed(origin)?;
			ensure!(Self::has_voting_rights(&proposor), Error::<T, I>::NoVotingRights);

			T::ProposalProvider::propose_proposal(proposor, threshold, proposal, length_bound)?;
			Ok(())
		}

		/// Add an aye or nay vote for the sender to the given proposal.
		///
		/// Must be called by a Fellow.
		#[pallet::call_index(1)]
		#[pallet::weight(T::WeightInfo::vote(T::MaxFellows::get()))]
		pub fn vote(
			origin: OriginFor<T>,
			proposal: T::Hash,
			#[pallet::compact] index: ProposalIndex,
			approve: bool,
		) -> DispatchResult {
			let who = ensure_signed(origin)?;
			ensure!(Self::has_voting_rights(&who), Error::<T, I>::NoVotingRights);

			T::ProposalProvider::vote_proposal(who, proposal, index, approve)?;
			Ok(())
		}

		// Index 2 was close_old_weight

		/// Initialize the Alliance, onboard fellows and allies.
		///
		/// The Alliance must be empty, and the call must provide some founding members.
		///
		/// Must be called by the Root origin.
		#[pallet::call_index(3)]
		#[pallet::weight(T::WeightInfo::init_members(
			fellows.len() as u32,
			allies.len() as u32,
		))]
		pub fn init_members(
			origin: OriginFor<T>,
			fellows: Vec<T::AccountId>,
			allies: Vec<T::AccountId>,
		) -> DispatchResult {
			ensure_root(origin)?;

			ensure!(!fellows.is_empty(), Error::<T, I>::FellowsMissing);
			ensure!(!Self::is_initialized(), Error::<T, I>::AllianceAlreadyInitialized);

			let mut fellows: BoundedVec<T::AccountId, T::MaxMembersCount> =
				fellows.try_into().map_err(|_| Error::<T, I>::TooManyMembers)?;
			let mut allies: BoundedVec<T::AccountId, T::MaxMembersCount> =
				allies.try_into().map_err(|_| Error::<T, I>::TooManyMembers)?;

Review comment (suggestion):
```suggestion
		// Index 2 was `close_old_weight`; it was removed due to weights v1 deprecation.
```

Code after:
			let proposor = ensure_signed(origin)?;
			ensure!(Self::has_voting_rights(&proposor), Error::<T, I>::NoVotingRights);

			T::ProposalProvider::propose_proposal(proposor, threshold, proposal, length_bound)?;
			Ok(())
		}

		/// Add an aye or nay vote for the sender to the given proposal.
		///
		/// Must be called by a Fellow.
		#[pallet::call_index(1)]
		#[pallet::weight(T::WeightInfo::vote(T::MaxFellows::get()))]
		pub fn vote(
			origin: OriginFor<T>,
			proposal: T::Hash,
			#[pallet::compact] index: ProposalIndex,
			approve: bool,
		) -> DispatchResult {
			let who = ensure_signed(origin)?;
			ensure!(Self::has_voting_rights(&who), Error::<T, I>::NoVotingRights);

			T::ProposalProvider::vote_proposal(who, proposal, index, approve)?;
			Ok(())
		}

		// Index 2 was `close_old_weight`; it was removed due to weights v1 deprecation.

		/// Initialize the Alliance, onboard fellows and allies.
		///
		/// The Alliance must be empty, and the call must provide some founding members.
		///
		/// Must be called by the Root origin.
		#[pallet::call_index(3)]
		#[pallet::weight(T::WeightInfo::init_members(
			fellows.len() as u32,
			allies.len() as u32,
		))]
		pub fn init_members(
			origin: OriginFor<T>,
			fellows: Vec<T::AccountId>,
			allies: Vec<T::AccountId>,
		) -> DispatchResult {
			ensure_root(origin)?;

			ensure!(!fellows.is_empty(), Error::<T, I>::FellowsMissing);
			ensure!(!Self::is_initialized(), Error::<T, I>::AllianceAlreadyInitialized);

			let mut fellows: BoundedVec<T::AccountId, T::MaxMembersCount> =
				fellows.try_into().map_err(|_| Error::<T, I>::TooManyMembers)?;
			let mut allies: BoundedVec<T::AccountId, T::MaxMembersCount> =
				allies.try_into().map_err(|_| Error::<T, I>::TooManyMembers)?;