Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the @graphprotocol/issuance test suite from the previous Hardhat-based TypeScript setup to Foundry/Forge Solidity tests, and updates coverage generation/collection so Forge lcov output is picked up by CI (consistent with horizon and subgraph-service).
Changes:
- Remove the
packages/issuance/testingandpackages/issuance/testing-coverageHardhat test packages and their TS test suites. - Add Forge-based unit tests under
packages/issuance/test/unit/**(allocator, direct allocation, eligibility) plus supporting mocks. - Update package scripts and CI coverage discovery to generate and upload
coverage/lcov.infofromforge coverage.
Reviewed changes
Copilot reviewed 60 out of 62 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pnpm-lock.yaml |
Adds forge-std and removes lock entries for the deleted Hardhat testing workspaces. |
packages/subgraph-service/package.json |
Updates Forge coverage script to emit coverage/lcov.info for CI. |
packages/horizon/package.json |
Updates Forge coverage script to emit coverage/lcov.info for CI. |
packages/issuance/package.json |
Switches testing to forge test/forge coverage, adds test:coverage:self lcov output, and adds forge-std. |
packages/issuance/foundry.toml |
Adds forge-std remapping and Foundry lint configuration. |
.github/workflows/build-test.yml |
Expands coverage file discovery to include Forge lcov.info. |
packages/contracts/package.json |
Extends clean script to remove test/node_modules/. |
packages/issuance/.solcover.js |
Removes Hardhat/solidity-coverage configuration (now using Forge coverage). |
packages/issuance/test/unit/** (new) |
Introduces Forge unit tests for allocator, direct allocation, and eligibility modules. |
packages/issuance/test/unit/mocks/MockGraphToken.sol (new) |
Adds an ERC20-based token mock used by Forge tests. |
packages/issuance/testing/** (deleted) |
Removes the Hardhat v3 TS test harness and suites. |
packages/issuance/testing-coverage/** (deleted) |
Removes the Hardhat v2 + solidity-coverage setup. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issuance forge migration
🚨 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 #1298 +/- ##
==========================================
+ Coverage 86.95% 88.50% +1.54%
==========================================
Files 46 75 +29
Lines 2492 4611 +2119
Branches 746 979 +233
==========================================
+ Hits 2167 4081 +1914
- Misses 325 507 +182
- Partials 0 23 +23
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:
|
Port all allocator, eligibility, and direct-allocation tests from Hardhat/TypeScript to Forge/Solidity. Tests cover access control, distribution accounting, target management, defensive checks, interface compliance, interface ID stability, and operator functions. Mock contracts placed in test/unit/mocks/ for shared use across test suites. All 188 tests pass.
Delete testing/ and testing-coverage/ directories, .solcover.js, and associated workspace packages. Update package scripts to use forge test/coverage directly. Add forge-std dependency and forge-lint configuration (exclude mixed-case rules, ignore node_modules).
Add test:coverage:self scripts that output lcov.info to coverage/ for issuance, horizon, and subgraph-service. Create coverage dir before running forge coverage (forge does not create it). Update CI workflow to find both Istanbul JSON and lcov coverage files.
The test/ directories in issuance and contracts were previously pnpm workspace packages with their own package.json. After removing the Hardhat test infrastructure, the orphaned test/node_modules remains locally (pnpm does not clean up node_modules for removed workspace packages). Add them to the clean scripts so `pnpm clean` removes them for anyone who still has them.
269c94c to
6f22949
Compare
For upcoming audit wrote new issuance changes using Forge testing instead of Hardhat.
Migrating existing issuance tests to use Forge. Works better, and aligns with
horizonandsubgraph-service.Merge these separately to reduce audit branch noise.
Also fixes code coverage to pick Forge coverage.