Skip to content

chore: remove panic#5525

Merged
aljo242 merged 1 commit intov0.37.xfrom
technicallyty/no-panic-v0.37.x
Dec 12, 2025
Merged

chore: remove panic#5525
aljo242 merged 1 commit intov0.37.xfrom
technicallyty/no-panic-v0.37.x

Conversation

@technicallyty
Copy link
Collaborator

@technicallyty technicallyty commented Dec 12, 2025

removes a panic from code

PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

Note

Replaces panics on total voting power overflow with error returns, adds a safe accessor, and updates callers and tests accordingly.

  • types/validator_set.go:
    • updateTotalVotingPower now returns error instead of panicking on overflow; propagates error where applicable.
    • Added TotalVotingPowerSafe() to compute/return total voting power or an error.
    • TotalVotingPower() now panics only if updateTotalVotingPower() returns an error.
    • Updated callers: updateWithChangeSet, ValidatorSetFromProto, and ValidatorSetFromExistingValidators to handle/propagate errors.
  • tests (types/validator_set_test.go):
    • Added TestValidatorSetFromProtoReturnsErrorOnOverflow.
    • Adjusted tests to handle new error-returning behavior (e.g., checking require.NoError from updateTotalVotingPower).

Written by Cursor Bugbot for commit d7d7ae4. This will update automatically on new commits. Configure here.

@technicallyty technicallyty requested a review from a team as a code owner December 12, 2025 17:53
@aljo242 aljo242 merged commit c7fcdb4 into v0.37.x Dec 12, 2025
20 of 25 checks passed
@aljo242 aljo242 deleted the technicallyty/no-panic-v0.37.x branch December 12, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants