Open
Conversation
- Remove dead CircuitBreakerStatePrefix (prefix 53) from keys.go; the implementation already uses string-based CircuitBreakerStateKey with KeyPrefix() consistently. Reserved comment added so prefix 53 is not reused accidentally. - Add nil guard in buildSelectionWeightsMap() for eg.GroupData == nil; defensive change to prevent a nil-dereference panic in the unlikely case EpochGroup is constructed without NewEpochGroup(). - Document zero-value governance param caveat in getCBParams(): setting any CB param to 0 via governance silently falls back to compile-time defaults. Prefer large values (e.g. CbMissThresholdPct=100) to disable threshold enforcement rather than zero. Addresses reviewer follow-up from issue #30.
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
Follow-up cleanup items from the reviewer's feedback on the circuit breaker + reputation-adjusted selection PR (reviewed in issue #30).
Changes
Remove dead
CircuitBreakerStatePrefix(types/keys.go) — Thecollections.NewPrefix(53)variable was defined but never referenced; all CB store access uses the string-basedCircuitBreakerStateKeywithKeyPrefix()consistently. A comment now reserves prefix 53 to prevent accidental reuse.Nil guard in
buildSelectionWeightsMap(epochgroup/random.go) — Adds a defensiveeg.GroupData == nilcheck to prevent a nil-pointer panic. In practiceGroupDatais always set byNewEpochGroup, but the guard is cheap and makes the invariant explicit.Document zero-value governance param caveat (
keeper/circuit_breaker.go) —getCBParamstreats zero as "unset" (falls back to compile-time defaults). This means operators cannot disable CB enforcement by setting a param to 0 via governance. The new comment explains why (0 would exclude every node) and recommends using large values instead.Addresses issue #30