Skip to content

Conversation

@RembrandtK
Copy link
Contributor

This PR resolves all Solidity linting issues across the monorepo, enabling clean pnpm lint execution.

Summary

  • 260 files changed (+5,087 / -1,569 lines)
  • ~3,000 NatSpec comments added (@title, @author, @notice, @param, @return, @dev)
  • ~220 solhint suppressions with TODO comments for unavoidable violations

Solhint Suppressions Added

Most common suppressed rules (all include TODO comments for future fixes):

  • gas-indexed-events (36) - Event parameters without indexed
  • use-natspec (36) - Legacy code without documentation
  • named-parameters-mapping (25) - Requires Solidity ≥0.8.18
  • immutable-vars-naming (19) - Non-UPPER_CASE immutables
  • gas-strict-inequalities (15) - Using <= vs <
  • gas-custom-errors (7) - Using require (0.7.6 limitation)
  • no-inline-assembly (5) - Critical assembly blocks
  • const-name-snakecase (3) - Non-UPPER_CASE constants
  • Other gas optimizations and formatting rules

Verification

Bytecode comparison (compare script): Only mock/test contracts have functional changes (added indexed to events). All production contracts are functionally identical.

All packages pass pnpm lint with zero errors/warnings

- 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.
Security fixes:
- Replace shell command string interpolation with safer argument
  construction in verify-solhint-disables.mjs
- Replace `find` shell command with Node.js fs API (walkDir) to
  eliminate command injection risk

Code quality improvements:
- Make metadata stripping regex more precise in bytecode comparison
- Replace double negation with clearer null check in build script
The previous attempt to make the metadata regex more precise used an
incorrect pattern that expected 64 hex characters for the IPFS hash,
but the actual CBOR format contains 68 hex characters (34 bytes).

Solidity metadata structure (CBOR-encoded):
- a264697066735822 = {"ipfs": bytes(
- [68 hex chars] = 34-byte IPFS multihash (0x1220 prefix + 32-byte hash)
- 64736f6c63 = "solc"
- [variable] = version bytes

The incorrect regex failed to match, causing metadata to remain in the
bytecode and producing false positive differences (106 contracts
reported as changed when only 2 mock contracts actually changed).

Verified with full comparison: 150 contracts functionally identical,
only 2 test mocks have legitimate changes (added 'indexed' to events).
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 PR addresses all Solidity linting issues across the monorepo to enable clean pnpm lint execution. The changes include adding over 3,000 NatSpec comments and approximately 220 solhint suppressions for unavoidable violations.

Key Changes:

  • Added comprehensive NatSpec documentation (@title, @author, @notice, @param, @return, @dev) to contracts across all packages
  • Added strategic solhint suppressions with TODO comments for rules that cannot be immediately fixed
  • Updated bytecode comparison script to improve metadata hash stripping accuracy

Reviewed Changes

Copilot reviewed 264 out of 264 changed files in this pull request and generated 3 comments.

File Description
scripts/verify-solhint-disables.mjs Improved argument handling and cross-platform compatibility
scripts/compare-repo-contract-bytecode-excluding-metadata.mjs Enhanced metadata hash pattern matching
Multiple contract files Added comprehensive NatSpec documentation and solhint suppressions
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@openzeppelin-code
Copy link

chore(contracts): fix solidity linting issues across all packages

Generated at commit: 6b37ad1c2f774dcf68e031e559726ef794714b6f

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
5
0
15
38
60
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 Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.06%. Comparing base (9f1d52d) to head (6b37ad1).
⚠️ Report is 4 commits behind head on build-lint-upgrade-2.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           build-lint-upgrade-2    #1238   +/-   ##
=====================================================
  Coverage                 84.05%   84.06%           
=====================================================
  Files                        42       42           
  Lines                      2070     2071    +1     
  Branches                    615      615           
=====================================================
+ Hits                       1740     1741    +1     
  Misses                      330      330           
Flag Coverage Δ
unittests 84.06% <100.00%> (+<0.01%) ⬆️

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
Copy link
Contributor Author

Subsequent commits to keep in sync with changes to #1237:

(Rather than for Solidity lint fixes.)

@RembrandtK
Copy link
Contributor Author

Replaced by: #1239

@RembrandtK RembrandtK closed this Oct 15, 2025
@RembrandtK RembrandtK deleted the solidity-lint-fixes branch October 15, 2025 15:06
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.

1 participant