Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
91abd30
paged exposure skeleton
Ank4n Jan 4, 2023
7466ccc
insignificant changes
Ank4n Jan 4, 2023
da60bf8
impl paged exposure
Ank4n Jan 6, 2023
83815ad
paged as exposure function
Ank4n Jan 6, 2023
5289b57
add test for paging exposure
Ank4n Jan 6, 2023
d6ae0b7
remove commented fn
Ank4n Jan 7, 2023
a30f442
cargo fmt
Ank4n Jan 7, 2023
d7b2ca5
more fmt
Ank4n Jan 7, 2023
6962b18
remove unnecessary bound
Ank4n Jan 7, 2023
10a3b1d
add wrapper struct and refactor
Ank4n Jan 8, 2023
3059b9a
create temp fn that checks both ledger and new claimed_rewards
Ank4n Jan 8, 2023
a06462c
incomplete, paged extrinisic to pay stakers
Ank4n Jan 8, 2023
eb7d34e
fix names
Ank4n Jan 10, 2023
423c6ca
add page as 0 for payout stakers, tests failing currently.
Ank4n Jan 14, 2023
56fbe4e
fix double claim
Ank4n Jan 14, 2023
2ea2e6b
don't store claimed rewards for previous eras in the ledger
Ank4n Jan 14, 2023
e0af618
mark claimed_rewards in Staking ledger as legacy
Ank4n Jan 14, 2023
09f2384
test for not populating legacy claimed rewards anymore
Ank4n Jan 14, 2023
07d8725
test is not accurate since for prebonded era, there cannot be any rew…
Ank4n Jan 14, 2023
c962bf5
fmt
Ank4n Jan 14, 2023
8a55bb2
assert claimed rewards is populated
Ank4n Jan 14, 2023
fae1d0a
introduce struct ExposurePage
Ank4n Jan 15, 2023
1271d93
fmt
Ank4n Jan 15, 2023
1a317f0
some docs
Ank4n Jan 15, 2023
f7f654c
rename to into_pages
Ank4n Jan 16, 2023
0aef279
verify claimed rewards and era stakers is cleared
Ank4n Jan 16, 2023
08d7366
small comment
Ank4n Jan 16, 2023
53389c6
reuse MaxNominatorRewardedPerValidator
Ank4n Jan 16, 2023
97744d7
get to the same stage as 1st attempt
Ank4n Jan 18, 2023
57eb16f
pay all pages
Ank4n Jan 21, 2023
122ac2c
introduce invalid page error
Ank4n Jan 21, 2023
9d317b2
docs
Ank4n Jan 21, 2023
32fe2d0
test all nominators are paid
Ank4n Jan 21, 2023
30c46c8
all test pass
Ank4n Jan 21, 2023
c2906d0
cargo fmt
Ank4n Jan 21, 2023
68302f2
add more tests
Ank4n Jan 22, 2023
12627ff
cargo fmt
Ank4n Jan 22, 2023
bbcd5f7
fix benchmarks
Ank4n Jan 23, 2023
f766fee
fix clippy suggestion
Ank4n Jan 23, 2023
43cbe72
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Jan 23, 2023
95f1455
doc for split into pages
Ank4n Jan 23, 2023
261b8ee
remove unused from
Ank4n Jan 23, 2023
562873a
fix doc
Ank4n Jan 23, 2023
a4ae4f9
rename MaxNominatorRewardedPerValidator
Ank4n Jan 23, 2023
6aeb320
add weight for pages other than 0
Ank4n Jan 23, 2023
9cbd08f
fmt
Ank4n Jan 23, 2023
3ecc398
use n to make the compiler happy
Ank4n Jan 23, 2023
daf7609
fix minimum count
Ank4n Jan 23, 2023
fc51915
correct number of nominators
Ank4n Jan 23, 2023
85d3dc5
fix benchmark and commission payout
Ank4n Jan 23, 2023
651c489
refactor
Ank4n Jan 23, 2023
658ea36
verify is paid only once per era for their own stake
Ank4n Jan 23, 2023
63e03ce
fmt
Ank4n Jan 23, 2023
052ed04
fix rustdoc
Ank4n Jan 23, 2023
db1aa46
fmt
Ank4n Jan 23, 2023
6089eb5
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Jan 23, 2023
2d9994f
fix rust doc
Ank4n Jan 23, 2023
de4a529
handles errors
Ank4n Jan 25, 2023
cc82541
commission test
Ank4n Jan 25, 2023
66dfdc5
some things to discuss
Ank4n Jan 25, 2023
f5fa2dd
try state checks
Ank4n Jan 25, 2023
702d1bb
fmt
Ank4n Jan 25, 2023
519fe2c
Revert "try state checks"
Ank4n Jan 25, 2023
327ceb6
cleanup era overview in history depth eras
Ank4n Jan 25, 2023
5bffaa2
todos
Ank4n Jan 28, 2023
e59f658
remove store
Ank4n Jan 31, 2023
266ce38
[Revert] keep the same name of page size
Ank4n Jan 31, 2023
ce77135
consume exposure
Ank4n Jan 31, 2023
b435e87
some new definitions
Ank4n Feb 5, 2023
85f670b
new call to payout staekers by page
Ank4n Feb 5, 2023
2b5dbc6
fix benchmark
Ank4n Feb 5, 2023
091463b
keep payout_stakers backward compatible
Ank4n Feb 5, 2023
628c1fc
split exposure by ExposurePageSize
Ank4n Feb 5, 2023
3763e1a
return both overview and page
Ank4n Feb 5, 2023
d232f9d
fmt
Ank4n Feb 5, 2023
6a747f7
Update frame/staking/README.md
Ank4n Feb 6, 2023
a591104
introduce exposure extension
Ank4n Feb 6, 2023
00b300f
doc
Ank4n Feb 6, 2023
9399131
format
Ank4n Feb 6, 2023
353ebd3
pay commission in parts; failing tests
Ank4n Feb 6, 2023
02d7ff8
verify commission are paid across pages
Ank4n Feb 6, 2023
ca5d5f9
fmt
Ank4n Feb 6, 2023
345b55a
docs
Ank4n Feb 6, 2023
6a26931
fix test
Ank4n Feb 6, 2023
2ae47d9
only use one constant
Ank4n Feb 7, 2023
7a4ce0d
payout_stakers still work nicely
Ank4n Feb 7, 2023
1abcad4
remove todo
Ank4n Feb 7, 2023
3792f3f
benchmark against implicit page payout stakers since thats worst case
Ank4n Feb 7, 2023
2605e52
add a working draft of changelog
Ank4n Feb 8, 2023
4104eb3
small doc update
Ank4n Feb 8, 2023
c1635b0
have a way to disable pages
Ank4n Feb 12, 2023
2985543
fmt
Ank4n Feb 12, 2023
fe5746b
simple rename
Ank4n Feb 12, 2023
43582af
test for page size and count
Ank4n Feb 12, 2023
9fb0ad1
add the old test back
Ank4n Feb 12, 2023
df5054b
update changelog
Ank4n Feb 12, 2023
33362c6
todo tags
Ank4n Feb 15, 2023
773d240
some renames and config vals
Ank4n Feb 15, 2023
2bb73c6
do not iterate twice
Ank4n Feb 15, 2023
3a6d4a8
rename
Ank4n Feb 15, 2023
b994878
clean up
Ank4n Feb 15, 2023
42ad72a
pr fixes
Ank4n Feb 15, 2023
32cf960
fmt
Ank4n Feb 15, 2023
92c70d6
make it compile
Ank4n Feb 15, 2023
9559ec2
keep only config item for MaxExposurePageSize
Ank4n Feb 19, 2023
3539326
safe maths
Ank4n Feb 19, 2023
34f2b08
pr comment
Ank4n Feb 19, 2023
44bf53d
simplify next claimable page
Ank4n Feb 19, 2023
7fb8163
fix build
Ank4n Feb 19, 2023
16500bc
pr comments
Ank4n Feb 19, 2023
1ab67e5
clippy suggestion
Ank4n Feb 20, 2023
e326598
write a new eras stakers
Ank4n Feb 20, 2023
c147702
clean up page_count
Ank4n Feb 20, 2023
7a76750
more readable validator exposure calculation
Ank4n Feb 20, 2023
1a56992
fmt
Ank4n Feb 20, 2023
5191eab
do not use ErasStakers anymore
Ank4n Feb 20, 2023
05c3206
defensive unwrap for appending nominator pages to eras stakers
Ank4n Feb 20, 2023
5bdcbc7
better fn naming
Ank4n Feb 20, 2023
48aef5f
fmt
Ank4n Feb 20, 2023
c4e3a37
move logic to combine all exposure into EraInfo
Ank4n Feb 20, 2023
6fc1d90
remove useless getters
Ank4n Feb 20, 2023
395e381
bounded ExposureOverview
Ank4n Feb 20, 2023
1833898
remove unused fn
Ank4n Feb 20, 2023
9df6956
ErasStakers backward compatible test
Ank4n Feb 22, 2023
75fb59b
fmt
Ank4n Feb 22, 2023
6e59335
update changelog
Ank4n Feb 22, 2023
c600139
Use NMap for ErasStakersPaged
Ank4n Feb 22, 2023
c461209
doc update
Ank4n Feb 22, 2023
c3b40bb
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Feb 22, 2023
f9235c0
rename to consistent names
Ank4n Feb 22, 2023
b4abd8a
some docs
Ank4n Feb 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ parameter_types! {
pub const BondingDuration: sp_staking::EraIndex = 24 * 28;
pub const SlashDeferDuration: sp_staking::EraIndex = 24 * 7; // 1/4 the bonding duration.
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const MaxExposurePageSize: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub OffchainRepeat: BlockNumber = 5;
pub HistoryDepth: u32 = 84;
Expand Down Expand Up @@ -571,7 +571,8 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type MaxExposurePageSize = MaxExposurePageSize;
type MaxExposurePageCount = ConstU32<1>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
Expand All @@ -594,7 +595,7 @@ impl pallet_fast_unstake::Config for Runtime {
type Staking = Staking;
type MaxErasToCheckPerBlock = ConstU32<1>;
#[cfg(feature = "runtime-benchmarks")]
type MaxBackersPerValidator = MaxNominatorRewardedPerValidator;
type MaxExposurePageSize = MaxExposurePageSize;
type WeightInfo = ();
}

Expand Down
3 changes: 2 additions & 1 deletion frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type UnixTime = pallet_timestamp::Pallet<Test>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageSize = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
Expand Down
8 changes: 4 additions & 4 deletions frame/babe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ fn report_equivocation_current_session_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(1, validator),
Staking::eras_stakers(1, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -478,7 +478,7 @@ fn report_equivocation_current_session_works() {
assert_eq!(Balances::total_balance(&offending_validator_id), 10_000_000 - 10_000);
assert_eq!(Staking::slashable_balance_of(&offending_validator_id), 0);
assert_eq!(
Staking::eras_stakers(2, offending_validator_id),
Staking::eras_stakers(2, &offending_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);

Expand All @@ -491,7 +491,7 @@ fn report_equivocation_current_session_works() {
assert_eq!(Balances::total_balance(validator), 10_000_000);
assert_eq!(Staking::slashable_balance_of(validator), 10_000);
assert_eq!(
Staking::eras_stakers(2, validator),
Staking::eras_stakers(2, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -550,7 +550,7 @@ fn report_equivocation_old_session_works() {
assert_eq!(Balances::total_balance(&offending_validator_id), 10_000_000 - 10_000);
assert_eq!(Staking::slashable_balance_of(&offending_validator_id), 0);
assert_eq!(
Staking::eras_stakers(3, offending_validator_id),
Staking::eras_stakers(3, &offending_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);
})
Expand Down
3 changes: 2 additions & 1 deletion frame/beefy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type UnixTime = pallet_timestamp::Pallet<Test>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageSize = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
Expand Down
12 changes: 6 additions & 6 deletions frame/beefy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(1, validator),
Staking::eras_stakers(1, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -315,7 +315,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Balances::total_balance(&equivocation_validator_id), 10_000_000 - 10_000);
assert_eq!(Staking::slashable_balance_of(&equivocation_validator_id), 0);
assert_eq!(
Staking::eras_stakers(2, equivocation_validator_id),
Staking::eras_stakers(2, &equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);

Expand All @@ -329,7 +329,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(2, validator),
Staking::eras_stakers(2, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -365,7 +365,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(2, validator),
Staking::eras_stakers(2, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -399,7 +399,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Balances::total_balance(&equivocation_validator_id), 10_000_000 - 10_000);
assert_eq!(Staking::slashable_balance_of(&equivocation_validator_id), 0);
assert_eq!(
Staking::eras_stakers(3, equivocation_validator_id),
Staking::eras_stakers(3, &equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);

Expand All @@ -413,7 +413,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(3, validator),
Staking::eras_stakers(3, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down
2 changes: 1 addition & 1 deletion frame/fast-unstake/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn setup_staking<T: Config>(v: u32, until: EraIndex) {
.collect::<Vec<_>>();

for era in 0..=until {
let others = (0..T::MaxBackersPerValidator::get())
let others = (0..T::MaxExposurePageSize::get())
.map(|s| {
let who = frame_benchmarking::account::<T::AccountId>("nominator", era, s);
let value = ed;
Expand Down
2 changes: 1 addition & 1 deletion frame/fast-unstake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub mod pallet {

/// Use only for benchmarking.
#[cfg(feature = "runtime-benchmarks")]
type MaxBackersPerValidator: Get<u32>;
type MaxExposurePageSize: Get<u32>;
}

/// The current "head of the queue" being unstaked.
Expand Down
5 changes: 3 additions & 2 deletions frame/fast-unstake/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ impl pallet_staking::Config for Runtime {
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = ();
type HistoryDepth = ConstU32<84>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageSize = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type OffendingValidatorsThreshold = ();
type ElectionProvider = MockElection;
type GenesisElectionProvider = Self::ElectionProvider;
Expand Down Expand Up @@ -187,7 +188,7 @@ impl fast_unstake::Config for Runtime {
type WeightInfo = ();
type MaxErasToCheckPerBlock = ConstU32<16>;
#[cfg(feature = "runtime-benchmarks")]
type MaxBackersPerValidator = ConstU32<128>;
type MaxExposurePageSize = ConstU32<128>;
}

type Block = frame_system::mocking::MockBlock<Runtime>;
Expand Down
3 changes: 2 additions & 1 deletion frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type UnixTime = pallet_timestamp::Pallet<Test>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageSize = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
Expand Down
12 changes: 6 additions & 6 deletions frame/grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(1, validator),
Staking::eras_stakers(1, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -372,7 +372,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Balances::total_balance(&equivocation_validator_id), 10_000_000 - 10_000);
assert_eq!(Staking::slashable_balance_of(&equivocation_validator_id), 0);
assert_eq!(
Staking::eras_stakers(2, equivocation_validator_id),
Staking::eras_stakers(2, &equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);

Expand All @@ -386,7 +386,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(2, validator),
Staking::eras_stakers(2, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -418,7 +418,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(2, validator),
Staking::eras_stakers(2, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down Expand Up @@ -451,7 +451,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Staking::slashable_balance_of(&equivocation_validator_id), 0);

assert_eq!(
Staking::eras_stakers(3, equivocation_validator_id),
Staking::eras_stakers(3, &equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
);

Expand All @@ -465,7 +465,7 @@ fn report_equivocation_old_set_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);

assert_eq!(
Staking::eras_stakers(3, validator),
Staking::eras_stakers(3, &validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
);
}
Expand Down
3 changes: 2 additions & 1 deletion frame/nomination-pools/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = ();
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = ();
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type MaxExposurePageSize = ConstU32<64>;
type OffendingValidatorsThreshold = ();
type ElectionProvider =
frame_election_provider_support::NoElection<(AccountId, BlockNumber, Staking, ())>;
Expand Down
3 changes: 2 additions & 1 deletion frame/nomination-pools/test-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = ();
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = ();
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type MaxExposurePageSize = ConstU32<64>;
type OffendingValidatorsThreshold = ();
type ElectionProvider =
frame_election_provider_support::NoElection<(AccountId, BlockNumber, Staking, ())>;
Expand Down
3 changes: 2 additions & 1 deletion frame/offences/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type MaxExposurePageSize = ConstU32<64>;
type OffendingValidatorsThreshold = ();
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
type GenesisElectionProvider = Self::ElectionProvider;
Expand Down
2 changes: 1 addition & 1 deletion frame/root-offences/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub mod pallet {
.clone()
.into_iter()
.map(|(o, _)| OffenceDetails::<T> {
offender: (o.clone(), Staking::<T>::eras_stakers(now, o)),
offender: (o.clone(), Staking::<T>::eras_stakers(now, &o)),
reporters: vec![],
})
.collect())
Expand Down
3 changes: 2 additions & 1 deletion frame/root-offences/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type MaxExposurePageSize = ConstU32<64>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
type GenesisElectionProvider = Self::ElectionProvider;
Expand Down
3 changes: 2 additions & 1 deletion frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxExposurePageCount = ConstU32<1>;
type MaxExposurePageSize = ConstU32<64>;
type OffendingValidatorsThreshold = ();
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
type GenesisElectionProvider = Self::ElectionProvider;
Expand Down
27 changes: 27 additions & 0 deletions frame/staking/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is loosely based
on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). We maintain a
single integer version number for staking pallet to keep track of all storage
migrations.

## [14]

### Added

- New item `ErasStakersPaged` that keeps up to `MaxExposurePageSize`
individual nominator exposures by era, validator and page.
- New item `ErasStakersOverview` complementary to `ErasStakersPaged` which keeps
state of own and total stake of the validator across pages.
- New item `ClaimedRewards` to support paged rewards payout.

### Deprecated

- `ErasStakersClipped` is deprecated and may be removed after 84 eras.
- `ErasStakers` is deprecated and may be removed after 84 eras.
- Field `claimed_rewards` in item `Ledger` is renamed
to `legacy_claimed_rewards` and may be removed after 84 eras.

[14]: https://github.com/paritytech/substrate/pull/13059
8 changes: 4 additions & 4 deletions frame/staking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ An account can become a nominator via the [`nominate`](https://docs.rs/pallet-st
The **reward and slashing** procedure is the core of the Staking module, attempting to _embrace
valid behavior_ while _punishing any misbehavior or lack of availability_.

Rewards must be claimed for each era before it gets too old by `$HISTORY_DEPTH` using the
Rewards must be claimed for each era before it gets too old by [`HistoryDeth`] using the
`payout_stakers` call. Any account can call `payout_stakers`, which pays the reward to the
validator as well as its nominators. Only the [`Config::MaxNominatorRewardedPerValidator`]
biggest stakers can claim their reward. This is to limit the i/o cost to mutate storage for each
nominator's account.
validator as well as its nominators. Rewards are paged to maximum of [`Config::MaxExposurePageSize`]
nominators per call. Each page of staker payout needs to be called separately to ensure all nominators are
paid. This is to limit the i/o cost to mutate storage for each nominator's account.

Slashing can occur at any point in time, once misbehavior is reported. Once slashing is
determined, a value is deducted from the balance of the validator and all the nominators who
Expand Down
Loading