[AUDIT][LOW][CX_HARDENING] - Add Bespoke Tests For VoteDependencyHandle #3517
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.
Closes #3452
This PR:
Currently our vote task tests are not invariant to all possible orderings
Quorum Vote Task has a problem during its units tests where no matter what order the events are received,
QuorumProposalValidated
is ALWAYS the first event processed whenhandle_dep_result
is called within the dependency task:Consider this list of events
The
events
vec will always shuffle DaCertificateRecv and VIDShareRecv accordingly, but QuorumProposalValidated is ALWAYS first, even when it comes last in the inputs. This is due to how the events are processed in the unit test:Starting here, we begin processing events. If you notice, however, we deviate our behavior slightly from the Quorum Proposal Task here. The event is optional because of these:
The proposal task has no use for validation, but voting does, which means its custom events incur a rebroadcast delay (however slight), but only for the above tasks, not
QuorumProposalValidated
, leading to it always being the first event received by the spawned dependency tasks. As a result, these events begetNone
in the above code block when creating the background task in the voting logic, but the value is ALWAYSSome
and, hence, does not useOption
in the same function for the proposal task.Because of this, during the testing, the events are applied instantly, meaning that the infinitessimal delay in broadacast to create the new DaCertificate and VidShare events always results in QuorumProposalValidated getting there first, meaning that we cannot ever have a test where this does not happen first in the current logic.
This PR adds a specific test to the vote dependency task with all permutations.
This PR does not:
Key places to review: