This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[NPoS] Implements dynamic number of nominators #12970
[NPoS] Implements dynamic number of nominators #12970
Changes from 43 commits
8cb3404
c9b8a17
fcc7657
3ae3e29
98f6e82
5434b47
0a7b714
1c347f9
9bf66c3
cdaeb7c
4e38839
11bd646
3fe1076
a1f77ad
905b8e0
775fe25
eb2456b
b0b21a4
82ac2db
8218e17
af0c52b
5b5231a
8e7ecbb
bfbb91b
2c44857
1bf29f7
125ff54
7d9fdfc
8fddf41
805e3f7
3317bd7
1c20979
8ba9e1e
761d7ae
3136966
8d78bee
397ce89
1349e6a
92b1231
42eeb97
5a29c9c
f51083b
d067a1c
422393c
fb418a9
b786d33
af3b8ba
7d8ffda
1246c73
325c91f
1f8f502
67c4734
70d8579
a68a37d
849a2e0
306668e
7ec6305
e8576b7
e12f287
c7acde4
61a8ca5
5c8a034
187ce07
9023997
ee5c863
c3b4375
9f0319d
bece9d5
8bd5ce9
7970ade
208ee20
6c5b3b1
6619b5d
02d8e78
4805516
d18b175
31ed378
4769857
a5cd416
742f07d
fe61184
87945f6
75be862
b3aab85
bc0e8bd
aab74d6
fe2dfe3
491ddfc
8bfd731
747aa52
0bda7a4
157e3a7
3c3fc5a
86ab41c
e4f7f9f
07c4a7d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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.
We can just get rid of this. It is double checking some bounds that are already "guaranteed" to be met. If we are to check, we should also check the byte size (if possible to do cheaply).
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.
The goal here was to double check that the data coming from the election provider meet the expected bounds, since we have no guarantee that the data provider is properly implemented. fwiw, there are a couple of old test checking for this.
Regarding checking the size in bytes of the voter list, this pallet doesn't have the concept of size in bytes of a voter list, since that is a concept only on the data provider side (the size tracker and bounds are implemented on the data provider side). Given the point made above that EPM should not blindly trust the data provider, perhaps we could also add the size in bytes of the voter list checks in EPM (needs a new bound config for this pallet), or we could just assume the data provider always behaves as expected and remove the checks altogether. wdyt?
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.
Added voter size checks here too.
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.
Your point about this pallet not dealing with byte size is correct, but in extension it would also not have to deal with
length
either.In principle, this pallet only knows that there is an
election_bounds
, which hasvoters
andtargets
, and once passed to theT::DataProvider
, they need to berespected
.If you were to do this pedantically, you would make the fields of
ElectionProviderBounds
private to hide this actually.I would formulate this then as:
and then inside
ensure_respected
implementation you can check length, and check byte-size again as well.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.
This is a great input. I have refactored this code and it ended up much simpler, thanks!