-
Notifications
You must be signed in to change notification settings - Fork 162
Fix solidity linting issues across all packages #1242
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: main
Are you sure you want to change the base?
Conversation
- Add NatSpec documentation (@title, @author, @notice, @param) - Add solhint-disable directives with TODO comments for future fixes - Minor code formatting changes to address lint rules All packages now pass pnpm lint with no reported issues. Verified with scripts/compare-repo-contract-bytecode-excluding-metadata.mjs: only mock contracts have functional bytecode changes.
- Move 36 duplicate interface files from contracts and token-distribution to interfaces package - Update all import statements across contracts, token-distribution, horizon, and subgraph-service to use @graphprotocol/interfaces - Delete duplicate interface files from source packages - Fix pragma versions for compatibility across compiler configurations - Add @graphprotocol/interfaces dependency to token-distribution All builds and tests passing.
- Dual-version interfaces: ^0.7.x || ^0.8.0 (max compatibility) - V0.8-only interfaces: ^0.8.22 (modern features support) Interfaces should allow wider compiler version ranges for external consumer compatibility, while implementations use exact versions for predictable compilation. Dual-version files use ^0.8.0 since they can't leverage v0.8 features anyway. V0.8-only files use ^0.8.22 for custom errors and named mappings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add explanation of open-ended pragma ranges for interface compatibility and document available TypeScript type generation formats.
- Rename interface parameters to avoid conflicts with getter functions - Add parameter references in mock contracts to silence unused warnings - Configure hardhat-ignore-warnings for contracts/test package
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 resolves Solidity linting issues across the monorepo by adding comprehensive NatSpec documentation, implementing solhint suppressions for unavoidable violations, and standardizing interface compiler versions for improved package compatibility.
Key Changes:
- Added ~3,000 NatSpec comments across 260 files
- Implemented ~220 solhint suppressions with TODO comments for future fixes
- Standardized interface pragma versions (^0.8.22 for modern features, ^0.8.0 for dual-version compatibility)
- Removed duplicate interface contracts in favor of centralized interfaces package
Reviewed Changes
Copilot reviewed 263 out of 264 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/token-distribution/package.json | Added @graphprotocol/interfaces dependency |
| packages/token-distribution/contracts/tests/**/*.sol | Added solhint suppressions and updated imports to use interfaces package |
| packages/token-distribution/contracts/**/*.sol | Added solhint suppressions and updated imports to use interfaces package |
| packages/interfaces/contracts/**/*.sol | Standardized pragma versions and added comprehensive NatSpec documentation |
| packages/interfaces/README.md | Documented compiler version strategy and available type formats |
| packages/subgraph-service/contracts/**/*.sol | Added NatSpec documentation and updated imports |
| packages/horizon/contracts/**/*.sol | Added NatSpec documentation and updated imports to use interfaces package |
| packages/contracts/contracts/**/*.sol | Added solhint suppressions, NatSpec documentation, and updated imports |
| packages/data-edge/contracts/**/*.sol | Added NatSpec documentation |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| function onSubgraphAllocationUpdate(bytes32 subgraphDeploymentID) public pure returns (uint256) { | ||
| subgraphDeploymentID; // silence unused variable warning | ||
| return 0; | ||
| } |
Copilot
AI
Oct 20, 2025
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.
Using a statement with just the variable name to silence unused parameter warnings is not a standard Solidity pattern. Consider using a comment or omitting the parameter name instead (e.g., function onSubgraphAllocationUpdate(bytes32 /* subgraphDeploymentID */)).
| function onSubgraphAllocationUpdate(bytes32 subgraphDeploymentID) public pure returns (uint256) { | |
| subgraphDeploymentID; // silence unused variable warning | |
| return 0; | |
| } | |
| function onSubgraphAllocationUpdate(bytes32 /* subgraphDeploymentID */) public pure returns (uint256) { | |
| return 0; | |
| } | |
| } |
Fix solidity linting issues across all packages
🚨 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 #1242 +/- ##
==========================================
+ Coverage 82.84% 84.06% +1.21%
==========================================
Files 47 42 -5
Lines 2093 2071 -22
Branches 620 615 -5
==========================================
+ Hits 1734 1741 +7
+ Misses 359 330 -29
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:
|
Status:
This PR resolves all Solidity linting issues across the monorepo, enabling clean
pnpm lintexecution.Additionally:
Summary
@title,@author,@notice,@param,@return,@dev)Solhint Suppressions Added
Most common suppressed rules (all include TODO comments for future fixes):
gas-indexed-events(36) - Event parameters withoutindexeduse-natspec(36) - Legacy code without documentationnamed-parameters-mapping(25) - Requires Solidity ≥0.8.18immutable-vars-naming(19) - Non-UPPER_CASE immutablesgas-strict-inequalities(15) - Using<=vs<gas-custom-errors(7) - Usingrequire(0.7.6 limitation)no-inline-assembly(5) - Critical assembly blocksconst-name-snakecase(3) - Non-UPPER_CASE constantsVerification
✅ Bytecode comparison (compare script): Only mock/test contracts have functional changes (added
indexedto events). All production contracts are functionally identical.✅ All packages pass
pnpm lintwith zero errors/warnings