-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[NPoS] Unlimited number of nominators eligible for Rewards payout #13498
base: master
Are you sure you want to change the base?
Changes from 37 commits
15805ce
bb6a79b
1e40f4d
ac43c26
09e9147
1eab166
bb60f7b
1c88aa2
98550eb
fb80ae2
494bbde
f2d06ea
5141b67
f1b90a8
7d0c66b
6308d43
69737f0
26a2e5b
cd01ee0
4e30f22
3e2fed1
06d6bfe
10b8b34
6ea4f57
d824e92
6b6a319
910dfe3
b0c7c36
832353f
7dfadbc
2ba18e5
9c5d405
8abc250
f497d19
70425f8
a0f64c4
c9b5c4c
2354bd7
f12a75a
ae28d84
f76dbcf
f4dd55d
d99769d
d939789
b2eed7b
b776386
5f82274
3ccb0af
2865046
8c013e7
809b47e
2a14298
fe09ecd
2023135
32a507e
6b5fca1
945f64d
fa02b72
a4884b2
84368c5
77fece6
2fa9227
98ffc9f
9275f3e
559e1e2
d73c7a1
dd70800
746049e
1a4963b
916dde2
53ef105
62835ef
0d7b4a8
1efa770
ef07f43
60785b7
99d595f
3bd8768
12a7566
fcd336f
12af748
338f69a
ac63a5f
954a3a6
38827d0
a1a06b5
307cec8
0875d0b
776adab
ef8962a
8b6ae95
3451985
e47ecde
df1f1ae
829f0d7
02c8757
bd55f14
981de06
de0528b
28afcb8
f6b8cbd
4051fde
cbf6e1c
c40cf54
d6f9693
7674d26
7071c60
3ddf325
81c7234
5f07634
858140e
29f800b
e1bbd95
4e0c8b6
79e3fb0
4d51ae0
989b391
ec0694b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -549,7 +549,6 @@ 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 OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); | ||||||||||||||
pub OffchainRepeat: BlockNumber = 5; | ||||||||||||||
pub HistoryDepth: u32 = 84; | ||||||||||||||
|
@@ -582,7 +581,8 @@ impl pallet_staking::Config for Runtime { | |||||||||||||
type SessionInterface = Self; | ||||||||||||||
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>; | ||||||||||||||
type NextNewSession = Session; | ||||||||||||||
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; | ||||||||||||||
type MaxExposurePageSize = ConstU32<256>; | ||||||||||||||
type MaxExposurePageCount = ConstU32<1>; | ||||||||||||||
type OffendingValidatorsThreshold = OffendingValidatorsThreshold; | ||||||||||||||
type ElectionProvider = ElectionProviderMultiPhase; | ||||||||||||||
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>; | ||||||||||||||
|
@@ -604,8 +604,6 @@ impl pallet_fast_unstake::Config for Runtime { | |||||||||||||
type Currency = Balances; | ||||||||||||||
type Staking = Staking; | ||||||||||||||
type MaxErasToCheckPerBlock = ConstU32<1>; | ||||||||||||||
#[cfg(feature = "runtime-benchmarks")] | ||||||||||||||
type MaxBackersPerValidator = MaxNominatorRewardedPerValidator; | ||||||||||||||
type WeightInfo = (); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
@@ -2049,10 +2047,18 @@ impl_runtime_apis! { | |||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
impl pallet_staking_runtime_api::StakingApi<Block, Balance> for Runtime { | ||||||||||||||
impl pallet_staking_runtime_api::StakingApi<Block, Balance, AccountId> for Runtime { | ||||||||||||||
fn nominations_quota(balance: Balance) -> u32 { | ||||||||||||||
Staking::api_nominations_quota(balance) | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
fn eras_stakers(era: sp_staking::EraIndex, account: AccountId) -> pallet_staking::Exposure<AccountId, Balance> { | ||||||||||||||
Staking::api_eras_stakers(era, account) | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
fn era_page_count(era: sp_staking::EraIndex, account: AccountId) -> sp_staking::PageIndex { | ||||||||||||||
Staking::api_era_page_count(era, account) | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This API call is only for validator exposures so the naming could reflect this and be a bit more intuitive.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The storage item that page corresponds to is called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to eras_stakers_page_count to keep in line with how storage items are named. |
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
impl sp_consensus_babe::BabeApi<Block> for Runtime { | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would there be any issues making these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An update, I want to bound EraStakersPaged and ClaimedRewards with these two values and boundedVec needs to be bounded by a u32 value. I will undo the changes to make it u16. |
||
type OffendingValidatorsThreshold = OffendingValidatorsThreshold; | ||
type NextNewSession = Session; | ||
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>; | ||
|
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. | ||
|
||
## [v14] | ||
|
||
### 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. | ||
|
||
[v14]: https://github.com/paritytech/substrate/pull/13498 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now's your last time to ask yourself: is the (legacy) name
eras_stakers
actually good? shoudl we not use the oppurtunity and rename it to something better? :DThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion here.
On one hand, since this is meant for backward compatibility and all similar storage items are named similarly (eras_stakers, eras_stakers_paged, eras_stakers_overview ...), it makes sense to keep a similar name.
We could call it
eras_exposure
as well but then we are exposing a new term (exposure) outside staking world which may be just an internal concept.Eras Stakers
might not be such a bad public name (staker info for the era).Do you have a name suggestion?