test: improve horizon and subgraph-service test coverage#1299
test: improve horizon and subgraph-service test coverage#1299RembrandtK merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive test coverage for the SubgraphService and Horizon PaymentsEscrow components, focusing on edge cases, error handling, access control, and state isolation.
Changes:
- Added positive and negative test cases for SubgraphService slash functionality with fuzzed token amounts and rewards
- Added governance tests for pause guardian management, pause/unpause operations, and maxPOIStaleness configuration
- Added getter function tests for SubgraphService including allocation data and parameter ranges
- Added dispute manager tests for non-pending dispute error handling (accept, draw, cancel operations)
- Added PaymentsEscrow tests for constructor validation, state isolation, boundary conditions, and collection edge cases
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/subgraph-service/test/unit/subgraphService/slash.t.sol | Added comprehensive slash tests including zero reward case and reward exceeding max verifier cut |
| packages/subgraph-service/test/unit/subgraphService/governance/pauseGuardian.t.sol | Added tests for pause guardian set/remove operations and access control |
| packages/subgraph-service/test/unit/subgraphService/governance/pause.t.sol | Added tests for pause/unpause functionality and guard access restrictions |
| packages/subgraph-service/test/unit/subgraphService/governance/maxPOIStaleness.t.sol | Added tests for maxPOIStaleness parameter configuration |
| packages/subgraph-service/test/unit/subgraphService/getters.t.sol | Added tests for getAllocationData, provision token range, thawing period range, and verifier cut range getters |
| packages/subgraph-service/test/unit/disputeManager/disputes/disputes.t.sol | Added tests verifying that accept, draw, and cancel operations revert for non-pending disputes |
| packages/horizon/test/unit/escrow/withdraw.t.sol | Added boundary test for withdrawal timing (though duplicates existing coverage) |
| packages/horizon/test/unit/escrow/paused.t.sol | Added test for cancelThaw reverting when paused |
| packages/horizon/test/unit/escrow/isolation.t.sol | Added comprehensive state isolation tests for different payer/collector/receiver tuples |
| packages/horizon/test/unit/escrow/constructor.t.sol | Added constructor validation tests for thawing period boundaries |
| packages/horizon/test/unit/escrow/collect.t.sol | Added tests for collecting entire balance, tokensThawing capping behavior, and inconsistent collection error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PaymentsEscrow: - thaw() with evenIfTimerReset=false (skip, proceed, same-block) - thaw() no-op when requested equals current thawing - Constructor validation (PaymentsEscrowThawingPeriodTooLong) - cancelThaw() and thaw(,,, false) when paused - Withdraw boundary at exact thawEndTimestamp - Collect: entire balance, tokensThawing cap to zero resets thawEndTimestamp, PaymentsEscrowInconsistentCollection error - State isolation across different payer/collector/receiver tuples SubgraphService: - slash: positive cases (fuzzed tokens/reward), zero reward, reward exceeds max verifier cut - getters: getAllocationData (open + non-existent), getProvisionTokensRange, getThawingPeriodRange, getVerifierCutRange - governance: setMaxPOIStaleness, setPauseGuardian (add/remove/no-change), pause/unpause behavior and access control DisputeManager: - onlyPendingDispute branch tests for accept, draw, and cancel with non-pending disputes - Fix view annotation on query test helper
e011732 to
ddee12b
Compare
test: improve horizon and subgraph-service test coverage
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1299 +/- ##
==========================================
+ Coverage 88.50% 88.55% +0.05%
==========================================
Files 75 75
Lines 4611 4615 +4
Branches 979 981 +2
==========================================
+ Hits 4081 4087 +6
Misses 507 507
+ Partials 23 21 -2
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:
|
PaymentsEscrow:
SubgraphService:
DisputeManager: