Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weights/runtime mock/benchmarking to vesting-manager pallet #177

Open
RustNinja opened this issue Mar 18, 2023 · 1 comment
Open

Add weights/runtime mock/benchmarking to vesting-manager pallet #177

RustNinja opened this issue Mar 18, 2023 · 1 comment
Labels
type:chore Maintenance tasks

Comments

@RustNinja
Copy link
Contributor

remove_vesting_schedule extrinsic uses hardcoded weighs

#[pallet::weight(10_000_000)]

#[pallet::call]
	impl<T: Config> Pallet<T> {
        #[pallet::call_index(0)]
        #[pallet::weight(10_000_000)]
        pub fn remove_vesting_schedule(
	        origin: OriginFor<T>,
	        who: AccountIdLookupOf<T>,
	        schedule_index: u32,
        ) -> DispatchResultWithPostInfo {
	        ensure_root(origin)?;
	        let who = T::Lookup::lookup(who)?;
	        T::VestingSchedule::remove_vesting_schedule(&who, schedule_index)?;
        
	        Self::deposit_event(Event::VestingScheduleRemoved { who, schedule_index });
        
	        // waive the fee
	        Ok(Pays::No.into())
        }
}

To automatically regenerate weight for extrinsic need :

  • add mock.rs
  • add benchmarking.rs
  • add pallet to runtime
  • build runtime with benchmarking feature
  • run ./target/release/spacewalk-standalone benchmark pallet to regenerate weights.
@ebma ebma added the priority:low Do it some day label Mar 20, 2023
@TorstenStueber
Copy link
Member

Moved to icebox.

@TorstenStueber TorstenStueber added type:chore Maintenance tasks and removed priority:low Do it some day labels Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:chore Maintenance tasks
Projects
Status: Backlog
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants