-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from 5ire-tech/fix/pallet-reward
fix: added benchmarking and weights.rs
- Loading branch information
Showing
16 changed files
with
333 additions
and
377 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#![cfg(feature = "runtime-benchmarks")] | ||
use super::*; | ||
use frame_benchmarking::whitelisted_caller; | ||
#[allow(unused)] | ||
use crate::Pallet as Reward; | ||
use frame_benchmarking::v2::*; | ||
use frame_system::RawOrigin as SystemOrigin; | ||
use sp_std::vec; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn get_rewards() { | ||
let caller: T::AccountId = whitelisted_caller(); | ||
let validator: T::AccountId = whitelisted_caller(); | ||
let balance : T::Balance = 5000u128.into(); | ||
ValidatorRewardAccounts::<T>::insert(validator.clone(),balance); | ||
|
||
#[extrinsic_call] | ||
get_rewards(SystemOrigin::Signed(caller), validator.clone()); | ||
|
||
assert!(ValidatorRewardAccounts::<T>::contains_key(&validator.clone())); | ||
} | ||
|
||
impl_benchmark_test_suite!(Reward, crate::mock::new_test_ext(), crate::mock::Test); | ||
} |
Oops, something went wrong.