fix: don't remove kicked out validators in ping()#8
Conversation
WalkthroughThe changes update the logic in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant VotingContract
User->>VotingContract: Call ping()
VotingContract->>VotingContract: Iterate existing votes
alt For each validator vote
VotingContract->>VotingContract: Update stake to current (including zero)
end
VotingContract-->>User: Return updated votes map (including zero stakes)
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/lib.rs(2 hunks)tests/test_vote.rs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Tests
- GitHub Check: Build
- GitHub Check: Code Linter
- GitHub Check: Analyze (actions)
🔇 Additional comments (2)
src/lib.rs (1)
498-498: Test assertion correctly reflects the new behavior.The updated assertion expects 1 vote to remain after a validator is removed and
pingis called, which correctly reflects the new behavior of retaining zero-stake votes. This change aligns with the code modification at line 80.tests/test_vote.rs (1)
496-496: Test correctly validates the new zero-stake vote retention behavior.The updated assertion expecting 2 votes aligns perfectly with the code changes in
src/lib.rs. After unstaking from the first pool and voting on the second pool, both votes should be retained:
- First pool's vote with zero stake (retained by
pingmethod)- Second pool's vote with positive stake (newly added)
This test change ensures the new behavior is properly validated and prevents regressions.
ping()
ping()ping()
Currently the kicked out validators are removed from the votes.
We'd like to keep their votes and update the stake to
0if they're kicked out, so their stake will counted after they rejoined the validator set.Summary by CodeRabbit
Bug Fixes
Tests