-
Notifications
You must be signed in to change notification settings - Fork 163
REO: Documentation fixes for audit issues TRST-L-1 and TRST-L-2 #1265
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
base: rewards-eligibility-oracle-4
Are you sure you want to change the base?
REO: Documentation fixes for audit issues TRST-L-1 and TRST-L-2 #1265
Conversation
Addresses audit finding TRST-L-1 by documenting the behavior when eligibility period is set to an extremely large value. For never- registered indexers with zero timestamp, when eligibilityPeriod is large enough that (block.timestamp < 0 + eligibilityPeriod) evaluates to true, all indexers become eligible. - Added NatSpec documentation to isEligible() function - Updated contract-level documentation - Added detailed edge case section to RewardsEligibilityOracle.md - Added comprehensive test validating the edge case behavior
…s (TRST-L-2) Add comprehensive documentation for TRST-L-2 race condition where configuration changes (reducing eligibility period or enabling validation) can cause indexers to permanently lose rewards if their claim transactions are in-flight when the change occurs. Changes include: - NatSpec warnings on setEligibilityPeriod() and setEligibilityValidation() - Contract-level security warning in RewardsEligibilityOracle - Operational considerations section in documentation with mitigation strategies - Monitoring guidance for operators and indexers No code changes - mitigation relies on operational practices.
REO: Documentation fixes for audit issues TRST-L-1 and TRST-L-2
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses two audit findings (TRST-L-1 and TRST-L-2) by adding comprehensive documentation about edge cases and operational considerations for the RewardsEligibilityOracle contract.
Key Changes:
- Documents the edge case where extremely large eligibility periods make all indexers eligible (TRST-L-1)
- Documents race condition risks with configuration changes affecting in-flight reward claim transactions (TRST-L-2)
- Adds comprehensive test case validating the large eligibility period edge case behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/issuance/test/tests/eligibility/RewardsEligibilityOracle.test.ts | Adds new test case to validate that never-registered indexers become eligible when eligibility period exceeds block timestamp |
| packages/issuance/contracts/eligibility/RewardsEligibilityOracle.sol | Adds NatSpec documentation explaining the large eligibility period edge case and race condition warnings to configuration functions |
| packages/issuance/contracts/eligibility/RewardsEligibilityOracle.md | Adds detailed documentation sections covering the edge case, race condition scenarios, mitigation strategies, and monitoring guidance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/issuance/contracts/eligibility/RewardsEligibilityOracle.md
Outdated
Show resolved
Hide resolved
packages/issuance/contracts/eligibility/RewardsEligibilityOracle.sol
Outdated
Show resolved
Hide resolved
packages/issuance/contracts/eligibility/RewardsEligibilityOracle.md
Outdated
Show resolved
Hide resolved
packages/issuance/contracts/eligibility/RewardsEligibilityOracle.md
Outdated
Show resolved
Hide resolved
…wing (#1268) Replace vm.assume with bounded inputs to fix "vm.assume rejected too many inputs" error. The previous implementation used overly restrictive constraints that caused the fuzzer to reject most random inputs. Now limits amountThawing and amountCollected to half of MAX_STAKING_TOKENS, guaranteeing valid deposit ranges while maintaining test coverage.
- Change 'eligible period' to 'eligibility period' for consistency - Fix 'have confidence is being able' to 'have confidence in being able' - Fix 'have a good transparency' to 'have good transparency' - Change 'Reward Manager' to 'RewardsManager' for correct contract naming
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## rewards-eligibility-oracle-4 #1265 +/- ##
=============================================================
Coverage 85.07% 85.07%
=============================================================
Files 44 44
Lines 2178 2178
Branches 649 649
=============================================================
Hits 1853 1853
Misses 325 325
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TRST-L-1: Large Eligibility Period Edge Case
Documents the behavior when
eligibilityPeriodis set to an extremely large value exceedingblock.timestamp. In this edge case, all indexers (including never-registered ones) become eligible because the checkblock.timestamp < 0 + eligibilityPeriodevaluates to true.Changes:
@devnote explaining the edge caseisEligible()functionTRST-L-2: Race Condition with Configuration Changes
Documents the race condition risk where configuration changes (reducing eligibility period or enabling validation) can cause indexers to permanently lose rewards if their claim transactions are in-flight when changes occur.
Changes:
@custom:security-warningabout race conditions@custom:warningtosetEligibilityPeriod()@custom:warningtosetEligibilityValidation()