-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Unlimited number of nominators eligible for Rewards payout #13059
Changes from 1 commit
acab2d1
256ca4c
8e6db42
0cabf55
00bc992
f65d7b6
e7f299c
b3f58d6
661fab0
06d83fb
02e3ffc
c924bfc
108cd16
e14eab3
70b8c7f
484dad8
eac23e0
1cd79ff
4fdc2df
c339ca5
773d91c
f50ee11
309c737
4f4466c
7f4aa5b
d64d28e
da53a27
dd60ba7
b19193a
e3569bf
99913b3
cc6be46
6623056
90e7a9d
cf6ee88
b86e3f8
1072147
9f4ea04
42429e9
4260bca
eb0709b
ec6ae58
03c53a0
f87a862
c94ce9c
554bb7c
1aed1b5
18d2d1d
b14319e
0fa0195
2d5082d
ce67004
c330866
99d19b7
fc2e091
2adf060
26efca4
d7ab5b7
e77bd87
6bc015f
514a851
076a0c1
cf0654b
94a6dd5
e49d721
2f40eea
455294b
4e2b482
416ee7e
478b473
ddfcd18
75fb102
fed66ce
aeec825
a85e451
b832130
5d215c6
d7e4a56
3ec6576
dca583b
b0e04e7
2d35736
599cd6e
4ff092b
0d47b62
f88a55e
da40ff1
c9310e1
4d02469
369365e
c6c490d
6453a4a
ff8a71f
ca58b7b
8866597
f28e182
ab79cd3
50690ff
664c374
bf41253
caeb781
3b9acbf
9ab601a
7f24aa1
1bf6161
21dff20
171d43b
263894b
78f94bc
806e656
e826056
bd420b3
5ae9ee8
641d112
0f76c59
37d46b6
406d3b8
bfdd143
f2fd8d4
58eef2c
b107674
4123495
23fb86b
be6a11c
4b23fdb
821ad7e
826cfb2
71432c2
bfe5a7d
02703c7
b79e231
77ba7df
ff965e2
8a608f9
fef9db6
a7bb9ed
dd6989c
64aa36b
397e5d2
73630b4
cb59ca7
a82b0bd
e8ebbbc
9a959e4
f712e35
dfe8a98
e2bf7cf
d08ffd5
d79d897
5a1f446
08d60ff
b929439
7df30f6
4a415e7
8544412
04133ab
0ce2bbd
ed8c993
2634403
5f5abad
9ad77cb
7dfb3e8
fd2f6fb
45ad6e1
d49de8b
c67e8bd
06627f0
89820f9
66c8fe1
b5fa46e
12ed262
14bc8b3
6ac7961
af01a1f
b5190b5
21c20f2
2aa08d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -679,20 +679,40 @@ pub mod pallet { | |
| era: EraIndex, | ||
| validator: &T::AccountId, | ||
| page: PageIndex, | ||
| ) -> Exposure<T::AccountId, BalanceOf<T>> { | ||
| ) -> (ExposureOverview<BalanceOf<T>>, ExposurePage<T::AccountId, BalanceOf<T>>) { | ||
| return match <ErasStakersPaged<T>>::get(era, (validator, page)) { | ||
| // only return clipped exposure if page zero and no paged exposure entry | ||
| None if page == 0 => <ErasStakersClipped<T>>::get(&era, validator), | ||
| None if page == 0 => Self::get_clipped_exposure_as_page(era, validator), | ||
| Some(exposure_page) => { | ||
| let overview = <ErasStakersOverview<T>>::get(&era, validator); | ||
| // own stake is included only once in the first page. | ||
| let own = if page == 0 { overview.own } else { Zero::zero() }; | ||
| Exposure { total: overview.total, own, others: exposure_page.others } | ||
| (ExposureOverview { | ||
| own, | ||
| ..overview | ||
| }, exposure_page) | ||
| }, | ||
| _ => Default::default(), | ||
| } | ||
| } | ||
|
|
||
| /// Get clipped exposure and convert it as `ExposurePage`. | ||
| fn get_clipped_exposure_as_page( | ||
| era: EraIndex, | ||
| validator: &T::AccountId, | ||
| ) -> (ExposureOverview<BalanceOf<T>>, ExposurePage<T::AccountId, BalanceOf<T>>) { | ||
| let exposure = <ErasStakersClipped<T>>::get(&era, validator); | ||
| ( | ||
| ExposureOverview { | ||
| total: exposure.total, | ||
| own: exposure.own, | ||
| nominator_count: exposure.others.len() as u32, | ||
| page_count: 1, | ||
| }, | ||
| ExposurePage { page_total: exposure.total, others: exposure.others }, | ||
| ) | ||
| } | ||
|
|
||
| /// Returns the number of pages of exposure a validator has for the given era. | ||
| /// | ||
| /// This will always return at minimum one count of exposure to be backward compatible to | ||
|
|
@@ -785,8 +805,7 @@ pub mod pallet { | |
| .unwrap_or_else(|| T::MaxExposurePageSize::get()) | ||
| .clamp(1, T::MaxExposurePageSize::get()); | ||
|
|
||
| let (exposure_overview, exposure_pages) = | ||
| exposure.into_pages(page_size); | ||
| let (exposure_overview, exposure_pages) = exposure.into_pages(page_size); | ||
|
Contributor
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. based on the code before, I would have expected this function to return a Or else, we can make
Contributor
Author
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. I feel I get what you meant but not too sure. The The weird part probably is to assume |
||
|
|
||
| <ErasStakersOverview<T>>::insert(era, &validator, &exposure_overview); | ||
| exposure_pages.iter().enumerate().for_each(|(page, paged_exposure)| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.