Harden contract, add ERC-20 recovery, and improve tooling#1
Merged
Conversation
Contract: - Migrate all require-strings to typed custom errors (lower deploy/revert gas) - Add dedicated FundsRecovered event instead of reusing Forwarded - Add recoverERC20() to sweep tokens accidentally sent to the contract Config: - Enable the Solidity optimizer (runs: 200) - Fix license inconsistency: package.json/README now MIT to match SPDX headers - Fill in package.json metadata (name, author, keywords, repository) Tooling: - Add solhint config and `npm run lint` script - Add Solidity linting and Slither static analysis to CI Tests: - Add MockERC20 helper and ERC-20 recovery / FundsRecovered test cases - Update assertions to revertedWithCustomError (49 -> 54 tests, all passing) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add slither.config.json: exclude test helpers (contracts/test/) and node_modules from analysis, plus informational/optimization noise. This drops the `suicidal` finding on the ForceFeeder test helper. - Annotate forwardFunds() with slither-disable-next-line arbitrary-send-eth: targetWallet is an owner-managed, validated, time-locked destination, not user-supplied — the High-severity finding is a false positive here. - Wire slither.config.json into the CI Slither step. Keeps `fail-on: high` intact so genuine high-severity findings still block. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
SP1R4
added a commit
that referenced
this pull request
May 22, 2026
* Harden contract, add ERC-20 recovery, and improve tooling Contract: - Migrate all require-strings to typed custom errors (lower deploy/revert gas) - Add dedicated FundsRecovered event instead of reusing Forwarded - Add recoverERC20() to sweep tokens accidentally sent to the contract Config: - Enable the Solidity optimizer (runs: 200) - Fix license inconsistency: package.json/README now MIT to match SPDX headers - Fill in package.json metadata (name, author, keywords, repository) Tooling: - Add solhint config and `npm run lint` script - Add Solidity linting and Slither static analysis to CI Tests: - Add MockERC20 helper and ERC-20 recovery / FundsRecovered test cases - Update assertions to revertedWithCustomError (49 -> 54 tests, all passing) * Triage Slither false positives so static-analysis passes - Add slither.config.json: exclude test helpers (contracts/test/) and node_modules from analysis, plus informational/optimization noise. This drops the `suicidal` finding on the ForceFeeder test helper. - Annotate forwardFunds() with slither-disable-next-line arbitrary-send-eth: targetWallet is an owner-managed, validated, time-locked destination, not user-supplied — the High-severity finding is a false positive here. - Wire slither.config.json into the CI Slither step. Keeps `fail-on: high` intact so genuine high-severity findings still block. ---------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improvements across the FundForwarder contract, build config, and tooling. All 54 tests pass with 100% line & function coverage; Solidity lints clean.
Contract
require-strings to 11 typed custom errors for lower deploy/revert gas (modern OZ-v5 idiom).FundsRecoveredevent —recoverFunds()now emits a dedicated event instead of misusingForwarded, so indexers can distinguish a recovery from a normal forward.recoverERC20(address token)— sweeps ERC-20 tokens accidentally sent to the contract (previously stuck forever). Owner-only,SafeERC20, reentrancy-guarded; emitsERC20Recovered.Config
hardhat.config.js(runs: 200) — smaller bytecode, lower runtime gas.package.jsonand README now say MIT, matchingLICENSEand all SPDX headers (previously ISC).package.jsonmetadata (name, author, keywords, repository, description).Tooling
.solhint.json/.solhintignore(solhint:recommended,gas-custom-errorsenforced) and annpm run lintscript.fail-on: high) as a separate job.Tests
MockERC20helper plus ERC-20 recovery andFundsRecoveredtest cases (49 → 54 tests).revertedWithCustomError.🤖 Generated with Claude Code