This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Improved election pallet testing #12327
Merged
paritytech-processbot
merged 22 commits into
paritytech:master
from
Szegoo:election-testing
Oct 4, 2022
Merged
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f978433
Improved election pallet testing
Szegoo ef0c223
Merge branch 'master' into election-testing
Szegoo 2f2c8b5
fmt
Szegoo 0494a89
remove comment
Szegoo d64de36
more checks
Szegoo 0d3478f
fixes in logic
Szegoo be05c37
roll_to_signed
Szegoo a0e24ca
switch to roll_to_signed
Szegoo e861d57
Update frame/election-provider-multi-phase/src/mock.rs
Szegoo 97b30c4
remove useless checks
Szegoo b2d1859
remove warning
Szegoo 818c404
add checks to signed.rs
Szegoo 956de55
add some checks to unsigned.rs
Szegoo c8a3b4e
Merge branch 'master' into election-testing
Szegoo b4c162c
fmt
Szegoo 779e300
use roll_to_signed and roll_to_unsigned
Szegoo b9a008d
remove nonsense
Szegoo ac84324
remove even more nonsense
Szegoo bd128f3
fix
Szegoo 93cc43f
fix
Szegoo a403504
remove useless checks
Szegoo 7787315
Merge remote-tracking branch 'origin/master' into election-testing
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
Referring to line 1877.
I think if we are using this pattern then we should not use the exact block numbers explicitly in the code anymore.
What I mean is, the test should read something like this
My reasoning for this is, if we still have to keep track of block numbers, it defeats the purpose of using the pattern
roll_to_event()
Since we are actively moving forward till a certain phase is reached, we probably don't need this assertions at block 24 anyway. If there is a logical assertion needed here, may be it could be done a bit differently. For example,
block_unsigned_phase - block_signed_phase == 10
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.
cc @kianenigma
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 is to have as much "separation of concerns" as possible. There is one tests somewhere in there that checks
roll_to(x)
manually (calledphase_rotation_works
). All other tests should spend the minimum amount of mental effort to deal with phase related stuff, so I would stick toroll_to_signed
androll_to_unsigned
for the sake of simplicity.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.
I am agreeing with the pattern. I agree we can keep manual roll over for this test. There are still few more
roll_to()
checks that I think we can get rid of.