test: add unit tests for TotalVotingPowerSafe (backport #5570)#5581
Merged
test: add unit tests for TotalVotingPowerSafe (backport #5570)#5581
Conversation
The 'tc := tc' pattern is no longer needed in modern Go versions (1.22+). This addresses reviewer feedback to clean up the code. (cherry picked from commit e030ded)
3 tasks
technicallyty
approved these changes
Jan 20, 2026
aljo242
approved these changes
Jan 21, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds comprehensive unit tests for the
TotalVotingPowerSafemethod intypes/validator_set.go, addressing the request in issue #5522.Changes
TestValidatorSet_TotalVotingPowerSafetotypes/validator_set_test.go.testify/requirefor strict assertions.MaxTotalVotingPower.MaxTotalVotingPower(checking that it returns the expected error).Related Issues
Closes #5522
PR checklist
.changelog(N/A:testonly change)docs/orspec/) and code commentsNote
Adds comprehensive unit tests for
TotalVotingPowerSafeintypes/validator_set_test.goto validate summation behavior and overflow handling.TestValidatorSet_TotalVotingPowerSafewith 11 cases: normal sums, nil/empty sets, single validator, boundaries atMaxTotalVotingPower, and multiple overflow scenarios (ensuring error with "exceeds maximum")NewValidatorSetto avoid panicWritten by Cursor Bugbot for commit a1931b6. This will update automatically on new commits. Configure here.
This is an automatic backport of pull request #5570 done by [Mergify](https://mergify.com).
Note
Adds comprehensive coverage for
TotalVotingPowerSafebehavior and overflow handling.TestValidatorSet_TotalVotingPowerSafeintypes/validator_set_test.goMaxTotalVotingPower, and multiple overflow cases (asserting error contains "exceeds maximum")NewValidatorSetto avoid panic during overflow scenarios; usesrequirefor strict assertionsWritten by Cursor Bugbot for commit bd517d2. This will update automatically on new commits. Configure here.