Skip to content

test: improve horizon and subgraph-service test coverage#1299

Merged
RembrandtK merged 2 commits intomainfrom
improve-test-coverage
Feb 27, 2026
Merged

test: improve horizon and subgraph-service test coverage#1299
RembrandtK merged 2 commits intomainfrom
improve-test-coverage

Conversation

@RembrandtK
Copy link
Contributor

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

@RembrandtK RembrandtK requested a review from Copilot February 27, 2026 15:30
@RembrandtK RembrandtK marked this pull request as ready for review February 27, 2026 15:33
@RembrandtK RembrandtK self-assigned this Feb 27, 2026
Copy link
Contributor

Copilot AI left a 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 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.

tmigone
tmigone previously approved these changes Feb 27, 2026
Copy link
Member

@tmigone tmigone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

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
@openzeppelin-code
Copy link

test: improve horizon and subgraph-service test coverage

Generated at commit: ddee12b111c4ac627c0c608294798c93e47ea3b7

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
5
0
14
37
59
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.55%. Comparing base (6f22949) to head (ddee12b).
⚠️ Report is 2 commits behind head on main.

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     
Flag Coverage Δ
unittests 88.55% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RembrandtK RembrandtK merged commit ddee12b into main Feb 27, 2026
6 checks passed
@RembrandtK RembrandtK deleted the improve-test-coverage branch February 27, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants