Skip to content

Conversation

@GheisMohammadi
Copy link
Collaborator

This PR fixes a critical bug in the leader rotation v2 implementation where the v2 logic was never actually being executed, even when the feature was enabled.

The issue was in the thread-safe wrapper for the decider. When NthNextValidatorV2 was called, it was incorrectly delegating to NthNextValidator instead of NthNextValidatorV2. This meant that even when the LeaderRotationV2Epoch was configured and the code path checked for v2, it would still use the v1 implementation with all its known corner cases and bugs.

The fix ensures that NthNextValidatorV2 properly calls the v2 implementation, which includes important improvements over v1 such as preventing infinite loops, proper index wrapping, and correct validator selection. This bug would have prevented v2 from being activated even after setting the activation epoch.

Additionally, this PR improves code readability by fixing variable shadowing in the rotateLeader function, where the inner loop variable was renamed from i to j to make the code clearer and less confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants