Skip to content

Fix validator set diff tests #1744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2023
Merged

Fix validator set diff tests #1744

merged 1 commit into from
Jul 21, 2023

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

Some of the validator set diff tests currently act unexpectedly.

  • Panic rather than fail
  • Fail if the underlying implementation doesn't cache values

Refactored out of #1611.

How this works

Fixes the tests

How this was tested

Running the tests

@StephenButtolph StephenButtolph added the testing This primarily focuses on testing label Jul 20, 2023
@StephenButtolph StephenButtolph added this to the v1.10.6 milestone Jul 20, 2023
@@ -189,7 +189,7 @@ func TestGetValidatorsSetProperty(t *testing.T) {
return fmt.Sprintf("failed GetValidatorSet: %s", err.Error())
}
if !reflect.DeepEqual(validatorsSet, res) {
return fmt.Sprintf("failed validators set comparison: %s", err.Error())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err is nil here - so this used to panic.

return database.ErrNotFound
}
if val.PublicKey != expectedBlsKey {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check assumes that the PublicKey pointer is equal, not the actual public key... Which means this is requiring the key to have been cached and not re-parsed.

Copy link
Contributor

@samliok samliok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good :)

@StephenButtolph StephenButtolph merged commit 1e8f790 into dev Jul 21, 2023
@StephenButtolph StephenButtolph deleted the fix-validator-set-tests branch July 21, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants