-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Goal The goal of this PR is to implement a really basic version of the StakingRewardsProvider in the Capacity pallet and in the test mock, neither of which is actively used. Closes #1572 # Discussion Does not include anything to do with setting and storing RewardPoolInfo when each new Era starts. # Checklist - [x] Design doc(s) updated - [x] Tests added
- Loading branch information
1 parent
cfde108
commit 6bbbcfc
Showing
11 changed files
with
254 additions
and
97 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,25 +1,23 @@ | ||
use super::mock::*; | ||
use crate::{ | ||
tests::testing_utils::{run_to_block, system_run_to_block}, | ||
Config, CurrentEraInfo, Error, Event, RewardEraInfo, | ||
CurrentEraInfo, RewardEraInfo, | ||
}; | ||
|
||
use frame_support::traits::Get; | ||
|
||
#[test] | ||
fn start_new_era_if_needed() { | ||
new_test_ext().execute_with(|| { | ||
CurrentEraInfo::<Test>::set(RewardEraInfo { current_era: 1, era_start: 0 }); | ||
CurrentEraInfo::<Test>::set(RewardEraInfo { era_index: 1, started_at: 0 }); | ||
system_run_to_block(9); | ||
run_to_block(10); | ||
let mut current_era_info = CurrentEraInfo::<Test>::get(); | ||
assert_eq!(current_era_info.current_era, 2u32); | ||
assert_eq!(current_era_info.era_start, 10u32); | ||
assert_eq!(current_era_info.era_index, 2u32); | ||
assert_eq!(current_era_info.started_at, 10u32); | ||
|
||
system_run_to_block(19); | ||
run_to_block(20); | ||
current_era_info = CurrentEraInfo::<Test>::get(); | ||
assert_eq!(current_era_info.current_era, 3u32); | ||
assert_eq!(current_era_info.era_start, 20u32); | ||
assert_eq!(current_era_info.era_index, 3u32); | ||
assert_eq!(current_era_info.started_at, 20u32); | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
pub mod capacity_details_tests; | ||
pub mod epochs_tests; | ||
mod capacity_details_tests; | ||
mod epochs_tests; | ||
mod eras_tests; | ||
pub mod mock; | ||
pub mod other_tests; | ||
pub mod replenishment_tests; | ||
pub mod stake_and_deposit_tests; | ||
pub mod staking_account_details_tests; | ||
pub mod staking_target_details_tests; | ||
pub mod testing_utils; | ||
pub mod unstaking_tests; | ||
pub mod withdraw_unstaked_tests; | ||
pub mod withdrawal_tests; | ||
mod other_tests; | ||
mod replenishment_tests; | ||
mod rewards_provider_tests; | ||
mod stake_and_deposit_tests; | ||
mod staking_account_details_tests; | ||
mod staking_target_details_tests; | ||
mod testing_utils; | ||
mod unstaking_tests; | ||
mod withdraw_unstaked_tests; | ||
mod withdrawal_tests; |
Oops, something went wrong.