Skip to content
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

Fix Key Filtering In Validator #12358

Merged
merged 1 commit into from
May 5, 2023
Merged

Fix Key Filtering In Validator #12358

merged 1 commit into from
May 5, 2023

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented May 5, 2023

What type of PR is this?

Bug Fix

What does this PR do? Why is it needed?

In #12322 we introduced the ability to filter keys based on the current validator status. However the change introduced a bug which lead to only 1 key being passed into the MultipleValidatorStatus request. For an example on how this would happen:
https://go.dev/play/p/1cPEh5fYIvx

The PR copies the key and appends it to the slice along with modifying the unit test so that this particular case can be caught correctly.

Which issues(s) does this PR fix?

N.A

Other notes for review

@nisdas nisdas added Ready For Review A pull request ready for code review Builder PR or issue that supports builder related work labels May 5, 2023
@nisdas nisdas requested a review from a team as a code owner May 5, 2023 11:09
Comment on lines -1053 to +1054
statusRequestKeys = append(statusRequestKeys, k[:])
copiedk := k
statusRequestKeys = append(statusRequestKeys, copiedk[:])
Copy link
Member

Choose a reason for hiding this comment

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

There is a static analysis that catches this, i wonder why it didnt do it here? It's called loopclosure.

@james-prysm
Copy link
Contributor

Wow thanks I'm surprised nothing else caught this in my tests

@james-prysm james-prysm merged commit b662555 into develop May 5, 2023
@james-prysm james-prysm deleted the fixFiltering branch May 5, 2023 13:32
terencechain pushed a commit that referenced this pull request May 5, 2023
terencechain pushed a commit that referenced this pull request May 5, 2023
terencechain pushed a commit that referenced this pull request May 5, 2023
@nisdas nisdas mentioned this pull request May 9, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builder PR or issue that supports builder related work Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants