-
Notifications
You must be signed in to change notification settings - Fork 48
fix(DK): no empty addresses after draw #2060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ Deploy Preview for kleros-v2-neo failed. Why did it fail? →
|
❌ Deploy Preview for kleros-v2-university failed. Why did it fail? →
|
WalkthroughA zero-address check was added to the juror drawing logic in the dispute kit contract, ensuring that post-draw validation is only performed for non-zero addresses. Additionally, a new test was introduced to verify that no empty addresses are drawn when no jurors are staked. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DisputeKit
participant SortitionModule
User->>DisputeKit: draw()
DisputeKit->>SortitionModule: draw()
SortitionModule-->>DisputeKit: drawnAddress
alt drawnAddress != address(0)
DisputeKit->>DisputeKit: _postDrawCheck(drawnAddress)
alt _postDrawCheck passes
DisputeKit->>DisputeKit: Add vote, mark address as drawn
else _postDrawCheck fails
DisputeKit->>DisputeKit: Reset drawnAddress to zero
end
else drawnAddress == address(0)
DisputeKit->>DisputeKit: Skip post-draw check, return zero
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 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. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
✨ Finishing Touches🧪 Generate unit tests
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 (
|
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
PR-Codex overview
This PR focuses on enhancing the
DisputeKitClassicBase
by adding a check to handle cases where no addresses are drawn due to lack of stakes, along with a new test to ensure that empty addresses are not returned during the drawing phase.Detailed summary
DisputeKitClassicBase.sol
to returndrawnAddress
if it isaddress(0)
.test_draw_noEmptyAddresses
inKlerosCore.t.sol
to verify that no empty addresses are drawn when no one has staked.nbVoters
is0
in the new test.Summary by CodeRabbit
Bug Fixes
Tests