-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Store voters in unsorted bags to get good stake iteration properties #9081
Changes from 1 commit
a549691
bdfabd2
450c344
21e79ee
f4998e2
8960daa
f9d061d
1e7dfd9
7f6460f
c6bcc76
82154dd
294cd99
9787daf
a857f59
1a50bba
5858569
721c2cb
92220ec
033d87f
18c8eef
9bd6682
7a74fcf
e0ae1c0
6699654
871b525
f221404
976c41b
37e666a
b75b55b
1cb9e26
c03d6ea
27cbb79
247f2a1
b650861
9b53d4c
ab048c6
5583ae4
ae67ae7
efe15e2
fb5431e
ee7959d
f58bb3a
1cd8730
3c92eda
22bc615
4092fa8
2182abe
472baa9
f1e7fe7
16e4774
2a4ebf7
cc6d0df
88195fe
70848ea
b630321
8ce3bc0
202def0
4da8204
498ab65
734ea86
3cfa8cf
a05df69
2838b83
3f17724
b73fd7f
c719c5c
4861789
59041b7
646f708
f5c8a4d
5e05e3f
dbf3a84
873005e
d5e0c8d
dbfb951
06e69a8
df75e66
6f15cc3
1b545e4
e0a00fd
008cacf
48ccfc9
225eb47
acc9183
1c56016
1f02cb4
2f83f16
abb61c1
0df47b0
c1c4fcd
2c5a20c
8706404
98a4b1f
ced6077
da4814c
d20278a
530e4d2
99bd08b
df990d3
1632747
dc3328e
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 |
|---|---|---|
|
|
@@ -514,8 +514,8 @@ fn nominating_and_rewards_should_work() { | |
| total: 1000 + 800, | ||
| own: 1000, | ||
| others: vec![ | ||
| IndividualExposure { who: 3, value: 400 }, | ||
| IndividualExposure { who: 1, value: 400 }, | ||
| IndividualExposure { who: 3, value: 400 }, | ||
| ] | ||
| }, | ||
| ); | ||
|
|
@@ -525,8 +525,8 @@ fn nominating_and_rewards_should_work() { | |
| total: 1000 + 1200, | ||
| own: 1000, | ||
| others: vec![ | ||
| IndividualExposure { who: 3, value: 600 }, | ||
| IndividualExposure { who: 1, value: 600 }, | ||
| IndividualExposure { who: 3, value: 600 }, | ||
| ] | ||
| }, | ||
| ); | ||
|
|
@@ -1860,13 +1860,13 @@ fn bond_with_duplicate_vote_should_be_ignored_by_election_provider() { | |
| // winners should be 21 and 31. Otherwise this election is taking duplicates into | ||
| // account. | ||
| let supports = <Test as Config>::ElectionProvider::elect().unwrap().0; | ||
| assert_eq!( | ||
| supports, | ||
| vec![ | ||
| assert!(supports_eq_unordered( | ||
| &supports, | ||
| &vec![ | ||
| (21, Support { total: 1800, voters: vec![(21, 1000), (3, 400), (1, 400)] }), | ||
| (31, Support { total: 2200, voters: vec![(31, 1000), (3, 600), (1, 600)] }) | ||
| ], | ||
| ); | ||
| )); | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -3958,7 +3958,7 @@ mod election_data_provider { | |
| #[test] | ||
| fn respects_len_limits() { | ||
| ExtBuilder::default().build_and_execute(|| { | ||
| assert_eq!(Staking::voters(Some(1)).unwrap_err(), "Voter snapshot too big"); | ||
| assert_eq!(Staking::voters(Some(1)).unwrap().0.len(), 1); | ||
|
Member
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 dont understand what this assertion tells us
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.
This PR changes that behavior: instead of raising an error, it now just produces only the requested number of voters in case a limit is present. This assertion is that, given more than one actual voter, but a requested limit of 1, the actual number of produced voters is 1. |
||
| assert_eq!(Staking::targets(Some(1)).unwrap_err(), "Target snapshot too big"); | ||
| }); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.